projects
/
roojs1
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
allow string based values for comboboxarray
[roojs1]
/
Roo
/
History.js
diff --git
a/Roo/History.js
b/Roo/History.js
index
b234b24
..
91ae8d2
100644
(file)
--- a/
Roo/History.js
+++ b/
Roo/History.js
@@
-1,17
+1,22
@@
/**
* Originally based of this code... - refactored for Roo...
/**
* Originally based of this code... - refactored for Roo...
- *
+ * https://github.com/browserstate/history.js
+
* History.js Core
* @author Benjamin Arthur Lupton <contact@balupton.com>
* @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
* @license New BSD License <http://creativecommons.org/licenses/BSD/>
* History.js Core
* @author Benjamin Arthur Lupton <contact@balupton.com>
* @copyright 2010-2011 Benjamin Arthur Lupton <contact@balupton.com>
* @license New BSD License <http://creativecommons.org/licenses/BSD/>
+ *
+ * Hackily modifyed by alan@roojs.com
+ *
+ * this is not initialized automatically..
+ * must call Roo.History.init( { ... options... });
+ *
+ * TOTALLY UNTESTED...
+ *
+ * Documentation to be done....
*/
*/
-
-// this is not initialized automatically..
-// must call Roo.History.init( { ... options... });
-
-
Roo.History = {
Roo.History = {
@@
-208,20
+213,14
@@
Roo.History = {
Roo.apply(this,options)
Roo.apply(this,options)
- // Check Load Status of Adapter
- //if ( typeof this.Adapter === 'undefined' ) {
- // return false;
- //}
-
+
// Check Load Status of Core
// Check Load Status of Core
- if ( typeof this.initCore !== 'undefined' ) {
- this.initCore();
- }
-
+ this.initCore();
+
// Check Load Status of HTML4 Support
// Check Load Status of HTML4 Support
- if ( typeof this.initHtml4 !== 'undefined' ) {
-
this.initHtml4();
- }
+
//
if ( typeof this.initHtml4 !== 'undefined' ) {
+
//
this.initHtml4();
+
//
}
this.initEmulated();
this.initEmulated();
@@
-241,7
+240,7
@@
Roo.History = {
-
this.Adapter.bind(window,'popstate',this.onPopState
);
+
Roo.get(window).on('popstate',this.onPopState, this
);
/**
/**
@@
-258,8
+257,8
@@
Roo.History = {
this.intervalList.push(setInterval(this.onUnload,this.storeInterval));
// For Other Browsers
this.intervalList.push(setInterval(this.onUnload,this.storeInterval));
// For Other Browsers
-
this.Adapter.bind(window,'beforeunload',this.onUnload
);
-
this.Adapter.bind(window,'unload',this.onUnload
);
+
Roo.get(window).on('beforeunload',this.onUnload,this
);
+
Roo.get(window).on('unload',this.onUnload, this
);
} else {
this.onUnload = emptyFunction;
} else {
this.onUnload = emptyFunction;
@@
-270,7
+269,7
@@
Roo.History = {
/**
* Clear Intervals on exit to prevent memory leaks
*/
/**
* Clear Intervals on exit to prevent memory leaks
*/
-
this.Adapter.bind(window,"unload",this.clearAllInterval
s);
+
Roo.get(window).on('unload',this.clearAllIntervals, thi
s);
/**
* Create the initial State
/**
* Create the initial State
@@
-304,14
+303,14
@@
Roo.History = {
*/
// Setup Alias
*/
// Setup Alias
-
this.Adapter.bind(window,
'hashchange',function(){
-
_this.Adapter.trigger(window,
'popstate');
- });
+
Roo.get(window).on(
'hashchange',function(){
+
Roo.get(window).fireEvent(
'popstate');
+ }
, this
);
// Initialise Alias
if ( this.getHash() ) {
// Initialise Alias
if ( this.getHash() ) {
-
this.Adapter.onDomLoad
(function(){
-
_this.Adapter.trigger(window,
'hashchange');
+
Roo.onReady
(function(){
+
Roo.get(window).fireEvent(
'hashchange');
});
}
}
});
}
}
@@
-1434,6
+1433,8
@@
Roo.History = {
*/
busy : function(value){
// Apply
*/
busy : function(value){
// Apply
+
+ var _this = this;
if ( typeof value !== 'undefined' ) {
//this.debug('this.busy: changing ['+(this.busy.flag||false)+'] to ['+(value||false)+']', this.queues.length);
this.busy_flag = value;
if ( typeof value !== 'undefined' ) {
//this.debug('this.busy: changing ['+(this.busy.flag||false)+'] to ['+(value||false)+']', this.queues.length);
this.busy_flag = value;
@@
-1445,17
+1446,20
@@
Roo.History = {
// Queue
if ( !this.busy_flag ) {
// Queue
if ( !this.busy_flag ) {
+
+
+
// Execute the next item in the queue
window.clearTimeout(this.busy.timeout);
var fireNext = function(){
var i, queue, item;
// Execute the next item in the queue
window.clearTimeout(this.busy.timeout);
var fireNext = function(){
var i, queue, item;
- if ( this.busy_flag ) return;
- for ( i=this.queues.length-1; i >= 0; --i ) {
- queue = this.queues[i];
+ if (
_
this.busy_flag ) return;
+ for ( i=
_
this.queues.length-1; i >= 0; --i ) {
+ queue =
_
this.queues[i];
if ( queue.length === 0 ) continue;
item = queue.shift();
if ( queue.length === 0 ) continue;
item = queue.shift();
- this.fireQueueItem(item);
-
this.busy.timeout = window.setTimeout(fireNext,
this.busyDelay);
+
_
this.fireQueueItem(item);
+
_this.busy.timeout = window.setTimeout(fireNext,_
this.busyDelay);
}
};
this.busy.timeout = window.setTimeout(fireNext,this.busyDelay);
}
};
this.busy.timeout = window.setTimeout(fireNext,this.busyDelay);
@@
-1568,7
+1572,9
@@
Roo.History = {
* Create a double check
* @return {Roo.History}
*/
* Create a double check
* @return {Roo.History}
*/
- doubleCheck : function(tryAgain){
+ doubleCheck : function(tryAgain)
+ {
+ var _this = this;
// Reset
this.stateChanged = false;
this.doubleCheckClear();
// Reset
this.stateChanged = false;
this.doubleCheckClear();
@@
-1579,8
+1585,8
@@
Roo.History = {
// Apply Check
this.doubleChecker = window.setTimeout(
function(){
// Apply Check
this.doubleChecker = window.setTimeout(
function(){
- this.doubleCheckClear();
- if ( !this.stateChanged ) {
+
_
this.doubleCheckClear();
+ if ( !
_
this.stateChanged ) {
//this.debug('History.doubleCheck: State has not yet changed, trying again', arguments);
// Re-Attempt
tryAgain();
//this.debug('History.doubleCheck: State has not yet changed, trying again', arguments);
// Re-Attempt
tryAgain();
@@
-1629,7
+1635,7
@@
Roo.History = {
// Apply the New State
//this.debug('this.safariStatePoll: trigger');
// Apply the New State
//this.debug('this.safariStatePoll: trigger');
-
this.Adapter.trigger(window,
'popstate');
+
Roo.get(window).fireEvent(
'popstate');
// Chain
return this;
// Chain
return this;
@@
-1644,9
+1650,10
@@
Roo.History = {
* Send the browser history back one item
* @param {Integer} queue [optional]
*/
* Send the browser history back one item
* @param {Integer} queue [optional]
*/
- back : function(queue){
+ back : function(queue)
+ {
//this.debug('this.back: called', arguments);
//this.debug('this.back: called', arguments);
-
+ var _this = this;
// Handle Queueing
if ( queue !== false && this.busy() ) {
// Wait + Push to Queue
// Handle Queueing
if ( queue !== false && this.busy() ) {
// Wait + Push to Queue
@@
-1665,7
+1672,7
@@
Roo.History = {
// Fix certain browser bugs that prevent the state from changing
this.doubleCheck(function(){
// Fix certain browser bugs that prevent the state from changing
this.doubleCheck(function(){
- this.back(false);
+
_
this.back(false);
});
// Go back
});
// Go back
@@
-1778,7
+1785,7
@@
Roo.History = {
else {
// Traditional Anchor
//this.debug('this.onPopState: traditional anchor', currentHash);
else {
// Traditional Anchor
//this.debug('this.onPopState: traditional anchor', currentHash);
-
this.Adapter.trigger(window,
'anchorchange');
+
Roo.get(window).fireEvent(
'anchorchange');
this.busy(false);
}
this.busy(false);
}
@@
-1786,9
+1793,10
@@
Roo.History = {
this.expectedStateId = false;
return false;
}
this.expectedStateId = false;
return false;
}
+ stateId = (event && event.browserEvent && event.browserEvent['state']) || (extra && extra['state']) || undefined;
// Ensure
// Ensure
- stateId = this.Adapter.extractEventData('state',event,extra) || false;
+
//
stateId = this.Adapter.extractEventData('state',event,extra) || false;
// Fetch State
if ( stateId ) {
// Fetch State
if ( stateId ) {
@@
-1829,7
+1837,7
@@
Roo.History = {
this.setTitle(newState);
// Fire Our Event
this.setTitle(newState);
// Fire Our Event
-
this.Adapter.trigger(window,
'statechange');
+
Roo.get(window).fireEvent(
'statechange');
this.busy(false);
// Return true
this.busy(false);
// Return true
@@
-1892,7
+1900,7
@@
Roo.History = {
history.pushState(newState.id,newState.title,newState.url);
// Fire HTML5 Event
history.pushState(newState.id,newState.title,newState.url);
// Fire HTML5 Event
-
this.Adapter.trigger(window,
'popstate');
+
Roo.get(window).fireEvent(
'popstate');
}
// End pushState closure
}
// End pushState closure
@@
-1949,7
+1957,7
@@
Roo.History = {
history.replaceState(newState.id,newState.title,newState.url);
// Fire HTML5 Event
history.replaceState(newState.id,newState.title,newState.url);
// Fire HTML5 Event
-
this.Adapter.trigger(window,
'popstate');
+
Roo.get(window).fireEvent(
'popstate');
}
// End replaceState closure
}
// End replaceState closure
@@
-2032,6
+2040,4
@@
Roo.History = {
}
}
}
}
}
}
-};
-
-
\ No newline at end of file
+};
\ No newline at end of file