Skip to content

Commit

Permalink
few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Koushikphy committed Feb 5, 2022
1 parent a995372 commit 4b7a124
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
23 changes: 14 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ var info = fs.existsSync(file) ? JSON.parse(fs.readFileSync(file,"utf8")) :{}

// for capturing proxy authentication request
let reservedLoginCallback = null
let proxy = null
let proxyPopUp = null
let loginCount = 0
ipcMain.on('authSubmitted', (_, {id, password}) => {
proxy.close()
proxyPopUp.close()
reservedLoginCallback(id, password)
reservedLoginCallback = null
info.proxy = {"id":id, "password":password}
Expand All @@ -82,8 +82,9 @@ app.on('ready', function () {
callback(aInfo.id,aInfo.password);
}else {
reservedLoginCallback = callback
proxy = new BrowserWindow({
width: 450,
if(proxyPopUp) proxyPopUp.close() // discard multiple popups
proxyPopUp = new BrowserWindow({
width: 400,
height: 200,
show:false,
modal:true,
Expand All @@ -96,11 +97,13 @@ app.on('ready', function () {
enableRemoteModule: true,
contextIsolation:false
},})
proxy.loadFile("src/html/auth.html")
proxy.once('ready-to-show',()=>{
proxy.webContents.send('details', authInfo)
proxy.show();
proxyPopUp.loadFile("src/html/auth.html")
proxyPopUp.once('ready-to-show',()=>{
proxyPopUp.webContents.send('details', authInfo)
proxyPopUp.show();
})
proxyPopUp.once('closed',()=>{proxyPopUp=null})

}
loginCount++
}
Expand Down Expand Up @@ -149,7 +152,7 @@ const helpMenu = {
childWindow.loadFile('src/html/doc.html')
childWindow.maximize();
childWindow.setMenuBarVisibility(false);
childWindow.show();
childWindow.once('ready-to-show',childWindow.show)
}
}, {
label: "Sample Data",
Expand Down Expand Up @@ -185,6 +188,7 @@ const helpMenu = {
minWidth: 500,
maxWidth : 700,
width:600,
show:false,
title: "Interactive Data Editor - About",
webPreferences: {
nodeIntegration: true,
Expand All @@ -195,6 +199,7 @@ const helpMenu = {
});
childWindow.loadFile('./src/html/about.html')
childWindow.setMenuBarVisibility(false);
childWindow.once('ready-to-show',childWindow.show)
}
},
{
Expand Down
4 changes: 4 additions & 0 deletions src/html/doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
width: 1.3pc;
height: 1.3pc;
}
.page:focus{
outline: none;
}

</style>
</head>
Expand Down Expand Up @@ -536,6 +539,7 @@
var current=0;
secList[current].classList.add('shown')
linkList[current].classList.add('visited')
secList[current].focus()

function showThis(index){
if(current==index) return
Expand Down
9 changes: 4 additions & 5 deletions src/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class dataStore{
this.info = fs.existsSync(this.file) ? JSON.parse(fs.readFileSync(this.file,"utf8")) :{}
}
get(key,optionalValue) {
return this.info[key]===undefined ? optionalValue : this.info[key]
return this.info.hasOwnProperty(key) ? this.info[key]: optionalValue
}
set(key, value){
this.info[key] = value
Expand Down Expand Up @@ -44,11 +44,10 @@ function recentMenu() {// builds the recent file submenu
}))
}
store.set('files', recentFiles)
// localStorage.setItem("files", JSON.stringify(recentFiles));
};


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

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



// var fl = store.get('autosave',0)// JSON.parse(localStorage.getItem("autosave"));
var autoSave = parseInt(store.get('autosave',0)) // fl!==null? parseInt(fl) : 0; // autosave file every, 0 means no autosave

var autoSave = parseInt(store.get('autosave',0)) // autosave file every, 0 means no autosave
var autoSaveMenuItems = menu.getMenuItemById('autosave').submenu.items;
autoSaveMenuItems.forEach(e=>{e.checked=false})
autoSaveMenuItems[{0:0,1:1,5:2,10:3}[autoSave]].checked = true
8 changes: 1 addition & 7 deletions src/js/keyIpcTrigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function ipcTrigger(_,d){
autoSaveMenuItems[{0:0,1:1,5:2,10:3}[autoSave]].checked = true
saveRemminder()
// localStorage.setItem( "autosave", JSON.stringify(autoSave))
StorageEvent.set('autosave',autoSave)
store.set('autosave',autoSave)
}
}

Expand Down Expand Up @@ -417,9 +417,3 @@ document.getElementById("valinput").onchange = document.getElementById('valBtn')
setValue($('#valinput').val())
$('.popup').hide()
}


// document.getElementById("autoSaveVal").onchange = document.getElementById('autoSaveBtn').onclick = ()=>{
// autoSave = parseInt($('#autoSaveVal').val()*1000)
// $('.popup').hide()
// }
2 changes: 1 addition & 1 deletion src/js/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function _versionCheck() {
buttons: ['OK', "Cancel"]
})
if (!res) {
shell.openExternal("https://github.com/Koushikphy/Interactive_Data_Editor/releases/latest")
shell.openExternal("https://koushikphy.github.io/Interactive_Data_Editor/")
}
}
})
Expand Down

0 comments on commit 4b7a124

Please sign in to comment.