From 4636f5b6efeabbdb8ead0b6f2ce96212fbed75b7 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 29 Jan 2014 22:43:09 +0100 Subject: [PATCH] fix watch.js on nonstandard paths; fixes vichan-devel#38 this commit also adds a modRoot js variable that makes proper modlinks. also fixed in watch.js --- js/watch.js | 15 ++++++--------- templates/header.html | 6 +++++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/js/watch.js b/js/watch.js index d8a1dcae..5c111bcd 100644 --- a/js/watch.js +++ b/js/watch.js @@ -108,7 +108,6 @@ $(function(){ list.attr("data-board", board); for (var tid in storage()[board].threads) { - // TODO: fix path var newposts = "(0)"; if (status && status[board] && status[board].threads && status[board].threads[tid]) { if (status[board].threads[tid] == -404) { @@ -121,7 +120,7 @@ $(function(){ var tag; if (variant == 'desktop') { - tag = $("#"+tid+""+newposts+""); + tag = $("#"+tid+""+newposts+""); tag.find(".watch-remove").mouseenter(function() { this.oldval = $(this).html(); $(this).css("min-width", $(this).width()); @@ -132,7 +131,7 @@ $(function(){ }) } else if (variant == 'mobile') { - tag = $("#"+tid+""+newposts+"" + tag = $("#"+tid+""+newposts+"" +""); } @@ -163,10 +162,9 @@ $(function(){ for (var i in st) { if (is_pinned(st[i])) { var link; - if (bl.find('[href*="/'+i+'/index.html"]:not(.cb-menuitem)').length) link = bl.find('[href*="/'+i+'/"]').first(); + if (bl.find('[href*="'+modRoot+i+'/index.html"]:not(.cb-menuitem)').length) link = bl.find('[href*="'+modRoot+i+'/"]').first(); - // TODO: fix path - else link = $('/'+i+'/').appendTo(pinned); + else link = $('/'+i+'/').appendTo(pinned); if (link[0].origtitle === undefined) { link[0].origtitle = link.html(); @@ -240,15 +238,14 @@ $(function(){ var st = storage(); for (var i in st) { if (st[i].watched) { - // TODO: fix path - var r = $.getJSON("/"+i+"/threads.json", function(j, x, r) { + var r = $.getJSON(configRoot+i+"/threads.json", function(j, x, r) { handle_board_json(r.board, j); }); r.board = i; } else if (st[i].threads) { for (var j in st[i].threads) { - var r = $.getJSON("/"+i+"/res/"+j+".json", function(k, x, r) { + var r = $.getJSON(configRoot+i+"/res/"+j+".json", function(k, x, r) { handle_thread_json(r.board, r.thread, k); }).error(function(r) { if(r.status == 404) handle_thread_404(r.board, r.thread); diff --git a/templates/header.html b/templates/header.html index 0f4bd260..63725b73 100644 --- a/templates/header.html +++ b/templates/header.html @@ -5,7 +5,11 @@ {% if config.meta_keywords %}{% endif %} {% if config.default_stylesheet.1 != '' %}{% endif %} {% if config.font_awesome %}{% endif %} - + {% if not nojavascript %} {% if not config.additional_javascript_compile %}