| 
									
										
										
										
											2006-08-02 16:49:19 +00:00
										 |  |  | /* | 
					
						
							|  |  |  | 	Scholar | 
					
						
							|  |  |  | 	Copyright (C) 2006   Center for History and New Media, George Mason University, Fairfax, VA | 
					
						
							|  |  |  | 	http://chnm.gmu.edu/
 | 
					
						
							|  |  |  | 	 | 
					
						
							|  |  |  |     This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |     it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |     the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |     (at your option) any later version. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |     but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |     GNU General Public License for more details. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     You should have received a copy of the GNU General Public License | 
					
						
							|  |  |  |     along with this program; if not, write to the Free Software | 
					
						
							|  |  |  |     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							|  |  |  | 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-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(); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 	Scholar.Prefs.set('openURL.resolver', openURLServerField.value); | 
					
						
							|  |  |  | 	Scholar.Prefs.set('openURL.version', openURLVersionMenu.value); | 
					
						
							| 
									
										
										
										
											2006-05-18 18:39:55 +00:00
										 |  |  | } |