MediaWiki:Common.js: differenze tra le versioni
mNessun oggetto della modifica |
mNessun oggetto della modifica |
||
| (21 versioni intermedie di uno stesso utente non sono mostrate) | |||
| Riga 1: | Riga 1: | ||
(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=1; | /* InMobi Choice. Consent Manager Tag v3.0 (for TCF 2.2) */ | ||
(adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=1; | (adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=1; | ||
(adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=1; | |||
(function() { | (function() { | ||
var host = | var host = 'wikidonca.it'; | ||
var element = document.createElement('script'); | var element = document.createElement('script'); | ||
var firstScript = document.getElementsByTagName('script')[0]; | var firstScript = document.getElementsByTagName('script')[0]; | ||
var url = 'https:// | var url = 'https://cmp.inmobi.com' | ||
var uspTries = 0; | .concat('/choice/', 'hK2b6w2mQ7J22', '/', host, '/choice.js?tag_version=V3'); | ||
var uspTriesLimit = 3; | var uspTries = 0; | ||
element.async = true; | var uspTriesLimit = 3; | ||
element.type = 'text/javascript'; | element.async = true; | ||
element.src = url; | element.type = 'text/javascript'; | ||
element.src = url; | |||
firstScript.parentNode.insertBefore(element, firstScript); | firstScript.parentNode.insertBefore(element, firstScript); | ||
function makeStub() { | function makeStub() { | ||
var TCF_LOCATOR_NAME = '__tcfapiLocator'; | var TCF_LOCATOR_NAME = '__tcfapiLocator'; | ||
var queue = []; | var queue = []; | ||
var win = window; | var win = window; | ||
var cmpFrame; | var cmpFrame; | ||
function addFrame() { | function addFrame() { | ||
var doc = win.document; | var doc = win.document; | ||
var otherCMP = !!(win.frames[TCF_LOCATOR_NAME]); | var otherCMP = !!(win.frames[TCF_LOCATOR_NAME]); | ||
if (!otherCMP) { | if (!otherCMP) { | ||
if (doc.body) { | if (doc.body) { | ||
var iframe = doc.createElement('iframe'); | var iframe = doc.createElement('iframe'); | ||
iframe.style.cssText = 'display:none'; | iframe.style.cssText = 'display:none'; | ||
iframe.name = TCF_LOCATOR_NAME; | iframe.name = TCF_LOCATOR_NAME; | ||
doc.body.appendChild(iframe); | doc.body.appendChild(iframe); | ||
} else { | } else { | ||
setTimeout(addFrame, 5); | setTimeout(addFrame, 5); | ||
} | } | ||
} | } | ||
return !otherCMP; | return !otherCMP; | ||
} | } | ||
function tcfAPIHandler() { | function tcfAPIHandler() { | ||
var gdprApplies; | var gdprApplies; | ||
var args = arguments; | var args = arguments; | ||
if (!args.length) { | if (!args.length) { | ||
return queue; | return queue; | ||
} else if (args[0] === 'setGdprApplies') { | } else if (args[0] === 'setGdprApplies') { | ||
if ( | if ( | ||
args.length > 3 && | args.length > 3 && | ||
args[2] === 2 && | args[2] === 2 && | ||
typeof args[3] === 'boolean' | typeof args[3] === 'boolean' | ||
) { | ) { | ||
gdprApplies = args[3]; | gdprApplies = args[3]; | ||
if (typeof args[2] === 'function') { | if (typeof args[2] === 'function') { | ||
args[2]('set', true); | args[2]('set', true); | ||
} | } | ||
} | } | ||
} else if (args[0] === 'ping') { | } else if (args[0] === 'ping') { | ||
var retr = { | var retr = { | ||
gdprApplies: gdprApplies, | gdprApplies: gdprApplies, | ||
cmpLoaded: false, | cmpLoaded: false, | ||
cmpStatus: 'stub' | cmpStatus: 'stub' | ||
}; | }; | ||
if (typeof args[2] === 'function') { | if (typeof args[2] === 'function') { | ||
args[2](retr); | args[2](retr); | ||
} | } | ||
} else { | } else { | ||
queue.push(args); | if(args[0] === 'init' && typeof args[3] === 'object') { | ||
} | args[3] = Object.assign(args[3], { tag_version: 'V3' }); | ||
} | } | ||
queue.push(args); | |||
} | |||
} | |||
function postMessageEventHandler(event) { | function postMessageEventHandler(event) { | ||
var msgIsString = typeof event.data === 'string'; | var msgIsString = typeof event.data === 'string'; | ||
var json = {}; | var json = {}; | ||
try { | try { | ||
if (msgIsString) { | if (msgIsString) { | ||
json = JSON.parse(event.data); | json = JSON.parse(event.data); | ||
} else { | } else { | ||
json = event.data; | json = event.data; | ||
} | } | ||
} catch (ignore) {} | } catch (ignore) {} | ||
var payload = json.__tcfapiCall; | var payload = json.__tcfapiCall; | ||
if (payload) { | if (payload) { | ||
window.__tcfapi( | window.__tcfapi( | ||
payload.command, | payload.command, | ||
payload.version, | payload.version, | ||
function(retValue, success) { | function(retValue, success) { | ||
var returnMsg = { | var returnMsg = { | ||
__tcfapiReturn: { | __tcfapiReturn: { | ||
returnValue: retValue, | returnValue: retValue, | ||
success: success, | success: success, | ||
callId: payload.callId | callId: payload.callId | ||
} | } | ||
}; | }; | ||
if (msgIsString) { | if (msgIsString) { | ||
returnMsg = JSON.stringify(returnMsg); | returnMsg = JSON.stringify(returnMsg); | ||
} | } | ||
event.source.postMessage(returnMsg, '*'); | if (event && event.source && event.source.postMessage) { | ||
}, | event.source.postMessage(returnMsg, '*'); | ||
payload.parameter | } | ||
); | }, | ||
} | payload.parameter | ||
} | ); | ||
} | |||
} | |||
while (win) { | while (win) { | ||
try { | try { | ||
if (win.frames[TCF_LOCATOR_NAME]) { | if (win.frames[TCF_LOCATOR_NAME]) { | ||
cmpFrame = win; | cmpFrame = win; | ||
break; | break; | ||
} | } | ||
} catch (ignore) {} | } catch (ignore) {} | ||
if (win === window.top) { | if (win === window.top) { | ||
break; | break; | ||
} | } | ||
win = win.parent; | win = win.parent; | ||
} | } | ||
if (!cmpFrame) { | if (!cmpFrame) { | ||
addFrame(); | addFrame(); | ||
win.__tcfapi = tcfAPIHandler; | win.__tcfapi = tcfAPIHandler; | ||
win.addEventListener('message', postMessageEventHandler, false); | win.addEventListener('message', postMessageEventHandler, false); | ||
} | } | ||
} | } | ||
makeStub(); | makeStub(); | ||
var uspStubFunction = function() { | var uspStubFunction = function() { | ||
var arg = arguments; | var arg = arguments; | ||
if (typeof window.__uspapi !== uspStubFunction) { | if (typeof window.__uspapi !== uspStubFunction) { | ||
setTimeout(function() { | setTimeout(function() { | ||
if (typeof window.__uspapi !== 'undefined') { | if (typeof window.__uspapi !== 'undefined') { | ||
window.__uspapi.apply(window.__uspapi, arg); | window.__uspapi.apply(window.__uspapi, arg); | ||
} | } | ||
}, 500); | }, 500); | ||
} | } | ||
}; | }; | ||
var checkIfUspIsReady = function() { | var checkIfUspIsReady = function() { | ||
uspTries++; | uspTries++; | ||
if (window.__uspapi === uspStubFunction && uspTries < uspTriesLimit) { | if (window.__uspapi === uspStubFunction && uspTries < uspTriesLimit) { | ||
console.warn('USP is not accessible'); | console.warn('USP is not accessible'); | ||
} else { | } else { | ||
clearInterval(uspInterval); | clearInterval(uspInterval); | ||
} | } | ||
}; | }; | ||
if (typeof window.__uspapi === 'undefined') { | if (typeof window.__uspapi === 'undefined') { | ||
window.__uspapi = uspStubFunction; | window.__uspapi = uspStubFunction; | ||
var uspInterval = setInterval(checkIfUspIsReady, 6000); | var uspInterval = setInterval(checkIfUspIsReady, 6000); | ||
} | } | ||
})(); | })(); | ||
(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=0; | |||
(adsbygoogle=window.adsbygoogle||[]).pauseAdRequests=0; | (adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=0; | ||
(adsbygoogle=window.adsbygoogle||[]).requestNonPersonalizedAds=0; | |||
(adsbygoogle = window.adsbygoogle || []).push({}); | (adsbygoogle = window.adsbygoogle || []).push({}); | ||