diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index d5b4883d2..99d59c913 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -115,7 +115,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, CatalogLinks, CatalogThread, Clone, Color, Conf, Config, CrossOrigin, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Flash, Fourchan, Gallery, Get, GlobalMessage, Header, IDColor, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, JSColor, Keybinds, Linkify, Main, MarkNewIPs, MascotTools, Mascots, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteInline, QuoteMarkers, QuotePreview, QuoteStrikeThrough, QuoteThreading, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, SimpleDict, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, + var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, CatalogLinks, CatalogThread, Clone, Color, Conf, Config, CrossOrigin, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Flash, Fourchan, Gallery, Get, GlobalMessage, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, JSColor, Keybinds, Linkify, Main, MarkNewIPs, MascotTools, Mascots, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteInline, QuoteMarkers, QuotePreview, QuoteStrikeThrough, QuoteThreading, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, SimpleDict, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, __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; }, __hasProp = {}.hasOwnProperty, @@ -15182,6 +15182,44 @@ } }; + IDHighlight = { + init: function() { + var _ref; + if ((_ref = g.VIEW) !== 'index' && _ref !== 'thread') { + return; + } + return Post.callbacks.push({ + name: 'Highlight by User ID', + cb: this.node + }); + }, + uniqueID: null, + node: function() { + if (this.nodes.uniqueID) { + $.on(this.nodes.uniqueID, 'click', IDHighlight.click(this)); + } + if (this.nodes.capcode) { + $.on(this.nodes.capcode, 'click', IDHighlight.click(this)); + } + if (!this.isClone) { + return IDHighlight.set(this); + } + }, + set: function(post) { + var match; + match = (post.info.uniqueID || post.info.capcode) === IDHighlight.uniqueID; + return $[match ? 'addClass' : 'rmClass'](post.nodes.post, 'highlight'); + }, + click: function(post) { + return function() { + var uniqueID; + uniqueID = post.info.uniqueID || post.info.capcode; + IDHighlight.uniqueID = IDHighlight.uniqueID === uniqueID ? null : uniqueID; + return g.posts.forEach(IDHighlight.set); + }; + } + }; + Keybinds = { init: function() { var hotkey, init; diff --git a/builds/crx/script.js b/builds/crx/script.js index 6d4081fd8..2bb009676 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -88,7 +88,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, CatalogLinks, CatalogThread, Clone, Color, Conf, Config, CrossOrigin, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Flash, Fourchan, Gallery, Get, GlobalMessage, Header, IDColor, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, JSColor, Keybinds, Linkify, Main, MarkNewIPs, MascotTools, Mascots, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteInline, QuoteMarkers, QuotePreview, QuoteStrikeThrough, QuoteThreading, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, SimpleDict, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, + var $, $$, Anonymize, AntiAutoplay, ArchiveLink, Banner, Board, Build, Callbacks, CatalogLinks, CatalogThread, Clone, Color, Conf, Config, CrossOrigin, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, E, Embedding, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Flash, Fourchan, Gallery, Get, GlobalMessage, Header, IDColor, IDHighlight, ImageCommon, ImageExpand, ImageHover, ImageLoader, Index, JSColor, Keybinds, Linkify, Main, MarkNewIPs, MascotTools, Mascots, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteInline, QuoteMarkers, QuotePreview, QuoteStrikeThrough, QuoteThreading, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Rice, Sauce, Settings, SimpleDict, Style, ThemeTools, Themes, Thread, ThreadExcerpt, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, editMascot, editTheme, g, userNavigation, __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; }, __hasProp = {}.hasOwnProperty, @@ -15203,6 +15203,44 @@ } }; + IDHighlight = { + init: function() { + var _ref; + if ((_ref = g.VIEW) !== 'index' && _ref !== 'thread') { + return; + } + return Post.callbacks.push({ + name: 'Highlight by User ID', + cb: this.node + }); + }, + uniqueID: null, + node: function() { + if (this.nodes.uniqueID) { + $.on(this.nodes.uniqueID, 'click', IDHighlight.click(this)); + } + if (this.nodes.capcode) { + $.on(this.nodes.capcode, 'click', IDHighlight.click(this)); + } + if (!this.isClone) { + return IDHighlight.set(this); + } + }, + set: function(post) { + var match; + match = (post.info.uniqueID || post.info.capcode) === IDHighlight.uniqueID; + return $[match ? 'addClass' : 'rmClass'](post.nodes.post, 'highlight'); + }, + click: function(post) { + return function() { + var uniqueID; + uniqueID = post.info.uniqueID || post.info.capcode; + IDHighlight.uniqueID = IDHighlight.uniqueID === uniqueID ? null : uniqueID; + return g.posts.forEach(IDHighlight.set); + }; + } + }; + Keybinds = { init: function() { var hotkey, init; diff --git a/src/Miscellaneous/IDHighlight.coffee b/src/Miscellaneous/IDHighlight.coffee new file mode 100644 index 000000000..4befd3112 --- /dev/null +++ b/src/Miscellaneous/IDHighlight.coffee @@ -0,0 +1,23 @@ +IDHighlight = + init: -> + return unless g.VIEW in ['index', 'thread'] + + Post.callbacks.push + name: 'Highlight by User ID' + cb: @node + + uniqueID: null + + node: -> + $.on @nodes.uniqueID, 'click', IDHighlight.click @ if @nodes.uniqueID + $.on @nodes.capcode, 'click', IDHighlight.click @ if @nodes.capcode + IDHighlight.set @ unless @isClone + + set: (post) -> + match = (post.info.uniqueID or post.info.capcode) is IDHighlight.uniqueID + $[if match then 'addClass' else 'rmClass'] post.nodes.post, 'highlight' + + click: (post) -> -> + uniqueID = post.info.uniqueID or post.info.capcode + IDHighlight.uniqueID = if IDHighlight.uniqueID is uniqueID then null else uniqueID + g.posts.forEach IDHighlight.set