Browse Source

added redirect.js

master
Luna 9 months ago
parent
commit
17bcd8da92
2 changed files with 4 additions and 2 deletions
  1. 3
    1
      README.md
  2. 1
    1
      data/public/redirect.js

+ 3
- 1
README.md View File

@@ -26,7 +26,7 @@ Then visit $VIRTUAL_HOST/?to=http%3A%2F%2Fcan-i.help%2F after a couple of minute
26 26
 <br>
27 27
 ## Use:
28 28
 
29
-Include this script in whatever page you want the links to be redirected:
29
+Include this script in whatever page you want the links to be redirected (required [jQuery](https://jquery.com/download/) to be included earlier on the page):
30 30
 
31 31
 ```
32 32
 <script src="https://$VIRTUAL_HOST/redirect.js" id="noref-redirect"></script>
@@ -34,6 +34,8 @@ Include this script in whatever page you want the links to be redirected:
34 34
 
35 35
 You can use the ```accept``` parameter to avoid redirecting specific domains. Domains must be comma separated, and * allows to match all subdomains. Url will be for example ```https://$VIRTUAL_HOST/redirect.js?accept=*.can-i.help,can-i.help```.
36 36
 
37
+You can also add the "keep-ref" class to whatever links you want not to be protected.
38
+
37 39
 <br>
38 40
 ## License:
39 41
 

+ 1
- 1
data/public/redirect.js View File

@@ -14,7 +14,7 @@ jQuery(document).ready(function(){
14 14
 	    jQuery(this).data('href', href);
15 15
 	}
16 16
 
17
-	if (href[0] == '#' || href.substr(0, 4) != 'http')
17
+	if (href[0] == '#' || href.substr(0, 4) != 'http' || jQuery(this).hasClass('keep-ref'))
18 18
 	    return true;
19 19
 
20 20
 	if (accept){

Loading…
Cancel
Save