diff --git a/pom.xml b/pom.xml
index a956ae8..a8f506b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
4.0.0
de.srsoftware
web4rail
- 0.6.8
+ 0.6.9
Web4Rail
jar
Java Model Railway Control
diff --git a/resources/js/plan.js b/resources/js/plan.js
index ede0ab4..32991b8 100644
--- a/resources/js/plan.js
+++ b/resources/js/plan.js
@@ -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){
$(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){
}
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){