Merge pull request #870 from ccd0/master

More fixes
This commit is contained in:
Zixaphir 2015-01-25 01:11:31 -07:00
commit 8877e4510f
5 changed files with 30 additions and 22 deletions

View File

@ -12158,7 +12158,7 @@
return g.posts.forEach(ImageLoader.prefetch);
});
if (Conf['Replace WEBM']) {
$.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', this.quotePreviews);
$.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', this.playVideos);
}
if (!Conf['Image Prefetching']) {
return;
@ -12265,7 +12265,7 @@
g.BOARD.posts.forEach(ImageLoader.prefetch);
}
},
quotePreviews: function() {
playVideos: function() {
var qpClone, _ref;
qpClone = (_ref = $.id('qp')) != null ? _ref.firstElementChild : void 0;
return g.posts.forEach(function(post) {
@ -13651,7 +13651,7 @@
},
markNew: function(post, ipCount) {
var counter, suffix;
suffix = ['st', 'nd', 'rd'][ipCount % 10] || 'th';
suffix = (Math.floor(ipCount / 10)) % 10 === 1 ? 'th' : ['st', 'nd', 'rd'][ipCount % 10 - 1] || 'th';
counter = $.el('span', {
className: 'ip-counter',
textContent: "(" + ipCount + ")"
@ -14460,7 +14460,8 @@
return $.event('CloseMenu');
},
toggle: function() {
ThreadWatcher.toggle(Get.threadFromNode(this));
var thread;
thread = Get.postFromNode(this).thread;
Index.followedThreadID = thread.ID;
ThreadWatcher.toggle(thread);
return delete Index.followedThreadID;
@ -14689,7 +14690,6 @@
$.on(x, 'click', ThreadWatcher.cb.rm);
link = $.el('a', {
href: "/" + boardID + "/thread/" + threadID,
textContent: data.excerpt,
title: data.excerpt,
className: 'watcher-link'
});
@ -14701,7 +14701,7 @@
$.prepend(link, count);
}
title = $.el('span', {
textContent: link.textContent,
textContent: data.excerpt,
className: 'watcher-title'
});
$.add(link, title);
@ -14980,9 +14980,11 @@
var entry, input;
entry = {
type: 'thread watcher',
el: UI.checkbox(name, " " + (name.replace(' Thread Watcher', '')))
el: UI.checkbox(name, name.replace(' Thread Watcher', ''))
};
entry.el.title = desc;
input = entry.el.firstElementChild;
$.on(input, 'change', $.cb.checked);
if (name === 'Current Board' || name === 'Show Unread Count') {
$.on(input, 'change', ThreadWatcher.refresh);
}

View File

@ -12181,7 +12181,7 @@
return g.posts.forEach(ImageLoader.prefetch);
});
if (Conf['Replace WEBM']) {
$.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', this.quotePreviews);
$.on(d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', this.playVideos);
}
if (!Conf['Image Prefetching']) {
return;
@ -12288,7 +12288,7 @@
g.BOARD.posts.forEach(ImageLoader.prefetch);
}
},
quotePreviews: function() {
playVideos: function() {
var qpClone, _ref;
qpClone = (_ref = $.id('qp')) != null ? _ref.firstElementChild : void 0;
return g.posts.forEach(function(post) {
@ -13674,7 +13674,7 @@
},
markNew: function(post, ipCount) {
var counter, suffix;
suffix = ['st', 'nd', 'rd'][ipCount % 10] || 'th';
suffix = (Math.floor(ipCount / 10)) % 10 === 1 ? 'th' : ['st', 'nd', 'rd'][ipCount % 10 - 1] || 'th';
counter = $.el('span', {
className: 'ip-counter',
textContent: "(" + ipCount + ")"
@ -14483,7 +14483,8 @@
return $.event('CloseMenu');
},
toggle: function() {
ThreadWatcher.toggle(Get.threadFromNode(this));
var thread;
thread = Get.postFromNode(this).thread;
Index.followedThreadID = thread.ID;
ThreadWatcher.toggle(thread);
return delete Index.followedThreadID;
@ -14712,7 +14713,6 @@
$.on(x, 'click', ThreadWatcher.cb.rm);
link = $.el('a', {
href: "/" + boardID + "/thread/" + threadID,
textContent: data.excerpt,
title: data.excerpt,
className: 'watcher-link'
});
@ -14724,7 +14724,7 @@
$.prepend(link, count);
}
title = $.el('span', {
textContent: link.textContent,
textContent: data.excerpt,
className: 'watcher-title'
});
$.add(link, title);
@ -15003,9 +15003,11 @@
var entry, input;
entry = {
type: 'thread watcher',
el: UI.checkbox(name, " " + (name.replace(' Thread Watcher', '')))
el: UI.checkbox(name, name.replace(' Thread Watcher', ''))
};
entry.el.title = desc;
input = entry.el.firstElementChild;
$.on(input, 'change', $.cb.checked);
if (name === 'Current Board' || name === 'Show Unread Count') {
$.on(input, 'change', ThreadWatcher.refresh);
}

View File

@ -12,7 +12,7 @@ ImageLoader =
g.posts.forEach ImageLoader.prefetch
if Conf['Replace WEBM']
$.on d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', @quotePreviews
$.on d, 'scroll visibilitychange 4chanXInitFinished PostsInserted', @playVideos
return unless Conf['Image Prefetching']
@ -85,11 +85,11 @@ ImageLoader =
g.BOARD.posts.forEach ImageLoader.prefetch
return
quotePreviews: ->
playVideos: ->
# Special case: Quote previews are off screen when inserted into document, but quickly moved on screen.
qpClone = $.id('qp')?.firstElementChild
g.posts.forEach (post) ->
for post in [post, post.clones...] when post.file?.videoThumb
{thumb} = post.file
if Header.isNodeVisible(thumb) or post.nodes.root is qpClone then thumb.play() else thumb.pause()
return
return

View File

@ -32,7 +32,10 @@ MarkNewIPs =
MarkNewIPs.postIDs = postIDs
markNew: (post, ipCount) ->
suffix = ['st', 'nd', 'rd'][ipCount % 10] or 'th' # fuck switches
suffix = if (ipCount // 10) % 10 is 1
'th'
else
['st', 'nd', 'rd'][ipCount % 10 - 1] or 'th' # fuck switches
counter = $.el 'span',
className: 'ip-counter'
textContent: "(#{ipCount})"

View File

@ -108,7 +108,7 @@ ThreadWatcher =
ThreadWatcher.refresh()
$.event 'CloseMenu'
toggle: ->
ThreadWatcher.toggle Get.threadFromNode @
{thread} = Get.postFromNode @
Index.followedThreadID = thread.ID
ThreadWatcher.toggle thread
delete Index.followedThreadID
@ -253,7 +253,6 @@ ThreadWatcher =
link = $.el 'a',
href: "/#{boardID}/thread/#{threadID}"
textContent: data.excerpt
title: data.excerpt
className: 'watcher-link'
@ -264,7 +263,7 @@ ThreadWatcher =
$.prepend link, count
title = $.el 'span',
textContent: link.textContent
textContent: data.excerpt
className: 'watcher-title'
$.add link, title
@ -431,8 +430,10 @@ ThreadWatcher =
createSubEntry: (name, desc) ->
entry =
type: 'thread watcher'
el: UI.checkbox name, " #{name.replace ' Thread Watcher', ''}"
el: UI.checkbox name, name.replace(' Thread Watcher', '')
entry.el.title = desc
input = entry.el.firstElementChild
$.on input, 'change', $.cb.checked
$.on input, 'change', ThreadWatcher.refresh if name in ['Current Board', 'Show Unread Count']
$.on input, 'change', ThreadWatcher.fetchAuto if name in ['Show Unread Count', 'Auto Update Thread Watcher']
entry