IDHighlight
This commit is contained in:
parent
2a94bb7150
commit
f10b3ad9f6
@ -115,7 +115,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
(function() {
|
(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,
|
__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; },
|
__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,
|
__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 = {
|
Keybinds = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var hotkey, init;
|
var hotkey, init;
|
||||||
|
|||||||
@ -88,7 +88,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
(function() {
|
(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,
|
__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; },
|
__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,
|
__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 = {
|
Keybinds = {
|
||||||
init: function() {
|
init: function() {
|
||||||
var hotkey, init;
|
var hotkey, init;
|
||||||
|
|||||||
23
src/Miscellaneous/IDHighlight.coffee
Normal file
23
src/Miscellaneous/IDHighlight.coffee
Normal file
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user