diff --git a/4chan_x.user.js b/4chan_x.user.js index 36878d91c..f2b11af6c 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -395,7 +395,7 @@ }, x: function(path, root) { if (root == null) root = d.body; - return d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue; + return d.evaluate(path, root, null, 8, null).singleNodeValue; }, replace: function(root, el) { return root.parentNode.replaceChild(el, root); @@ -633,7 +633,7 @@ }, email: function(root) { var mail; - if (!(mail = $('.linkmail', root))) return mail.href; + if (mail = $('.linkmail', root)) return mail.href; return false; }, subject: function(root, isOP) { @@ -642,18 +642,13 @@ return sub.textContent; }, comment: function(root) { - var i, len, node, nodes, text; + var data, i, len, nodes, text; text = []; - nodes = d.evaluate('.//node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); + nodes = d.evaluate('.//br|.//text()', root.lastChild, null, 7, null); i = 0; len = nodes.snapshotLength; while (i < len) { - node = nodes.snapshotItem(i++); - if (node instanceof Text) { - text.push(node.data); - } else if (node instanceof HTMLBRElement) { - text.push('\n'); - } + text.push((data = nodes.snapshotItem(i++).data) ? data : '\n'); } return text.join(''); }, @@ -798,6 +793,7 @@ num = (function() { switch (g.BOARD) { case 'b': + case 'vg': return 3; case 't': return 1; @@ -1530,7 +1526,7 @@ className: 'preview', draggable: true, href: 'javascript:;', - innerHTML: 'x' + innerHTML: '×' }); $('input', this.el).checked = this.spoiler; $.on(this.el, 'click', function() { @@ -1724,7 +1720,7 @@ qr.el = ui.dialog('qr', 'top:0;right:0;', '\
\ Quick Reply \ - x\ + ×\
\
\
\ @@ -2121,7 +2117,8 @@ className: 'reply dialog', innerHTML: '
\
\ - 4chan X | ' + VERSION + '\ + 4chan X\ + | ' + VERSION + '\ | Issues\
\
\ @@ -2682,7 +2679,7 @@ for (id in _ref) { props = _ref[id]; x = $.el('a', { - textContent: 'X', + textContent: '\u00d7', href: 'javascript:;' }); $.on(x, 'click', watcher.cb.x); @@ -3370,6 +3367,7 @@ threadStats.imgLimit = (function() { switch (g.BOARD) { case 'a': + case 'mlp': case 'v': return 251; case 'vg': @@ -3483,6 +3481,7 @@ case 'm': case 'tg': case 'u': + case 'vg': return "http://archive.foolz.us/" + href[3] + "/full_image/" + href[5]; } }, @@ -4154,6 +4153,16 @@ img[md5], img[md5] + img {\ .presto > .fitwidth img[md5] + img {\ width: 100%;\ }\ +/* revealed spoilers do not have height/width,\ + this fixed "expanded" auto-gifs */\ +img[md5] {\ + max-height: 251px;\ + max-width: 251px;\ +}\ +td > .filesize > img[md5] {\ + max-height: 126px;\ + max-width: 126px;\ +}\ \ #qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks {\ position: fixed;\ diff --git a/changelog b/changelog index 6ee8b4e95..988300229 100644 --- a/changelog +++ b/changelog @@ -5,10 +5,13 @@ master - Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default). - Resolution/PDF: %r - Original filename: %n, %N. +- noface + Update imagelimit for mlp. 2.27.1 - Mayhem Fix stubs with the new filter. + Fix mail filtering. The MD5 will now check for exact string matching, it will not use regular expressions. 2.27.0 diff --git a/script.coffee b/script.coffee index 9dc5af705..224a53cde 100644 --- a/script.coffee +++ b/script.coffee @@ -304,7 +304,8 @@ $.extend $, $.add d.head, style style x: (path, root=d.body) -> - d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null). + # XPathResult.ANY_UNORDERED_NODE_TYPE is 8 + d.evaluate(path, root, null, 8, null). singleNodeValue replace: (root, el) -> root.parentNode.replaceChild el, root @@ -547,7 +548,7 @@ filter = return trip.textContent false email: (root) -> - unless mail = $ '.linkmail', root + if mail = $ '.linkmail', root return mail.href false subject: (root, isOP) -> @@ -555,15 +556,12 @@ filter = sub.textContent comment: (root) -> text = [] - nodes = d.evaluate './/node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null + # XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE is 7 + nodes = d.evaluate './/br|.//text()', root.lastChild, null, 7, null i = 0 len = nodes.snapshotLength while i < len - node = nodes.snapshotItem i++ - if node instanceof Text - text.push node.data - else if node instanceof HTMLBRElement - text.push '\n' + text.push if data = nodes.snapshotItem(i++).data then data else '\n' text.join '' filename: (root) -> if file = $ '.filesize > span', root @@ -666,7 +664,7 @@ expandThread = a.textContent = a.textContent.replace '-', '+' #goddamit moot num = switch g.BOARD - when 'b' then 3 + when 'b', 'vg' then 3 when 't' then 1 else 5 table = $.x "following::br[@clear]/preceding::table[#{num}]", a @@ -1231,7 +1229,7 @@ qr = className: 'preview' draggable: true href: 'javascript:;' - innerHTML: 'x' + innerHTML: '×' $('input', @el).checked = @spoiler $.on @el, 'click', => @select() $.on $('.remove', @el), 'click', (e) => @@ -1368,7 +1366,7 @@ qr = qr.el = ui.dialog 'qr', 'top:0;right:0;', '
Quick Reply - x + ×
@@ -1716,7 +1714,8 @@ options = className: 'reply dialog' innerHTML: '
- 4chan X | ' + VERSION + ' + 4chan X + | ' + VERSION + ' | Issues
@@ -2214,7 +2213,8 @@ watcher = for board of watched for id, props of watched[board] x = $.el 'a', - textContent: 'X' + # \u00d7 is × + textContent: '\u00d7' href: 'javascript:;' $.on x, 'click', watcher.cb.x link = $.el 'a', props @@ -2710,7 +2710,7 @@ threadStats = threadStats.posts = threadStats.images = 0 threadStats.imgLimit = switch g.BOARD - when 'a', 'v' + when 'a', 'mlp', 'v' 251 when 'vg' 501 @@ -2824,7 +2824,7 @@ redirect = # Do not use g.BOARD, the image url can originate from a cross-quote. return unless conf['404 Redirect'] switch href[3] - when 'a', 'jp', 'm', 'tg', 'u' + when 'a', 'jp', 'm', 'tg', 'u', 'vg' "http://archive.foolz.us/#{href[3]}/full_image/#{href[5]}" thread: -> return unless conf['404 Redirect'] @@ -3441,6 +3441,16 @@ img[md5], img[md5] + img { .presto > .fitwidth img[md5] + img { width: 100%; } +/* revealed spoilers do not have height/width, + this fixed "expanded" auto-gifs */ +img[md5] { + max-height: 251px; + max-width: 251px; +} +td > .filesize > img[md5] { + max-height: 126px; + max-width: 126px; +} #qr, #qp, #updater, #stats, #ihover, #overlay, #navlinks { position: fixed;