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) { function setState(state, callback) {
var set = {};
Ox.Log('URL', 'setState:', state); Ox.Log('URL', 'setState:', state);
pandora.user.ui._list = pandora.getListState(pandora.user.ui.find); pandora.user.ui._list = pandora.getListState(pandora.user.ui.find);
@ -77,14 +79,33 @@ pandora.URL = (function() {
} }
callback && callback(); 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(); callback && callback();
} else { } else {
var set = {page: ''}; set.page = '';
if (state.type) { if (state.type) {
set.section = state.type == pandora.site.itemsSection ? 'items' : state.type set.section = state.type == pandora.site.itemsSection ? 'items' : state.type
set[set.section.slice(0, -1)] = state.item; 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(); Ox.Request.cancel();
$('video').each(function() { $('video').each(function() {
$(this).trigger('stop'); $(this).trigger('stop');
@ -182,6 +190,8 @@ pandora.URL = (function() {
} }
}
pandora.user.ui.showHome = false; pandora.user.ui.showHome = false;
} }