From 7bbb273c1cccddd1208fc4ccc39995080a5203c3 Mon Sep 17 00:00:00 2001 From: rugk Date: Tue, 25 Oct 2016 21:13:43 +0200 Subject: [PATCH] Add "JS not working" error message It is: * hidden by JS code executed as early as possible * not hidden by noscript tags, so that it is *not* shown when JavaScript is just no activated Fix https://github.com/PrivateBin/PrivateBin/issues/103 --- css/noscript.css | 15 +++++++++++++++ css/privatebin.css | 14 +++++++------- js/privatebin.js | 5 +++++ tpl/bootstrap-compact.php | 2 +- tpl/bootstrap-dark-page.php | 2 +- tpl/bootstrap-dark.php | 2 +- tpl/bootstrap-page.php | 2 +- tpl/bootstrap.php | 6 ++++-- tpl/page.php | 2 +- 9 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 css/noscript.css diff --git a/css/noscript.css b/css/noscript.css new file mode 100644 index 00000000..97ef60d5 --- /dev/null +++ b/css/noscript.css @@ -0,0 +1,15 @@ +/** + * PrivateBin + * + * CSS file only loaded when no JavaScript available. + * + * @link https://github.com/PrivateBin/PrivateBin + * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net) + * @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License + * @version 1.0 + */ + +/* When there is no script at all other */ +.noscript-hide { + display: none; +} diff --git a/css/privatebin.css b/css/privatebin.css index 5a6d80d6..fa97c89c 100644 --- a/css/privatebin.css +++ b/css/privatebin.css @@ -1,7 +1,7 @@ /** * PrivateBin * - * a zero-knowledge paste bin + * Main CSS file. * * @link https://github.com/PrivateBin/PrivateBin * @copyright 2012 Sébastien SAUVAGE (sebsauvage.net) @@ -161,7 +161,7 @@ button, .button { background-clip: padding-box; } -button:hover { +button:hover { background-image: linear-gradient(bottom, #424b57 0%, #61707e 100%); background-image: -o-linear-gradient(bottom, #424b57 0%, #61707e 100%); background-image: -moz-linear-gradient(bottom, #424b57 0%, #61707e 100%); @@ -193,8 +193,8 @@ button img { top: 2px; } -.button { - background-color: #414d5a; +.button { + background-color: #414d5a; padding: 6px 8px; margin: 0 5px 0 0; position: relative; @@ -218,7 +218,7 @@ button img { } #remainingtime, #password { - color: #94a3b4; + color: #94a3b4; display: inline; font-size: 0.85em; } @@ -298,7 +298,7 @@ h4.title { font-size: 1.2em; color: #94a3b4; font-style: italic; - font-weight: bold; + font-weight: bold; position: relative; margin-left: 30px; } @@ -356,7 +356,7 @@ h4.title { background-clip: padding-box; } -.comment button:hover { +.comment button:hover { background-image: linear-gradient(bottom, #ccd 0, #fff 100%); background-image: -o-linear-gradient(bottom, #ccd 0, #fff 100%); background-image: -moz-linear-gradient(bottom, #ccd 0, #fff 100%); diff --git a/js/privatebin.js b/js/privatebin.js index faf09602..b6d104dc 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -20,6 +20,11 @@ /** global: showdown */ /** global: sjcl */ +$(document).ready(function() { + // hide "no javascript" message as early as possible + $('#noscript').hide(); +}) + // Immediately start random number generator collector. sjcl.random.startCollectors(); diff --git a/tpl/bootstrap-compact.php b/tpl/bootstrap-compact.php index 657b5788..b4790be7 100644 --- a/tpl/bootstrap-compact.php +++ b/tpl/bootstrap-compact.php @@ -52,7 +52,7 @@ if ($MARKDOWN): - + diff --git a/tpl/bootstrap-dark-page.php b/tpl/bootstrap-dark-page.php index b57e880e..14676c01 100644 --- a/tpl/bootstrap-dark-page.php +++ b/tpl/bootstrap-dark-page.php @@ -52,7 +52,7 @@ if ($MARKDOWN): - + diff --git a/tpl/bootstrap-dark.php b/tpl/bootstrap-dark.php index 9ceb15f7..2da3d02f 100644 --- a/tpl/bootstrap-dark.php +++ b/tpl/bootstrap-dark.php @@ -52,7 +52,7 @@ if ($MARKDOWN): - + diff --git a/tpl/bootstrap-page.php b/tpl/bootstrap-page.php index fe49a3fd..235f4877 100644 --- a/tpl/bootstrap-page.php +++ b/tpl/bootstrap-page.php @@ -52,7 +52,7 @@ if ($MARKDOWN): - + diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 56150908..cd9a787a 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -52,7 +52,7 @@ if ($MARKDOWN): - + @@ -279,7 +279,9 @@ if (!strlen($ERROR)): ?>hidden alert alert-danger"> - + + +