forked from jrast/Foldergallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrontend.js
5 lines (5 loc) · 993 Bytes
/
frontend.js
1
2
3
4
5
function loadjscssfile(filename,filetype){if(filetype=="js"){var fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");fileref.setAttribute("src",filename);}else if(filetype=="css"){var fileref=document.createElement("link")
fileref.setAttribute("rel","stylesheet");fileref.setAttribute("type","text/css");fileref.setAttribute("href",filename);}if(typeof fileref!="undefined"){document.getElementsByTagName("head")[0].appendChild(fileref);}}var filesadded=""
function checkloadjscssfile(filename,filetype){if(filesadded.indexOf("["+filename+"]")==-1){loadjscssfile(filename,filetype)
filesadded+="["+filename+"]"}else{alert("file already added!");}}function hexToRgb(hex){var shorthandRegex=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;hex=hex.replace(shorthandRegex,function(m,r,g,b){return r+r+g+g+b+b;});var result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);return result?{r:parseInt(result[1],16),g:parseInt(result[2],16),b:parseInt(result[3],16)}:null;}