1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-28 10:40:52 +02:00

much better sketch resetting using DOM rebuild

This commit is contained in:
Pomax
2020-09-16 22:43:16 -07:00
parent 4861c3a63b
commit ab4dd877ee
8 changed files with 292 additions and 194 deletions

View File

@@ -10,17 +10,15 @@
* grabs your document.referrer value, which (unless Do
* Not Track is enabled) will contain the location of
* the page you were on before you clicked a link to this
* page, and GETs that to my logger. That GET operation
* comes from your computer, so will have your IP as part
* of the HTTP headers.
* page, and GETs that to my logger.
*
* And that's all I really care about, because I want to
* know how many people visit this page, and roughly where
* they're from (gasp! IPs can be turned into rough
* geographical location O_O).
* If you want to know what gets logged, have a look
* at the ./src/logger/logger.php file on github.
*
* If you want to know what logger.php looks like, hit up
* github. It's in referrer/logger.php
* If that's too much effort:
* - the request URL
* - the referrer URL (if there is one)
* - the user agent
*
*/
(function referrer(l) {
@@ -32,20 +30,7 @@
if (loc.indexOf("localhost") !== -1) return;
// right, continue
var url = "https://pomax.nihongoresources.com/pages/bezierinfo/logger.php";
var xhr = new XMLHttpRequest();
xhr.open(
"GET",
url +
"?" +
"referrer=" +
encodeURIComponent(document.referrer) +
"&for=" +
page,
true
);
try {
xhr.send(null);
} catch (e) {
/* you don't care about this error, and I can't see it, so why would we do anything with it? */
}
fetch(`${url}?referrer=${encodeURIComponent(document.referrer)}&for=${page}`)
.then((_) => {})
.catch((_) => {});
})(window.location.toString());