// Sostituisce il document ready di jquery (function(funcName, baseObj) { "use strict"; // The public function name defaults to window.docReady // but you can pass in your own object and own function name and those will be used // if you want to put them in a different namespace funcName = funcName || "docReady"; baseObj = baseObj || window; var readyList = []; var readyFired = false; var readyEventHandlersInstalled = false; // call this when the document is ready // this function protects itself against being called more than once function ready() { if (!readyFired) { // this must be set to true before we start calling callbacks readyFired = true; for (var i = 0; i < readyList.length; i++) { // if a callback here happens to add new ready handlers, // the docReady() function will see that it already fired // and will schedule the callback to run right after // this event loop finishes so all handlers will still execute // in order and no new ones will be added to the readyList // while we are processing the list readyList[i].fn.call(window, readyList[i].ctx); } // allow any closures held by these functions to free readyList = []; } } function readyStateChange() { if ( document.readyState === "complete" ) { ready(); } } // This is the one public interface // docReady(fn, context); // the context argument is optional - if present, it will be passed // as an argument to the callback baseObj[funcName] = function(callback, context) { // if ready has already fired, then just schedule the callback // to fire asynchronously, but right away if (readyFired) { setTimeout(function() {callback(context);}, 1); return; } else { // add the function and context to the list readyList.push({fn: callback, ctx: context}); } // if document already ready to go, schedule the ready function to run if (document.readyState === "complete") { setTimeout(ready, 1); } else if (!readyEventHandlersInstalled) { // otherwise if we don\'t have event handlers installed, install them if (document.addEventListener) { // first choice is DOMContentLoaded event document.addEventListener("DOMContentLoaded", ready, false); // backup is window load event window.addEventListener("load", ready, false); } else { // must be IE document.attachEvent("onreadystatechange", readyStateChange); window.attachEvent("onload", ready); } readyEventHandlersInstalled = true; } } })("docReady", window); // genera un base64 encode crossbrowser function base64_encode(str){ "use strict"; if (window.btoa) // Internet Explorer 10 and above return window.btoa(unescape(encodeURIComponent( str ))); else { // Cross-Browser Method (compressed) // Create Base64 Object var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n127&&r<2048){t+=String.fromCharCode(r>>6|192);t+=String.fromCharCode(r&63|128)}else{t+=String.fromCharCode(r>>12|224);t+=String.fromCharCode(r>>6&63|128);t+=String.fromCharCode(r&63|128)}}return t},_utf8_decode:function(e){var t="";var n=0;var r=c1=c2=0;while(n191&&r<224){c2=e.charCodeAt(n+1);t+=String.fromCharCode((r&31)<<6|c2&63);n+=2}else{c2=e.charCodeAt(n+1);c3=e.charCodeAt(n+2);t+=String.fromCharCode((r&15)<<12|(c2&63)<<6|c3&63);n+=3}}return t}} // Encode the String return Base64.encode(unescape(encodeURIComponent( str ))); } } // Funzione per caricamento in AJAX docReady(function() { "use strict"; var rec = document.getElementById("recensioni2view");// Nome DIV in cui stampare i dati if(!rec)alert('ATTENZIONE ! Ti sei dimenticato di incorporare il div in cui visualizzare le recensioni. Controlla lo Step 2. (info su https://www.recensionihot.com/widget-nel-tuo-sito)'); var widgetHeight=rec.getAttribute("data-height");// Altezza widget if(!widgetHeight){widgetHeight=400;}// Altezza default se non impostata var paramStr=''; var params={ height:rec.getAttribute("data-height"),recordToView:rec.getAttribute("data-recordToView"),phoneNumber:rec.getAttribute("data-phoneNumber"),site:rec.getAttribute("data-site"),minRateRec:rec.getAttribute("data-minRateRec"),viewUserNickname:rec.getAttribute("data-viewUserNickname"),viewSiteForReview:rec.getAttribute("data-viewSiteForReview"),viewSummary:rec.getAttribute("data-viewSummary"),viewAdvertiserName:rec.getAttribute("data-viewAdvertiserName"),viewCategoryAd:rec.getAttribute("data-viewCategoryAd"),viewDetails:rec.getAttribute("data-viewDetails"),viewDetailsRE:rec.getAttribute("data-viewDetailsRE"),viewDetailsRR:rec.getAttribute("data-viewDetailsRR"),viewLeaveReview:rec.getAttribute("data-viewLeaveReview"),theme:rec.getAttribute("data-theme"),customLayout:rec.getAttribute("data-customLayout") } for(var kiave in params) { paramStr+=kiave+'='+params[kiave]+','; } paramStr=base64_encode(paramStr.substring(0, paramStr.length - 1));// Rimuovo l'ultima virgola e faccio codifica base64 // Scrivo iframe rec.innerHTML = ''; });