add adblock detection in admin panel, because of blocked config pages in case of activated adblocker

This commit is contained in:
Daniel Seifert 2017-06-29 14:21:45 +02:00
parent dae9810ec8
commit 61b1cd95d1
6 changed files with 30 additions and 0 deletions

View File

@ -29,4 +29,19 @@ class d3_cfg_googleanalytics extends d3_cfg_mod_
$this->addTplParam('sMainClass', 'd3_cfg_googleanalytics_main');
return parent::render();
}
public function getAdditionalHeadContent()
{
$oViewConf = oxRegistry::getConfig()->getActiveView()->getViewConfig();
$sScriptUrl = $oViewConf->getModuleUrl('d3_googleanalytics', 'out/src/d3_googleanalytics_test.js');
return parent::getAdditionalHeadContent().'
<script src="'.$sScriptUrl.'"></script>
<script type="text/javascript">
if(null === document.getElementById("SePiRENuJOBWx")){
alert("'.oxRegistry::getLang()->translateString('D3_GOOGLEANALYTICS_ADBLOCKER', null, true).'");
}
</script>
';
}
}

View File

@ -0,0 +1,9 @@
if (null === document.body) {
// add body tag, if it's missing because framesets
var b=document.createElement('body');
document.getElementsByTagName('html')[0].appendChild(b);
}
var e=document.createElement('div');
e.id='SePiRENuJOBWx';
e.style.display='none';
document.body.appendChild(e);

View File

@ -408,6 +408,9 @@ $aLang = array(
'Sie in der <a href="https://www.google.de/search?q=Analytics+_opt+out+script" target="gahelp">Google-Suche'.
'</a>.</p>',
'D3_GOOGLEANALYTICS_ADBLOCKER' => 'AdBlocker entdeckt - Bitte deaktivieren Sie diesen für diese Seite, da sonst '.
'Teile des Admin-Bereichs nicht richtig geladen werden können.',
// Erweiterung des Links in der Fussnote "Hilfe Starten"
'D3_GOOGLEANALYTICS_HELPLINK' => 'Fragen-zu-speziellen-Modulen/Google-Analytics/',
);

View File

@ -408,6 +408,9 @@ $aLang = array(
'Sie in der <a href="https://www.google.de/search?q=Analytics+_opt+out+script" target="gahelp">Google-Suche'.
'</a>.</p>',
'D3_GOOGLEANALYTICS_ADBLOCKER' => 'AdBlocker detected - Please deactivate it for this page, because otherwise '.
'parts of the admin area can not be loaded correctly.',
// Erweiterung des Links in der Fussnote "Hilfe Starten"
'D3_GOOGLEANALYTICS_HELPLINK' => 'Fragen-zu-speziellen-Modulen/Google-Analytics/',
);