diff --git a/CHANGELOG.md b/CHANGELOG.md index a72a0fbe8..bb5ad5955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ Sometimes the changelog has notes (not comprehensive) acknowledging people's wor ### v1.11.28 +**v1.11.28.1** *(2016-03-16)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.28.1/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.28.1/builds/4chan-X-noupdate.crx "Chromium version")] +- Add option to the header menu in threads to set the maximum number of replies to show. Currently off by default. Not yet compatible with `Quote Threading`. + ![Reply pruning](img/1.9.17.3.png) + **v1.11.28.0** *(2016-03-13)* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.28.0/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.11.28.0/builds/4chan-X-noupdate.crx "Chromium version")] - Based on v1.11.27.2. - New sorting mode: `Last long reply` sorts threads by time of last visible reply over 100 characters, or time of creation if no such reply exists. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 95a2feb50..327a0ed2e 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index ba2ea5726..650295006 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.11.28.0 +// @version 1.11.28.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index a084f1683..378f3a82a 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.11.28.0 +// @version 1.11.28.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -119,7 +119,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, + var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, PruneReplies, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, slice = [].slice, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, @@ -427,7 +427,11 @@ 'Interval': 30 }, customCooldown: 0, - customCooldownEnabled: true + customCooldownEnabled: true, + pruneReplies: { + 'Prune Replies': false, + 'Max Replies': 1000 + } }; Conf = {}; @@ -439,7 +443,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.28.0', + VERSION: '1.11.28.1', NAMESPACE: '4chan X.', boards: {} }; @@ -13244,6 +13248,88 @@ } }; + PruneReplies = { + init: function() { + var el, label; + if (!(g.VIEW === 'thread' && !Conf['Quote Threading'])) { + return; + } + label = UI.checkbox('Prune Replies', 'Show Last'); + el = $.el('span', { + title: 'Maximum number of replies to show.' + }, { + innerHTML: " " + }); + $.prepend(el, label); + this.inputs = { + enabled: label.firstElementChild, + replies: el.lastElementChild + }; + $.on(this.inputs.enabled, 'change', $.cb.checked); + $.on(this.inputs.replies, 'change', $.cb.value); + Header.menu.addEntry({ + el: el, + order: 190 + }); + return Thread.callbacks.push({ + name: 'Prune Replies', + cb: this.node + }); + }, + position: 0, + hidden: 0, + total: 0, + node: function() { + PruneReplies.thread = this; + PruneReplies.total = this.posts.keys.length - 1; + $.on(PruneReplies.inputs.enabled, 'change', PruneReplies.setEnabled); + $.on(PruneReplies.inputs.enabled, 'change', PruneReplies.update); + if (Conf['Prune Replies']) { + PruneReplies.setEnabled(); + return PruneReplies.update(); + } + }, + setEnabled: function() { + var onOff; + PruneReplies.container || (PruneReplies.container = $.frag()); + onOff = Conf['Prune Replies'] ? $.on : $.off; + onOff(PruneReplies.inputs.replies, 'change', PruneReplies.update); + return onOff(d, 'ThreadUpdate', PruneReplies.update); + }, + update: function(e) { + var OP, frag, hidden2, post, posts, ref, results; + if (e && e.type === 'ThreadUpdate' && !e.detail[404]) { + PruneReplies.total += e.detail.newPosts.length; + } + hidden2 = Conf['Prune Replies'] ? Math.max(PruneReplies.total - +Conf["Max Replies"], 0) : 0; + ref = PruneReplies.thread, posts = ref.posts, OP = ref.OP; + if (PruneReplies.hidden < hidden2) { + results = []; + while (PruneReplies.hidden < hidden2 && PruneReplies.position < posts.keys.length) { + post = posts[posts.keys[PruneReplies.position++]]; + if (post.isReply && !post.isFetchedQuote) { + $.add(PruneReplies.container, post.nodes.root); + results.push(PruneReplies.hidden++); + } else { + results.push(void 0); + } + } + return results; + } else if (PruneReplies.hidden > hidden2) { + frag = $.frag(); + while (PruneReplies.hidden > hidden2 && PruneReplies.position > 0) { + post = posts[posts.keys[--PruneReplies.position]]; + if (post.isReply && !post.isFetchedQuote) { + $.prepend(frag, post.nodes.root); + PruneReplies.hidden--; + } + } + $.after(OP.nodes.root, frag); + return $.event('PostsInserted'); + } + } + }; + ThreadExcerpt = { init: function() { if (g.BOARD.ID !== 'f' || g.VIEW !== 'thread' || !Conf['Thread Excerpt']) { @@ -14793,14 +14879,13 @@ return Unread.update(); }, read: $.debounce(100, function(e) { - var ID, count, data, height, ref, ref1, root; + var ID, count, data, ref, ref1, root; if (!Unread.posts.size && Unread.readCount !== Unread.thread.posts.keys.length) { Unread.saveLastReadPost(); } if (d.hidden || !Unread.posts.size) { return; } - height = doc.clientHeight; count = 0; while (Unread.position) { ref = Unread.position, ID = ref.ID, data = ref.data; @@ -19609,6 +19694,10 @@ ".credits {\n" + " float: right;\n" + "}\n" + +".export, .import, .reset {\n" + +" cursor: pointer;\n" + +" text-decoration: none !important;\n" + +"}\n" + ".tab-selected {\n" + " font-weight: 700;\n" + "}\n" + @@ -20836,6 +20925,9 @@ " position: relative;\n" + " top: 2px;\n" + "}\n" + +".entry input[type=\"number\"] {\n" + +" width: 4.5em;\n" + +"}\n" + ".entry.has-shortcut-text {\n" + " display: flex;\n" + " justify-content: space-between;\n" + @@ -20879,10 +20971,6 @@ " left: 0px;\n" + " width: 200px;\n" + "}\n" + -".export, .import, .reset {\n" + -" cursor: pointer;\n" + -" text-decoration: none !important;\n" + -"}\n" + "/* Custom Board Titles */\n" + ".boardTitle, .boardSubtitle {\n" + " white-space: pre-line;\n" + @@ -21212,9 +21300,6 @@ ":root.gal-hide-thumbnails:.gal-fit-height:not(.gal-pdf) .gal-count {\n" + " right: 28px !important;\n" + "}\n" + -".field[name=\"Slide Delay\"] {\n" + -" width: 4em;\n" + -"}\n" + ":root.gallery-open.fixed #header-bar:not(.autohide),\n" + ":root.gallery-open.fixed #header-bar:not(.autohide) #shortcuts .fa::before {\n" + " visibility: hidden;\n" + @@ -21735,7 +21820,7 @@ cssWWW: "#captcha-cnt {\n" + " height: auto;\n" + "}", - features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Configuration', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Edit Link', QR.oekaki.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] + features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Configuration', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Edit Link', QR.oekaki.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash], ['Prune Replies', PruneReplies]] }; Main.init(); diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index e050c2196..9be1f7b7c 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index 548381dcd..dbda4fd11 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.28.0 +// @version 1.11.28.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -119,7 +119,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, + var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, PruneReplies, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, slice = [].slice, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, @@ -427,7 +427,11 @@ 'Interval': 30 }, customCooldown: 0, - customCooldownEnabled: true + customCooldownEnabled: true, + pruneReplies: { + 'Prune Replies': false, + 'Max Replies': 1000 + } }; Conf = {}; @@ -439,7 +443,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.28.0', + VERSION: '1.11.28.1', NAMESPACE: '4chan X.', boards: {} }; @@ -13244,6 +13248,88 @@ } }; + PruneReplies = { + init: function() { + var el, label; + if (!(g.VIEW === 'thread' && !Conf['Quote Threading'])) { + return; + } + label = UI.checkbox('Prune Replies', 'Show Last'); + el = $.el('span', { + title: 'Maximum number of replies to show.' + }, { + innerHTML: " " + }); + $.prepend(el, label); + this.inputs = { + enabled: label.firstElementChild, + replies: el.lastElementChild + }; + $.on(this.inputs.enabled, 'change', $.cb.checked); + $.on(this.inputs.replies, 'change', $.cb.value); + Header.menu.addEntry({ + el: el, + order: 190 + }); + return Thread.callbacks.push({ + name: 'Prune Replies', + cb: this.node + }); + }, + position: 0, + hidden: 0, + total: 0, + node: function() { + PruneReplies.thread = this; + PruneReplies.total = this.posts.keys.length - 1; + $.on(PruneReplies.inputs.enabled, 'change', PruneReplies.setEnabled); + $.on(PruneReplies.inputs.enabled, 'change', PruneReplies.update); + if (Conf['Prune Replies']) { + PruneReplies.setEnabled(); + return PruneReplies.update(); + } + }, + setEnabled: function() { + var onOff; + PruneReplies.container || (PruneReplies.container = $.frag()); + onOff = Conf['Prune Replies'] ? $.on : $.off; + onOff(PruneReplies.inputs.replies, 'change', PruneReplies.update); + return onOff(d, 'ThreadUpdate', PruneReplies.update); + }, + update: function(e) { + var OP, frag, hidden2, post, posts, ref, results; + if (e && e.type === 'ThreadUpdate' && !e.detail[404]) { + PruneReplies.total += e.detail.newPosts.length; + } + hidden2 = Conf['Prune Replies'] ? Math.max(PruneReplies.total - +Conf["Max Replies"], 0) : 0; + ref = PruneReplies.thread, posts = ref.posts, OP = ref.OP; + if (PruneReplies.hidden < hidden2) { + results = []; + while (PruneReplies.hidden < hidden2 && PruneReplies.position < posts.keys.length) { + post = posts[posts.keys[PruneReplies.position++]]; + if (post.isReply && !post.isFetchedQuote) { + $.add(PruneReplies.container, post.nodes.root); + results.push(PruneReplies.hidden++); + } else { + results.push(void 0); + } + } + return results; + } else if (PruneReplies.hidden > hidden2) { + frag = $.frag(); + while (PruneReplies.hidden > hidden2 && PruneReplies.position > 0) { + post = posts[posts.keys[--PruneReplies.position]]; + if (post.isReply && !post.isFetchedQuote) { + $.prepend(frag, post.nodes.root); + PruneReplies.hidden--; + } + } + $.after(OP.nodes.root, frag); + return $.event('PostsInserted'); + } + } + }; + ThreadExcerpt = { init: function() { if (g.BOARD.ID !== 'f' || g.VIEW !== 'thread' || !Conf['Thread Excerpt']) { @@ -14793,14 +14879,13 @@ return Unread.update(); }, read: $.debounce(100, function(e) { - var ID, count, data, height, ref, ref1, root; + var ID, count, data, ref, ref1, root; if (!Unread.posts.size && Unread.readCount !== Unread.thread.posts.keys.length) { Unread.saveLastReadPost(); } if (d.hidden || !Unread.posts.size) { return; } - height = doc.clientHeight; count = 0; while (Unread.position) { ref = Unread.position, ID = ref.ID, data = ref.data; @@ -19609,6 +19694,10 @@ ".credits {\n" + " float: right;\n" + "}\n" + +".export, .import, .reset {\n" + +" cursor: pointer;\n" + +" text-decoration: none !important;\n" + +"}\n" + ".tab-selected {\n" + " font-weight: 700;\n" + "}\n" + @@ -20836,6 +20925,9 @@ " position: relative;\n" + " top: 2px;\n" + "}\n" + +".entry input[type=\"number\"] {\n" + +" width: 4.5em;\n" + +"}\n" + ".entry.has-shortcut-text {\n" + " display: flex;\n" + " justify-content: space-between;\n" + @@ -20879,10 +20971,6 @@ " left: 0px;\n" + " width: 200px;\n" + "}\n" + -".export, .import, .reset {\n" + -" cursor: pointer;\n" + -" text-decoration: none !important;\n" + -"}\n" + "/* Custom Board Titles */\n" + ".boardTitle, .boardSubtitle {\n" + " white-space: pre-line;\n" + @@ -21212,9 +21300,6 @@ ":root.gal-hide-thumbnails:.gal-fit-height:not(.gal-pdf) .gal-count {\n" + " right: 28px !important;\n" + "}\n" + -".field[name=\"Slide Delay\"] {\n" + -" width: 4em;\n" + -"}\n" + ":root.gallery-open.fixed #header-bar:not(.autohide),\n" + ":root.gallery-open.fixed #header-bar:not(.autohide) #shortcuts .fa::before {\n" + " visibility: hidden;\n" + @@ -21735,7 +21820,7 @@ cssWWW: "#captcha-cnt {\n" + " height: auto;\n" + "}", - features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Configuration', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Edit Link', QR.oekaki.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] + features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Configuration', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Edit Link', QR.oekaki.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash], ['Prune Replies', PruneReplies]] }; Main.init(); diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index aaf1cbf03..067ab919c 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index fecac547c..5e7d1cf3c 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.11.28.0 +// @version 1.11.28.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 000461ebe..83181d1b4 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.11.28.0 +// @version 1.11.28.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -119,7 +119,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, + var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, Captcha, CatalogLinks, CatalogThread, Clone, Conf, Config, Connection, CrossOrigin, CustomCSS, DataBoard, DeleteLink, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, Fetcher, FileInfo, Filter, Flash, Fourchan, Gallery, Get, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, Keybinds, Linkify, Main, MarkNewIPs, Menu, Metadata, Nav, NormalizeURL, Notice, PSAHiding, PassLink, Polyfill, Post, PostHiding, PostSuccessful, PruneReplies, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, ShimSet, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadLinks, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, Volume, c, d, doc, g, slice = [].slice, indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }, extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, @@ -427,7 +427,11 @@ 'Interval': 30 }, customCooldown: 0, - customCooldownEnabled: true + customCooldownEnabled: true, + pruneReplies: { + 'Prune Replies': false, + 'Max Replies': 1000 + } }; Conf = {}; @@ -439,7 +443,7 @@ doc = d.documentElement; g = { - VERSION: '1.11.28.0', + VERSION: '1.11.28.1', NAMESPACE: '4chan X.', boards: {} }; @@ -13244,6 +13248,88 @@ } }; + PruneReplies = { + init: function() { + var el, label; + if (!(g.VIEW === 'thread' && !Conf['Quote Threading'])) { + return; + } + label = UI.checkbox('Prune Replies', 'Show Last'); + el = $.el('span', { + title: 'Maximum number of replies to show.' + }, { + innerHTML: " " + }); + $.prepend(el, label); + this.inputs = { + enabled: label.firstElementChild, + replies: el.lastElementChild + }; + $.on(this.inputs.enabled, 'change', $.cb.checked); + $.on(this.inputs.replies, 'change', $.cb.value); + Header.menu.addEntry({ + el: el, + order: 190 + }); + return Thread.callbacks.push({ + name: 'Prune Replies', + cb: this.node + }); + }, + position: 0, + hidden: 0, + total: 0, + node: function() { + PruneReplies.thread = this; + PruneReplies.total = this.posts.keys.length - 1; + $.on(PruneReplies.inputs.enabled, 'change', PruneReplies.setEnabled); + $.on(PruneReplies.inputs.enabled, 'change', PruneReplies.update); + if (Conf['Prune Replies']) { + PruneReplies.setEnabled(); + return PruneReplies.update(); + } + }, + setEnabled: function() { + var onOff; + PruneReplies.container || (PruneReplies.container = $.frag()); + onOff = Conf['Prune Replies'] ? $.on : $.off; + onOff(PruneReplies.inputs.replies, 'change', PruneReplies.update); + return onOff(d, 'ThreadUpdate', PruneReplies.update); + }, + update: function(e) { + var OP, frag, hidden2, post, posts, ref, results; + if (e && e.type === 'ThreadUpdate' && !e.detail[404]) { + PruneReplies.total += e.detail.newPosts.length; + } + hidden2 = Conf['Prune Replies'] ? Math.max(PruneReplies.total - +Conf["Max Replies"], 0) : 0; + ref = PruneReplies.thread, posts = ref.posts, OP = ref.OP; + if (PruneReplies.hidden < hidden2) { + results = []; + while (PruneReplies.hidden < hidden2 && PruneReplies.position < posts.keys.length) { + post = posts[posts.keys[PruneReplies.position++]]; + if (post.isReply && !post.isFetchedQuote) { + $.add(PruneReplies.container, post.nodes.root); + results.push(PruneReplies.hidden++); + } else { + results.push(void 0); + } + } + return results; + } else if (PruneReplies.hidden > hidden2) { + frag = $.frag(); + while (PruneReplies.hidden > hidden2 && PruneReplies.position > 0) { + post = posts[posts.keys[--PruneReplies.position]]; + if (post.isReply && !post.isFetchedQuote) { + $.prepend(frag, post.nodes.root); + PruneReplies.hidden--; + } + } + $.after(OP.nodes.root, frag); + return $.event('PostsInserted'); + } + } + }; + ThreadExcerpt = { init: function() { if (g.BOARD.ID !== 'f' || g.VIEW !== 'thread' || !Conf['Thread Excerpt']) { @@ -14793,14 +14879,13 @@ return Unread.update(); }, read: $.debounce(100, function(e) { - var ID, count, data, height, ref, ref1, root; + var ID, count, data, ref, ref1, root; if (!Unread.posts.size && Unread.readCount !== Unread.thread.posts.keys.length) { Unread.saveLastReadPost(); } if (d.hidden || !Unread.posts.size) { return; } - height = doc.clientHeight; count = 0; while (Unread.position) { ref = Unread.position, ID = ref.ID, data = ref.data; @@ -19609,6 +19694,10 @@ ".credits {\n" + " float: right;\n" + "}\n" + +".export, .import, .reset {\n" + +" cursor: pointer;\n" + +" text-decoration: none !important;\n" + +"}\n" + ".tab-selected {\n" + " font-weight: 700;\n" + "}\n" + @@ -20836,6 +20925,9 @@ " position: relative;\n" + " top: 2px;\n" + "}\n" + +".entry input[type=\"number\"] {\n" + +" width: 4.5em;\n" + +"}\n" + ".entry.has-shortcut-text {\n" + " display: flex;\n" + " justify-content: space-between;\n" + @@ -20879,10 +20971,6 @@ " left: 0px;\n" + " width: 200px;\n" + "}\n" + -".export, .import, .reset {\n" + -" cursor: pointer;\n" + -" text-decoration: none !important;\n" + -"}\n" + "/* Custom Board Titles */\n" + ".boardTitle, .boardSubtitle {\n" + " white-space: pre-line;\n" + @@ -21212,9 +21300,6 @@ ":root.gal-hide-thumbnails:.gal-fit-height:not(.gal-pdf) .gal-count {\n" + " right: 28px !important;\n" + "}\n" + -".field[name=\"Slide Delay\"] {\n" + -" width: 4em;\n" + -"}\n" + ":root.gallery-open.fixed #header-bar:not(.autohide),\n" + ":root.gallery-open.fixed #header-bar:not(.autohide) #shortcuts .fa::before {\n" + " visibility: hidden;\n" + @@ -21735,7 +21820,7 @@ cssWWW: "#captcha-cnt {\n" + " height: auto;\n" + "}", - features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Configuration', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Edit Link', QR.oekaki.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash]] + features: [['Polyfill', Polyfill], ['Normalize URL', NormalizeURL], ['Captcha Configuration', Captcha.replace], ['Redirect', Redirect], ['Header', Header], ['Catalog Links', CatalogLinks], ['Settings', Settings], ['Index Generator', Index], ['Disable Autoplay', AntiAutoplay], ['Announcement Hiding', PSAHiding], ['Fourchan thingies', Fourchan], ['Color User IDs', IDColor], ['Highlight by User ID', IDHighlight], ['Custom CSS', CustomCSS], ['Thread Links', ThreadLinks], ['Linkify', Linkify], ['Reveal Spoilers', RemoveSpoilers], ['Resurrect Quotes', Quotify], ['Filter', Filter], ['Thread Hiding Buttons', ThreadHiding], ['Reply Hiding Buttons', PostHiding], ['Recursive', Recursive], ['Strike-through Quotes', QuoteStrikeThrough], ['Quick Reply', QR], ['Cooldown', QR.cooldown], ['Pass Link', PassLink], ['Menu', Menu], ['Index Generator (Menu)', Index.menu], ['Report Link', ReportLink], ['Thread Hiding (Menu)', ThreadHiding.menu], ['Reply Hiding (Menu)', PostHiding.menu], ['Delete Link', DeleteLink], ['Filter (Menu)', Filter.menu], ['Edit Link', QR.oekaki.menu], ['Download Link', DownloadLink], ['Archive Link', ArchiveLink], ['Quote Inlining', QuoteInline], ['Quote Previewing', QuotePreview], ['Quote Backlinks', QuoteBacklink], ['Mark Quotes of You', QuoteYou], ['Mark OP Quotes', QuoteOP], ['Mark Cross-thread Quotes', QuoteCT], ['Anonymize', Anonymize], ['Time Formatting', Time], ['Relative Post Dates', RelativeDates], ['File Info Formatting', FileInfo], ['Fappe Tyme', FappeTyme], ['Gallery', Gallery], ['Gallery (menu)', Gallery.menu], ['Sauce', Sauce], ['Image Expansion', ImageExpand], ['Image Expansion (Menu)', ImageExpand.menu], ['Reveal Spoiler Thumbnails', RevealSpoilers], ['Image Loading', ImageLoader], ['Image Hover', ImageHover], ['Volume Control', Volume], ['WEBM Metadata', Metadata], ['Comment Expansion', ExpandComment], ['Thread Expansion', ExpandThread], ['Thread Excerpt', ThreadExcerpt], ['Favicon', Favicon], ['Unread', Unread], ['Quote Threading', QuoteThreading], ['Thread Stats', ThreadStats], ['Thread Updater', ThreadUpdater], ['Thread Watcher', ThreadWatcher], ['Thread Watcher (Menu)', ThreadWatcher.menu], ['Mark New IPs', MarkNewIPs], ['Index Navigation', Nav], ['Keybinds', Keybinds], ['Banner', Banner], ['Flash Features', Flash], ['Prune Replies', PruneReplies]] }; Main.init(); diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index d7795b399..338593311 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index ff0f3aae1..1326a691b 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index 4572e8b5d..0a803d67e 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/img/1.11.28.1.png b/img/1.11.28.1.png new file mode 100644 index 000000000..8863085c9 Binary files /dev/null and b/img/1.11.28.1.png differ diff --git a/version.json b/version.json index 560741dee..49f2fd5e1 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "1.11.28.0", - "date": "2016-03-13T22:50:13.404Z" + "version": "1.11.28.1", + "date": "2016-03-16T10:59:02.457Z" }