diff options
author | redmatrix <git@macgirvin.com> | 2016-04-26 16:14:10 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-04-26 16:14:10 -0700 |
commit | 509f25e46a37d7fae1a2d1934c6143e96aa6497d (patch) | |
tree | 900e91ef3e02863cd16cc34f5ceae2c5bf5a9e0b | |
parent | f99daf8ff9b3cd9c0ad61f9fcfec04c6c4042a59 (diff) | |
parent | 607125e795ca624fe6d3ee83acdd65e3100a22a4 (diff) | |
download | volse-hubzilla-509f25e46a37d7fae1a2d1934c6143e96aa6497d.tar.gz volse-hubzilla-509f25e46a37d7fae1a2d1934c6143e96aa6497d.tar.bz2 volse-hubzilla-509f25e46a37d7fae1a2d1934c6143e96aa6497d.zip |
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
-rw-r--r-- | include/bbcode.php | 44 | ||||
-rw-r--r-- | include/text.php | 29 | ||||
-rw-r--r-- | view/js/autocomplete.js | 2 | ||||
-rw-r--r-- | view/theme/redbasic/css/narrow_navbar.css | 4 | ||||
-rwxr-xr-x | view/tpl/jot.tpl | 8 |
5 files changed, 36 insertions, 51 deletions
diff --git a/include/bbcode.php b/include/bbcode.php index 78a2759c1..b8cd23f59 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -330,8 +330,19 @@ function bb_map_location($match) { } function bb_opentag($match) { + $openclose = (($match[2]) ? '<span class="bb-open" title="' . t('Click to open/close') . '">' . $match[1] . '</span>' : t('Click to open/close')); + $text = (($match[2]) ? $match[2] : $match[1]); $rnd = mt_rand(); - return "<br /><div onclick=\"openClose('opendiv-" . $rnd . "');return false;\" class=\"fakelink\">" . $match[1] . "</div><div id=\"opendiv-" . $rnd . "\" style=\"display: none;\">" . $match[2] . "</div>"; + + return '<div onclick="openClose(\'opendiv-' . $rnd . '\'); return false;" class="fakelink">' . $openclose . '</div><div id="opendiv-' . $rnd . '" style="display: none;">' . $text . '</div>'; +} + +function bb_spoilertag($match) { + $openclose = (($match[2]) ? '<span class="bb-spoiler" title="' . t('Click to open/close') . '">' . $match[1] . ' ' . t('spoiler') . '</span>' : t('Click to open/close')); + $text = (($match[2]) ? $match[2] : $match[1]); + $rnd = mt_rand(); + + return '<div onclick="openClose(\'opendiv-' . $rnd . '\'); return false;" class="fakelink">' . $openclose . '</div><blockquote id="opendiv-' . $rnd . '" style="display: none;">' . $text . '</blockquote>'; } /** @@ -748,33 +759,34 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $Text = preg_replace("/\[code\](.*?)\[\/code\]/ism", "$CodeLayout", $Text); } - // Declare the format for [spoiler] layout - $SpoilerLayout = '<blockquote class="spoiler">$1</blockquote>'; - // Check for [spoiler] text - // handle nested quotes $endlessloop = 0; - while ((strpos($Text, "[/spoiler]") !== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20)) - $Text = preg_replace("/\[spoiler\](.*?)\[\/spoiler\]/ism", "$SpoilerLayout", $Text); + while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler]") !== false) and (++$endlessloop < 20)) { + $Text = preg_replace_callback("/\[spoiler\](.*?)\[\/spoiler\]/ism", 'bb_spoilertag', $Text); + } // Check for [spoiler=Author] text - - $t_wrote = t('$1 spoiler'); - - // handle nested quotes $endlessloop = 0; - while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler=") !== false) and (++$endlessloop < 20)) - $Text = preg_replace("/\[spoiler=[\"\']*(.*?)[\"\']*\](.*?)\[\/spoiler\]/ism", - "<br /><strong class=".'"spoiler"'.">" . $t_wrote . "</strong><blockquote class=".'"spoiler"'.">$2</blockquote>", - $Text); + while ((strpos($Text, "[/spoiler]")!== false) and (strpos($Text, "[spoiler=") !== false) and (++$endlessloop < 20)) { + $Text = preg_replace_callback("/\[spoiler=(.*?)\](.*?)\[\/spoiler\]/ism", 'bb_spoilertag', $Text); + } + // Check for [open] text + $endlessloop = 0; + while ((strpos($Text, "[/open]")!== false) and (strpos($Text, "[open]") !== false) and (++$endlessloop < 20)) { + $Text = preg_replace_callback("/\[open\](.*?)\[\/open\]/ism", 'bb_opentag', $Text); + } + // Check for [open=Title] text $endlessloop = 0; while ((strpos($Text, "[/open]")!== false) and (strpos($Text, "[open=") !== false) and (++$endlessloop < 20)) { $Text = preg_replace_callback("/\[open=(.*?)\](.*?)\[\/open\]/ism", 'bb_opentag', $Text); } + + + // Declare the format for [quote] layout $QuoteLayout = '<blockquote>$1</blockquote>'; @@ -792,7 +804,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) $endlessloop = 0; while ((strpos($Text, "[/quote]")!== false) and (strpos($Text, "[quote=") !== false) and (++$endlessloop < 20)) $Text = preg_replace("/\[quote=[\"\']*(.*?)[\"\']*\](.*?)\[\/quote\]/ism", - "<br /><strong class=".'"author"'.">" . $t_wrote . "</strong><blockquote>$2</blockquote>", + "<span class=".'"bb-quote"'.">" . $t_wrote . "</span><blockquote>$2</blockquote>", $Text); // Images diff --git a/include/text.php b/include/text.php index 0a7f84b01..926e2eed6 100644 --- a/include/text.php +++ b/include/text.php @@ -1532,35 +1532,6 @@ function prepare_body(&$item,$attach = false) { $s = sslify($s); - // Look for spoiler - $spoilersearch = '<blockquote class="spoiler">'; - - // Remove line breaks before the spoiler - while ((strpos($s, "\n".$spoilersearch) !== false)) - $s = str_replace("\n".$spoilersearch, $spoilersearch, $s); - while ((strpos($s, "<br />".$spoilersearch) !== false)) - $s = str_replace("<br />".$spoilersearch, $spoilersearch, $s); - - while ((strpos($s, $spoilersearch) !== false)) { - - $pos = strpos($s, $spoilersearch); - $rnd = random_string(8); - $spoilerreplace = '<br /> <span id="spoiler-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'spoiler-'.$rnd.'\');">'.sprintf(t('Click to open/close')).'</span>'. - '<blockquote class="spoiler" id="spoiler-'.$rnd.'" style="display: none;">'; - $s = substr($s, 0, $pos).$spoilerreplace.substr($s, $pos+strlen($spoilersearch)); - } - - // Look for quote with author - $authorsearch = '<blockquote class="author">'; - - while ((strpos($s, $authorsearch) !== false)) { - $pos = strpos($s, $authorsearch); - $rnd = random_string(8); - $authorreplace = '<br /> <span id="author-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'author-'.$rnd.'\');">'.sprintf(t('Click to open/close')).'</span>'. - '<blockquote class="author" id="author-'.$rnd.'" style="display: block;">'; - $s = substr($s, 0, $pos).$authorreplace.substr($s, $pos+strlen($authorsearch)); - } - $prep_arr = array( 'item' => $item, 'photo' => $photo, diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 84cc075dc..21ce2d150 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -265,7 +265,7 @@ function string2bb(element) { $.fn.bbco_autocomplete = function(type) { if(type=='bbcode') { - var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer']; + var open_close_elements = ['bold', 'italic', 'underline', 'overline', 'strike', 'superscript', 'subscript', 'quote', 'code', 'open', 'spoiler', 'map', 'nobb', 'list', 'ul', 'ol', 'li', 'table', 'tr', 'th', 'td', 'center', 'color', 'font', 'size', 'zrl', 'zmg', 'rpost', 'qr', 'observer']; var open_elements = ['observer.baseurl', 'observer.address', 'observer.photo', 'observer.name', 'observer.webname', 'observer.url', '*', 'hr', ]; var elements = open_close_elements.concat(open_elements); diff --git a/view/theme/redbasic/css/narrow_navbar.css b/view/theme/redbasic/css/narrow_navbar.css index e7c1e9f40..faa18dfe5 100644 --- a/view/theme/redbasic/css/narrow_navbar.css +++ b/view/theme/redbasic/css/narrow_navbar.css @@ -1,11 +1,11 @@ @media screen and (min-width: 760px) { aside { - padding: 52px 7px 0px 7px; + padding-top: 52px; } section { - padding: 52px 7px 200px 7px; + padding-top: 52px; } .navbar-nav > li > a { diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 026c586a0..44e010e77 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -115,18 +115,20 @@ <button type="button" id="more-tools" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <i id="more-tools-icon" class="icon-caret-down jot-icons"></i> </button> - <ul class="dropdown-menu dropdown-menu-right" role="menu"> + <ul class="dropdown-menu dropdown-menu" role="menu"> <li class="visible-xs"><a href="#" onclick="preview_post();return false;"><i class="icon-eye-open"></i> {{$preview}}</a></li> {{if $visitor}} <li class="divider visible-xs"></li> - {{if $writefiles}}<li class="visible-xs"><a id="wall-file-upload-sub" href="#" ><i class="icon-paper-clip"></i> {{$attach}}</a></li>{{/if}} - <li class="visible-xs"><a href="#" onclick="jotGetLink(); return false;"><i class="icon-link"></i> {{$weblink}}</a></li> + {{if $writefiles}} + <li class="visible-xs"><a id="wall-file-upload-sub" href="#" ><i class="icon-paper-clip"></i> {{$attach}}</a></li> {{/if}} + <li class="visible-xs"><a href="#" onclick="jotGetLink(); return false;"><i class="icon-link"></i> {{$weblink}}</a></li> <li class="divider visible-xs"></li> <li class="visible-xs visible-sm"><a href="#" onclick="jotGetLocation(); return false;"><i class="icon-globe"></i> {{$setloc}}</a></li> {{if $noloc}} <li class="visible-xs visible-sm"><a href="#" onclick="jotClearLocation(); return false;"><i class="icon-circle-blank"></i> {{$noloc}}</a></li> {{/if}} + {{/if}} {{if $feature_expire}} <li class="visible-xs visible-sm"><a href="#" onclick="jotGetExpiry(); return false;"><i class="icon-eraser"></i> {{$expires}}</a></li> {{/if}} |