Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3

Conflicts:
	CHANGELOG.md
	Gruntfile.coffee
	package.json
	src/Quotelinks/QuoteYou.coffee
This commit is contained in:
Zixaphir 2013-08-10 14:37:45 -07:00
commit 6602bb885d
6 changed files with 37 additions and 19 deletions

View File

@ -71,9 +71,6 @@ module.exports = (grunt) ->
dest: 'builds/crx/' dest: 'builds/crx/'
expand: true expand: true
flatten: true flatten: true
nex:
src: 'builds/<%= pkg.name %>.zip'
dest: 'builds/<%= pkg.name %>.nex'
coffee: coffee:
script: script:
@ -174,7 +171,6 @@ module.exports = (grunt) ->
'shell:push' 'shell:push'
'build-crx' 'build-crx'
'compress:crx' 'compress:crx'
'copy:nex'
] ]
grunt.registerTask 'patch', [ grunt.registerTask 'patch', [
'bump' 'bump'

View File

@ -4215,10 +4215,11 @@
_ref = this.nodes.quotelinks; _ref = this.nodes.quotelinks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i]; quotelink = _ref[_i];
if (QR.db.get(Get.postDataFromLink(quotelink))) { if (!(QR.db.get(Get.postDataFromLink(quotelink)))) {
$.add(quotelink, $.tn('\u00A0(You)')); continue;
$.addClass(this.nodes.root, 'quotesYou');
} }
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
} }
}, },
cb: { cb: {
@ -4297,13 +4298,17 @@
var a, boardID, m, post, postID, quote, quoteID, redirect, _ref; var a, boardID, m, post, postID, quote, quoteID, redirect, _ref;
if (deadlink.parentNode.className === 'prettyprint') { if (deadlink.parentNode.className === 'prettyprint') {
$.replace(deadlink, __slice.call(deadlink.childNodes)); Quotify.fixDeadlink(deadlink);
return; return;
} }
quote = deadlink.textContent; quote = deadlink.textContent;
if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) { if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) {
return; return;
} }
if (postID[0] === '0') {
Quotify.fixDeadlink(deadlink);
return;
}
boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID; boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID;
quoteID = "" + boardID + "." + postID; quoteID = "" + boardID + "." + postID;
if (post = g.posts[quoteID]) { if (post = g.posts[quoteID]) {
@ -4359,6 +4364,9 @@
if ($.hasClass(a, 'quotelink')) { if ($.hasClass(a, 'quotelink')) {
return this.nodes.quotelinks.push(a); return this.nodes.quotelinks.push(a);
} }
},
fixDeadlink: function(deadlink) {
return $.replace(deadlink, __slice.call(deadlink.childNodes));
} }
}; };
@ -8536,7 +8544,7 @@
return; return;
} }
roll = $('b', this.nodes.comment).firstChild; roll = $('b', this.nodes.comment).firstChild;
return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + " and got " + (roll.data.slice(7)); return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + ": " + (roll.data.slice(7));
} }
}; };

View File

@ -4220,10 +4220,11 @@
_ref = this.nodes.quotelinks; _ref = this.nodes.quotelinks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i]; quotelink = _ref[_i];
if (QR.db.get(Get.postDataFromLink(quotelink))) { if (!(QR.db.get(Get.postDataFromLink(quotelink)))) {
$.add(quotelink, $.tn('\u00A0(You)')); continue;
$.addClass(this.nodes.root, 'quotesYou');
} }
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
} }
}, },
cb: { cb: {
@ -4302,13 +4303,17 @@
var a, boardID, m, post, postID, quote, quoteID, redirect, _ref; var a, boardID, m, post, postID, quote, quoteID, redirect, _ref;
if (deadlink.parentNode.className === 'prettyprint') { if (deadlink.parentNode.className === 'prettyprint') {
$.replace(deadlink, __slice.call(deadlink.childNodes)); Quotify.fixDeadlink(deadlink);
return; return;
} }
quote = deadlink.textContent; quote = deadlink.textContent;
if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) { if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) {
return; return;
} }
if (postID[0] === '0') {
Quotify.fixDeadlink(deadlink);
return;
}
boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID; boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID;
quoteID = "" + boardID + "." + postID; quoteID = "" + boardID + "." + postID;
if (post = g.posts[quoteID]) { if (post = g.posts[quoteID]) {
@ -4364,6 +4369,9 @@
if ($.hasClass(a, 'quotelink')) { if ($.hasClass(a, 'quotelink')) {
return this.nodes.quotelinks.push(a); return this.nodes.quotelinks.push(a);
} }
},
fixDeadlink: function(deadlink) {
return $.replace(deadlink, __slice.call(deadlink.childNodes));
} }
}; };
@ -8522,7 +8530,7 @@
return; return;
} }
roll = $('b', this.nodes.comment).firstChild; roll = $('b', this.nodes.comment).firstChild;
return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + " and got " + (roll.data.slice(7)); return roll.data = "Rolled " + dicestats[1] + "d" + dicestats[2] + ": " + (roll.data.slice(7));
} }
}; };

View File

@ -8,4 +8,4 @@ Dice =
return if @isClone or not dicestats = @info.email?.match /dice[+\s](\d+)d(\d+)/ return if @isClone or not dicestats = @info.email?.match /dice[+\s](\d+)d(\d+)/
# Use the text node directly, as the <b> has two <br>. # Use the text node directly, as the <b> has two <br>.
roll = $('b', @nodes.comment).firstChild roll = $('b', @nodes.comment).firstChild
roll.data = "Rolled #{dicestats[1]}d#{dicestats[2]} and got #{roll.data.slice 7}" roll.data = "Rolled #{dicestats[1]}d#{dicestats[2]}: #{roll.data.slice 7}"

View File

@ -25,8 +25,7 @@ QuoteYou =
# Stop there if there's no quotes in that post. # Stop there if there's no quotes in that post.
return unless @quotes.length return unless @quotes.length
for quotelink in @nodes.quotelinks for quotelink in @nodes.quotelinks when QR.db.get Get.postDataFromLink quotelink
if QR.db.get Get.postDataFromLink quotelink
$.add quotelink, $.tn '\u00A0(You)' $.add quotelink, $.tn '\u00A0(You)'
$.addClass @nodes.root, 'quotesYou' $.addClass @nodes.root, 'quotesYou'
return return

View File

@ -24,11 +24,15 @@ Quotify =
# This won't be necessary once 4chan # This won't be necessary once 4chan
# stops quotifying inside code tags: # stops quotifying inside code tags:
# https://github.com/4chan/4chan-JS/issues/77 # https://github.com/4chan/4chan-JS/issues/77
$.replace deadlink, [deadlink.childNodes...] Quotify.fixDeadlink deadlink
return return
quote = deadlink.textContent quote = deadlink.textContent
return unless postID = quote.match(/\d+$/)?[0] return unless postID = quote.match(/\d+$/)?[0]
if postID[0] is '0'
# Fix quotelinks that start with a `0`.
Quotify.fixDeadlink deadlink
return
boardID = if m = quote.match /^>>>\/([a-z\d]+)/ boardID = if m = quote.match /^>>>\/([a-z\d]+)/
m[1] m[1]
else else
@ -75,3 +79,6 @@ Quotify =
$.replace deadlink, a $.replace deadlink, a
if $.hasClass a, 'quotelink' if $.hasClass a, 'quotelink'
@nodes.quotelinks.push a @nodes.quotelinks.push a
fixDeadlink: (deadlink) ->
$.replace deadlink, [deadlink.childNodes...]