Skip to content

Commit a4642d6

Browse files
committed
fix: fix clear flags
1 parent 9bb85d4 commit a4642d6

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

app/src/main/java/ir/amirroid/chatguard/core/web_content_extractor/implementation/DefaultWebContentExtractor.kt

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,20 +1248,6 @@ class DefaultWebContentExtractor(
12481248
return true;
12491249
""".trimIndent()
12501250

1251-
private fun clearCharacterCounterScript() = """
1252-
if (window.__chatguardCounterElement) {
1253-
window.__chatguardCounterElement.remove();
1254-
delete window.__chatguardCounterElement;
1255-
}
1256-
1257-
if (window.__chatguardCounterObserver) {
1258-
window.__chatguardCounterObserver.disconnect();
1259-
delete window.__chatguardCounterObserver;
1260-
}
1261-
1262-
return true;
1263-
""".trimIndent()
1264-
12651251
private fun buildClearAllFlagsScript() = """
12661252
(function() {
12671253
if (window.__chatguardSendObserver) {
@@ -1306,8 +1292,16 @@ class DefaultWebContentExtractor(
13061292
btn.remove();
13071293
});
13081294
1309-
${clearCharacterCounterScript()}
1295+
if (window.__chatguardCounterElement) {
1296+
window.__chatguardCounterElement.remove();
1297+
delete window.__chatguardCounterElement;
1298+
}
13101299
1300+
if (window.__chatguardCounterObserver) {
1301+
window.__chatguardCounterObserver.disconnect();
1302+
delete window.__chatguardCounterObserver;
1303+
}
1304+
13111305
var infoMessages = document.querySelectorAll('.chatguard-info-message');
13121306
infoMessages.forEach(function(msg) {
13131307
msg.remove();

0 commit comments

Comments
 (0)