j1-template 2022.5.1.rc0 → 2022.5.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/_includes/themes/j1/procedures/global/date-german.proc +67 -0
  3. data/assets/data/banner.html +2 -2
  4. data/assets/data/menu.html +1 -1
  5. data/assets/data/mmenu.html +36 -36
  6. data/assets/themes/j1/adapter/js/attic.js +8 -0
  7. data/assets/themes/j1/adapter/js/cookieConsent.js +42 -25
  8. data/assets/themes/j1/adapter/js/mmenu.js +2 -2
  9. data/assets/themes/j1/core/css/themes/unolight/bootstrap.css +2 -2
  10. data/assets/themes/j1/core/css/themes/unolight/bootstrap.min.css +1 -1
  11. data/assets/themes/j1/modules/backstretch/js/backstretch.js +4 -4
  12. data/assets/themes/j1/modules/backstretch/js/backstretch.min.js +1 -1
  13. data/assets/themes/j1/modules/mmenuLight/README.md +22 -0
  14. data/assets/themes/j1/modules/mmenuLight/css/mmenu-light.css +224 -243
  15. data/assets/themes/j1/modules/mmenuLight/css/mmenu-light.min.css +3 -3
  16. data/assets/themes/j1/modules/mmenuLight/css/theme/uno/mmenu.css +95 -55
  17. data/assets/themes/j1/modules/mmenuLight/css/theme/uno/mmenu.min.css +1 -1
  18. data/assets/themes/j1/modules/mmenuLight/js/mmenu.js +57 -440
  19. data/assets/themes/j1/modules/mmenuLight/js/mmenu.min.js +4 -15
  20. data/assets/themes/j1/modules/{twemoji/js/picker → themeSwitcher}/LICENSE +21 -21
  21. data/assets/themes/j1/modules/themeSwitcher/README.md +166 -0
  22. data/assets/themes/j1/modules/themeSwitcher/js/switcher.js +2 -2
  23. data/assets/themes/j1/modules/themeSwitcher/js/switcher.min.js +1 -1
  24. data/lib/j1/version.rb +1 -1
  25. data/lib/starter_web/Gemfile +1 -1
  26. data/lib/starter_web/README.md +5 -5
  27. data/lib/starter_web/_config.yml +2 -2
  28. data/lib/starter_web/_data/blocks/banner.yml +1 -1
  29. data/lib/starter_web/_data/modules/defaults/cookies.yml +1 -1
  30. data/lib/starter_web/_plugins/lunr_index.rb +1 -1
  31. data/lib/starter_web/index.html +34 -12
  32. data/lib/starter_web/package.json +1 -1
  33. data/lib/starter_web/pages/public/features/general.adoc +1 -1
  34. data/lib/starter_web/pages/public/legal/de/300_privacy.adoc +139 -0
  35. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +63 -3
  36. data/lib/starter_web/utilsrv/_defaults/package.json +1 -1
  37. data/lib/starter_web/utilsrv/package.json +1 -1
  38. metadata +6 -9
  39. data/assets/themes/j1/modules/twemoji/css/picker/twemoji-picker.css +0 -153
  40. data/assets/themes/j1/modules/twemoji/css/picker/twemoji-picker.min.css +0 -19
  41. data/assets/themes/j1/modules/twemoji/js/picker/twemoji-picker.js +0 -304
  42. data/assets/themes/j1/modules/twemoji/js/picker/twemoji-picker.min.js +0 -322
  43. data/assets/themes/j1/modules/twemoji/js/twemoji.js +0 -580
  44. data/assets/themes/j1/modules/twemoji/js/twemoji.min.js +0 -19
@@ -1,304 +0,0 @@
1
- /*
2
- # -----------------------------------------------------------------------------
3
- # ~/assets/themes/j1/modules/twemoji/js/picker/twemoji-picker.js
4
- # Twemoji-Picker v2017-06-03 implementation for J1 template
5
- #
6
- # Product/Info:
7
- # https://jekyll.one
8
- # https://github.com/xLs51/Twemoji-Picker
9
- #
10
- # Copyright (C) 2022 Juergen Adams
11
- # Copyright (C) 2015 xLs51
12
- #
13
- # J1 Template is licensed under the MIT License.
14
- # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
15
- # Twemoji-Picker is licensed under under the MIT License.
16
- # For details, https://github.com/xLs51/Twemoji-Picker
17
- # -----------------------------------------------------------------------------
18
- */
19
- (function ($, window, undefined) {
20
- var b = 150;
21
- var d = {};
22
- var twa_database = "/assets/data/twa_v1.json";
23
- var responseText;
24
- var placeholder;
25
-
26
- $.TwemojiPicker = function (element, options) {
27
- var h = this;
28
- $.when(this._loadDatabase()).done(function (e) {
29
- h.$el = $(element);
30
- h._init(options)
31
- })
32
- };
33
- $.TwemojiPicker.defaults = {
34
- init: null,
35
- language: "en",
36
- size: 25,
37
- icon: "grinning",
38
- iconSize: 25,
39
- height: 100,
40
- width: null,
41
- category: ["smile", "cherry-blossom", "video-game", "oncoming-automobile", "symbols"],
42
- categorySize: 20,
43
- pickerPosition: null,
44
- pickerHeight: 150,
45
- pickerWidth: null,
46
- placeholder: "Click on Picker to select Emoji's from a Category",
47
- };
48
- $.TwemojiPicker.prototype = {
49
- _init: function (h) {
50
- this.options = $.extend(true, {}, $.TwemojiPicker.defaults, h);
51
- this._initPicker();
52
- this._initCategory();
53
- this._initTwemoji();
54
- this._initText();
55
- this._initStyle();
56
- this._initEvents()
57
- },
58
- _loadDatabase: function f() {
59
- return $.ajax({
60
- url: twa_database,
61
- success: function (h) {
62
- if (typeof h == "string") {
63
- d = JSON.parse(h)
64
- }
65
- if (typeof h == "object") {
66
- d = h
67
- }
68
- }
69
- })
70
- },
71
- _initPicker: function () {
72
- var h = this;
73
- var clearText;
74
- var buttonsHTML;
75
-
76
- if (h.options.language == 'en') {
77
- clearText = 'Clear';
78
- responseText = 'Copied to Clipboard';
79
- placeholder = h.options.placeholder;
80
- } else if (h.options.language == 'de') {
81
- clearText = 'Löschen';
82
- responseText = 'Kopiert zur Zwischenablage';
83
- placeholder = "Klicken Sie auf Picker zur Auswahl von Emoji's aus einer Kategorie";
84
- } else {
85
- clearText = 'Clear';
86
- responseText = 'in Clipboard';
87
- placeholder = h.options.placeholder;
88
- }
89
-
90
- buttonsHTML = '<div class="twemoji-icon-picker">';
91
- buttonsHTML += '<span id="open-group" class="mr-2" style="width: 2rem; height: 2rem;">';
92
- buttonsHTML += '<button type="button" name="open-group" class="btn btn-flex btn-primary mr-2"><i class="toggle-button mdi mdi-lg mr-1 mdi-toggle-switch-off"></i> Picker </button>';
93
- buttonsHTML += '</span>';
94
- buttonsHTML += '<span id="clear-textarea" style="width: 2rem; height: 2rem;">';
95
- buttonsHTML += '<button type="button" name="clear-textarea" class="btn btn-flex btn-primary"><i class="mdi mdi-close mdi-lg mr-1"></i>' + clearText + '</button>';
96
- buttonsHTML += '</span>';
97
- buttonsHTML += '</div>';
98
-
99
- h.$id = "#" + h.$el["0"].id;
100
- h.$pickerHeigth = h.options.height.replace("px", "");
101
- h.$pickerHeigth = Number(h.$pickerHeigth);
102
- h.$wrapper = h.$el.wrap('<div class="twemoji-wrap"></div>').parent();
103
- h.$wrapper.append('<div class="twemoji-textarea" contentEditable="true" placeholder="' + placeholder + '"></div>');
104
- h.$wrapper.append('<div class="twemoji-textarea-duplicate"></div>');
105
- h.$wrapper.append(buttonsHTML);
106
- h.$wrapper.append('<div class="twemoji-picker"></div>');
107
- h.$el.hide();
108
- h.$textarea = h.$wrapper.find(".twemoji-textarea");
109
- h.$textareaDuplicate = h.$wrapper.find(".twemoji-textarea-duplicate").hide();
110
- h.$iconPicker = h.$wrapper.find("#open-group");
111
- h.$clearTextarea = h.$wrapper.find("#clear-textarea");
112
- h.$picker = h.$wrapper.find(".twemoji-picker").hide()
113
- },
114
- _initCategory: function () {
115
- var h = this;
116
- var i = this.options.category;
117
- this.categoryName = ["people", "nature", "object", "place", "symbol"];
118
- this.$picker.append('<div class="twemoji-picker-category"></div>');
119
- this.$pickerCategory = this.$picker.find(".twemoji-picker-category");
120
- $.each(this.categoryName, function (j, k) {
121
- h.$pickerCategory.append('<span data-category="' + k + '">' + h.imageFromName(i[j]) + "</span>")
122
- });
123
- this.$pickerCategory.find("span:first").addClass("active")
124
- },
125
- _initTwemoji: function () {
126
- var h = this;
127
- $.each(this.categoryName, function (j, k) {
128
- h.$picker.append('<div class="twemoji-list ' + k + '"></div>');
129
- $.each(d, function (i, l) {
130
- if (l.category === k) {
131
- h.$wrapper.find(".twemoji-picker ." + k).append('<span><img class="emoji" draggable="false" src="' + l.base64 + '" alt="' + l.value + '" title="' + l.name + '"></span>')
132
- }
133
- })
134
- });
135
- this.$twemojiList = this.$picker.find(".twemoji-list");
136
- this.$twemojiList.not(":first").hide()
137
- },
138
- _initText: function () {
139
- if (this.options.init) {
140
- var j = this.options.init;
141
- var i = /:([\w-]+):/g;
142
- var h;
143
- while (h == i.exec(j)) {
144
- j = j.replace(h[0], this.imageFromName(h[1], true))
145
- }
146
- this.$textarea.html(j);
147
- this.copyTextArea(this.$textarea.html())
148
- }
149
- },
150
- _initStyle: function () {
151
- this.$wrapper.css({
152
- width: this.options.width ? this.options.width : "100%",
153
- height: this.options.height ? this.options.height : "",
154
- });
155
- this.$wrapper.find("img").css({
156
- width: this.options.size,
157
- height: this.options.size,
158
- });
159
- this.$iconPicker.css({
160
- width: this.options.iconSize,
161
- height: this.options.iconSize,
162
- });
163
- this.$pickerCategory.find("img").css({
164
- width: this.options.categorySize,
165
- height: this.options.categorySize,
166
- });
167
- this.$twemojiList.css({
168
- width: this.options.pickerWidth ? this.options.pickerWidth : "100%",
169
- height: this.options.pickerHeight,
170
- });
171
- this.$picker.css({
172
- width: this.options.pickerWidth ? this.options.pickerWidth : "100%",
173
- top: this.options.pickerPosition === "top" ? "-" + this.$picker.outerHeight() + "px" : "",
174
- })
175
- },
176
- _initEvents: function () {
177
- var h = this;
178
- this.$textarea.on("keyup", function () {
179
- h.copyTextArea($(this).html())
180
- });
181
- this.$iconPicker.on("click", function () {
182
- var i = $(".twemoji-picker").height() + b;
183
- $("#picker").height(i);
184
- $(".toggle-button").toggleClass("mdi-toggle-switch-off mdi-toggle-switch");
185
- if (!h.openedPicker) {
186
- h.openPicker()
187
- } else {
188
- h.closePicker();
189
- $("#picker").height(h.$pickerHeigth)
190
- }
191
- });
192
- this.$clearTextarea.on("click", function () {
193
- h.copyTextArea('');
194
- $(h.$id).val('');
195
- $(".twemoji-textarea > .emoji-span").remove()
196
- });
197
- this.$pickerCategory.find("span").on("click", function () {
198
- var i = $(this).data("category");
199
- h.openCategory($(this), i)
200
- });
201
- this.$pickerCategory.find(".close").on("click", function () {
202
- if (h.openedPicker) {
203
- h.closePicker()
204
- }
205
- });
206
- this.$twemojiList.find("img").on("click", function () {
207
- h.copyTwemoji($(this))
208
- })
209
- },
210
- copyText: function (text) {
211
- var copyFrom = document.createElement('textarea');
212
- copyFrom.setAttribute("style", "position:fixed;opacity:0;top:100px;left:100px;");
213
- copyFrom.value = text;
214
- document.body.appendChild(copyFrom);
215
- copyFrom.select();
216
- document.execCommand('copy');
217
- var copied = document.createElement('div');
218
- copied.setAttribute('class', 'copied');
219
- copied.appendChild(document.createTextNode(responseText));
220
- document.body.appendChild(copied);
221
- setTimeout(function () {
222
- document.body.removeChild(copyFrom);
223
- document.body.removeChild(copied);
224
- }, 1500);
225
- },
226
- openPicker: function () {
227
- this.$picker.show();
228
- this.openedPicker = true
229
- },
230
- closePicker: function () {
231
- this.$picker.hide();
232
- this.openedPicker = false
233
- },
234
- openCategory: function (h, i) {
235
- this.$pickerCategory.find("span").removeClass("active");
236
- h.addClass("active");
237
- this.$twemojiList.not(".twemoji-picker ." + i).hide();
238
- this.$twemojiList.filter(".twemoji-picker ." + i).show()
239
- },
240
- copyTwemoji: function (l) {
241
- var i = l.attr("alt");
242
- var k = l.attr("src");
243
- var j = l.attr("title");
244
- var h = "emoji:" + j + "[]";
245
- this.copyText(h);
246
- this.$textarea.focus();
247
- this.pasteAtCursor('<span class="emoji-span"><img class="emoji" src="' + k + '" title="' + j + '" alt="' + i + '" width="' + this.options.size + '" height="' + this.options.size + '"> ' + h + "</span> ");
248
- this.copyTextArea(this.$textarea.html())
249
- },
250
- copyTextArea: function (j) {
251
- var h = this.$textareaDuplicate.html(j);
252
- h.find("img").replaceWith(function () {
253
- return this.alt
254
- });
255
- var i = h.html();
256
- this.$el.text(i)
257
- },
258
- imageFromName: function (i, j) {
259
- var h = $.grep(d, function (k) {
260
- return k.name == i
261
- });
262
- if (j) {
263
- return '<img class="emoji" src="' + h[0].base64 + '" alt="' + h[0].value + '" width="' + this.options.size + '" height="' + this.options.size + '">'
264
- }
265
- return '<img class="emoji" draggable="false" src="' + h[0].base64 + '" alt="' + i + '">'
266
- },
267
- pasteAtCursor: function (m) {
268
- var l, h;
269
- if (window.getSelection) {
270
- l = window.getSelection();
271
- if (l.getRangeAt && l.rangeCount) {
272
- h = l.getRangeAt(0);
273
- h.deleteContents();
274
- var i = document.createElement("div");
275
- i.innerHTML = m;
276
- var n = document.createDocumentFragment(),
277
- k, j;
278
- while ((k = i.firstChild)) {
279
- j = n.appendChild(k)
280
- }
281
- h.insertNode(n);
282
- if (j) {
283
- h = h.cloneRange();
284
- h.setStartAfter(j);
285
- h.collapse(true);
286
- l.removeAllRanges();
287
- l.addRange(h)
288
- }
289
- }
290
- } else {
291
- if (document.selection && document.selection.type != "Control") {
292
- document.selection.createRange().pasteHTML(m)
293
- }
294
- }
295
- }
296
- };
297
- $.fn.twemojiPicker = function (i) {
298
- var h = $.data(this, "twemojiPicker");
299
- this.each(function () {
300
- h ? h._init() : h = $.data(this, "twemojiPicker", new $.TwemojiPicker(this, i));
301
- });
302
- return h
303
- }
304
- })(jQuery, window, document);
@@ -1,322 +0,0 @@
1
- /*
2
- # -----------------------------------------------------------------------------
3
- # ~/assets/themes/j1/modules/twemoji/js/picker/twemoji-picker.min.js
4
- # Twemoji-Picker v2017-06-03 implementation for J1 template
5
- #
6
- # Product/Info:
7
- # https://jekyll.one
8
- # https://github.com/xLs51/Twemoji-Picker
9
- #
10
- # Copyright (C) 2022 Juergen Adams
11
- # Copyright (C) 2015 xLs51
12
- #
13
- # J1 Template is licensed under the MIT License.
14
- # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
15
- # Twemoji-Picker is licensed under under the MIT License.
16
- # For details, https://github.com/xLs51/Twemoji-Picker
17
- # -----------------------------------------------------------------------------
18
- */
19
- /*
20
- # -----------------------------------------------------------------------------
21
- # ~/assets/themes/j1/modules/twemoji/js/picker/twemoji-picker.js
22
- # Twemoji-Picker v2017-06-03 implementation for J1 template
23
- #
24
- # Product/Info:
25
- # https://jekyll.one
26
- # https://github.com/xLs51/Twemoji-Picker
27
- #
28
- # Copyright (C) 2022 Juergen Adams
29
- # Copyright (C) 2015 xLs51
30
- #
31
- # J1 Template is licensed under the MIT License.
32
- # See: https://github.com/jekyll-one-org/J1 Template/blob/master/LICENSE
33
- # Twemoji-Picker is licensed under under the MIT License.
34
- # For details, https://github.com/xLs51/Twemoji-Picker
35
- # -----------------------------------------------------------------------------
36
- */
37
- (function ($, window, undefined) {
38
- var b = 150;
39
- var d = {};
40
- var twa_database = "/assets/data/twa_v1.json";
41
- var responseText;
42
- var placeholder;
43
-
44
- $.TwemojiPicker = function (element, options) {
45
- var h = this;
46
- $.when(this._loadDatabase()).done(function (e) {
47
- h.$el = $(element);
48
- h._init(options)
49
- })
50
- };
51
- $.TwemojiPicker.defaults = {
52
- init: null,
53
- language: "en",
54
- size: 25,
55
- icon: "grinning",
56
- iconSize: 25,
57
- height: 100,
58
- width: null,
59
- category: ["smile", "cherry-blossom", "video-game", "oncoming-automobile", "symbols"],
60
- categorySize: 20,
61
- pickerPosition: null,
62
- pickerHeight: 150,
63
- pickerWidth: null,
64
- placeholder: "Click on Picker to select Emoji's from a Category",
65
- };
66
- $.TwemojiPicker.prototype = {
67
- _init: function (h) {
68
- this.options = $.extend(true, {}, $.TwemojiPicker.defaults, h);
69
- this._initPicker();
70
- this._initCategory();
71
- this._initTwemoji();
72
- this._initText();
73
- this._initStyle();
74
- this._initEvents()
75
- },
76
- _loadDatabase: function f() {
77
- return $.ajax({
78
- url: twa_database,
79
- success: function (h) {
80
- if (typeof h == "string") {
81
- d = JSON.parse(h)
82
- }
83
- if (typeof h == "object") {
84
- d = h
85
- }
86
- }
87
- })
88
- },
89
- _initPicker: function () {
90
- var h = this;
91
- var clearText;
92
- var buttonsHTML;
93
-
94
- if (h.options.language == 'en') {
95
- clearText = 'Clear';
96
- responseText = 'Copied to Clipboard';
97
- placeholder = h.options.placeholder;
98
- } else if (h.options.language == 'de') {
99
- clearText = 'Löschen';
100
- responseText = 'Kopiert zur Zwischenablage';
101
- placeholder = "Klicken Sie auf Picker zur Auswahl von Emoji's aus einer Kategorie";
102
- } else {
103
- clearText = 'Clear';
104
- responseText = 'in Clipboard';
105
- placeholder = h.options.placeholder;
106
- }
107
-
108
- buttonsHTML = '<div class="twemoji-icon-picker">';
109
- buttonsHTML += '<span id="open-group" class="mr-2" style="width: 2rem; height: 2rem;">';
110
- buttonsHTML += '<button type="button" name="open-group" class="btn btn-flex btn-primary mr-2"><i class="toggle-button mdi mdi-lg mr-1 mdi-toggle-switch-off"></i> Picker </button>';
111
- buttonsHTML += '</span>';
112
- buttonsHTML += '<span id="clear-textarea" style="width: 2rem; height: 2rem;">';
113
- buttonsHTML += '<button type="button" name="clear-textarea" class="btn btn-flex btn-primary"><i class="mdi mdi-close mdi-lg mr-1"></i>' + clearText + '</button>';
114
- buttonsHTML += '</span>';
115
- buttonsHTML += '</div>';
116
-
117
- h.$id = "#" + h.$el["0"].id;
118
- h.$pickerHeigth = h.options.height.replace("px", "");
119
- h.$pickerHeigth = Number(h.$pickerHeigth);
120
- h.$wrapper = h.$el.wrap('<div class="twemoji-wrap"></div>').parent();
121
- h.$wrapper.append('<div class="twemoji-textarea" contentEditable="true" placeholder="' + placeholder + '"></div>');
122
- h.$wrapper.append('<div class="twemoji-textarea-duplicate"></div>');
123
- h.$wrapper.append(buttonsHTML);
124
- h.$wrapper.append('<div class="twemoji-picker"></div>');
125
- h.$el.hide();
126
- h.$textarea = h.$wrapper.find(".twemoji-textarea");
127
- h.$textareaDuplicate = h.$wrapper.find(".twemoji-textarea-duplicate").hide();
128
- h.$iconPicker = h.$wrapper.find("#open-group");
129
- h.$clearTextarea = h.$wrapper.find("#clear-textarea");
130
- h.$picker = h.$wrapper.find(".twemoji-picker").hide()
131
- },
132
- _initCategory: function () {
133
- var h = this;
134
- var i = this.options.category;
135
- this.categoryName = ["people", "nature", "object", "place", "symbol"];
136
- this.$picker.append('<div class="twemoji-picker-category"></div>');
137
- this.$pickerCategory = this.$picker.find(".twemoji-picker-category");
138
- $.each(this.categoryName, function (j, k) {
139
- h.$pickerCategory.append('<span data-category="' + k + '">' + h.imageFromName(i[j]) + "</span>")
140
- });
141
- this.$pickerCategory.find("span:first").addClass("active")
142
- },
143
- _initTwemoji: function () {
144
- var h = this;
145
- $.each(this.categoryName, function (j, k) {
146
- h.$picker.append('<div class="twemoji-list ' + k + '"></div>');
147
- $.each(d, function (i, l) {
148
- if (l.category === k) {
149
- h.$wrapper.find(".twemoji-picker ." + k).append('<span><img class="emoji" draggable="false" src="' + l.base64 + '" alt="' + l.value + '" title="' + l.name + '"></span>')
150
- }
151
- })
152
- });
153
- this.$twemojiList = this.$picker.find(".twemoji-list");
154
- this.$twemojiList.not(":first").hide()
155
- },
156
- _initText: function () {
157
- if (this.options.init) {
158
- var j = this.options.init;
159
- var i = /:([\w-]+):/g;
160
- var h;
161
- while (h == i.exec(j)) {
162
- j = j.replace(h[0], this.imageFromName(h[1], true))
163
- }
164
- this.$textarea.html(j);
165
- this.copyTextArea(this.$textarea.html())
166
- }
167
- },
168
- _initStyle: function () {
169
- this.$wrapper.css({
170
- width: this.options.width ? this.options.width : "100%",
171
- height: this.options.height ? this.options.height : "",
172
- });
173
- this.$wrapper.find("img").css({
174
- width: this.options.size,
175
- height: this.options.size,
176
- });
177
- this.$iconPicker.css({
178
- width: this.options.iconSize,
179
- height: this.options.iconSize,
180
- });
181
- this.$pickerCategory.find("img").css({
182
- width: this.options.categorySize,
183
- height: this.options.categorySize,
184
- });
185
- this.$twemojiList.css({
186
- width: this.options.pickerWidth ? this.options.pickerWidth : "100%",
187
- height: this.options.pickerHeight,
188
- });
189
- this.$picker.css({
190
- width: this.options.pickerWidth ? this.options.pickerWidth : "100%",
191
- top: this.options.pickerPosition === "top" ? "-" + this.$picker.outerHeight() + "px" : "",
192
- })
193
- },
194
- _initEvents: function () {
195
- var h = this;
196
- this.$textarea.on("keyup", function () {
197
- h.copyTextArea($(this).html())
198
- });
199
- this.$iconPicker.on("click", function () {
200
- var i = $(".twemoji-picker").height() + b;
201
- $("#picker").height(i);
202
- $(".toggle-button").toggleClass("mdi-toggle-switch-off mdi-toggle-switch");
203
- if (!h.openedPicker) {
204
- h.openPicker()
205
- } else {
206
- h.closePicker();
207
- $("#picker").height(h.$pickerHeigth)
208
- }
209
- });
210
- this.$clearTextarea.on("click", function () {
211
- h.copyTextArea('');
212
- $(h.$id).val('');
213
- $(".twemoji-textarea > .emoji-span").remove()
214
- });
215
- this.$pickerCategory.find("span").on("click", function () {
216
- var i = $(this).data("category");
217
- h.openCategory($(this), i)
218
- });
219
- this.$pickerCategory.find(".close").on("click", function () {
220
- if (h.openedPicker) {
221
- h.closePicker()
222
- }
223
- });
224
- this.$twemojiList.find("img").on("click", function () {
225
- h.copyTwemoji($(this))
226
- })
227
- },
228
- copyText: function (text) {
229
- var copyFrom = document.createElement('textarea');
230
- copyFrom.setAttribute("style", "position:fixed;opacity:0;top:100px;left:100px;");
231
- copyFrom.value = text;
232
- document.body.appendChild(copyFrom);
233
- copyFrom.select();
234
- document.execCommand('copy');
235
- var copied = document.createElement('div');
236
- copied.setAttribute('class', 'copied');
237
- copied.appendChild(document.createTextNode(responseText));
238
- document.body.appendChild(copied);
239
- setTimeout(function () {
240
- document.body.removeChild(copyFrom);
241
- document.body.removeChild(copied);
242
- }, 1500);
243
- },
244
- openPicker: function () {
245
- this.$picker.show();
246
- this.openedPicker = true
247
- },
248
- closePicker: function () {
249
- this.$picker.hide();
250
- this.openedPicker = false
251
- },
252
- openCategory: function (h, i) {
253
- this.$pickerCategory.find("span").removeClass("active");
254
- h.addClass("active");
255
- this.$twemojiList.not(".twemoji-picker ." + i).hide();
256
- this.$twemojiList.filter(".twemoji-picker ." + i).show()
257
- },
258
- copyTwemoji: function (l) {
259
- var i = l.attr("alt");
260
- var k = l.attr("src");
261
- var j = l.attr("title");
262
- var h = "emoji:" + j + "[]";
263
- this.copyText(h);
264
- this.$textarea.focus();
265
- this.pasteAtCursor('<span class="emoji-span"><img class="emoji" src="' + k + '" title="' + j + '" alt="' + i + '" width="' + this.options.size + '" height="' + this.options.size + '"> ' + h + "</span> ");
266
- this.copyTextArea(this.$textarea.html())
267
- },
268
- copyTextArea: function (j) {
269
- var h = this.$textareaDuplicate.html(j);
270
- h.find("img").replaceWith(function () {
271
- return this.alt
272
- });
273
- var i = h.html();
274
- this.$el.text(i)
275
- },
276
- imageFromName: function (i, j) {
277
- var h = $.grep(d, function (k) {
278
- return k.name == i
279
- });
280
- if (j) {
281
- return '<img class="emoji" src="' + h[0].base64 + '" alt="' + h[0].value + '" width="' + this.options.size + '" height="' + this.options.size + '">'
282
- }
283
- return '<img class="emoji" draggable="false" src="' + h[0].base64 + '" alt="' + i + '">'
284
- },
285
- pasteAtCursor: function (m) {
286
- var l, h;
287
- if (window.getSelection) {
288
- l = window.getSelection();
289
- if (l.getRangeAt && l.rangeCount) {
290
- h = l.getRangeAt(0);
291
- h.deleteContents();
292
- var i = document.createElement("div");
293
- i.innerHTML = m;
294
- var n = document.createDocumentFragment(),
295
- k, j;
296
- while ((k = i.firstChild)) {
297
- j = n.appendChild(k)
298
- }
299
- h.insertNode(n);
300
- if (j) {
301
- h = h.cloneRange();
302
- h.setStartAfter(j);
303
- h.collapse(true);
304
- l.removeAllRanges();
305
- l.addRange(h)
306
- }
307
- }
308
- } else {
309
- if (document.selection && document.selection.type != "Control") {
310
- document.selection.createRange().pasteHTML(m)
311
- }
312
- }
313
- }
314
- };
315
- $.fn.twemojiPicker = function (i) {
316
- var h = $.data(this, "twemojiPicker");
317
- this.each(function () {
318
- h ? h._init() : h = $.data(this, "twemojiPicker", new $.TwemojiPicker(this, i));
319
- });
320
- return h
321
- }
322
- })(jQuery, window, document);