Browse Source

implemented storing of tiling layout on device

lookup-tables
Stephan Richter 5 years ago
parent
commit
6986c418e7
  1. 2
      pom.xml
  2. 35
      resources/js/plan.js

2
pom.xml

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.srsoftware</groupId>
<artifactId>web4rail</artifactId>
<version>0.6.8</version>
<version>0.6.9</version>
<name>Web4Rail</name>
<packaging>jar</packaging>
<description>Java Model Railway Control</description>

35
resources/js/plan.js

@ -101,6 +101,11 @@ function fadeMessage(){ @@ -101,6 +101,11 @@ function fadeMessage(){
$('#messages').css('opacity',o/OPAC);
}
function getCookie(key) {
var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
return keyValue ? keyValue[2] : null;
}
function heartbeat(data){
$('#heartbeat').show().fadeOut(2000);
return false;
@ -162,12 +167,9 @@ function request(data){ @@ -162,12 +167,9 @@ function request(data){
$(PLAN).append($(resp));
} else if (resp.startsWith('<')) {
var isWindow = $(resp).attr('class') == 'window';
if (isWindow){
$('.window').remove();
$('#plan').css('height','50%');
}
$(BODY).append($(resp));
$('.window').css('height','50%');
if (isWindow) $('.window').remove();
$(BODY).append($(resp));
if (isWindow) tileWindow();
} else {
addMessage(resp);
}
@ -202,15 +204,18 @@ function stream(ev){ @@ -202,15 +204,18 @@ function stream(ev){
}
function swapTiling(ev){
if ($('.swapbtn').text() == '◧'){
$('.swapbtn').text('⬒');
$('.window').css('height','').css('width','50%');
$(PLAN).css('height','').css('width','50%');
} else {
$('.swapbtn').text('◧');
$('.window').css('height','50%').css('width','');
$(PLAN).css('height','50%').css('width','');
}
var vertical = getCookie("tiling") == 'v';
document.cookie = "tiling="+(vertical?'h':'v');
tileWindow();
}
function tileWindow(){
var vertical = getCookie("tiling") == 'v';
var width = vertical ? '50%':'';
var height = vertical ? '' : '50%';
$(PLAN).css('width',width).css('height',height);
$('.window').css('width',width).css('height',height);
$('.swapbtn').text(vertical ? '⇩' : '⇨');
}
function train(id,action){

Loading…
Cancel
Save