Skip to content
This repository was archived by the owner on Nov 18, 2023. It is now read-only.
This repository was archived by the owner on Nov 18, 2023. It is now read-only.

bootstrap5 support #2

@jipexu

Description

@jipexu

Hi
to work with boostrap5
I have quickly fix in the emojiPopper.min.js to work with bs5 ...
(except the detection of popper #1) ....

work well now (but only for bs5 ...)
It will be more work to make it work for both BS4 and BS5 ...

if agree will make a pr ...

var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,e){a!=Array.prototype&&a!=Object.prototype&&(a[b]=e.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_"; $jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.Symbol=function(){var a=0;return function(b){return $jscomp.SYMBOL_PREFIX+(b||"")+a++}}(); $jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var a=$jscomp.global.Symbol.iterator;a||(a=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&$jscomp.defineProperty(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(a){var b=0;return $jscomp.iteratorPrototype(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})}; $jscomp.iteratorPrototype=function(a){$jscomp.initSymbolIterator();a={next:a};a[$jscomp.global.Symbol.iterator]=function(){return this};return a};$jscomp.polyfill=function(a,b,e,c){if(b){e=$jscomp.global;a=a.split(".");for(c=0;c<a.length-1;c++){var k=a[c];k in e||(e[k]={});e=e[k]}a=a[a.length-1];c=e[a];b=b(c);b!=c&&null!=b&&$jscomp.defineProperty(e,a,{configurable:!0,writable:!0,value:b})}}; $jscomp.polyfill("Array.from",function(a){return a?a:function(a,e,c){$jscomp.initSymbolIterator();e=null!=e?e:function(a){return a};var b=[],f=a[Symbol.iterator];if("function"==typeof f)for(a=f.call(a);!(f=a.next()).done;)b.push(e.call(c,f.value));else{f=a.length;for(var d=0;d<f;d++)b.push(e.call(c,a[d]))}return b}},"es6","es3"); (function(a){a.fn.emojiPopper=function(b){function e(b,g){var e=d&&d.getItem("emoji");if((b=b||!d)||!e)a.getJSON(f.url,function(a){d&&(d.setItem("emoji",JSON.stringify(a)),console.log("Emoji stored locally"));console.log("Remote emoji to callback");return g(a)}).fail(function(){console.error("An error occured while getting the emoji data from remote source!")});else return console.log("Local emoji to callback"),g(JSON.parse(d.getItem("emoji")))}function c(b){var g,e=Math.random().toString(36).substr(2, 9),h=['<div class="accordion accordion-flush" id="emojiPopper'+e+'" data-type="emojiPopper">'],f="true",d="show";a.each(b,function(a,c){c.groupName!=g&&(g=c.groupName,h.push('<div class="accordion-item"><div class="accordion-header p-0" id="group'+a+'">'),h.push('<button type="button" class="accordion-button collapsed px-0" data-bs-toggle="collapse" data-bs-target="#collapse'+a+'" aria-expanded="'+f+'" aria-controls="collapse'+a+'">'),h.push(c.groupName),h.push("</button></div>"),h.push('<div id="collapse'+a+'" class="accordion-collapse collapse" aria-labelledby="group'+ a+'" data-bs-parent="#emojiPopper'+e+'">'),h.push('<div class="accordion-body px-0">'));h.push('<span title="'+c.description+'">'+c.formatted+"</span>");a+1 in b&&b[a+1].groupName==g||(h.push("</div></div></div>"),f="false",d="")});h.push("</div>");return h.join("")}function k(b){n=c(b);a(document).on("click",'[data-type="emojiPopper"] span',function(b){var e;b=a(this).closest('[data-type="emojiPopper"]');var c=b.data("targetSelector");b=b.data("toggler");var g=a(this).text();if("undefined"!==c){var d=a(c);c= (e=d.is("input")||d.is("textarea"))?d.val():d.text();var k=Array.from(c).length;var l=Number(d.attr("maxlength"));if(!isNaN(l)&&l<k+1)return f.autoClose&&"undefined"!==b&&b.popover("hide"),!1;l=d[0].selectionStart;k=d[0].selectionEnd;g=c.slice(0,l)+g+c.slice(k);console.log(c," TO ",g);e?d.val(g):d.text(g)}f.autoClose&&"undefined"!==b&&b.popover("hide")});l.popover(a.extend({},f,{html:!0,sanitize:!1,content:n}));l.on("shown.bs.popover",function(){var b=a(this),c=b.attr("aria-describedby");c=a("#"+ c+' [data-type="emojiPopper"]');b.removeAttr("aria-describedby").attr("aria-label",f.title);a(c).data({targetSelector:b.data("bs-target"),toggler:b})});l.on("show.bs.popover",function(){a(this).removeAttr("aria-describedby").attr("aria-label",f.title)});if(f.dismiss)a("body").on("click",function(b){l.each(function(){a(this).is(b.target)||0!==a(this).has(b.target).length||0!==a(".popover").has(b.target).length||a(this).popover("hide")})});return this}var f=a.extend({},{title:"Pick an emoji...",storageType:"localStorage", autoClose:!0,dismiss:!0},b),d=!1,l=a(this),n;this.initializeBefore=function(){/*if("undefined"===typeof Popper)return console.error("Dependency popper.js is not loaded!"),this;*/if(!f.hasOwnProperty("url"))return console.error("Url to emoji listing is undefined!"),this;try{var a=window[f.storageType];a.setItem("__storage_test__","__storage_test__");a.removeItem("__storage_test__");var b=!0}catch(m){b=m instanceof DOMException&&(22===m.code||1014===m.code||"QuotaExceededError"===m.name||"NS_ERROR_DOM_QUOTA_REACHED"=== m.name)&&a&&0!==a.length}b&&(d=window[f.storageType]);return e(!1,k)};this.clearStorage=function(){d&&(d.removeItem("emoji"),console.log("Storage cleared"))};return this.initializeBefore()}})(jQuery);

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions