Merge lp:~daker/ubuntu-html5-theme/fix.1293899 into lp:ubuntu-html5-theme
Proposed by
Adnane Belmadiaf
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Alexandre Abreu | ||||||||
Approved revision: | 166 | ||||||||
Merged at revision: | 189 | ||||||||
Proposed branch: | lp:~daker/ubuntu-html5-theme/fix.1293899 | ||||||||
Merge into: | lp:ubuntu-html5-theme | ||||||||
Diff against target: |
90 lines (+65/-1) 1 file modified
0.1/ambiance/js/toolbars.js (+65/-1) |
||||||||
To merge this branch: | bzr merge lp:~daker/ubuntu-html5-theme/fix.1293899 | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexandre Abreu | Approve | ||
Review via email: mp+213394@code.launchpad.net |
Commit message
Added timer to hide the toolbar
To post a comment you must log in.
I think it could be a bit better/cleaner. Maybe something more consistent, and prone to errors (forgot to add a window. clearTimeout, etc.) w/ e.g. the MutationObserver class:
function ToolbarListener(id) { onChangedCallba cks = []; ener.prototype = { _onChangedCallb acks.push( callback) ; rClass = _getNativeMutat ionObserverClas s(); rClass) { getElementById( this._id) ; rClass( _onMutated. bind(this) ); observe( toolbar, {attributes: true}); Callbacks. length; ++i) { _onChangedCallb acks[i] (mutations) ; tionObserverCla ss: function() { MutationObserve r || window. WebKitMutationO bserver;
this._id = id;
this._
this._listen();
};
ToolbarList
onchanged: function(callback) {
if (callback && typeof callback === 'function')
this.
},
_listen: function() {
var mutationObserve
this.
if ( ! mutationObserve
console.error(
'Could not listen to toolbar changes: no mutation observer found');
return;
}
var toolbar = document.
if (toolbar) {
var observer = new mutationObserve
this.
observer.
}
},
_onMutated: function(mutations, observer) {
for (var i = 0; i < this._onChanged
this.
}
},
_getNativeMuta
return window.
},
};
and in function Toolbar(id, touchInfoDelegate):
this._timer = null;
var listener = new ToolbarListener (id); onchanged( function( ) { ble() { .slice. call(toolbar. classList) .indexOf( 'revealed' ) >= 0; ible()) { clearTimeout( self._timer) ;
var self = this;
listener.
var toolbar = self.toolbar;
function __isToolbarVisi
return Array.prototype
}
if (__isToolbarVis
self._timer = window.setTimeout(
function () { self.hide(); },
5000);
}
else {
if (self._timer) {
window.
self._timer = null;
}
}
});
no need to sparkle logic bits in the class, the states are kept consistent in one location along w/ the management of the timer
?