Spaces:
Running
Running
remove: neutralize wc_shorts_inject.js
Browse files- static/wc_shorts_inject.js +1 -76
static/wc_shorts_inject.js
CHANGED
|
@@ -1,76 +1 @@
|
|
| 1 |
-
/
|
| 2 |
-
* WC Shorts Inject — Chạy SAU app_v2.js
|
| 3 |
-
* Tự tạo anchor DIV rồi render WC Shorts slide TRÊN World Cup section
|
| 4 |
-
*/
|
| 5 |
-
(function(){
|
| 6 |
-
'use strict';
|
| 7 |
-
|
| 8 |
-
function inject(){
|
| 9 |
-
// Tìm WC section
|
| 10 |
-
const wcSection = document.getElementById('wc2026-live-section');
|
| 11 |
-
const homeEl = document.getElementById('view-home');
|
| 12 |
-
if(!homeEl) return;
|
| 13 |
-
|
| 14 |
-
// Đã inject?
|
| 15 |
-
if(document.getElementById('wc-shorts-slide-section')) return;
|
| 16 |
-
|
| 17 |
-
// Đảm bảo renderWCSSlideSection đã load
|
| 18 |
-
if(typeof renderWCSSlideSection !== 'function'){
|
| 19 |
-
// Chờ rồi thử lại
|
| 20 |
-
setTimeout(inject, 500);
|
| 21 |
-
return;
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
// Tạo container rồi render vào
|
| 25 |
-
const div = document.createElement('div');
|
| 26 |
-
div.id = 'wc-shorts-slide-container-tmp';
|
| 27 |
-
div.style.display = 'none';
|
| 28 |
-
|
| 29 |
-
// Insert TRƯỚC WC section, hoặc vào đầu home
|
| 30 |
-
if(wcSection && wcSection.parentNode){
|
| 31 |
-
wcSection.parentNode.insertBefore(div, wcSection);
|
| 32 |
-
} else {
|
| 33 |
-
homeEl.insertBefore(div, homeEl.firstChild);
|
| 34 |
-
}
|
| 35 |
-
|
| 36 |
-
// Render slide section vào div
|
| 37 |
-
renderWCSSlideSection(div);
|
| 38 |
-
|
| 39 |
-
// Bỏ wrapper thừa, di chuyển section ra đúng vị trí
|
| 40 |
-
const section = div.querySelector('.wc-shorts-slide-section');
|
| 41 |
-
if(section){
|
| 42 |
-
section.id = 'wc-shorts-slide-section';
|
| 43 |
-
if(wcSection && wcSection.parentNode){
|
| 44 |
-
wcSection.parentNode.insertBefore(section, wcSection);
|
| 45 |
-
}
|
| 46 |
-
div.remove();
|
| 47 |
-
}
|
| 48 |
-
}
|
| 49 |
-
|
| 50 |
-
// Chạy khi DOM sẵn sàng
|
| 51 |
-
if(document.readyState === 'loading'){
|
| 52 |
-
document.addEventListener('DOMContentLoaded', ()=> setTimeout(inject, 800));
|
| 53 |
-
} else {
|
| 54 |
-
setTimeout(inject, 800);
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
// Cũng chạy sau khi loadHome xong
|
| 58 |
-
const origLoadHome = window.loadHome;
|
| 59 |
-
if(origLoadHome){
|
| 60 |
-
window.loadHome = function(){
|
| 61 |
-
const result = origLoadHome.apply(this, arguments);
|
| 62 |
-
setTimeout(inject, 200);
|
| 63 |
-
setTimeout(inject, 800);
|
| 64 |
-
setTimeout(inject, 2000);
|
| 65 |
-
return result;
|
| 66 |
-
};
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
// Fallback: retry nhiều lần
|
| 70 |
-
let retries = 0;
|
| 71 |
-
const retryIv = setInterval(()=>{
|
| 72 |
-
retries++;
|
| 73 |
-
inject();
|
| 74 |
-
if(retries > 20) clearInterval(retryIv);
|
| 75 |
-
}, 1000);
|
| 76 |
-
})();
|
|
|
|
| 1 |
+
// removed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|