get thread expansion working
This commit is contained in:
parent
d3397a952c
commit
aedaac2b24
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.7.1 - 2014-04-06
|
||||
* 4chan X - Version 1.7.1 - 2014-04-07
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
// ==/UserScript==
|
||||
|
||||
/*
|
||||
* 4chan X - Version 1.7.1 - 2014-04-06
|
||||
* 4chan X - Version 1.7.1 - 2014-04-07
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
@ -10996,14 +10996,24 @@
|
||||
if (g.VIEW === 'thread' || !Conf['Thread Expansion']) {
|
||||
return;
|
||||
}
|
||||
return $.on(d, 'IndexRefresh', this.onIndexRefresh);
|
||||
if (Conf['JSON Navigation']) {
|
||||
return $.on(d, 'IndexRefresh', this.onIndexRefresh);
|
||||
} else {
|
||||
return Thread.callbacks.push({
|
||||
name: 'Expand Thread',
|
||||
cb: function() {
|
||||
return ExpandThread.setButton(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
setButton: function(thread) {
|
||||
var a;
|
||||
if (!(a = $.x('following-sibling::a[contains(@class,"summary")][1]', thread.OP.nodes.root))) {
|
||||
if (!(a = $.x('following-sibling::*[contains(@class,"summary")][1]', thread.OP.nodes.root))) {
|
||||
return;
|
||||
}
|
||||
a.textContent = ExpandThread.text.apply(ExpandThread, ['+'].concat(__slice.call(a.textContent.match(/\d+/g))));
|
||||
a.style.cursor = 'pointer';
|
||||
return $.on(a, 'click', ExpandThread.cbToggle);
|
||||
},
|
||||
disconnect: function(refresh) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// Generated by CoffeeScript
|
||||
/*
|
||||
* 4chan X - Version 1.7.1 - 2014-04-06
|
||||
* 4chan X - Version 1.7.1 - 2014-04-07
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||
@ -10999,14 +10999,24 @@
|
||||
if (g.VIEW === 'thread' || !Conf['Thread Expansion']) {
|
||||
return;
|
||||
}
|
||||
return $.on(d, 'IndexRefresh', this.onIndexRefresh);
|
||||
if (Conf['JSON Navigation']) {
|
||||
return $.on(d, 'IndexRefresh', this.onIndexRefresh);
|
||||
} else {
|
||||
return Thread.callbacks.push({
|
||||
name: 'Expand Thread',
|
||||
cb: function() {
|
||||
return ExpandThread.setButton(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
setButton: function(thread) {
|
||||
var a;
|
||||
if (!(a = $.x('following-sibling::a[contains(@class,"summary")][1]', thread.OP.nodes.root))) {
|
||||
if (!(a = $.x('following-sibling::*[contains(@class,"summary")][1]', thread.OP.nodes.root))) {
|
||||
return;
|
||||
}
|
||||
a.textContent = ExpandThread.text.apply(ExpandThread, ['+'].concat(__slice.call(a.textContent.match(/\d+/g))));
|
||||
a.style.cursor = 'pointer';
|
||||
return $.on(a, 'click', ExpandThread.cbToggle);
|
||||
},
|
||||
disconnect: function(refresh) {
|
||||
|
||||
@ -2,11 +2,17 @@ ExpandThread =
|
||||
statuses: {}
|
||||
init: ->
|
||||
return if g.VIEW is 'thread' or !Conf['Thread Expansion']
|
||||
$.on d, 'IndexRefresh', @onIndexRefresh
|
||||
if Conf['JSON Navigation']
|
||||
$.on d, 'IndexRefresh', @onIndexRefresh
|
||||
else
|
||||
Thread.callbacks.push
|
||||
name: 'Expand Thread'
|
||||
cb: -> ExpandThread.setButton @
|
||||
|
||||
setButton: (thread) ->
|
||||
return unless a = $.x 'following-sibling::a[contains(@class,"summary")][1]', thread.OP.nodes.root
|
||||
return unless a = $.x 'following-sibling::*[contains(@class,"summary")][1]', thread.OP.nodes.root
|
||||
a.textContent = ExpandThread.text '+', a.textContent.match(/\d+/g)...
|
||||
a.style.cursor = 'pointer'
|
||||
$.on a, 'click', ExpandThread.cbToggle
|
||||
|
||||
disconnect: (refresh) ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user