Move user to local storage part one, should work already

This commit is contained in:
2012-12-07 14:46:34 +01:00
parent fa68893510
commit 69dff38fd7
5 changed files with 47 additions and 58 deletions
+10 -17
View File
@@ -113,11 +113,12 @@ var $translations = {
}
function redirect_to(mapping, variables){
variables || (variables = {});
var vars = []
var vars = [];
for(var name in variables){
vars.push(name + '=' +variables[name])
vars.push(name + '=' +variables[name]);
Qstorage[name] = variables[name];
}
window.location = QMobile.root_url() + path_mapping[mapping] + '.html?' + vars.join('&')
window.location = QMobile.root_url() + path_mapping[mapping] + '.html'
}
function direct_to_site(mapping, variables){
variables || (variables = {});
@@ -156,29 +157,21 @@ $.ajaxSetup({
}
}
});
function getUrlVars() {
if($url_vars) return $url_vars;
$url_vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
$url_vars[key] = value;
});
return $url_vars;
}
var Qstorage = sessionStorage;
$(function(){
$locale = QMobile.locale();
if(getUrlVars().message){
if(Qstorage.message){
var container = $('.alert-success');
// Prepend messages. if there is no path/period specified
var message = t((getUrlVars().message.indexOf('.') > -1 ? '' : 'messages.' ) + getUrlVars().message )
container.find('div').text(message);
container.find('div').text($translations[$locale]['messages'][Qstorage.message]);
container.show();
Qstorage.removeItem('message');
}
if(getUrlVars().list_closed){
if(Qstorage.list_closed){
var container = $('.alert-error');
container.find('div').text($translations[$locale]['messages']['the_list_has_been_closed']);
container.show();
Qstorage.removeItem('list_closed');
}
$('[data-t]').each(function(){$(this).text(t($(this).attr('data-t')))})
setTranslations();
});
function setLocale(locale){