update URL controller

This commit is contained in:
rolux 2013-02-18 18:05:29 +05:30
parent 99856e49e7
commit 52dcf98edf

View file

@ -64,6 +64,8 @@ pandora.URL = (function() {
function setState(state, callback) {
var set = {};
Ox.Log('URL', 'setState:', state);
pandora.user.ui._list = pandora.getListState(pandora.user.ui.find);
@ -77,14 +79,33 @@ pandora.URL = (function() {
}
callback && callback();
} else if (state.page) {
} else {
pandora.UI.set(state);
if (state.hash) {
set.hash = state.hash;
if (state.hash.query) {
if (state.hash.query.embed === true) {
// ...
} else {
state.hash.query.forEach(function(kv) {
set[kv.key] = kv.value;
});
}
}
} else {
set.hash = {};
}
if (state.page) {
set.page = state.page;
pandora.UI.set(set);
callback && callback();
} else {
var set = {page: ''};
set.page = '';
if (state.type) {
set.section = state.type == pandora.site.itemsSection ? 'items' : state.type
set[set.section.slice(0, -1)] = state.item;
@ -141,19 +162,6 @@ pandora.URL = (function() {
}
}
if (state.hash) {
set.hash = state.hash;
if (state.hash.query) {
if (state.hash.query.embed === true) {
} else {
state.hash.query.forEach(function(kv) {
set[kv.key] = kv.value;
});
}
}
}
Ox.Request.cancel();
$('video').each(function() {
$(this).trigger('stop');
@ -182,6 +190,8 @@ pandora.URL = (function() {
}
}
pandora.user.ui.showHome = false;
}