2006-08-02 16:49:19 +00:00
|
|
|
/*
|
2006-08-30 06:00:44 +00:00
|
|
|
Zotero
|
2006-08-02 16:49:19 +00:00
|
|
|
Copyright (C) 2006 Center for History and New Media, George Mason University, Fairfax, VA
|
|
|
|
http://chnm.gmu.edu/
|
|
|
|
*/
|
|
|
|
|
2006-06-21 22:31:52 +00:00
|
|
|
var autoUpdateBox;
|
2006-07-19 16:14:27 +00:00
|
|
|
var positionMenu;
|
2006-08-09 15:44:11 +00:00
|
|
|
var parseEndnoteBox;
|
2006-08-21 21:10:40 +00:00
|
|
|
var openURLMenu;
|
|
|
|
var openURLResolvers;
|
2006-08-09 15:44:11 +00:00
|
|
|
var openURLServerField;
|
|
|
|
var openURLVersionMenu;
|
2006-05-18 18:39:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
To add a new preference:
|
2006-06-21 22:31:52 +00:00
|
|
|
1) modify defaults/preferences/scholar.js
|
|
|
|
2) in this document:
|
|
|
|
a) add var above
|
|
|
|
b) add lines to init() function
|
|
|
|
c) add line to accept() function
|
|
|
|
3) add a control to prefs.xul
|
2006-06-25 07:31:01 +00:00
|
|
|
4) (Optional) To add an observer for a preference change,
|
|
|
|
add an appropriate case in the switch statement
|
|
|
|
in Scholar.Prefs.observe()
|
2006-05-18 18:39:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
function init()
|
|
|
|
{
|
2006-06-21 22:31:52 +00:00
|
|
|
autoUpdateBox = document.getElementById('autoUpdateBox');
|
2006-06-25 07:31:01 +00:00
|
|
|
autoUpdateBox.checked = Scholar.Prefs.get('automaticScraperUpdates');
|
2006-07-19 16:14:27 +00:00
|
|
|
|
|
|
|
positionMenu = document.getElementById('positionMenu');
|
|
|
|
positionMenu.selectedIndex = Scholar.Prefs.get('scholarPaneOnTop') ? 0 : 1;
|
2006-08-09 15:44:11 +00:00
|
|
|
|
|
|
|
parseEndnoteBox = document.getElementById('parseEndnoteBox');
|
|
|
|
parseEndnoteBox.checked = Scholar.Prefs.get('parseEndNoteMIMETypes');
|
|
|
|
|
|
|
|
openURLServerField = document.getElementById('openURLServerField');
|
|
|
|
openURLServerField.value = Scholar.Prefs.get('openURL.resolver');
|
|
|
|
openURLVersionMenu = document.getElementById('openURLVersionMenu');
|
|
|
|
openURLVersionMenu.value = Scholar.Prefs.get('openURL.version');
|
2006-08-21 21:10:40 +00:00
|
|
|
|
|
|
|
openURLMenu = document.getElementById('openURLMenu');
|
|
|
|
|
|
|
|
openURLResolvers = Scholar.OpenURL.discoverResolvers();
|
|
|
|
for(var i in openURLResolvers)
|
|
|
|
{
|
|
|
|
openURLMenu.insertItemAt(i,openURLResolvers[i]['name']);
|
|
|
|
if(openURLResolvers[i]['url'] == Scholar.Prefs.get('openURL.resolver') && openURLResolvers[i]['version'] == Scholar.Prefs.get('openURL.version'))
|
|
|
|
openURLMenu.selectedIndex = i;
|
|
|
|
}
|
2006-05-18 18:39:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function accept()
|
|
|
|
{
|
2006-08-09 15:44:11 +00:00
|
|
|
Scholar.Prefs.set('automaticScraperUpdates', autoUpdateBox.checked);
|
|
|
|
Scholar.Prefs.set('scholarPaneOnTop', positionMenu.selectedIndex == 0);
|
|
|
|
|
|
|
|
if(Scholar.Prefs.get('parseEndNoteMIMETypes') != parseEndnoteBox.checked)
|
|
|
|
{
|
|
|
|
Scholar.Prefs.set('parseEndNoteMIMETypes', parseEndnoteBox.checked);
|
|
|
|
Scholar.Ingester.MIMEHandler.init();
|
|
|
|
}
|
2006-08-21 21:10:40 +00:00
|
|
|
|
2006-08-09 15:44:11 +00:00
|
|
|
Scholar.Prefs.set('openURL.resolver', openURLServerField.value);
|
|
|
|
Scholar.Prefs.set('openURL.version', openURLVersionMenu.value);
|
2006-08-21 21:10:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function onOpenURLSelected()
|
|
|
|
{
|
|
|
|
if(openURLMenu.value == "custom")
|
|
|
|
{
|
|
|
|
openURLServerField.focus();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
openURLServerField.value = openURLResolvers[openURLMenu.selectedIndex]['url'];
|
|
|
|
openURLVersionMenu.value = openURLResolvers[openURLMenu.selectedIndex]['version'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function onOpenURLCustomized()
|
|
|
|
{
|
|
|
|
openURLMenu.value = "custom";
|
2006-05-18 18:39:55 +00:00
|
|
|
}
|