Browse Source

Update jQuery libraries

Mainly for security purposes. Removed on('ready') function has been replace, most of deprecated ':' selectors have been removed (some :first selectors remain insted find() functions since I was unsure of the correct way to deal with them)
main
discomrade 2 years ago
parent
commit
8d3b5c86ab
  1. 2
      js/ajax.js
  2. 9
      js/auto-reload.js
  3. 2
      js/catalog-search.js
  4. 4
      js/comment-toolbar.js
  5. 8
      js/compact-boardlist.js
  6. 4
      js/expand-all-images.js
  7. 4
      js/forced-anon.js
  8. 2
      js/gallery-view.js
  9. 2
      js/id_colors.js
  10. 2
      js/image-hover.js
  11. 2
      js/infinite-scroll.js
  12. 8
      js/jquery-ui.custom.min.js
  13. 6
      js/jquery.min.js
  14. 2
      js/keyboard-shortcuts.js
  15. 4
      js/live-index.js
  16. 2
      js/mod/recent-posts-auto-reload.js
  17. 2
      js/mod/recent-posts.js
  18. 4
      js/multi-image.js
  19. 2
      js/no-animated-gif.js
  20. 4
      js/options.js
  21. 4
      js/quick-post-controls.js
  22. 8
      js/quick-reply.js
  23. 4
      js/thread-stats.js
  24. 2
      js/thread-watcher.js
  25. 2
      js/toggle-images.js
  26. 2
      js/toggle-locked-threads.js
  27. 2
      js/treeview.js
  28. 6
      js/watch.js

2
js/ajax.js

@ -97,7 +97,7 @@ $(window).ready(function() {
$(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">');
$(this).insertAfter($('div.post').last().next()).after('<br class="clear">');
$(document).trigger('new_post', this);
// watch.js & auto-reload.js retrigger
setTimeout(function() { $(window).trigger("scroll"); }, 100);

9
js/auto-reload.js

@ -151,10 +151,6 @@ $(document).ready(function(){
var id = $(this).attr('id');
if($('#' + id).length == 0) {
if (!new_posts) {
<<<<<<< HEAD
first_new_post = this;
}
=======
makeIcon('reply');
}
if (notify === "all" || (notify === "mention" && $(this).find('.own_post').length)) {
@ -162,8 +158,7 @@ $(document).ready(function(){
var n = new Notification("New reply to "+ title, {body: $('<div/>').html(body).text()});
}
>>>>>>> 5e4e27bc... Make all notifications show, not just the first unread
$(this).insertAfter($('div.post:not(.post-hover,.inline):last').next()).after('<br class="clear">');
$(this).insertAfter($('div.post:not(.post-hover,.inline)').last().next()).after('<br class="clear">');
new_posts++;
loaded_posts++;
$(document).trigger('new_post', this);
@ -230,7 +225,7 @@ $(document).ready(function(){
// if the newest post is not visible
if($(this).scrollTop() + $(this).height() <
$('div.post:last').position().top + $('div.post:last').height()) {
$('div.post').last().position().top + $('div.post').last().height()) {
end_of_page = false;
return;
} else {

2
js/catalog-search.js

@ -22,7 +22,7 @@ if (active_page == 'catalog') {
function filter(search_term) {
$('.replies').each(function () {
var subject = $(this).children('.intro').text().toLowerCase();
var comment = $(this).clone().children().remove(':lt(2)').end().text().trim().toLowerCase();
var comment = $(this).clone().children().slice(0,2).remove().end().end().text().trim().toLowerCase();
search_term = search_term.toLowerCase();
if (subject.indexOf(search_term) == -1 && comment.indexOf(search_term) == -1) {

4
js/comment-toolbar.js

@ -265,8 +265,8 @@ if (active_page == 'thread' || active_page == 'index') {
');
} else {
var s1 = '#formatText_keybinds', s2 = '#formatText_toolbar', e = 'click';
$('hr:first').before('<div id="formatText_keybinds" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Enable formatting keybinds') +'</a></div>');
$('hr:first').before('<div id="formatText_toolbar" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Show formatting toolbar') +'</a></div>');
$('hr').first().before('<div id="formatText_keybinds" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Enable formatting keybinds') +'</a></div>');
$('hr').first().before('<div id="formatText_toolbar" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+ _('Show formatting toolbar') +'</a></div>');
}
// add the tab for customizing the format settings

8
js/compact-boardlist.js

@ -21,7 +21,7 @@
* //$config['additional_javascript'][] = 'js/watch.js';
*
*/
$(document).on("ready", function() {
$(document).ready(function() {
if (window.Options && Options.get_tab('general')) {
Options.extend_tab("general",
"<fieldset><legend> Compact Board List </legend>"
@ -84,7 +84,7 @@ function initCompactBoardList() { //Pashe, influenced by tux, et al, WTFPL
do_boardlist = function() {
var categories = [];
var topbl = $('.boardlist:first');
var topbl = $('.boardlist').first();
topbl.find('>.sub').each(function() {
var cat = {name: $(this).data('description'), boards: []};
@ -176,8 +176,8 @@ options_tablist = $("<div id='options_tablist'></div>").appendTo(options_div);
options_button.addClass("cb-item cb-fa").html("<i class='fa fa-gear'></i>");
}
if ($(".boardlist:first").length) {
options_button.css('float', 'right').appendTo($(".boardlist:first"));
if ($(".boardlist").first().length) {
options_button.css('float', 'right').appendTo($(".boardlist").first());
}
else {
var optsdiv = $('<div style="text-align: right"></div>');

4
js/expand-all-images.js

@ -18,7 +18,7 @@
if (active_page == 'ukko' || active_page == 'thread' || active_page == 'index')
onready(function(){
$('hr:first').before('<div id="expand-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
$('hr').first().before('<div id="expand-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
$('div#expand-all-images a')
.text(_('Expand all images'))
.click(function() {
@ -36,7 +36,7 @@ onready(function(){
});
if (!$('#shrink-all-images').length) {
$('hr:first').before('<div id="shrink-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
$('hr').first().before('<div id="shrink-all-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)"></a></div>');
}
$('div#shrink-all-images a')

4
js/forced-anon.js

@ -75,8 +75,8 @@ $(document).ready(function() {
}
else {
var s1 = '#hide-ids', s2 = '#forced-anon', e = 'click';
$('hr:first').before('<div id="hide-ids" style="text-align:right"><a class="unimportant" href="javascript:void(0)">Hide IDs</a></div>');
$('hr:first').before('<div id="forced-anon" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('hr').first().before('<div id="hide-ids" style="text-align:right"><a class="unimportant" href="javascript:void(0)">Hide IDs</a></div>');
$('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')) + ')');
}

2
js/gallery-view.js

@ -3,7 +3,7 @@ $(function(){
var gallery_view = false;
$('hr:first').before('<div id="gallery-view" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('hr').first().before('<div id="gallery-view" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('#gallery-view a').html(gallery_view ? _("Disable gallery mode") : _("Enable gallery mode")).click(function() {
gallery_view = !gallery_view;
$(this).html(gallery_view ? _("Disable gallery mode") : _("Enable gallery mode"));

2
js/id_colors.js

@ -9,7 +9,7 @@ if (active_page == 'thread' || active_page == 'index') {
else {
var selector = '#color-ids';
var e = 'click';
$('hr:first').before('<div id="color-ids" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+_('Color IDs')+'</a></div>')
$('hr').first().before('<div id="color-ids" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+_('Color IDs')+'</a></div>')
}
$(selector).on(e, function() {

2
js/image-hover.js

@ -6,7 +6,7 @@
*/
if (active_page === "catalog" || active_page === "thread" || active_page === "index" || active_page === "ukko") {
$(document).on('ready', function(){
$(document).ready(function(){
if (window.Options && Options.get_tab('general')) {
Options.extend_tab("general",

2
js/infinite-scroll.js

@ -38,7 +38,7 @@ var load_next_page = function() {
if (loading) return;
loading = true;
var this_page = $(".pages a.selected:last");
var this_page = $(".pages a.selected").last();
var next_page = this_page.next();
var href = next_page.prop("href");

8
js/jquery-ui.custom.min.js

File diff suppressed because one or more lines are too long

6
js/jquery.min.js

File diff suppressed because one or more lines are too long

2
js/keyboard-shortcuts.js

@ -2,7 +2,7 @@
// keyboard navigation
// v1.4
$(document).on("ready", function() {
$(document).ready(function() {
// adding keyboard navigation to options menu
if (window.Options && Options.get_tab('general')) {

4
js/live-index.js

@ -27,7 +27,7 @@ if (active_page == 'index' && (""+document.location).match(/\/(index\.html)?(\?|
};
$(function() {
$("hr:first").before("<hr /><div class='new-threads'>"+_("No new threads.")+"</div>");
$("hr").first().before("<hr /><div class='new-threads'>"+_("No new threads.")+"</div>");
$('div[id^="thread_"]').each(handle_one_thread);
@ -96,7 +96,7 @@ if (active_page == 'index' && (""+document.location).match(/\/(index\.html)?(\?|
// okay, the thread is there
}
else {
var thread = $(this).insertBefore('div[id^="thread_"]:first');
var thread = $(this).insertBefore('div[id^="thread_"]').first();
$(document).trigger("new_post", this);
}
});

2
js/mod/recent-posts-auto-reload.js

@ -199,7 +199,7 @@ $(document).ready(function(){
var n = new Notification("New reply to "+ title, {body: $('<div/>').html(body).text()});
}
}
$(this).parent().insertBefore($('.post-wrapper:first'));
$(this).parent().insertBefore($('.post-wrapper').first());
new_posts++;
loaded_posts++;
$(document).trigger('new_post', this);

2
js/mod/recent-posts.js

@ -49,7 +49,7 @@ $(document).ready(function(){
}
$('<a class="hide-post-link" href="javascript:void(0)"> Dismiss </a>')
.insertBefore(post_container.find('a.eita-link:first'))
.insertBefore(post_container.find('a.eita-link').first())
.click(function(){
hidden_data[board][id] = Math.round(Date.now() / 1000);
store_data_posts();

4
js/multi-image.js

@ -20,9 +20,9 @@ function multi_image() {
if (!(images_len >= max_images)) {
var new_file = '<br class="file_separator"/><input type="file" name="file'+(images_len+1)+'" id="upload_file'+(images_len+1)+'">';
$('[type=file]:last').after(new_file);
$('[type=file]').last().after(new_file);
if ($("#quick-reply").length) {
$('form:not(#quick-reply) [type=file]:last').after(new_file);
$('form:not(#quick-reply) [type=file]').last().after(new_file);
}
if (typeof setup_form !== 'undefined') setup_form($('form[name="post"]'));
}

2
js/no-animated-gif.js

@ -76,7 +76,7 @@ if (active_page == 'thread' || active_page == 'index' || active_page == 'ukko' |
else {
selector = '#no-animated-gif';
event = 'click';
$('hr:first').before('<div id="no-animated-gif" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+_('Unanimate GIFs')+'</a></div>')
$('hr').first().before('<div id="no-animated-gif" style="text-align:right"><a class="unimportant" href="javascript:void(0)">'+_('Unanimate GIFs')+'</a></div>')
}
$(selector).on(event, function() {

4
js/options.js

@ -109,8 +109,8 @@ $(function(){
options_button.addClass("cb-item cb-fa").html("<i class='fa fa-gear'></i>");
}
if ($(".boardlist:first").length) {
options_button.appendTo($(".boardlist:first"));
if ($(".boardlist").first().length) {
options_button.appendTo($(".boardlist").first());
}
else {
options_button.prependTo($(document.body));

4
js/quick-post-controls.js

@ -39,10 +39,10 @@ $(document).ready(function(){
' <input type="submit" name="report" value="'+_('Report')+'">' +
'</div>' +
'</form>');
if($('form[name="post"]:first').length){
if($('form[name="post"]').first().length){
var board=$(this).parent().parent().parent().attr("data-board");
post_form
.attr('action', $('form[name="post"]:first').attr('action'))
.attr('action', $('form[name="post"]').first().attr('action'))
.append('<input type="hidden" value="'+board+'" name="board" />');
}else{
var board=$(this).parent().parent().parent().attr("data-board");

8
js/quick-reply.js

@ -139,8 +139,8 @@
$dummyStuff = $('<div class="nonsense"></div>').appendTo($postForm);
$postForm.find('table tr').each(function() {
var $th = $(this).children('th:first');
var $td = $(this).children('td:first');
var $th = $(this).children('th').first();
var $td = $(this).children('td').first();
if ($th.length && $td.length) {
$td.attr('colspan', 2);
@ -294,7 +294,7 @@
$postForm.attr('id', 'quick-reply');
$postForm.appendTo($('body')).hide();
$origPostForm = $('form[name="post"]:first');
$origPostForm = $('form[name="post"]').first();
// Synchronise body text with original post form
$origPostForm.find('textarea[name="body"]').on('change input propertychange', function() {
@ -442,7 +442,7 @@
$(window).scroll(function() {
if ($(this).width() <= 400)
return;
if ($(this).scrollTop() < $('form[name="post"]:first').offset().top + $('form[name="post"]:first').height() - 100)
if ($(this).scrollTop() < $('form[name="post"]').first().offset().top + $('form[name="post"]').first().height() - 100)
$('.quick-reply-btn').fadeOut(100);
else
$('.quick-reply-btn').fadeIn(100);

4
js/thread-stats.js

@ -68,7 +68,7 @@ $(document).ready(function(){
$('#thread_stats_uids').text(size(ids));
}
var board_name = $('input[name="board"]').val();
$.getJSON('//'+ document.location.host +'/'+ board_name +'/threads.json').success(function(data){
$.getJSON('//'+ document.location.host +'/'+ board_name +'/threads.json').done(function(data){
var found, page = '???';
for (var i=0;data[i];i++){
var threads = data[i].threads;
@ -90,7 +90,7 @@ $(document).ready(function(){
// uses ajax call so it gets loaded on a delay (depending on network resources available)
var thread_stats_page_timer = setInterval(function(){
var board_name = $('input[name="board"]').val();
$.getJSON('//'+ document.location.host +'/'+ board_name +'/threads.json').success(function(data){
$.getJSON('//'+ document.location.host +'/'+ board_name +'/threads.json').done(function(data){
var found, page = '???';
for (var i=0;data[i];i++){
var threads = data[i].threads;

2
js/thread-watcher.js

@ -151,7 +151,7 @@ $(document).ready(function(){
//Append the watchlist toggle button.
$('.boardlist, .compact-boardlist').append(' <span>[ <a class="watchlist-toggle" href="#">'+_('watchlist')+'</a> ]</span>');
//Append a watch thread button after every OP post number.
$('.op>.intro>.post_no:odd').after('<a class="watchThread" href="#">['+_('Watch Thread')+']</a>');
$('.op>.intro>.post_no').odd().after('<a class="watchThread" href="#">['+_('Watch Thread')+']</a>');
//Draw the watchlist, hidden.
watchlist.render();

2
js/toggle-images.js

@ -65,7 +65,7 @@ $(document).ready(function(){
else {
selector = '#toggle-images a';
event = 'click';
$('hr:first').before('<div id="toggle-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('hr').first().before('<div id="toggle-images" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('div#toggle-images a')
.text(hide_images ? _('Show images') : _('Hide images'));
}

2
js/toggle-locked-threads.js

@ -46,7 +46,7 @@ $(document).ready(function(){
else {
selector = '#toggle-locked-threads a';
event = 'click';
$('hr:first').before('<div id="toggle-locked-threads" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('hr').first().before('<div id="toggle-locked-threads" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
}
$('div#toggle-locked-threads a')

2
js/treeview.js

@ -65,7 +65,7 @@ $(function() {
}
}
$('hr:first').before('<div class="unimportant" style="text-align:right"><label for="treeview"><input type="checkbox" id="treeview"> '+_('Tree view')+'</label></div>');
$('hr').first().before('<div class="unimportant" style="text-align:right"><label for="treeview"><input type="checkbox" id="treeview"> '+_('Tree view')+'</label></div>');
$('input#treeview').on('change', function(e) { treeview($(this).is(':checked')); });
if (localStorage.treeview === 'true') {

6
js/watch.js

@ -360,7 +360,7 @@ $(function(){
var boardconfig = storage()[board] || {};
$('hr:first').before('<div id="watch-thread" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('hr').first().before('<div id="watch-thread" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('#watch-thread a').html(is_threadwatched(boardconfig, thread) ? _("Stop watching this thread") : _("Watch this thread")).click(function() {
$(this).html(toggle_threadwatched(board, thread) ? _("Stop watching this thread") : _("Watch this thread"));
update_pinned();
@ -371,14 +371,14 @@ $(function(){
var boardconfig = storage()[board] || {};
$('hr:first').before('<div id="watch-pin" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('hr').first().before('<div id="watch-pin" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('#watch-pin a').html(is_pinned(boardconfig) ? _("Unpin this board") : _("Pin this board")).click(function() {
$(this).html(toggle_pinned(board) ? _("Unpin this board") : _("Pin this board"));
$('#watch-board a').html(is_boardwatched(boardconfig) ? _("Stop watching this board") : _("Watch this board"));
update_pinned();
});
$('hr:first').before('<div id="watch-board" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('hr').first().before('<div id="watch-board" style="text-align:right"><a class="unimportant" href="javascript:void(0)">-</a></div>');
$('#watch-board a').html(is_boardwatched(boardconfig) ? _("Stop watching this board") : _("Watch this board")).click(function() {
$(this).html(toggle_boardwatched(board) ? _("Stop watching this board") : _("Watch this board"));
$('#watch-pin a').html(is_pinned(boardconfig) ? _("Unpin this board") : _("Pin this board"));

Loading…
Cancel
Save