WikiApiary:Bookmarklet

This bookmarklet can be used to easily add websites to WikiApiary.

 javascript:q=location.href;p=document.title.replace(/[\/\#\<\>\[\]\|\{\}]/g,"-");a=d='';if(document.querySelector){link=document.querySelector('link[rel="EditURI"]');if(link){a=(link.href).split("?")[0];}}if(document.getSelection){d=document.getSelection;}void(open('https://wikiapiary.com/wiki/Special:RunQuery/Bookmarklet'+'?Bookmarklet%5BURL%5D='+encodeURIComponent(q)+'&Bookmarklet%5BAPI%20URL%5D='+encodeURIComponent(a)+'&Bookmarklet%5BName%5D='+encodeURIComponent(p)+'&Bookmarklet%5BDescription%5D='+encodeURIComponent(d)+'&wpRunQuery=true','Add%20to%20WikiApiary'));

When you find a wiki that you want to add to WikiApiary, you can highlight the text that describes the wiki, and then activate the bookmarklet. The name of the window, URL in the location bar and the text you have highlighted will be used to pre-populate the form to add a new wiki. If the wiki provides a  attribute the API URL will also be pre-populated.

Expanded Code
This is the same code as above, but with spaces and newlines in place to make it easier to read and edit.

javascript: q = location.href; p = document.title.replace(/[\/\#\<\>\[\]\|\{\}]/g,"-"); a = d = ''; if (document.querySelector) { link = document.querySelector('link[rel="EditURI"]'); if (link) { a = (link.href).split("?")[0]; } }  if (document.getSelection) { d = document.getSelection; } void(open('https://wikiapiary.com/wiki/Special:RunQuery/Bookmarklet' + '?Bookmarklet%5BURL%5D=' + encodeURIComponent(q) + '&Bookmarklet%5BAPI%20URL%5D=' + encodeURIComponent(a) + '&Bookmarklet%5BName%5D=' + encodeURIComponent(p) + '&Bookmarklet%5BDescription%5D=' + encodeURIComponent(d) + '&wpRunQuery=true', 'Add%20to%20WikiApiary'));

To Do

 * Automatically get API URL from EditURI link.
 * Instead of going directly to the edit form, go to a query form that will search to see if any wikis exist on this domain name. Provide a link in that querypage that will then allow the form to be activated with the fields populated.
 * Only relatively modern MediaWiki installs report EditURI. Older versions have link references in the head element pointing to index.php, which could reliably predict api.php. If EditURI is not present the bookmarklet could attempt to find index.php and assume that path for api.php.