Opt-In Cookie Manager

Instructions for editing the scripts. - Opt-In Cookie Manager

Instructions for editing the scripts.

by Chris1278 » Fri Aug 19, 2022 7:07 am

This information relates to the next version of the extension.

From Opt-In Cookie Manager version 2.0.3

With some switches you have to edit the scripts yourself. Unfortunately, it is not possible for me to include all the scripts for this. Hence this information topic.
In any case, it is recommended to set the switch "Allow usage of third party content delivery networks" to no in the admin panel of the forum under load settings. This saves you having to intervene in the style files of the forum (if the style author has not changed anything, e.g. removing this switch in the template)
The script I use for this extension comes from here:

https://heyklaro.com/https://heyklaro.com/

Of course, I try to keep it as easy to use as possible. However, under certain conditions, this is not 100% possible for me.

Therefore I decided to install the switches accordingly and to specify the so-called data-name names in the ACP.

Scripts must be edited in this form:

e.g. from this one:

Code: Select all

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
this has to be here to take an example from Adsense:

Code: Select all

<script async type="text/plain" data-type="application/javascript" data-name="google_adsense" data-src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
For example, I have planned a switch for Adsense and one for Google Webfonts for the next version. Since, for example, the Google web fonts are already in every style and I can't address them directly, everyone who uses them has to do something with their styles. If you have any questions about this, I can also help you to adapt your scripts accordingly. Then simply provide the scripts you use and I'll take a look and then post what you need to change accordingly.

But as I said, I try to keep things as comfortable as possible.


Please ask the questions here if you have problems with scripts that have to be edited manually.
Last edited by Chris1278 on Sat Sep 03, 2022 12:31 pm
User avatar
Chris1278
Jr. Extension Validator
Posts: 493
Joined: Thu Mar 14, 2019 6:07 pm

Re: Instructions for editing the scripts.

by Chris1278 » Wed Aug 24, 2022 7:34 pm

Google Webfonts in Style File


If you still want to load the Google webfont and the Ajax api from google, you can edit the following in the style html template files. Of course, you have to repeat this with every style update.

Open the overall_header.html file and find this:

Code: Select all

<!-- IF S_ALLOW_CDN -->
<script>
	WebFontConfig = {
		google: {
			families: ['Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese']
		}
	};

	(function(d) {
		var wf = d.createElement('script'), s = d.scripts[0];
		wf.src = 'https://cdn.jsdelivr.net/npm/[email protected]/webfontloader.min.js';
		wf.async = true;
		s.parentNode.insertBefore(wf, s);
	})(document);
</script>
<!-- ENDIF -->
and replace this with the following:

Code: Select all

<!-- IF S_ALLOW_CDN -->
<script type="text/plain" data-type="application/javascript" data-name="googlewebfont">
	WebFontConfig = {
		google: {
			families: ['Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese']
		}
	};

	(function(d) {
		var wf = d.createElement('script'), s = d.scripts[0];
		wf.src = 'https://cdn.jsdelivr.net/npm/[email protected]/webfontloader.min.js';
		wf.async = true;
		s.parentNode.insertBefore(wf, s);
	})(document);
</script>
<!-- ENDIF -->
For jquery this information:

For the Java Query option please do the following:

In the admin area under general/server configuration/load settings

activate the following option with no (which is usually the default)

Allow usage of third party content delivery networks: = NO

Save both files and then clear forums and browser cache.
User avatar
Chris1278
Jr. Extension Validator
Posts: 493
Joined: Thu Mar 14, 2019 6:07 pm

Re: Instructions for editing the scripts.

by Chris1278 » Thu Sep 01, 2022 8:02 pm

Instruction for Google Translate Extension Version 1.0.3

To make the Google Translate Extension compatible with this, please proceed as follows:


find in the file: ...\ext\hifikabin\translate\styles\prosilver\template\event\overall_footer_after.html

Code: Select all

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
and replace with:

Code: Select all

<script type="text/javascript" data-name="{{ DATA_NAME_GOOGLETRANSLATE }}" data-src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

The script I used before only blocked the entry of the dropdown box in the navigation bar but not the loading of the service itself. With this change you can edit the script of the extension correctly and it then behaves GDPR compliant. Note that this change must be repeated when updating the translation extension.
User avatar
Chris1278
Jr. Extension Validator
Posts: 493
Joined: Thu Mar 14, 2019 6:07 pm

Re: Instructions for editing the scripts.

by HiFiKabin » Fri Apr 07, 2023 4:42 pm

That is for the 1.0.3 version. I suspect you are using the later version from my extension site which is written differentlt
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6826
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James

Re: Instructions for editing the scripts.

by Chris1278 » Fri Apr 07, 2023 10:25 pm

Instruction for Google Translate Extension Version 1.0.4

open ...ext\hifikabin\translate\styles\prosilver\template\event\overall_footer_after.html

Replace the whole content with:

Code: Select all

<script type="text/plain" data-type="application/javascript" data-name="{{ DATA_NAME_GOOGLETRANSLATE }}">
function googleTranslateElementInit() {
	new google.translate.TranslateElement({
		pageLanguage: '{{ TRANSLATE_DEFAULT_LANG |escape('js') }}',
		includedLanguages: '{{ TRANSLATE_CHOICE_LANG |escape('js') }}',
		layout: google.translate.TranslateElement.InlineLayout.SIMPLE,
		autoDisplay: false
	}, 'google_translate_element');

	function changeGoogleStyles() {
		if ($('.goog-te-menu-frame').contents().find('.goog-te-menu2').length) {
			$('.goog-te-menu-frame').contents().find('.goog-te-menu2').css({
				'max-width': '100%',
				'overflow-x': 'auto',
				'overflow-y': 'auto',
				'box-sizing': 'border-box',
				'height': 'auto'
			});
		} else {
			setTimeout(changeGoogleStyles, 50);
		}
	}
	changeGoogleStyles();
}
</script>
<script type="text/plain" data-type="application/javascript" data-name="{{ DATA_NAME_GOOGLETRANSLATE }}">
(function () {
	var gtConstEvalStartTime = new Date();
	/*

	 Copyright The Closure Library Authors.
	 SPDX-License-Identifier: Apache-2.0
	*/
	function d(b) {
		var a = document.getElementsByTagName("head")[0];
		a || (a = document.body.parentNode.appendChild(document.createElement("head")));
		a.appendChild(b)
	}

	function _loadJs(b) {
		var a = document.createElement("script");
		a.type = "text/javascript";
		a.charset = "UTF-8";
		a.src = b;
		d(a)
	}

	function _loadCss(b) {
		var a = document.createElement("link");
		a.type = "text/css";
		a.rel = "stylesheet";
		a.charset = "UTF-8";
		a.href = b;
		d(a)
	}

	function _isNS(b) {
		b = b.split(".");
		for (var a = window, c = 0; c < b.length; ++c)
			if (!(a = a[b[c]])) return !1;
		return !0
	}

	function _setupNS(b) {
		b = b.split(".");
		for (var a = window, c = 0; c < b.length; ++c) a.hasOwnProperty ? a.hasOwnProperty(b[c]) ? a = a[b[c]] : a = a[b[c]] = {} : a = a[b[c]] || (a[b[c]] = {});
		return a
	}
	window.addEventListener && "undefined" == typeof document.readyState && window.addEventListener("DOMContentLoaded", function () {
		document.readyState = "complete"
	}, !1);
	if (_isNS('google.translate.Element')) {
		return
	}(function () {
		var c = _setupNS('google.translate._const');
		c._cest = gtConstEvalStartTime;
		gtConstEvalStartTime = undefined;
		c._cl = 'en';
		c._cuc = 'googleTranslateElementInit';
		c._cac = '';
		c._cam = '';
		c._ctkk = '441442.1753366353';
		var h = 'translate.googleapis.com';
		var s = (true ? 'https' : window.location.protocol == 'https:' ? 'https' : 'http') + '://';
		var b = s + h;
		c._pah = h;
		c._pas = s;
		c._pbi = b + '/translate_static/img/te_bk.gif';
		c._pci = b + '/translate_static/img/te_ctrl3.gif';
		c._pli = b + '/translate_static/img/loading.gif';
		c._plla = h + '/translate_a/l';
		c._pmi = b + '/translate_static/img/mini_google.png';
		c._ps = b + '/translate_static/css/translateelement.css';
		c._puh = 'translate.google.com';
		_loadCss(c._ps);
		_loadJs(b + '/translate_static/js/element/main.js');
	})();
})();


</script>

open ...\ext\hifikabin\translate\styles\prosilver\template\event\overall_header_head_append.html
find and delete:

Code: Select all

{% INCLUDEJS '@hifikabin_translate/translate.js' %}

Delete the file:

..\ext\hifikabin\translate\styles\prosilver\template\translate.js
Unfortunately I have no other way to do that. To do this, what is in the java script file must be loaded into a <script> element, then it can also be controlled
User avatar
Chris1278
Jr. Extension Validator
Posts: 493
Joined: Thu Mar 14, 2019 6:07 pm

Re: Instructions for editing the scripts.

by kjh-mov » Sat Apr 08, 2023 2:05 am

Thanks for the quick help

Your kjh-mov :-)
Wer nichts weiß, muss alles glauben.

Marie von Ebner-Eschenbach
User avatar
kjh-mov
Registered User
Posts: 82
Joined: Mon May 07, 2018 12:23 pm

Re: Instructions for editing the scripts.

by HiFiKabin » Sat Apr 08, 2023 8:56 am

Chris1278 wrote:Instruction for Google Translate Extension Version 1.0.4

Many thanks
User avatar
HiFiKabin
Community Team Member
Community Team Member
Posts: 6826
Joined: Wed May 14, 2014 9:10 am
Location: Swearing at the PC, UK
Name: James