I use JavaScript for a long time, I considered
bookmarklets once for educational purposes, but there was no need to use it.
The idea of writing a bookmarklet came spontaneously: checking email on one of the online servers felt an obvious discomfort caused by the intrusive (variegated and large) flash banner, and this somewhat puzzled me, since advertising is found quite often, sometimes poorly made advertising annoys, but not so much (rather perceived as the surrounding background). The first thought was to find an add-on for the browser (such as Flashblock), and was already going to install, but for various reasons (I use different browsers on several computers, the reluctance to configure and maintain, etc., and not all flash objects provoke on The fact that they were removed) did not feel much enthusiasm for installing such additions, but then I remembered the bookmarklets and wrote simple code that allows me to cope with clearing the page as needed:
(function(tagNameList){for(var j = 0, m = tagNameList.length; j < m; j++){var obj = document.getElementsByTagName(tagNameList[j]); for(var i = 0, n=obj.length; i < n ; i++) {obj[i].style.display = 'none'; }};})(['object','embed','iframe']);
A small comment for beginners:
')
The code is embedded in an anonymous function, see
http://en.wikipedia.org/wiki/Anonymous_function#JavaScriptActual examples for experiments with Anonymous_function:
http://ideone.com/DWtzxhttp://ideone.com/BCZlRAs an argument of an anonymous function, an array of tag names ('object', 'embed', 'iframe') is passed, by which the corresponding objects are searched in the HTML DOM and the objects found become invisible
obj[i].style.display = 'none';
... By changing the contents of this list, you can change the composition of objects to which you want to access.
The complete solution is presented here:
http://jsfiddle.net/ySG6a/Those who want to learn more about the bookmarklets can get acquainted with an extensive collection of articles on this topic on Habré:
http://habrahabr.ru/search/?q=bookmarklet