diff --git a/builds/appchan-x.js b/builds/appchan-x.js index bcd3bf5c4..e6fc2e492 100644 --- a/builds/appchan-x.js +++ b/builds/appchan-x.js @@ -42,7 +42,7 @@ */ (function() { - var $, $$, Anonymize, ArchiveLink, Banner, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, GlobalMessage, Header, Icons, ImageExpand, ImageHover, ImageReplace, JSColor, Keybinds, Linkify, Main, MascotTools, Mascots, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, + var $, $$, Anonymize, ArchiveLink, Banner, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, GlobalMessage, Header, Icons, ImageExpand, ImageHover, ImageReplace, JSColor, Keybinds, Linkify, Main, MascotTools, Mascots, Menu, MutationObserver, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, __slice = [].slice, __hasProp = {}.hasOwnProperty, __extends = 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; }; @@ -332,6 +332,8 @@ posts: {} }; + MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.OMutationObserver; + Mascots = { 'Akiyama_Mio': { category: 'Anime', @@ -9617,7 +9619,7 @@ }), this.ready.bind(this)); }, ready: function() { - var MutationObserver, imgContainer, input, observer, setLifetime, + var imgContainer, input, observer, setLifetime, _this = this; setLifetime = function(e) { @@ -9643,7 +9645,7 @@ img: imgContainer.firstChild, input: input }; - if (MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.OMutationObserver) { + if (MutationObserver) { observer = new MutationObserver(this.load.bind(this)); observer.observe(this.nodes.challenge, { childList: true @@ -10524,15 +10526,22 @@ return this.cb = QuoteThreading.nodeinsert; }, nodeinsert: function() { - var posts, qpost, qroot, threadContainer; + var bottom, height, posts, qpost, qroot, threadContainer, top, _ref; posts = g.posts; qpost = posts[this.threaded]; delete this.threaded; delete this.cb; - if (this.thread.OP === qpost || (QuoteThreading.hasRun && !Unread.posts.contains(qpost))) { + if (this.thread.OP === qpost) { return false; } + if (QuoteThreading.hasRun) { + height = doc.clientHeight; + _ref = qpost.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; + if (!(Unread.posts.contains(qpost) || ((bottom < height) && (top > 0)))) { + return false; + } + } qroot = qpost.nodes.root; threadContainer = qroot.nextSibling; if ((threadContainer != null ? threadContainer.className : void 0) !== 'threadContainer') { diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index f181dcc85..9fdc32f3a 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -42,7 +42,7 @@ */ (function() { - var $, $$, Anonymize, ArchiveLink, Banner, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, GlobalMessage, Header, Icons, ImageExpand, ImageHover, ImageReplace, JSColor, Keybinds, Linkify, Main, MascotTools, Mascots, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, + var $, $$, Anonymize, ArchiveLink, Banner, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, GlobalMessage, Header, Icons, ImageExpand, ImageHover, ImageReplace, JSColor, Keybinds, Linkify, Main, MascotTools, Mascots, Menu, MutationObserver, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, __slice = [].slice, __hasProp = {}.hasOwnProperty, __extends = 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; }; @@ -329,6 +329,8 @@ posts: {} }; + MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.OMutationObserver; + Mascots = { 'Akiyama_Mio': { category: 'Anime', @@ -9615,7 +9617,7 @@ }), this.ready.bind(this)); }, ready: function() { - var MutationObserver, imgContainer, input, observer, setLifetime, + var imgContainer, input, observer, setLifetime, _this = this; setLifetime = function(e) { @@ -9641,7 +9643,7 @@ img: imgContainer.firstChild, input: input }; - if (MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.OMutationObserver) { + if (MutationObserver) { observer = new MutationObserver(this.load.bind(this)); observer.observe(this.nodes.challenge, { childList: true @@ -10541,15 +10543,22 @@ return this.cb = QuoteThreading.nodeinsert; }, nodeinsert: function() { - var posts, qpost, qroot, threadContainer; + var bottom, height, posts, qpost, qroot, threadContainer, top, _ref; posts = g.posts; qpost = posts[this.threaded]; delete this.threaded; delete this.cb; - if (this.thread.OP === qpost || (QuoteThreading.hasRun && !Unread.posts.contains(qpost))) { + if (this.thread.OP === qpost) { return false; } + if (QuoteThreading.hasRun) { + height = doc.clientHeight; + _ref = qpost.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; + if (!(Unread.posts.contains(qpost) || ((bottom < height) && (top > 0)))) { + return false; + } + } qroot = qpost.nodes.root; threadContainer = qroot.nextSibling; if ((threadContainer != null ? threadContainer.className : void 0) !== 'threadContainer') { diff --git a/builds/crx.crx b/builds/crx.crx index c293e8fc0..ce63318d9 100644 Binary files a/builds/crx.crx and b/builds/crx.crx differ diff --git a/builds/crx/script.js b/builds/crx/script.js index 39e6a9961..3423622c1 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,5 +1,5 @@ (function() { - var $, $$, Anonymize, ArchiveLink, Banner, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, GlobalMessage, Header, Icons, ImageExpand, ImageHover, ImageReplace, JSColor, Keybinds, Linkify, Main, MascotTools, Mascots, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, + var $, $$, Anonymize, ArchiveLink, Banner, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, GlobalMessage, Header, Icons, ImageExpand, ImageHover, ImageReplace, JSColor, Keybinds, Linkify, Main, MascotTools, Mascots, Menu, MutationObserver, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, __slice = [].slice, __hasProp = {}.hasOwnProperty, __extends = 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; }; @@ -285,6 +285,8 @@ posts: {} }; + MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.OMutationObserver; + Mascots = { 'Akiyama_Mio': { category: 'Anime', @@ -9537,7 +9539,7 @@ }), this.ready.bind(this)); }, ready: function() { - var MutationObserver, imgContainer, input, observer, setLifetime, + var imgContainer, input, observer, setLifetime, _this = this; setLifetime = function(e) { @@ -9563,7 +9565,7 @@ img: imgContainer.firstChild, input: input }; - if (MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.OMutationObserver) { + if (MutationObserver) { observer = new MutationObserver(this.load.bind(this)); observer.observe(this.nodes.challenge, { childList: true @@ -10444,15 +10446,22 @@ return this.cb = QuoteThreading.nodeinsert; }, nodeinsert: function() { - var posts, qpost, qroot, threadContainer; + var bottom, height, posts, qpost, qroot, threadContainer, top, _ref; posts = g.posts; qpost = posts[this.threaded]; delete this.threaded; delete this.cb; - if (this.thread.OP === qpost || (QuoteThreading.hasRun && !Unread.posts.contains(qpost))) { + if (this.thread.OP === qpost) { return false; } + if (QuoteThreading.hasRun) { + height = doc.clientHeight; + _ref = qpost.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top; + if (!(Unread.posts.contains(qpost) || ((bottom < height) && (top > 0)))) { + return false; + } + } qroot = qpost.nodes.root; threadContainer = qroot.nextSibling; if ((threadContainer != null ? threadContainer.className : void 0) !== 'threadContainer') { diff --git a/src/code/globals.coffee b/src/code/globals.coffee index 7c4114364..b68fb2c2e 100644 --- a/src/code/globals.coffee +++ b/src/code/globals.coffee @@ -19,6 +19,8 @@ g = threads: {} posts: {} +MutationObserver = window.MutationObserver or window.WebKitMutationObserver or window.OMutationObserver + Mascots = 'Akiyama_Mio': category: 'Anime' diff --git a/src/code/posting/qr.coffee b/src/code/posting/qr.coffee index e2f878ffc..5eba07abe 100644 --- a/src/code/posting/qr.coffee +++ b/src/code/posting/qr.coffee @@ -671,7 +671,7 @@ QR = img: imgContainer.firstChild input: input - if MutationObserver = window.MutationObserver or window.WebKitMutationObserver or window.OMutationObserver + if MutationObserver observer = new MutationObserver @load.bind @ observer.observe @nodes.challenge, childList: true diff --git a/src/code/quoting/quotethreading.coffee b/src/code/quoting/quotethreading.coffee index 185e70ed8..837e74c29 100644 --- a/src/code/quoting/quotethreading.coffee +++ b/src/code/quoting/quotethreading.coffee @@ -62,7 +62,14 @@ QuoteThreading = delete @threaded delete @cb - return false if @thread.OP is qpost or (QuoteThreading.hasRun and !Unread.posts.contains qpost) + return false if @thread.OP is qpost + + if QuoteThreading.hasRun + height = doc.clientHeight + {bottom, top} = qpost.nodes.root.getBoundingClientRect() + + # Post is unread or is fully visible. + return false unless Unread.posts.contains(qpost) or ((bottom < height) and (top > 0)) qroot = qpost.nodes.root threadContainer = qroot.nextSibling