From 4ce8f52d60de3edcf06502efdeb35ad8ffef332a Mon Sep 17 00:00:00 2001 From: Christian Fenzl Date: Fri, 26 Oct 2018 01:55:08 +0200 Subject: [PATCH] V0.1.6 Fixed blank recognizion before value, UI --- plugin.cfg | 2 +- release.cfg | 4 ++-- templates/comrec.html | 38 +++++++++++++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/plugin.cfg b/plugin.cfg index 70e1135..a5c8a2c 100644 --- a/plugin.cfg +++ b/plugin.cfg @@ -10,7 +10,7 @@ EMAIL=christiantf@gmx.at [PLUGIN] # The version of your plugin - important if you would like to write an # upgrade script. -VERSION=0.1.5 +VERSION=0.1.6 # Short name and prefered subfolder of your Plugin (do not use blanks - they # will be filtered - and use lowercase only)! Used for script names in diff --git a/release.cfg b/release.cfg index e67c6f4..88b5253 100644 --- a/release.cfg +++ b/release.cfg @@ -5,10 +5,10 @@ # the donwload link here # Version of the new release -VERSION=0.1.5 +VERSION=0.1.6 # Download URL of the ZIP Archive -ARCHIVEURL=https://github.com/christianTF/LoxBerry-Plugin-CommandRecognition/archive/0.1.5.zip +ARCHIVEURL=https://github.com/christianTF/LoxBerry-Plugin-CommandRecognition/archive/0.1.6.zip # URL for further information about this release INFOURL=https://github.com/christianTF/LoxBerry-Plugin-CommandRecognition/releases diff --git a/templates/comrec.html b/templates/comrec.html index c4d7c35..2116a68 100644 --- a/templates/comrec.html +++ b/templates/comrec.html @@ -26,8 +26,8 @@

Source

@@ -65,6 +65,9 @@

Input text

$(function() { console.log("Loaded."); + var nav = sessionStorage.getItem("comrec_nav"); + if(nav !== null) { $('#'+nav).trigger("click"); } + restoreWindow(); }); $('#recognition').on('input', function() { @@ -76,12 +79,14 @@

Input text

$('#syntaxstatus').html('OK'); var recstr = $('#recognition').val(); + storeWindow("recognition", recstr); var regex = parse_recstring( recstr ); // var regexval = parse_valuestring( $('#recognition').val() ); var regexval; var conversion=0; if (recstr.indexOf('\\v') != -1) { - regexval = '^(-)?\\d+[.,]?\\d*'; + // regexval = '^(-)?\\d+[.,]?\\d*'; + regexval = '^(\\s)*(-)?\\d+[.,]?\\d*'; } else if (recstr.indexOf('\\1') != -1) { regexval = '[\x00-\xFF]'; @@ -156,6 +161,7 @@

Input text

str = str.replace('\\n', "\n"); rawhtml = str; $('#visiblehtml').html(htmlEncode(rawhtml)); + storeWindow ("inputstring", str) update_result(); }); @@ -252,6 +258,7 @@

Input text

$('#sslwarning').html(""); $('#visiblehtml').html('Please wait...'); var url = $('#fetchurl').val().trim(); + storeWindow("fetchurl", url); if (! url.startsWith("http://") && ! url.startsWith("https://")) { url = 'http://' + url; } @@ -319,4 +326,29 @@

Input text

return re; } +function storeWindow (name, val) +{ + sessionStorage.setItem("comrec_"+name, val); +} + +function restoreWindow() +{ + + var fetchurl = sessionStorage.getItem("comrec_fetchurl"); + var recognition = sessionStorage.getItem("comrec_recognition"); + var inputstring = sessionStorage.getItem("comrec_inputstring"); + + console.log(fetchurl, recognition, inputstring); + + if(fetchurl !== null) $("#fetchurl").val(fetchurl); + + if(inputstring !== null && $("#divstring").is(':visible')) { $("#inputstring").val(inputstring); $("#inputstring").trigger("input"); } + if(recognition !== null) { $("#recognition").val(recognition); $("#recognition").trigger("input"); } + + console.log("Inputs restored"); + +} + + +