From ab96e30d89de2161713626e9eb856301b5e38399 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 9 Oct 2014 00:42:28 +0200 Subject: [PATCH 1/2] infinite scroll implementation --- js/infinite-scroll.js | 91 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 js/infinite-scroll.js diff --git a/js/infinite-scroll.js b/js/infinite-scroll.js new file mode 100644 index 00000000..e212f9d6 --- /dev/null +++ b/js/infinite-scroll.js @@ -0,0 +1,91 @@ +/* + * infinite-scroll.js + * https://github.com/vichan-devel/vichan/blob/master/js/infinite-scroll.js + * + * Released under the MIT license + * Copyright (c) 2013-2014 Marcin Ɓabanowski + * + * Usage: + * $config['additional_javascript'][] = 'js/jquery.min.js'; + * $config['additional_javascript'][] = 'js/infinite-scroll.js'; + * + */ + +$(function() { +if (active_page == 'index') { + + +var loading = false; + +var activate = function() { + if (document.location.hash != '#all') return false; + + $(window).on("scroll", function() { + scrolltest(); + }); + scrolltest(); + + return true; +}; + +var scrolltest = function() { + if ($(window).scrollTop() + $(window).height() + 1000 > $(document).height() && !loading) { + 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'); + }); + +}; + +var button = $(""+_("All")+" ").prependTo(".pages"); + +$(window).on("hashchange", function() { + return !activate(); +}); +activate(); + + +} +}); From ccd871c1950ee174aae1a6dfc00053ddacdad39f Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 9 Oct 2014 01:01:41 +0200 Subject: [PATCH 2/2] missed ban-list.css from banlist commit --- stylesheets/mod/ban-list.css | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 stylesheets/mod/ban-list.css diff --git a/stylesheets/mod/ban-list.css b/stylesheets/mod/ban-list.css new file mode 100644 index 00000000..6115b4b9 --- /dev/null +++ b/stylesheets/mod/ban-list.css @@ -0,0 +1,61 @@ +#banlist { + clear: left; +} +#banlist th { + text-align: center; +} +#banlist th, #banlist td { + margin: 2px; + padding: 2px; + overflow: hidden; +} +#banlist td:hover { + overflow: visible; + height: auto !important; + background-color: white; + z-index: 1; + position: relative; + border: 1px solid black; + padding: 1px; +} +.banlist-opts { +} +.banlist-opts .checkboxes { + float: left; + width: 50%; +} +.banlist-opts .checkboxes label { + display: block; + color: black; +} +.banlist-opts .buttons { + float: left; + width: 50%; +} +.banlist-opts .buttons * { + display: inline-block; + width: 49%; + font-size: 18pt; +} + +tr.tblhead { + display: block; + box-sizing: border-box; + clear: left; + width: 100%; +} +tr.tblhead > th { + display: block; + box-sizing: border-box; + float: left; + padding: 0; + color: black; +} +tr.tblhead > th.sortable { + cursor: pointer; +} + + +body { + min-width: 980px; +}