Fix index.html to work in non-root directories

This commit is contained in:
calzoneman 2013-05-19 13:34:14 -04:00
parent cf2e1213a9
commit ea9132624a
1 changed files with 5 additions and 4 deletions

View File

@ -90,8 +90,9 @@
<script type="text/javascript"> <script type="text/javascript">
var host = document.location+""; var host = document.location+"";
host = host.replace("http://", ""); host = host.replace("http://", "");
if(host.indexOf("/") != -1) var parts = host.split("/");
host = host.substring(0, host.indexOf("/")); parts[parts.length - 1] = "";
host = parts.join("/");
host = "http://" + host; host = "http://" + host;
setInterval(refresh, 10000); setInterval(refresh, 10000);
refresh(); refresh();
@ -142,7 +143,7 @@
var d = data[i]; var d = data[i];
var tr = $("<tr/>").appendTo($("#channeldata")); var tr = $("<tr/>").appendTo($("#channeldata"));
var name = $("<td/>").appendTo(tr); var name = $("<td/>").appendTo(tr);
$("<a/>").attr("href", host + "/r/" + d.name) $("<a/>").attr("href", host + "r/" + d.name)
.text(d.name) .text(d.name)
.appendTo(name); .appendTo(name);
$("<td/>").text(d.pagetitle).appendTo(tr); $("<td/>").text(d.pagetitle).appendTo(tr);
@ -166,7 +167,7 @@
alert("Invalid channel names. Channel names may contain alphanumeric characters, underscores, and hyphens"); alert("Invalid channel names. Channel names may contain alphanumeric characters, underscores, and hyphens");
return; return;
} }
document.location = host + "/r/" + $("#channel").val(); document.location = host + "r/" + $("#channel").val();
} }
}); });
</script> </script>