RevealSpoilers, Sauce, TrashQueue
This commit is contained in:
parent
edb60f4221
commit
7858787516
@ -11514,7 +11514,8 @@
|
||||
|
||||
RevealSpoilers = {
|
||||
init: function() {
|
||||
if (!Conf['Reveal Spoiler Thumbnails']) {
|
||||
var _ref;
|
||||
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Reveal Spoiler Thumbnails'])) {
|
||||
return;
|
||||
}
|
||||
return Post.callbacks.push({
|
||||
@ -11529,20 +11530,21 @@
|
||||
}
|
||||
thumb = this.file.thumb;
|
||||
thumb.removeAttribute('style');
|
||||
thumb.style.maxHeight = thumb.style.maxWidth = this.isReply ? '125px' : '250px';
|
||||
return thumb.src = this.file.thumbURL;
|
||||
}
|
||||
};
|
||||
|
||||
Sauce = {
|
||||
init: function() {
|
||||
var err, link, links, _i, _len, _ref;
|
||||
if (!Conf['Sauce']) {
|
||||
var err, link, links, _i, _len, _ref, _ref1;
|
||||
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Sauce'])) {
|
||||
return;
|
||||
}
|
||||
links = [];
|
||||
_ref = Conf['sauces'].split('\n');
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
_ref1 = Conf['sauces'].split('\n');
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
link = _ref1[_i];
|
||||
try {
|
||||
if (link[0] !== '#') {
|
||||
links.push(link.trim());
|
||||
@ -11563,30 +11565,58 @@
|
||||
cb: this.node
|
||||
});
|
||||
},
|
||||
createSauceLink: function(link, post, a) {
|
||||
var m, text;
|
||||
link = link.replace(/%(T?URL|MD5|board|name)/g, function(parameter) {
|
||||
var type;
|
||||
if (type = {
|
||||
'%TURL': post.file.thumbURL,
|
||||
'%URL': post.file.URL,
|
||||
'%MD5': post.file.MD5,
|
||||
'%board': post.board,
|
||||
'%name': post.file.name
|
||||
}[parameter]) {
|
||||
return encodeURIComponent(type);
|
||||
createSauceLink: function(link, post) {
|
||||
var a, ext, i, key, m, part, parts, _i, _len, _ref, _ref1, _ref2, _ref3;
|
||||
parts = {};
|
||||
_ref = link.split(/;(?=(?:text|boards|types):)/);
|
||||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
||||
part = _ref[i];
|
||||
if (i === 0) {
|
||||
parts['url'] = part;
|
||||
} else {
|
||||
return parameter;
|
||||
m = part.match(/^(\w*):(.*)$/);
|
||||
parts[m[1]] = m[2];
|
||||
}
|
||||
});
|
||||
text = (m = link.match(/;text:(.+)$/)) ? m[1] : link.match(/(\w+)\.\w+\//)[1];
|
||||
link = link.replace(/;text:.+$/, '');
|
||||
a.href = link;
|
||||
a.textContent = text;
|
||||
}
|
||||
parts['text'] || (parts['text'] = ((_ref1 = parts['url'].match(/(\w+)\.\w+\//)) != null ? _ref1[1] : void 0) || '?');
|
||||
for (key in parts) {
|
||||
parts[key] = parts[key].replace(/%(T?URL|MD5|board|name|%|semi)/g, function(parameter) {
|
||||
var type;
|
||||
type = {
|
||||
'%TURL': post.file.thumbURL,
|
||||
'%URL': post.file.URL,
|
||||
'%MD5': post.file.MD5,
|
||||
'%board': post.board.ID,
|
||||
'%name': post.file.name,
|
||||
'%%': '%',
|
||||
'%semi': ';'
|
||||
}[parameter];
|
||||
if (key === 'url' && parameter !== '%%' && parameter !== '%semi') {
|
||||
if (/^javascript:/i.test(parts['url'])) {
|
||||
type = JSON.stringify(type);
|
||||
}
|
||||
type = encodeURIComponent(type);
|
||||
}
|
||||
return type;
|
||||
});
|
||||
}
|
||||
ext = ((_ref2 = post.file.URL.match(/\.([^\.]*)$/)) != null ? _ref2[1] : void 0) || '';
|
||||
if (!(!parts['boards'] || (_ref3 = post.board.ID, __indexOf.call(parts['boards'].split(','), _ref3) >= 0))) {
|
||||
return null;
|
||||
}
|
||||
if (!(!parts['types'] || __indexOf.call(parts['types'].split(','), ext) >= 0)) {
|
||||
return null;
|
||||
}
|
||||
a = Sauce.link.cloneNode(true);
|
||||
a.href = parts['url'];
|
||||
a.textContent = parts['text'];
|
||||
if (/^javascript:/i.test(parts['url'])) {
|
||||
a.removeAttribute('target');
|
||||
}
|
||||
return a;
|
||||
},
|
||||
node: function() {
|
||||
var link, nodes, _i, _len, _ref;
|
||||
var link, node, nodes, _i, _len, _ref;
|
||||
if (this.isClone || !this.file) {
|
||||
return;
|
||||
}
|
||||
@ -11594,7 +11624,9 @@
|
||||
_ref = Sauce.links;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
nodes.push($.tn('\u00A0'), Sauce.createSauceLink(link, this, Sauce.link.cloneNode(true)));
|
||||
if (node = Sauce.createSauceLink(link, this)) {
|
||||
nodes.push($.tn('\u00A0'), node);
|
||||
}
|
||||
}
|
||||
return $.add(this.file.text, nodes);
|
||||
}
|
||||
|
||||
@ -11536,7 +11536,8 @@
|
||||
|
||||
RevealSpoilers = {
|
||||
init: function() {
|
||||
if (!Conf['Reveal Spoiler Thumbnails']) {
|
||||
var _ref;
|
||||
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Reveal Spoiler Thumbnails'])) {
|
||||
return;
|
||||
}
|
||||
return Post.callbacks.push({
|
||||
@ -11551,20 +11552,21 @@
|
||||
}
|
||||
thumb = this.file.thumb;
|
||||
thumb.removeAttribute('style');
|
||||
thumb.style.maxHeight = thumb.style.maxWidth = this.isReply ? '125px' : '250px';
|
||||
return thumb.src = this.file.thumbURL;
|
||||
}
|
||||
};
|
||||
|
||||
Sauce = {
|
||||
init: function() {
|
||||
var err, link, links, _i, _len, _ref;
|
||||
if (!Conf['Sauce']) {
|
||||
var err, link, links, _i, _len, _ref, _ref1;
|
||||
if (!(((_ref = g.VIEW) === 'index' || _ref === 'thread') && Conf['Sauce'])) {
|
||||
return;
|
||||
}
|
||||
links = [];
|
||||
_ref = Conf['sauces'].split('\n');
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
_ref1 = Conf['sauces'].split('\n');
|
||||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
||||
link = _ref1[_i];
|
||||
try {
|
||||
if (link[0] !== '#') {
|
||||
links.push(link.trim());
|
||||
@ -11585,30 +11587,58 @@
|
||||
cb: this.node
|
||||
});
|
||||
},
|
||||
createSauceLink: function(link, post, a) {
|
||||
var m, text;
|
||||
link = link.replace(/%(T?URL|MD5|board|name)/g, function(parameter) {
|
||||
var type;
|
||||
if (type = {
|
||||
'%TURL': post.file.thumbURL,
|
||||
'%URL': post.file.URL,
|
||||
'%MD5': post.file.MD5,
|
||||
'%board': post.board,
|
||||
'%name': post.file.name
|
||||
}[parameter]) {
|
||||
return encodeURIComponent(type);
|
||||
createSauceLink: function(link, post) {
|
||||
var a, ext, i, key, m, part, parts, _i, _len, _ref, _ref1, _ref2, _ref3;
|
||||
parts = {};
|
||||
_ref = link.split(/;(?=(?:text|boards|types):)/);
|
||||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
||||
part = _ref[i];
|
||||
if (i === 0) {
|
||||
parts['url'] = part;
|
||||
} else {
|
||||
return parameter;
|
||||
m = part.match(/^(\w*):(.*)$/);
|
||||
parts[m[1]] = m[2];
|
||||
}
|
||||
});
|
||||
text = (m = link.match(/;text:(.+)$/)) ? m[1] : link.match(/(\w+)\.\w+\//)[1];
|
||||
link = link.replace(/;text:.+$/, '');
|
||||
a.href = link;
|
||||
a.textContent = text;
|
||||
}
|
||||
parts['text'] || (parts['text'] = ((_ref1 = parts['url'].match(/(\w+)\.\w+\//)) != null ? _ref1[1] : void 0) || '?');
|
||||
for (key in parts) {
|
||||
parts[key] = parts[key].replace(/%(T?URL|MD5|board|name|%|semi)/g, function(parameter) {
|
||||
var type;
|
||||
type = {
|
||||
'%TURL': post.file.thumbURL,
|
||||
'%URL': post.file.URL,
|
||||
'%MD5': post.file.MD5,
|
||||
'%board': post.board.ID,
|
||||
'%name': post.file.name,
|
||||
'%%': '%',
|
||||
'%semi': ';'
|
||||
}[parameter];
|
||||
if (key === 'url' && parameter !== '%%' && parameter !== '%semi') {
|
||||
if (/^javascript:/i.test(parts['url'])) {
|
||||
type = JSON.stringify(type);
|
||||
}
|
||||
type = encodeURIComponent(type);
|
||||
}
|
||||
return type;
|
||||
});
|
||||
}
|
||||
ext = ((_ref2 = post.file.URL.match(/\.([^\.]*)$/)) != null ? _ref2[1] : void 0) || '';
|
||||
if (!(!parts['boards'] || (_ref3 = post.board.ID, __indexOf.call(parts['boards'].split(','), _ref3) >= 0))) {
|
||||
return null;
|
||||
}
|
||||
if (!(!parts['types'] || __indexOf.call(parts['types'].split(','), ext) >= 0)) {
|
||||
return null;
|
||||
}
|
||||
a = Sauce.link.cloneNode(true);
|
||||
a.href = parts['url'];
|
||||
a.textContent = parts['text'];
|
||||
if (/^javascript:/i.test(parts['url'])) {
|
||||
a.removeAttribute('target');
|
||||
}
|
||||
return a;
|
||||
},
|
||||
node: function() {
|
||||
var link, nodes, _i, _len, _ref;
|
||||
var link, node, nodes, _i, _len, _ref;
|
||||
if (this.isClone || !this.file) {
|
||||
return;
|
||||
}
|
||||
@ -11616,7 +11646,9 @@
|
||||
_ref = Sauce.links;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
link = _ref[_i];
|
||||
nodes.push($.tn('\u00A0'), Sauce.createSauceLink(link, this, Sauce.link.cloneNode(true)));
|
||||
if (node = Sauce.createSauceLink(link, this)) {
|
||||
nodes.push($.tn('\u00A0'), node);
|
||||
}
|
||||
}
|
||||
return $.add(this.file.text, nodes);
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
RevealSpoilers =
|
||||
init: ->
|
||||
return if !Conf['Reveal Spoiler Thumbnails']
|
||||
return unless g.VIEW in ['index', 'thread'] and Conf['Reveal Spoiler Thumbnails']
|
||||
|
||||
Post.callbacks.push
|
||||
name: 'Reveal Spoiler Thumbnails'
|
||||
@ -9,5 +9,8 @@ RevealSpoilers =
|
||||
node: ->
|
||||
return if @isClone or !@file?.isSpoiler
|
||||
{thumb} = @file
|
||||
# Remove old width and height.
|
||||
thumb.removeAttribute 'style'
|
||||
# Enforce thumbnail size if thumbnail is replaced.
|
||||
thumb.style.maxHeight = thumb.style.maxWidth = if @isReply then '125px' else '250px'
|
||||
thumb.src = @file.thumbURL
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Sauce =
|
||||
init: ->
|
||||
return if !Conf['Sauce']
|
||||
return unless g.VIEW in ['index', 'thread'] and Conf['Sauce']
|
||||
|
||||
links = []
|
||||
for link in Conf['sauces'].split '\n'
|
||||
@ -14,27 +14,42 @@ Sauce =
|
||||
Post.callbacks.push
|
||||
name: 'Sauce'
|
||||
cb: @node
|
||||
createSauceLink: (link, post, a) ->
|
||||
link = link.replace /%(T?URL|MD5|board|name)/g, (parameter) ->
|
||||
if type = {
|
||||
'%TURL': post.file.thumbURL
|
||||
'%URL': post.file.URL
|
||||
'%MD5': post.file.MD5
|
||||
'%board': post.board
|
||||
'%name': post.file.name
|
||||
}[parameter]
|
||||
encodeURIComponent(type)
|
||||
createSauceLink: (link, post) ->
|
||||
parts = {}
|
||||
for part, i in link.split /;(?=(?:text|boards|types):)/
|
||||
if i is 0
|
||||
parts['url'] = part
|
||||
else
|
||||
parameter
|
||||
text = if m = link.match(/;text:(.+)$/) then m[1] else link.match(/(\w+)\.\w+\//)[1]
|
||||
link = link.replace /;text:.+$/, ''
|
||||
a.href = link
|
||||
a.textContent = text
|
||||
m = part.match /^(\w*):(.*)$/
|
||||
parts[m[1]] = m[2]
|
||||
parts['text'] or= parts['url'].match(/(\w+)\.\w+\//)?[1] or '?'
|
||||
for key of parts
|
||||
parts[key] = parts[key].replace /%(T?URL|MD5|board|name|%|semi)/g, (parameter) ->
|
||||
type = {
|
||||
'%TURL': post.file.thumbURL
|
||||
'%URL': post.file.URL
|
||||
'%MD5': post.file.MD5
|
||||
'%board': post.board.ID
|
||||
'%name': post.file.name
|
||||
'%%': '%'
|
||||
'%semi': ';'
|
||||
}[parameter]
|
||||
if key is 'url' and parameter isnt '%%' and parameter isnt '%semi'
|
||||
type = JSON.stringify type if /^javascript:/i.test parts['url']
|
||||
type = encodeURIComponent type
|
||||
type
|
||||
ext = post.file.URL.match(/\.([^\.]*)$/)?[1] or ''
|
||||
return null unless !parts['boards'] or post.board.ID in parts['boards'].split ','
|
||||
return null unless !parts['types'] or ext in parts['types'].split ','
|
||||
a = Sauce.link.cloneNode true
|
||||
a.href = parts['url']
|
||||
a.textContent = parts['text']
|
||||
a.removeAttribute 'target' if /^javascript:/i.test parts['url']
|
||||
a
|
||||
node: ->
|
||||
return if @isClone or !@file
|
||||
nodes = []
|
||||
for link in Sauce.links
|
||||
for link in Sauce.links when node = Sauce.createSauceLink link, @
|
||||
# \u00A0 is nbsp
|
||||
nodes.push $.tn('\u00A0'), (Sauce.createSauceLink link, @, Sauce.link.cloneNode true)
|
||||
nodes.push $.tn('\u00A0'), node
|
||||
$.add @file.text, nodes
|
||||
|
||||
@ -11,4 +11,3 @@ TrashQueue =
|
||||
remove: (video) ->
|
||||
if video is @killNext
|
||||
delete @killNext
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user