MediaWiki:Registry/ToolboxExtender: Difference between revisions

From CSDMS
No edit summary
Removing all content from page
Line 1: Line 1:
__NOEDITSECTION__ __NOTOC__ 
bookmarks
* {{#imagelink:{{DiggImage}}    |digg:submit?phase=2&url=$titleURI$&title=$title$}}
* {{#imagelink:{{DeliciousImage}}|delicious:post?url=$titleURI$&title=$title$}}


<!-- below is the javascript required to 'fix' the magic words in the URI above -->
<!-- relevant page level variables defined by MediaWiki are: wgArticlePath, wgTitle, wgServer, wgCanonicalNamespace  -->
<html><script>
/* jQuery based
*/
$(document).ready(function() {
  // do stuff when DOM is ready
  fixMagicWords();
});
function fixMagicWords()
{
$("a").filter(".extiw").each(function(i)
  {
    if (/\$title\$/g)
    this.href = fixTitleMagicWord( this.href );
    if (/\$titleURI\$/g)
    this.href = fixTitleUriMagicWord( this.href );
  });
};
function fixTitleMagicWord( href )
{
title = getValidTitle();
return href.replace( /\$title\$/g,  title );
};
function fixTitleUriMagicWord( href )
{
title = getValidTitle();
path = wgArticlePath.replace( /\$1/g, title );
return href.replace( /\$titleURI\$/g, wgServer + path );
};
function getValidTitle()
{
title = wgTitle.replace( / /g, '_' );
if (wgCanonicalNamespace.length == 0)
  return title;
else
  return wgCanonicalNamespace + ':' + title;
};
</script></html>

Revision as of 08:51, 11 August 2008