From: Johannes Schwab Date: Sat, 31 Aug 2013 11:50:02 +0000 (+0200) Subject: Fixed for tinymce and improved appearance X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f2a019504c1624507447a35edd08931b909773bc;p=friendica-addons.git Fixed for tinymce and improved appearance --- diff --git a/smileybutton/icon.gif b/smileybutton/icon.gif index e3fe6a55..6ce09471 100644 Binary files a/smileybutton/icon.gif and b/smileybutton/icon.gif differ diff --git a/smileybutton/smileybutton.css b/smileybutton/smileybutton.css index bb84030f..916e0416 100755 --- a/smileybutton/smileybutton.css +++ b/smileybutton/smileybutton.css @@ -1,5 +1,12 @@ +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} +table.smiley-preview { + border: 1px solid #AAAAAA; +} #smileybutton-enable-label { float: left; diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index d6520a75..afd3e214 100755 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -128,8 +128,7 @@ function show_button($a, &$b) { */ $params = array('texts' => $texts, 'icons' => $icons, 'string' => ""); //changed - call_hooks('smiley', $params); - + call_hooks('smilie', $params); /** * @@ -137,15 +136,25 @@ function show_button($a, &$b) { * */ - $s = "\t"; + $s = "\t\n"; for($x = 0; $x < count($params['texts']); $x ++) { $icon = $params['icons'][$x]; $icon = str_replace('/>', 'onclick="smileybutton_addsmiley(\'' . $params['texts'][$x] . '\')"/>', $icon); - $s .= $icon . ' '; - if ($x != 0 && $x % 10 == 0) { - $s .= "
\n\t"; + $icon = str_replace('class="smiley"', 'class="smiley_preview"', $icon); + $s .= ""; + if (($x+1) % (sqrt(count($params['texts']))+1) == 0) { + $s .= "\n\t"; } } + $s .= "\t
" . $icon . "
\n"; + + /** + * + * Add css to page + * + */ + + $a->page['htmlhead'] .= '' . "\r\n"; /** * @@ -191,9 +200,17 @@ function show_button($a, &$b) { */ $b .= " function smileybutton_addsmiley(text) {\n"; - $b .= " v = $(\"#profile-jot-text\").val()\n"; - $b .= " v = v + text\n"; - $b .= " $(\"#profile-jot-text\").val(v)\n"; + $b .= " if(plaintext == 'none') {\n"; + $b .= " var v = $(\"#profile-jot-text\").val();\n"; + $b .= " v = v + text;\n"; + $b .= " $(\"#profile-jot-text\").val(v);\n"; + $b .= " $(\"#profile-jot-text\").focus();\n"; + $b .= " } else {\n"; + $b .= " var v = tinymce.activeEditor.getContent();\n"; + $b .= " v = v + text;\n"; + $b .= " tinymce.activeEditor.setContent(v);\n"; + $b .= " tinymce.activeEditor.focus();\n"; + $b .= " }\n"; $b .= " }\n"; $b .= "\n"; }