Spaces:
Running
Running
Remove comments_off.js — comment section restored on videos
Browse files- static/comments_off.js +0 -43
static/comments_off.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
| 1 |
-
// === Remove the comment section from every TikTok-style video slide ===
|
| 2 |
-
// User request: "xóa phần bình luận mỗi video" (remove comments on each video).
|
| 3 |
-
// We wrap buildTikTokSlide (defined in app_v2.js) so the rendered slide no longer
|
| 4 |
-
// contains the 💬 comment button or the inline comment panel. We also neutralize
|
| 5 |
-
// the comment toggle/submit helpers as a safety net. This is an additive override
|
| 6 |
-
// loaded AFTER app_v2.js, so the rest of the app is untouched.
|
| 7 |
-
(function(){
|
| 8 |
-
function stripComments(htmlStr){
|
| 9 |
-
try{
|
| 10 |
-
var wrap=document.createElement('div');
|
| 11 |
-
wrap.innerHTML=htmlStr;
|
| 12 |
-
// 1) Remove the 💬 comment button (its onclick calls toggleComments).
|
| 13 |
-
wrap.querySelectorAll('.tiktok-right-btn').forEach(function(btn){
|
| 14 |
-
var oc=btn.getAttribute('onclick')||'';
|
| 15 |
-
if(oc.indexOf('toggleComments')!==-1) btn.remove();
|
| 16 |
-
});
|
| 17 |
-
// 2) Remove the inline comments container(s).
|
| 18 |
-
wrap.querySelectorAll('.inline-comments').forEach(function(p){p.remove();});
|
| 19 |
-
return wrap.innerHTML;
|
| 20 |
-
}catch(e){return htmlStr;}
|
| 21 |
-
}
|
| 22 |
-
function install(){
|
| 23 |
-
if(typeof window.buildTikTokSlide!=='function') return false;
|
| 24 |
-
if(window.buildTikTokSlide._noComments) return true;
|
| 25 |
-
var orig=window.buildTikTokSlide;
|
| 26 |
-
var wrapped=function(opts){ return stripComments(orig(opts)); };
|
| 27 |
-
wrapped._noComments=true;
|
| 28 |
-
window.buildTikTokSlide=wrapped;
|
| 29 |
-
// Neutralize comment helpers so nothing tries to open/post comments.
|
| 30 |
-
window.toggleComments=function(){};
|
| 31 |
-
window.submitInlineCmt=function(){};
|
| 32 |
-
return true;
|
| 33 |
-
}
|
| 34 |
-
// app_v2.js defines buildTikTokSlide at parse time; try now, then retry briefly
|
| 35 |
-
// in case of script-order races.
|
| 36 |
-
if(!install()){
|
| 37 |
-
var tries=0;
|
| 38 |
-
var t=setInterval(function(){
|
| 39 |
-
tries++;
|
| 40 |
-
if(install()||tries>50) clearInterval(t);
|
| 41 |
-
},100);
|
| 42 |
-
}
|
| 43 |
-
})();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|