Setting up your browserEdit
|This section needs to be updated. Please help update this section to reflect recent events or newly available information. Relevant discussion may be found on the talk page.|
How you check the settings depends on your browser:
Adding and deleting scriptsEdit
- By saving the page with only a comment, initially, you're creating a version of the page that you can revert to if something goes wrong. That's extremely unlikely, but it doesn't hurt to have the option.
Adding a scriptEdit
1. Go to the page Wikipedia:WikiProject User scripts/Scripts/User tabs (Figure 21-2), and copy all the text within the dotted box.
2. Open your own common.js page, and then, in the edit box, paste the text that you copied in step 1.
- If you haven't created a common.js page yet, instructions are on the section about creating your common.js page.
3. Change [[User:Where/usertabs]] to [[Wikipedia:WikiProject User scripts/Scripts/User tabs]], to show where you got the script.
- Your edit box should look like Figure 21-3.
- The preview should look like Figure 21-4. If everything looks as you expect (as is the case here, there's no visible change), save the page. If something looks wrong, recheck the code that you added to the page.
5. After you save the change, you should bypass your cache so that Wikipedia isn't using an old version of your common.js (see the section about fixing problems with your user scripts). Then go to a page where you expect the change to appear—for example, click on the "my talk" link on the upper right, and check if the change has happened.
- As shown in Figure 21-5, it indeed has.
If you still can't see what you expect after bypassing your cache, then ask for assistance at the Help desk (shortcut: WP:HD).
Preventing code overloadEdit
It's good practice to put anything other than a very short script into a separate page, with a name ending in .js, so that only you—and interface administrators—can edit it. That way, you don't end up with a very long, difficult-to-understand and difficult-to-edit common.js page.
Importing multi-function scripts of other editorsEdit
Several Wikipedia editors have created big, fabulously useful, multi-function scripts. You absolutely don't want to cut and paste these scripts, even to a separate page of your own, because you need the editor who created it to maintain it. You want to get enhancements to the code as they occur. By using the import function, you get the benefit of those updates (as do the hundreds of other editors using the same script).
As you can see from reading this chapter, editing your common.js page is no big deal. It's no harder than cutting and pasting text to any Wikipedia article. You can remove a function by deleting it, or by commenting it out (putting a pair of slashes at the beginning of each line). Commenting out works best for cases where you're importing a function (see Figure 21-6) and there's just one line to comment out. If you have 10 or 15 lines of code that you copied to your common.js page that you don't want any more, the page will be a lot neater if you delete it all, perhaps leaving a single comment line about where you found the code, in case you want to copy it back in at some later point.
- You may need to bypass your browser's cache (the copy of pages that it keeps, to speed up the process of showing you what you want to see). See Wikipedia:Bypass your cache (shortcut: WP:BYC) for instructions
- Sometimes bypassing the cache doesn't work, but purging it does. As discussed at the Wikipedia:Purge, page, follow this procedure: Click the "edit this page" tab. In your browser's address bar, at the end of the URL, where you see &action=edit, replace edit with purge, so it reads &action=purge. Then press Enter to tell your browser to go to that revised URL.
User scripts are scattered throughout Wikipedia. The largest collection of scripts is at Wikipedia:User scripts/List (shortcut: WP:US/L). You may also find one just because someone mentioned it, or because you came across it in the index (shortcut: WP:EIW). Other places to check are: