mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
added onhashchange handling...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6b16845856
commit
0672387994
@ -2783,18 +2783,37 @@ module.DirectControlGSAP = core.ImageGridFeatures.Feature({
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
// XXX make this browser specific... (???)
|
||||
// XXX make this work for external links in a stable manner...
|
||||
var URLHash =
|
||||
module.URLHash = core.ImageGridFeatures.Feature({
|
||||
title: '',
|
||||
title: 'Handle URL hash',
|
||||
doc: '',
|
||||
|
||||
tag: 'ui-url-hash',
|
||||
depends: ['ui'],
|
||||
|
||||
//isApplicable: function(){
|
||||
// return typeof(location) != 'undefined' && location.hash != null },
|
||||
isApplicable: function(){ return this.runtime == 'browser' },
|
||||
|
||||
handlers: [
|
||||
// hanlde window.onhashchange event...
|
||||
['start',
|
||||
function(){
|
||||
var that = this
|
||||
var handler = this.__hashchange_handler = function(){
|
||||
var h = location.hash
|
||||
h = h.replace(/^#/, '')
|
||||
that.current = h
|
||||
}
|
||||
$(window).on('hashchange', handler)
|
||||
}],
|
||||
['stop',
|
||||
function(){
|
||||
this.__hashchange_handler
|
||||
&& $(window).on('hashchange', this.__hashchange_handler)
|
||||
}],
|
||||
// store/restore hash when we focus images...
|
||||
['focusImage',
|
||||
function(res, a){
|
||||
if(this.current && this.current != ''){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user