zotero/chrome/chromeFiles/content/scholar/exportOptions.js
Simon Kornblith 20486d5053 addresses #103, figure out how to store captured pages in native export format
import/export of file data should work for all file types _except_ snapshots (in this situation, export is working, but import is not yet complete; see #193)
also, fixes a potential security issue that could have allowed malicious web translators to post local data to remote sites (although, given we maintain the central repository and there's no easy way to install a translator, the risk would have been minimal to begin with).
2006-08-18 05:58:14 +00:00

72 lines
No EOL
1.7 KiB
JavaScript

//////////////////////////////////////////////////////////////////////////////
//
// Scholar_File_Interface_Export
//
//////////////////////////////////////////////////////////////////////////////
// Class to provide options for export
var Scholar_File_Interface_Export = new function() {
var _options;
this.init = init;
this.accept = accept;
this.cancel = cancel;
/*
* add options to export
*/
function init() {
_options = window.arguments[0].options;
// add options to dialog
var dialog = document.getElementById("scholar-export-options");
for(var option in _options) {
var defValue = _options[option];
// get readable name for option
try {
var optionLabel = Scholar.getString("exportOptions."+option);
} catch(e) {
var optionLabel = option;
}
// right now, option interface supports only boolean values, which
// it interprets as checkboxes
Scholar.debug(option+" ("+optionLabel+") = "+defValue+" ("+typeof(defValue)+")");
if(typeof(defValue) == "boolean") {
var checkbox = document.createElement("checkbox");
checkbox.setAttribute("id", option);
checkbox.setAttribute("label", optionLabel);
checkbox.setAttribute("checked", (defValue ? "true" : "false"));
dialog.appendChild(checkbox);
}
}
}
/*
* make option array reflect status
*/
function accept() {
for(var option in _options) {
var defValue = _options[option];
var element = document.getElementById(option);
if(typeof(defValue) == "boolean") {
if(element.checked == "true") {
_options[option] = true;
} else {
_options[option] = false;
}
}
}
Scholar.debug(_options);
}
/*
* make option array reflect status
*/
function cancel() {
window.arguments[0].options = false;
}
}