diff options
author | Case Duckworth | 2015-04-14 18:09:55 -0700 |
---|---|---|
committer | Case Duckworth | 2015-04-14 18:09:55 -0700 |
commit | 08fd8e95dccb91d0495a50d1009f85cb80cfad65 (patch) | |
tree | 9accf8a6e9b1f836e3c7c7b5437d11351545a07e /scripts/randomize.js | |
parent | Change file hierarchy and rewrite makefile (diff) | |
download | autocento-08fd8e95dccb91d0495a50d1009f85cb80cfad65.tar.gz autocento-08fd8e95dccb91d0495a50d1009f85cb80cfad65.zip |
First compile in v1.0.0 v1.0.0
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 | } |