-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
50 lines (36 loc) · 1.12 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
(function() {
//Node Libs
var remote = require('remote');
var cmd = remote.require('./cmd.js');
var bw = remote.require('browser-window');
//Initialize jQuery
window.jQuery = window.$ = require('./jquery.min.js');
/* Bind tab controls */
$("body").on("click", "li[role=tab]:not([aria-selected=true])", function() {
//switch tabs
$("li[role=tab]").attr("aria-selected", false)
.filter(this).attr("aria-selected", true);
//switch panels
$("li[role=tabpanel]").attr("aria-hidden", true)
.filter("[aria-describedby=" + this.id + "]").attr("aria-hidden", false);
});
var timer = null;
var auxWindow = null;
$(".js-iframe-ctrl").on("keyup", function() {
clearTimeout(timer);
var url = this.value;
if(!/^https?:\/\//.test(url)) {
url = "https://" + url;
}
timer = setTimeout(function() {
// $("iframe").attr("src", url);
if(!auxWindow) {
auxWindow = new bw({width: 800, height: 600});
}
auxWindow.loadURL(url);
auxWindow.on('closed', function() {
auxWindow = null;
});
}, 400);
});
})();