6305e4cada
closes #4, Make printable version - moves functions for creating and deleting hidden browser objects to scholar.js (from ingester.js), since these are necessary for printing as well - allows saving bibliography in HTML or printing bibliography. style support is not yet complete (pending finalization of 0.9 version of CSL specification).
47 lines
No EOL
1.3 KiB
JavaScript
47 lines
No EOL
1.3 KiB
JavaScript
//////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Scholar_File_Interface_Bibliography
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Class to provide options for bibliography
|
|
|
|
Scholar_File_Interface_Bibliography = new function() {
|
|
var _io;
|
|
|
|
this.init = init;
|
|
this.acceptSelection = acceptSelection;
|
|
|
|
/*
|
|
* Initialize some variables and prepare event listeners for when chrome is done
|
|
* loading
|
|
*/
|
|
function init() {
|
|
_io = window.arguments[0];
|
|
|
|
var listbox = document.getElementById("style-popup");
|
|
var styles = Scholar.Cite.getStyles();
|
|
|
|
var firstItem = true;
|
|
for(i in styles) {
|
|
var itemNode = document.createElement("menuitem");
|
|
itemNode.setAttribute("value", i);
|
|
itemNode.setAttribute("label", styles[i]);
|
|
listbox.appendChild(itemNode);
|
|
}
|
|
|
|
// select first item by default
|
|
document.getElementById("style-menu").selectedIndex = 0;
|
|
|
|
if(navigator.userAgent.toLowerCase().indexOf("mac") != -1) {
|
|
// hack to eliminate clipboard option for mac users
|
|
document.getElementById("output-radio").removeChild(document.getElementById("copy-to-clipboard"));
|
|
}
|
|
}
|
|
|
|
function acceptSelection() {
|
|
// collect code
|
|
_io.style = document.getElementById("style-menu").selectedItem.value;
|
|
_io.output = document.getElementById("output-radio").selectedItem.id;
|
|
}
|
|
} |