tarteaucitron.js: Now using document.currentScript if available

This commit is contained in:
Dagrut 2023-06-09 10:39:54 +04:00 committed by GitHub
parent fbf3a8cf27
commit 024793ef12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1,7 +1,7 @@
/*jslint browser: true, evil: true */
var scripts = document.getElementsByTagName('script'),
path = scripts[scripts.length - 1].src.split('?')[0],
path = (document.currentScript || scripts[scripts.length - 1]).src.split('?')[0],
tarteaucitronForceCDN = (tarteaucitronForceCDN === undefined) ? '' : tarteaucitronForceCDN,
cdn = (tarteaucitronForceCDN === '') ? path.split('/').slice(0, -1).join('/') + '/' : tarteaucitronForceCDN,
alreadyLaunch = (alreadyLaunch === undefined) ? 0 : alreadyLaunch,