User Tools

Site Tools


tools

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tools [2008/01/17 12:57]
127.0.0.1 external edit
tools [2010/06/01 12:40] (current)
robm
Line 28: Line 28:
  
 **NB:** This also removes the ability to show thumbnails (mini-thumbnails on a folder icon do still appear to work though, but that might be cached) **NB:** This also removes the ability to show thumbnails (mini-thumbnails on a folder icon do still appear to work though, but that might be cached)
 +
 +===== Firefox Magic =====
 +==== GreaseMonkey ====
 +=== Convert Javascript links to ordinary links ===
 +
 +I hate websites which use ''​href='​javascript:​window.document.href='​...'''​ in their ''<​a>​..<​a/>''​ tags when an ordinary link would do! You can't middle-click JS links into new tabs!
 +
 +Here's a script which fixed this for me:
 +
 +<code javascript>​
 +// ==UserScript==
 +// @name           ​Rewrite JS URLs to ordinary URLs
 +// @namespace ​     myscripts
 +// @include ​       http://​www.example.com/​silly_web_2.0/​*
 +// @require ​       http://​ajax.googleapis.com/​ajax/​libs/​jquery/​1.2.6/​jquery.js
 +// ==/​UserScript==
 +
 +$(document).ready(function() {  ​
 +        $("​a[href]"​)
 +            .each(function(index,​ domElement){
 +                var jObj = $(this)
 +                var rHref = jObj.attr("​href"​);​
 +                if( rHref.match(/​^javascript:​window.document.location='​[^'​]*'​$/​) ) {
 +                    rHref = rHref.replace(/​^javascript:​window.document.location='/,​ ""​);​
 +                    rHref = rHref.replace(/'​$/,​ ""​);​
 +                    jObj.attr("​href",​ rHref);
 +                }
 +            })
 +        ;
 +});
 +</​code>​
 +
 +You need to replace @include to match the URLs you want the script applied to, and you probably want to change the namespace to better suite your personal organisation of greasemonkey scripts.
 +
 +
tools.txt · Last modified: 2010/06/01 12:40 by robm