Showing posts with label greasemonkey. Show all posts
Showing posts with label greasemonkey. Show all posts

Sunday, 18 December 2016

Greasemonkey script to dim white background webpages in Firefox

Background

In some of the previous posts we saw some greasemomkey scripts -
 This is a similar script.

Bright white pages strain your eyes. I love dark black/grey themes and they dont strain your eyes as well. So was looking out for an addon to do this.
Chrome has a beautiful addon called -
Unfortunately there is no such good plugin available on Firefox. Hence this script. You can configure RGB to the background color you wish to have. The script will be executed when your DOM(Document object model) is loaded.

Greasemonkey script to dim white background webpages in Firefox

I am not going to paste the code here. It is available on my Github gists page -
Feel free to fork it and change it as per you need. Google homepage looks like below post this change -


It has sort of greyish background.


NOTE : This is not a script originally written by me. I have just modified it to suit my needs. Feel free to edit it and use as per your requirements.

Related Links

Saturday, 11 June 2016

Greasemonkey script to replay Youtube videos once they finish

Background

In one of the previous post we saw a Greasemonkey script to block Game of thrones spoiler on facebook.  In this post we will see Greasemonkey script to replay Youtube videos once they finish. And we will see how to do this from very beginning including installing the plugin.



Setup

First step is to install the  Greasemonkey  plugin in firefox. There is a similar plugin in chrome called Tampermonkey. For demo purposes we will use firefox. So go ahead and install the plugin. URL is -




Once installed you can see it's icon besides navigation bar. There you can click to create a new user script -



Then you should see a window where you can create your script.



You can find the actual script on my github account - 

Related Links

Sunday, 29 May 2016

Greasemonkey script to block Game of Thrones spoilers

Background

Greasemonkey is a Firefox plugin that runs user scripts just like tampermonkey in chrome. In this post we will see a simple script that will blacklist certain words appearing in Game of thrones which will potentially be spoilers.


Greasemonkey script to block Game of Thrones spoilers

Script is as follows -


// ==UserScript==
// @name           Spoiler Killer
// @include        http://*.facebook.com/*
// @include        https://*.facebook.com/*
// @require        http://code.jquery.com/jquery-1.7.1.min.js
// @require        https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant          none
// @version 1
// @namespace http://opensourceforgeeks.blogspot.in/
// @description Blacken facebook posts possibly containing Game of Thrones spoilers.
// copied from https://gist.github.com/vshivam/94d18c5d652217a449a5b785cbda1073
// ==/UserScript==

(function(){
    var terms = ['spoiler', 'game of thrones', 'hodor', 'jon snow', 'khaleesi', 'stark', 'dothraki'];
    function actionFunction(node){
        var content = node.html();
        content = content.toLowerCase();
        $.each(terms, function(index, term){
            if(content.indexOf(term) > -1){
                var overlay = $('<div />' ).css({
                     position: "absolute",
                     width: "100%",
                     height: "100%",
                     left: 0,
                     top: 0,
                     zIndex: 1000000,
                     background: "#000000",
                 });
                (function(overlay, node){
                    overlay.appendTo(node.css("position", "relative"));
                    $(node).on("mouseenter", function(){
                        overlay.hide();
                    });
                    $(node).on("mouseleave", function(){
                        overlay.show();
                    });
                })(overlay, node);
            }
        });
    }
    waitForKeyElements("div.userContentWrapper", actionFunction);
})();


NOTE : This script is copied over from https://gist.github.com/vshivam/94d18c5d652217a449a5b785cbda1073.  It's original version can be found at https://gist.github.com/vshivam/9080a0b5ece35689163ed12955c131a9 (simply replaces text)

Script essentially blackens the posts that contain spoiler words. Feel free to add/remove words as you choose suitable. Make sure that the script is running on the site you intend it to be. You can test that from  Greasemonkey icon near URL bar. See following screenshot for details -




Related Links


t> UA-39527780-1 back to top