//************************** // verifica le condizioni sul tablet function DetectTablet(uagent, device, width, height, minWidth, minHeight ) { if (uagent.indexOf(device) > -1 ) { if( (width + height) >= (minWidth + minHeight) ) { return true; } } return false; } function getUrlParams(q) { var e, a = /\+/g, // Regex for replacing addition symbol with a space r = /([^&=]+)=?([^&]*)/g, d = function (s) { return decodeURIComponent(s.replace(a, " ").toLowerCase()); }, tempObj = new Object(); if (q == undefined) { q = window.location.search.substring(1) } while (e = r.exec(q)) tempObj[d(e[1])] = d(e[2]); return tempObj; } var valueParams = getUrlParams(); var mobileRedirectEnabled = "True"; var userAgent = "ccbot/2.0 (http://commoncrawl.org/faq/)"; var userMobileDevice = "unknown"; var screenResolutionWidth = screen.width; var screenResolutionHeight = screen.height; var jsArray = [ {device: 'ipad', width: 1024,height: 768, url:'http://www.riviste24.ilsole24ore.com/tablet/' },{device: 'android', width: 1280,height: 800, url:'http://www.riviste24.ilsole24ore.com/tablet/' },{device: 'touch', width: 1366,height: 768, url:'http://www.riviste24.ilsole24ore.com/tablet' }]; for(var j=0; j < jsArray.length; j++) { var check = DetectTablet (userAgent,jsArray[j].device , jsArray[j].width, jsArray[j].height, screenResolutionWidth, screenResolutionHeight); if ( check ) { switch (valueParams.view) { case 'document': //window.stop(); window.location = jsArray[j].url + '?o=doc&d=' + valueParams.documentid + '&dt=' + valueParams.documenttype + '&f=-1'; break; case 'provlink': //window.stop(); window.location = jsArray[j].url + '?o=prov&p=' + valueParams.idprovv + '&dt=' + valueParams.iddoctype + '&f=' + valueParams.idfonte; break; case 'scadenzario': //window.stop(); window.location = jsArray[j].url + '?o=exp&mid=' + valueParams.vocemenu + '&mpid=-1'; break; case 'tree': //window.stop(); window.location = jsArray[j].url + '?o=index&mid=' + valueParams.treeid + '&mpid=-1'; break; case 'list': //window.stop(); window.location = jsArray[j].url + '?o=squery&mid=' + valueParams.menuitem; break; default: //window.stop(); window.location = jsArray[j].url; break; } } }