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: "
" + innerHTML: "
" }); $.on($('.export', Settings.dialog), 'click', Settings["export"]); $.on($('.import', Settings.dialog), 'click', Settings["import"]); diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index 4d61740c0..dbfddbe95 100644 Binary files a/builds/4chan-X-noupdate.crx and b/builds/4chan-X-noupdate.crx differ diff --git a/builds/4chan-X-noupdate.user.js b/builds/4chan-X-noupdate.user.js index 3403f9c9f..9e3ae63bd 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.9.3.5 +// @version 1.9.3.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -23,7 +23,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 @@ -375,7 +375,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', @@ -11776,7 +11776,7 @@ return; } replies = $$('.thread > .replyContainer', threadRoot); - if (Conf['Show Replies']) { + if (!Conf['JSON Navigation'] || Conf['Show Replies']) { num = (function() { if (thread.isSticky) { return 1; @@ -12871,7 +12871,7 @@ className: 'dialog' }); $.extend(dialog, { - innerHTML: "
" + innerHTML: "
" }); $.on($('.export', Settings.dialog), 'click', Settings["export"]); $.on($('.import', Settings.dialog), 'click', Settings["import"]); diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index 4764f5007..240b0610e 100644 Binary files a/builds/4chan-X.crx and b/builds/4chan-X.crx differ diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index bc63fc090..f093bbac8 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.9.3.5 +// @version 1.9.3.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 85cb2769b..c76ec58a6 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @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: "
" + innerHTML: "
" }); $.on($('.export', Settings.dialog), 'click', Settings["export"]); $.on($('.import', Settings.dialog), 'click', Settings["import"]); diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 84b69f927..e8c6874da 100644 Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml index a8ab6876c..e8f4af775 100644 --- a/builds/updates-beta.xml +++ b/builds/updates-beta.xml @@ -1,7 +1,7 @@ - + diff --git a/builds/updates.xml b/builds/updates.xml index 2efd69bfe..2ed721642 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index a8c3e9e7e..b8124cda9 100755 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X", - "version": "1.9.3.5", + "version": "1.9.3.6", "repo": "https://github.com/ccd0/4chan-x/", "page": "https://github.com/ccd0/4chan-x", "downloads": "https://ccd0.github.io/4chan-x/builds/", diff --git a/src/General/Build.coffee b/src/General/Build.coffee index f85937bf5..d5c44df15 100755 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -45,6 +45,7 @@ Build = # thread status isSticky: !!data.sticky isClosed: !!data.closed + isArchived: !!data.archived # file if data.filedeleted o.file = @@ -76,7 +77,6 @@ Build = { postID, threadID, boardID name, capcode, tripcode, uniqueID, email, subject, flagCode, flagName, date, dateUTC - isSticky, isClosed comment file } = o @@ -153,15 +153,9 @@ Build = else "/#{boardID}/thread/#{threadID}\#q#{postID}" - sticky = if isSticky - <%= html(' Sticky') %> - else - <%= html('') %> - - closed = if isClosed - <%= html(' Closed') %> - else - <%= html('') %> + icons = for type in ['Sticky', 'Closed', 'Archived'] when o["is#{type}"] and !(type is 'Closed' and o.isArchived) + typeLC = type.toLowerCase() + <%= html(' ${type}') %> 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