Skip to content

Commit

Permalink
Added tab swtich hotkey
Browse files Browse the repository at this point in the history
  • Loading branch information
z1pti3 committed Oct 17, 2020
1 parent 37ae4da commit e04c6b2
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 10 deletions.
10 changes: 10 additions & 0 deletions web/static/javascript/hotkeys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

$(document).ready(function () {
$(window).bind("keydown", function (event) {
if (event.ctrlKey || event.metaKey) {
if (event.keyCode == 223) {
window.top.swtichTab();
}
}
})
});
5 changes: 4 additions & 1 deletion web/templates/audit.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

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


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

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

Expand Down Expand Up @@ -71,4 +74,4 @@
}
table.draw();
});
</script>
</script>
4 changes: 3 additions & 1 deletion web/templates/backups.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<link rel="stylesheet" href="{{ url_for('static', filename='includes/bootstrap-3.3.7/css/bootstrap.min.css') }}">
<script src="{{ url_for('static', filename='includes/bootstrap-3.3.7/js/bootstrap.min.js') }}"></script>

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

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

Expand All @@ -23,4 +25,4 @@
<input class='btn btn-primary theme-panelButton' type="submit" value="Restore System">
</form>
</body>
</html>
</html>
4 changes: 3 additions & 1 deletion web/templates/blank.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<html>
<head>
<link rel="stylesheet" href="{{ url_for('static', filename='themes/default/default.css') }}">
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
</head>
<body class="theme-panelContainer">
<pre class="theme-panelContainer">{{ content }}</pre>
</body>
</html>
</html>

6 changes: 4 additions & 2 deletions web/templates/codify.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<link rel="stylesheet" href="{{ url_for('static', filename='css/datatable.css') }}">

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

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

<link rel="stylesheet" href="{{ url_for('static', filename='css/alert.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/codify.css') }}">
Expand Down Expand Up @@ -73,4 +75,4 @@
}
});

</script>
</script>
2 changes: 2 additions & 0 deletions web/templates/conductEditor.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<script src="{{ url_for('static', filename='javascript/triggerObject.js') }}"></script>
<script src="{{ url_for('static', filename='javascript/aclProperties.js') }}"></script>

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

<link rel="stylesheet" href="{{ url_for('static', filename='css/conductEditor.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/objectProperties.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/alert.css') }}">
Expand Down
2 changes: 2 additions & 0 deletions web/templates/debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<script src="{{ url_for('static', filename='includes/visjs/js/moment.js') }}"></script>
<script src="{{ url_for('static', filename='includes/datatables/js/datetime.moment.js') }}"></script>

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

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

<html>
Expand Down
4 changes: 3 additions & 1 deletion web/templates/import.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<script src="{{ url_for('static', filename='javascript/helpers.js') }}"></script>
<script src="{{ url_for('static', filename='javascript/alert.js') }}"></script>

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

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

Expand Down Expand Up @@ -50,4 +52,4 @@
}
});
});
</script>
</script>
39 changes: 39 additions & 0 deletions web/templates/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ <h1 class="nav-header" >Jimi</h1>
</html>

<script>
var currentTab = null
var lastTab = null

function generateUUID() {
var d = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
Expand All @@ -110,17 +113,40 @@ <h1 class="nav-header" >Jimi</h1>
var id = generateUUID();
$('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>');
$('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>');
$('ul#tabs > li').click(function() {
if (currentTab != null) {
lastTab = currentTab;
}
currentTab = id
});
$('ul#tabs > li').removeClass("active");
$('div.tab-content div').removeClass("active");
$('ul#tabs > li#li' + id).addClass("active");
$('div.tab-content div#tab' + id).addClass("active");
if (currentTab != null) {
lastTab = currentTab;
}
currentTab = id
}


function removeTab(liElem) {
$('ul#tabs > li#li' + liElem).remove();
$('div.tab-content div#tab' + liElem).remove();
}

function swtichTab() {
if ( currentTab != null ) {
$('ul#tabs > li').removeClass("active");
$('div.tab-content div').removeClass("active");
$('ul#tabs > li#li' + lastTab).addClass("active");
$('div.tab-content div#tab' + lastTab).addClass("active");
changeTab = currentTab;
currentTab = lastTab;
lastTab = changeTab;
}
}

</script>

<script>
Expand Down Expand Up @@ -195,3 +221,16 @@ <h1 class="nav-header" >Jimi</h1>
});

</script>

<script>
$(document).ready(function () {
$(window).bind("keydown", function (event) {
if (event.ctrlKey || event.metaKey) {
console.log(event.keyCode)
if (event.keyCode == 223) {
swtichTab();
}
}
})
});
</script>
5 changes: 4 additions & 1 deletion web/templates/modelEditorList.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

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

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


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

Expand Down Expand Up @@ -279,4 +281,5 @@
var alert = $(".alert-container");
locationHandler();
});
</script>
</script>

4 changes: 3 additions & 1 deletion web/templates/myAccount.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<script src="{{ url_for('static', filename='includes/visjs/js/moment.js') }}"></script>
<script src="{{ url_for('static', filename='includes/datatables/js/datetime.moment.js') }}"></script>

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

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

<link rel="stylesheet" href="{{ url_for('static', filename='css/modelEditor.css') }}">
Expand Down Expand Up @@ -116,4 +118,4 @@
var alert = $(".alert-container");
getAccount();
});
</script>
</script>
4 changes: 3 additions & 1 deletion web/templates/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<script src="{{ url_for('static', filename='includes/visjs/js/moment.js') }}"></script>
<script src="{{ url_for('static', filename='includes/datatables/js/datetime.moment.js') }}"></script>

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

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

<link rel="stylesheet" href="{{ url_for('static', filename='themes/default/default.css') }}">
Expand Down Expand Up @@ -60,4 +62,4 @@
}
table.draw();
});
</script>
</script>
3 changes: 2 additions & 1 deletion web/templates/workers.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<head>
<title>JIMI - Workers</title>
<link rel="stylesheet" href="{{ url_for('static', filename='themes/default/default.css') }}">
<script src="{{ url_for('static', filename='javascript/hotkeys.js') }}"></script>
</head>
<body class="theme-panelContainer">
{{ content|safe }}
</body>
</html>
</html>

0 comments on commit e04c6b2

Please sign in to comment.