ed6650c4e7
to get this to work right, you'll need the SOAP toolkit from http://www.microsoft.com/downloads/details.aspx?FamilyID=ba611554-5943-444c-b53c-c0a450b7013c&DisplayLang=en I may replace the SOAP object with a simple XMLHTTP object, since that page says that the SOAP toolkit is deprecated.
62 lines
No EOL
1.6 KiB
JavaScript
62 lines
No EOL
1.6 KiB
JavaScript
//////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Scholar_File_Interface_Bibliography
|
|
//
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Class to provide options for bibliography
|
|
|
|
var 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 styleMenu = document.getElementById("style-menu");
|
|
var styles = Scholar.Cite.getStyles();
|
|
|
|
// add styles to list
|
|
for(i in styles) {
|
|
var itemNode = document.createElement("menuitem");
|
|
itemNode.setAttribute("value", i);
|
|
itemNode.setAttribute("label", styles[i]);
|
|
listbox.appendChild(itemNode);
|
|
|
|
if(i == _io.style) {
|
|
styleMenu.selectedItem = itemNode;
|
|
}
|
|
}
|
|
|
|
// select first item by default
|
|
if(styleMenu.selectedIndex == -1) {
|
|
styleMenu.selectedIndex = 0;
|
|
}
|
|
|
|
if(Scholar.isMac && document.getElementById("copy-to-clipboard")) {
|
|
document.getElementById("copy-to-clipboard").hidden = "true";
|
|
}
|
|
|
|
// move to center of screen
|
|
window.sizeToContent();
|
|
window.moveTo(
|
|
(self.screen.width-window.innerWidth)/2,
|
|
(self.screen.height-window.innerHeight)/2
|
|
);
|
|
}
|
|
|
|
function acceptSelection() {
|
|
// collect code
|
|
_io.style = document.getElementById("style-menu").selectedItem.value;
|
|
if(document.getElementById("output-radio")) {
|
|
_io.output = document.getElementById("output-radio").selectedItem.id;
|
|
}
|
|
}
|
|
} |