Sfoglia il codice sorgente

Get emoji picker working again

George S. Baugh 5 anni fa
parent
commit
293d887603
4 ha cambiato i file con 18 aggiunte e 1 eliminazioni
  1. 2 0
      .gitignore
  2. 2 0
      Makefile
  3. 2 1
      www/templates/form_common.tx
  4. 12 0
      www/templates/mbengine.tx

+ 2 - 0
.gitignore

@@ -6,3 +6,5 @@ www/assets/*.*
 data/DUMMY.json
 data/files/*
 pod2htmd.tmp
+fgEmojiPicker.js
+full-emoji-list.json

+ 2 - 0
Makefile

@@ -17,3 +17,5 @@ reset-dummy-data:
 depend:
 	sudo apt install -y sqlite3 libsqlite3-dev libdbd-sqlite3-perl cpanminus starman  libcal-dav-perl libtext-xslate-perl libserver-starter-perl libplack-perl libcal-dav-perl libconfig-tiny-perl libdatetime-format-http-perl libjson-maybexs-perl libuuid-tiny-perl libcapture-tiny-perl libconfig-simple-perl libdbi-perl libfile-slurper-perl libfile-touch-perl libfile-copy-recursive-perl libxml-rss-perl libmodule-install-perl
 	sudo cpanm Mojo::File Date::Format WWW::SitemapIndex::XML WWW::Sitemap::XML HTTP::Body Pod::Html URL::Encode
+	wget -O www/scripts/fgEmojiPicker.js https://github.com/woody180/vanilla-javascript-emoji-picker/raw/master/fgEmojiPicker.js
+	wget -O www/scripts/full-emoji-list.json https://github.com/woody180/vanilla-javascript-emoji-picker/raw/master/full-emoji-list.json

+ 2 - 1
www/templates/form_common.tx

@@ -1,4 +1,5 @@
-Content<br /><textarea class="cooltext" name="data" placeholder="Potzrebie"><: $post.data :></textarea>
+Content <button class="coolbutton emojiPicker">😎</button>:
+<br /><textarea class="cooltext" name="data" placeholder="Potzrebie"><: $post.data :></textarea>
 <input type="hidden" name="app" value="<: $app :>" />
 <input type="hidden" name="to"  value="<: $route :>" />
 : if ( $post.id ) {

+ 12 - 0
www/templates/mbengine.tx

@@ -8,3 +8,15 @@
         : include "posts.tx";
     </div>
 </div>
+<script type="text/javascript" src="/scripts/fgEmojiPicker.js"></script>
+<script type="text/javascript">
+new FgEmojiPicker({
+    trigger: ['button.emojiPicker'],
+    position: ['bottom'],
+    dir: `/scripts/`,
+    emit(obj, triggerElement) {
+        const emoji = obj.emoji;
+        document.querySelector('textarea').value += emoji;
+    }
+});
+</script>