No-JS Warning

Shows a warning message for users without JS active.
This commit is contained in:
Sascha Leib
2025-11-26 22:51:18 +01:00
parent 6861f2af57
commit cb91697912
7 changed files with 33 additions and 3 deletions

View File

@@ -270,6 +270,10 @@ class action_plugin_botmon extends DokuWiki_Action_Plugin {
echo DOKU_TAB . '};' . NL;
echo '</script>' . NL;
// insert a warning message for users without JavaScript:
echo '<dialog open closedby="any" id="BM__NoJSWarning"><p>' . $this->getLang('bm_noJsWarning') . '</p></dialog>' . NL;
}
}

View File

@@ -6,6 +6,11 @@
const $BMCaptcha = {
init: function() {
// hide the NoJS warning:
document.getElementById('BM__NoJSWarning').close();
// install the captcha:
document.getElementsByTagName('body')[0].classList.add('botmon_captcha');
$BMCaptcha._cbDly = 1.5;
$BMCaptcha.install()

View File

@@ -6,7 +6,6 @@
{"id": "brasilnet", "name": "BrasilNet"},
{"id": "charter", "name": "Charter Inc. Range"},
{"id": "chinanet", "name": "ChinaNet"},
{"id": "cloudflare", "name": "Cloudflare Network"},
{"id": "cnisp", "name": "China ISP Range"},
{"id": "cnmob", "name": "China Mobile"},
{"id": "domtehniki", "name": "Dom Tehniki / WS Telecom"},
@@ -108,7 +107,6 @@
{"from": "2603:8000::::::", "to": "2603:80ff:ffff:ffff:ffff:ffff:ffff:ffff", "m": 24, "g": "charter"},
{"from": "2607:a400::::::", "to": "2607:a400:ffff:ffff:ffff:ffff:ffff:ffff", "m": 32, "g": "zenlayer"},
{"from": "2804:::::::", "to": "2804:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "m": 16, "g": "misc_sa"},
{"from": "2a09:bac3::::::", "to": "2a09:bac3:ffff:ffff:ffff:ffff:ffff:ffff", "m": 32,"g": "cloudflare"},
{"from": "2a0a:4cc0::::::", "to": "2a0a:4cc0:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "g": "netcup"}
]
}

View File

@@ -12,3 +12,4 @@ $lang['bm_dlgConfirm'] = 'Klicke, um zu best&auml;tigen.';
$lang['bm_dlgChecking'] = 'Wird &uuml;berpr&uuml;ft&nbsp;&hellip;';
$lang['bm_dlgLoading'] = 'Seite wird geladen&nbsp;&hellip;';
$lang['bm_dlgError'] = 'Es ist ein Fehler aufgetreten.';
$lang['bm_noJsWarning'] = 'Bitte aktivieren Sie JavaScript, um diese Seite anzuzeigen.';

View File

@@ -12,3 +12,4 @@ $lang['bm_dlgConfirm'] = 'Click to confirm.';
$lang['bm_dlgChecking'] = 'Checking&nbsp;&hellip;';
$lang['bm_dlgLoading'] = 'Loading page&nbsp;&hellip;';
$lang['bm_dlgError'] = 'An error occured.';
$lang['bm_noJsWarning'] = 'This page requires JavaScript to be enabled.';

9
lang/fr/lang.php Normal file
View File

@@ -0,0 +1,9 @@
<?php
/**
* French language file for BotMon plugin
*
* @author Sascha Leib <ad@hominem.info>
*/
// Captcha dialog locale strings:
$lang['bm_noJsWarning'] = 'Veuillez activer JavaScript pour afficher cette page.';

View File

@@ -106,7 +106,19 @@ body.botmon_captcha {
}
}
// smaller screens:
// no js warning
#BM__NoJSWarning {
position: fixed;
bottom: calc(50vh - 2.5rem);
width: 100%; max-width: fit-content;
margin: 0 auto;
padding: .25rem 1rem;
border-radius: .5rem;
border: red solid 2pt;
box-shadow: rgba(128, 0, 0, 0.5) .25rem .25rem .5rem;
}
// captcha on smaller screens:
@media (max-width: 480px) {
body.botmon_captcha #botmon_captcha_box {
width: 100vw;