Skip to content

Instantly share code, notes, and snippets.

@dnaber-de
Last active November 9, 2016 13:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dnaber-de/8767849 to your computer and use it in GitHub Desktop.
Save dnaber-de/8767849 to your computer and use it in GitHub Desktop.
A bookmarklet which brings you directly from a wordpress.org plugin page to the svn repository on plugins.svn.wordpress.org.
(function(){var b=document.location.href,a=document.createElement('a'),path=[],protocol='http';a.href=b;path=a.pathname.split('/');if('https:'==a.protocol){protocol='https'}if('wordpress.org'!=a.hostname||'undefined'==typeof path[1]||''==path[1]||'plugins'!=path[1]||'undefined'==typeof path[2]||''==path[2]){alert('It seems you are not facing a wordpress plugin page. The URL must match: worpress.org/plugins/{PLUGIN_NAME}');return}document.location.href=protocol+'://plugins.svn.wordpress.org/'+path[2]+'/trunk/'})();
( function() {
var
url = document.location.href,
a = document.createElement( 'a' ),
path = [],
protocol = 'http';
a.href = url;
path = a.pathname.split( '/' );
if ( 'https:' == a.protocol ) {
protocol = 'https';
}
if (
'wordpress.org' != a.hostname
|| 'undefined' == typeof path[ 1 ] || '' == path[ 1 ] || 'plugins' != path[ 1 ]
|| 'undefined' == typeof path[ 2 ] || '' == path[ 2 ]
) {
alert( 'It seems you are not facing a wordpress plugin page. The URL must match: worpress.org/plugins/{PLUGIN_NAME}' );
return;
}
document.location.href = protocol + '://plugins.svn.wordpress.org/' + path[ 2 ] + '/trunk/';
} )();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment