Zocky's javascript tools
- Picture Popups - the Javascript tool that makes clicking on image thumbnails work As Nature Intended. users Now for Vector! users
- Search Box - search and replace in the edit box. users
- Auto Complete - auto complete titles of articles in the search input box on the left. users
- Link Complete - auto complete titles of articles when typing links in the edit box. users
Search Box is a Javascript tool which adds a search and replace box above the editbox. users
Click the search icon in the toolbar or press Alt-Shift-F (or Meta-Shift-F) to get the SearchBox. See Installation below.
Features
edit- Search and replace terms one at a time, forward or backward.
- Replace all occurrences of the search term at once. This feature operates inside selected text, otherwise it covers the entire edit box.
- Search term expressions that understand a list of special characters which help pinpoint accurate targets when choosing to "Replace all" of them. They form the standard, universal regular expressions of JavaScript, as compiled for reference by the Mozilla Contributors. (Group references can be made with the '$' prefix for $1, $2, $3, ...$9.)
- Case sensitive or case insensitive searches.
Issues
edit- The tool overrides the "edit box has full width" setting in preferences, under editing. This will probably shrink your edit box in width. Unfortunately, it seems that it's necessary for the tool to be able to show the found text in the textbox. A partial workaround is to increase the size of the editing window at Preferences → Editing, to have more columns .
- The found text may sometimes still be outside the edit box. Scroll up and down a bit to find it.
Installation
editYour four choices of Wikipedia skin at Special:Preferences, in the second tab (Appearance), each have there own "Custom JavaScript" file and "Custom CSS" file. (Those will be red links if that skin has not been modified from the original.) We will be using custom JavaScript. The custom JavaScript file ends in ".js". The Monobook skin, for example, links to Special:Mypage/monobook.js, and for the Classic skin you would be editing Special:Mypage/standard.js, etc.
Copy and paste the following line into the ".js" (JavaScript) file for your skin:
{{subst:User:Zocky/searchBox}}
Save the file. You will notice that this line is automatically substituted (replaced) when the file is saved, and new version is displayed, showing:
document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Zocky/searchBox.js' + '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
Those lines are the expected results of the earlier substitution, which is permanent. (There may be other parts not shown that are comments, starting with "//
" characters, which may also install alongside their associated code.)
Now, the edit page will have over the top left of it "Search/Replace Toggle Case", two links which activate the JavaScript dialog box you just installed. If not, reload the page in your browser in the usual way, or clear your cache, and the new icon should appear.
To uninstall the script delete only the lines you saw above, or just "undo" from the page history. A new edit sessions will then not show the icon.
Code
editThe code is available under GPL at User:Zocky/SearchBox.js.