app.tuotempo.com
Open in
urlscan Pro
54.247.171.209
Public Scan
URL:
https://app.tuotempo.com/js/mop_loader.js.php
Submission: On September 16 via api from IT — Scanned from IT
Submission: On September 16 via api from IT — Scanned from IT
Form analysis
0 forms found in the DOMText Content
(function() { /*\ |*| A complete cookies reader/writer framework with full unicode support. |*| https://developer.mozilla.org/en-US/docs/DOM/document.cookie |*| This framework is released under the GNU Public License, version 3 or later. |*| http://www.gnu.org/licenses/gpl-3.0-standalone.html |*| Syntaxes: |*| * docCookies.setItem(name, value[, end[, path[, domain[, secure]]]]) |*| * docCookies.getItem(name) |*| * docCookies.removeItem(name[, path]) |*| * docCookies.hasItem(name) |*| * docCookies.keys() \*/ var docCookies = { getItem: function (sKey) { return unescape(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; }, setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) { if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; } var sExpires = ""; if (vEnd) { switch (vEnd.constructor) { case Number: sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd; break; case String: sExpires = "; expires=" + vEnd; break; case Date: sExpires = "; expires=" + vEnd.toGMTString(); break; } } document.cookie = escape(sKey) + "=" + escape(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); return true; }, removeItem: function (sKey, sPath) { if (!sKey || !this.hasItem(sKey)) { return false; } document.cookie = escape(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sPath ? "; path=" + sPath : ""); return true; }, hasItem: function (sKey) { return (new RegExp("(?:^|;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie); }, keys: /* optional method: you can safely remove it! */ function () { var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/); for (var nIdx = 0; nIdx < aKeys.length; nIdx++) { aKeys[nIdx] = unescape(aKeys[nIdx]); } return aKeys; } }; /*****************************************************************************************************************************************************************************/ var mop_iframe_css = "@media (max-width:699px){body {margin:auto 0px;} #mop_iframe {width:100% !important;}}"; var html_style = document.createElement('style'); html_style.innerHTML = mop_iframe_css; document.getElementsByTagName('head')[0].appendChild(html_style); /*****************************************************************************************************************************************************************************/ var isMobile = function(){ return screen.width < 700; }; var isSecureConnection = function(){ return (document.location.protocol == 'https:'); }; var querystringToArray = function( querystring ) { if (querystring == "") return {}; var a = querystring.split('&'); var b = {}; for (var i = 0; i < a.length; ++i){ var p=a[i].split('='); if( p[1] != undefined ){ b[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " ")); } } return b; }; var serialize = function( obj ) { var str = []; for (var p in obj) if (obj.hasOwnProperty(p)) { str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p])); } return str.join("&"); }; /*********************************************************************************************************/ var loadMop = function( source, fullQuerystring, hash, instance_dbName, querystring, hostname ){ ////////////////////////////// MIGRATION to the MOP 3.0 /////////////////////////////// var use_new_mop = true; var mop_search_data = querystringToArray( fullQuerystring ); if (mop_search_data['newMopPreview']) { use_new_mop = true; } if (use_new_mop) { source = source.replace("mop_customer.php", "mop/index.php"); } if (mop_search_data['loadBetaVersion']) { source = source.replace('app.', 'beta.'); } /////////////////////////////////////////////////////////////////////////////////////// var mop_url = source + '?' + fullQuerystring + (hash ? '#' + hash : ''); /////////////////////////////////////////////////////////////////////////////////////// var linkByName = document.getElementsByName('mop_link'); if ( linkByName.length > 0 ) { for( var i=0; i < linkByName.length; i++ ){ linkByName[i].href = mop_url; } } else { if ( document.getElementById('mop_link') ){ var mop_link = document.getElementById('mop_link'); mop_link.href = mop_url; } else if ( document.getElementById('mop_iframe') ) { var fromMopLauncher = false; if( isMobile() && !fromMopLauncher){ // Trasformiamo la querystring in un oggetto e rimuoviamo il dbName var querystringObj = querystringToArray(querystring); delete querystringObj.dbName; var scriptMopLauncher = document.createElement('script'); scriptMopLauncher.setAttribute('type', 'text/javascript'); scriptMopLauncher.setAttribute('tt-mop-launcher-plugin', ''); scriptMopLauncher.setAttribute("tt-instance", instance_dbName); scriptMopLauncher.setAttribute("tt-mopfallbackurl", mop_url); scriptMopLauncher.setAttribute("tt-querystring", serialize(querystringObj)); scriptMopLauncher.setAttribute("tt-hash", hash); scriptMopLauncher.setAttribute("origin", 'customer_embedded_redirect_mobile'); scriptMopLauncher.src = hostname+'/mop/mop-launcher/index.php?mode=1'; document.body.appendChild(scriptMopLauncher); } else { var mop_iframe = document.getElementById('mop_iframe'); // Ci permette di far funzionare la geolocalizzazione e fotocamera anche se siamo in iframe mop_iframe.setAttribute("allow", "geolocation; camera"); mop_iframe.src = mop_url; } } } }; /*********************************************************************************************************/ if( typeof(mop_source) !== 'undefined' ){ // Formatto eventuali codifiche non utf8, per far in modo che la regexp seguente estragga i valori corretti mop_source = mop_source.replace(/&/g, "&"); mop_source = mop_source.replace(/&/g,"&"); mop_source = mop_source.replace(/&/g, "&"); var mop_pathname = mop_source.slice().replace(/(.[^?#]*)[\?]?(.[^#]*)?[\#]?(.*)?/g, '$1'); var querystring = mop_source.slice().replace(/(.[^?#]*)[\?]?(.[^#]*)?[\#]?(.*)?/g, '$2'); var mop_hash = mop_source.slice().replace(/(.[^?#]*)[\?]?(.[^#]*)?[\#]?(.*)?/g, '$3'); //1) Get parent querystring var parent_querystring = window.location.search; if( parent_querystring ){ // Tolgo il ? dalla querystring del parent e lo sostituisco con un &. parent_querystring = parent_querystring.replace(/\?/,'&'); // Tolgo eventuali dbName presenti nella querystring del parent. parent_querystring = parent_querystring.replace(/(&)?dbName=(\w|_)+/g, ''); } //2) Add full parent querystring to mop querystring var mop_search = querystring; mop_search += (parent_querystring ? parent_querystring : ''); //3) add parent_location to mop querystring mop_search += '&parent_location=' + encodeURIComponent(window.location); //4) Add utmz data to mop querystring var __utmz = docCookies.getItem('__utmz'); if (__utmz) { mop_search += '&__utmz=' + encodeURIComponent(__utmz); } //5) Manage an eventual secure connection and remove special chars from mop_source var fromLocalDev = false; if (!fromLocalDev) { mop_pathname = mop_pathname.replace("http://", "https://"); } //6) Retrieve server name from mop_source var mop_pathname_data = mop_pathname.split('/mop'); var mop_server_name = mop_pathname_data[0]; //7) Retrieve instance dbName from mop_source var mop_source_search_data = querystringToArray(mop_search); var instance_dbName = mop_source_search_data['dbName']; loadMop(mop_pathname, mop_search, mop_hash, instance_dbName, querystring, mop_server_name); } function validateJson(val) { if (typeof val == 'object') { return true; } var isValidJson = false; try { JSON.parse(val); isValidJson = true; } catch (e) {} return isValidJson; } function getNodePosition(node) { var top = 0; var left = 0; while (node) { if (node.tagName) { top = top + node.offsetTop; left = left + node.offsetLeft; node = node.offsetParent; } else { node = node.parentNode; } } return [top, left]; } /*********************************************************************************************************/ // iFrame resizable behaviour // Create IE + others compatible event handler var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent", eventer = window[eventMethod], messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message", old_height = 1000, // default height for iframed mop postMessageCallback; postMessageCallback = function postMessageCallback(e) { if (validateJson(e.data)) { var stringCommunicationType = (typeof e.data == 'string'); var data = stringCommunicationType ? JSON.parse(e.data) : e.data; var fn = data.fn; if (fn === 'updateIframeMopHeight') { // Forziamo 350px come altezza minima del MOP in iframe var THRESHOLD = 350; var raw_height = data.value; var new_height = raw_height >= THRESHOLD ? raw_height : THRESHOLD; if (new_height != old_height) { var $mop_iframe = document.getElementById('mop_iframe'); $mop_iframe.style.height = new_height + 'px'; old_height = new_height; } } else if (fn === 'evalFunction') { var resp = data.resp || undefined; try { eval(data.value); } catch (e) { } } else if (fn === 'localStorage') { var method = data.method; var key = data.key; var value = data.value || undefined; var iframe = document.getElementById("mop_iframe").contentWindow; var result; var response; try { result = { result: 'OK', value: localStorage[method](key, value) }; } catch (err) { result = { result: 'ERROR', value: err }; } response = {id: data.id, response: result}; iframe.postMessage(stringCommunicationType ? JSON.stringify(response) : response, '*'); } else if (fn === 'sessionStorage') { var method = data.method; var key = data.key; var value = data.value || undefined; var iframe = document.getElementById("mop_iframe").contentWindow; var result; var response; try { result = { result: 'OK', value: sessionStorage[method](key, value) }; } catch (err) { result = { result: 'ERROR', value: err }; } response = {id: data.id, response: result}; iframe.postMessage(stringCommunicationType ? JSON.stringify(response) : response, '*'); } else if (fn === 'closeMopLauncher') { window.MOPLauncher.close(); } } }; Storage.prototype.removeItemByRegExp = function(reg_exp){ var regExp = new RegExp(reg_exp); Object.keys(localStorage) .forEach(function(key){ if (regExp.test(key)) { localStorage.removeItem(key); } }); Object.keys(sessionStorage) .forEach(function(key){ if (regExp.test(key)) { sessionStorage.removeItem(key); } }); return true; }; // Listen to message from child window eventer(messageEvent, postMessageCallback, false); })();