From 7f1a8e0a6c3a63f4b01ccbb8a817d65444357a4c Mon Sep 17 00:00:00 2001 From: randogoth Date: Mon, 22 May 2023 10:06:52 +0300 Subject: [PATCH] selective js --- web/nfc-theme/static/geo.js | 33 +--------------------------- web/nfc-theme/static/user.js | 28 +++++++++++++++++++++++ web/nfc-theme/templates/article.html | 3 +++ web/nfc-theme/templates/base.html | 2 ++ 4 files changed, 34 insertions(+), 32 deletions(-) create mode 100644 web/nfc-theme/static/user.js diff --git a/web/nfc-theme/static/geo.js b/web/nfc-theme/static/geo.js index fa711eb..8b2e2af 100644 --- a/web/nfc-theme/static/geo.js +++ b/web/nfc-theme/static/geo.js @@ -17,35 +17,4 @@ if ( hasharray.length > 0 ) { else if ( android ) hashlink.href = "geo:0,0?q=" + latlon; else if ( ios ) hashlink.href = "http://maps.apple.com/?ll=" + latlon + "&q=" + hashlink.innerHTML; }); -} - -// fingerprint user - -/*! js-cookie v3.0.5 | MIT */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t { - let - d = new Date().getTime(), - d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0; - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { - let r = Math.random() * 16; - if (d > 0) { - r = (d + r) % 16 | 0; - d = Math.floor(d / 16); - } else { - r = (d2 + r) % 16 | 0; - d2 = Math.floor(d2 / 16); - } - return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16); - }); - }; - -if ( !Cookies.get('nfcexplorer') ) { - Cookies.set('nfcexplorer', generateUUID()) -} - -fetch('https://nmns.place/track?' + new URLSearchParams({ - hash: Cookies.get('nfcexplorer'), - ua: ua, -})); \ No newline at end of file +} \ No newline at end of file diff --git a/web/nfc-theme/static/user.js b/web/nfc-theme/static/user.js new file mode 100644 index 0000000..296ed76 --- /dev/null +++ b/web/nfc-theme/static/user.js @@ -0,0 +1,28 @@ +/*! js-cookie v3.0.5 | MIT */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,(function(){"use strict";function e(e){for(var t=1;t { + let + d = new Date().getTime(), + d2 = ((typeof performance !== 'undefined') && performance.now && (performance.now() * 1000)) || 0; + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => { + let r = Math.random() * 16; + if (d > 0) { + r = (d + r) % 16 | 0; + d = Math.floor(d / 16); + } else { + r = (d2 + r) % 16 | 0; + d2 = Math.floor(d2 / 16); + } + return (c == 'x' ? r : (r & 0x7 | 0x8)).toString(16); + }); + }; + +if ( !Cookies.get('nfcexplorer') ) { + Cookies.set('nfcexplorer', generateUUID()) +} + +fetch('https://nmns.place/track?' + new URLSearchParams({ + hash: Cookies.get('nfcexplorer'), + ua: ua, +})); \ No newline at end of file diff --git a/web/nfc-theme/templates/article.html b/web/nfc-theme/templates/article.html index fdae598..8f8e317 100644 --- a/web/nfc-theme/templates/article.html +++ b/web/nfc-theme/templates/article.html @@ -9,3 +9,6 @@ {% endblock %} +{% block scripts %} + +{% endblock %} \ No newline at end of file diff --git a/web/nfc-theme/templates/base.html b/web/nfc-theme/templates/base.html index 7881858..d25a5ee 100644 --- a/web/nfc-theme/templates/base.html +++ b/web/nfc-theme/templates/base.html @@ -21,6 +21,8 @@ {% endif %} +{% block scripts %} +{% endblock %}