From 9a1c783d74e6bea6fca49422e6106f7af23cfee5 Mon Sep 17 00:00:00 2001 From: Johannes Schwab Date: Sat, 7 Feb 2015 14:51:10 +0100 Subject: [PATCH] make smileybutton respect the theme --- smileybutton/icon.gif | Bin 293 -> 0 bytes smileybutton/smileybutton.css | 21 --- smileybutton/smileybutton.php | 247 ++++++++--------------------- smileybutton/view/default.css | 13 ++ smileybutton/view/default.png | Bin 0 -> 865 bytes smileybutton/view/default.svg | 99 ++++++++++++ smileybutton/view/duepuntozero.css | 21 +++ smileybutton/view/duepuntozero.png | Bin 0 -> 399 bytes smileybutton/view/frost.css | 21 +++ smileybutton/view/frost.png | Bin 0 -> 865 bytes smileybutton/view/smoothly.css | 21 +++ smileybutton/view/smoothly.png | Bin 0 -> 977 bytes smileybutton/view/smoothly.svg | 112 +++++++++++++ smileybutton/view/vier.css | 15 ++ smileybutton/view/vier.png | Bin 0 -> 940 bytes smileybutton/view/vier.svg | 99 ++++++++++++ 16 files changed, 466 insertions(+), 203 deletions(-) delete mode 100644 smileybutton/icon.gif delete mode 100755 smileybutton/smileybutton.css create mode 100644 smileybutton/view/default.css create mode 100644 smileybutton/view/default.png create mode 100644 smileybutton/view/default.svg create mode 100644 smileybutton/view/duepuntozero.css create mode 100644 smileybutton/view/duepuntozero.png create mode 100644 smileybutton/view/frost.css create mode 100644 smileybutton/view/frost.png create mode 100644 smileybutton/view/smoothly.css create mode 100644 smileybutton/view/smoothly.png create mode 100644 smileybutton/view/smoothly.svg create mode 100644 smileybutton/view/vier.css create mode 100644 smileybutton/view/vier.png create mode 100644 smileybutton/view/vier.svg diff --git a/smileybutton/icon.gif b/smileybutton/icon.gif deleted file mode 100644 index 6ce0947194f28f0bd04357af315f529d8262525e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 293 zcmZ?wbhEHb6k-r!Xkh>WV`F0iYHTw{G2f^5n^f40ti+WYDAMiQsG%z*e)=(E443q}iHe?r zEDhHl9Bt^jqSxr4`={51U-V(B!itUA(@r^>{0&l@ynf#AmG{3kL@Q;82(VTO39$-z z7Rz%BiU_eVdkFC|vxtkNDe-ZMS1>ayVPLKh=TdQBD9pve!nGnmm6O+`Tv)`6ms6da YOE61JkSkE1o0E%+^SJ(b6-5SX00NL_j{pDw diff --git a/smileybutton/smileybutton.css b/smileybutton/smileybutton.css deleted file mode 100755 index 916e0416..00000000 --- a/smileybutton/smileybutton.css +++ /dev/null @@ -1,21 +0,0 @@ - -img.smiley_preview { - max-height: 25px; - max-width: 25px; -} - -table.smiley-preview { - border: 1px solid #AAAAAA; -} - -#smileybutton-enable-label { - float: left; - width: 200px; - margin-bottom: 25px; -} - -#smileybutton-checkbox { - float: left; -} - - diff --git a/smileybutton/smileybutton.php b/smileybutton/smileybutton.php index d53794b9..50a61606 100755 --- a/smileybutton/smileybutton.php +++ b/smileybutton/smileybutton.php @@ -2,68 +2,42 @@ /** * Name: Smileybutton * Description: Adds a smileybutton to the Inputbox - * Version: 0.1 - * Author: Johannes Schwab + * Version: 0.2 + * Author: Johannes Schwab */ function smileybutton_install() { - - /** - * - * Register hooks for jot_tool and plugin_settings - * - */ - + //Register hooks register_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - register_hook('plugin_settings', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings'); - register_hook('plugin_settings_post', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings_post'); logger("installed smileybutton"); } function smileybutton_uninstall() { - - /** - * - * Delet registered hooks - * - */ - + //Delet registered hooks unregister_hook('jot_tool', 'addon/smileybutton/smileybutton.php', 'show_button'); - unregister_hook('plugin_settings', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings'); - unregister_hook('plugin_settings_post', 'addon/smileybutton/smileybutton.php', 'smileybutton_settings_post'); - + logger("removed smileybutton"); } function show_button($a, &$b) { + // Disable if theme is quattro + // TODO add style for quattro + if (current_theme() == 'quattro') + return; + + // Disable for mobile because most mobiles have a smiley key for ther own + if ($a->is_mobile || $a->is_tablet) + return; /** * - * Check if it is a local user and he has enabled smileybutton - * - */ - - if(! local_user()) { - $nobutton = false; - } else { - $nobutton = get_pconfig(local_user(), 'smileybutton', 'nobutton'); - } - - /** - * - * Prepare the Smilie-Arrays - * - */ - - /** - * - * I have copied this from /include/text.php, removed dobles - * and some escapes. + * I have copied this from /include/text.php, removed doubles + * and escaped them. * */ @@ -120,22 +94,12 @@ function show_button($a, &$b) { 'red' ); - /** - * - * Call hooks to get aditional smileies from other addons - * - */ - + // Call hooks to get aditional smileies from other addons $params = array('texts' => $texts, 'icons' => $icons, 'string' => ""); //changed call_hooks('smilie', $params); - /** - * - * Generate html for smileylist - * - */ - - $s = "\t\n"; + //Generate html for smiley list + $s = "
\n\t"; for($x = 0; $x < count($params['texts']); $x ++) { $icon = $params['icons'][$x]; $icon = str_replace('/>', 'onclick="smileybutton_addsmiley(\'' . $params['texts'][$x] . '\')"/>', $icon); @@ -145,139 +109,58 @@ function show_button($a, &$b) { $s .= "\n\t"; } } - $s .= "\t
\n"; + $s .= "\t"; - /** - * - * Add css to page - * - */ + //Add css to header + $css_file = 'addon/smileybutton/view/'.current_theme().'.css'; + if (! file_exists($css_file)) + $css_file = 'addon/smileybutton/view/default.css'; + $css_url = $a->get_baseurl().'/'.$css_file; - $a->page['htmlhead'] .= '' . "\r\n"; + $a->page['htmlhead'] .= ''."\r\n"; - /** - * - * Add the button to the Inputbox - * - */ - if (! $nobutton) { - $b = "
\n"; - $b .= "\tget_baseurl() . "/addon/smileybutton/icon.gif\" onclick=\"toggle_smileybutton()\" alt=\"smiley\">\n"; - $b .= "\t
\n"; - } + + //Get the correct image for the theme + $image = 'addon/smileybutton/view/'.current_theme().'.png'; + if (! file_exists($image)) + $image = 'addon/smileybutton/view/default.png'; + $image_url = $a->get_baseurl().'/'.$image; - - /** - * - * Write the smileies to an (hidden) div - * - */ + //Add the hmtl and script to the page + $b = <<< EOT +
+ smiley +
- if ($nobutton) { - $b .= "\t
\n"; - } else { - $b .= "\t
\n"; - } - $b .= $s . "\n"; - $b .= "
\n"; + - /** - * - * Function to show and hide the smiley-list in the hidden div - * - */ - - $b .= "\n"; -} - - - - - -/** - * - * Set the configuration - * - */ - -function smileybutton_settings_post($a,$post) { - if(! local_user()) - return; - if($_POST['smileybutton-submit']) - set_pconfig(local_user(),'smileybutton','nobutton',intval($_POST['smileybutton'])); - -} - - -/** - * - * Add configuration-dialog to form - * - */ - - -function smileybutton_settings(&$a,&$s) { - - if(! local_user()) - return; - - /* Add our stylesheet to the page so we can make our settings look nice */ - - $a->page['htmlhead'] .= '' . "\r\n"; - - /* Get the current state of our config variable */ - - $nobutton = get_pconfig(local_user(),'smileybutton','nobutton'); - $checked = (($nobutton) ? ' checked="checked" ' : ''); - - /* Add some HTML to the existing form */ - - $s .= '
'; - $s .= '

Smileybutton settings

'; - $s .= '
'; - - $s .= 'You can hide the button and show the smilies directly.

'; - - $s .= ''; - $s .= ''; - - $s .= '
'; - - /* provide a submit button */ - - $s .= '
'; + +EOT; } diff --git a/smileybutton/view/default.css b/smileybutton/view/default.css new file mode 100644 index 00000000..16120360 --- /dev/null +++ b/smileybutton/view/default.css @@ -0,0 +1,13 @@ +img.smiley_button { + height: 18px; + width: 18px; +} + +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} + +table.smiley-preview { + border: 1px solid #AAAAAA; +} diff --git a/smileybutton/view/default.png b/smileybutton/view/default.png new file mode 100644 index 0000000000000000000000000000000000000000..6ad02a18f195e8b3a71b4744692ed25a75615a4a GIT binary patch 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 + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/smileybutton/view/duepuntozero.css b/smileybutton/view/duepuntozero.css new file mode 100644 index 00000000..0f4ef4ae --- /dev/null +++ b/smileybutton/view/duepuntozero.css @@ -0,0 +1,21 @@ +img.smiley_button { + height: 18px; + width: 18px; + position: relative; + left: 285px; + 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/duepuntozero.png b/smileybutton/view/duepuntozero.png new file mode 100644 index 0000000000000000000000000000000000000000..b9ee401d83aed898ef25120b6d617c3a8108a697 GIT binary patch literal 399 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+3?vf;>QaGJY=BRQ>#<|U)VP?YRq?z!FL-KO z*1bzc`&aqBfB)|DhsXWOcqR2F9I!MED7=pW^j0RBMrn! z@^*J&=wOxg0CG4BJR*x37`TN&n2}-D90{Nxdx@v7EBk#Wc3x}lY~fQ0K%v#1E{-7* zQ%fg!^Bq>;ak(s@#IbH-fwG<1o&Pg@71myIb)R*1@^QJ!S^qN6u6_EIO-$UELv7bn z=Q0x?h9hj>wNsdnatJ81S|8FAurasrJ@{4etY+?QgV)76(q1d=+D|^2=dIcJebJPT z4bmKYcr+ESH!rxQ;9GgB*7iiq+K#oG9pe8xecNZp7y4du{VMjumB*T6LYF6H{an^LB{Ts56I`F! literal 0 HcmV?d00001 diff --git a/smileybutton/view/frost.css b/smileybutton/view/frost.css new file mode 100644 index 00000000..42e18f05 --- /dev/null +++ b/smileybutton/view/frost.css @@ -0,0 +1,21 @@ +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 new file mode 100644 index 0000000000000000000000000000000000000000..6ad02a18f195e8b3a71b4744692ed25a75615a4a GIT binary patch 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`BD4))?}uKxm77&vNN;y?7h}^)_iO2b=uH|5o|_h&Q}vlxQg?bC}BGWF^0>l?7WP- zF^Z)Uwx;t7cgQ)+i%9G$iLlSLcyI&m#}4$MtIFUNjN>Q#-GZ$-be39lya`XG<7zDA zXMc_%Jex#5#dI^n%?Pw(KOPd|oW>9M1%F|&%FYJt!XE5QvR~t45$+WeSc_MMNH61) zbY2UK_#?*`cmU7f5e(oxm1r%)nq+zo*Q?gsaUh+K;aw{e=_MS;MiGt8_`a}b9qwzd zV_+YKg`n!PZ-NCJ#LwbE9poey>{JjgI`jRw%uQJ-92scjTEe z&f;{gbvGg~D$?ylVf|v0c`JL4r|r?|#bO$66Dc)OSpN<03q?-~VHGhZG&3yf#8lz; z3EWH{-_|40Cko6Bx8lbfjqqKLT38SzdYOo8Y2Zo|C;taCDj8CfK$`|-b2U&TFss1u zHe-GIs7qi*{Ri)G(`a6Xjh%C<(tgH1Lf zFfKH(H|J+XIz3#q)(ZOYib&~WxwbcLk2fMPBl2|=TXO9PuHgkd*n;y-ctdFEGm(0O zqF4A;K?Aj}<4fsi3r>l&JTF?Y-Dzl1v{dC=vQvckNjxXC^CdnPrTcYJf)9%Jjl7O) zH6+vcMuh!EQ30p$cFwovrzG-EIw@lgABp?F4KLvyd?gx|WvJJXOo%38RD^F_gziK} zV=13{oe{i6Bk!b#Cl)w)|6MxczF;)XjZ+VY_s&#MTL5LmUX zb2y4KP3$*q%gdO;JGfV5!_IWNK7XIbpDHgVEjO?w@uJwRP$KK#LXM-YI%t3%TrG*# ztK2@#*WZ6z(JeCUOqZmJ>1va00000NkvXXu0mjfYNW*l literal 0 HcmV?d00001 diff --git a/smileybutton/view/smoothly.svg b/smileybutton/view/smoothly.svg new file mode 100644 index 00000000..8f5d26a2 --- /dev/null +++ b/smileybutton/view/smoothly.svg @@ -0,0 +1,112 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/smileybutton/view/vier.css b/smileybutton/view/vier.css new file mode 100644 index 00000000..4f237800 --- /dev/null +++ b/smileybutton/view/vier.css @@ -0,0 +1,15 @@ +img.smiley_button { + height: 18px; + width: 18px; + margin-right: 18px; +} + +img.smiley_preview { + max-height: 25px; + max-width: 25px; +} + +table.smiley-preview { + border: 1px solid #999999; + margin-left: 10px; +} diff --git a/smileybutton/view/vier.png b/smileybutton/view/vier.png new file mode 100644 index 0000000000000000000000000000000000000000..440f6a37064fd4b22f9f6baf3aa8ec0e8d61427d GIT binary patch literal 940 zcmV;d15^BoP)b5WdOHJ#+5dGjrz5nMY0cSc5GX!&Mk;_&$wa@HLL$Z(X3)i2>_z z7p}vq4!jxjIE;frv6g73K#vf7vr_N^Cem{Xb7_7xhA@InDAN2qKE}H^s|i{uFo1_} zWum9?p4ioFi+?iuuno6iU79yx3~%5>8lS+ME%=tgn`LdO;bCmX%lM|n z4@9_a<$R6k#5;xuaikE*hKTL$(5-Mf^JZD=3-l&prUmo)K$g{;Z@~pap^VFY?HJE7 zvaH!cTt6ZQRIyH(*H?-m^#^gdl+G7+N{h5Y(pcv7V0j2xgQ3yddXOg#$h z6bmdDHQbZNiu28G!9t%=@`ztT9%_=3_gj^jp=y-tc4J|}YaHsO%hC;lnz%d=73FVZf2 zgb&hqCvFnTyoUK|O?ZpY`YfImsTr;iVKesu^Y|V=2s74%NiP+`b7Wl<_2m1B9>yc0 z=6DOAP+yd;!aiKBEXi_BzebekH|VZ6n8e%4>^g|Yg(Z*T1*s%!tcv^aggA;BysAD$ z4~RUzSyVMSj4$FhQG^~6*2%aAd&JtO@U%*4ztXaNwXjIDUZGi8{-TB&VX2MDxYC + + + + + + + + + image/svg+xml + + + + + + + + + + + +