Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 How to create the bookmarklet  





2 Quotation  





3 Saving the settings for sites  





4 Extra words or characters in the values  





5 How to create the bookmarklet -- super easy instructions!  





6 Troubleshooting  





7 See also  














User:V111P/js/WebRef






Български
 










User page
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
User contributions
User logs
View user groups
Upload file
Special pages
Permanent link
Page information
Get shortened URL
Download QR code
 




Print/export  



Download as PDF
Printable version
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 

< User:V111P | js

A text box with the Cite Web template is displayed on top of the page after activating the bookmarklet.

WebRef is a script automating the filling of the {{cite web}} template. You use the script on the page you want to cite. A form will be displayed on top of that page with a text box containing the prefilled cite template. You should review the prefilled values and fill the missing ones and then press the "Compact & Copy" button (except for WP:LDR cites).

Not all the information can be autofilled on all sites, however it's easy to just drag or copy and paste the information from the page when the form with the cite template is on the same page.

For some sites, in order for the script to be able to fill all the information (including the name of the author and the date of the article), you have to configure the script to let it know where to find that information. To do that, press the Site setup button and follow the instructions.

The script can be used as a bookmarklet with the following address:

javascript:(function(){var d=document,s=d.createElement('script');s.src='//en.wikipedia.org/w/index.php?title=User:V111P/js/webRef.js&action=raw&ctype=text/javascript&smaxage=43200&maxage=86400';d.body.appendChild(s);})();

To test the script, using a desktop/laptop computer, you can just execute its source code (or the code above, after removing the javascript: part) in your browser's JavaScript console (which in most browsers can be opened by pressing the F12 key). Make sure you are on a page with (only one) article on it, for example on a news site.


You can edit this page. If I don't like or understand something you wrote, I will correct it. ;)

How to create the bookmarklet[edit]

It depends on your browser.

There is a second set of instructions further below if you have problems with these.

Quotation[edit]

If you select text on the page prior to activating the WebRef bookmarklet, the selected text will be used for the quote parameter in the Cite Web template. In Firefox you can select multiple text ranges (by holding the Ctrl key); they will be joined by [...] by the script.

Saving the settings for sites[edit]

For the script to be able to fill all the information (including the name of the author and the date of the article) on most sites you need to press the Site setup button and follow the instructions in order to help the script determine where to find this information. (Please, let me know if you don't understand the instructions.)

After you configure the script for the site you are using it on, you have the option to save the settings in the local storage (this doesn't work with old browsers as they don't have local storage). Unfortunately that is not the best place to store the settings because they can be deleted from there by a script from the site or when you delete your browsing history/cookies/etc. from the browser's settings. Also, you won't be able to use them with another browser and from other computers.

A better way is to save them to a subpage of your Wikipedia user page (use a page name with .js at the end for security reasons), make that page call WebRef, and then use your page's URL in your bookmarklet code. Here is an example of how your page should look like: webRefSiteDataExample.js.

It would be best if all wikipedians were able to share their site settings, but that's not likely to be possible any time soon. A special wiki or other kind of site can be created for that purpose, but it has to be able to handle vandalism too.

Extra words or characters in the values[edit]

If extra words or characters appear in the values of the parameters when using the script on some site, you can remove them every time by hand. Or you can make the script remove them automatically by changing the code for the site by hand (the code given on the page Site Setup). Here is an example: On BBC articles the author is given on a line below the title and the name is preceded by the word By. To remove this By, modify the value for the author parameter in the code for the BBC site, which is normally span.byline-name by adding ^^By at the end: span.byline-name^^By (actually just y instead of By will work too - everything before the first occurrence of the word after the first ^^ is automatically removed). If there are characters you want to remove from the end too (here as an example - an exclamation point), add another ^^ and the characters: span.byline-name^^By^^!. If you want to remove characters only from the end, use ^^^^ (i.e. leave empty the slot for the characters to omit from the beginning). No need to include spaces at the start or end of the words after ^^.

The caveat is that these words, after ^^, can be regular expressions. What that means is to use the characters \ . ? * + | ^ $ ( ) [ ] { } you need to prepend them with \. Otherwise they have special meanings. A period for examples means "any one character". An example: we want to remove everything after the first period: span.byline-name^^^^\. - here we use \ to escape the special-character meaning of the period.

How to create the bookmarklet -- super easy instructions![edit]

The bookmark (bookmarklet) doesn't take you to a different page, all it does is run the JavaScript saved in it: a text box with the Cite Web template pops up at the top of the page you are currently on, after clicking on the bookmark.

This is actually super easy to set up. I do computer support for friends and family, so let's first ditch all the jargon: for all intents and purposes a bookmarklet is nothing more than a bookmark with special instructions -- in this case a JavaScript put in the place where you usually have the URL.

This is what you need to do:

To use WebRef, click on the WebRef bookmark when you are on the page you want to cite. The special WebRef bookmark doesn't take you to another page, it runs the JavaScript in the bookmark and opens a text box with the Cite Web template.

If WebRef doesn't include the author's name, click on the 'Authors' button and enter the name(s) just as they appear on the webpage. "Jane Doe" will be converted automatically to "last = Doe | first = Jane."

Make sure to check the dates because WebRef doesn't always pick up the correct publication date, even when it is shown on the webpage.

Thank you V111P for giving us such an easy to use way for creating references! If you still have problems setting this up -- and after reading the troubleshooting tips below, I'd be happy to help. If you installed WebRef after reading my guide, I'd love to hear from you.

-- Peter NYC (talk) 01:50, 25 May 2019 (UTC)

Troubleshooting[edit]

The bookmark (bookmarklet) doesn't take you to a different page, all it does is run the JavaScript saved in it: a text box with the Cite Web template pops up at the top of the page you are currently on, after clicking on the bookmark.

If you have problems getting WebRef to work, first go to a site that is known to be easy to use with WebRef, the New York Times https://www.nytimes.com. Click on a news article on the main page, and then click on your WebRef bookmark.

If the textbox does not pop up:

Sometimes you need to reload the webpage twice after turning off extensions. Good luck!

-- Peter NYC (talk) 01:50, 25 May 2019 (UTC)

See also[edit]


Retrieved from "https://en.wikipedia.org/w/index.php?title=User:V111P/js/WebRef&oldid=1086845308"

Category: 
Wikipedia tools
 



This page was last edited on 8 May 2022, at 18:13 (UTC).

Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



Privacy policy

About Wikipedia

Disclaimers

Contact Wikipedia

Code of Conduct

Developers

Statistics

Cookie statement

Mobile view



Wikimedia Foundation
Powered by MediaWiki