-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
kumapana
committed
May 1, 2018
1 parent
9cc53f9
commit d6f02a1
Showing
2 changed files
with
63 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
const remote = require('electron').remote | ||
let w = remote.getCurrentWindow() | ||
let countFullScreenPushed = 0; | ||
|
||
//閉じるボタンイベント | ||
document.getElementById("close_icon").onclick = function(){ | ||
w.close() | ||
}; | ||
|
||
//タッチスクリーン対応 | ||
document.getElementById("close_icon").addEventListener('touchStart', function(){ | ||
w.close() | ||
}, false); | ||
|
||
|
||
//最大化ボタンイベント | ||
document.getElementById("fullscreen_icon").onclick = function(){ | ||
w.setFullScreen(true); | ||
const titleBar = document.getElementById("titlebar"); | ||
titleBar.style.display = "none"; | ||
document.getElementById("web_view").style.top = 0; | ||
}; | ||
|
||
//タッチスクリーン対応 | ||
document.getElementById("fullscreen_icon").addEventListener('touchStart', function(){ | ||
w.setFullScreen(true); | ||
const titleBar = document.getElementById("titlebar"); | ||
titleBar.style.display = "none"; | ||
document.getElementById("web_view").style.top = 0; | ||
}, false); | ||
|
||
//引用元 https://stackoverflow.com/questions/3369593/how-to-detect-escape-key-press-with-pure-js-or-jquery | ||
//最大化後Esc押下で元に戻る | ||
document.onkeydown = function(evt) { | ||
evt = evt || window.event; | ||
let isEscape = false; | ||
if ("key" in evt) { | ||
isEscape = (evt.key == "Escape" || evt.key == "Esc"); | ||
} else { | ||
isEscape = (evt.keyCode == 27); | ||
} | ||
const wv = document.getElementById("web_view"); | ||
if (isEscape&& wv.style.top === "0px") { | ||
wv.style.top = "30px"; | ||
document.getElementById("titlebar").style.display = "flex"; | ||
w.setFullScreen(false); | ||
} | ||
}; | ||
|
||
//リロードボタンのイベント | ||
document.getElementById("reload_icon").onclick = function(){ | ||
document.getElementById("web_view").reload(); | ||
}; | ||
|
||
document.getElementById("reload_icon").addEventListener('touchStart', function(){ | ||
document.getElementById("web_view").reload(); | ||
}); | ||
//スクリーンショット機能実装テスト | ||
function test(){ | ||
w.capturePage(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters