Add remove spoilers and indicate spoilers
This commit is contained in:
parent
b370cd91e3
commit
7a03d0eedd
@ -102,7 +102,7 @@
|
|||||||
* this notice is kept intact.
|
* this notice is kept intact.
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
||||||
__slice = [].slice,
|
__slice = [].slice,
|
||||||
__hasProp = {}.hasOwnProperty,
|
__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; },
|
__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; },
|
||||||
@ -125,7 +125,9 @@
|
|||||||
'Index Navigation': [false, 'Add buttons to navigate between threads.'],
|
'Index Navigation': [false, 'Add buttons to navigate between threads.'],
|
||||||
'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'],
|
'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'],
|
||||||
'Check for Updates': [true, 'Check for updated versions of 4chan X.'],
|
'Check for Updates': [true, 'Check for updated versions of 4chan X.'],
|
||||||
'Emoji': [false, 'Adds icons next to names for different emails']
|
'Emoji': [false, 'Adds icons next to names for different emails'],
|
||||||
|
'Remove Spoilers': [false, 'Remove all spoilers in text.'],
|
||||||
|
'Indicate Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled.']
|
||||||
},
|
},
|
||||||
'Linkification': {
|
'Linkification': {
|
||||||
'Linkify': [true, 'Convert text into links where applicable.'],
|
'Linkify': [true, 'Convert text into links where applicable.'],
|
||||||
@ -5701,6 +5703,35 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RemoveSpoilers = {
|
||||||
|
init: function() {
|
||||||
|
if (!Conf['Remove Spoilers']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Conf['Indicate Spoilers']) {
|
||||||
|
this.wrapper = function(text) {
|
||||||
|
return "[spoiler]" + text + "[/spoiler]";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Post.prototype.callbacks.push({
|
||||||
|
name: 'Reveal Spoilers',
|
||||||
|
cb: this.node
|
||||||
|
});
|
||||||
|
},
|
||||||
|
wrapper: function(text) {
|
||||||
|
return text;
|
||||||
|
},
|
||||||
|
node: function(post) {
|
||||||
|
var spoiler, spoilers, _i, _len;
|
||||||
|
|
||||||
|
spoilers = $$('s', this.nodes.comment);
|
||||||
|
for (_i = 0, _len = spoilers.length; _i < _len; _i++) {
|
||||||
|
spoiler = spoilers[_i];
|
||||||
|
$.replace(spoiler, $.tn(RemoveSpoilers.wrapper(spoiler.textContent)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Report = {
|
Report = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (!/report/.test(location.search)) {
|
if (!/report/.test(location.search)) {
|
||||||
@ -9437,6 +9468,7 @@
|
|||||||
'Announcement Hiding': PSAHiding,
|
'Announcement Hiding': PSAHiding,
|
||||||
'Fourchan thingies': Fourchan,
|
'Fourchan thingies': Fourchan,
|
||||||
'Emoji': Emoji,
|
'Emoji': Emoji,
|
||||||
|
'Remove Spoilers': RemoveSpoilers,
|
||||||
'Custom CSS': CustomCSS,
|
'Custom CSS': CustomCSS,
|
||||||
'Linkify': Linkify,
|
'Linkify': Linkify,
|
||||||
'Resurrect Quotes': Quotify,
|
'Resurrect Quotes': Quotify,
|
||||||
|
|||||||
@ -102,7 +102,7 @@
|
|||||||
* this notice is kept intact.
|
* this notice is kept intact.
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
||||||
__slice = [].slice,
|
__slice = [].slice,
|
||||||
__hasProp = {}.hasOwnProperty,
|
__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; },
|
__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; },
|
||||||
@ -125,7 +125,9 @@
|
|||||||
'Index Navigation': [false, 'Add buttons to navigate between threads.'],
|
'Index Navigation': [false, 'Add buttons to navigate between threads.'],
|
||||||
'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'],
|
'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'],
|
||||||
'Check for Updates': [true, 'Check for updated versions of 4chan X.'],
|
'Check for Updates': [true, 'Check for updated versions of 4chan X.'],
|
||||||
'Emoji': [false, 'Adds icons next to names for different emails']
|
'Emoji': [false, 'Adds icons next to names for different emails'],
|
||||||
|
'Remove Spoilers': [false, 'Remove all spoilers in text.'],
|
||||||
|
'Indicate Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled.']
|
||||||
},
|
},
|
||||||
'Linkification': {
|
'Linkification': {
|
||||||
'Linkify': [true, 'Convert text into links where applicable.'],
|
'Linkify': [true, 'Convert text into links where applicable.'],
|
||||||
@ -5692,6 +5694,35 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RemoveSpoilers = {
|
||||||
|
init: function() {
|
||||||
|
if (!Conf['Remove Spoilers']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Conf['Indicate Spoilers']) {
|
||||||
|
this.wrapper = function(text) {
|
||||||
|
return "[spoiler]" + text + "[/spoiler]";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Post.prototype.callbacks.push({
|
||||||
|
name: 'Reveal Spoilers',
|
||||||
|
cb: this.node
|
||||||
|
});
|
||||||
|
},
|
||||||
|
wrapper: function(text) {
|
||||||
|
return text;
|
||||||
|
},
|
||||||
|
node: function(post) {
|
||||||
|
var spoiler, spoilers, _i, _len;
|
||||||
|
|
||||||
|
spoilers = $$('s', this.nodes.comment);
|
||||||
|
for (_i = 0, _len = spoilers.length; _i < _len; _i++) {
|
||||||
|
spoiler = spoilers[_i];
|
||||||
|
$.replace(spoiler, $.tn(RemoveSpoilers.wrapper(spoiler.textContent)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Report = {
|
Report = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (!/report/.test(location.search)) {
|
if (!/report/.test(location.search)) {
|
||||||
@ -9455,6 +9486,7 @@
|
|||||||
'Announcement Hiding': PSAHiding,
|
'Announcement Hiding': PSAHiding,
|
||||||
'Fourchan thingies': Fourchan,
|
'Fourchan thingies': Fourchan,
|
||||||
'Emoji': Emoji,
|
'Emoji': Emoji,
|
||||||
|
'Remove Spoilers': RemoveSpoilers,
|
||||||
'Custom CSS': CustomCSS,
|
'Custom CSS': CustomCSS,
|
||||||
'Linkify': Linkify,
|
'Linkify': Linkify,
|
||||||
'Resurrect Quotes': Quotify,
|
'Resurrect Quotes': Quotify,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(function() {
|
(function() {
|
||||||
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
var $, $$, Anonymize, ArchiveLink, Board, Build, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DataBoards, DeleteLink, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Get, Header, ImageExpand, ImageHover, ImageReplace, Keybinds, Linkify, Main, Menu, Nav, Notification, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, UI, Unread, c, d, doc, g,
|
||||||
__slice = [].slice,
|
__slice = [].slice,
|
||||||
__hasProp = {}.hasOwnProperty,
|
__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; },
|
__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; },
|
||||||
@ -22,7 +22,9 @@
|
|||||||
'Index Navigation': [false, 'Add buttons to navigate between threads.'],
|
'Index Navigation': [false, 'Add buttons to navigate between threads.'],
|
||||||
'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'],
|
'Reply Navigation': [false, 'Add buttons to navigate to top / bottom of thread.'],
|
||||||
'Check for Updates': [true, 'Check for updated versions of 4chan X.'],
|
'Check for Updates': [true, 'Check for updated versions of 4chan X.'],
|
||||||
'Emoji': [false, 'Adds icons next to names for different emails']
|
'Emoji': [false, 'Adds icons next to names for different emails'],
|
||||||
|
'Remove Spoilers': [false, 'Remove all spoilers in text.'],
|
||||||
|
'Indicate Spoilers': [false, 'Indicate spoilers if Remove Spoilers is enabled.']
|
||||||
},
|
},
|
||||||
'Linkification': {
|
'Linkification': {
|
||||||
'Linkify': [true, 'Convert text into links where applicable.'],
|
'Linkify': [true, 'Convert text into links where applicable.'],
|
||||||
@ -5556,6 +5558,35 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RemoveSpoilers = {
|
||||||
|
init: function() {
|
||||||
|
if (!Conf['Remove Spoilers']) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (Conf['Indicate Spoilers']) {
|
||||||
|
this.wrapper = function(text) {
|
||||||
|
return "[spoiler]" + text + "[/spoiler]";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Post.prototype.callbacks.push({
|
||||||
|
name: 'Reveal Spoilers',
|
||||||
|
cb: this.node
|
||||||
|
});
|
||||||
|
},
|
||||||
|
wrapper: function(text) {
|
||||||
|
return text;
|
||||||
|
},
|
||||||
|
node: function(post) {
|
||||||
|
var spoiler, spoilers, _i, _len;
|
||||||
|
|
||||||
|
spoilers = $$('s', this.nodes.comment);
|
||||||
|
for (_i = 0, _len = spoilers.length; _i < _len; _i++) {
|
||||||
|
spoiler = spoilers[_i];
|
||||||
|
$.replace(spoiler, $.tn(RemoveSpoilers.wrapper(spoiler.textContent)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
Report = {
|
Report = {
|
||||||
init: function() {
|
init: function() {
|
||||||
if (!/report/.test(location.search)) {
|
if (!/report/.test(location.search)) {
|
||||||
@ -9298,6 +9329,7 @@
|
|||||||
'Announcement Hiding': PSAHiding,
|
'Announcement Hiding': PSAHiding,
|
||||||
'Fourchan thingies': Fourchan,
|
'Fourchan thingies': Fourchan,
|
||||||
'Emoji': Emoji,
|
'Emoji': Emoji,
|
||||||
|
'Remove Spoilers': RemoveSpoilers,
|
||||||
'Custom CSS': CustomCSS,
|
'Custom CSS': CustomCSS,
|
||||||
'Linkify': Linkify,
|
'Linkify': Linkify,
|
||||||
'Resurrect Quotes': Quotify,
|
'Resurrect Quotes': Quotify,
|
||||||
|
|||||||
@ -61,6 +61,14 @@ Config =
|
|||||||
false
|
false
|
||||||
'Adds icons next to names for different emails'
|
'Adds icons next to names for different emails'
|
||||||
]
|
]
|
||||||
|
'Remove Spoilers': [
|
||||||
|
false
|
||||||
|
'Remove all spoilers in text.'
|
||||||
|
]
|
||||||
|
'Indicate Spoilers': [
|
||||||
|
false
|
||||||
|
'Indicate spoilers if Remove Spoilers is enabled.'
|
||||||
|
]
|
||||||
|
|
||||||
'Linkification':
|
'Linkification':
|
||||||
'Linkify': [
|
'Linkify': [
|
||||||
|
|||||||
20
src/features/misc/removespoilers.coffee
Normal file
20
src/features/misc/removespoilers.coffee
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
RemoveSpoilers =
|
||||||
|
init: ->
|
||||||
|
return unless Conf['Remove Spoilers']
|
||||||
|
|
||||||
|
if Conf['Indicate Spoilers']
|
||||||
|
@wrapper = (text) ->
|
||||||
|
"[spoiler]#{text}[/spoiler]"
|
||||||
|
|
||||||
|
Post::callbacks.push
|
||||||
|
name: 'Reveal Spoilers'
|
||||||
|
cb: @node
|
||||||
|
|
||||||
|
wrapper: (text) ->
|
||||||
|
text
|
||||||
|
|
||||||
|
node: (post) ->
|
||||||
|
spoilers = $$ 's', @nodes.comment
|
||||||
|
for spoiler in spoilers
|
||||||
|
$.replace spoiler, $.tn RemoveSpoilers.wrapper spoiler.textContent
|
||||||
|
return
|
||||||
@ -72,6 +72,7 @@ Main =
|
|||||||
'Announcement Hiding': PSAHiding
|
'Announcement Hiding': PSAHiding
|
||||||
'Fourchan thingies': Fourchan
|
'Fourchan thingies': Fourchan
|
||||||
'Emoji': Emoji
|
'Emoji': Emoji
|
||||||
|
'Remove Spoilers': RemoveSpoilers
|
||||||
'Custom CSS': CustomCSS
|
'Custom CSS': CustomCSS
|
||||||
'Linkify': Linkify
|
'Linkify': Linkify
|
||||||
'Resurrect Quotes': Quotify
|
'Resurrect Quotes': Quotify
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user