From 4f96263e3b72124df7b152e5dd2b513683fda818 Mon Sep 17 00:00:00 2001 From: 8chan Date: Tue, 21 Oct 2014 21:06:34 -0700 Subject: Upgrade jQuery mixitup, preserve settings, no animations --- js/catalog.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'js/catalog.js') diff --git a/js/catalog.js b/js/catalog.js index 768845f6..386557d9 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -1,8 +1,17 @@ if (active_page == 'catalog') $(function(){ + if (localStorage.catalog !== undefined) { + var catalog = JSON.parse(localStorage.catalog); + } else { + var catalog = {}; + localStorage.catalog = JSON.stringify(catalog); + } + $("#sort_by").change(function(){ var value = this.value; - $("#sort-"+value).trigger("click"); + $('#Grid').mixItUp('sort', value); + catalog.sort_by = value; + localStorage.catalog = JSON.stringify(catalog); }); $("#image_size").change(function(){ @@ -11,9 +20,21 @@ if (active_page == 'catalog') $(function(){ $(".grid-li").removeClass("grid-size-small"); $(".grid-li").removeClass("grid-size-large"); $(".grid-li").addClass("grid-size-"+value); + catalog.image_size = value; + localStorage.catalog = JSON.stringify(catalog); }); - $('#Grid').mixitup({ + $('#Grid').mixItUp({ + animation: { + enable: false + }, }); + if (catalog.sort_by !== undefined) { + $('#sort_by').val(catalog.sort_by).trigger('change'); + } + if (catalog.image_size !== undefined) { + $('#image_size').val(catalog.image_size).trigger('change'); + } + }); -- cgit v1.3 From b056124e499082328f932a34997fc90ca3538233 Mon Sep 17 00:00:00 2001 From: 8chan Date: Mon, 5 Jan 2015 04:39:08 -0800 Subject: Catalog: don't show hidden threads --- js/catalog.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'js/catalog.js') diff --git a/js/catalog.js b/js/catalog.js index 386557d9..5a236b8b 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -7,6 +7,16 @@ if (active_page == 'catalog') $(function(){ localStorage.catalog = JSON.stringify(catalog); } + if (localStorage.hiddenthreads) { + var hidden_data = JSON.parse(localStorage.hiddenthreads); + + if (hidden_data[board_name]) { + $.each(hidden_data[board_name], function(k, v) { + $('a[href*="'+k+'"]').parents('.mix').remove(); + }); + } + } + $("#sort_by").change(function(){ var value = this.value; $('#Grid').mixItUp('sort', value); -- cgit v1.3 From 01207dfcbb1750441a274538591a1a861698dda2 Mon Sep 17 00:00:00 2001 From: 8chan Date: Fri, 23 Jan 2015 02:24:04 -0800 Subject: Catalog script fix for hiding threads with short IDs --- js/catalog.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/catalog.js') diff --git a/js/catalog.js b/js/catalog.js index 5a236b8b..801c86bc 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -10,9 +10,9 @@ if (active_page == 'catalog') $(function(){ if (localStorage.hiddenthreads) { var hidden_data = JSON.parse(localStorage.hiddenthreads); - if (hidden_data[board_name]) { + if (hidden_data[board_name] && !$.isEmptyObject(hidden_data[board_name])) { $.each(hidden_data[board_name], function(k, v) { - $('a[href*="'+k+'"]').parents('.mix').remove(); + $('a[href$="/'+k+'.html"]').parents('.mix').remove(); }); } } -- cgit v1.3 From e8b530a78369fffff024f1d26696605c3f1130c2 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 31 Jan 2015 23:30:59 -0800 Subject: Shift-click to hide threads in catalog --- js/catalog.js | 12 ++++++++++-- templates/themes/catalog/catalog.html | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'js/catalog.js') diff --git a/js/catalog.js b/js/catalog.js index 801c86bc..38382096 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -1,5 +1,4 @@ if (active_page == 'catalog') $(function(){ - if (localStorage.catalog !== undefined) { var catalog = JSON.parse(localStorage.catalog); } else { @@ -15,8 +14,18 @@ if (active_page == 'catalog') $(function(){ $('a[href$="/'+k+'.html"]').parents('.mix').remove(); }); } + } else { + hidden_data = {}; } + $(document).on('click', '.mix', function(e) { + if (e.shiftKey) { + hidden_data[board_name][$(this).data('id')] = Math.round(Date.now() / 1000); + $(this).remove(); + localStorage.hiddenthreads = JSON.stringify(hidden_data); + } + }); + $("#sort_by").change(function(){ var value = this.value; $('#Grid').mixItUp('sort', value); @@ -46,5 +55,4 @@ if (active_page == 'catalog') $(function(){ if (catalog.image_size !== undefined) { $('#image_size').val(catalog.image_size).trigger('change'); } - }); diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 6aa577a1..2ca66089 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -37,6 +37,7 @@ data-reply="{{ post.reply_count }}" data-bump="{{ post.bump }}" data-time="{{ post.time }}" + data-id="{{ post.id }}" >
-- cgit v1.3 From dd27026618ab200253ab6fcd6e58e247f8cc6711 Mon Sep 17 00:00:00 2001 From: 8chan Date: Fri, 6 Mar 2015 02:01:53 -0800 Subject: Show stickies at top of catalog --- js/catalog.js | 4 ++-- templates/themes/catalog/catalog.html | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'js/catalog.js') diff --git a/js/catalog.js b/js/catalog.js index 38382096..18da6d6b 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -28,7 +28,7 @@ if (active_page == 'catalog') $(function(){ $("#sort_by").change(function(){ var value = this.value; - $('#Grid').mixItUp('sort', value); + $('#Grid').mixItUp('sort', (value == "random" ? value : "sticky:desc " + value)); catalog.sort_by = value; localStorage.catalog = JSON.stringify(catalog); }); @@ -46,7 +46,7 @@ if (active_page == 'catalog') $(function(){ $('#Grid').mixItUp({ animation: { enable: false - }, + } }); if (catalog.sort_by !== undefined) { diff --git a/templates/themes/catalog/catalog.html b/templates/themes/catalog/catalog.html index 2ca66089..1011fdaf 100644 --- a/templates/themes/catalog/catalog.html +++ b/templates/themes/catalog/catalog.html @@ -38,6 +38,8 @@ data-bump="{{ post.bump }}" data-time="{{ post.time }}" data-id="{{ post.id }}" + data-sticky="{% if post.sticky %}true{% else %}false{% endif %}" + data-locked="{% if post.locked %}true{% else %}false{% endif %}" >
@@ -49,7 +51,7 @@ id="img-{{ post.id }}" data-subject="{% if post.subject %}{{ post.subject|e }}{% endif %}" data-name="{{ post.name|e }}" data-muhdifference="{{ post.muhdifference }}" class="{{post.board}} thread-image" title="{{post.bump|date('%b %d %H:%M')}}">
- R: {{ post.reply_count }} / I: {{ post.image_count }} + R: {{ post.reply_count }} / I: {{ post.image_count }}{% if post.sticky %} (sticky){% endif %} {% if post.subject %}

-- cgit v1.3 From 513c8f7b68ba17bbd3356af4301d8e5f3342187e Mon Sep 17 00:00:00 2001 From: marktaiwan Date: Fri, 6 Mar 2015 16:15:49 +0800 Subject: post-filter.js catalog support Removes hidden threads from catalog page Shift click on catalog to hide thread Improved word matching for simple comment and subject filter. --- js/catalog.js | 20 ------- js/post-filter.js | 156 ++++++++++++++++++++++++++++-------------------------- 2 files changed, 81 insertions(+), 95 deletions(-) (limited to 'js/catalog.js') diff --git a/js/catalog.js b/js/catalog.js index 18da6d6b..065fba7b 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -6,26 +6,6 @@ if (active_page == 'catalog') $(function(){ localStorage.catalog = JSON.stringify(catalog); } - if (localStorage.hiddenthreads) { - var hidden_data = JSON.parse(localStorage.hiddenthreads); - - if (hidden_data[board_name] && !$.isEmptyObject(hidden_data[board_name])) { - $.each(hidden_data[board_name], function(k, v) { - $('a[href$="/'+k+'.html"]').parents('.mix').remove(); - }); - } - } else { - hidden_data = {}; - } - - $(document).on('click', '.mix', function(e) { - if (e.shiftKey) { - hidden_data[board_name][$(this).data('id')] = Math.round(Date.now() / 1000); - $(this).remove(); - localStorage.hiddenthreads = JSON.stringify(hidden_data); - } - }); - $("#sort_by").change(function(){ var value = this.value; $('#Grid').mixItUp('sort', (value == "random" ? value : "sticky:desc " + value)); diff --git a/js/post-filter.js b/js/post-filter.js index 9ec28262..28e02f78 100644 --- a/js/post-filter.js +++ b/js/post-filter.js @@ -1,4 +1,4 @@ -if (active_page === 'thread' || active_page === 'index') { +if (active_page === 'thread' || active_page === 'index' || active_page === 'catalog') { $(document).ready(function () { 'use strict'; // returns blacklist object from storage @@ -408,13 +408,13 @@ if (active_page === 'thread' || active_page === 'index') { if (!forcedAnon && hasTrip) trip = $post.find('.trip').text(); if (hasSub) - subject = ' '+ $post.find('.subject').text() +' '; + subject = $post.find('.subject').text(); array = $post.find('.body').contents().filter(function () {if ($(this).text() !== '') return true;}).toArray(); array = $.map(array, function (ele) { return $(ele).text(); }); - comment = ' '+ array.join(' ') +' '; + comment = array.join(' '); for (i = 0, length = list.generalFilter.length; i < length; i++) { @@ -430,7 +430,7 @@ if (active_page === 'thread' || active_page === 'index') { } break; case 'trip': - if (!forcedAnon && pattern.test(trip)) { + if (!forcedAnon && hasTrip && pattern.test(trip)) { $post.data('hiddenByTrip', true); hide(post); } @@ -463,13 +463,15 @@ if (active_page === 'thread' || active_page === 'index') { } break; case 'sub': - if (hasSub && subject.indexOf(' '+ rule.value +' ') != -1) { + pattern = new RegExp('\\b'+ rule.value+ '\\b'); + if (hasSub && pattern.test(subject)) { $post.data('hiddenBySubject', true); hide(post); } break; case 'com': - if (comment.indexOf(' '+ rule.value +' ') != -1) { + pattern = new RegExp('\\b'+ rule.value+ '\\b'); + if (pattern.test(comment)) { $post.data('hiddenByComment', true); hide(post); } @@ -502,43 +504,63 @@ if (active_page === 'thread' || active_page === 'index') { function filterPage(pageData) { var list = getList(); - // empty the local and no-reply list - pageData.localList = []; - pageData.noReplyList = []; + if (active_page != 'catalog') { - $('.thread').each(function () { - var $thread = $(this); - // disregard the hidden threads constructed by post-hover.js - if ($thread.css('display') == 'none') - return; + // empty the local and no-reply list + pageData.localList = []; + pageData.noReplyList = []; + + $('.thread').each(function () { + var $thread = $(this); + // disregard the hidden threads constructed by post-hover.js + if ($thread.css('display') == 'none') + return; - var threadId = $thread.attr('id').replace('thread_', ''); - var op = $thread.children('.op')[0]; - var i, array; // temp variables + var threadId = $thread.attr('id').replace('thread_', ''); + var op = $thread.children('.op')[0]; + var i, array; // temp variables - // add posts to localList and noReplyList - if (typeof list.postFilter[pageData.boardId] != 'undefined' && typeof list.postFilter[pageData.boardId][threadId] != 'undefined') { - array = list.postFilter[pageData.boardId][threadId]; - for (i=0; i'); $row.append( - ''+ typeName[obj.type] +'', - ''+ val +'', - $('').append( - $('').html('X') - .addClass('del-btn') - .attr('href', '#') - .data('type', obj.type) - .data('val', obj.value) - .data('useRegex', obj.regex) - ) - ); + ''+ typeName[obj.type] +'', + ''+ val +'', + $('').append( + $('').html('X') + .addClass('del-btn') + .attr('href', '#') + .data('type', obj.type) + .data('val', obj.value) + .data('useRegex', obj.regex) + ) + ); $ele.append($row); } } @@ -754,33 +776,6 @@ if (active_page === 'thread' || active_page === 'index') { }); } - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Migrate from previous version of post filter - * Remember to remove next time anyone touches this file - */ - (function () { - var list = getList(); - if (typeof list.nameFilter != 'undefined') { - var filter = list.nameFilter; - list.generalFilter = []; - - for (var i = 0; i < filter.length; i++) { - var obj = filter[i]; - for (var key in obj) { - list.generalFilter.push({ - type: key, - value: obj[key], - regex: false - }); - } - } - - delete list.nameFilter; - localStorage.postFilter = JSON.stringify(list); - } - })(); - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - var pageData = { boardId: board_name, // get the id from the global variable localList: [], // all the blacklisted post IDs or UIDs that apply to the current page @@ -812,6 +807,17 @@ if (active_page === 'thread' || active_page === 'index') { filterPage(pageData); }); + // shift+click on catalog to hide thread + if (active_page == 'catalog') { + $(document).on('click', '.mix', function(e) { + if (e.shiftKey) { + var threadId = $(this).data('id'); + var postId = threadId; + blacklist.add.post(pageData.boardId, threadId, postId, false); + } + }); + } + // clear out the old threads purge(); } -- cgit v1.3 From 65ea7b78c50ab3da60a541237f73b13cd2e7e6d8 Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Sun, 10 May 2015 12:51:35 +0800 Subject: Catalog: click to scroll thread --- js/catalog.js | 10 ++++++++++ stylesheets/style.css | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'js/catalog.js') diff --git a/js/catalog.js b/js/catalog.js index 065fba7b..9adaeaef 100644 --- a/js/catalog.js +++ b/js/catalog.js @@ -35,4 +35,14 @@ if (active_page == 'catalog') $(function(){ if (catalog.image_size !== undefined) { $('#image_size').val(catalog.image_size).trigger('change'); } + + $('div.thread').on('click', function(e) { + if ($(this).css('overflow-y') === 'hidden') { + $(this).css('overflow-y', 'auto'); + $(this).css('width', '100%'); + } else { + $(this).css('overflow-y', 'hidden'); + $(this).css('width', 'auto'); + } + }); }); diff --git a/stylesheets/style.css b/stylesheets/style.css index e54faf93..b36a9de9 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -1033,7 +1033,6 @@ div.boardlist a { #watchlist-toggle, .watchThread, .watchlist-remove, #clearList, #clearGhosts { cursor: pointer; } -<<<<<<< HEAD #youtube-size input { width: 50px; -- cgit v1.3