summaryrefslogtreecommitdiff
path: root/itjs/state.js
diff options
context:
space:
mode:
authorThomas BrĂ¼derli2007-07-24 09:54:33 +0000
committerThomas BrĂ¼derli2007-07-24 09:54:33 +0000
commitc3cba034c8009b65c25dd4ef5f54b18d9c8ee7d4 (patch)
tree270dbe9f89efc50f1fc551c78b04796b58bca2a7 /itjs/state.js
parent5abbfdee24e0e059f6919f136b8fb07e4864e5e5 (diff)
downloaditools-c3cba034c8009b65c25dd4ef5f54b18d9c8ee7d4.tar.gz
itools-c3cba034c8009b65c25dd4ef5f54b18d9c8ee7d4.tar.bz2
itools-c3cba034c8009b65c25dd4ef5f54b18d9c8ee7d4.zip
Improved it_state with Safari support
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 */
}