@@ -169,6 +169,7 @@ function solo_submit() {
169169 action: '<?php echo $ route ->action ; ?> '
170170}
171171var Visitor = {
172+ id: <?php echo $ visitor ->id ; ?> ,
172173 token: '<?php echo authenticate (); ?> '
173174}
174175var Site = {
@@ -521,17 +522,19 @@ function solo_submit() {
521522
522523 // Remember unsaved text entered in the primary text input and textarea.
523524 if (!!sessionStorage) {
525+ var prefix = "user_" + Visitor.id;
526+
524527 $("#write_form .main_options input[type='text']").first(
525528 ).val(function() {
526529 try {
527- return sessionStorage.getItem("write_title ");
530+ return sessionStorage.getItem(prefix + "_write_title ");
528531 } catch(e) {
529532 console.log("Caught Exception: Window.sessionStorage.getItem()");
530533 return null;
531534 }
532535 }).on("change", function(e) {
533536 try {
534- sessionStorage.setItem("write_title ", $(this).val());
537+ sessionStorage.setItem(prefix + "_write_title ", $(this).val());
535538 } catch(e) {
536539 console.log("Caught Exception: Window.sessionStorage.setItem()");
537540 }
@@ -540,23 +543,23 @@ function solo_submit() {
540543 $("#write_form .main_options textarea").first(
541544 ).val(function(index, value) {
542545 try {
543- return sessionStorage.getItem("write_body ");
546+ return sessionStorage.getItem(prefix + "_write_body ");
544547 } catch(e) {
545548 console.log("Caught Exception: Window.sessionStorage.getItem()");
546549 return null;
547550 }
548551 }).on("change", function(e) {
549552 try {
550- sessionStorage.setItem("write_body ", $(this).val());
553+ sessionStorage.setItem(prefix + "_write_body ", $(this).val());
551554 } catch(e) {
552555 console.log("Caught Exception: Window.sessionStorage.setItem()");
553556 }
554557 });
555558
556559 $("#write_form").on("submit.sessionStorage", function(e) {
557560 try {
558- sessionStorage.removeItem("write_title ");
559- sessionStorage.removeItem("write_body ");
561+ sessionStorage.removeItem(prefix + "_write_title ");
562+ sessionStorage.removeItem(prefix + "_write_body ");
560563 } catch(e) {
561564 console.log("Caught Exception: Window.sessionStorage.removeItem()");
562565 }
0 commit comments