aboutsummaryrefslogtreecommitdiff
path: root/ring/getid.js
diff options
context:
space:
mode:
Diffstat (limited to 'ring/getid.js')
-rwxr-xr-xring/getid.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/ring/getid.js b/ring/getid.js
new file mode 100755
index 0000000..4aba45d
--- /dev/null
+++ b/ring/getid.js
@@ -0,0 +1,28 @@
+var urls;
+var id;
+
+fetch("./urls.txt").then(response => response.text()).then((data) => {
+ urls=data.split("\n");
+ process();
+})
+
+function process() {
+ var urlParams = new URLSearchParams(window.location.search);
+ id=urlParams.get('id');
+
+ if (!urlParams.has('id') || id.isNaN || id==0){
+ id=-1;
+ var ref=document.referrer.replace(/[^/]*$/, '');
+
+ for (var i=0;i<urls.length;i++){
+ if (urls[i]==ref || urls[i]+"/"==ref){
+ id=i;
+ break;
+ }//end if
+ }//next
+ //console.log(document.referrer+" "+ref+" "+id);
+ }else{
+ id--;
+ }//end if
+ activate();
+}// \ No newline at end of file