📜 ⬆️ ⬇️

Opera user scripts

In the opera there is a great opportunity to add your scripts to a specific site or to all. So you can remove the banners from the site. You can also block content, but only pictures and flash, so it's better through js.
For example, with a habr:

< script >
function fuck_banner () {
if (! document .getElementById ( 'footer' )) {
return ;
}
$ clear (fb_int);

$$ ( '.banner' ) .each ( function (el) {
el.setStyle ( 'display' , 'none' );
});

if ($ ( 'main-page' ) .getElement ( 'object' )) {
$ ( 'main-page' ). getElement ( 'object' ) .setStyle ( 'display' , 'none' );
} else {
var a_banner = $ ( 'main-page' ). getElement ( 'a' );
if (a_banner.href! = 'http://habrahabr.ru' ) {
$ ( 'main-page' ). getElement ( 'a' ) .setStyle ( 'display' , 'none' );
}
}
}
')
var fb_int = setInterval ( "fuck_banner ();" , 1000);
</ script >

* This source code was highlighted with Source Code Highlighter .


Or connect a script to all pages to integrate with Google Reader. If there are feeds on the page, by pressing the button - `(g) the google reader page opens.
< script >
setTimeout ( "set_key_controller ();" , 1010);
function set_key_controller () {
if (! document .getElementsByTagName ( 'head' ) .length) {
setTimeout ( "set_key_controller ();" , 1010);
return ;
}
var links = document .getElementsByTagName ( 'link' );
for ( var n = 0; n <links.length; n ++) {
if (links [n] .type == 'application / rss + xml' ) {
feed_url = links [n] .href;
document .getElementsByTagName ( 'body' ) [0] .onkeydown = 'key_controller ()' ;
return ;
}
}
}

function key_controller () {
// 192 and 1025 - correspond to the button `(g)
if ( event .keyCode == 192 || event .keyCode == 1025) {
var url = 'http://www.google.com/reader/view/feed/' + feed_url;
window.open (url, '' , 'resizable = yes, location = no, menubar = no, scrollbars = yes, status = no, toolbar = no, fullscreen = no, dependent = no, width = 1015, height = 600, left = 100, top = 100, status' );
}
}
</ script > This code was highlighted with Source Code Highlighter .

(for some reason does not work on Habré)

Source: https://habr.com/ru/post/37870/


All Articles