Merge branch 'v3'

Conflicts:
	LICENSE
	builds/appchan-x.user.js
	builds/crx/script.js
	src/General/Main.coffee
	src/General/Navigate.coffee
	src/Linkification/Linkify.coffee
This commit is contained in:
Zixaphir 2014-03-20 09:57:27 -07:00
commit d45f737603
6 changed files with 21 additions and 81 deletions

View File

@ -7400,7 +7400,7 @@
}
},
secondNode: function() {
var backlink, container, post, quoteID, _i, _j, _len, _len1, _ref, _ref1;
var backlink, container, map, post, quoteID, _i, _j, _len, _len1, _ref;
if (!(this.isReply || Conf['OP Backlinks'])) {
return;
}
@ -7416,10 +7416,9 @@
this.nodes.backlinkContainer = container = $.el('span', {
className: 'backlink-container'
});
if (this.fullID in QuoteBacklink.map) {
_ref1 = QuoteBacklink.map[this.fullID];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
quoteID = _ref1[_j];
if (map = QuoteBacklink.map[this.fullID]) {
for (_j = 0, _len1 = map.length; _j < _len1; _j++) {
quoteID = map[_j];
if (post = g.posts[quoteID]) {
$.add(container, QuoteBacklink.buildBacklink(this, post));
}
@ -8111,10 +8110,6 @@
if (Conf['Comment Expansion']) {
ExpandComment.callbacks.push(this.node);
}
if (Conf['Link Title']) {
$.sync('CachedTitles', Linkify.titleSync);
this.clean();
}
return Post.callbacks.push({
name: 'Linkify',
cb: this.node
@ -8317,22 +8312,6 @@
}
}
},
clean: function() {
var age, pruned, uid, _, _ref, _ref1;
pruned = false;
_ref = Conf['CachedTitles'];
for (uid in _ref) {
_ref1 = _ref[uid], _ = _ref1[0], age = _ref1[1];
if (!(age + $.DAY > Date.now())) {
continue;
}
pruned = true;
delete Conf['CachedTitles'][uid];
}
if (pruned) {
return $.set('CachedTitles', Conf['CachedTitles']);
}
},
cb: {
toggle: function() {
var string, _ref;
@ -16523,7 +16502,7 @@
if ('f' === boardID || 'f' === g.BOARD.ID) {
return;
}
if (e) {
if (e != null) {
e.preventDefault();
}
if (Index.isSearching) {
@ -17958,9 +17937,8 @@
}
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
Main.initThread();
} else {
$.event('4chanXInitFinished');
}
$.event('4chanXInitFinished');
test = $.el('span');
test.classList.add('a', 'b');
if (test.className !== 'a b') {
@ -18015,7 +17993,6 @@
}
Thread.callbacks.execute(threads);
Post.callbacks.execute(posts);
$.event('4chanXInitFinished');
}
return $.get('previousversion', null, function(_arg) {
var changelog, el, previousversion;

View File

@ -7451,7 +7451,7 @@
}
},
secondNode: function() {
var backlink, container, post, quoteID, _i, _j, _len, _len1, _ref, _ref1;
var backlink, container, map, post, quoteID, _i, _j, _len, _len1, _ref;
if (!(this.isReply || Conf['OP Backlinks'])) {
return;
}
@ -7467,10 +7467,9 @@
this.nodes.backlinkContainer = container = $.el('span', {
className: 'backlink-container'
});
if (this.fullID in QuoteBacklink.map) {
_ref1 = QuoteBacklink.map[this.fullID];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
quoteID = _ref1[_j];
if (map = QuoteBacklink.map[this.fullID]) {
for (_j = 0, _len1 = map.length; _j < _len1; _j++) {
quoteID = map[_j];
if (post = g.posts[quoteID]) {
$.add(container, QuoteBacklink.buildBacklink(this, post));
}
@ -8162,10 +8161,6 @@
if (Conf['Comment Expansion']) {
ExpandComment.callbacks.push(this.node);
}
if (Conf['Link Title']) {
$.sync('CachedTitles', Linkify.titleSync);
this.clean();
}
return Post.callbacks.push({
name: 'Linkify',
cb: this.node
@ -8368,22 +8363,6 @@
}
}
},
clean: function() {
var age, pruned, uid, _, _ref, _ref1;
pruned = false;
_ref = Conf['CachedTitles'];
for (uid in _ref) {
_ref1 = _ref[uid], _ = _ref1[0], age = _ref1[1];
if (!(age + $.DAY > Date.now())) {
continue;
}
pruned = true;
delete Conf['CachedTitles'][uid];
}
if (pruned) {
return $.set('CachedTitles', Conf['CachedTitles']);
}
},
cb: {
toggle: function() {
var string, _ref;
@ -16547,7 +16526,7 @@
if ('f' === boardID || 'f' === g.BOARD.ID) {
return;
}
if (e) {
if (e != null) {
e.preventDefault();
}
if (Index.isSearching) {
@ -17974,9 +17953,8 @@
}
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
Main.initThread();
} else {
$.event('4chanXInitFinished');
}
$.event('4chanXInitFinished');
try {
return localStorage.getItem('4chan-settings');
} catch (_error) {
@ -18016,7 +17994,6 @@
}
Thread.callbacks.execute(threads);
Post.callbacks.execute(posts);
$.event('4chanXInitFinished');
}
return $.get('previousversion', null, function(_arg) {
var changelog, el, previousversion;

View File

@ -197,9 +197,9 @@ Main =
# Parse HTML or skip it and start building from JSON.
if !Conf['JSON Navigation'] or g.VIEW is 'thread'
Main.initThread()
else
$.event '4chanXInitFinished'
Main.initThread()
$.event '4chanXInitFinished'
<% if (type === 'userscript') { %>
test = $.el 'span'
@ -242,8 +242,6 @@ Main =
Thread.callbacks.execute threads
Post.callbacks.execute posts
$.event '4chanXInitFinished'
$.get 'previousversion', null, ({previousversion}) ->
return if previousversion is g.VERSION
if previousversion

View File

@ -190,7 +190,7 @@ Navigate =
navigate: (e) ->
return if @hostname isnt 'boards.4chan.org' or window.location.hostname is 'rs.4chan.org'
if e
if e
if e.shiftKey or e.ctrlKey or (e.type is 'click' and e.button isnt 0) # Not simply a left click
Navigate.setMode @ unless e?.button is 2 # Right Click
return
@ -212,7 +212,7 @@ Navigate =
[_, boardID, view, threadID] = @pathname.split '/'
return if 'f' in [boardID, g.BOARD.ID]
e.preventDefault() if e
e?.preventDefault()
Index.clearSearch() if Index.isSearching
Navigate.title = -> return
@ -232,7 +232,7 @@ Navigate =
history.pushState 'internal', '', path unless @id is 'popState'
Navigate.path = @pathname
Navigate.setMode @
unless view is 'index' and 'index' is g.VIEW and boardID is g.BOARD.ID

View File

@ -5,10 +5,6 @@ Linkify =
if Conf['Comment Expansion']
ExpandComment.callbacks.push @node
if Conf['Link Title']
$.sync 'CachedTitles', Linkify.titleSync
@clean()
Post.callbacks.push
name: 'Linkify'
cb: @node
@ -185,13 +181,6 @@ Linkify =
link.innerHTML = "[#{key}] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>"
return
clean: ->
pruned = false
for uid, [_, age] of Conf['CachedTitles'] when age + $.DAY > Date.now()
pruned = true
delete Conf['CachedTitles'][uid]
$.set 'CachedTitles', Conf['CachedTitles'] if pruned
cb:
toggle: ->
[string, @textContent] = if $.hasClass @, "embedded"

View File

@ -47,10 +47,9 @@ QuoteBacklink =
return
@nodes.backlinkContainer = container = $.el 'span',
className: 'backlink-container'
if @fullID of QuoteBacklink.map
for quoteID in QuoteBacklink.map[@fullID]
if post = g.posts[quoteID] # Post hasn't been collected since.
$.add container, QuoteBacklink.buildBacklink @, post
if map = QuoteBacklink.map[@fullID]
for quoteID in map when post = g.posts[quoteID] # Post hasn't been collected since.
$.add container, QuoteBacklink.buildBacklink @, post
$.add @nodes.info, container