diff options
Diffstat (limited to 'scripts/randomize.js')
-rw-r--r-- | scripts/randomize.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/randomize.js b/scripts/randomize.js index b225b2f..0ad9bf9 100644 --- a/scripts/randomize.js +++ b/scripts/randomize.js | |||
@@ -12,11 +12,18 @@ function _randomize() { | |||
12 | var index = Math.floor(Math.random() * files.length); | 12 | var index = Math.floor(Math.random() * files.length); |
13 | 13 | ||
14 | var url = window.location.pathname; | 14 | var url = window.location.pathname; |
15 | var current = "../" + url.substring(url.lastIndexOf('/')+1); | ||
15 | var current = url.substring(url.lastIndexOf('/')+1); | 16 | var current = url.substring(url.lastIndexOf('/')+1); |
16 | 17 | ||
17 | if (current != files[index]) { | 18 | if (current != files[index]) { |
18 | randomlink.setAttribute("href", files[index]); | 19 | var blre = /backlinks/ |
19 | randomlink.setAttribute("title", "To random article"); | 20 | if (!blre.test(url)) { |
21 | randomlink.setAttribute("href", files[index]); | ||
22 | randomlink.setAttribute("title", "To random article"); | ||
23 | } else { | ||
24 | randomlink.setAttribute("href", '../' + files[index]); | ||
25 | randomlink.setAttribute("title", "To random article"); | ||
26 | } | ||
20 | } else { | 27 | } else { |
21 | _randomize() | 28 | _randomize() |
22 | } | 29 | } |