Created
November 14, 2011 15:00
-
-
Save oleriesenberg/1364113 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Deeplinking = function() { | |
var deeplink_map = {}; | |
function initialize(map) { | |
deeplink_map = map; | |
$(document).ready(function() { | |
var query = jQuery.parseQuery(); | |
for (queryKey in deeplink_map) { | |
if (query.hasOwnProperty(queryKey)) { | |
switch (typeof(deeplink_map[queryKey])) { | |
case 'object': | |
for (value in deeplink_map[queryKey]) { | |
if (query[queryKey] == value) { | |
if (typeof(deeplink_map[queryKey][value]) == 'function') { | |
deeplink_map[queryKey][value](); | |
} else { | |
ULM.Layover.load(deeplink_map[queryKey][value]) | |
} | |
} | |
} | |
break; | |
case 'function': | |
deeplink_map[queryKey](query[queryKey]); | |
break; | |
default: | |
ULM.Layover.load(deeplink_map[queryKey]) | |
break; | |
} | |
} | |
} | |
}); | |
} | |
return { | |
initialize: initialize | |
} | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment