Michael Save
12 years ago
11 changed files with 2 additions and 516 deletions
@ -0,0 +1,2 @@ |
|||||
|
This section has been merged into https://github.com/savetheinternet/Tinyboard. |
||||
|
|
@ -1,51 +0,0 @@ |
|||||
/* |
|
||||
* auto-reload.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/auto-reload.js
|
|
||||
* |
|
||||
* Brings AJAX to Tinyboard. |
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; |
|
||||
* $config['additional_javascript'][] = 'js/auto-reload.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function(){ |
|
||||
if($('div.banner').length == 0) |
|
||||
return; // not index
|
|
||||
|
|
||||
var poll_interval; |
|
||||
|
|
||||
var poll = function() { |
|
||||
$.ajax({ |
|
||||
url: document.location, |
|
||||
success: function(data) { |
|
||||
$(data).find('div.post.reply').each(function() { |
|
||||
var id = $(this).attr('id'); |
|
||||
if($('#' + id).length == 0) { |
|
||||
$(this).insertAfter($('div.post:last').next()).after('<br class="clear">'); |
|
||||
$(document).trigger('new_post', this); |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
||||
poll_interval = setTimeout(poll, 5000); |
|
||||
}; |
|
||||
|
|
||||
$(window).scroll(function() { |
|
||||
if($(this).scrollTop() + $(this).height() < $('div.post:last').position().top + $('div.post:last').height()) { |
|
||||
clearTimeout(poll_interval); |
|
||||
poll_interval = false; |
|
||||
return; |
|
||||
} |
|
||||
|
|
||||
if(poll_interval === false) { |
|
||||
poll_interval = setTimeout(poll, 1500); |
|
||||
} |
|
||||
}).trigger('scroll'); |
|
||||
}); |
|
||||
|
|
@ -1,26 +0,0 @@ |
|||||
/* |
|
||||
* fix-report-delete-submit.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/fix-report-delete-submit.js
|
|
||||
* |
|
||||
* Fixes a known bug regarding the delete/report submit buttons. |
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; |
|
||||
* $config['additional_javascript'][] = 'js/fix-report-delete-submit.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function(){ |
|
||||
$('form[name="postcontrols"] div.delete input:not([type="checkbox"]):not([type="submit"]):not([type="hidden"])').keypress(function(e) { |
|
||||
if(e.which == 13) { |
|
||||
e.preventDefault(); |
|
||||
$(this).next().click(); |
|
||||
return false; |
|
||||
} |
|
||||
return true; |
|
||||
}); |
|
||||
}); |
|
||||
|
|
@ -1,85 +0,0 @@ |
|||||
/* |
|
||||
* forced-anon.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/forced-anon.js
|
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; |
|
||||
* $config['additional_javascript'][] = 'js/forced-anon.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function() { |
|
||||
var force_anon = function() { |
|
||||
if($(this).children('a.capcode').length == 0) { |
|
||||
var id = $(this).parent().children('a.post_no:eq(1)').text(); |
|
||||
|
|
||||
if($(this).children('a.email').length != 0) |
|
||||
var p = $(this).children('a.email'); |
|
||||
else |
|
||||
var p = $(this); |
|
||||
|
|
||||
old_info[id] = {'name': p.children('span.name').text(), 'trip': p.children('span.trip').text()}; |
|
||||
|
|
||||
p.children('span.name').text('Anonymous'); |
|
||||
if(p.children('span.trip').length != 0) |
|
||||
p.children('span.trip').text(''); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
var enable_fa = function() { |
|
||||
$('p.intro label').each(force_anon); |
|
||||
}; |
|
||||
|
|
||||
var disable_fa = function() { |
|
||||
$('p.intro label').each(function() { |
|
||||
if($(this).children('a.capcode').length == 0) { |
|
||||
var id = $(this).parent().children('a.post_no:eq(1)').text(); |
|
||||
|
|
||||
if(old_info[id]) { |
|
||||
if($(this).children('a.email').length != 0) |
|
||||
var p = $(this).children('a.email'); |
|
||||
else |
|
||||
var p = $(this); |
|
||||
|
|
||||
p.children('span.name').text(old_info[id]['name']); |
|
||||
if(p.children('span.trip').length != 0) |
|
||||
p.children('span.trip').text(old_info[id]['trip']); |
|
||||
} |
|
||||
} |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
old_info = {}; |
|
||||
forced_anon = localStorage['forcedanon'] ? true : false; |
|
||||
|
|
||||
$('hr:first').before('<div id="forced-anon" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>'); |
|
||||
$('div#forced-anon a').text('Forced anonymity (' + (forced_anon ? 'enabled' : 'disabled') + ')'); |
|
||||
|
|
||||
$('div#forced-anon a').click(function() { |
|
||||
forced_anon = !forced_anon; |
|
||||
|
|
||||
if(forced_anon) { |
|
||||
$('div#forced-anon a').text('Forced anonymity (enabled)'); |
|
||||
localStorage.forcedanon = true; |
|
||||
enable_fa(); |
|
||||
} else { |
|
||||
$('div#forced-anon a').text('Forced anonymity (disabled)'); |
|
||||
delete localStorage.forcedanon; |
|
||||
disable_fa(); |
|
||||
} |
|
||||
|
|
||||
return false; |
|
||||
}); |
|
||||
|
|
||||
if(forced_anon) |
|
||||
enable_fa(); |
|
||||
|
|
||||
$(document).bind('new_post', function(e, post) { |
|
||||
if(forced_anon) |
|
||||
$(post).find('p.intro label').each(force_anon); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
File diff suppressed because one or more lines are too long
@ -1,42 +0,0 @@ |
|||||
/* |
|
||||
* local-time.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/local-time.js
|
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['quick_reply'] = true; |
|
||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; |
|
||||
* $config['additional_javascript'][] = 'js/local-time.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function(){ |
|
||||
var iso8601 = function(s) { |
|
||||
s = s.replace(/\.\d\d\d+/,""); // remove milliseconds
|
|
||||
s = s.replace(/-/,"/").replace(/-/,"/"); |
|
||||
s = s.replace(/T/," ").replace(/Z/," UTC"); |
|
||||
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
|
|
||||
return new Date(s); |
|
||||
}; |
|
||||
var zeropad = function(num, count) { |
|
||||
return [Math.pow(10, count - num.toString().length), num].join('').substr(1); |
|
||||
}; |
|
||||
|
|
||||
$('time').each(function() { |
|
||||
if(!$(this).text().match(/^\d+\/\d+\/\d+ \(\w+\) \d+:\d+:\d+$/)) |
|
||||
return; |
|
||||
|
|
||||
var t = iso8601($(this).attr('datetime')); |
|
||||
|
|
||||
$(this).text( |
|
||||
// date
|
|
||||
zeropad(t.getMonth() + 1, 2) + "/" + zeropad(t.getDate(), 2) + "/" + t.getFullYear().toString().substring(2) + |
|
||||
" (" + ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][t.getDay()] + ") " + |
|
||||
// time
|
|
||||
zeropad(t.getHours(), 2) + ":" + zeropad(t.getMinutes(), 2) + ":" + zeropad(t.getSeconds(), 2) |
|
||||
); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
@ -1,117 +0,0 @@ |
|||||
/* |
|
||||
* post-hover.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/post-hover.js
|
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; |
|
||||
* $config['additional_javascript'][] = 'js/post-hover.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function(){ |
|
||||
var dont_fetch_again = []; |
|
||||
var init_hover = function() { |
|
||||
var link = $(this); |
|
||||
|
|
||||
var id; |
|
||||
|
|
||||
if(id = $(link).text().match(/^>>(\d+)$/)) { |
|
||||
id = id[1]; |
|
||||
} |
|
||||
|
|
||||
var post = false; |
|
||||
var hovering = false; |
|
||||
var hovered_at; |
|
||||
$(link).hover(function(e) { |
|
||||
hovering = true; |
|
||||
hovered_at = {'x': e.pageX, 'y': e.pageY}; |
|
||||
|
|
||||
var start_hover = function(link) { |
|
||||
if(post.is(':visible') && |
|
||||
post.offset().top + post.height() >= $(window).scrollTop() && |
|
||||
post.offset().top <= $(window).scrollTop() + $(window).height() |
|
||||
) { |
|
||||
// post is in view
|
|
||||
post.attr('style', 'border-style: none dashed dashed none; background: ' + post.css('border-right-color')); |
|
||||
} else { |
|
||||
post.clone() |
|
||||
.attr('id', 'post-hover-' + id) |
|
||||
.addClass('post-hover') |
|
||||
.css('position', 'absolute') |
|
||||
.css('border-style', 'solid') |
|
||||
.css('box-shadow', '1px 1px 1px #999') |
|
||||
.css('display', 'block') |
|
||||
.insertAfter($(link).parent()); |
|
||||
$(link).trigger('mousemove'); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
post = $('div.post#reply_' + id); |
|
||||
if(post.length > 0) { |
|
||||
start_hover(this); |
|
||||
} else { |
|
||||
var url = link.attr('href').replace(/#.*$/, ''); |
|
||||
|
|
||||
if($.inArray(url, dont_fetch_again) != -1) { |
|
||||
return; |
|
||||
} |
|
||||
dont_fetch_again.push(url); |
|
||||
|
|
||||
$.ajax({ |
|
||||
url: url, |
|
||||
context: document.body, |
|
||||
success: function(data) { |
|
||||
$(data).find('div.post.reply').each(function() { |
|
||||
if($('#' + $(this).attr('id')).length == 0) |
|
||||
$('div.post:first').prepend($(this).css('display', 'none').addClass('hidden')); |
|
||||
|
|
||||
}); |
|
||||
|
|
||||
post = $('div.post#reply_' + id); |
|
||||
if(hovering && post.length > 0) { |
|
||||
start_hover(link); |
|
||||
} |
|
||||
} |
|
||||
}); |
|
||||
} |
|
||||
}, function() { |
|
||||
hovering = false; |
|
||||
if(!post) |
|
||||
return; |
|
||||
|
|
||||
post.attr('style', ''); |
|
||||
if(post.hasClass('hidden')) |
|
||||
post.css('display', 'none'); |
|
||||
$('.post-hover').remove(); |
|
||||
}).mousemove(function(e) { |
|
||||
if(!post) |
|
||||
return; |
|
||||
|
|
||||
var hover = $('#post-hover-' + id); |
|
||||
if(hover.length == 0) |
|
||||
return; |
|
||||
|
|
||||
var top = (e.pageY ? e.pageY : hovered_at['y']) - 10; |
|
||||
|
|
||||
if(e.pageY < $(window).scrollTop() + 15) { |
|
||||
top = $(window).scrollTop(); |
|
||||
} else if(e.pageY > $(window).scrollTop() + $(window).height() - hover.height() - 15) { |
|
||||
top = $(window).scrollTop() + $(window).height() - hover.height() - 15; |
|
||||
} |
|
||||
|
|
||||
|
|
||||
hover.css('left', (e.pageX ? e.pageX : hovered_at['x'])).css('top', top); |
|
||||
}); |
|
||||
}; |
|
||||
|
|
||||
$('p.body a:not([rel="nofollow"])').each(init_hover); |
|
||||
|
|
||||
// allow to work with auto-reload.js, etc.
|
|
||||
$(document).bind('new_post', function(e, post) { |
|
||||
$(post).find('p.body a:not([rel="nofollow"])').each(init_hover); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
@ -1,80 +0,0 @@ |
|||||
/* |
|
||||
* quick-posts-controls.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/quick-posts-controls.js
|
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; |
|
||||
* $config['additional_javascript'][] = 'js/quick-post-controls.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function(){ |
|
||||
var open_form = function() { |
|
||||
var thread = $(this).parent().parent().hasClass('op'); |
|
||||
var id = $(this).attr('name').match(/^delete_(\d+)$/)[1]; |
|
||||
var submitButton; |
|
||||
|
|
||||
if(this.checked) { |
|
||||
var post_form = $('<form class="post-actions" method="post" style="margin:10px 0 0 0">' + |
|
||||
'<div style="text-align:right">' + |
|
||||
(!thread ? '<hr>' : '') + |
|
||||
|
|
||||
'<input type="hidden" name="delete_' + id + '">' + |
|
||||
|
|
||||
'<label for="password_' + id + '">Password</label>: ' + |
|
||||
'<input id="password_' + id + '" type="password" name="password" size="11" maxlength="18">' + |
|
||||
'<input title="Delete file only" type="checkbox" name="file" id="delete_file_' + id + '">' + |
|
||||
'<label for="delete_file_' + id + '">File</label>' + |
|
||||
' <input type="submit" name="delete" value="Delete">' + |
|
||||
|
|
||||
'<br>' + |
|
||||
|
|
||||
'<label for="reason_' + id + '">Reason</label>: ' + |
|
||||
'<input id="reason_' + id + '" type="text" name="reason" size="20" maxlength="100">' + |
|
||||
' <input type="submit" name="report" value="Report">' + |
|
||||
'</div>' + |
|
||||
'</form>'); |
|
||||
post_form |
|
||||
.attr('action', $('form:first').attr('action')) |
|
||||
.append($('input[name=board]:first').clone()) |
|
||||
.find('input:not([type="checkbox"]):not([type="submit"]):not([type="hidden"])').keypress(function(e) { |
|
||||
if(e.which == 13) { |
|
||||
e.preventDefault(); |
|
||||
if($(this).attr('name') == 'password') { |
|
||||
post_form.find('input[name=delete]').click(); |
|
||||
} else if($(this).attr('name') == 'reason') { |
|
||||
post_form.find('input[name=report]').click(); |
|
||||
} |
|
||||
|
|
||||
return false; |
|
||||
} |
|
||||
|
|
||||
return true; |
|
||||
}); |
|
||||
|
|
||||
post_form.find('input[type="password"]').val(localStorage.password); |
|
||||
|
|
||||
if(thread) { |
|
||||
post_form.prependTo($(this).parent().parent().find('p.body')); |
|
||||
} else { |
|
||||
post_form.appendTo($(this).parent().parent()); |
|
||||
//post_form.insertBefore($(this));
|
|
||||
} |
|
||||
} else { |
|
||||
var elm = $(this).parent().parent().find('form'); |
|
||||
|
|
||||
if(elm.attr('class') == 'post-actions') |
|
||||
elm.remove(); |
|
||||
} |
|
||||
}; |
|
||||
|
|
||||
$('div.post input[type=checkbox].delete').each(function() { |
|
||||
$(this).change(open_form); |
|
||||
if(this.checked) |
|
||||
$(this).trigger('change'); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
@ -1,46 +0,0 @@ |
|||||
/* |
|
||||
* quick-reply.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/quick-reply.js
|
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['quick_reply'] = true; |
|
||||
* $config['additional_javascript'][] = 'js/jquery.min.js'; |
|
||||
* $config['additional_javascript'][] = 'js/quick-reply.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function(){ |
|
||||
if($('div.banner').length != 0) |
|
||||
return; // not index
|
|
||||
|
|
||||
txt_new_topic = $('form[name=post] input[type=submit]').val(); |
|
||||
txt_new_reply = txt_new_topic == 'Submit' ? txt_new_topic : 'New Reply'; |
|
||||
|
|
||||
undo_quick_reply = function() { |
|
||||
$('div.banner').remove(); |
|
||||
$('form[name=post] input[type=submit]').val(txt_new_topic); |
|
||||
$('form[name=post] input[name=quick-reply]').remove(); |
|
||||
} |
|
||||
|
|
||||
$('div.post.op').each(function() { |
|
||||
var id = $(this).children('p.intro').children('a.post_no:eq(1)').text(); |
|
||||
$('<a href="?/b/res/69.html">[Quick reply]</a>').insertAfter($(this).children('p.intro').children('a:last')).click(function() { |
|
||||
$('div.banner').remove(); |
|
||||
$('<div class="banner">Posting mode: Replying to <small>>>' + id + '</small> <a class="unimportant" onclick="undo_quick_reply()" href="javascript:void(0)">[Return]</a></div>') |
|
||||
.insertBefore('form[name=post]'); |
|
||||
$('form[name=post] input[type=submit]').val(txt_new_reply); |
|
||||
|
|
||||
$('<input type="hidden" name="quick-reply" value="' + id + '">').appendTo($('form[name=post]')); |
|
||||
|
|
||||
$('form[name=post] textarea').select(); |
|
||||
|
|
||||
window.scrollTo(0, 0); |
|
||||
|
|
||||
return false; |
|
||||
}); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
@ -1,37 +0,0 @@ |
|||||
/* |
|
||||
* show-backlinks.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/show-backlinks.js
|
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['additional_javascript'][] = 'js/show-backlinks.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function(){ |
|
||||
$('div.post.reply').each(function() { |
|
||||
var reply_id = $(this).attr('id').replace(/^reply_/, ''); |
|
||||
|
|
||||
$(this).find('p.body a:not([rel="nofollow"])').each(function() { |
|
||||
var id, post, mentioned; |
|
||||
|
|
||||
if(id = $(this).text().match(/^>>(\d+)$/)) |
|
||||
id = id[1]; |
|
||||
else |
|
||||
return; |
|
||||
|
|
||||
post = $('#reply_' + id); |
|
||||
if(post.length == 0) |
|
||||
return; |
|
||||
|
|
||||
mentioned = post.find('p.intro span.mentioned'); |
|
||||
if(mentioned.length == 0) |
|
||||
mentioned = $('<span class="mentioned"></span>').appendTo(post.find('p.intro')); |
|
||||
|
|
||||
mentioned.append('<a onclick="highlightReply(\'' + reply_id + '\');" href="#' + reply_id + '">>>' + reply_id + '</a>'); |
|
||||
}); |
|
||||
}); |
|
||||
}); |
|
||||
|
|
@ -1,28 +0,0 @@ |
|||||
/* |
|
||||
* smartphone-spoiler.js |
|
||||
* https://github.com/savetheinternet/Tinyboard-Tools/blob/master/js/smartphone-spoiler.js
|
|
||||
* |
|
||||
* Released under the MIT license |
|
||||
* Copyright (c) 2012 Michael Save <savetheinternet@tinyboard.org> |
|
||||
* |
|
||||
* Usage: |
|
||||
* $config['additional_javascript'][] = 'js/smartphone-spoiler.js'; |
|
||||
* |
|
||||
*/ |
|
||||
|
|
||||
$(document).ready(function(){ |
|
||||
/* This needs to be expanded upon: */ |
|
||||
var is_mobile = navigator.userAgent.match(/iPhone|iPod|iPad|Android/i); |
|
||||
|
|
||||
if(is_mobile) { |
|
||||
$('span.spoiler').each(function() { |
|
||||
$(this).click(function() { |
|
||||
if($(this).hasClass('show')) |
|
||||
$(this).css('color', 'black').removeClass('show'); |
|
||||
else |
|
||||
$(this).css('color', 'white').addClass('show'); |
|
||||
}); |
|
||||
}); |
|
||||
} |
|
||||
}); |
|
||||
|
|
Loading…
Reference in new issue