Added cookies to remember tabs

Wed, 14 Jan 2015 12:50:12 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 14 Jan 2015 12:50:12 +0100
changeset 304
c1be51c076c9
parent 303
19a9a3912d03
child 305
fc2fae36f4ba

Added cookies to remember tabs

www-thermferm/liveview.php file | annotate | diff | comparison | revisions
--- a/www-thermferm/liveview.php	Wed Dec 17 15:44:58 2014 +0100
+++ b/www-thermferm/liveview.php	Wed Jan 14 12:50:12 2015 +0100
@@ -428,6 +428,19 @@
     if (strlen($answer)) {
 	$arr = explode("\r\n", $answer);
 
+	$outstr .= '   <script type="text/javascript">'.PHP_EOL;
+	$outstr .= '    $(document).ready(function () {'.PHP_EOL;
+	$outstr .= '     var index = $.jqx.cookie.cookie("jqxTabs_jqxWidget");'.PHP_EOL;
+	$outstr .= '     if (undefined == index) index = 0;'.PHP_EOL;
+	$outstr .= '       $(\'#jqxTabs\').jqxTabs({selectedItem: index, width: \'90%\', height: 200, position: \'top\'});'.PHP_EOL;
+	// on to the select event.
+	$outstr .= '       $("#jqxTabs").on(\'selected\', function (event) {'.PHP_EOL;
+	// save the index in cookie.
+	$outstr .= '       $.jqx.cookie.cookie("jqxTabs_jqxWidget", event.args.item);'.PHP_EOL;
+	$outstr .= '     });'.PHP_EOL;
+	$outstr .= '    });'.PHP_EOL;
+	$outstr .= '   </script>'.PHP_EOL;
+
 	$outstr .= '   <div id="jqxTabs">'.PHP_EOL;
 	$outstr .= '    <ul>'.PHP_EOL;
 	if (startsWith($arr[0], "212")) {

mercurial