Browse Source

Bug 25350: Load Emoji picker assets more efficiently

This patch moves the Emoji picker JS assets out of opac-bottom.inc and
into opac-detail.tt. This prevents the assets from being loaded on every
page of the OPAC when they're only used on opac-detail.

The patch also combines and minifies the 4 JavaScript files used by the
feature. opac-detail.tt now loads only the one file.

To test, apply the patch and make sure the TagsEnabled and
TagsInputOnDetail preferences are enabled.

- Log in to the OPAC and view the detail page for a bibliographic
  record.
- Click the "Add tag(s)" link
- Verify that the emoji-picker works for adding emojis

Signed-off-by: David Roberts <david@koha-ptfs.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
20.05.x
Owen Leonard 2 years ago
committed by Martin Renvoize
parent
commit
67f695001a
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 12
      koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
  2. 9
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
  3. 1
      koha-tmpl/opac-tmpl/lib/emoji-picker/js/emoji-picker-all.min.js

12
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc

@ -121,11 +121,6 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
[% Asset.js("js/amazonimages.js") | $raw %]
[% END %]
[% Asset.js("lib/emoji-picker/js/config.js") | $raw %]
[% Asset.js("lib/emoji-picker/js/util.js") | $raw %]
[% Asset.js("lib/emoji-picker/js/jquery.emojiarea.js") | $raw %]
[% Asset.js("lib/emoji-picker/js/emoji-picker.js") | $raw %]
<script>
//<![CDATA[
var MSG_CONFIRM_AGAIN = _("Warning: Cannot be undone. Please confirm once again")
@ -308,13 +303,6 @@ $(document).ready(function() {
jQuery.removeCookie("search_path_code", { path: '/'});
});
}
window.emojiPicker = new EmojiPicker({
emojiable_selector: '[data-emojiable=true]',
assetsPath: '[% interface | html %]/lib/emoji-picker/img/',
popupButtonClasses: 'fa fa-smile-o'
});
window.emojiPicker.discover();
});
</script>
[% PROCESS jsinclude %]

9
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt

@ -1369,8 +1369,15 @@
</script>
[% Asset.js("js/verovio.js") | $raw %]
[% END %]
[% Asset.js("lib/emoji-picker/js/emoji-picker-all.min.js") | $raw %]
<script>
window.emojiPicker = new EmojiPicker({
emojiable_selector: '[data-emojiable=true]',
assetsPath: '[% interface | html %]/lib/emoji-picker/img/',
popupButtonClasses: 'fa fa-smile-o'
});
window.emojiPicker.discover();
var OPACPopupAuthorsSearch = "[% Koha.Preference('OPACPopupAuthorsSearch') | html %]";
[% IF ( OpacHighlightedWords ) %]
var q_array = new Array(); // holds search terms if available

1
koha-tmpl/opac-tmpl/lib/emoji-picker/js/emoji-picker-all.min.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save