From: Alexander Butenko Date: Thu, 14 Jan 2010 01:19:38 +0000 (+0100) Subject: Use a script to hide images and frames that are blocked X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb4c381b4339ba865db3affdcfa3a6fb7e401839;p=midori Use a script to hide images and frames that are blocked --- diff --git a/extensions/adblock.c b/extensions/adblock.c index 46ca3087..6abeeb1e 100644 --- a/extensions/adblock.c +++ b/extensions/adblock.c @@ -636,6 +636,36 @@ adblock_is_matched (const gchar* opts, return adblock_is_matched_by_pattern (req_uri, page_uri); } +static gchar* +adblock_prepare_urihider_js (const gchar* uri) +{ + const char *js = + "(function() {" + "function getElementsByAttribute (strTagName, strAttributeName, strAttributeValue) {" + " var arrElements = document.getElementsByTagName (strTagName);" + " var arrReturnElements = new Array();" + " for (var i=0; i 0 && strAttributeValue.indexOf (oAttribute) != -1)" + " arrReturnElements.push (oCurrent);" + " }" + " return arrReturnElements;" + "}" + "function hideElementBySrc (strUri) {" + " var oElements = getElementsByAttribute('img', 'src', strUri);" + " if (oElements.length == 0)" + " oElements = getElementsByAttribute ('iframe', 'src', strUri);" + " for (var i=0; i