LSP: explain IH-system on login page untill turned off through localStorage (if browser supports)

This commit is contained in:
cat 2014-06-18 13:33:38 +02:00 committed by Thulinma
parent f417df5de5
commit a2ab708aef
3 changed files with 33 additions and 5 deletions

View file

@ -90,7 +90,10 @@ body {
#message > a {
text-decoration: underline;
color: #505050;
}
a {
cursor: pointer;
text-decoration: underline;
}
#ih-button, #ih-button.active:hover {
position: absolute;

View file

@ -1455,10 +1455,8 @@ $(function(){
$('#ih-button').click(function(){
if (ih) {
$('.ih-balloon').remove();
}
else {
$('.ih-balloon').remove();
if (!ih) {
getWikiData('/wiki/Integrated_Help',function(data){
settings.ih = {
raw: data.find('#mw-content-text').contents(),
@ -1498,4 +1496,13 @@ $(window).on('hashchange', function(e) {
showTab(loc[0]);
}
ignoreHashChange = false;
});
});
function localStorageSupported() {
//does this browser support it?
try {
return 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}
}

View file

@ -68,6 +68,24 @@ function showTab(tabName,streamName) {
$('#server').val(adr[1]);
$('#credentials-username').val(adr[0]);
}
//new here? message
if ((!localStorageSupported) || (!localStorage['MistServer_notnew'])) {
var $msg = $('<div>').addClass('ih-balloon').addClass('pageinfo').html(
'<p>New here?<br>Click the Integrated Help logo for more information about the current page.</p>'
);
if (localStorageSupported()) {
$msg.append(
$('<a>').text('Don\'t show this again.').click(function(){
localStorage['MistServer_notnew'] = 1;
$(this).closest('.ih-balloon').remove();
})
);
}
$('#page').prepend($msg);
}
break;
case 'create new account':
$('#menu').css('visibility', 'hidden');