This is a simple bookmarklet that generates a BibLaTeX entry with type @online of the site that you're currently on.
This bookmarklet is optimized for BibLaTeX which features the @online type. If you're using BibTeX, it will also work, but it will probably get styled like an @misc entry.
I also did put no effort in handling any LaTeX control characters, please do so yourself.
- Simply copy the following code snippet
javascript:(function(){t=document.title;u=document.URL;d=new Date().toISOString().split("T")[0];id=btoa((u+t+d).split('').reduce((a,b)=>{a=((a<<5)-a)+b.charCodeAt(0);return a&a;},0)).replace(/\W/g,'').substring(0,8);alert("@online{" +id+ ",\n title = {" +t+ "},\n url = {" +u+ "},\n urldate = {" +d+ "}\n}");})();
- Create a new bookmark by right-clicking your browser's bookmark bar
- Paste the snippet into the address field and choose an arbitrary title, e.g. "Generate BibLaTeX"
- Visit the page you want to cite
- Click on the bookmark
- An alert will pop up which contains your BibTeX entry
- Copy the content of the alert and paste it into your BIB file
- Fix broken control characters, if present
E.g. for github.com
, the entry will look like this:
@online{aHR0cHM6,
title = {GitHub},
url = {https://github.com/},
urldate = {2020-09-20}
}
I have only tested this with Firefox.
The unminified code of the function is below:
function(){
t = document.title;
u = document.URL;
d = new Date().toISOString().split("T")[0];
id = btoa((u + t + d).split('').reduce((a,b) => {
a = (( a << 5 ) - a ) + b.charCodeAt(0);
return a & a;
}, 0)).replace(/\W/g, '').substring(0,8);
alert("@online{" + id + ",\n title = {" + t + "},\n url = {" + u + "},\n urldate = {" + d + "}\n}");
}