Jump to content

උදවු:ඉඟි සහ උප්පරවැට්ටි/Bookmarklets

Wiktionary වෙතින්
See also: Wiktionary:Bookmarklets - some supplemental bookmarklets.

What is a bookmarklet? Usually, it is a piece of JavaScript that is meant to be pasted into your browser's url bar. Instead of cutting-n-pasting it every time, it is useful to create a bookmark (or favourite) containing the code. That is, instead of making a bookmark pointing to, for instance, http://en.wiktionary.org, point it to any of the following codes. For them to work, make sure JavaScript is enabled in your browser.

[සංස්කරණය]

This does two things:

  • When on any webpage, select a word and then hit the bookmarklet. It should take you to the Wiktionary page for that word. This may or not work, depending on the website. It should definitely work on any Wikimedia site.
  • If no word is selected, a pop-up window appears, letting you enter one instead.

For Internet Explorer:

javascript:(function(){q=document.selection.createRange().text;if(!q)q=prompt('Wiktionary:',''); if(q)location.href='http://en.wiktionary.org/w/wiki.phtml?search='+escape(q);})()

For Mozilla Firefox:

javascript:(function(){q=window.getSelection().toString();if(!q)q=prompt('Wiktionary:'); if(q)location.href='http://en.wiktionary.org/w/wiki.phtml?search='+encodeURI(q);})()

For Safari:

javascript:void(q=prompt('Wiktionary:',getSelection())); if(q)void(location.href='http://en.wiktionary.org/w/wiki.phtml?search='+escape(q))

NB: a browser-agnostic version can and should be derived from the code at http://en.wikipedia.org/wiki/Bookmarklet#Example instead.

On Wiktionary, the following bookmarklets will change all wikilinks on a page to any of the variants in the url. These should work in most browsers.

Edit page

Example: will change a link language to language?action=edit.

javascript:(function(){var x,i; x=document.links;for(i=0;i<x.length;++i) { if (/wiki/.test(x[i].href)) {z=x[i].href.match(/[^\/]+$/);x[i].href=%22/wiki/%22+z+%22?action=edit%22; };}})();
History page

Example: will change a link language to language?action=history.

javascript:(function(){var x,i; x=document.links;for(i=0;i<x.length;++i) { if (/wiki/.test(x[i].href)) {z=x[i].href.match(/[^\/]+$/);x[i].href=%22/wiki/%22+z+%22?action=history%22; };}})();
Watch

Example: will change a link language to language?action=watch.

javascript:(function(){var x,i; x=document.links;for(i=0;i<x.length;++i) { if (/wiki/.test(x[i].href)) {z=x[i].href.match(/[^\/]+$/);x[i].href=%22/wiki/%22+z+%22?action=watch%22; };}})();
Delete (for sysops)

Example: will change a link language to language?action=delete.

javascript:(function(){var x,i; x=document.links;for(i=0;i<x.length;++i) { if (/wiki/.test(x[i].href)) {z=x[i].href.match(/[^\/]+$/);x[i].href=%22/wiki/%22+z+%22?action=delete%22; };}})();
Protect (for sysops)

Example: will change a link language to language?action=protect.

javascript:(function(){var x,i; x=document.links;for(i=0;i<x.length;++i) { if (/wiki/.test(x[i].href)) {z=x[i].href.match(/[^\/]+$/);x[i].href=%22/wiki/%22+z+%22?action=protect%22; };}})();