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

View File

@ -4215,10 +4215,11 @@
_ref = this.nodes.quotelinks;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i];
if (QR.db.get(Get.postDataFromLink(quotelink))) {
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
if (!(QR.db.get(Get.postDataFromLink(quotelink)))) {
continue;
}
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
}
},
cb: {
@ -4297,13 +4298,17 @@
var a, boardID, m, post, postID, quote, quoteID, redirect, _ref;
if (deadlink.parentNode.className === 'prettyprint') {
$.replace(deadlink, __slice.call(deadlink.childNodes));
Quotify.fixDeadlink(deadlink);
return;
}
quote = deadlink.textContent;
if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) {
return;
}
if (postID[0] === '0') {
Quotify.fixDeadlink(deadlink);
return;
}
boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID;
quoteID = "" + boardID + "." + postID;
if (post = g.posts[quoteID]) {
@ -4359,6 +4364,9 @@
if ($.hasClass(a, 'quotelink')) {
return this.nodes.quotelinks.push(a);
}
},
fixDeadlink: function(deadlink) {
return $.replace(deadlink, __slice.call(deadlink.childNodes));
}
};
@ -8536,7 +8544,7 @@
return;
}
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;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i];
if (QR.db.get(Get.postDataFromLink(quotelink))) {
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
if (!(QR.db.get(Get.postDataFromLink(quotelink)))) {
continue;
}
$.add(quotelink, $.tn('\u00A0(You)'));
$.addClass(this.nodes.root, 'quotesYou');
}
},
cb: {
@ -4302,13 +4303,17 @@
var a, boardID, m, post, postID, quote, quoteID, redirect, _ref;
if (deadlink.parentNode.className === 'prettyprint') {
$.replace(deadlink, __slice.call(deadlink.childNodes));
Quotify.fixDeadlink(deadlink);
return;
}
quote = deadlink.textContent;
if (!(postID = (_ref = quote.match(/\d+$/)) != null ? _ref[0] : void 0)) {
return;
}
if (postID[0] === '0') {
Quotify.fixDeadlink(deadlink);
return;
}
boardID = (m = quote.match(/^>>>\/([a-z\d]+)/)) ? m[1] : this.board.ID;
quoteID = "" + boardID + "." + postID;
if (post = g.posts[quoteID]) {
@ -4364,6 +4369,9 @@
if ($.hasClass(a, 'quotelink')) {
return this.nodes.quotelinks.push(a);
}
},
fixDeadlink: function(deadlink) {
return $.replace(deadlink, __slice.call(deadlink.childNodes));
}
};
@ -8522,7 +8530,7 @@
return;
}
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+)/
# Use the text node directly, as the <b> has two <br>.
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.
return unless @quotes.length
for quotelink in @nodes.quotelinks
if QR.db.get Get.postDataFromLink quotelink
for quotelink in @nodes.quotelinks when QR.db.get Get.postDataFromLink quotelink
$.add quotelink, $.tn '\u00A0(You)'
$.addClass @nodes.root, 'quotesYou'
return
@ -60,4 +59,4 @@ QuoteYou =
window.location = "##{post.id}"
Header.scrollToPost post
$.addClass $('.post', post), 'highlight'
return true
return true

View File

@ -24,11 +24,15 @@ Quotify =
# This won't be necessary once 4chan
# stops quotifying inside code tags:
# https://github.com/4chan/4chan-JS/issues/77
$.replace deadlink, [deadlink.childNodes...]
Quotify.fixDeadlink deadlink
return
quote = deadlink.textContent
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]+)/
m[1]
else
@ -75,3 +79,6 @@ Quotify =
$.replace deadlink, a
if $.hasClass a, 'quotelink'
@nodes.quotelinks.push a
fixDeadlink: (deadlink) ->
$.replace deadlink, [deadlink.childNodes...]