Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

User:Zocky/Search Box

    From Wikipedia, the free encyclopedia
    <User:Zocky

    Zocky's javascript tools

    Search Box is aJavascript 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, universalregular 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 atPreferences →Editing, to have morecolumns .
    • The found text may sometimes still be outside the edit box. Scroll up and down a bit to find it.

    Installation

    [edit]

    Your four choices of Wikipedia skin atSpecial:Preferences, in the second tab (Appearance), each have there own "Custom JavaScript" file and "Custom CSS" file. (Those will bered links if that skin has not been modified from the original.) We will be usingcustom JavaScript. The custom JavaScript file ends in ".js". The Monobook skin, for example, links toSpecial:Mypage/monobook.js, and for the Classic skin you would be editingSpecial: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 arecomments, 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, orclear your cache, and the new icon should appear.

    To uninstall the scriptdelete only the lines you saw above, or just "undo" from the page history. A new edit sessions will then not show the icon.

    Code

    [edit]

    The code is available under GPL atUser:Zocky/SearchBox.js.


    Retrieved from "https://en.wikipedia.org/w/index.php?title=User:Zocky/Search_Box&oldid=1071808235"
    Category:

    [8]ページ先頭

    ©2009-2025 Movatter.jp