aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-09-07 07:32:49 +0000
committerMario <mario@mariovavti.com>2021-09-07 07:32:49 +0000
commit52995bde125a568894ae441bb75cd69ac7945ef7 (patch)
tree3c0e56d65d6cafd27c53506e2d725c68cd9fbc52
parent2523ebc76af2ba016bb56ece70ce7a1f827d730a (diff)
downloadvolse-hubzilla-52995bde125a568894ae441bb75cd69ac7945ef7.tar.gz
volse-hubzilla-52995bde125a568894ae441bb75cd69ac7945ef7.tar.bz2
volse-hubzilla-52995bde125a568894ae441bb75cd69ac7945ef7.zip
deprecate the custom highlight [hl] bbcode in favor of [mark] which is a html5 standard
-rw-r--r--include/bbcode.php10
-rw-r--r--view/css/bootstrap-red.css4
-rw-r--r--view/js/autocomplete.js2
3 files changed, 13 insertions, 3 deletions
diff --git a/include/bbcode.php b/include/bbcode.php
index 25615e385..42790aaca 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -1351,12 +1351,18 @@ function bbcode($Text, $options = []) {
if (strpos($Text,'[/color]') !== false) {
$Text = preg_replace("(\[color=(.*?)\](.*?)\[\/color\])ism", "<span style=\"color: $1;\">$2</span>", $Text);
}
- // Check for colored text
+
+ // @DEPRECATED: Check for colored text (deprecated in favor of mark which is a html5 standard)
if (strpos($Text,'[/hl]') !== false) {
- $Text = preg_replace("(\[hl\](.*?)\[\/hl\])ism", "<span class=\"default-highlight\">$1</span>", $Text);
+ $Text = preg_replace("(\[hl\](.*?)\[\/hl\])ism", "<span class=\"default-highlight\">$1</span>", $Text);
$Text = preg_replace("(\[hl=(.*?)\](.*?)\[\/hl\])ism", "<span style=\"background-color: $1;\">$2</span>", $Text);
}
+ if (strpos($Text,'[/mark]') !== false) {
+ $Text = preg_replace("(\[mark\](.*?)\[\/mark\])ism", "<mark class=\"mark\">$1</mark>", $Text);
+ $Text = preg_replace("(\[mark=(.*?)\](.*?)\[\/mark\])ism", "<mark style=\"background-color: $1;\">$2</mark>", $Text);
+ }
+
// Check for sized text
// [size=50] --> font-size: 50px (with the unit).
if (strpos($Text,'[/size]') !== false) {
diff --git a/view/css/bootstrap-red.css b/view/css/bootstrap-red.css
index 0e4b0e8e6..9f03d1b12 100644
--- a/view/css/bootstrap-red.css
+++ b/view/css/bootstrap-red.css
@@ -80,3 +80,7 @@ label {
a {
text-decoration: none !important;
}
+
+.mark {
+ background-color: yellow;
+}
diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js
index 596dc7076..d6893073d 100644
--- a/view/js/autocomplete.js
+++ b/view/js/autocomplete.js
@@ -360,7 +360,7 @@ function string2bb(element) {
return;
if(type=='bbcode') {
- var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'question', 'answer', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer', 'observer.language','embed', 'highlight', 'url', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
+ var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'checklist', 'question', 'answer', 'ul', 'ol', 'dl', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer', 'observer.language','embed', 'mark', 'url', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr' ];
var elements = open_close_elements.concat(open_elements);