All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.cordova.browser.confighelper.min.js Maven / Gradle / Ivy

There is a newer version: 0.66.0.1
Show newest version
var config;function Config(xhr){function loadPreferences(xhr){var parser=new DOMParser;var doc=parser.parseFromString(xhr.responseText,"application/xml");var preferences=doc.getElementsByTagName("preference");return Array.prototype.slice.call(preferences)}this.xhr=xhr;this.preferences=loadPreferences(this.xhr)}function readConfig(success,error){var xhr;if(typeof config!="undefined"){success(config)}function fail(msg){console.error(msg);if(error){error(msg)}}var xhrStatusChangeHandler=function(){if(xhr.readyState==4){if(xhr.status==200||xhr.status==304||xhr.status===0){config=new Config(xhr);success(config)}else{fail("[Browser][cordova.js][xhrStatusChangeHandler] Could not XHR config.xml: "+xhr.statusText)}}};if("ActiveXObject"in window){xhr=new window.ActiveXObject("MSXML2.XMLHTTP");xhr.onreadystatechange=xhrStatusChangeHandler}else{xhr=new XMLHttpRequest;xhr.addEventListener("load",xhrStatusChangeHandler)}try{xhr.open("get","/config.xml",true);xhr.send()}catch(e){fail("[Browser][cordova.js][readConfig] Could not XHR config.xml: "+JSON.stringify(e))}}Config.prototype.getPreferenceValue=function getPreferenceValue(preferenceName){var preferenceItem=this.preferences&&this.preferences.filter(function(item){return item.attributes.name&&item.attributes.name.value===preferenceName});if(preferenceItem&&preferenceItem[0]&&preferenceItem[0].attributes&&preferenceItem[0].attributes.value){return preferenceItem[0].attributes.value.value}};exports.readConfig=readConfig;




© 2015 - 2025 Weber Informatics LLC | Privacy Policy