diff --git a/js/fix-report-delete-submit.js b/js/fix-report-delete-submit.js index 47a04f16..01785974 100644 --- a/js/fix-report-delete-submit.js +++ b/js/fix-report-delete-submit.js @@ -9,9 +9,10 @@ */ if (active_page == 'thread' || active_page == 'index') { -$(document).ready(function(){ - +$(document).on('menu_ready', function(){ + if ($('#delete-fields #password').length) { + var Menu = window.Menu; Menu.add_item("delete_post_menu", _("Delete post")); Menu.add_item("delete_file_menu", _("Delete file")); Menu.onclick(function(e, $buf) { @@ -57,4 +58,9 @@ $(document).on('new_post', function(){ }); $('input.delete').hide(); $('#post-moderation-fields').hide(); -})} +}); + +if (typeof window.Menu !== "undefined") { + $(document).trigger('menu_ready'); +} +} diff --git a/js/infinite-scroll.js b/js/infinite-scroll.js index e212f9d6..b3c5c7ae 100644 --- a/js/infinite-scroll.js +++ b/js/infinite-scroll.js @@ -21,7 +21,7 @@ var activate = function() { if (document.location.hash != '#all') return false; $(window).on("scroll", function() { - scrolltest(); + scrolltest(); }); scrolltest(); @@ -30,53 +30,54 @@ var activate = function() { var scrolltest = function() { if ($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading) { - load_next_page(); + load_next_page(); } }; var load_next_page = function() { - if (loading) return; - loading = true; - - var this_page = $(".pages a.selected:last"); - var next_page = this_page.next(); - - var href = next_page.prop("href"); - if (!href) return; - - var boardheader = $('

'+_('Page')+' '+next_page.html()+'

'); - var loading_ind = $('

'+_('Loading...')+'

').insertBefore('form[name="postcontrols"]>.delete:first'); - - $.get(href, function(data) { - var doc = $(data); - - loading_ind.remove(); - boardheader.insertBefore('form[name="postcontrols"]>.delete:first'); - - var i = 0; - - doc.find('div[id*="thread_"]').each(function() { - var checkout = $(this).attr('id').replace('thread_', ''); - var $this = this; - - if ($('div#thread_' + checkout).length == 0) { - // Delay DOM insertion to lessen the lag. - setTimeout(function() { - $($this).insertBefore('form[name="postcontrols"]>.delete:first'); - $(document).trigger('new_post', $this); - $($this).hide().slideDown(); - }, 500*i); - i++; - } - }); - setTimeout(function() { - loading = false; - scrolltest(); - }, 500*(i+1)); - - next_page.addClass('selected'); - }); - + if (loading) return; + loading = true; + + var this_page = $(".pages a.selected:last"); + var next_page = this_page.next(); + + var href = next_page.prop("href"); + if (!href) return; + + var boardheader = $('

'+_('Page')+' '+next_page.html()+'

'); + var loading_ind = $('

'+_('Loading...')+'

').insertBefore('#post-moderation-fields'); + + $.get(href, function(data) { + var doc = $(data); + + loading_ind.remove(); + boardheader.insertBefore('#post-moderation-fields'); + + var i = 0; + + doc.find('div[id*="thread_"]').each(function() { + var checkout = $(this).attr('id').replace('thread_', ''); + var $this = this; + + if ($('div#thread_' + checkout).length == 0) { + // Delay DOM insertion to lessen the lag. + setTimeout(function() { + $($this).insertBefore('#post-moderation-fields'); + $(document).trigger('new_post', $this); + $($this).hide().slideDown(); + }, 500*i); + + i++; + } + }); + + setTimeout(function() { + loading = false; + scrolltest(); + }, 500*(i+1)); + + next_page.addClass('selected'); + }); }; var button = $(""+_("All")+" ").prependTo(".pages"); diff --git a/js/post-filter.js b/js/post-filter.js index aaab4d0e..023b54e4 100644 --- a/js/post-filter.js +++ b/js/post-filter.js @@ -1,6 +1,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'catalog') { - $(document).ready(function () { + $(document).on('menu_ready', function () { 'use strict'; + // returns blacklist object from storage function getList() { return JSON.parse(localStorage.postFilter); @@ -200,7 +201,7 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata * create filter menu when the button is clicked */ function initPostMenu(pageData) { - + var Menu = window.Menu; var submenu; Menu.add_item('filter-menu-hide', _('Hide post')); Menu.add_item('filter-menu-unhide', _('Unhide post')); @@ -836,4 +837,8 @@ if (active_page === 'thread' || active_page === 'index' || active_page === 'cata } init(); }); + + if (typeof window.Menu !== "undefined") { + $(document).trigger('menu_ready'); + } } diff --git a/js/post-menu.js b/js/post-menu.js index 7d83709a..6018dfdb 100644 --- a/js/post-menu.js +++ b/js/post-menu.js @@ -26,7 +26,7 @@ * $config['additional_javascript'][] = 'js/jquery.min.js'; * $config['additional_javascript'][] = 'js/post-menu.js'; */ -onready(function () { +$(document).ready(function () { var List = function (menuId, text) { this.id = menuId; @@ -133,6 +133,8 @@ Menu.get_submenu = function (id) { return mainMenu.get_submenu(id); }; +window.Menu = Menu; + /* * * * * * * * Initialize @@ -205,5 +207,5 @@ $(document).on('new_post', function (e, post) { addButton(post); }); -window.Menu = Menu; +$(document).trigger('menu_ready'); }); diff --git a/stylesheets/style.css b/stylesheets/style.css index 6a9f1a9a..6b4b19d9 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -416,12 +416,13 @@ fieldset label { } div.pages { - color: #89A; - background: #D6DAF0; - display: inline; - padding: 8px; - border-right: 1px solid #B7C5D9; - border-bottom: 1px solid #B7C5D9; + color: #89A; + background: #D6DAF0; + display: inline-block; + padding: 8px; + margin: 8px 0 4px 0; + border-right: 1px solid #B7C5D9; + border-bottom: 1px solid #B7C5D9; } div.pages.top {