So what is Greasemonkey ?
Ok whats next ?
Now what is this userscript ?
userscript is plain javascript code file nothing special. You can use all the features of javascript in userscript. There are few more function provided by Greasemonkey, you can find the list here Greasemonkey Manual:API
Lets start My First Greasemonkey User Script
To create new script right click on “monkey” face and then select New User Script and popup will come up as shown below. enter all the details as shown below in the image and click on ok.
1 2 3 4 5 6 |
// ==UserScript== // @name myFirstScript // @namespace https://amitpatil.me/ // @description This is my first greasemonkey script // @include https://amitpatil.me/* // ==/UserScript== |
Now add below javascript to it and save the page
or Install it directly from here myfirstscript.user.js
1 2 3 |
var urname = prompt ("What is your Name ?",""); if(urname != null && urname != "") document.title = urname+"'s Personal Blog"; |
Full source code should look like this
1 2 3 4 5 6 7 8 9 |
// ==UserScript== // @name myFirstScript // @namespace https://amitpatil.me/ // @description This is my first greasemonkey script // @include https://amitpatil.me/* // ==/UserScript== var urname = prompt ("What is your Name ?",""); if(urname != null && urname != "") document.title = urname+"'s Personal Blog"; |
Now we are done with our first greasemonkey script. Now lets test it 😉
To see it in action Refresh the firefox
it will ask for “What is your Name ?” enter your name and click “ok”.
see what happened ? look at title bar of window as shown in image below.
Its not my blog anymore…its your blog now 🙂 🙂 🙂
Just 2 lines of javascript gifted this blog to you. Isn’t it fun ???
[…] of all you install greasemonkey . If you haven’t done this before then you should read this getting started with greasemonkey tutorial. This script adds button just below the video, now you want to check if this video is really real […]