From 9ee7935e0a8dbd82b936423da2713428e9c5ce22 Mon Sep 17 00:00:00 2001 From: d11e9 Date: Fri, 2 Oct 2015 18:33:33 +0100 Subject: [PATCH] dont rename if same --- index.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 224b593443..49f05671a0 100644 --- a/index.html +++ b/index.html @@ -109,7 +109,7 @@ THE SOFTWARE. $filesEl.on( 'click','.newFile', function(){ count++; - var name = 'Unititled'+count+'.sol'; + var name = 'Unititled'+count; solFiles.push( name ) SOL_CACHE_FILE = name; window.localStorage.setItem( SOL_CACHE_FILES_KEY, JSON.stringify( solFiles ) ); @@ -132,17 +132,16 @@ THE SOFTWARE. ev.preventDefault() var newName = ev.target.value; var $new = null - if (confirm( "Are you sure you want to rename: " + originalName + " to " + newName + '?' )) { + if ( newName !== originalName && confirm( "Are you sure you want to rename: " + originalName + " to " + newName + '?' )) { solFiles.splice( solFiles.indexOf(originalName), 1, newName ); window.localStorage.setItem( newName, window.localStorage.getItem(originalName) ); window.localStorage.setItem( SOL_CACHE_FILES_KEY, JSON.stringify( solFiles ) ); window.localStorage.removeItem( originalName ) SOL_CACHE_FILE = newName; - updateFiles() } - fileTabFromName(newName || originalName ).addClass('active') + updateFiles() return false; }) return false;