File: assets/EXAMPLEs/rsLIB.min.js

Recommend this page to a friend!
  Classes of Juan Jose   rsLIB   assets/EXAMPLEs/rsLIB.min.js   Download  
File: assets/EXAMPLEs/rsLIB.min.js
Role: Example script
Content type: text/plain
Description: Example script
Class: rsLIB
Load JavaScript and CSS using AJAX requests
Author: By
Last change: Update of assets/EXAMPLEs/rsLIB.min.js
Date: 2 years ago
Size: 2,484 bytes
 

Contents

Class file image Download
var rsLIB=function(){"use-strict";function RSLIB_onComplete(e){_callback=e,_ready&&_callback()}function RSLIB_isset(e){return"UNDEFINED"!==e.toUpperCase()}function RSLIB_get(e,t){return _options&&_options[e]?_options[e]:t}function RSLIB_getThisScript(){var e=document.getElementById(RSLIB_ID);if(e)return e;for(var e,t=document.head||document.documentElement||document.getElementsByTagName("head")[0]||document.querySelector("head"),s=t.getElementsByTagName("script"),r=0;r<s.length;r++)if(s[r].className===RSLIB_CLASS){e=s[r];break}if(e)return e;for(var r=0;r<s.length;r++)if(s[r].src.indexOf(RSLIB_FILE)>-1){e=s[r];break}return e}var RSLIB_NAME="rsLIB",RSLIB_FILE=RSLIB_NAME+".js",RSLIB_ID=RSLIB_NAME+"_ID",RSLIB_CLASS=RSLIB_NAME+"_CLASS",_options=eval("("+RSLIB_getThisScript().innerHTML+")"),_callback=null,_ready=!1;return function(e){e.scripts=RSLIB_get("scripts",[]),e.nameLIB=RSLIB_get("nameLIB",""),e.pathToLIB=RSLIB_get("pathToLIB","./");var t=e.scripts.pop();e.scripts=e.scripts.reverse();for(var s=0;s<e.scripts.length;s++)if(e.scripts[s]){var r=e.scripts[s].split(".").pop(),a=e.scripts[s].indexOf("\\")>-1?e.scripts[s].split("\\").pop():e.scripts[s].split("/").pop();a=a.replace("\\","-").replace("/","-");var c;switch(r.toLowerCase()){case"css":c=document.createElement("link"),c.setAttribute("type","text/css"),c.setAttribute("rel","stylesheet"),c.setAttribute("media","screen"),c.setAttribute("href",e.scripts[s]);break;case"js":default:c=document.createElement("script"),c.setAttribute("type","text/javascript"),c.setAttribute("src",e.scripts[s])}c.setAttribute("id",a),c.setAttribute("class",RSLIB_NAME+"_"+e.nameLIB),e.scripts[s]===t&&(c.readyState?c.onreadystatechange=function(){("loaded"===c.readyState||"complete"===c.readyState)&&(c.onreadystatechange=null,_callback?_callback():_ready=!0)}:c.onload=function(){_callback?_callback():_ready=!0});for(var n,i=document.head||document.documentElement||document.getElementsByTagName("head")[0]||document.querySelector("head"),o=i.getElementsByTagName("script"),p=!0,l=0;l<o.length;l++){if(o[l].src===e.scripts[s]){p=!1;break}(o[l].id===RSLIB_ID||o[l].className===RSLIB_CLASS||o[l].src.indexOf(RSLIB_FILE)>-1)&&(n=o[l])}p&&i.insertBefore(c,n.nextSibling)}e.scripts=e.scripts.reverse(),RSLIB_getThisScript().innerHTML=""}(_options),{options:_options,nameLIB:RSLIB_get("nameLIB",""),pathToLIB:RSLIB_get("pathToLIB","./"),scripts:RSLIB_get("scripts",[]),get:RSLIB_get,isset:RSLIB_isset,onComplete:RSLIB_onComplete}}();