mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +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 =
|
var URLHash =
|
||||||
module.URLHash = core.ImageGridFeatures.Feature({
|
module.URLHash = core.ImageGridFeatures.Feature({
|
||||||
title: '',
|
title: 'Handle URL hash',
|
||||||
doc: '',
|
doc: '',
|
||||||
|
|
||||||
tag: 'ui-url-hash',
|
tag: 'ui-url-hash',
|
||||||
depends: ['ui'],
|
depends: ['ui'],
|
||||||
|
|
||||||
|
//isApplicable: function(){
|
||||||
|
// return typeof(location) != 'undefined' && location.hash != null },
|
||||||
isApplicable: function(){ return this.runtime == 'browser' },
|
isApplicable: function(){ return this.runtime == 'browser' },
|
||||||
|
|
||||||
handlers: [
|
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',
|
['focusImage',
|
||||||
function(res, a){
|
function(res, a){
|
||||||
if(this.current && this.current != ''){
|
if(this.current && this.current != ''){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user