fix glitch with switching between new and classic

This commit is contained in:
Hannes Mannerheim 2014-11-27 12:54:56 +01:00
parent e19892584f
commit 76ea483a2a
3 changed files with 10 additions and 6 deletions

View File

@ -246,7 +246,11 @@ class QvitterPlugin extends Plugin {
}
}
$action->inlineScript('var toggleQvitterAPIURL = \''.common_path('', true).'api/qvitter/toggle_qvitter.json\'; var toggleText = \'New '.str_replace("'","\'",common_config('site','name')).'\';var qvitterEnabled = '.$qvitter_enabled.';');
$action->inlineScript(' var toggleQvitterAPIURL = \''.common_path('', true).'api/qvitter/toggle_qvitter.json\';
var toggleText = \'New '.str_replace("'","\'",common_config('site','name')).'\';
var qvitterEnabled = '.$qvitter_enabled.';
var qvitterAllLink = \''.common_local_url('all', array('nickname' => $user->nickname)).'\';
');
$action->script($this->path('js/toggleqvitter.js'));
}
}

View File

@ -384,7 +384,7 @@ $('#rememberme_label').disableSelection();
· · · · · · · · · · · · · */
$('#logout').click(function(){
window.location.href =window.siteInstanceURL + 'main/logout';
window.location.href =window.siteInstanceURL + 'main/logout';
});
@ -406,14 +406,14 @@ $('#faq-link').click(function(){
/* ·
·
· Classic Link, toggle setting in api and reload page when finished
· Classic Link, toggle setting in api and redirect to /all
·
· · · · · · · · · · · · · */
$('#classic-link').click(function(){
getFromAPI('qvitter/toggle_qvitter.json',function(data){
if(data.success === true) {
location.reload(); // reload
window.location.href = window.siteInstanceURL + window.loggedIn.screen_name + '/all';
}
});

View File

@ -42,7 +42,7 @@
if(qvitterEnabled) {
$('#site_nav_global_primary').find('.nav').first().prepend('<li id="toggleqvitter"><a href="' + $('.home.bookmark').attr('href') + '">' + toggleText + '</a></li>');
$('#site_nav_global_primary').find('.nav').first().prepend('<li id="toggleqvitter"><a href="' + qvitterAllLink + '">' + toggleText + '</a></li>');
}
else {
$('#site_nav_global_primary').find('.nav').first().prepend('<li id="toggleqvitter"><a href="' + location.href + '">' + toggleText + '</a></li>');
@ -51,7 +51,7 @@ else {
e.preventDefault();
$.get(toggleQvitterAPIURL,function(data){
if(data.success === true) {
location.reload(); // reload
window.location.href = qvitterAllLink;
}
});