Annoying popups on NationalMemo.com
A friend posted a link to an article on NationalMemo.com. I went ahead and clicked the link because I was interested in the article, even though I absolutely hate NationalMemo.com’s website.
If you go to NationalMemo.com, you’ll encounter one of their annoying popups (click to embiggen)
Why do I hate NationalMemo.com? Because of their stupid popups.
I might be more inclined to sign one of National Memo’s petitions if there were a link to it in a box next to the article, but by completely obscuring the web page, I am not only disinclined to sign their petition but I’m also disinclined to even visit their poorly thought out website at all.
And I’m not the only person who thinks this.
If you’re not a web developer, or if you think National Memo’s just not worth the bother, the solution is just that—no longer clicking on links going to NationalMemo.com.
However, tools are available to make NationalMemo.com stop its rude behavior, and doing so really doesn’t take long.
What do you need? Greasemonkey, an add-on for Mozilla Firefox that allows you to add your own bits of JavaScript to any web page you visit, in order to change its appearance or behavior.
If you use Google Chrome, you can try TamperMonkey; it’s supposed to be Greasemonkey UserScript-compatible, but I’ve not tried it myself. If you use Microsoft IE, you can try IE7Pro, but why are you using IE? (Yes, my NationalMemo.com screenshot was done with IE, but that’s because I have Adblock Plus (Firefox) / Adblock Plus (Chrome) installed in the browsers I regularly use, and so the popup National Memo tries to force on me is just blank in those browsers.)
Then you just need to create a quick UserScript for NationalMemo.com. Looking at the source of a NationalMemo.com page, you can see that they have a JavaScript function named lbx_show_lightbox_custom() that displays their popup (which they call a “lightbox”). With the power of Greasemonkey, we can replace NationalMemo.com’s lbx_show_lightbox_custom() function and no longer see their stupid popup.
To figure out how to do this, I googled around some for replacing javascript using Greasemonkey, and I found this very helpful page by Squak Mountain Consulting that explained how to do exactly what I wanted.
Using Squak’s example, I came up with the following UserScript:
// ==UserScript==
// @name DisableNationalMemo_lightbox
// @namespace http://www.davidlauri.com/
// @description Turn off the annoying lightbox that National Memo displays
// @include http://www.nationalmemo.com/*
// @version 1
// ==/UserScript==
// set up the javascript function we want to replace
var scriptCode = new Array();
scriptCode.push('function lbx_show_lightbox_custom(){');
scriptCode.push(' return false;');
scriptCode.push('}');
// put the script in a new script element into the DOM
var script = document.createElement('script'); // create the script element
script.innerHTML = scriptCode.join('\n'); // add the script code to it
scriptCode.length = 0; // recover the memory we used to build the script
// find the first <head> tag on the page and then add the new script just below it
document.getElementsByTagName('head')[0].appendChild(script);
A hint for testing this script on NationalMemo.com is that you should find and delete your NationalMemo.com cookies. They only do their stupid popup once (per day? per week? I don’t know), so if you visit their site first and then set up the UserScript, you won’t actually know if it’s their site deciding that you’ve already seen their stupid popup or if it’s your UserScript disabling their lightbox function.
Was it really worth the time it took to deal with NationalMemo.com’s stupid popup? Probably not, but I had fun finding a solution.
|