mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-28 01:10:51 +01:00
main.js: a bit more sane code
This commit is contained in:
parent
6991ca270e
commit
02c3c28a16
@ -79,8 +79,8 @@ watchlist.add = function(sel) {
|
|||||||
} else {
|
} else {
|
||||||
postCount = $(sel).parents('.op').siblings('.post').length+1;
|
postCount = $(sel).parents('.op').siblings('.post').length+1;
|
||||||
}
|
}
|
||||||
//Grab the reply link.
|
//Grab the reply link.;
|
||||||
var threadLink = $(sel).siblings('a:contains("['+_('Reply')+']")').attr('href');
|
var threadLink = $(sel).siblings('a:not(.watchThread)').last().attr('href');
|
||||||
//Figure out the thread name. If anon, use the thread id.
|
//Figure out the thread name. If anon, use the thread id.
|
||||||
if ($(sel).parent().find('.subject').length) {
|
if ($(sel).parent().find('.subject').length) {
|
||||||
threadName = $(sel).parent().find('.subject').text().substring(0,20);
|
threadName = $(sel).parent().find('.subject').text().substring(0,20);
|
||||||
|
@ -4,10 +4,12 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var
|
||||||
{% if not no_post_form %}
|
{% if not no_post_form %}
|
||||||
var active_page = "index";
|
active_page = "index"
|
||||||
|
, board_name = "{{ board.uri }}";
|
||||||
{% else %}
|
{% else %}
|
||||||
var active_page = "ukko";
|
active_page = "ukko";
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -115,7 +115,10 @@ var styles = {
|
|||||||
{% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',
|
{% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',
|
||||||
{% endraw %}{% endfor %}{% raw %}
|
{% endraw %}{% endfor %}{% raw %}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (typeof board_name === 'undefined') {
|
||||||
var board_name = false;
|
var board_name = false;
|
||||||
|
}
|
||||||
|
|
||||||
function changeStyle(styleName, link) {
|
function changeStyle(styleName, link) {
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
@ -159,13 +162,7 @@ function changeStyle(styleName, link) {
|
|||||||
|
|
||||||
{% endraw %}
|
{% endraw %}
|
||||||
{% if config.stylesheets_board %}
|
{% if config.stylesheets_board %}
|
||||||
{# This is such an unacceptable mess. There needs to be an easier way. #}
|
|
||||||
{# Needs fix for slugify #}
|
|
||||||
var matches = document.URL.match(/\/(\w+)\/($|{{ config.dir.res|replace({'/': '\\/'}) }}{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }}|{{ config.file_index|replace({'.': '\\.'}) }}|{{ config.file_page|replace({'%d': '\\d+', '.': '\\.'}) }})/);
|
|
||||||
{% raw %}
|
{% raw %}
|
||||||
if (matches) {
|
|
||||||
board_name = matches[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!localStorage.board_stylesheets) {
|
if (!localStorage.board_stylesheets) {
|
||||||
localStorage.board_stylesheets = '{}';
|
localStorage.board_stylesheets = '{}';
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
active_page = "page";
|
var active_page = "page";
|
||||||
</script>
|
</script>
|
||||||
{% include 'header.html' %}
|
{% include 'header.html' %}
|
||||||
<title>{{ title }}</title>
|
<title>{{ title }}</title>
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
active_page = "catalog";
|
var active_page = "catalog"
|
||||||
|
, board_name = "{{ board }}";
|
||||||
</script>
|
</script>
|
||||||
{% include 'header.html' %}
|
{% include 'header.html' %}
|
||||||
<title>{{ settings.title }}</title>
|
<title>{{ settings.title }}</title>
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var active_page = "thread";
|
var active_page = "thread"
|
||||||
|
, board_name = "{{ board.uri }}"
|
||||||
|
, thread_id = "{{ thread.id }}";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% include 'header.html' %}
|
{% include 'header.html' %}
|
||||||
|
Loading…
Reference in New Issue
Block a user