Deprecated obsolete options which are now part of the vanilla CC/TW Forums experience and fixed a bug caused to an internal TW HTML structure change
diff --git a/src/background.js b/src/background.js
index 14cda5a..56db901 100644
--- a/src/background.js
+++ b/src/background.js
@@ -2,7 +2,7 @@
return Object.keys(obj).length === 0;
}
-var defaultOptions = {
+const defaultOptions = {
"list": true,
"thread": true,
"threadall": false,
diff --git a/src/console_inject.js b/src/console_inject.js
index 912be50..13dc5e8 100644
--- a/src/console_inject.js
+++ b/src/console_inject.js
@@ -46,10 +46,6 @@
if (mutation.type == "childList") {
mutation.addedNodes.forEach(function (node) {
if (typeof node.classList !== "undefined") {
- if (options.list && node.classList.contains("view-more-button-container")) {
- intersectionObserver.observe(node.querySelector(".view-more-button"));
- }
-
if (options.thread && node.classList.contains("load-more-bar")) {
intersectionObserver.observe(node.querySelector(".load-more-button"));
}
@@ -105,7 +101,7 @@
});
}
-function intersectionCallback(entries, observer) {
+function intersectionCallback(entries, observer) {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.click();
diff --git a/src/console_inject_start.js b/src/console_inject_start.js
index edb6030..fef90f7 100644
--- a/src/console_inject_start.js
+++ b/src/console_inject_start.js
@@ -6,14 +6,6 @@
startup[4][13] = true;
}
- if (items.escalatethreads) {
- startup[4][20] = true;
- }
-
- if (items.movethreads) {
- startup[4][18] = true;
- }
-
document.querySelector("html").setAttribute("data-startup", JSON.stringify(startup));
}
});
diff --git a/src/options.html b/src/options.html
index 6af3c26..5013134 100644
--- a/src/options.html
+++ b/src/options.html
@@ -7,7 +7,6 @@
</head>
<body>
<p>
- <input type="checkbox" id="list"> <label for="list" data-i18n="list"></label><br>
<input type="checkbox" id="thread"> <label for="thread" data-i18n="thread"></label><br>
<input type="checkbox" id="threadall"> <label for="threadall" data-i18n="threadall"></label>
</p>
@@ -18,8 +17,6 @@
<input type="checkbox" id="history"> <label for="history" data-i18n="history"></label><br>
<input type="checkbox" id="loaddrafts"> <label for="loaddrafts" data-i18n="loaddrafts"></label> <span style="color: gray;" data-i18n="experimental_label"></span><br>
<input type="checkbox" id="batchduplicate"> <label for="batchduplicate" data-i18n="batchduplicate"></label> <span style="color: gray;" data-i18n="experimental_label"></span><br>
- <input type="checkbox" id="escalatethreads"> <label for="escalatethreads" data-i18n="escalatethreads"></label> <span style="color: gray;" data-i18n="experimental_label"></span><br>
- <input type="checkbox" id="movethreads"> <label for="movethreads" data-i18n="movethreads"></label> <span style="color: gray;" data-i18n="experimental_label"></span><br>
</p>
<p style="text-align: center;"><button id="save" data-i18n="save"></button></p>
<script src="options.js"></script>
diff --git a/src/options.js b/src/options.js
index 53c4e3b..648faa2 100644
--- a/src/options.js
+++ b/src/options.js
@@ -2,7 +2,7 @@
return Object.keys(obj).length === 0;
}
-var defaultOptions = {
+const defaultOptions = {
"list": true,
"thread": true,
"threadall": false,
@@ -15,6 +15,12 @@
"movethreads": false
};
+const deprecatedOptions = [
+ "list",
+ "escalatethreads",
+ "movethreads"
+];
+
function cleanUpOptions(options) {
var ok = true;
for (const [opt, value] of Object.entries(defaultOptions)) {
@@ -35,7 +41,8 @@
var options = defaultOptions;
Object.keys(options).forEach(function (opt) {
- options[opt] = document.querySelector("#"+opt).checked;
+ if (deprecatedOptions.includes(opt)) return;
+ options[opt] = document.querySelector("#"+opt).checked || false;
});
chrome.storage.sync.set(options, function() {
@@ -60,7 +67,7 @@
items = cleanUpOptions(items);
Object.keys(defaultOptions).forEach(function(opt) {
- if (items[opt] === true) {
+ if (items[opt] === true && !deprecatedOptions.includes(opt)) {
document.querySelector("#"+opt).checked = true;
}
});
diff --git a/src/thread_inject.js b/src/thread_inject.js
index e756640..1d65dc6 100644
--- a/src/thread_inject.js
+++ b/src/thread_inject.js
@@ -13,7 +13,7 @@
}
chrome.storage.sync.get(null, function(items) {
- var redirectLink = document.querySelector(".thread-question__open-in-community-console-button");
+ var redirectLink = document.querySelector(".community-console");
if (items.redirect && redirectLink !== null) {
window.location = redirectLink.href;
} else {