function devicetest() { console.log("debug"); var NAV_SHORTNAMES = { userAgent:'uA', appCodeName:'aCN', appName:'aN', appVersion:'aV', cookieEnabled:'cE', systemLanguage:'sL', userLanguage:'uL', language:'la', platform:'pl', onLine:'oL' }, J_SHORTNAMES = { leadingWhitespace:'lW', tbody:'tb', htmlSerialize:'hS', style:'st', hrefNormalized:'hN', opacity:'op', cssFloat:'cF', checkOn:'cO', optSelected:'oS', parentNode:'pN', deleteExpando:'dE', checkClone:'cC', scriptEval:'sE', noCloneEvent:'nCE', boxModel:'bM', submitBubbles:'sB', changeBubbles:'cB' }, device={}, w=window, d=document, // helper redirect=redirect || { url: d.location.href, params: d.location.search }, // failsafe encodeFunc = w.encodeURIComponent || escape, // IE 5 decodeFunc = w.decodeURIComponent || unescape; device = { // width and height of the screen sz: (function(){ try { return { w: screen.width, h: screen.height }; } catch(e){ } return { w: -1, h: -1 }; })(), // available width and height on the screen (excluding OS taskbars and such) av: (function(){ try { return { w: screen.availWidth, h: screen.availHeight }; } catch(e){ } return { w: -1, h: -1 }; })(), // dimensions of the viewport (interior of the browser window) vp: (function(){ if (w.innerWidth) { return { w: w.innerWidth, h: w.innerHeight, t: 0 }; } else if (d.documentElement.clientWidth) { // width and height of the content field, excluding border and scrollbar, // but including padding return { w: d.documentElement.clientWidth, h: d.documentElement.clientHeight, t: 1 }; } try { return { w: d.body.offsetWidth, h: d.body.offsetHeight, t: 2 }; } catch(e){ } return { w: -1, h: -1, t: -1 }; })(), // navigator object n: (function() { var nav = new Object(); // add common properties for (i in NAV_SHORTNAMES) { if (navigator[i]){ nav[NAV_SHORTNAMES[i]] = navigator[i]; } } return nav; })(), // javascript js: (function(){ var js = new Object(); js["po"] = (typeof Array.prototype.pop !== "undefined"); js["pu"] = (typeof Array.prototype.push !== "undefined"); js["eU"] = !!w.encodeURIComponent; js["dU"] = !!w.decodeURIComponent; return js; })(), // jQuery j: (function(){ if (typeof jQuery === "undefined" || !jQuery) { return false; } // extend device with jQuery.support var jq = new Object(); for (i in J_SHORTNAMES) { jq[J_SHORTNAMES[i]] = !!$.support[i]; } return jq; })(), pw: (function(){ return !(typeof Piwik === "undefined" || !Piwik); })() }; var toParams = function(object) { var res = [], stack = []; // IE 5 if (typeof Array.prototype.pop === "undefined") { Array.prototype.pop = function() { var o = this[this.length-1]; this.length--; return o; } } function append(obj) { var s = ""; if (obj == null) { s = "null"; } else if (typeof obj == "undefined") { s = "undefined"; } else if (typeof obj == "string" || typeof obj == "number") { s = "" + obj; } else if (typeof obj == "boolean") { s = (obj ? "1" : "0"); } if (s != "") { var parent=""; if (stack.length > 0) { for (j=stack.length-1; j>=0; j--){ if (j>0) { parent = '[' + stack[j] + ']' + parent; } else { parent = stack[j] + parent; } } } res[res.length] = encodeFunc(parent)+ '=' + encodeFunc(s); return; } if (typeof obj === 'object') { var text = obj.toString(), idx = text.indexOf('[object '); if (idx > -1 && (text.indexOf(']') > idx)) { // Object for (i in obj) { stack[stack.length]=i; append(obj[i]); stack.pop(); } } else { // Array for (i=0; i 1 ? redirect.params + '&' : '?') + toParams(device); redirect.params = redirect.params + '&mr=1'; // d.write(''); return(redirect); }; function redirectTo(redirectUrl) { //window.location=redirect.url + redirect.params + '&wl=1'; window.location=redirectUrl; }; function pushDeviceInfoToBackendViaAjax(url){ $.get(url,function(data, textStatus){ pushDeviceInfoCallback(textStatus); }); }; function pushDeviceInfoToBackendViaImg(url){ img = new Image(); img.src = url; pushDeviceInfoCallback("success"); }; function pushDeviceInfoCallback(textStatus){ if(textStatus=="success") { location.reload(); } else { // if not successfull simply setDev? location.replace("?setDev=true"); } } d = w = null; // cleanup