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:
commit
d45f737603
@ -7400,7 +7400,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
secondNode: function() {
|
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'])) {
|
if (!(this.isReply || Conf['OP Backlinks'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7416,10 +7416,9 @@
|
|||||||
this.nodes.backlinkContainer = container = $.el('span', {
|
this.nodes.backlinkContainer = container = $.el('span', {
|
||||||
className: 'backlink-container'
|
className: 'backlink-container'
|
||||||
});
|
});
|
||||||
if (this.fullID in QuoteBacklink.map) {
|
if (map = QuoteBacklink.map[this.fullID]) {
|
||||||
_ref1 = QuoteBacklink.map[this.fullID];
|
for (_j = 0, _len1 = map.length; _j < _len1; _j++) {
|
||||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
quoteID = map[_j];
|
||||||
quoteID = _ref1[_j];
|
|
||||||
if (post = g.posts[quoteID]) {
|
if (post = g.posts[quoteID]) {
|
||||||
$.add(container, QuoteBacklink.buildBacklink(this, post));
|
$.add(container, QuoteBacklink.buildBacklink(this, post));
|
||||||
}
|
}
|
||||||
@ -8111,10 +8110,6 @@
|
|||||||
if (Conf['Comment Expansion']) {
|
if (Conf['Comment Expansion']) {
|
||||||
ExpandComment.callbacks.push(this.node);
|
ExpandComment.callbacks.push(this.node);
|
||||||
}
|
}
|
||||||
if (Conf['Link Title']) {
|
|
||||||
$.sync('CachedTitles', Linkify.titleSync);
|
|
||||||
this.clean();
|
|
||||||
}
|
|
||||||
return Post.callbacks.push({
|
return Post.callbacks.push({
|
||||||
name: 'Linkify',
|
name: 'Linkify',
|
||||||
cb: this.node
|
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: {
|
cb: {
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
var string, _ref;
|
var string, _ref;
|
||||||
@ -16523,7 +16502,7 @@
|
|||||||
if ('f' === boardID || 'f' === g.BOARD.ID) {
|
if ('f' === boardID || 'f' === g.BOARD.ID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e) {
|
if (e != null) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
if (Index.isSearching) {
|
if (Index.isSearching) {
|
||||||
@ -17958,9 +17937,8 @@
|
|||||||
}
|
}
|
||||||
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
|
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
|
||||||
Main.initThread();
|
Main.initThread();
|
||||||
} else {
|
|
||||||
$.event('4chanXInitFinished');
|
|
||||||
}
|
}
|
||||||
|
$.event('4chanXInitFinished');
|
||||||
test = $.el('span');
|
test = $.el('span');
|
||||||
test.classList.add('a', 'b');
|
test.classList.add('a', 'b');
|
||||||
if (test.className !== 'a b') {
|
if (test.className !== 'a b') {
|
||||||
@ -18015,7 +17993,6 @@
|
|||||||
}
|
}
|
||||||
Thread.callbacks.execute(threads);
|
Thread.callbacks.execute(threads);
|
||||||
Post.callbacks.execute(posts);
|
Post.callbacks.execute(posts);
|
||||||
$.event('4chanXInitFinished');
|
|
||||||
}
|
}
|
||||||
return $.get('previousversion', null, function(_arg) {
|
return $.get('previousversion', null, function(_arg) {
|
||||||
var changelog, el, previousversion;
|
var changelog, el, previousversion;
|
||||||
|
|||||||
@ -7451,7 +7451,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
secondNode: function() {
|
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'])) {
|
if (!(this.isReply || Conf['OP Backlinks'])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -7467,10 +7467,9 @@
|
|||||||
this.nodes.backlinkContainer = container = $.el('span', {
|
this.nodes.backlinkContainer = container = $.el('span', {
|
||||||
className: 'backlink-container'
|
className: 'backlink-container'
|
||||||
});
|
});
|
||||||
if (this.fullID in QuoteBacklink.map) {
|
if (map = QuoteBacklink.map[this.fullID]) {
|
||||||
_ref1 = QuoteBacklink.map[this.fullID];
|
for (_j = 0, _len1 = map.length; _j < _len1; _j++) {
|
||||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
quoteID = map[_j];
|
||||||
quoteID = _ref1[_j];
|
|
||||||
if (post = g.posts[quoteID]) {
|
if (post = g.posts[quoteID]) {
|
||||||
$.add(container, QuoteBacklink.buildBacklink(this, post));
|
$.add(container, QuoteBacklink.buildBacklink(this, post));
|
||||||
}
|
}
|
||||||
@ -8162,10 +8161,6 @@
|
|||||||
if (Conf['Comment Expansion']) {
|
if (Conf['Comment Expansion']) {
|
||||||
ExpandComment.callbacks.push(this.node);
|
ExpandComment.callbacks.push(this.node);
|
||||||
}
|
}
|
||||||
if (Conf['Link Title']) {
|
|
||||||
$.sync('CachedTitles', Linkify.titleSync);
|
|
||||||
this.clean();
|
|
||||||
}
|
|
||||||
return Post.callbacks.push({
|
return Post.callbacks.push({
|
||||||
name: 'Linkify',
|
name: 'Linkify',
|
||||||
cb: this.node
|
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: {
|
cb: {
|
||||||
toggle: function() {
|
toggle: function() {
|
||||||
var string, _ref;
|
var string, _ref;
|
||||||
@ -16547,7 +16526,7 @@
|
|||||||
if ('f' === boardID || 'f' === g.BOARD.ID) {
|
if ('f' === boardID || 'f' === g.BOARD.ID) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e) {
|
if (e != null) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
if (Index.isSearching) {
|
if (Index.isSearching) {
|
||||||
@ -17974,9 +17953,8 @@
|
|||||||
}
|
}
|
||||||
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
|
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
|
||||||
Main.initThread();
|
Main.initThread();
|
||||||
} else {
|
|
||||||
$.event('4chanXInitFinished');
|
|
||||||
}
|
}
|
||||||
|
$.event('4chanXInitFinished');
|
||||||
try {
|
try {
|
||||||
return localStorage.getItem('4chan-settings');
|
return localStorage.getItem('4chan-settings');
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
@ -18016,7 +17994,6 @@
|
|||||||
}
|
}
|
||||||
Thread.callbacks.execute(threads);
|
Thread.callbacks.execute(threads);
|
||||||
Post.callbacks.execute(posts);
|
Post.callbacks.execute(posts);
|
||||||
$.event('4chanXInitFinished');
|
|
||||||
}
|
}
|
||||||
return $.get('previousversion', null, function(_arg) {
|
return $.get('previousversion', null, function(_arg) {
|
||||||
var changelog, el, previousversion;
|
var changelog, el, previousversion;
|
||||||
|
|||||||
@ -197,9 +197,9 @@ Main =
|
|||||||
|
|
||||||
# Parse HTML or skip it and start building from JSON.
|
# Parse HTML or skip it and start building from JSON.
|
||||||
if !Conf['JSON Navigation'] or g.VIEW is 'thread'
|
if !Conf['JSON Navigation'] or g.VIEW is 'thread'
|
||||||
Main.initThread()
|
Main.initThread()
|
||||||
else
|
|
||||||
$.event '4chanXInitFinished'
|
$.event '4chanXInitFinished'
|
||||||
|
|
||||||
<% if (type === 'userscript') { %>
|
<% if (type === 'userscript') { %>
|
||||||
test = $.el 'span'
|
test = $.el 'span'
|
||||||
@ -242,8 +242,6 @@ Main =
|
|||||||
Thread.callbacks.execute threads
|
Thread.callbacks.execute threads
|
||||||
Post.callbacks.execute posts
|
Post.callbacks.execute posts
|
||||||
|
|
||||||
$.event '4chanXInitFinished'
|
|
||||||
|
|
||||||
$.get 'previousversion', null, ({previousversion}) ->
|
$.get 'previousversion', null, ({previousversion}) ->
|
||||||
return if previousversion is g.VERSION
|
return if previousversion is g.VERSION
|
||||||
if previousversion
|
if previousversion
|
||||||
|
|||||||
@ -190,7 +190,7 @@ Navigate =
|
|||||||
|
|
||||||
navigate: (e) ->
|
navigate: (e) ->
|
||||||
return if @hostname isnt 'boards.4chan.org' or window.location.hostname is 'rs.4chan.org'
|
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
|
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
|
Navigate.setMode @ unless e?.button is 2 # Right Click
|
||||||
return
|
return
|
||||||
@ -212,7 +212,7 @@ Navigate =
|
|||||||
[_, boardID, view, threadID] = @pathname.split '/'
|
[_, boardID, view, threadID] = @pathname.split '/'
|
||||||
|
|
||||||
return if 'f' in [boardID, g.BOARD.ID]
|
return if 'f' in [boardID, g.BOARD.ID]
|
||||||
e.preventDefault() if e
|
e?.preventDefault()
|
||||||
Index.clearSearch() if Index.isSearching
|
Index.clearSearch() if Index.isSearching
|
||||||
Navigate.title = -> return
|
Navigate.title = -> return
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ Navigate =
|
|||||||
|
|
||||||
history.pushState 'internal', '', path unless @id is 'popState'
|
history.pushState 'internal', '', path unless @id is 'popState'
|
||||||
Navigate.path = @pathname
|
Navigate.path = @pathname
|
||||||
|
|
||||||
Navigate.setMode @
|
Navigate.setMode @
|
||||||
|
|
||||||
unless view is 'index' and 'index' is g.VIEW and boardID is g.BOARD.ID
|
unless view is 'index' and 'index' is g.VIEW and boardID is g.BOARD.ID
|
||||||
|
|||||||
@ -5,10 +5,6 @@ Linkify =
|
|||||||
if Conf['Comment Expansion']
|
if Conf['Comment Expansion']
|
||||||
ExpandComment.callbacks.push @node
|
ExpandComment.callbacks.push @node
|
||||||
|
|
||||||
if Conf['Link Title']
|
|
||||||
$.sync 'CachedTitles', Linkify.titleSync
|
|
||||||
@clean()
|
|
||||||
|
|
||||||
Post.callbacks.push
|
Post.callbacks.push
|
||||||
name: 'Linkify'
|
name: 'Linkify'
|
||||||
cb: @node
|
cb: @node
|
||||||
@ -185,13 +181,6 @@ Linkify =
|
|||||||
link.innerHTML = "[#{key}] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>"
|
link.innerHTML = "[#{key}] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>"
|
||||||
return
|
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:
|
cb:
|
||||||
toggle: ->
|
toggle: ->
|
||||||
[string, @textContent] = if $.hasClass @, "embedded"
|
[string, @textContent] = if $.hasClass @, "embedded"
|
||||||
|
|||||||
@ -47,10 +47,9 @@ QuoteBacklink =
|
|||||||
return
|
return
|
||||||
@nodes.backlinkContainer = container = $.el 'span',
|
@nodes.backlinkContainer = container = $.el 'span',
|
||||||
className: 'backlink-container'
|
className: 'backlink-container'
|
||||||
if @fullID of QuoteBacklink.map
|
if map = QuoteBacklink.map[@fullID]
|
||||||
for quoteID in QuoteBacklink.map[@fullID]
|
for quoteID in map when post = g.posts[quoteID] # Post hasn't been collected since.
|
||||||
if post = g.posts[quoteID] # Post hasn't been collected since.
|
$.add container, QuoteBacklink.buildBacklink @, post
|
||||||
$.add container, QuoteBacklink.buildBacklink @, post
|
|
||||||
$.add @nodes.info, container
|
$.add @nodes.info, container
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user