Merge pull request #600 from mapado/nr-use_jsdelivr_minified_files
Use jsdelivr minified files when delivered from jsdelivr CDN
This commit is contained in:
commit
e120b1a6b6
|
|
@ -196,8 +196,9 @@ var tarteaucitron = {
|
||||||
"use strict";
|
"use strict";
|
||||||
var cdn = tarteaucitron.cdn,
|
var cdn = tarteaucitron.cdn,
|
||||||
language = tarteaucitron.getLanguage(),
|
language = tarteaucitron.getLanguage(),
|
||||||
pathToLang = cdn + 'lang/tarteaucitron.' + language + '.js?v=' + tarteaucitron.version,
|
useJSDelivrMinifiedJS = cdn.includes("cdn.jsdelivr.net"),
|
||||||
pathToServices = cdn + 'tarteaucitron.services.js?v=' + tarteaucitron.version,
|
pathToLang = cdn + 'lang/tarteaucitron.' + language + (useJSDelivrMinifiedJS ? '.min' : '') + '.js?v=' + tarteaucitron.version,
|
||||||
|
pathToServices = cdn + 'tarteaucitron.services' + (useJSDelivrMinifiedJS ? '.min' : '') + '.js?v=' + tarteaucitron.version,
|
||||||
linkElement = document.createElement('link'),
|
linkElement = document.createElement('link'),
|
||||||
defaults = {
|
defaults = {
|
||||||
"adblocker": false,
|
"adblocker": false,
|
||||||
|
|
@ -253,7 +254,7 @@ var tarteaucitron = {
|
||||||
if ( !tarteaucitron.parameters.useExternalCss ) {
|
if ( !tarteaucitron.parameters.useExternalCss ) {
|
||||||
linkElement.rel = 'stylesheet';
|
linkElement.rel = 'stylesheet';
|
||||||
linkElement.type = 'text/css';
|
linkElement.type = 'text/css';
|
||||||
linkElement.href = cdn + 'css/tarteaucitron.css?v=' + tarteaucitron.version;
|
linkElement.href = cdn + 'css/tarteaucitron' + (useJSDelivrMinifiedJS ? '.min' : '') + '.css?v=' + tarteaucitron.version;
|
||||||
document.getElementsByTagName('head')[0].appendChild(linkElement);
|
document.getElementsByTagName('head')[0].appendChild(linkElement);
|
||||||
}
|
}
|
||||||
// Step 2: load language and services
|
// Step 2: load language and services
|
||||||
|
|
@ -470,7 +471,7 @@ var tarteaucitron = {
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
tarteaucitron.addInternalScript(tarteaucitron.cdn + 'advertising.js?v=' + tarteaucitron.version, '', function () {
|
tarteaucitron.addInternalScript(tarteaucitron.cdn + 'advertising' + (useJSDelivrMinifiedJS ? '.min' : '') + '.js?v=' + tarteaucitron.version, '', function () {
|
||||||
if (tarteaucitronNoAdBlocker === true || tarteaucitron.parameters.adblocker === false) {
|
if (tarteaucitronNoAdBlocker === true || tarteaucitron.parameters.adblocker === false) {
|
||||||
|
|
||||||
// create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened
|
// create a wrapper container at the same level than tarteaucitron so we can add an aria-hidden when tarteaucitron is opened
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue