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
This commit is contained in:
parent
31584986e4
commit
4636f5b6ef
15
js/watch.js
15
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);
|
||||
|
@ -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 %}
|
||||
|
Loading…
Reference in New Issue
Block a user