From a2ab708aeffe2a5031865a26ff299c50ce9c0941 Mon Sep 17 00:00:00 2001 From: cat Date: Wed, 18 Jun 2014 13:33:38 +0200 Subject: [PATCH] LSP: explain IH-system on login page untill turned off through localStorage (if browser supports) --- lsp/main.css | 3 +++ lsp/main.js | 17 ++++++++++++----- lsp/pages.js | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/lsp/main.css b/lsp/main.css index a8953cdb..c0ed5056 100755 --- a/lsp/main.css +++ b/lsp/main.css @@ -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; diff --git a/lsp/main.js b/lsp/main.js index a06f69d7..0d88e038 100755 --- a/lsp/main.js +++ b/lsp/main.js @@ -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; -}); \ No newline at end of file +}); + +function localStorageSupported() { + //does this browser support it? + try { + return 'localStorage' in window && window['localStorage'] !== null; + } catch (e) { + return false; + } +} \ No newline at end of file diff --git a/lsp/pages.js b/lsp/pages.js index 8aa4d689..254200fd 100755 --- a/lsp/pages.js +++ b/lsp/pages.js @@ -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 = $('
').addClass('ih-balloon').addClass('pageinfo').html( + '

New here?
Click the Integrated Help logo for more information about the current page.

' + ); + if (localStorageSupported()) { + $msg.append( + $('').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');