/** * Filemanager JS core * * filemanager.js * * @license MIT License * @author Jason Huck - Core Five Labs * @author Simon Georget * @copyright Authors */ (function($) { var jsRoot = "static/component/filemanager/"; var cssRoot = "static/component/filemanager/"; var jspRoot = "static/component/filemanager/"; // function to retrieve GET params $.urlParam = function(name){ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); if (results) return results[1]; else return 0; }; /*--------------------------------------------------------- Setup, Layout, and Status Functions ---------------------------------------------------------*/ // We retrieve config settings from filemanager.config.js var loadConfigFile = function (type) { var json = null; type = (typeof type === "undefined") ? "user" : type; if(type == 'user') { if($.urlParam('config') != 0) { var url = jsRoot + './scripts/' + $.urlParam('config'); userconfig = $.urlParam('config'); } else { var url = jsRoot + './scripts/filemanager.config.js'; userconfig = 'filemanager.config.js'; } } else { var url = jsRoot + './scripts/filemanager.config.js.default'; } $.ajax({ 'async': false, 'url': url, 'dataType': "json", cache: false, 'success': function (data) { json = data; } }); return json; }; // loading default configuration file var configd = loadConfigFile('default'); // loading user configuration file var config = loadConfigFile(); // we remove version from user config file if (config !== null) delete config.version; // we merge default config and user config file var config = $.extend({}, configd, config); if(config.options.logger) var start = new Date().getTime(); // included files collector HEAD_included_files = new Array(); getTheme = function(){ var theme = config.options.theme; var flag = (typeof jflyfox_theme != 'undefined'); if(flag) theme = jflyfox_theme; return theme; }; /** * function to load a given css file into header * if not already included */ loadCSS = function(href) { // we check if already included if($.inArray(href, HEAD_included_files) == -1) { var cssLink = $(""); $("head").append(cssLink); HEAD_included_files.push(href); } }; /** * function to load a given js file into header * if not already included */ loadJS = function(src) { // we check if already included if($.inArray(src, HEAD_included_files) == -1) { var jsLink = $("