Skip to content

Instantly share code, notes, and snippets.

@nicolassmith
Created March 16, 2012 20:18
Show Gist options
  • Save nicolassmith/2052384 to your computer and use it in GitHub Desktop.
Save nicolassmith/2052384 to your computer and use it in GitHub Desktop.
DCC Bibtex Bookmarklet source.
(function(){
var basicdiv = document.getElementById('BasicDocInfo');
var dccnum = basicdiv.childNodes[1].childNodes[2].childNodes[0].innerHTML.split('-')[1];
var numauthors = document.getElementById('Authors').childNodes[1].childNodes.length;
var authors = new Array();
for(var j=0;j<numauthors;j++){
authors[j] = document.getElementById('Authors').childNodes[1].childNodes[j].childNodes[0].innerHTML;
};
var title = document.getElementById('DocTitle').childNodes[1].innerHTML;
var dateels = basicdiv.childNodes[1].childNodes[17].innerHTML.split('%20');
var day = dateels[0];
var month = dateels[1];
var year = dateels[2].substring(0,4);
var ind = "%20%20%20%20";
bibstring = "@techreport{" + dccnum + ",\n";
bibstring += ind + "author={" + authors.join("%20and%20") + "},\n";
bibstring += ind + "institution={LIGO Laboratory},\n";
bibstring += ind + "title={{" + title + "}},\n";
bibstring += ind + "number={" + dccnum + "},\n";
bibstring += ind + "day={" + day + "},\n";
bibstring += ind + "month={" + month + "},\n";
bibstring += ind + "year={" + year + "},\n";
bibstring += ind + "url={" + document.baseURI + "}\n";
bibstring += "}";
/*var popup = window.open("", "Bibtex output", "width=320,height=210,scrollbars=yes");
popup.document.writeln(bibstring);*/
alert(bibstring);
})()
@nicolassmith
Copy link
Author

J. Rollins told me about DCC xml metadata export: &outformat=xml

Would be less hackey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment