]> git.mxchange.org Git - friendica-addons.git/commitdiff
Fixed for tinymce and improved appearance
authorJohannes Schwab <Johannes_Schwab@gmx.de>
Sat, 31 Aug 2013 11:50:02 +0000 (13:50 +0200)
committerJohannes Schwab <Johannes_Schwab@gmx.de>
Sat, 31 Aug 2013 11:50:02 +0000 (13:50 +0200)
smileybutton/icon.gif
smileybutton/smileybutton.css
smileybutton/smileybutton.php

index e3fe6a55c6c226dedffb4cde18e703529411f8bd..6ce0947194f28f0bd04357af315f529d8262525e 100644 (file)
Binary files a/smileybutton/icon.gif and b/smileybutton/icon.gif differ
index bb84030f850d428d8baae29cd78c91d6a18068d0..916e04165bc2a594459614fc36b18f5a9cdd17f6 100755 (executable)
@@ -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;
index d6520a75bd34199dbd0dc1fbbffc6c43e8f99a16..afd3e214c7ac0334cf353fd684b1ebf1672c7ef5 100755 (executable)
@@ -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<table class=\"smiley-preview\"><tr>\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 .= "<br />\n\t";
+               $icon = str_replace('class="smiley"', 'class="smiley_preview"', $icon);
+               $s .= "<td>" . $icon . "</td>";
+               if (($x+1) % (sqrt(count($params['texts']))+1) == 0) {
+                       $s .= "</tr>\n\t<tr>";
                }
        }
+       $s .= "\t</tr></table>\n";
+
+       /**
+        *
+        * Add css to page
+        *
+        */     
+
+       $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/smileybutton/smileybutton.css' . '" media="all" />' . "\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 .= "</script>\n";
 }