// CDN version 1.0.8.4
var orSuffix; // backward compatibity
(function() {
var utils = new loaderUtils();
orSuffix = utils.getDomain();
var defaultLibSettings = getDefaultLibSettings();
var element = utils.getScriptElement();
var src = element.getAttribute('src');
var queryStrings = utils.getQueryStrings(src);
if (queryStrings) {
for (var i = 0; i < defaultLibSettings.length; i++) {
var _setting = defaultLibSettings[i];
var value = queryStrings[_setting.key.toLowerCase()];
if (value) {
loadLib(_setting);
}
}
}
function loadLib(setting) {
if (setting) {
var flag = utils.getQueryString(src, setting.key);
if (flag && flag.toLowerCase() == 'true') {
var version = utils.getQueryString(src, setting.key + '_ver');
document.write(setting.createElement(version));
}
}
}
}());
function libSetting(_key, _version, _pathPrefix, _pathSuffix, createPathOverride, createElementOverride) {
var self = this;
self.key = _key;
self.version = _version;
self.pathPrefix = _pathPrefix;
self.pathSuffix = _pathSuffix;
if (createPathOverride) {
self.createPath = createPathOverride;
} else {
self.createPath = function(ver) {
if (ver == null)
ver = self.version;
return "https://" + self.pathPrefix + ver + self.pathSuffix;
};
}
if (createElementOverride) {
self.createElement = createElementOverride;
} else {
self.createElement = function(ver) {
var path = self.createPath(ver);
if (self.key.toLowerCase().indexOf('css') >= 0) {
return '<link rel="stylesheet" href="' + path + '">';
} else {
return '<script src="' + path + '"></script>';
}
};
}
}
function loaderUtils() {
var self = this;
var _url;
var _queryStrings = [];
var orDomain;
self.getScriptElement = function() {
var tempId = 'temp_element_script';
document.write('<script id="' + tempId + '"></script>');
var tempElement = document.getElementById(tempId);
var scriptElement = tempElement.previousSibling;
tempElement.parentNode.removeChild(tempElement);
return scriptElement;
};
self.getQueryStrings = function(url) {
if (url && url != _url && url.indexOf('?') >= 0) {
var hash, key;
var hashes = url.split('?')[1].split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
key = hash[0].toLowerCase();
_queryStrings.push(key);
_queryStrings[key] = hash[1];
}
}
return _queryStrings;
};
self.getQueryString = function(url, name) {
return self.getQueryStrings(url)[name.toLowerCase()];
};
self.getDomain = function() {
if (orDomain == null) {
orDomain = window.location.host.toLowerCase();
if ((orDomain.indexOf("authoring-staging.apps.") !== -1) ||
(orDomain.indexOf("staging.apps.") !== -1) ||
(orDomain.indexOf("stage-apps.") !== -1) ||
(orDomain.indexOf("authoring-staging-sos.") !== -1) ||
(orDomain.indexOf("staging-courts.") !== -1) ||
(orDomain.indexOf("authoring-staging-courts.") !== -1) ||
(orDomain.indexOf("nws-stage.corp.") !== -1) ||
(orDomain.indexOf("or-dev-web01.") !== -1) ||
(orDomain.indexOf("eventreg-uat.") !== -1) ||
(orDomain.indexOf("localhost") !== -1) ||
(orDomain.indexOf("win-enrooqo0rtr") !== -1) ||
(orDomain.indexOf("10.211.55.4") !== -1) ||
(orDomain.indexOf("dev-wt.oregon.") !== -1) ||
(orDomain.indexOf("file") !== -1)) {
orDomain = "stage-apps.oregon.egov.com/Application/CDN";
} else {
orDomain = "apps.oregon.gov/Application/CDN";
}
}
return orDomain;
};
}
function orRequirePath(key) {
var defaultSettings = getDefaultLibSettings();
var keyMemberName = "key";
var javascriptFilePath = ".js";
for (var settingIndex in defaultSettings) {
var setting = defaultSettings[settingIndex];
if (setting.hasOwnProperty(keyMemberName) && setting[keyMemberName] === key) {
var requirePath = setting.createPath()
var lengthToJsFilePath = requirePath.length - javascriptFilePath.length;
if (requirePath.substring(lengthToJsFilePath, javascriptFilePath.length)) {
requirePath = requirePath.substring(0, lengthToJsFilePath);
};
return requirePath;
}
}
};
function getDefaultLibSettings() {
var utils = new loaderUtils();
return [
// css
new libSetting('bsCss', '3.3.7', 'cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/', '/css/bootstrap.min.css'),
new libSetting('jbCss', '3.1.3', 'cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/', '/css/jasny-bootstrap.min.css'),
new libSetting('fa3Css', '3.2.1', 'cdnjs.cloudflare.com/ajax/libs/font-awesome/', '/css/font-awesome.min.css'),
new libSetting('faCss', '4.7.0', 'cdnjs.cloudflare.com/ajax/libs/font-awesome/', '/css/font-awesome.min.css'),
new libSetting('material_iconsCss', '3.0.1', 'cdnjs.cloudflare.com/ajax/libs/material-design-icons/', '/iconfont/material-icons.css'),
new libSetting('dropzoneCss', '5.1.1', 'cdnjs.cloudflare.com/ajax/libs/dropzone/', '/min/dropzone.min.css'),
new libSetting('bootgridCss', '1.3.1', 'cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/', '/jquery.bootgrid.min.css'),
new libSetting('politespaceCss', '1.0.2', 'cdnjs.cloudflare.com/ajax/libs/politespace/', '/politespace.min.css'),
new libSetting('selectize_bs2Css', '0.12.4', 'cdnjs.cloudflare.com/ajax/libs/selectize.js/', '/css/selectize.bootstrap2.min.css'),
new libSetting('selectize_bsCss', '0.12.4', 'cdnjs.cloudflare.com/ajax/libs/selectize.js/', '/css/selectize.bootstrap3.min.css'),
new libSetting('datatablesCss', '1.10.15', 'cdnjs.cloudflare.com/ajax/libs/datatables/', '/css/dataTables.min.css'),
new libSetting('datatables_bsCss','jszip-3.1.3/pdfmake-0.1.27/dt-1.10.15/b-1.3.1/b-colvis-1.3.1/b-flash-1.3.1/b-html5-1.3.1/b-print-1.3.1/r-2.1.1', 'cdn.datatables.net/v/bs/', '/datatables.min.css'),
new libSetting('plyrCss', '3.0.11', 'cdnjs.cloudflare.com/ajax/libs/plyr/', '/plyr.css'),
new libSetting('jq_UICss', '1.11.4', 'cdnjs.cloudflare.com/ajax/libs/jqueryui/', '/themes/start/jquery-ui.min.css'),
// css local
new libSetting('bs_formCss', '2.3.0', utils.getDomain() + '/Enterprise/scripts/plugins/bootstrap-form-helpers/', '/css/bootstrap-formhelpers.min.css'),
new libSetting('assets_datepickerCss', '3.4.2', utils.getDomain() + '/Enterprise/scripts/plugins/fed-assets/', '/datepicker/css/datepicker.min.css'),
new libSetting('file_extCss', '', utils.getDomain() + '/Enterprise', '/css/file-ext.min.css'),
new libSetting('sp2010Css', '', utils.getDomain() + '/Enterprise/css/sharepoint/2010/', 'enterprise.min.css'),
// css not minified
new libSetting('bs_tabdropCss', '4.30.2015', utils.getDomain() + '/Enterprise/scripts/plugins/tabdrop/', '/css/tabdrop.css'),
new libSetting('bs_accCss', '1.0.3', utils.getDomain() + '/Enterprise/scripts/plugins/bootstrap-accessibility-plugin/', '/css/bootstrap-accessibility.css'),
new libSetting('helpful_page_ga_extCss', '1.0', utils.getDomain() + '/Enterprise/scripts/plugins/helpful-page-poll/ga.js/ext/', '/css/helpful-page-poll-ga-ext.css'),
// new libSetting('helpful_page_an_extCss', '1.0', utils.getDomain() + '/Enterprise/scripts/plugins/helpful-page-poll/analytics.js/ext/', '/css/helpful-page-poll-an-ext.css'),
new libSetting('oregonAppBs2Css', '', utils.getDomain() + '/Enterprise', '/css/app.css'),
new libSetting('oregonAppCss', '', utils.getDomain() + '/Enterprise', '/css/appBs3.css'),
// js
new libSetting('jq', '3.2.1', 'cdnjs.cloudflare.com/ajax/libs/jquery/', '/jquery.min.js'),
new libSetting('jq_UI', '1.11.4', 'cdnjs.cloudflare.com/ajax/libs/jqueryui/', '/jquery-ui.min.js'),
new libSetting('mod', '2.8.3', 'cdnjs.cloudflare.com/ajax/libs/modernizr/', '/modernizr.min.js'),
new libSetting('require', '2.3.3', 'cdnjs.cloudflare.com/ajax/libs/require.js/', '/require.min.js'),
new libSetting('require_text', '2.0.12', 'cdnjs.cloudflare.com/ajax/libs/require-text/', '/text.min.js'),
new libSetting('resp', '1.4.2', 'cdnjs.cloudflare.com/ajax/libs/respond.js/', '/respond.min.js'),
new libSetting('moment', '2.20.0', 'cdnjs.cloudflare.com/ajax/libs/moment.js/', '/moment.min.js'),
new libSetting('bs', '3.3.7', 'cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/', '/js/bootstrap.min.js'),
new libSetting('js_cookie', '2.1.2', 'cdnjs.cloudflare.com/ajax/libs/js-cookie/', '/js.cookie.min.js'),
new libSetting('jb', '3.1.3', 'cdnjs.cloudflare.com/ajax/libs/jasny-bootstrap/', '/js/jasny-bootstrap.min.js'),
new libSetting('tota11y', '0.1.6', 'cdnjs.cloudflare.com/ajax/libs/tota11y/', '/tota11y.min.js'),
new libSetting('ko', '3.4.2', 'cdnjs.cloudflare.com/ajax/libs/knockout/', '/knockout-min.js'),
new libSetting('kom', '2.4.1', 'cdnjs.cloudflare.com/ajax/libs/knockout.mapping/', '/knockout.mapping.min.js'),
new libSetting('kov', '2.0.3', 'cdnjs.cloudflare.com/ajax/libs/knockout-validation/', '/knockout.validation.min.js'),
new libSetting('dropzone', '5.1.1', 'cdnjs.cloudflare.com/ajax/libs/dropzone/', '/min/dropzone.min.js'),
new libSetting('bootgrid', '1.3.1', 'cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/', '/jquery.bootgrid.min.js'),
new libSetting('chart_js', '2.7.2', 'cdnjs.cloudflare.com/ajax/libs/Chart.js/', '/Chart.min.js'),
new libSetting('d3', '4.10.0', 'cdnjs.cloudflare.com/ajax/libs/d3/', '/d3.min.js'),
new libSetting('politespace', '1.0.2', 'cdnjs.cloudflare.com/ajax/libs/politespace/', '/politespace.min.js'),
new libSetting('plyr', '3.0.11', 'cdnjs.cloudflare.com/ajax/libs/plyr/', '/plyr.js'),
new libSetting('sizzle', '2.3.3', 'cdnjs.cloudflare.com/ajax/libs/sizzle/', '/sizzle.min.js'),
new libSetting('selectize', '0.12.4', 'cdnjs.cloudflare.com/ajax/libs/selectize.js/', '/js/standalone/selectize.min.js'),
new libSetting('sp_services', '2014.02', 'cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/', '/jquery.SPServices.min.js'),
new libSetting('outdated', '1.1.5', 'cdnjs.cloudflare.com/ajax/libs/outdated-browser/', '/outdatedbrowser.min.js'),
new libSetting('fileDownload', '1.4.2', 'cdnjs.cloudflare.com/ajax/libs/jquery.fileDownload/', '/jquery.fileDownload.min.js'),
new libSetting('spin', '2.3.2', 'cdnjs.cloudflare.com/ajax/libs/spin.js/', '/spin.min.js'),
new libSetting('datatables_require', '1.10.15', 'cdnjs.cloudflare.com/ajax/libs/datatables/', '/js/jquery.dataTables.min.js'),
new libSetting('datatables_require_bs', '1.10.15', 'cdnjs.cloudflare.com/ajax/libs/datatables/', '/js/dataTables.bootstrap.min.js'),
new libSetting('datatables_bs', 'jszip-3.1.3/pdfmake-0.1.27/dt-1.10.15/b-1.3.1/b-colvis-1.3.1/b-flash-1.3.1/b-html5-1.3.1/b-print-1.3.1/r-2.1.1', 'cdn.datatables.net/v/bs/', '/datatables.min.js'),
// js local
new libSetting('bs_form', '2.3.0', utils.getDomain() + '/Enterprise/scripts/plugins/bootstrap-form-helpers/', '/js/bootstrap-formhelpers.js'),
new libSetting('assets_datepicker', '3.4.1', utils.getDomain() + '/Enterprise/scripts/plugins/fed-assets/', '/datepicker/js/datepicker.js'),
new libSetting('bs_tabdrop', '4.30.2015', utils.getDomain() + '/Enterprise/scripts/plugins/tabdrop/', '/js/bootstrap-tabdrop.js'),
new libSetting('bs_acc', '1.0.3', utils.getDomain() + '/Enterprise/scripts/plugins/bootstrap-accessibility-plugin/', '/js/bootstrap-accessibility.min.js'),
new libSetting('oregon-sharepoint', '', utils.getDomain() + '/Enterprise/scripts/sharepoint/', 'oregon-sharepoint.js'),
new libSetting('sp2010', '', utils.getDomain() + '/Enterprise/scripts/sharepoint/2010/', 'enterprise.min.js'),
new libSetting('sp_webparts', '', utils.getDomain() + '/Enterprise/scripts/sharepoint/2010/', 'orgov-full.min.js'),
new libSetting('statewide', '', utils.getDomain() + '/Enterprise/statewide-data/', 'statewide-links.min.js'),
new libSetting('helpful_page_ga_bs', '2.0', utils.getDomain() + '/Enterprise/scripts/plugins/helpful-page-poll/ga.js/bs/', '/js/helpful-page-poll-ga-bs.min.js'),
// new libSetting('helpful_page_ga_ext', '1.0', utils.getDomain() + '/Enterprise/scripts/plugins/helpful-page-poll/ga.js/ext/', '/js/helpful-page-poll-ga-ext.min.js'),
new libSetting('helpful_page_an_bs', '2.0', utils.getDomain() + '/Enterprise/scripts/plugins/helpful-page-poll/analytics.js/bs/', '/js/helpful-page-poll-an-bs.min.js'),
// new libSetting('helpful_page_an_ext', '1.0', utils.getDomain() + '/Enterprise/scripts/plugins/helpful-page-poll/analytics.js/ext/', '/js/helpful-page-poll-an-ext.min.js'),
new libSetting('helpful_page_an_old_ext', '1.0', utils.getDomain() + '/Enterprise/scripts/plugins/helpful-page-poll/analytics.js/ext/', '/js/helpful-page-poll-an-old-ext.min.js'),
// js not minified
new libSetting('sp_reset', '', utils.getDomain() + '/Enterprise/scripts/sharepoint/2010/', 'sharepoint-2010-reset.js'),
new libSetting('oregonApp', '', utils.getDomain() + '/Enterprise/scripts/', 'oregonApp.js'),
new libSetting('form_val', '1.1.2', utils.getDomain() + '/Enterprise/scripts/plugins/form-validation/', '/js/form-validation.js'),
new libSetting('form_val_bs3', '1.1.2', utils.getDomain() + '/Enterprise/scripts/plugins/form-validation/', '/js/form-validation-bs3.js')
];
};