summaryrefslogtreecommitdiff
path: root/itjs/state.js
diff options
context:
space:
mode:
Diffstat (limited to 'itjs/state.js')
-rw-r--r--itjs/state.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/itjs/state.js b/itjs/state.js
index 9521093..73e41cb 100644
--- a/itjs/state.js
+++ b/itjs/state.js
@@ -8,6 +8,7 @@ var it_state =
{
it_iframe: null,
it_history_field: null,
+it_state_saved: false,
it_store_handlers: [],
it_restore_handlers: [],
@@ -44,12 +45,18 @@ register_restore_handler: function(p)
*/
new_history_entry: function(p)
{
- // ED('it_state::new_history_entry()');
+ this.store_state();
+ this.it_state_saved = true;
if (!this.it_iframe && !(this.it_iframe = document.getElementById('it_state')))
ED('it_state::new_history_entry(): it_state object not found!');
- this.it_iframe.src = "/itjs/state.html?t="+it_now();
+ var idoc;
+ if (idoc = it_get_iframe_document(this.it_iframe))
+ {
+ idoc.title = document.title;
+ idoc.forms[0].submit();
+ }
this.it_history_field = null;
},
@@ -64,18 +71,18 @@ restore_history: function()
var idoc = it_get_iframe_document(this.it_iframe);
this.it_history_field = idoc ? idoc.getElementById('state') : {}; // Work-around IE5 not returning iframe document
+ this.it_state_saved = false;
if (this.it_history_field.value)
{
var res = eval('({' + this.it_history_field.value + '})');
- // ED('it_state::restore_history(): restoring these settings:', res);
for (var key in res)
this[key] = res[key];
}
for (var i in this.it_restore_handlers)
{
- if (this.it_history_field.value || (this.it_restore_handlers[i].initial && (!idoc || !it_get_iframe_document(this.it_iframe).location.href.match(/t=/))))
+ if (this.it_history_field.value || (this.it_restore_handlers[i].initial && (!idoc || !idoc.location.href.match(/s=/))))
this.it_restore_handlers[i].object[this.it_restore_handlers[i].method]();
}
},
@@ -103,7 +110,6 @@ store_state: function()
ser[ser.length] = key + ':' + ((type == 'string') ? "'" + value.replace(/([\\'])/g, '\\\1') + "'" : value);
}
- // ED('it_state::store_state()', ser);
this.it_history_field.value = ser.join(',');
}/* NO COMMA */
}