Reputation: 2961
I want to be able to add a pre-defined set of images onto various websites in FireFox - this is to enable a personal extension to work.
I think I should be able to do this in GreaseMonkey - can anyone confirm if I am looking in the right direction before I go further down this road?
Thanks!
Upvotes: 1
Views: 3723
Reputation: 93473
Yes, you can do this in a variety of ways.
Here's a complete working script to get you started:
// ==UserScript==
// @name _Add an image to a web page
// @include http://stackoverflow.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js
// ==/UserScript==
$("body").append (
'<img id="myNewImage" src="http://i37.photobucket.com/albums/e77/kpeaton/unicorn.jpg">'
);
$("#myNewImage").css ( {
position: "fixed",
width: "128px",
height: "128px",
top: "0",
left: "0"
} );
Upvotes: 3