Category: greasemonkey

Greasemonkey

Posted by on July 19, 2006 | No comments

Quick greasemonkey script to change links to community.livejournal.com/commname to commname.livejournal.com. Based off the “Always link to full LiveJournal userinfo” script.

Probably doesn’t take into account a bunch of stuff…

// ==UserScript==
// @name          Change community.livejournal.com/commname ... to commname.livejournal.com
// @namespace    http://livejournal.arricc.net/
// @description  Modify links to LJ communities
// @include      http://*.livejournal.com/*
// ==/UserScript==
(function(){
  var commRegEx = /^(http:\/\/community\.livejournal\.com)?\/([^/]+)(\/)?(.*)/i;
  var l = document.getElementsByTagName("a");
  for (var cand = null, i = 0; (cand = l[i]); i++) {
    uim = commRegEx.exec(cand.getAttribute('href'));
    if (uim != null) {
      cand.setAttribute('href','http://' + uim[2] + '.livejournal.com/' + uim[4]);
    }
  }
})();

Download: changecommunitylivejourn.user.js

If you find this article useful, buy me a beer!

Tags: , , ,

Powered by Wordpress and Stripes Theme Entries (RSS) | Comments (RSS)