Merge remote-tracking branch 'daprice/master' into devel

master
Gina Häußge 2013-03-16 00:28:37 +01:00
commit e08783c8bf
1 changed files with 15 additions and 11 deletions

View File

@ -1345,16 +1345,16 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor
var currentSorting = self.currentSorting();
if (currentSorting !== undefined)
localStorage[self.listType]["currentSorting"] = currentSorting;
localStorage[self.listType + "." + "currentSorting"] = currentSorting;
else
localStorage[self.listType]["currentSorting"] = undefined;
localStorage[self.listType + "." + "currentSorting"] = undefined;
}
self._loadCurrentSortingFromLocalStorage = function() {
self._initializeLocalStorage();
if (_.contains(_.keys(supportedSorting), localStorage[self.listType]["currentSorting"]))
self.currentSorting(localStorage[self.listType]["currentSorting"]);
if (_.contains(_.keys(supportedSorting), localStorage[self.listType + "." + "currentSorting"]))
self.currentSorting(localStorage[self.listType + "." + "currentSorting"]);
else
self.currentSorting(defaultSorting);
}
@ -1363,23 +1363,21 @@ function ItemListHelper(listType, supportedSorting, supportedFilters, defaultSor
self._initializeLocalStorage();
var filters = _.intersection(_.keys(self.supportedFilters), self.currentFilters());
localStorage[self.listType]["currentFilters"] = filters;
localStorage[self.listType + "." + "currentFilters"] = JSON.stringify(filters);
}
self._loadCurrentFiltersFromLocalStorage = function() {
self._initializeLocalStorage();
self.currentFilters(_.intersection(_.keys(self.supportedFilters), localStorage[self.listType, "currentFilters"]));
self.currentFilters(_.intersection(_.keys(self.supportedFilters), JSON.parse(localStorage[self.listType + "." + "currentFilters"])));
}
self._initializeLocalStorage = function() {
if (localStorage[self.listType] !== undefined)
if (localStorage[self.listType + "." + "currentSorting"] !== undefined && localStorage[self.listType + "." + "currentFilters"] !== undefined && JSON.parse(localStorage[self.listType + "." + "currentFilters"]) instanceof Array)
return;
localStorage[self.listType] = {
"currentSorting": self.defaultSorting,
"currentFilters": self.defaultFilters
}
localStorage[self.listType + "." + "currentSorting"] = self.defaultSorting;
localStorage[self.listType + "." + "currentFilters"] = JSON.stringify(self.defaultFilters);
}
self._loadCurrentFiltersFromLocalStorage();
@ -1434,6 +1432,12 @@ $(function() {
webcamViewModel,
gcodeViewModel
);
//work around a stupid iOS6 bug where ajax requests get cached and only work once, as described at http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results
$.ajaxSetup({
type: 'POST',
headers: { "cache-control": "no-cache" }
});
//~~ Show settings - to ensure centered
$('#navbar_show_settings').click(function() {