summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authoranonfagola <anonfagola@users.noreply.github.com>2014-09-23 19:31:06 -0700
committerczaks <marcin@6irc.net>2014-09-24 04:47:40 +0200
commitb9886dc474e5d3fcbf879bd6237bae739c63a9f1 (patch)
tree8e8a7af6cd2270d1ded424cd603d0a5fffdf1dc4 /js
parent712e7f6c575f028511bf1ecfdf81e0a02df913fc (diff)
Update threadscroll.js
Made compatible for use with additional_javascripts.
Diffstat (limited to 'js')
-rw-r--r--js/threadscroll.js62
1 files changed, 32 insertions, 30 deletions
diff --git a/js/threadscroll.js b/js/threadscroll.js
index 5cbcbbe8..c3c6deef 100644
--- a/js/threadscroll.js
+++ b/js/threadscroll.js
@@ -1,35 +1,37 @@
-var hoverElem = null;
-
-$(document).mouseover(function(e){
- var x = e.clientX, y = e.clientY,
- elementOnMouseOver = document.elementFromPoint(x, y);
- hoverElem = $(elementOnMouseOver);
-});
-
-$(document).keydown(function(e){
- //Up arrow
- if(e.which == 38){
- var ele = hoverElem;
- var par = $(ele).parents('div[id^="thread_"]');
-
- if(par.length == 1){
- if(par.prev().attr("id") != null){
- if(par.prev().attr("id").match("^thread")){
- window.location.href = window.location.protocol+"//"+window.location.host+window.location.pathname+"#"+par.prev().attr("id");
+if(active_page == "index" || active_page == "ukko"){
+ var hoverElem = null;
+
+ $(document).mouseover(function(e){
+ var x = e.clientX, y = e.clientY,
+ elementOnMouseOver = document.elementFromPoint(x, y);
+ hoverElem = $(elementOnMouseOver);
+ });
+
+ $(document).keydown(function(e){
+ //Up arrow
+ if(e.which == 38){
+ var ele = hoverElem;
+ var par = $(ele).parents('div[id^="thread_"]');
+
+ if(par.length == 1){
+ if(par.prev().attr("id") != null){
+ if(par.prev().attr("id").match("^thread")){
+ window.location.href = window.location.protocol+"//"+window.location.host+window.location.pathname+"#"+par.prev().attr("id");
+ }
}
}
- }
- //Down arrow
- }else if(e.which == 40){
- var ele = hoverElem;
- var par = $(ele).parents('div[id^="thread_"]');
-
- if(par.length == 1){
- if(par.next().attr("id") != null){
- if(par.next().attr("id").match("^thread")){
- window.location.href = window.location.protocol+"//"+window.location.host+window.location.pathname+"#"+par.next().attr("id");
+ //Down arrow
+ }else if(e.which == 40){
+ var ele = hoverElem;
+ var par = $(ele).parents('div[id^="thread_"]');
+
+ if(par.length == 1){
+ if(par.next().attr("id") != null){
+ if(par.next().attr("id").match("^thread")){
+ window.location.href = window.location.protocol+"//"+window.location.host+window.location.pathname+"#"+par.next().attr("id");
+ }
}
}
}
- }
-});
+ });
+}