1/** 2 * Droppics 3 * 4 * We developed this code with our hearts and passion. 5 * We hope you found it useful, easy to understand and to customize. 6 * Otherwise, please feel free to contact us at [email protected] * 7 * @package Droppics 8 * @copyright Copyright (C) 2013 JoomUnited (http://www.joomunited.com). All rights reserved. 9 * @copyright Copyright (C) 2013 Damien Barrère (http://www.crac-design.com). All rights reserved. 10 * @license GNU General Public License version 2 or later; http://www.gnu.org/licenses/gpl-2.0.html 11 */ 12 13/* Based on the work : http://www.javascriptkit.com/javatutors/loadjavascriptcss2.shtml */ 14 15var filesadded = ""; 16var stylesadded = ""; 17window.droppicsHeadLoaded = true; 18 19function loadHeadFiles(files){ 20 window.droppicsHeadLoaded = false; 21 files = eval(files); 22 for (var i = 0; i < files.length; ++i) { 23 loadHeadFile(files[i][0],files[i][1]); 24 } 25 window.droppicsHeadLoaded = true; 26} 27 28function loadHeadFile(filename, filetype){ 29 if (filesadded.indexOf("["+filename+"]")>0){ 30 return 1; 31 } 32 if (filetype=="js"){ 33 var fileref=document.createElement('script'); 34 fileref.setAttribute("type","text/javascript"); 35 fileref.setAttribute("src", filename); 36 }else if (filetype=="css"){ 37 var fileref=document.createElement("link"); 38 fileref.setAttribute("rel", "stylesheet"); 39 fileref.setAttribute("type", "text/css"); 40 fileref.setAttribute("href", filename); 41 } 42 if (typeof fileref!=="undefined"){ 43 document.getElementsByTagName("head")[0].appendChild(fileref); 44 filesadded+="["+filename+"]"; 45 return true; 46 } 47 return false; 48} 49 50function unloadHeadFile(filename, filetype){ 51 if(typeof filename==='undefined') return; 52 if(filename==='') return; 53 if(typeof filetype==='undefined'){ 54 unloadHeadFile(filename,'css'); 55 unloadHeadFile(filename,'js'); 56 }else{ 57 var targetelement=(filetype=="js")? "script" : (filetype=="css")? "link" : "none"; //determine element type to create nodelist from 58 var targetattr=(filetype=="js")? "src" : (filetype=="css")? "href" : "none"; //determine corresponding attribute to test for 59 var allsuspects=document.getElementsByTagName(targetelement); 60 for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove 61 if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null && allsuspects[i].getAttribute(targetattr).indexOf(filename)!=-1){ 62 allsuspects[i].parentNode.removeChild(allsuspects[i]); //remove element by calling parentNode.removeChild() 63 filesadded = filesadded.replace("["+filename+"]",""); 64 } 65 } 66 } 67} 68 69function unloadHeadFiles(){ 70 if(filesadded==='') return; 71 files = filesadded.split("]["); 72 for (var i=0; i < files.length; i++){ 73 files[i] = files[i].replace("[",""); 74 files[i] = files[i].replace("]",""); 75 unloadHeadFile(files[i]); 76 } 77} 78 79function loadHeadStyle(content,id){ 80 var fileref=document.createElement("style"); 81 fileref.setAttribute("type", "text/css"); 82 fileref.setAttribute("id", id); 83 fileref.innerHTML =content; 84 document.getElementsByTagName("head")[0].appendChild(fileref); 85 stylesadded+="["+id+"]"; 86} 87 88function unloadStyles(){ 89 files = str.split(stylesadded); 90 for (var style in styles){ 91 style = style.replace("[",""); 92 style = style.replace("]",""); 93 unloadStyleId(style); 94 } 95} 96 97function unloadStyleId(id){ 98 elem=document.getElementById(id); 99 if(elem){ 100 elem.parentNode.removeChild(elem); 101 } 102} 103 104function addParameter(parameterName, parameterValue) { 105 var url = pathname; 106 replaceDuplicates = true; 107 if (url.indexOf('#') > 0) { 108 var cl = url.indexOf('#'); 109 urlhash = url.substring(url.indexOf('#'), url.length); 110 urlhash = parameterValue+'-'+ parameterName + "&"+urlhash; 111 } else { 112 urlhash = parameterValue+'-'+ parameterName; 113 cl = url.length; 114 } 115 sourceUrl = url.substring(0, cl); 116 117 return sourceUrl + '#'+ urlhash; 118 119} 120 121//if no ie support maybe see http://stackoverflow.com/questions/1184950/dynamically-loading-css-stylesheet-
121doesnt-work-on-ie
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.