Skip to content

Commit e04c6b2

Browse files
committed
Added tab swtich hotkey
1 parent 37ae4da commit e04c6b2

File tree

13 files changed

+82
-10
lines changed

13 files changed

+82
-10
lines changed

web/static/javascript/hotkeys.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
$(document).ready(function () {
3+
$(window).bind("keydown", function (event) {
4+
if (event.ctrlKey || event.metaKey) {
5+
if (event.keyCode == 223) {
6+
window.top.swtichTab();
7+
}
8+
}
9+
})
10+
});

web/templates/audit.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
<script src="{{ url_for('static', filename='javascript/helpers.js') }}"></script>
1515

16+
17+
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
18+
1619
<link rel="stylesheet" href="{{ url_for('static', filename='css/datatable.css') }}">
1720
<link rel="stylesheet" href="{{ url_for('static', filename='themes/default/default.css') }}">
1821

@@ -71,4 +74,4 @@
7174
}
7275
table.draw();
7376
});
74-
</script>
77+
</script>

web/templates/backups.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<link rel="stylesheet" href="{{ url_for('static', filename='includes/bootstrap-3.3.7/css/bootstrap.min.css') }}">
88
<script src="{{ url_for('static', filename='includes/bootstrap-3.3.7/js/bootstrap.min.js') }}"></script>
99

10+
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
11+
1012
<link rel="stylesheet" href="{{ url_for('static', filename='css/datatable.css') }}">
1113
<link rel="stylesheet" href="{{ url_for('static', filename='themes/default/default.css') }}">
1214

@@ -23,4 +25,4 @@
2325
<input class='btn btn-primary theme-panelButton' type="submit" value="Restore System">
2426
</form>
2527
</body>
26-
</html>
28+
</html>

web/templates/blank.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<html>
22
<head>
33
<link rel="stylesheet" href="{{ url_for('static', filename='themes/default/default.css') }}">
4+
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
45
</head>
56
<body class="theme-panelContainer">
67
<pre class="theme-panelContainer">{{ content }}</pre>
78
</body>
8-
</html>
9+
</html>
10+

web/templates/codify.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
<link rel="stylesheet" href="{{ url_for('static', filename='css/datatable.css') }}">
1818

1919
<script src="{{ url_for('static', filename='javascript/helpers.js') }}"></script>
20-
<script src="{{ url_for('static', filename='javascript/alert.js') }}"></script>
20+
<script src="{{ url_for('static', filename='javascript/alert.js') }}"></script>
21+
22+
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
2123

2224
<link rel="stylesheet" href="{{ url_for('static', filename='css/alert.css') }}">
2325
<link rel="stylesheet" href="{{ url_for('static', filename='css/codify.css') }}">
@@ -73,4 +75,4 @@
7375
}
7476
});
7577

76-
</script>
78+
</script>

web/templates/conductEditor.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
<script src="{{ url_for('static', filename='javascript/triggerObject.js') }}"></script>
2929
<script src="{{ url_for('static', filename='javascript/aclProperties.js') }}"></script>
3030

31+
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
32+
3133
<link rel="stylesheet" href="{{ url_for('static', filename='css/conductEditor.css') }}">
3234
<link rel="stylesheet" href="{{ url_for('static', filename='css/objectProperties.css') }}">
3335
<link rel="stylesheet" href="{{ url_for('static', filename='css/alert.css') }}">

web/templates/debug.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<script src="{{ url_for('static', filename='includes/visjs/js/moment.js') }}"></script>
1010
<script src="{{ url_for('static', filename='includes/datatables/js/datetime.moment.js') }}"></script>
1111

12+
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
13+
1214
<link rel="stylesheet" href="{{ url_for('static', filename='css/datatable.css') }}">
1315

1416
<html>

web/templates/import.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
<script src="{{ url_for('static', filename='javascript/helpers.js') }}"></script>
2020
<script src="{{ url_for('static', filename='javascript/alert.js') }}"></script>
2121

22+
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
23+
2224
<link rel="stylesheet" href="{{ url_for('static', filename='css/alert.css') }}">
2325
<link rel="stylesheet" href="{{ url_for('static', filename='css/codify.css') }}">
2426

@@ -50,4 +52,4 @@
5052
}
5153
});
5254
});
53-
</script>
55+
</script>

web/templates/main.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ <h1 class="nav-header" >Jimi</h1>
9696
</html>
9797

9898
<script>
99+
var currentTab = null
100+
var lastTab = null
101+
99102
function generateUUID() {
100103
var d = new Date().getTime();
101104
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
@@ -110,17 +113,40 @@ <h1 class="nav-header" >Jimi</h1>
110113
var id = generateUUID();
111114
$('ul#tabs li:last-child').before('<li id="li' + id + '"><a href="#tab' + id + '" role="tab" data-toggle="tab">' + name + ' <button type="button" class="btn theme-navButton" onclick="removeTab(\'' + id + '\');">X</button></a>');
112115
$('div.tab-content div:last-child').after('<div class="tab-pane" id="tab' + id + '"><iframe name="content-frame" class="content-frame" focus() src="'+ url +'"></iframe></div>');
116+
$('ul#tabs > li').click(function() {
117+
if (currentTab != null) {
118+
lastTab = currentTab;
119+
}
120+
currentTab = id
121+
});
113122
$('ul#tabs > li').removeClass("active");
114123
$('div.tab-content div').removeClass("active");
115124
$('ul#tabs > li#li' + id).addClass("active");
116125
$('div.tab-content div#tab' + id).addClass("active");
126+
if (currentTab != null) {
127+
lastTab = currentTab;
128+
}
129+
currentTab = id
117130
}
118131

119132

120133
function removeTab(liElem) {
121134
$('ul#tabs > li#li' + liElem).remove();
122135
$('div.tab-content div#tab' + liElem).remove();
123136
}
137+
138+
function swtichTab() {
139+
if ( currentTab != null ) {
140+
$('ul#tabs > li').removeClass("active");
141+
$('div.tab-content div').removeClass("active");
142+
$('ul#tabs > li#li' + lastTab).addClass("active");
143+
$('div.tab-content div#tab' + lastTab).addClass("active");
144+
changeTab = currentTab;
145+
currentTab = lastTab;
146+
lastTab = changeTab;
147+
}
148+
}
149+
124150
</script>
125151

126152
<script>
@@ -195,3 +221,16 @@ <h1 class="nav-header" >Jimi</h1>
195221
});
196222

197223
</script>
224+
225+
<script>
226+
$(document).ready(function () {
227+
$(window).bind("keydown", function (event) {
228+
if (event.ctrlKey || event.metaKey) {
229+
console.log(event.keyCode)
230+
if (event.keyCode == 223) {
231+
swtichTab();
232+
}
233+
}
234+
})
235+
});
236+
</script>

web/templates/modelEditorList.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
<script src="{{ url_for('static', filename='javascript/helpers.js') }}"></script>
1515

16+
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
17+
1618

1719
<link rel="stylesheet" href="{{ url_for('static', filename='css/datatable.css') }}">
1820

@@ -279,4 +281,5 @@
279281
var alert = $(".alert-container");
280282
locationHandler();
281283
});
282-
</script>
284+
</script>
285+

0 commit comments

Comments
 (0)