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

Conflicts:
	json/archives.json
	src/General/Main.coffee
This commit is contained in:
Zixaphir 2013-07-24 21:55:26 -07:00
commit 0ac6747810
5 changed files with 59 additions and 101 deletions

View File

@ -984,33 +984,30 @@
};
Post.prototype.parseQuotes = function() {
var hash, pathname, quotelink, quotes, _i, _len, _ref;
var quotelink, _i, _len, _ref;
quotes = {};
this.quotes = [];
_ref = $$('.quotelink', this.nodes.comment);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i];
hash = quotelink.hash;
if (!hash) {
continue;
}
pathname = quotelink.pathname;
if (/catalog$/.test(pathname)) {
continue;
}
if (quotelink.hostname !== 'boards.4chan.org') {
continue;
}
this.nodes.quotelinks.push(quotelink);
if (!this.isReply && $.hasClass(quotelink.parentNode.parentNode, 'capcodeReplies')) {
continue;
}
quotes["" + (pathname.split('/')[1]) + "." + hash.slice(2)] = true;
this.parseQuote(quotelink);
}
if (this.isClone) {
};
Post.prototype.parseQuote = function(quotelink) {
var fullID, match;
if (!(match = quotelink.href.match(/boards\.4chan\.org\/([^\/]+)\/res\/\d+#p(\d+)$/))) {
return;
}
return this.quotes = Object.keys(quotes);
this.nodes.quotelinks.push(quotelink);
if (this.isClone || !this.isReply && $.hasClass(quotelink.parentNode.parentNode, 'capcodeReplies')) {
return;
}
fullID = "" + match[1] + "." + match[2];
if (this.quotes.indexOf(fullID) === -1) {
return this.quotes.push(fullID);
}
};
Post.prototype.parseFile = function(that) {

View File

@ -990,33 +990,30 @@
};
Post.prototype.parseQuotes = function() {
var hash, pathname, quotelink, quotes, _i, _len, _ref;
var quotelink, _i, _len, _ref;
quotes = {};
this.quotes = [];
_ref = $$('.quotelink', this.nodes.comment);
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
quotelink = _ref[_i];
hash = quotelink.hash;
if (!hash) {
continue;
}
pathname = quotelink.pathname;
if (/catalog$/.test(pathname)) {
continue;
}
if (quotelink.hostname !== 'boards.4chan.org') {
continue;
}
this.nodes.quotelinks.push(quotelink);
if (!this.isReply && $.hasClass(quotelink.parentNode.parentNode, 'capcodeReplies')) {
continue;
}
quotes["" + (pathname.split('/')[1]) + "." + hash.slice(2)] = true;
this.parseQuote(quotelink);
}
if (this.isClone) {
};
Post.prototype.parseQuote = function(quotelink) {
var fullID, match;
if (!(match = quotelink.href.match(/boards\.4chan\.org\/([^\/]+)\/res\/\d+#p(\d+)$/))) {
return;
}
return this.quotes = Object.keys(quotes);
this.nodes.quotelinks.push(quotelink);
if (this.isClone || !this.isReply && $.hasClass(quotelink.parentNode.parentNode, 'capcodeReplies')) {
return;
}
fullID = "" + match[1] + "." + match[2];
if (this.quotes.indexOf(fullID) === -1) {
return this.quotes.push(fullID);
}
};
Post.prototype.parseFile = function(that) {

View File

@ -1,3 +0,0 @@
<div class="move" title="Post count / File count / Page count">
<span id="post-count">...</span> / <span id="file-count">...</span> / <span id="page-count">...</span>
</div>

View File

@ -1,38 +0,0 @@
<div>
<input type="checkbox" id="autohide" title="Auto-hide">
<select data-name="thread" title="Create a new thread / Reply">
<option value="new">New thread</option>
</select>
<span class="move"></span>
<a href="javascript:;" class="close" title="Close">×</a>
</div>
<form>
<div class="persona">
<input type="button" id="dump-button" title="Dump list" value="+">
<input data-name="name" list="list-name" placeholder="Name" class="field" size="1">
<input data-name="email" list="list-email" placeholder="E-mail" class="field" size="1">
<input data-name="sub" list="list-sub" placeholder="Subject" class="field" size="1">
</div>
<div id="dump-list-container">
<div id="dump-list"></div>
<a id="add-post" href="javascript:;" title="Add a post">+</a>
</div>
<div class="textarea">
<textarea data-name="com" placeholder="Comment" class="field"></textarea>
<span id="char-count"></span>
</div>
<div id="file-n-submit">
<input type="submit">
<input type="button" id="qr-file-button" value="Choose files">
<span id="qr-filename-container">
<span id="qr-no-file">No selected file</span>
<span id="qr-filename"></span>
</span>
<a id="qr-filerm" href="javascript:;" title="Remove file">×</a>
<input type="checkbox" id="qr-file-spoiler" title="Spoiler image">
</div>
<input type="file" multiple hidden>
</form>
<datalist id="list-name"></datalist>
<datalist id="list-email"></datalist>
<datalist id="list-sub"></datalist>

View File

@ -83,29 +83,34 @@ class Post
@info.comment = text.join('').trim().replace /\s+$/gm, ''
parseQuotes: ->
quotes = {}
@quotes = []
for quotelink in $$ '.quotelink', @nodes.comment
# Don't add board links. (>>>/b/)
{hash} = quotelink
continue unless hash
@parseQuote quotelink
return
parseQuote: (quotelink) ->
# Only add quotes that link to posts on an imageboard.
# Don't add:
# - board links. (>>>/b/)
# - catalog links. (>>>/b/catalog or >>>/b/search)
# - rules links. (>>>/a/rules)
# - text-board quotelinks. (>>>/img/1234)
return unless match = quotelink.href.match ///
boards\.4chan\.org/
([^/]+) # boardID
/res/\d+#p
(\d+) # postID
$
///
# Don't add catalog links. (>>>/b/catalog or >>>/b/search)
{pathname} = quotelink
continue if /catalog$/.test pathname
@nodes.quotelinks.push quotelink
# Don't add rules links. (>>>/a/rules)
# Don't add text-board quotelinks. (>>>/img/1234)
continue if quotelink.hostname isnt 'boards.4chan.org'
@nodes.quotelinks.push quotelink
# Don't count capcode replies as quotes in OPs. (Admin/Mod/Dev Replies: ...)
continue if !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies'
# Basically, only add quotes that link to posts on an imageboard.
quotes["#{pathname.split('/')[1]}.#{hash[2..]}"] = true
return if @isClone
@quotes = Object.keys quotes
# Don't count capcode replies as quotes in OPs. (Admin/Mod/Dev Replies: ...)
return if @isClone or !@isReply and $.hasClass quotelink.parentNode.parentNode, 'capcodeReplies'
# ES6 Set when?
fullID = "#{match[1]}.#{match[2]}"
@quotes.push fullID if @quotes.indexOf(fullID) is -1
parseFile: (that) ->
return unless (fileEl = $ '.file', @nodes.post) and thumb = $ 'img[data-md5]', fileEl