diff --git a/CHANGELOG.md b/CHANGELOG.md index 809b5b557..81e6f934c 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ The attributions below are for work that has been incorporated into the script a The links to individual versions below are to copies of the script with the update URL removed. If you want automatic updates, install the script from the links on the [main page](https://github.com/ccd0/4chan-x). +### v1.9.3.6 +*2014-09-19* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.3.6/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.3.6/builds/4chan-X-noupdate.crx "Chromium version")] + +**ccd0** +- Thread expansion bugfix. + ### v1.9.3.5 *2014-09-18* - [[Firefox](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.3.5/builds/4chan-X-noupdate.user.js "Firefox version")] [[Chromium](https://raw.githubusercontent.com/ccd0/4chan-x/1.9.3.5/builds/4chan-X-noupdate.crx "Chromium version")] diff --git a/LICENSE b/LICENSE index ad7cc6501..4d1b265ff 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.9.3.5 +* 4chan X - Version 1.9.3.6 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index 7bbc299e9..79dd92b56 100644 Binary files a/builds/4chan-X-beta.crx and b/builds/4chan-X-beta.crx differ diff --git a/builds/4chan-X-beta.meta.js b/builds/4chan-X-beta.meta.js index 7c791d59f..a69a91bc4 100644 --- a/builds/4chan-X-beta.meta.js +++ b/builds/4chan-X-beta.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.9.3.5 +// @version 1.9.3.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X-beta.user.js b/builds/4chan-X-beta.user.js index d924a4fdd..bd6b32ed4 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X beta -// @version 1.9.3.5 +// @version 1.9.3.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.9.3.5 +* 4chan X - Version 1.9.3.6 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -376,7 +376,7 @@ doc = d.documentElement; g = { - VERSION: '1.9.3.5', + VERSION: '1.9.3.6', NAMESPACE: '4chan X.', NAME: '4chan X', FAQ: 'https://github.com/ccd0/4chan-x/wiki/Frequently-Asked-Questions', @@ -11777,7 +11777,7 @@ return; } replies = $$('.thread > .replyContainer', threadRoot); - if (Conf['Show Replies']) { + if (!Conf['JSON Navigation'] || Conf['Show Replies']) { num = (function() { if (thread.isSticky) { return 1; @@ -12872,7 +12872,7 @@ className: 'dialog' }); $.extend(dialog, { - innerHTML: "
') %>
- else
- <%= html('') %>
-
- closed = if isClosed
- <%= html('
') %>
- else
- <%= html('') %>
+ icons = for type in ['Sticky', 'Closed', 'Archived'] when o["is#{type}"] and !(type is 'Closed' and o.isArchived)
+ typeLC = type.toLowerCase()
+ <%= html('
') %>
replyLink = if isOP and g.VIEW is 'index'
<%= html(' [Reply]') %>
@@ -177,7 +171,7 @@ Build =
'' +
'No.' +
'${postID}' +
- '&{sticky}&{closed}&{replyLink}' +
+ '@{icons}&{replyLink}' +
'' +
''
) %>
diff --git a/src/General/Main.coffee b/src/General/Main.coffee
index 2b725b9e4..3bbe98561 100755
--- a/src/General/Main.coffee
+++ b/src/General/Main.coffee
@@ -166,7 +166,6 @@ Main =
for threadRoot in $$ '.board > .thread', board
thread = new Thread +threadRoot.id[1..], g.BOARD
- thread.isDead = thread.isArchived = !!$('.closed')?.textContent.match(/Thread archived/) if g.VIEW is 'thread'
threads.push thread
for postRoot in $$ '.thread > .postContainer', threadRoot
try
diff --git a/src/General/lib/post.class b/src/General/lib/post.class
index 645f0894e..fcc16f490 100755
--- a/src/General/lib/post.class
+++ b/src/General/lib/post.class
@@ -43,8 +43,10 @@ class Post
unless @isReply = $.hasClass post, 'reply'
@thread.OP = @
- @thread.isSticky = !!$ '.stickyIcon', info
- @thread.isClosed = !!$ '.closedIcon', info
+ @thread.isArchived = !!$ '.archivedIcon', info
+ @thread.isSticky = !!$ '.stickyIcon', info
+ @thread.isClosed = @thread.isArchived or !!$ '.closedIcon', info
+ @thread.kill() if @thread.isArchived
@info = {}
if subject = $ '.subject', info
diff --git a/src/General/lib/thread.class b/src/General/lib/thread.class
index 2fc060441..0b5273c5f 100755
--- a/src/General/lib/thread.class
+++ b/src/General/lib/thread.class
@@ -3,16 +3,17 @@ class Thread
toString: -> @ID
constructor: (@ID, @board) ->
- @fullID = "#{@board}.#{@ID}"
- @posts = new SimpleDict
- @isDead = false
- @isHidden = false
- @isOnTop = false
- @isPinned = false
- @isSticky = false
- @isClosed = false
- @postLimit = false
- @fileLimit = false
+ @fullID = "#{@board}.#{@ID}"
+ @posts = new SimpleDict
+ @isDead = false
+ @isHidden = false
+ @isOnTop = false
+ @isPinned = false
+ @isSticky = false
+ @isClosed = false
+ @isArchived = false
+ @postLimit = false
+ @fileLimit = false
@OP = null
@catalogView = null
@@ -38,18 +39,25 @@ class Thread
return if @[name] is status
@[name] = status
return unless @OP
+ @setIcon 'Sticky', @isSticky
+ @setIcon 'Closed', @isClosed and !@isArchived
+ @setIcon 'Archived', @isArchived
+
+ setIcon: (type, status) ->
typeLC = type.toLowerCase()
+ icon = $ ".#{typeLC}Icon", @OP.nodes.info
+ return if !!icon is status
unless status
- $.rm $ ".#{typeLC}Icon", @OP.nodes.info
+ $.rm icon.previousSibling
+ $.rm icon
$.rm $ ".#{typeLC}Icon", @catalogView.nodes.icons if @catalogView
return
-
icon = $.el 'img',
src: "#{Build.staticPath}#{typeLC}#{Build.gifIcon}"
alt: type
title: type
className: "#{typeLC}Icon retina"
- root = if type is 'Closed' and @isSticky
+ root = if type isnt 'Sticky' and @isSticky
$ '.stickyIcon', @OP.nodes.info
else
$('.page-num', @OP.nodes.info) or $('[title="Reply to this post"]', @OP.nodes.info)
diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee
index fb7a84566..65746e55c 100755
--- a/src/Miscellaneous/ExpandThread.coffee
+++ b/src/Miscellaneous/ExpandThread.coffee
@@ -60,7 +60,7 @@ ExpandThread =
return
replies = $$ '.thread > .replyContainer', threadRoot
- if Conf['Show Replies']
+ if !Conf['JSON Navigation'] or Conf['Show Replies']
num = if thread.isSticky
1
else switch g.BOARD.ID
diff --git a/src/Monitoring/ThreadUpdater.coffee b/src/Monitoring/ThreadUpdater.coffee
index 5130262c4..4d2548d06 100755
--- a/src/Monitoring/ThreadUpdater.coffee
+++ b/src/Monitoring/ThreadUpdater.coffee
@@ -132,8 +132,7 @@ ThreadUpdater =
switch req.status
when 200
ThreadUpdater.parse req.response.posts
- if !!req.response.posts[0].archived
- ThreadUpdater.thread.isArchived = true
+ if ThreadUpdater.thread.isArchived
ThreadUpdater.set 'status', 'Archived', 'warning'
ThreadUpdater.kill()
else
@@ -263,6 +262,7 @@ ThreadUpdater =
OP = postObjects[0]
Build.spoilerRange[ThreadUpdater.thread.board] = OP.custom_spoiler
+ ThreadUpdater.thread.setStatus 'Archived', !!OP.archived
ThreadUpdater.updateThreadStatus 'Sticky', !!OP.sticky
ThreadUpdater.updateThreadStatus 'Closed', !!OP.closed
ThreadUpdater.thread.postLimit = !!OP.bumplimit