From 184a20604ec0bd2d0d0243ecbbed329e4674220e Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 6 Dec 2023 13:59:10 +0100 Subject: [PATCH] cleanup styles, use SVG icon for audio --- ear-hearing.svg | 1 + helper.php | 13 ++++------ sound.png | Bin 610 -> 0 bytes style.css | 42 ------------------------------- style.less | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 50 deletions(-) create mode 100644 ear-hearing.svg delete mode 100644 sound.png delete mode 100644 style.css create mode 100644 style.less diff --git a/ear-hearing.svg b/ear-hearing.svg new file mode 100644 index 0000000..68f5d6a --- /dev/null +++ b/ear-hearing.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/helper.php b/helper.php index 2543a27..bc8d5ad 100644 --- a/helper.php +++ b/helper.php @@ -194,7 +194,7 @@ class helper_plugin_captcha extends Plugin { $ident = hexdec(substr(md5($ident), 5, 5)); // use part of the md5 to generate an int $rand *= 0xFFFFF; // bitmask from the random number - $comb = (int) $rand ^ $ident; // combine both values + $comb = (int)$rand ^ $ident; // combine both values return md5($comb); } @@ -411,24 +411,21 @@ class helper_plugin_captcha extends Plugin */ protected function htmlAudioLink($secret, $ID) { - $img = DOKU_BASE . 'lib/plugins/captcha/sound.png'; // FIXME use svg icon + $url = DOKU_BASE . 'lib/plugins/captcha/wav.php'; $param = buildURLparams([ 'secret' => $secret, 'id' => $ID, ]); - $icon = sprintf( - '%s', - $img, - $this->getLang('soundlink') - ); + $icon = inlineSVG(__DIR__ . '/ear-hearing.svg'); return sprintf( - '%s', + '%s', $url, $param, $this->getLang('soundlink'), + $this->getConf('height'), $icon ); } diff --git a/sound.png b/sound.png deleted file mode 100644 index 6056d234a9818d248987389d4a621e5c83ce0851..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 610 zcmV-o0-gPdP)FDRfPcVFW5d%9V=z{?A#;oriL5xO+n6O2X~nf!lQuE^VWXpgu83qI(qCF{ zS}dqc=wWy-JjhR6YYDxINHb)T^nMSh)vA20R`F7)lzCSCZF94My}d73T>N+m zpyXWPL`#FF;s+j3t(LL2R!6+EP98p9G9EaJe<5S)o@#CPu0JyV*YBbiNC<>y{C`3_2 zFc^fUC0P=`0GC2D0rmxry!i<{eh#|t2UjSV*w|QyY37m5W)KQZKoA6m%^;bK|K7sb zq~^Y!1U(%y>Cs5W^^bz?JUQeR7IK)M&$43OYdMwDJVcVBtSjl_Ar8Hmr2)a$eK-tv zNC4d)(7D`Piq~gVUR7m2k$BH5O6=$i%I6Kpa_sVNy!&j)9UKPT@*VWNNNm+UIUciF wPJ00!a`S;oH}3WS@hUTDnx*^y9@F3E2OYGed{u8eJ^%m!07*qoM6N<$f+a~A3jhEB diff --git a/style.css b/style.css deleted file mode 100644 index 210ac38..0000000 --- a/style.css +++ /dev/null @@ -1,42 +0,0 @@ -.dokuwiki #plugin__captcha_wrapper img { - margin: 1px; - vertical-align: bottom; - border: 1px solid __border__; -} - -.dokuwiki #plugin__captcha_wrapper pre { - font-size: 70%; - font-family: monospace; - font-weight: bold; - border: none; - background-color: __background__; - color: __text__; - padding: 0; -} - -.dokuwiki #plugin__captcha_wrapper .svg { - display: inline-block; - background-color: __background__; - vertical-align: bottom; - border: 1px solid __border__; -} - -.dokuwiki #plugin__captcha_wrapper svg { - width: 100%; - height: 100%; -} - -.dokuwiki #plugin__captcha_wrapper svg path { - fill: __text__; -} - -.dokuwiki #plugin__captcha_wrapper .no { - display: none; -} - -.dokuwiki #plugin__captcha_wrapper { - clear: left; - border: 1px solid __border__; - padding: 0.75em; - margin: 1em 0; -} diff --git a/style.less b/style.less new file mode 100644 index 0000000..9ad7351 --- /dev/null +++ b/style.less @@ -0,0 +1,64 @@ +.dokuwiki #plugin__captcha_wrapper { + clear: left; + border: 1px solid @ini_border; + padding: 0.75em; + margin: 1em 0; + + * { + vertical-align: middle; + } + + img { + margin: 1px; + vertical-align: bottom; + border: 1px solid @ini_border; + } + + pre { + font-size: 70%; + font-family: monospace; + font-weight: bold; + border: none; + background-color: @ini_background; + color: @ini_text; + padding: 0; + } + + .svg { + display: inline-block; + background-color: @ini_background; + vertical-align: bottom; + border: 1px solid @ini_border; + + svg { + width: 100%; + height: 100%; + + path { + fill: @ini_text; + } + } + } + + .audiolink { + display: inline-flex; + justify-content: center; + align-items: center; + margin-left: 0.5em; + margin-right: 0.5em; + border: 1px solid @ini_border; + aspect-ratio: 1; + + svg { + height: auto; + width: auto; + flex-grow: 1; + flex-shrink: 1; + fill: @ini_link; + } + } + + .no { + display: none; + } +}