From ebdc1a753d4d4f36d40a70007366dcfa2d6db1aa Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 8 Feb 2021 11:01:37 -0500 Subject: [PATCH 1/2] [smileybutton] Remove reference to removed frost theme --- smileybutton/view/frost.css | 21 --------------------- smileybutton/view/frost.png | Bin 865 -> 0 bytes 2 files changed, 21 deletions(-) delete mode 100644 smileybutton/view/frost.css delete mode 100644 smileybutton/view/frost.png diff --git a/smileybutton/view/frost.css b/smileybutton/view/frost.css deleted file mode 100644 index 42e18f05..00000000 --- a/smileybutton/view/frost.css +++ /dev/null @@ -1,21 +0,0 @@ -img.smiley_button { - height: 25; - width: 25px; - position: relative; - left: 335px; - top: -45px; -} - -img.smiley_preview { - max-height: 25px; - max-width: 25px; -} - -table.smiley-preview { - border: 1px solid #AAAAAA; - -moz-border-radius: 3px; - border-radius: 3px; - position: relative; - left: 285px; - top: -36px; -} diff --git a/smileybutton/view/frost.png b/smileybutton/view/frost.png deleted file mode 100644 index 6ad02a18f195e8b3a71b4744692ed25a75615a4a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 865 zcmV-n1D^beP)f9o{SY5(TO{p_Q5*tNr$lt^6kLiXK!B30&CrKsyO#acyAF?EKKI?koTu8gn}zu{do$5xS=4`;HWw4Z~` z;{P92q~QV4{Y+wu{xJ(*3I9ivtd2`b_7KgfcxPsOBFTnvpZ;)6_!v_ZpQ%)QK~{Il ziqSGf%KTMtC3-gAP^9GDNuC#@Be}t1{F4-UIo_1Xui+K#`@$L?RWvpY9MAN-lkBpR z*8SzAyn%-^`6kVCz%6`|_)p+T>=6(4e8&3^2Qoif6#d~ICAb@3BtmOTwg_+Qem3|4 z+cWz$iZ1zcZNhtrs0j^`F1NSn2e41f23HgpPKqk{9v;!$)a($x8X~kiw)VZW<@1HZ zvH_>8E#FYWD@EC0@;sKeGfG&F7j-$9^g5bNicmd^A4O!qy`ujg5|3?GlJ`BD Date: Mon, 8 Feb 2021 11:02:34 -0500 Subject: [PATCH 2/2] [smileybutton] Rework addon - Add frio style - Remove reference to removed tinymce editor --- smileybutton/smileybutton.php | 97 +++++++++++++----------------- smileybutton/view/default.css | 16 ++++- smileybutton/view/duepuntozero.css | 20 +++++- smileybutton/view/frio.css | 31 ++++++++++ smileybutton/view/smoothly.css | 17 +++++- smileybutton/view/vier.css | 48 ++++++++++++--- 6 files changed, 161 insertions(+), 68 deletions(-) create mode 100644 smileybutton/view/frio.css diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index fc420773..f01a6201 100644 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -2,38 +2,34 @@ /** * Name: Smileybutton * Description: Adds a smileybutton to the Inputbox - * Version: 0.2 + * Version: 1.0 * Author: Johannes Schwab + * Maintainer: Hypolite Petovan */ + use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\DI; -function smileybutton_install() { +function smileybutton_install() +{ //Register hooks - Hook::register('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - - Logger::log("installed smileybutton"); + Hook::register('jot_tool', 'addon/smileybutton/smileybutton.php', 'smileybutton_jot_tool'); } -function show_button(Friendica\App $a, &$b) { +function smileybutton_jot_tool(Friendica\App $a, &$b) +{ // Disable if theme is quattro // TODO add style for quattro - if ($a->getCurrentTheme() == 'quattro') + if ($a->getCurrentTheme() == 'quattro') { return; + } - // Disable for mobile because most mobiles have a smiley key for ther own - if (DI::mode()->isMobile() || DI::mode()->isMobile()) + // Disable for mobile because they have a smiley key of their own + if (DI::mode()->isMobile() || DI::mode()->isMobile()) { return; + } - /** - * - * I have copied this from /include/text.php, removed doubles - * and escaped them. - * - */ - - $texts = [ + $texts = [ '<3', '</3', ':-)', @@ -45,19 +41,18 @@ function show_button(Friendica\App $a, &$b) { ':-O', '\\\\o/', 'O_o', - ":\'(", - ":-!", - ":-/", - ":-[", - "8-)", + ':\'(', + ':-!', + ':-/', + ':-[', + '8-)', ':beer', ':coffee', ':facepalm', ':like', ':dislike', - '~friendica', - 'red#' - + '~friendica', + 'red#', ]; $icons = [ @@ -87,42 +82,41 @@ function show_button(Friendica\App $a, &$b) { ]; // Call hooks to get aditional smileies from other addons - $params = ['texts' => $texts, 'icons' => $icons, 'string' => ""]; //changed + $params = ['texts' => $texts, 'icons' => $icons, 'string' => '']; //changed Hook::callAll('smilie', $params); //Generate html for smiley list - $s = "\n\t"; - for($x = 0; $x < count($params['texts']); $x ++) { + $s = '
'; + for ($x = 0; $x < count($params['texts']); $x++) { $icon = $params['icons'][$x]; - $icon = str_replace('/>', 'onclick="smileybutton_addsmiley(\'' . $params['texts'][$x] . '\')"/>', $icon); - $icon = str_replace('class="smiley"', 'class="smiley_preview"', $icon); - $s .= ""; - if (($x+1) % (sqrt(count($params['texts']))+1) == 0) { - $s .= "\n\t"; + $s .= ''; + if (($x + 1) % (sqrt(count($params['texts'])) + 1) == 0) { + $s .= ''; } } - $s .= "\t
" . $icon . "
' . $icon . '
"; + $s .= ''; //Add css to header $css_file = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.css'; - if (! file_exists($css_file)) + if (!file_exists($css_file)) { $css_file = 'addon/smileybutton/view/default.css'; - $css_url = DI::baseUrl()->get().'/'.$css_file; - - DI::page()['htmlhead'] .= ''."\r\n"; + } + DI::page()->registerStylesheet($css_file); //Get the correct image for the theme $image = 'addon/smileybutton/view/' . $a->getCurrentTheme() . '.png'; - if (! file_exists($image)) + if (!file_exists($image)) { $image = 'addon/smileybutton/view/default.png'; - $image_url = DI::baseUrl()->get().'/'.$image; + } + + $image_url = DI::baseUrl()->get() . '/' . $image; //Add the hmtl and script to the page $b = <<< EOT -
- smiley -