diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a06464c9..5bf1e5510 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ ### v1.13.1 +**v1.13.1.1** *(2016-11-07)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.1.1/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.1.1/builds/4chan-X-noupdate.crx)] +- Fix bug causing replies to not immediately show when catalog thread is clicked. + **v1.13.1.0** *(2016-11-07)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.1.0/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.13.1.0/builds/4chan-X-noupdate.crx)] - Based on v1.13.0.22. - Only activate `Catalog Hover Expand` when catalog is clicked. Deactivate on second click. Turn `Catalog Hover Expand` back on by default. diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx index f731c1293..8f0fa8354 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 583922bb6..846431642 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.13.1.0 +// @version 1.13.1.1 // @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 af4687666..89fa526ec 100644 --- a/builds/4chan-X-beta.user.js +++ b/builds/4chan-X-beta.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X beta -// @version 1.13.1.0 +// @version 1.13.1.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -147,7 +147,7 @@ docSet = function() { }; g = { - VERSION: '1.13.1.0', + VERSION: '1.13.1.1', NAMESPACE: '4chan X.', boards: {} }; @@ -8509,10 +8509,13 @@ Get = (function() { return excerpt; }, threadFromRoot: function(root) { + if (root == null) { + return null; + } return g.threads[g.BOARD + "." + root.id.slice(1)]; }, threadFromNode: function(node) { - return Get.threadFromRoot($.x('ancestor::div[@class="thread"]', node)); + return Get.threadFromRoot($.x('ancestor-or-self::div[contains(concat(" ",@class," ")," thread ")]', node)); }, postFromRoot: function(root) { var index, post; @@ -9603,11 +9606,12 @@ Index = (function() { } }, hoverToggle: function(e) { - var post; + var thread; if (Conf['Catalog Hover Expand'] && !$.modifiedClick(e) && !$.x('ancestor-or-self::a', e.target)) { $.toggleClass(doc, 'catalog-hover-expand'); - if ((post = Get.postFromNode(e.target))) { - return Index.cb.hoverAdjust.call(post.nodes); + if ((thread = Get.threadFromNode(e.target))) { + Index.cb.catalogReplies.call(thread); + return Index.cb.hoverAdjust.call(thread.OP.nodes); } } }, @@ -9661,11 +9665,9 @@ Index = (function() { return Index.update(); }, catalogReplies: function() { - if (!(Conf['Show Replies'] && $.hasClass(doc, 'catalog-hover-expand'))) { - return; + if (Conf['Show Replies'] && $.hasClass(doc, 'catalog-hover-expand') && !this.catalogView.nodes.replies) { + return Index.buildCatalogReplies(this); } - $.off(this, 'mouseenter', Index.cb.catalogReplies); - return Index.buildCatalogReplies(Get.threadFromRoot(this)); }, hoverAdjust: function() { var rect, style, x; @@ -10109,7 +10111,7 @@ Index = (function() { thread.setStatus('Sticky', !!threadData.sticky); thread.setStatus('Closed', !!threadData.closed); } - if (thread.catalogView && (isStale || !(isCatalog && Conf['Show Replies'] && Conf['Catalog Hover Expand']))) { + if (thread.catalogView) { $.rm(thread.catalogView.nodes.replies); thread.catalogView.nodes.replies = null; } @@ -10218,22 +10220,14 @@ Index = (function() { } }, buildCatalogReplies: function(thread) { - var data, k, l, lastReplies, len, len1, nodes, ref, replies, reply, timeEl; + var data, k, lastReplies, len, nodes, replies, reply; nodes = thread.catalogView.nodes; if (!(lastReplies = Index.liveThreadDict[thread.ID].last_replies)) { return; } - if (nodes.replies) { - ref = $$('time', nodes.replies); - for (k = 0, len = ref.length; k < len; k++) { - timeEl = ref[k]; - RelativeDates.update(timeEl); - } - return; - } replies = []; - for (l = 0, len1 = lastReplies.length; l < len1; l++) { - data = lastReplies[l]; + for (k = 0, len = lastReplies.length; k < len; k++) { + data = lastReplies[k]; if (PostHiding.isHidden(g.BOARD.ID, thread.ID, data.no)) { continue; } @@ -10424,7 +10418,7 @@ Index = (function() { thread.OP.setCatalogOP(true); $.add(thread.catalogView.nodes.root, thread.OP.nodes.root); nodes.push(thread.catalogView.nodes.root); - $.on(thread.catalogView.nodes.root, 'mouseenter', Index.cb.catalogReplies); + $.on(thread.catalogView.nodes.root, 'mouseenter', Index.cb.catalogReplies.bind(thread)); $.on(thread.OP.nodes.root, 'mouseenter', Index.cb.hoverAdjust.bind(thread.OP.nodes)); } $.add(Index.root, nodes); diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx index fa1d8a3cd..1bccf24e7 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 69691360c..a6b106ae2 100644 --- a/builds/4chan-X-noupdate.user.js +++ b/builds/4chan-X-noupdate.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.13.1.0 +// @version 1.13.1.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -147,7 +147,7 @@ docSet = function() { }; g = { - VERSION: '1.13.1.0', + VERSION: '1.13.1.1', NAMESPACE: '4chan X.', boards: {} }; @@ -8509,10 +8509,13 @@ Get = (function() { return excerpt; }, threadFromRoot: function(root) { + if (root == null) { + return null; + } return g.threads[g.BOARD + "." + root.id.slice(1)]; }, threadFromNode: function(node) { - return Get.threadFromRoot($.x('ancestor::div[@class="thread"]', node)); + return Get.threadFromRoot($.x('ancestor-or-self::div[contains(concat(" ",@class," ")," thread ")]', node)); }, postFromRoot: function(root) { var index, post; @@ -9603,11 +9606,12 @@ Index = (function() { } }, hoverToggle: function(e) { - var post; + var thread; if (Conf['Catalog Hover Expand'] && !$.modifiedClick(e) && !$.x('ancestor-or-self::a', e.target)) { $.toggleClass(doc, 'catalog-hover-expand'); - if ((post = Get.postFromNode(e.target))) { - return Index.cb.hoverAdjust.call(post.nodes); + if ((thread = Get.threadFromNode(e.target))) { + Index.cb.catalogReplies.call(thread); + return Index.cb.hoverAdjust.call(thread.OP.nodes); } } }, @@ -9661,11 +9665,9 @@ Index = (function() { return Index.update(); }, catalogReplies: function() { - if (!(Conf['Show Replies'] && $.hasClass(doc, 'catalog-hover-expand'))) { - return; + if (Conf['Show Replies'] && $.hasClass(doc, 'catalog-hover-expand') && !this.catalogView.nodes.replies) { + return Index.buildCatalogReplies(this); } - $.off(this, 'mouseenter', Index.cb.catalogReplies); - return Index.buildCatalogReplies(Get.threadFromRoot(this)); }, hoverAdjust: function() { var rect, style, x; @@ -10109,7 +10111,7 @@ Index = (function() { thread.setStatus('Sticky', !!threadData.sticky); thread.setStatus('Closed', !!threadData.closed); } - if (thread.catalogView && (isStale || !(isCatalog && Conf['Show Replies'] && Conf['Catalog Hover Expand']))) { + if (thread.catalogView) { $.rm(thread.catalogView.nodes.replies); thread.catalogView.nodes.replies = null; } @@ -10218,22 +10220,14 @@ Index = (function() { } }, buildCatalogReplies: function(thread) { - var data, k, l, lastReplies, len, len1, nodes, ref, replies, reply, timeEl; + var data, k, lastReplies, len, nodes, replies, reply; nodes = thread.catalogView.nodes; if (!(lastReplies = Index.liveThreadDict[thread.ID].last_replies)) { return; } - if (nodes.replies) { - ref = $$('time', nodes.replies); - for (k = 0, len = ref.length; k < len; k++) { - timeEl = ref[k]; - RelativeDates.update(timeEl); - } - return; - } replies = []; - for (l = 0, len1 = lastReplies.length; l < len1; l++) { - data = lastReplies[l]; + for (k = 0, len = lastReplies.length; k < len; k++) { + data = lastReplies[k]; if (PostHiding.isHidden(g.BOARD.ID, thread.ID, data.no)) { continue; } @@ -10424,7 +10418,7 @@ Index = (function() { thread.OP.setCatalogOP(true); $.add(thread.catalogView.nodes.root, thread.OP.nodes.root); nodes.push(thread.catalogView.nodes.root); - $.on(thread.catalogView.nodes.root, 'mouseenter', Index.cb.catalogReplies); + $.on(thread.catalogView.nodes.root, 'mouseenter', Index.cb.catalogReplies.bind(thread)); $.on(thread.OP.nodes.root, 'mouseenter', Index.cb.hoverAdjust.bind(thread.OP.nodes)); } $.add(Index.root, nodes); diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx index de79ec6dd..ecb97cb3b 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 ac1d81e57..51165b2ae 100644 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.13.1.0 +// @version 1.13.1.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index d7245c0c3..89d44c95f 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.13.1.0 +// @version 1.13.1.1 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -147,7 +147,7 @@ docSet = function() { }; g = { - VERSION: '1.13.1.0', + VERSION: '1.13.1.1', NAMESPACE: '4chan X.', boards: {} }; @@ -8509,10 +8509,13 @@ Get = (function() { return excerpt; }, threadFromRoot: function(root) { + if (root == null) { + return null; + } return g.threads[g.BOARD + "." + root.id.slice(1)]; }, threadFromNode: function(node) { - return Get.threadFromRoot($.x('ancestor::div[@class="thread"]', node)); + return Get.threadFromRoot($.x('ancestor-or-self::div[contains(concat(" ",@class," ")," thread ")]', node)); }, postFromRoot: function(root) { var index, post; @@ -9603,11 +9606,12 @@ Index = (function() { } }, hoverToggle: function(e) { - var post; + var thread; if (Conf['Catalog Hover Expand'] && !$.modifiedClick(e) && !$.x('ancestor-or-self::a', e.target)) { $.toggleClass(doc, 'catalog-hover-expand'); - if ((post = Get.postFromNode(e.target))) { - return Index.cb.hoverAdjust.call(post.nodes); + if ((thread = Get.threadFromNode(e.target))) { + Index.cb.catalogReplies.call(thread); + return Index.cb.hoverAdjust.call(thread.OP.nodes); } } }, @@ -9661,11 +9665,9 @@ Index = (function() { return Index.update(); }, catalogReplies: function() { - if (!(Conf['Show Replies'] && $.hasClass(doc, 'catalog-hover-expand'))) { - return; + if (Conf['Show Replies'] && $.hasClass(doc, 'catalog-hover-expand') && !this.catalogView.nodes.replies) { + return Index.buildCatalogReplies(this); } - $.off(this, 'mouseenter', Index.cb.catalogReplies); - return Index.buildCatalogReplies(Get.threadFromRoot(this)); }, hoverAdjust: function() { var rect, style, x; @@ -10109,7 +10111,7 @@ Index = (function() { thread.setStatus('Sticky', !!threadData.sticky); thread.setStatus('Closed', !!threadData.closed); } - if (thread.catalogView && (isStale || !(isCatalog && Conf['Show Replies'] && Conf['Catalog Hover Expand']))) { + if (thread.catalogView) { $.rm(thread.catalogView.nodes.replies); thread.catalogView.nodes.replies = null; } @@ -10218,22 +10220,14 @@ Index = (function() { } }, buildCatalogReplies: function(thread) { - var data, k, l, lastReplies, len, len1, nodes, ref, replies, reply, timeEl; + var data, k, lastReplies, len, nodes, replies, reply; nodes = thread.catalogView.nodes; if (!(lastReplies = Index.liveThreadDict[thread.ID].last_replies)) { return; } - if (nodes.replies) { - ref = $$('time', nodes.replies); - for (k = 0, len = ref.length; k < len; k++) { - timeEl = ref[k]; - RelativeDates.update(timeEl); - } - return; - } replies = []; - for (l = 0, len1 = lastReplies.length; l < len1; l++) { - data = lastReplies[l]; + for (k = 0, len = lastReplies.length; k < len; k++) { + data = lastReplies[k]; if (PostHiding.isHidden(g.BOARD.ID, thread.ID, data.no)) { continue; } @@ -10424,7 +10418,7 @@ Index = (function() { thread.OP.setCatalogOP(true); $.add(thread.catalogView.nodes.root, thread.OP.nodes.root); nodes.push(thread.catalogView.nodes.root); - $.on(thread.catalogView.nodes.root, 'mouseenter', Index.cb.catalogReplies); + $.on(thread.catalogView.nodes.root, 'mouseenter', Index.cb.catalogReplies.bind(thread)); $.on(thread.OP.nodes.root, 'mouseenter', Index.cb.hoverAdjust.bind(thread.OP.nodes)); } $.add(Index.root, nodes); diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip index 6e10aae86..808f7025e 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 ff042da9f..0c0674179 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 f0a3745cb..f05d352fa 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/version.json b/version.json index 3d0595e49..e81c824e3 100644 --- a/version.json +++ b/version.json @@ -1,4 +1,4 @@ { - "version": "1.13.1.0", - "date": "2016-11-07T08:52:09.200Z" + "version": "1.13.1.1", + "date": "2016-11-07T11:05:03.448Z" } \ No newline at end of file