User javascript to fix external links in Wiki

Hi. In our Wiki, external links annoy, by stopping one extra time at a
page, saying "You're leaving Wikia". The attached javascript fixes
it. It's a greasemonkey script for firefox.

Save it as "outbound.user.js" (The leading part doesn't matter.)
First I sent it with that name, but our mailer daemon refused it.

Greasemonkey is a firefox addon that lets you add your own
javascripts, working as a "miniature add-on".

Well, if you know Javascript well, it must be easy, but I don't.

Teika (Teika kazura)

// ==UserScript==
// @name          Wikia Outbound Fix
// @namespace
// @description   Get rid of an annoying stop of Wikia's external links.
// @include*
// ==/UserScript==

// Adblock Plus is recommendable, too.

(function () {
    // Only get external links
    var allLinks = document.getElementsByClassName('external');

    for (var i = 0; i < allLinks.length; i++) {

	allLinks[i].href = allLinks[i].href.replace(/^http.*http%3a%2f%2f/i, 'http://');
	allLinks[i].href = allLinks[i].href.replace(/%2f/gi, "/");

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]