גרסת סקריפט טמפרמונקי למעוניינים:
// ==UserScript==
// @name SmartBlock PRO - Tampermonkey Edition
// @namespace http://tampermonkey.net/
// @version 1.7.1
// @description חסימת פרסומות באתרי חדשות ישראלים עם ממשק שליטה מותאם לטמפרמונקי
// @author SmartBlock PRO (Ported)
// @match *://*.prog.co.il/*
// @match *://*.kore.co.il/*
// @match *://*.emess.co.il/*
// @match *://*.jdn.co.il/*
// @match *://*.93fm.co.il/*
// @match *://*.kcm.fm/*
// @match *://*.hm-news.co.il/*
// @match *://*.babli.co.il/*
// @run-at document-start
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_registerMenuCommand
// @grant GM_addStyle
// ==/UserScript==
(function() {
'use strict';
// ==========================================
// זיהוי האתר הנוכחי והגדרות מפתח
// ==========================================
const currentHost = window.location.hostname || '';
const BLOCK_RULES_API_URL = 'https://next-js-chrome-exten-30q4.bolt.host/api/block-rules';
let siteKey = '';
let siteName = '';
if (currentHost.includes('prog.co.il')) { siteKey = 'prog'; siteName = 'פרוג'; }
else if (currentHost.includes('jdn.co.il')) { siteKey = 'jdn'; siteName = 'JDN'; }
else if (currentHost.includes('kore.co.il')) { siteKey = 'kore'; siteName = 'כל רגע'; }
else if (currentHost.includes('emess.co.il')) { siteKey = 'emess'; siteName = 'קול חי'; }
else if (currentHost.includes('kcm.fm')) { siteKey = 'kcm'; siteName = 'KCM'; }
else if (currentHost.includes('hm-news')) { siteKey = 'hm-news'; siteName = 'המחדש'; }
else if (currentHost.includes('babli.co.il')) { siteKey = 'babli'; siteName = 'בבלי'; }
else if (currentHost.includes('93fm.co.il')) { siteKey = 'jdn'; siteName = '93FM'; } // fallback
// ==========================================
// מערכת הגדרות (מחליף את ה-Popup)
// ==========================================
const masterProtection = GM_getValue('master_protection', true);
const siteProtection = siteKey ? GM_getValue(siteKey, true) : true;
// רישום תפריטים לטמפרמונקי
GM_registerMenuCommand(`הגנה כללית (Master): ${masterProtection ? 'פעילה 🟢' : 'כבויה 🔴'}`, () => {
GM_setValue('master_protection', !masterProtection);
location.reload();
});
if (siteKey) {
GM_registerMenuCommand(`הגנה באתר זה (${siteName}): ${siteProtection ? 'פעילה 🟢' : 'כבויה 🔴'}`, () => {
GM_setValue(siteKey, !siteProtection);
location.reload();
});
}
// עצירת הסקריפט אם ההגנה כבויה
if (!masterProtection || !siteProtection) {
return;
}
// ==========================================
// המרת חוקי חסימת רשת (rules.json) ל-CSS
// ==========================================
const NETWORK_BLOCK_CSS = `
iframe[src*="advertising.jdn.co.il"], img[src*="advertising.jdn.co.il"],
iframe[src*="clicka1.co.il"], img[src*="clicka1.co.il"],
iframe[src*="ultra.clicka1.co.il"], img[src*="ultra.clicka1.co.il"],
iframe[src*="jobik.co.il"], img[src*="jobik.co.il"],
iframe[src*="a.kikar.co.il"], img[src*="a.kikar.co.il"],
iframe[src*="video_ad"], video[src*="video_ad"]
{ display: none !important; height: 0 !important; visibility: hidden !important; width: 0 !important; }
`;
// ==========================================
// CSS מיידי מובנה (HARDCODED_CSS)
// ==========================================
const HARDCODED_CSS = {
prog: `
.samUnitWrapper, .samCodeUnit, .samItem, .samBannerUnit2, .samUnitContent,
[data-xf-init="sam-unit"], [data-position*="post_below"],
.prog-classifieds-banner-container, ins.adsbygoogle,
iframe[src*="googleads"], iframe[src*="doubleclick"],
div[data-widget-key*="ad_"] {
display: none !important; height: 0 !important; visibility: hidden !important;
}
article.message[data-author="פרוגבוט"],
article.message:has(a[username="פרוגבוט"]) {
display: none !important; height: 0 !important;
pointer-events: none !important; margin: 0 !important; padding: 0 !important;
}
`,
jdn: `
[id^="div-gpt-ad"], .ad-slot, .jdn-ad, iframe[src*="ads"],
.ad-manager-slot, .maavaron, div.banner[role="banner"],
#v-0-0, #v-0-1-0, div[id^="v-0-"],
aside iframe, aside div[id^="v-0-"],
div[ads="true"], .videoadplayer,
.ultracap, .ucapc, .uc1,
div:has(> div > img[src*="clicka1.co.il"]),
div:has(> div > a > img[src*="clicka1.co.il"]),
div:has(> div > .ubtn),
div:has(> div > iframe[src*="jobik.co.il"]),
div[style*="max-width: 1200px"]:has(img[src*="clicka1"]),
figure:has(a > video),
.article-content-inside a > video,
a:has(video[autoplay]),
iframe[src*="advertising.jdn.co.il"] {
display: none !important;
}
.video-js.vjs-ad-playing .vjs-tech,
.video-js.vjs-ad-loading .vjs-tech,
.video-js.vjs-ad-playing .vjs-poster,
.video-js.vjs-ad-loading .vjs-poster {
opacity: 0 !important;
}
.video-js.vjs-ad-playing .preroll-blocker,
.video-js.vjs-ad-playing [class*="preroll"],
.video-js.vjs-ad-playing [class*="skip"] {
opacity: 0 !important;
pointer-events: none !important;
}
`,
babli: `
iframe[src*="a.kikar.co.il"],
iframe[src*="kikar.co.il"],
div:has(> iframe[src*="kikar.co.il"]),
div:has(> iframe[src*="a.kikar.co.il"]),
[class*="kikar-ad"], [id*="kikar-ad"],
.sidebar-ad, .top-ad, .bottom-ad
{ display: none !important; }
`,
'hm-news': `
#top_banner_div, #top_banner_btn,
div[class*="aid-"][class*="zid-"],
[id^="_4q"], [id^="_d6q"],
#NewsItem > div.Scroll > div.video > div > div > div > a:has(video),
a[href*="track.hm-news.co.il"],
img[src*="media.aso1.net"],
iframe[src*="media.hm-news.co.il"] {
display: none !important; height: 0 !important; visibility: hidden !important;
pointer-events: none !important; margin: 0 !important; padding: 0 !important;
}
`
};
// הזרקת CSS מובנה ו-CSS שמבוסס על rules.json
let cssGroupKey = siteKey;
if (['kore', 'jdn', 'emess', 'kcm'].includes(siteKey)) cssGroupKey = 'jdn'; // קיבוץ אתרי JDN
if (cssGroupKey && HARDCODED_CSS[cssGroupKey]) {
GM_addStyle(NETWORK_BLOCK_CSS + "\n" + HARDCODED_CSS[cssGroupKey]);
}
// ==========================================
// חוקי ענן (משיכה משרת מרוחק)
// ==========================================
function applyRemoteRules() {
const ctrl = new AbortController();
const tid = setTimeout(() => ctrl.abort(), 3000);
fetch(BLOCK_RULES_API_URL, { headers: { Accept: 'application/json' }, signal: ctrl.signal })
.then(res => { clearTimeout(tid); return res.ok ? res.json() : null; })
.then(rules => {
if (!Array.isArray(rules)) return;
rules.filter(r => Array.isArray(r.domains) && r.domains.some(d => currentHost.includes(d)))
.forEach(rule => {
if (!rule.site_key || !rule.css_selectors) return;
// בטמפרמונקי אנחנו כבר יודעים שההגנה דולקת (אחרת חזרנו מוקדם)
if (document.getElementById(`sb-dyn-${rule.site_key}`)) return;
GM_addStyle(rule.css_selectors);
});
})
.catch(() => {});
}
setTimeout(applyRemoteRules, 2000);
// ==========================================
// לוגיקת JS לפי אתרים (MutationObservers)
// ==========================================
// ---- PROG ----
if (siteKey === 'prog') {
const obs = new MutationObserver((mutations) => {
for (const { addedNodes } of mutations) {
for (const node of addedNodes) {
if (node.nodeType !== 1) continue;
try {
if (node.classList?.contains('overlay') && node.querySelector('.samItem')) { node.remove(); continue; }
if (node.tagName === 'ARTICLE' && node.innerText?.includes('פרוגבוט')) { node.remove(); continue; }
node.querySelectorAll?.('article.message[data-author="פרוגבוט"]').forEach(b => b.remove());
} catch (_) {}
}
}
});
document.addEventListener("DOMContentLoaded", () => {
obs.observe(document.documentElement, { childList: true, subtree: true });
});
}
// ---- BABLI ----
else if (siteKey === 'babli') {
const AD_SELECTOR = 'iframe[src*="kikar.co.il"], iframe[src*="a.kikar.co.il"]';
function removeBabliAd(iframe) {
try {
let parent = iframe.parentElement;
while (parent && parent !== document.body) {
const children = Array.from(parent.children).filter(c => c.offsetHeight > 0 || c.offsetWidth > 0);
if (children.length === 1 && children[0] === iframe) {
parent.remove();
return;
}
break;
}
iframe.remove();
} catch (_) {}
}
const babliObs = new MutationObserver((mutations) => {
for (const { addedNodes } of mutations) {
for (const node of addedNodes) {
if (node.nodeType !== 1) continue;
try {
if (node.matches?.('iframe') && node.src?.includes('kikar.co.il')) {
removeBabliAd(node); continue;
}
node.querySelectorAll?.(AD_SELECTOR).forEach(removeBabliAd);
} catch (_) {}
}
}
});
document.addEventListener("DOMContentLoaded", () => {
babliObs.observe(document.documentElement, { childList: true, subtree: true });
const cleanBabli = () => { try { document.querySelectorAll(AD_SELECTOR).forEach(removeBabliAd); } catch (_) {} };
setTimeout(cleanBabli, 400);
setTimeout(cleanBabli, 1200);
window.addEventListener('popstate', () => setTimeout(cleanBabli, 250));
});
}
// ---- JDN / KORE / EMESS / 93FM / KCM ----
else if (['kore', 'jdn', 'emess', 'kcm'].includes(siteKey)) {
setInterval(() => {
try {
// VideoJS preroll detection
document.querySelectorAll('.video-js').forEach(player => {
try {
const isAd = player.classList.contains('vjs-ad-playing') || player.classList.contains('vjs-ad-loading');
const video = player.querySelector('video');
if (!isAd) {
delete player.dataset.adSrc;
if (video && video.playbackRate > 4) video.playbackRate = 1;
return;
}
if (!video) return;
if (!video.muted) video.muted = true;
if (!player.dataset.adSrc && video.src) {
player.dataset.adSrc = video.src;
}
if (player.dataset.adSrc && video.src && video.src !== player.dataset.adSrc) return;
if (video.duration && isFinite(video.duration) && video.duration > 0) video.currentTime = video.duration;
if (video.playbackRate < 16) video.playbackRate = 16;
const skipBtn = player.querySelector('[class*="skip" i], [class*="Skip"]');
if (skipBtn) { try { skipBtn.click(); } catch (_) {} }
} catch (_) {}
});
// Flowplayer detection
document.querySelectorAll('.flowplayer').forEach(fpContainer => {
try {
if (fpContainer.classList.contains('is-cva') ||
fpContainer.querySelector('.fv-cva-skip') ||
(fpContainer.querySelector('video') && fpContainer.querySelector('video').src && fpContainer.querySelector('video').src.includes('video_ad'))) {
const nextVideoBtn = fpContainer.parentElement ? fpContainer.parentElement.querySelector('.fp-playlist-external a:nth-child(2)') : null;
if (nextVideoBtn && !nextVideoBtn.classList.contains('is-active')) {
nextVideoBtn.click();
} else {
const v = fpContainer.querySelector('video');
if (v) { v.muted = true; if (v.duration) v.currentTime = v.duration; }
}
}
} catch (_) {}
});
} catch (_) {}
}, 50);
const msObs = new MutationObserver((mutations) => {
for (const { addedNodes } of mutations) {
for (const node of addedNodes) {
if (node.nodeType !== 1) continue;
try {
if (node.className && typeof node.className === 'string' && node.className.toLowerCase().includes('skip')) {
try { setTimeout(() => { if (node.offsetParent !== null) node.click(); }, 100); } catch (_) {}
}
const adVideos = node.querySelectorAll ? node.querySelectorAll('.videoadplayer, div[ads="true"] video') : [];
adVideos.forEach(adVideo => {
try {
adVideo.muted = true;
adVideo.style.display = 'none';
adVideo.dispatchEvent(new Event('ended', { bubbles: true }));
const skipBtn = document.querySelector('.skip-button');
if (skipBtn) skipBtn.click();
} catch (_) {}
});
node.querySelectorAll?.('iframe[src*="advertising.jdn.co.il"], iframe[src*="clicka1.co.il"], div[id^="div-gpt-ad"], .ultracap, .ucapc, .uc1').forEach(el => { try { el.remove(); } catch (_) {} });
} catch (_) {}
}
}
});
document.addEventListener("DOMContentLoaded", () => {
msObs.observe(document.documentElement, { childList: true, subtree: true });
});
}
// ---- HM-NEWS ----
else if (siteKey === 'hm-news') {
const hmObs = new MutationObserver(() => {
try {
document.querySelectorAll('.video a video, a[href*="track.hm-news.co.il"] video').forEach(vid => {
try {
vid.muted = true;
vid.style.display = 'none';
if (vid.parentElement) vid.parentElement.style.display = 'none';
} catch (_) {}
});
} catch (_) {}
});
document.addEventListener("DOMContentLoaded", () => {
hmObs.observe(document.documentElement, { childList: true, subtree: true });
});
}
})();
בהצלחה, ותודה ל @פראירי על העבודה החשובה.