diff options
| author | czaks <marcin@6irc.net> | 2014-01-29 22:43:09 +0100 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2014-01-29 22:53:31 +0100 |
| commit | 4636f5b6efeabbdb8ead0b6f2ce96212fbed75b7 (patch) | |
| tree | 8f4af74ffa47d34614cb75584a09bb2c15f55b24 | |
| parent | 31584986e47b2e796f10c547c115080e028937ed (diff) | |
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
| -rw-r--r-- | js/watch.js | 15 | ||||
| -rw-r--r-- | 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 = $("<a href='/"+board+"/res/"+tid+".html'><span>#"+tid+"</span><span class='cb-uri watch-remove'>"+newposts+"</span>"); + tag = $("<a href='"+modRoot+board+"/res/"+tid+".html'><span>#"+tid+"</span><span class='cb-uri watch-remove'>"+newposts+"</span>"); 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 = $("<a href='/"+board+"/res/"+tid+".html'><span>#"+tid+"</span><span class='cb-uri'>"+newposts+"</span>" + tag = $("<a href='"+modRoot+board+"/res/"+tid+".html'><span>#"+tid+"</span><span class='cb-uri'>"+newposts+"</span>" +"<span class='cb-uri watch-remove'><i class='fa fa-minus'></i></span>"); } @@ -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 = $('<a href="/'+i+'/" class="cb-item cb-cat">/'+i+'/</a>').appendTo(pinned); + else link = $('<a href="'+modRoot+i+'/" class="cb-item cb-cat">/'+i+'/</a>').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 %}<meta name="keywords" content="{{ config.meta_keywords }}">{% endif %} {% if config.default_stylesheet.1 != '' %}<link rel="stylesheet" type="text/css" id="stylesheet" href="{{ config.uri_stylesheets }}{{ config.default_stylesheet.1 }}">{% endif %} {% if config.font_awesome %}<link rel="stylesheet" media="screen" href="{{ config.root }}{{ config.font_awesome_css }}">{% endif %} - <script type="text/javascript">var configRoot="{{ config.root }}";</script> + <script type="text/javascript"> + var configRoot="{{ config.root }}"; + var inMod = {% if mod %}true{% else %}false{% end %}; + var modRoot="{{ config.root }}"+(inMod ? "mod.php?/" : ""); + </script> {% if not nojavascript %} <script type="text/javascript" src="{{ config.url_javascript }}"></script> {% if not config.additional_javascript_compile %} |
