File: public/assets/bootstrap-iconpicker/js/bootstrap-iconpicker.min.js

Recommend this page to a friend!
  Classes of Aby Dahana  >  Aksara  >  public/assets/bootstrap-iconpicker/js/bootstrap-iconpicker.min.js  >  Download  
File: public/assets/bootstrap-iconpicker/js/bootstrap-iconpicker.min.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Aksara
A CodeIgniter based API and CRUD generator
Author: By
Last change: Update of public/assets/bootstrap-iconpicker/js/bootstrap-iconpicker.min.js
Date: 3 months ago
Size: 11,042 bytes
 

Contents

Class file image Download
/*!========================================================================
 * File: bootstrap-iconpicker.min.js v1.10.0 by @victor-valencia
 * https://victor-valencia.github.com/bootstrap-iconpicker
 * ========================================================================
 * Copyright 2013-2018 Victor Valencia Rico.
 * Licensed under MIT license.
 * https://github.com/victor-valencia/bootstrap-iconpicker/blob/master/LICENSE
 * ========================================================================
 */
!function(d){"use strict";var r=function(t,e){if(void 0===d.fn.popover||void 0===d.fn.popover.Constructor.VERSION)throw new TypeError("Bootstrap iconpicker require Bootstrap popover");this.$element=d(t),this.options=d.extend({},r.DEFAULTS,this.$element.data()),this.options=d.extend({},this.options,e)};r.VERSION="1.10.0",r.ICONSET_EMPTY={iconClass:"",iconClassFix:"",icons:[]},r.ICONSET={_custom:null,elusiveicon:d.iconset_elusiveicon||r.ICONSET_EMPTY,flagicon:d.iconset_flagicon||r.ICONSET_EMPTY,fontawesome4:d.iconset_fontawesome_4||r.ICONSET_EMPTY,fontawesome5:d.iconset_fontawesome_5||r.ICONSET_EMPTY,glyphicon:d.iconset_glyphicon||r.ICONSET_EMPTY,ionicon:d.iconset_ionicon||r.ICONSET_EMPTY,mapicon:d.iconset_mapicon||r.ICONSET_EMPTY,materialdesign:d.iconset_materialdesign||r.ICONSET_EMPTY,octicon:d.iconset_octicon||r.ICONSET_EMPTY,typicon:d.iconset_typicon||r.ICONSET_EMPTY,weathericon:d.iconset_weathericon||r.ICONSET_EMPTY},r.DEFAULTS={align:"center",arrowClass:"btn-primary",arrowNextIconClass:"mdi mdi-arrow-right",arrowPrevIconClass:"mdi mdi-arrow-left",cols:4,icon:"",iconset:"materialdesign",iconsetVersion:"lastest",header:!0,labelHeader:"{0} / {1}",footer:!0,labelFooter:"{0} - {1} of {2}",placement:"bottom",rows:4,search:!0,searchText:"Search icon",selectedClass:"btn-warning p-0",unselectedClass:"btn-secondary p-0"},r.prototype.bindEvents=function(){var o=this.options,s=this;o.table.find(".btn-previous, .btn-next").off("click").on("click",function(t){if(t.preventDefault(),!d(this).hasClass("disabled")){var e=parseInt(d(this).val(),10);s.changeList(o.page+e)}}),o.table.find(".btn-icon").off("click").on("click",function(t){t.preventDefault(),s.select(d(this).val()),!1===o.inline?s.$element.popover("3.x"===d.fn.bsVersion()?"destroy":"dispose"):o.table.find("i[class$='"+d(this).val()+"']").parent().addClass(o.selectedClass)}),o.table.find(".search-control").off("keyup").on("keyup",function(){s.changeList(1)})},r.prototype.changeList=function(t){this.filterIcons(),this.updateLabels(t),this.updateIcons(t),this.options.page=t,this.bindEvents()},r.prototype.filterIcons=function(){var o=this.options,s=o.table.find(".search-control").val(),n=[];if("lastest"!=o.iconsetVersion&&void 0!==r.ICONSET[o.iconset].allVersions?d.each(r.ICONSET[o.iconset].allVersions,function(t,e){o.iconsetVersion==e.version&&(n=e.icons)}):n=r.ICONSET[o.iconset].icons,""===s)o.icons=n;else{var i=[];d.each(n,function(t,e){-1<e.toLowerCase().indexOf(s)&&i.push(e)}),o.icons=i}},r.prototype.removeAddClass=function(t,e,o){return this.options.table.find(t).removeClass(e).addClass(o),o},r.prototype.reset=function(){this.updatePicker(),this.changeList(1)},r.prototype.select=function(t){var e=this.options,o=this.$element;e.selected=d.inArray(t.replace(e.iconClassFix,""),e.icons),-1===e.selected&&(e.selected=0,t=e.iconClassFix+e.icons[e.selected]),""!==t&&0<=e.selected&&(e.icon=t,!1===e.inline&&(o.find("input").val(t),o.find("i").attr("class","").addClass(e.iconClass).addClass(t)),t===e.iconClassFix?o.trigger({type:"change",icon:"empty"}):(o.trigger({type:"change",icon:t}),o.find("input").val(t)),e.table.find("button."+e.selectedClass).removeClass(e.selectedClass))},r.prototype.switchPage=function(t){var e=this.options;if(e.selected=d.inArray(t.replace(e.iconClassFix,""),e.icons),0<=e.selected){var o=Math.ceil((e.selected+1)/this.totalIconsPerPage());this.changeList(o)}""===t?e.table.find("i."+e.iconClassFix).parent().addClass(e.selectedClass):e.table.find("i."+t).parent().addClass(e.selectedClass)},r.prototype.totalPages=function(){return Math.ceil(this.totalIcons()/this.totalIconsPerPage())},r.prototype.totalIcons=function(){return this.options.icons.length},r.prototype.totalIconsPerPage=function(){return 0===this.options.rows?this.options.icons.length:this.options.cols*this.options.rows},r.prototype.updateArrows=function(t){var e=this.options,o=this.totalPages();1===t?e.table.find(".btn-previous").addClass("disabled"):e.table.find(".btn-previous").removeClass("disabled"),t===o||0===o?e.table.find(".btn-next").addClass("disabled"):e.table.find(".btn-next").removeClass("disabled")},r.prototype.updateIcons=function(t){var e=this.options,o=e.table.find("tbody").empty(),s=(t-1)*this.totalIconsPerPage(),n=e.rows;0===e.rows&&(n=e.icons.length);for(var i=0;i<n;i++){for(var a=d("<tr></tr>"),r=0;r<e.cols;r++){var c=s+i*e.cols+r,p=d('<button class="btn '+e.unselectedClass+' btn-icon"></button>').hide();if(c<e.icons.length){var l=e.iconClassFix+e.icons[c];p.val(l).attr("title",l).append('<i class="'+e.iconClass+" "+l+'"></i>').show(),e.icon===l&&p.addClass(e.selectedClass).addClass("btn-icon-selected")}a.append(d("<td></td>").append(p))}o.append(a)}},r.prototype.updateIconsCount=function(){var t=this.options;if(!0===t.footer){var e=["<tr>",'<td colspan="'+t.cols+'" class="text-center">','<span class="icons-count"></span>',"</td>","</tr>"];t.table.find("tfoot").empty().append(e.join(""))}},r.prototype.updateLabels=function(t){var e=this.options,o=this.totalIcons(),s=this.totalPages();e.table.find(".page-count").html(e.labelHeader.replace("{0}",0===s?0:t).replace("{1}",s));var n=(t-1)*this.totalIconsPerPage(),i=t*this.totalIconsPerPage();e.table.find(".icons-count").html(e.labelFooter.replace("{0}",o?n+1:0).replace("{1}",i<o?i:o).replace("{2}",o)),this.updateArrows(t)},r.prototype.updatePagesCount=function(){var t=this.options;if(!0===t.header){for(var e=d("<tr></tr>"),o=0;o<t.cols;o++){var s=d('<td class="text-center"></td>');if(0===o||o===t.cols-1){var n=['<button class="btn btn-arrow '+(0===o?"btn-previous":"btn-next")+" "+t.arrowClass+'" value="'+(0===o?-1:1)+'">','<span class="'+(0===o?t.arrowPrevIconClass:t.arrowNextIconClass)+'"></span>',"</button>"];s.append(n.join("")),e.append(s)}else 0===e.find(".page-count").length&&(s.attr("colspan",t.cols-2).append('<span class="page-count"></span>'),e.append(s))}t.table.find("thead").empty().append(e)}},r.prototype.updatePicker=function(){var t=this.options;if(t.cols<4)throw"Iconpicker => The number of columns must be greater than or equal to 4. [option.cols = "+t.cols+"]";if(t.rows<0)throw"Iconpicker => The number of rows must be greater than or equal to 0. [option.rows = "+t.rows+"]";this.updatePagesCount(),this.updateSearch(),this.updateIconsCount()},r.prototype.updateSearch=function(){var t=this.options,e=["<tr>",'   <td colspan="'+t.cols+'">','       <input type="text" class="form-control search-control" style="width: '+t.cols*("3.x"===d.fn.bsVersion()?39:41)+'px;" placeholder="'+t.searchText+'">',"   </td>","</tr>"];e=d(e.join("")),!0===t.search?e.show():e.hide(),t.table.find("thead").append(e)},r.prototype.setAlign=function(t){this.$element.removeClass(this.options.align).addClass(t),this.options.align=t},r.prototype.setArrowClass=function(t){this.options.arrowClass=this.removeAddClass(".btn-arrow",this.options.arrowClass,t)},r.prototype.setArrowNextIconClass=function(t){this.options.arrowNextIconClass=this.removeAddClass(".btn-next > span",this.options.arrowNextIconClass,t)},r.prototype.setArrowPrevIconClass=function(t){this.options.arrowPrevIconClass=this.removeAddClass(".btn-previous > span",this.options.arrowPrevIconClass,t)},r.prototype.setCols=function(t){this.options.cols=t,this.reset()},r.prototype.setFooter=function(t){var e=this.options.table.find("tfoot");!0===t?e.show():e.hide(),this.options.footer=t},r.prototype.setHeader=function(t){var e=this.options.table.find("thead");!0===t?e.show():e.hide(),this.options.header=t},r.prototype.setIcon=function(t){this.select(t)},r.prototype.setIconset=function(t){var e=this.options;d.isPlainObject(t)?(r.ICONSET._custom=d.extend(r.ICONSET_EMPTY,t),e.iconset="_custom"):r.ICONSET.hasOwnProperty(t)?e.iconset=t:e.iconset=r.DEFAULTS.iconset,e=d.extend(e,r.ICONSET[e.iconset]),this.reset(),this.select(e.icon)},r.prototype.setLabelHeader=function(t){this.options.labelHeader=t,this.updateLabels(this.options.page)},r.prototype.setLabelFooter=function(t){this.options.labelFooter=t,this.updateLabels(this.options.page)},r.prototype.setPlacement=function(t){this.options.placement=t},r.prototype.setRows=function(t){this.options.rows=t,this.reset()},r.prototype.setSearch=function(t){var e=this.options.table.find(".search-control");!0===t?e.show():e.hide(),e.val(""),this.changeList(1),this.options.search=t},r.prototype.setSearchText=function(t){this.options.table.find(".search-control").attr("placeholder",t),this.options.searchText=t},r.prototype.setSelectedClass=function(t){this.options.selectedClass=this.removeAddClass(".btn-icon-selected",this.options.selectedClass,t)},r.prototype.setUnselectedClass=function(t){this.options.unselectedClass=this.removeAddClass(".btn-icon",this.options.unselectedClass,t)};var t=d.fn.iconpicker;d.fn.iconpicker=function(i,a){return this.each(function(){var e=d(this),o=e.data("bs.iconpicker"),t="object"==typeof i&&i;if(o||e.data("bs.iconpicker",o=new r(this,t)),"string"==typeof i){if(void 0===o[i])throw'Iconpicker => The "'+i+'" method does not exists.';o[i](a)}else{var s=o.options;s=d.extend(s,{inline:!1,page:1,selected:-1,table:d('<table class="table-icons"><thead></thead><tbody></tbody><tfoot></tfoot></table>')});var n=void 0!==e.attr("name")?'name="'+e.attr("name")+'"':"";"BUTTON"===e.prop("tagName")?(e.empty().append("<i></i>").append('<input type="hidden" '+n+"></input>").append('<span class="caret"></span>').addClass("iconpicker "+("3.x"===d.fn.bsVersion()?"":"dropdown-toggle")),o.setIconset(s.iconset),e.on("click",function(t){t.preventDefault(),e.popover({animation:!1,trigger:"manual",html:!0,content:s.table,container:"body",placement:s.placement}).on("inserted.bs.popover",function(){var t=e.data("bs.popover");("3.x"===d.fn.bsVersion()?t.tip():d(t.getTipElement())).addClass("iconpicker-popover")}).on("shown.bs.popover",function(){o.switchPage(s.icon),o.bindEvents()}),e.popover("show")})):(s.inline=!0,o.setIconset(s.iconset),e.empty().append('<input type="hidden" '+n+"></input>").append(s.table).addClass("iconpicker").addClass(s.align),o.switchPage(s.icon),o.bindEvents())}})},d.fn.iconpicker.Constructor=r,d.fn.iconpicker.noConflict=function(){return d.fn.iconpicker=t,this},d.fn.bsVersion=function(){return d.fn.popover.Constructor.VERSION.substr(0,2)+"x"},d(document).on("click","body",function(t){d(".iconpicker").each(function(){d(this).is(t.target)||0!==d(this).has(t.target).length||0!==d(".popover").has(t.target).length||d(this).popover("3.x"===d.fn.bsVersion()?"destroy":"dispose")})}),d('button[role="iconpicker"],div[role="iconpicker"]').iconpicker()}(jQuery);
For more information send a message to info at phpclasses dot org.