##// END OF EJS Templates
Removed user last access time update to speed up page load.
Removed user last access time update to speed up page load.

File last commit:

r125:449be9e6 default
r196:005f6ba5 default
Show More
thread.js
103 lines | 2.5 KiB | application/javascript | JavascriptLexer
neko259
#37 Added javascript gallery mode for viewing thread in image-only mode.
r66 var image_mode = 0;
var normal_dom, table_dom;
function add_panel(after)
{
var nav_top = $(after);
if (nav_top.length === 0) return;
nav_top = nav_top[0];
var tab_bar = $('<div class="image-mode-tab" role="radiogroup" aria-label="Image mode"></div>');
var tab;
tab = $('<input type="radio" class="image-mode-normal" name="image-mode" value="0" checked="checked"/>');
tab.on("change", tab_handler);
neko259
Added translation for javascript. This fixes #36
r122
var label_normal = gettext('Normal');
tab = $('<label>' + label_normal + '</label>').prepend(tab);
neko259
#37 Added javascript gallery mode for viewing thread in image-only mode.
r66 tab_bar.append(tab);
tab = $('<input type="radio" class="image-mode-table" name="image-mode" value="1"/>');
tab.on("change", tab_handler);
neko259
Added translation for javascript. This fixes #36
r122
var label_gallery = gettext('Gallery');
tab = $('<label>' + label_gallery + '</label>').prepend(tab);
neko259
#37 Added javascript gallery mode for viewing thread in image-only mode.
r66 tab_bar.append(tab);
tab_bar.insertAfter(nav_top);
}
function tab_handler(ev)
{
var current_el = $(this);
if (!current_el.prop('checked')) return;
var new_mode = parseInt(current_el.val(), 10);
if (new_mode === image_mode) return;
image_mode = new_mode;
make_normal_dom();
make_table_dom();
switch(new_mode) {
case 0:
$('#posts-table').replaceWith(normal_dom);
break;
case 1:
$('#posts').replaceWith(table_dom);
break;
}
}
function make_normal_dom()
{
if (typeof normal_dom === 'undefined') {
normal_dom = $('#posts').clone(true);
}
}
function make_table_dom()
{
if (typeof table_dom !== 'undefined') return;
table_dom = $('<div id="posts-table"></div>');
$('#posts > .post > .image > a').each(
function(){
table_dom.append(
$(this).clone().attr('target', '_blank')
);
}
);
}
Pavel Ryapolov
Move cursor to the text area end after replying.
r106 function moveCaretToEnd(el) {
if (typeof el.selectionStart == "number") {
el.selectionStart = el.selectionEnd = el.value.length;
} else if (typeof el.createTextRange != "undefined") {
el.focus();
var range = el.createTextRange();
range.collapse(false);
range.select();
}
}
neko259
Added links to reply a post in the thread view. Removed quote paddings in white theme.
r97 function addQuickReply(postId) {
var textToAdd = '>>' + postId + '\n\n';
Pavel Ryapolov
Setting focus to text area after reply.
r107 var textAreaId = '#id_text';
$(textAreaId).val($(textAreaId).val()+ textToAdd);
neko259
Added links to reply a post in the thread view. Removed quote paddings in white theme.
r97
Pavel Ryapolov
Move cursor to the text area end after replying.
r106 var textarea = document.getElementById('id_text');
Pavel Ryapolov
Setting focus to text area after reply.
r107 $(textAreaId).focus();
Pavel Ryapolov
Move cursor to the text area end after replying.
r106 moveCaretToEnd(textarea);
Pavel Ryapolov
Setting focus to text area after reply.
r107 $("html, body").animate({ scrollTop: $(textAreaId).offset().top }, "slow");
neko259
Added links to reply a post in the thread view. Removed quote paddings in white theme.
r97 }
ritsufag
Add reflink map
r118
neko259
#37 Added javascript gallery mode for viewing thread in image-only mode.
r66 $(document).ready(function(){
add_panel('.navigation_panel');
ritsufag
Add reflink map
r118 addRefLinkMap();
Pavel Ryapolov
Move cursor to the text area end after replying.
r106 });