/*** newt-file.js: File and Sample Design Functions ***/ /* Newt-Web: A Newtonian Telescope CAD Program Copyright (C) 2011 Kenneth H. Slater This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License Version 2 as published by the Free Software Foundation. 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ function UpdateFiles() { // Refreshes data on the file pane document.getElementById( "modified" ).innerHTML = scope.modified ? 'Modified - Save if Necessary' : 'Not Modified'; document.getElementById( "modstatus" ).style.backgroundColor = scope.modified ? '#FF99CC' : '#99FF66'; UpdateLocalStorage(); CheckFileReader(); // test if this browser can read files } function UpdateLocalStorage() { if ( !supports_local_storage() ) { document.getElementById('ls_list').innerHTML = '
This browser does not support Local Storage. You will not be able to save and restore your designs.
' + 'See Help on Browsers for information about upgrading to a modern browser that supports this facility.
'; disableLScontrols( 'all', true ); return; } ListLS(); // Builds the saved design list, resets selections UpdateSave(); // Updates the design name & Save button } function ListLS() { //Lists Local Storage var LS = window.localStorage; var List = document.getElementById('ls_list'); var Cnt = document.getElementById('save_count'); if ( LS.length == 0 ) { List.innerHTML = '(No Stored Designs Found)
'; Cnt.innerHTML = 'No'; } else { Cnt.innerHTML = LS.length; // Display number of saved designs // Get key names in an array for sorting var SortAry = new Array(); for ( i=0; i