diff options
author | sn4il <sn4il@localhost.localdomain> | 2024-05-04 19:33:08 +0300 |
---|---|---|
committer | sn4il <sn4il@localhost.localdomain> | 2024-05-04 19:33:08 +0300 |
commit | 15b6a74002796d6d3532884f112bfe9ffc9763ae (patch) | |
tree | fc0d73215a120f7c6e2f4e8acdedfd772c2a6773 /ring/getid.js | |
download | smol-15b6a74002796d6d3532884f112bfe9ffc9763ae.tar.gz smol-15b6a74002796d6d3532884f112bfe9ffc9763ae.zip |
Init
Diffstat (limited to 'ring/getid.js')
-rwxr-xr-x | ring/getid.js | 28 |
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 |