diff --git a/CHANGELOG.md b/CHANGELOG.md
index 373ce66e7..b8b2cceb8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,9 @@
### v1.14.20
+**v1.14.20.2** *(2020-08-24)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.14.20.2/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.14.20.2/builds/4chan-X-noupdate.crx)]
+- Fix index not working on /vg/ when sort mode is last reply. https://github.com/ccd0/4chan-x/issues/2685#issuecomment-679311712
+
**v1.14.20.1** *(2020-08-24)* - [[Userscript](https://raw.githubusercontent.com/ccd0/4chan-x/1.14.20.1/builds/4chan-X-noupdate.user.js)] [[Chrome extension](https://raw.githubusercontent.com/ccd0/4chan-x/1.14.20.1/builds/4chan-X-noupdate.crx)]
- Update for 4chan /vg/ change.
diff --git a/builds/4chan-X-beta.crx b/builds/4chan-X-beta.crx
index 168b50327..bccc280f8 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 c8c58d653..354304e7b 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.14.20.1
+// @version 1.14.20.2
// @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 ed5517b3c..590304907 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.14.20.1
+// @version 1.14.20.2
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -218,7 +218,7 @@ docSet = function() {
};
g = {
- VERSION: '1.14.20.1',
+ VERSION: '1.14.20.2',
NAMESPACE: '4chan X.',
sites: Object.create(null),
boards: Object.create(null)
@@ -12389,7 +12389,7 @@ Index = (function() {
$.add(thread.OP.nodes.post, nodes.replies);
},
sort: function() {
- var lastlong, lastlongD, liveThreadData, liveThreadIDs, sortType, thread, threadIDs;
+ var lastlong, lastlongD, liveThreadData, liveThreadIDs, repliesAvailable, sortType, thread, threadIDs;
liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData;
if (!liveThreadData) {
return;
@@ -12400,8 +12400,15 @@ Index = (function() {
switch (sortType) {
case 'lastreply':
case 'lastlong':
+ repliesAvailable = liveThreadData.some(function(thread) {
+ var ref;
+ return (ref = thread.last_replies) != null ? ref.length : void 0;
+ });
lastlong = function(thread) {
- var i, k, len, r, ref;
+ var i, k, len, r, ref, ref1;
+ if (!repliesAvailable) {
+ return thread.last_modified;
+ }
ref = thread.last_replies || [];
for (i = k = ref.length - 1; k >= 0; i = k += -1) {
r = ref[i];
@@ -12416,7 +12423,7 @@ Index = (function() {
return r;
}
}
- if (thread.omitted_posts) {
+ if (thread.omitted_posts && ((ref1 = thread.last_replies) != null ? ref1.length : void 0)) {
return thread.last_replies[0];
} else {
return thread;
diff --git a/builds/4chan-X-noupdate.crx b/builds/4chan-X-noupdate.crx
index acbc3c1b7..e3d44d962 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 96d549ef7..87bcccb84 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.14.20.1
+// @version 1.14.20.2
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -218,7 +218,7 @@ docSet = function() {
};
g = {
- VERSION: '1.14.20.1',
+ VERSION: '1.14.20.2',
NAMESPACE: '4chan X.',
sites: Object.create(null),
boards: Object.create(null)
@@ -12389,7 +12389,7 @@ Index = (function() {
$.add(thread.OP.nodes.post, nodes.replies);
},
sort: function() {
- var lastlong, lastlongD, liveThreadData, liveThreadIDs, sortType, thread, threadIDs;
+ var lastlong, lastlongD, liveThreadData, liveThreadIDs, repliesAvailable, sortType, thread, threadIDs;
liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData;
if (!liveThreadData) {
return;
@@ -12400,8 +12400,15 @@ Index = (function() {
switch (sortType) {
case 'lastreply':
case 'lastlong':
+ repliesAvailable = liveThreadData.some(function(thread) {
+ var ref;
+ return (ref = thread.last_replies) != null ? ref.length : void 0;
+ });
lastlong = function(thread) {
- var i, k, len, r, ref;
+ var i, k, len, r, ref, ref1;
+ if (!repliesAvailable) {
+ return thread.last_modified;
+ }
ref = thread.last_replies || [];
for (i = k = ref.length - 1; k >= 0; i = k += -1) {
r = ref[i];
@@ -12416,7 +12423,7 @@ Index = (function() {
return r;
}
}
- if (thread.omitted_posts) {
+ if (thread.omitted_posts && ((ref1 = thread.last_replies) != null ? ref1.length : void 0)) {
return thread.last_replies[0];
} else {
return thread;
diff --git a/builds/4chan-X.crx b/builds/4chan-X.crx
index bac8730f1..b4d1cc3e0 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 e2d894e7f..34fcf5e47 100644
--- a/builds/4chan-X.meta.js
+++ b/builds/4chan-X.meta.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.14.20.1
+// @version 1.14.20.2
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js
index e895c5204..27c12a2b2 100644
--- a/builds/4chan-X.user.js
+++ b/builds/4chan-X.user.js
@@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
-// @version 1.14.20.1
+// @version 1.14.20.2
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@@ -218,7 +218,7 @@ docSet = function() {
};
g = {
- VERSION: '1.14.20.1',
+ VERSION: '1.14.20.2',
NAMESPACE: '4chan X.',
sites: Object.create(null),
boards: Object.create(null)
@@ -12389,7 +12389,7 @@ Index = (function() {
$.add(thread.OP.nodes.post, nodes.replies);
},
sort: function() {
- var lastlong, lastlongD, liveThreadData, liveThreadIDs, sortType, thread, threadIDs;
+ var lastlong, lastlongD, liveThreadData, liveThreadIDs, repliesAvailable, sortType, thread, threadIDs;
liveThreadIDs = Index.liveThreadIDs, liveThreadData = Index.liveThreadData;
if (!liveThreadData) {
return;
@@ -12400,8 +12400,15 @@ Index = (function() {
switch (sortType) {
case 'lastreply':
case 'lastlong':
+ repliesAvailable = liveThreadData.some(function(thread) {
+ var ref;
+ return (ref = thread.last_replies) != null ? ref.length : void 0;
+ });
lastlong = function(thread) {
- var i, k, len, r, ref;
+ var i, k, len, r, ref, ref1;
+ if (!repliesAvailable) {
+ return thread.last_modified;
+ }
ref = thread.last_replies || [];
for (i = k = ref.length - 1; k >= 0; i = k += -1) {
r = ref[i];
@@ -12416,7 +12423,7 @@ Index = (function() {
return r;
}
}
- if (thread.omitted_posts) {
+ if (thread.omitted_posts && ((ref1 = thread.last_replies) != null ? ref1.length : void 0)) {
return thread.last_replies[0];
} else {
return thread;
diff --git a/builds/4chan-X.zip b/builds/4chan-X.zip
index 3ac031347..ae05db9a3 100644
Binary files a/builds/4chan-X.zip and b/builds/4chan-X.zip differ
diff --git a/builds/updates-beta.json b/builds/updates-beta.json
index 87cb909a8..b3381a7ec 100644
--- a/builds/updates-beta.json
+++ b/builds/updates-beta.json
@@ -3,7 +3,7 @@
"4chan-x@4chan-x.net": {
"updates": [
{
- "version": "1.14.20.1",
+ "version": "1.14.20.2",
"update_link": "https://www.4chan-x.net/builds/4chan-X-beta.crx"
}
]
diff --git a/builds/updates-beta.xml b/builds/updates-beta.xml
index c3bac2875..d080fd0e7 100644
--- a/builds/updates-beta.xml
+++ b/builds/updates-beta.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/builds/updates.json b/builds/updates.json
index 7d2d8b019..fd550c89c 100644
--- a/builds/updates.json
+++ b/builds/updates.json
@@ -3,7 +3,7 @@
"4chan-x@4chan-x.net": {
"updates": [
{
- "version": "1.14.20.1",
+ "version": "1.14.20.2",
"update_link": "https://www.4chan-x.net/builds/4chan-X.crx"
}
]
diff --git a/builds/updates.xml b/builds/updates.xml
index 12cb65fef..7adb3c836 100644
--- a/builds/updates.xml
+++ b/builds/updates.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/version.json b/version.json
index a6ef085c9..972115813 100644
--- a/version.json
+++ b/version.json
@@ -1,4 +1,4 @@
{
- "version": "1.14.20.1",
- "date": "2020-08-24T15:40:29.833Z"
+ "version": "1.14.20.2",
+ "date": "2020-08-24T21:49:12.412Z"
}
\ No newline at end of file