in URL controller, get and set hash

This commit is contained in:
rolux 2013-02-18 17:31:36 +05:30
parent 5bfcf51a1f
commit e7c79f512e

View file

@ -10,12 +10,14 @@ pandora.URL = (function() {
Ox.Log('URL', 'getState:, UI', pandora.user.ui) Ox.Log('URL', 'getState:, UI', pandora.user.ui)
if (pandora.user.ui.page) {
return {page: pandora.user.ui.page};
}
var state = {}; var state = {};
if (pandora.user.ui.page) {
state.page = pandora.user.ui.page;
} else {
state.type = pandora.user.ui.section == 'items' ? pandora.site.itemsSection : pandora.user.ui.section; state.type = pandora.user.ui.section == 'items' ? pandora.site.itemsSection : pandora.user.ui.section;
state.item = pandora.user.ui[pandora.user.ui.section.slice(0, -1)]; state.item = pandora.user.ui[pandora.user.ui.section.slice(0, -1)];
@ -50,6 +52,10 @@ pandora.URL = (function() {
); );
} }
}
state.hash = pandora.user.ui.hash;
Ox.Log('', 'URL', 'STATE ...', state) Ox.Log('', 'URL', 'STATE ...', state)
return state; return state;
@ -135,11 +141,18 @@ pandora.URL = (function() {
} }
} }
if (state.hash && state.hash.query) { if (state.hash) {
set.hash = state.hash;
if (state.hash.query) {
if (state.hash.query.embed === true) {
} else {
state.hash.query.forEach(function(kv) { state.hash.query.forEach(function(kv) {
set[kv.key] = kv.value; set[kv.key] = kv.value;
}); });
} }
}
}
Ox.Request.cancel(); Ox.Request.cancel();
$('video').each(function() { $('video').each(function() {
@ -367,7 +380,7 @@ pandora.URL = (function() {
}; };
that.update = function(keys) { that.update = function(keys) {
Ox.Log('', 'update.........', keys) Ox.Log('URL', 'update.........', keys)
// this gets called from pandora.UI // this gets called from pandora.UI
var action, state; var action, state;
if (!keys) { if (!keys) {