Created
February 23, 2016 20:43
-
-
Save piotrek-k/962ef2499052e90c68fe to your computer and use it in GitHub Desktop.
Tampermonkey script to change all images to funny horses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name HorseChrome | |
// @namespace http://tampermonkey.net/ | |
// @version 21.37 | |
// @description Skrypt zmieniania obrazków na wszystkich stronach www na obrazki z koniem | |
// @match http://tampermonkey.net/index.php?version=3.12.58&ext=dhdg&updated=true#features | |
// @grant none | |
// ==/UserScript== | |
/* jshint -W097 */ | |
'use strict'; | |
var listaObrazkowDoWstawienia = [ | |
"http://streemo.pl/Image/469256_m.jpg", | |
"http://i.wp.pl/a/f/jpeg/24489/kon580.jpeg", | |
"http://konisie-i-inne.blog.pl/files/2013/08/humor4.jpg" | |
]; | |
var images = document.getElementsByTagName('img'); | |
for(var i = 0; i < images.length; i++) { | |
var numerObrazkaDoWyswietlenia = Math.floor(Math.random()*listaObrazkowDoWstawienia.length); | |
//console.log("wylosowany numer:" + numerObrazkaDoWyswietlenia); | |
var divZKoniem = document.createElement("div"); | |
divZKoniem.style.width= images[i].width+"px"; | |
divZKoniem.style.height= images[i].height+"px"; | |
divZKoniem.style["background"] = "url('"+listaObrazkowDoWstawienia[numerObrazkaDoWyswietlenia]+"')"; | |
divZKoniem.style["background-size"] = "cover"; | |
divZKoniem.style["background-position"] = "center"; | |
divZKoniem.style["background-repeat"] = "no-repeat"; | |
images[i].parentNode.replaceChild(divZKoniem, images[i]); | |
//console.log(divZKoniem); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment