Merge branch 'next' into multisite

This commit is contained in:
ccd0 2016-10-09 17:29:41 -07:00
commit b26a1806cf
21 changed files with 89 additions and 68 deletions

View File

@ -4,6 +4,9 @@
## v1.13.0
**v1.13.0.9** *(2016-10-09)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.9/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.9/builds/4chan-X-noupdate.crx)]
- Fix bug from v1.13.0.0 that broke Quote Inlining / Previewing of OPs on /f/.
**v1.13.0.8** *(2016-10-08)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.8/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.0.8/builds/4chan-X-noupdate.crx)]
- (AchtBit) Add keybind for toggling custom cooldown (default: `Alt+Comma`).
- Add keybind to post file from URL (default: `Alt+l`).

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X beta
// @version 1.13.0.8
// @version 1.13.0.9
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X beta
// @version 1.13.0.8
// @version 1.13.0.9
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -136,7 +136,7 @@ docSet = function() {
};
g = {
VERSION: '1.13.0.8',
VERSION: '1.13.0.9',
NAMESPACE: '4chan X.',
boards: {}
};
@ -6128,7 +6128,7 @@ Post = (function() {
_Class.prototype.isClone = true;
function _Class(origin, context, contractThumb) {
var base, fileRoot, i, inline, inlined, j, k, key, l, len, len1, len2, len3, node, nodes, ref, ref1, ref2, ref3, ref4, root, val;
var base, fileRoot, i, inline, inlined, j, k, key, l, len, len1, len2, len3, node, nodes, ref, ref1, ref2, ref3, ref4, ref5, root, val;
this.origin = origin;
this.context = context;
ref = ['ID', 'fullID', 'board', 'thread', 'info', 'quotes', 'isReply'];
@ -6178,7 +6178,7 @@ Post = (function() {
this.file.text = fileRoot.firstElementChild;
this.file.link = $('.fileText > a, .fileText-original', fileRoot);
this.file.thumb = $('a.fileThumb > [data-md5]', fileRoot);
this.file.thumbLink = this.file.thumb.parentNode;
this.file.thumbLink = (ref5 = this.file.thumb) != null ? ref5.parentNode : void 0;
this.file.fullImage = $('.full-image', fileRoot);
this.file.videoControls = $('.video-controls', this.file.text);
if (this.file.videoThumb) {

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
// @version 1.13.0.8
// @version 1.13.0.9
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -136,7 +136,7 @@ docSet = function() {
};
g = {
VERSION: '1.13.0.8',
VERSION: '1.13.0.9',
NAMESPACE: '4chan X.',
boards: {}
};
@ -6128,7 +6128,7 @@ Post = (function() {
_Class.prototype.isClone = true;
function _Class(origin, context, contractThumb) {
var base, fileRoot, i, inline, inlined, j, k, key, l, len, len1, len2, len3, node, nodes, ref, ref1, ref2, ref3, ref4, root, val;
var base, fileRoot, i, inline, inlined, j, k, key, l, len, len1, len2, len3, node, nodes, ref, ref1, ref2, ref3, ref4, ref5, root, val;
this.origin = origin;
this.context = context;
ref = ['ID', 'fullID', 'board', 'thread', 'info', 'quotes', 'isReply'];
@ -6178,7 +6178,7 @@ Post = (function() {
this.file.text = fileRoot.firstElementChild;
this.file.link = $('.fileText > a, .fileText-original', fileRoot);
this.file.thumb = $('a.fileThumb > [data-md5]', fileRoot);
this.file.thumbLink = this.file.thumb.parentNode;
this.file.thumbLink = (ref5 = this.file.thumb) != null ? ref5.parentNode : void 0;
this.file.fullImage = $('.full-image', fileRoot);
this.file.videoControls = $('.video-controls', this.file.text);
if (this.file.videoThumb) {

Binary file not shown.

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
// @version 1.13.0.8
// @version 1.13.0.9
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
// @version 1.13.0.8
// @version 1.13.0.9
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -136,7 +136,7 @@ docSet = function() {
};
g = {
VERSION: '1.13.0.8',
VERSION: '1.13.0.9',
NAMESPACE: '4chan X.',
boards: {}
};
@ -6128,7 +6128,7 @@ Post = (function() {
_Class.prototype.isClone = true;
function _Class(origin, context, contractThumb) {
var base, fileRoot, i, inline, inlined, j, k, key, l, len, len1, len2, len3, node, nodes, ref, ref1, ref2, ref3, ref4, root, val;
var base, fileRoot, i, inline, inlined, j, k, key, l, len, len1, len2, len3, node, nodes, ref, ref1, ref2, ref3, ref4, ref5, root, val;
this.origin = origin;
this.context = context;
ref = ['ID', 'fullID', 'board', 'thread', 'info', 'quotes', 'isReply'];
@ -6178,7 +6178,7 @@ Post = (function() {
this.file.text = fileRoot.firstElementChild;
this.file.link = $('.fileText > a, .fileText-original', fileRoot);
this.file.thumb = $('a.fileThumb > [data-md5]', fileRoot);
this.file.thumbLink = this.file.thumb.parentNode;
this.file.thumbLink = (ref5 = this.file.thumb) != null ? ref5.parentNode : void 0;
this.file.fullImage = $('.full-image', fileRoot);
this.file.videoControls = $('.video-controls', this.file.text);
if (this.file.videoThumb) {

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.13.0.8' />
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X-beta.crx' version='1.13.0.9' />
</app>
</gupdate>

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.13.0.8' />
<updatecheck codebase='https://www.4chan-x.net/builds/4chan-X.crx' version='1.13.0.9' />
</app>
</gupdate>

View File

@ -83,8 +83,6 @@ Build =
html = html
.replace(/<br\b[^<]*>/gi, '\n')
.replace(/\n\n<span\b[^<]* class="abbr"[^]*$/i, '') # EXIF data (/p/)
.replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '') # Rolls (/tg/)
.replace(/<span\b[^<]* class="fortune"[^]*$/i, '') # Fortunes (/s4s/)
.replace(/<[^>]*>/g, '')
Build.unescape html
@ -93,6 +91,9 @@ Build =
unless Conf['Remove Spoilers'] or Conf['Reveal Spoilers']
while (html2 = html.replace /<s>(?:(?!<\/?s>).)*<\/s>/g, '[spoiler]') isnt html
html = html2
html = html
.replace(/^<b\b[^<]*>Rolled [^<]*<\/b>/i, '') # Rolls (/tg/, /qst/)
.replace(/<span\b[^<]* class="fortune"[^]*$/i, '') # Fortunes (/s4s/)
# Remove preceding and following new lines, trailing spaces.
Build.parseComment(html).trim().replace(/\s+$/gm, '')

View File

@ -3,9 +3,9 @@ Get =
{OP} = thread
excerpt = ("/#{thread.board}/ - ") + (
OP.info.subject?.trim() or
OP.info.commentDisplay.replace(/\n+/g, ' // ') or
OP.commentDisplay().replace(/\n+/g, ' // ') or
OP.file?.name or
OP.info.nameBlock)
"No.#{OP}")
return "#{excerpt[...70]}..." if excerpt.length > 73
excerpt
threadFromRoot: (root) ->

View File

@ -10,7 +10,7 @@ IDColor =
cb: @node
node: ->
return if @isClone or !((uid = @info.uniqueID) and (span = $ 'span.hand', @nodes.uniqueID))
return if @isClone or !((uid = @info.uniqueID) and (span = @nodes.uniqueID))
rgb = IDColor.ids[uid] or IDColor.compute uid

View File

@ -9,8 +9,8 @@ IDHighlight =
uniqueID: null
node: ->
$.on @nodes.uniqueID, 'click', IDHighlight.click @ if @nodes.uniqueID
$.on @nodes.capcode, 'click', IDHighlight.click @ if @nodes.capcode
$.on @nodes.uniqueIDRoot, 'click', IDHighlight.click @ if @nodes.uniqueIDRoot
$.on @nodes.capcode, 'click', IDHighlight.click @ if @nodes.capcode
IDHighlight.set @ unless @isClone
set: (post) ->

View File

@ -10,7 +10,7 @@ IDPostCount =
node: ->
if @nodes.uniqueID and @thread is IDPostCount.thread
$.on $('span.hand', @nodes.uniqueID), 'mouseover', IDPostCount.count
$.on @nodes.uniqueID, 'mouseover', IDPostCount.count
count: ->
{uniqueID} = Get.postFromNode(@).info

View File

@ -132,7 +132,7 @@ Unread =
openNotification: (post) ->
return unless Header.areNotificationsEnabled
notif = new Notification "#{post.info.nameBlock} replied to you",
body: post.info.commentDisplay
body: post.commentDisplay()
icon: Favicon.logo
notif.onclick = ->
Header.scrollToIfNeeded post.nodes.root, true

View File

@ -48,7 +48,7 @@ Post.Clone = class extends Post
@file.text = fileRoot.firstElementChild
@file.link = $ '.fileText > a, .fileText-original', fileRoot
@file.thumb = $ 'a.fileThumb > [data-md5]', fileRoot
@file.thumbLink = @file.thumb.parentNode
@file.thumbLink = @file.thumb?.parentNode
@file.fullImage = $ '.full-image', fileRoot
@file.videoControls = $ '.video-controls', @file.text

View File

@ -24,17 +24,23 @@ class Post
@thread.kill() if @thread.isArchived
@info =
nameBlock: if Conf['Anonymize'] then 'Anonymous' else @nodes.nameBlock.textContent.trim()
subject: @nodes.subject?.textContent or undefined
name: @nodes.name?.textContent
tripcode: @nodes.tripcode?.textContent
uniqueID: @nodes.uniqueID?.firstElementChild.textContent
uniqueID: @nodes.uniqueID?.textContent
capcode: @nodes.capcode?.textContent.replace '## ', ''
pass: @nodes.pass?.title.match(/\d*$/)[0]
flagCode: @nodes.flag?.className.match(/flag-(\w+)/)?[1].toUpperCase()
flag: @nodes.flag?.title
date: if @nodes.date then new Date(@nodes.date.dataset.utc * 1000)
if Conf['Anonymize']
@info.nameBlock = 'Anonymous'
else
@info.nameBlock = "#{@info.name or ''} #{@info.tripcode or ''}".trim()
@info.nameBlock += " ## #{@info.capcode}" if @info.capcode
@info.nameBlock += " (ID: #{@info.uniqueID})" if @info.uniqueID
@parseComment()
@parseQuotes()
@parseFile()
@ -59,25 +65,25 @@ class Post
post = $ '.post', root
info = $ '.postInfo', post
nodes =
root: root
post: post
info: info
subject: $ '.subject', info
name: $ '.name', info
email: $ '.useremail', info
tripcode: $ '.postertrip', info
uniqueID: $ '.posteruid', info
capcode: $ '.capcode.hand', info
pass: $ '.n-pu', info
flag: $ '.flag, .countryFlag', info
date: $ '.dateTime', info
nameBlock: $ '.nameBlock', info
quote: $ '.postNum > a:nth-of-type(2)', info
reply: $ '.replylink', info
fileRoot: $ '.file', post
comment: $ '.postMessage', post
links: []
quotelinks: []
root: root
post: post
info: info
subject: $ '.subject', info
name: $ '.name', info
email: $ '.useremail', info
tripcode: $ '.postertrip', info
uniqueIDRoot: $ '.posteruid', info
uniqueID: $ '.posteruid > .hand', info
capcode: $ '.capcode.hand', info
pass: $ '.n-pu', info
flag: $ '.flag, .countryFlag', info
date: $ '.dateTime', info
nameBlock: $ '.nameBlock', info
quote: $ '.postNum > a:nth-of-type(2)', info
reply: $ '.replylink', info
fileRoot: $ '.file', post
comment: $ '.postMessage', post
quotelinks: []
archivelinks: []
# XXX Edge invalidates HTMLCollections when an ancestor node is inserted into another node.
@ -101,29 +107,22 @@ class Post
# Remove:
# 'Comment too long'...
# EXIF data. (/p/)
# Rolls. (/tg/)
# Fortunes. (/s4s/)
bq = @nodes.comment.cloneNode true
for node in $$ '.abbr + br, .exif, b, .fortune', bq
$.rm node
if abbr = $ '.abbr', bq
$.rm abbr
@nodes.commentClean = bq = @nodes.comment.cloneNode true
@cleanComment bq
@info.comment = @nodesToText bq
if abbr
@info.comment = @info.comment.replace /\n\n$/, ''
# Hide spoilers.
# Remove:
commentDisplay: ->
# Get the comment's text for display purposes (e.g. notifications, excerpts).
# In addition to what's done in generating `@info.comment`, remove:
# Spoilers. (filter to '[spoiler]')
# Rolls. (/tg/, /qst/)
# Fortunes. (/s4s/)
# Preceding and following new lines.
# Trailing spaces.
commentDisplay = @info.comment
unless Conf['Remove Spoilers'] or Conf['Reveal Spoilers']
spoilers = $$ 's', bq
if spoilers.length
for node in spoilers
$.replace node, $.tn '[spoiler]'
commentDisplay = @nodesToText bq
@info.commentDisplay = commentDisplay.trim().replace /\s+$/gm, ''
bq = @nodes.commentClean.cloneNode true
@cleanSpoilers bq unless Conf['Remove Spoilers'] or Conf['Reveal Spoilers']
@cleanCommentDisplay bq
@nodesToText(bq).trim().replace(/\s+$/gm, '')
nodesToText: (bq) ->
text = ""
@ -133,6 +132,24 @@ class Post
text += node.data or '\n'
text
cleanComment: (bq) ->
if (abbr = $ '.abbr', bq) # 'Comment too long' or 'EXIF data available'
for node in $$ '.abbr + br, .exif', bq
$.rm node
for i in [0...2]
$.rm br if (br = abbr.previousSibling) and br.nodeName is 'BR'
$.rm abbr
cleanSpoilers: (bq) ->
spoilers = $$ 's', bq
for node in spoilers
$.replace node, $.tn '[spoiler]'
return
cleanCommentDisplay: (bq) ->
$.rm b if (b = $ 'b', bq) and /^Rolled /.test(b.textContent)
$.rm $('.fortune', bq)
parseQuotes: ->
@quotes = []
# XXX https://github.com/4chan/4chan-JS/issues/77

View File

@ -1,4 +1,4 @@
{
"version": "1.13.0.8",
"date": "2016-10-08T19:18:35.432Z"
"version": "1.13.0.9",
"date": "2016-10-09T10:48:46.406Z"
}