Skip to content

Commit 4b7a124

Browse files
committed
few fixes
1 parent a995372 commit 4b7a124

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

index.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ var info = fs.existsSync(file) ? JSON.parse(fs.readFileSync(file,"utf8")) :{}
5858

5959
// for capturing proxy authentication request
6060
let reservedLoginCallback = null
61-
let proxy = null
61+
let proxyPopUp = null
6262
let loginCount = 0
6363
ipcMain.on('authSubmitted', (_, {id, password}) => {
64-
proxy.close()
64+
proxyPopUp.close()
6565
reservedLoginCallback(id, password)
6666
reservedLoginCallback = null
6767
info.proxy = {"id":id, "password":password}
@@ -82,8 +82,9 @@ app.on('ready', function () {
8282
callback(aInfo.id,aInfo.password);
8383
}else {
8484
reservedLoginCallback = callback
85-
proxy = new BrowserWindow({
86-
width: 450,
85+
if(proxyPopUp) proxyPopUp.close() // discard multiple popups
86+
proxyPopUp = new BrowserWindow({
87+
width: 400,
8788
height: 200,
8889
show:false,
8990
modal:true,
@@ -96,11 +97,13 @@ app.on('ready', function () {
9697
enableRemoteModule: true,
9798
contextIsolation:false
9899
},})
99-
proxy.loadFile("src/html/auth.html")
100-
proxy.once('ready-to-show',()=>{
101-
proxy.webContents.send('details', authInfo)
102-
proxy.show();
100+
proxyPopUp.loadFile("src/html/auth.html")
101+
proxyPopUp.once('ready-to-show',()=>{
102+
proxyPopUp.webContents.send('details', authInfo)
103+
proxyPopUp.show();
103104
})
105+
proxyPopUp.once('closed',()=>{proxyPopUp=null})
106+
104107
}
105108
loginCount++
106109
}
@@ -149,7 +152,7 @@ const helpMenu = {
149152
childWindow.loadFile('src/html/doc.html')
150153
childWindow.maximize();
151154
childWindow.setMenuBarVisibility(false);
152-
childWindow.show();
155+
childWindow.once('ready-to-show',childWindow.show)
153156
}
154157
}, {
155158
label: "Sample Data",
@@ -185,6 +188,7 @@ const helpMenu = {
185188
minWidth: 500,
186189
maxWidth : 700,
187190
width:600,
191+
show:false,
188192
title: "Interactive Data Editor - About",
189193
webPreferences: {
190194
nodeIntegration: true,
@@ -195,6 +199,7 @@ const helpMenu = {
195199
});
196200
childWindow.loadFile('./src/html/about.html')
197201
childWindow.setMenuBarVisibility(false);
202+
childWindow.once('ready-to-show',childWindow.show)
198203
}
199204
},
200205
{

src/html/doc.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,9 @@
199199
width: 1.3pc;
200200
height: 1.3pc;
201201
}
202+
.page:focus{
203+
outline: none;
204+
}
202205

203206
</style>
204207
</head>
@@ -536,6 +539,7 @@
536539
var current=0;
537540
secList[current].classList.add('shown')
538541
linkList[current].classList.add('visited')
542+
secList[current].focus()
539543

540544
function showThis(index){
541545
if(current==index) return

src/js/init.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class dataStore{
1515
this.info = fs.existsSync(this.file) ? JSON.parse(fs.readFileSync(this.file,"utf8")) :{}
1616
}
1717
get(key,optionalValue) {
18-
return this.info[key]===undefined ? optionalValue : this.info[key]
18+
return this.info.hasOwnProperty(key) ? this.info[key]: optionalValue
1919
}
2020
set(key, value){
2121
this.info[key] = value
@@ -44,11 +44,10 @@ function recentMenu() {// builds the recent file submenu
4444
}))
4545
}
4646
store.set('files', recentFiles)
47-
// localStorage.setItem("files", JSON.stringify(recentFiles));
4847
};
4948

5049

51-
var recentFiles =store.get('files',[]) // JSON.parse(localStorage.getItem("files"));
50+
var recentFiles =store.get('files',[])
5251
if (recentFiles.length!=0) recentMenu();
5352

5453
var recentLocation = store.get('recent',os.userInfo().homedir)
@@ -86,8 +85,8 @@ if (app.isPackaged) {
8685

8786

8887

89-
// var fl = store.get('autosave',0)// JSON.parse(localStorage.getItem("autosave"));
90-
var autoSave = parseInt(store.get('autosave',0)) // fl!==null? parseInt(fl) : 0; // autosave file every, 0 means no autosave
88+
89+
var autoSave = parseInt(store.get('autosave',0)) // autosave file every, 0 means no autosave
9190
var autoSaveMenuItems = menu.getMenuItemById('autosave').submenu.items;
9291
autoSaveMenuItems.forEach(e=>{e.checked=false})
9392
autoSaveMenuItems[{0:0,1:1,5:2,10:3}[autoSave]].checked = true

src/js/keyIpcTrigger.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ function ipcTrigger(_,d){
200200
autoSaveMenuItems[{0:0,1:1,5:2,10:3}[autoSave]].checked = true
201201
saveRemminder()
202202
// localStorage.setItem( "autosave", JSON.stringify(autoSave))
203-
StorageEvent.set('autosave',autoSave)
203+
store.set('autosave',autoSave)
204204
}
205205
}
206206

@@ -417,9 +417,3 @@ document.getElementById("valinput").onchange = document.getElementById('valBtn')
417417
setValue($('#valinput').val())
418418
$('.popup').hide()
419419
}
420-
421-
422-
// document.getElementById("autoSaveVal").onchange = document.getElementById('autoSaveBtn').onclick = ()=>{
423-
// autoSave = parseInt($('#autoSaveVal').val()*1000)
424-
// $('.popup').hide()
425-
// }

src/js/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function _versionCheck() {
1414
buttons: ['OK', "Cancel"]
1515
})
1616
if (!res) {
17-
shell.openExternal("https://github.com/Koushikphy/Interactive_Data_Editor/releases/latest")
17+
shell.openExternal("https://koushikphy.github.io/Interactive_Data_Editor/")
1818
}
1919
}
2020
})

0 commit comments

Comments
 (0)