Cleanup: Remoción masiva de restos de WordPress y consolidación de archivos GKACHELE™
This commit is contained in:
188
gk-assets/themes/chromax/inc/customizer/controls/js/controls.js
vendored
Normal file
188
gk-assets/themes/chromax/inc/customizer/controls/js/controls.js
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
/* Range */
|
||||
wp.customize.controlConstructor['range-value'] = wp.customize.Control.extend({
|
||||
|
||||
ready: function(){
|
||||
'use strict';
|
||||
|
||||
jQuery.fn.exists = function(){return this.length>0;};
|
||||
var control = this,
|
||||
changeAction;
|
||||
var theme_controls = jQuery('#customize-theme-controls');
|
||||
|
||||
function syncRangeText( slider, input, from ){
|
||||
switch (from){
|
||||
case 'slider':
|
||||
input.val( slider.val());
|
||||
break;
|
||||
case 'input':
|
||||
slider.val( input.val() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function updateValues( control ){
|
||||
var collector = control.find('.range-collector');
|
||||
var values = getSliderValues( control );
|
||||
var have_queries = Object.keys(values).length > 1;
|
||||
if( have_queries ){
|
||||
collector.val(JSON.stringify(values));
|
||||
} else {
|
||||
collector.val(values.desktop);
|
||||
}
|
||||
collector.trigger( 'change' );
|
||||
|
||||
}
|
||||
|
||||
function getSliderValues( control ) {
|
||||
var values = {};
|
||||
var desktopSelector = control.find('.range-slider__range[data-query="desktop"]'),
|
||||
tabletSelector = control.find('.range-slider__range[data-query="tablet"]') ,
|
||||
mobileSelector = control.find('.range-slider__range[data-query="mobile"]'),
|
||||
desktopValue, tabletValue, mobileValue;
|
||||
|
||||
if( desktopSelector.exists() ){
|
||||
desktopValue = desktopSelector.val();
|
||||
if( desktopValue !== 'undefined' && desktopValue !== '' ){
|
||||
values.desktop = desktopValue;
|
||||
}
|
||||
}
|
||||
|
||||
if( tabletSelector.exists() ){
|
||||
tabletValue = tabletSelector.val();
|
||||
if( tabletValue !== 'undefined' && tabletValue !== '' ){
|
||||
values.tablet = tabletValue;
|
||||
}
|
||||
}
|
||||
|
||||
if( mobileSelector.exists() ){
|
||||
mobileValue = mobileSelector.val();
|
||||
if( mobileValue !== 'undefined' && mobileValue !== '' ){
|
||||
values.mobile = mobileValue;
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
function responsiveSwitcher(){
|
||||
// Responsive switchers
|
||||
jQuery( '.customize-control .responsive-switchers button' ).on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
// Set up variables
|
||||
var $devices = jQuery( '.responsive-switchers' ),
|
||||
$device = jQuery( event.currentTarget ).data( 'device' ),
|
||||
$body = jQuery( '.wp-full-overlay' ),
|
||||
$footer_devices = jQuery( '.wp-full-overlay-footer .devices' );
|
||||
|
||||
// Button class
|
||||
$devices.find( 'button' ).removeClass( 'active' );
|
||||
$devices.find( 'button.preview-' + $device ).addClass( 'active' );
|
||||
|
||||
var control = jQuery('.range-slider.has-media-queries');
|
||||
control.find('.desktop-range').removeClass('active');
|
||||
control.find('.tablet-range').removeClass('active');
|
||||
control.find('.mobile-range').removeClass('active');
|
||||
control.find('.' + $device + '-range').addClass('active');
|
||||
|
||||
// Wrapper class
|
||||
$body.removeClass( 'preview-desktop preview-tablet preview-mobile' ).addClass( 'preview-' + $device );
|
||||
|
||||
// Panel footer buttons
|
||||
$footer_devices.find( 'button' ).removeClass( 'active' ).attr( 'aria-pressed', false );
|
||||
$footer_devices.find( 'button.preview-' + $device ).addClass( 'active' ).attr( 'aria-pressed', true );
|
||||
|
||||
} );
|
||||
|
||||
jQuery('#customize-footer-actions .devices button').on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
var device = jQuery(this).data('device');
|
||||
var queries = jQuery( '.responsive-switchers' );
|
||||
|
||||
queries.find( 'button' ).removeClass( 'active' );
|
||||
queries.find( 'button.preview-' + device ).addClass( 'active' );
|
||||
|
||||
var control = jQuery('.range-slider.has-media-queries');
|
||||
control.find('.desktop-range').removeClass('active');
|
||||
control.find('.tablet-range').removeClass('active');
|
||||
control.find('.mobile-range').removeClass('active');
|
||||
control.find('.' + device + '-range').addClass('active');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
theme_controls.unbind().on('click', '.preview-desktop.active', function () {
|
||||
jQuery( this ).parent().parent().toggleClass( 'responsive-switchers-open' );
|
||||
});
|
||||
|
||||
theme_controls.on('input', '.range-slider__range', function () {
|
||||
var slider = jQuery(this);
|
||||
var input = jQuery(this).next();
|
||||
var control = jQuery(this).parent().parent();
|
||||
syncRangeText( slider, input, 'slider');
|
||||
updateValues( control );
|
||||
});
|
||||
|
||||
theme_controls.on('keyup', '.range-slider-value', function(){
|
||||
var control = jQuery(this).parent().parent();
|
||||
updateValues( control );
|
||||
});
|
||||
theme_controls.on('keydown', '.range-slider-value', function(){
|
||||
var slider = jQuery(this).prev();
|
||||
var input = jQuery(this);
|
||||
syncRangeText( slider, input, 'input');
|
||||
});
|
||||
|
||||
|
||||
theme_controls.on('click', '.range-reset-slider', function (event) {
|
||||
event.preventDefault();
|
||||
var input = jQuery(this).prev();
|
||||
var slider = input.prev();
|
||||
var control = jQuery(this).parent().parent();
|
||||
var defaultValue = slider.data('default');
|
||||
input.val( defaultValue );
|
||||
slider.val( defaultValue );
|
||||
updateValues( control );
|
||||
});
|
||||
|
||||
responsiveSwitcher();
|
||||
|
||||
if ( 'postMessage' === control.setting.transport ) {
|
||||
changeAction = 'mousemove change';
|
||||
} else {
|
||||
changeAction = 'change';
|
||||
}
|
||||
|
||||
// Change the value
|
||||
this.container.on( changeAction, '.range-collector', function() {
|
||||
control.setting.set( jQuery( this ).val() );
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/* Upsale */
|
||||
( function( api ) {
|
||||
|
||||
// Extends our custom "chromax" section.
|
||||
api.sectionConstructor['chromax'] = api.Section.extend( {
|
||||
|
||||
// No events for this type of section.
|
||||
attachEvents: function () {},
|
||||
|
||||
// Always make the section active.
|
||||
isContextuallyActive: function () {
|
||||
return true;
|
||||
}
|
||||
} );
|
||||
|
||||
} )( wp.customize );
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
jQuery("#sub-accordion-section-chromax_sidebar_options select:not(#_customize-input-chromax_default_pg_sidebar_option), #sub-accordion-section-chromax_typography_options select, #sub-accordion-section-chromax_headings_typography select").prop('disabled', true);
|
||||
});
|
||||
|
||||
|
||||
jQuery(document).ready(function($) {
|
||||
jQuery('.contact-icon-picker.iconPicker').fontIconPicker();
|
||||
});
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Copyright (C) 2014 by original authors @ fontello.com</metadata>
|
||||
<defs>
|
||||
<font id="iconpicker" horiz-adv-x="1000" >
|
||||
<font-face font-family="iconpicker" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
||||
<missing-glyph horiz-adv-x="1000" />
|
||||
<glyph glyph-name="spin3" unicode="" d="m494 850c-266 0-483-210-494-472c-1-19 13-20 13-20l84 0c16 0 19 10 19 18c10 199 176 358 378 358c107 0 205-45 273-118l-58-57c-11-12-11-27 5-31l247-50c21-5 46 11 37 44l-58 227c-2 9-16 22-29 13l-65-60c-89 91-214 148-352 148z m409-508c-16 0-19-10-19-18c-10-199-176-358-377-358c-108 0-205 45-274 118l59 57c10 12 10 27-5 31l-248 50c-21 5-46-11-37-44l58-227c2-9 16-22 30-13l64 60c89-91 214-148 353-148c265 0 482 210 493 473c1 18-13 19-13 19l-84 0z" horiz-adv-x="1000" />
|
||||
<glyph glyph-name="search" unicode="" d="m643 386q0 103-74 176t-176 74t-177-74t-73-176t73-177t177-73t176 73t74 177z m286-465q0-29-22-50t-50-21q-30 0-50 21l-191 191q-100-69-223-69q-80 0-153 31t-125 84t-84 125t-31 153t31 152t84 126t125 84t153 31t152-31t126-84t84-126t31-152q0-123-69-223l191-191q21-21 21-51z" horiz-adv-x="928.6" />
|
||||
<glyph glyph-name="cancel" unicode="" d="m724 112q0-22-15-38l-76-76q-16-15-38-15t-38 15l-164 165l-164-165q-16-15-38-15t-38 15l-76 76q-16 16-16 38t16 38l164 164l-164 164q-16 16-16 38t16 38l76 76q16 16 38 16t38-16l164-164l164 164q16 16 38 16t38-16l76-76q15-15 15-38t-15-38l-164-164l164-164q15-15 15-38z" horiz-adv-x="785.7" />
|
||||
<glyph glyph-name="block" unicode="" d="m732 352q0 90-48 164l-421-420q76-50 166-50q62 0 118 25t96 65t65 97t24 119z m-557-167l421 421q-75 50-167 50q-83 0-153-40t-110-112t-41-152q0-91 50-167z m682 167q0-88-34-168t-91-137t-137-92t-166-34t-167 34t-137 92t-91 137t-34 168t34 167t91 137t137 91t167 34t166-34t137-91t91-137t34-167z" horiz-adv-x="857.1" />
|
||||
<glyph glyph-name="down-dir" unicode="" d="m571 457q0-14-10-25l-250-250q-11-11-25-11t-25 11l-250 250q-11 11-11 25t11 25t25 11h500q14 0 25-11t10-25z" horiz-adv-x="571.4" />
|
||||
<glyph glyph-name="up-dir" unicode="" d="m571 171q0-14-10-25t-25-10h-500q-15 0-25 10t-11 25t11 26l250 250q10 10 25 10t25-10l250-250q10-11 10-26z" horiz-adv-x="571.4" />
|
||||
<glyph glyph-name="left-dir" unicode="" d="m357 600v-500q0-14-10-25t-26-11t-25 11l-250 250q-10 11-10 25t10 25l250 250q11 11 25 11t26-11t10-25z" horiz-adv-x="357.1" />
|
||||
<glyph glyph-name="right-dir" unicode="" d="m321 350q0-14-10-25l-250-250q-11-11-25-11t-25 11t-11 25v500q0 15 11 25t25 11t25-11l250-250q10-10 10-25z" horiz-adv-x="357.1" />
|
||||
</font>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,328 @@
|
||||
/* fontIconPicker main CSS file {@link https://github.com/micc83/fontIconPicker} */
|
||||
|
||||
.icons-selector * {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
.icons-selector,
|
||||
.icons-selector *,
|
||||
.icons-selector :after,
|
||||
.icons-selector :before,
|
||||
.icons-selector:after,
|
||||
.icons-selector:before {
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box
|
||||
}
|
||||
|
||||
.icons-selector {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-align: left
|
||||
}
|
||||
|
||||
.icons-selector .selector {
|
||||
width: 100px;
|
||||
height: 40px
|
||||
}
|
||||
|
||||
.icons-selector .selector-button {
|
||||
width: 39px;
|
||||
height: 100%;
|
||||
display: block;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
float: left
|
||||
}
|
||||
|
||||
.icons-selector .selector-button i {
|
||||
line-height: 38px;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.icons-selector .selected-icon {
|
||||
display: block;
|
||||
width: 60px;
|
||||
height: 100%;
|
||||
float: left;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.icons-selector .selected-icon i {
|
||||
line-height: 40px;
|
||||
font-size: 18px;
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.icons-selector .selector-popup {
|
||||
position: absolute;
|
||||
z-index: 10000;
|
||||
background-color: #fefefe;
|
||||
padding: 5px;
|
||||
height: auto;
|
||||
width: 342px;
|
||||
margin-top: -1px
|
||||
}
|
||||
|
||||
.icons-selector .selector-category select,
|
||||
.icons-selector .selector-search input[type=text] {
|
||||
border: 0;
|
||||
line-height: 20px;
|
||||
padding: 10px 2.5%;
|
||||
width: 100%;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 5px;
|
||||
font-size: 12px;
|
||||
display: block
|
||||
}
|
||||
|
||||
.icons-selector .selector-category select {
|
||||
height: 40px
|
||||
}
|
||||
|
||||
.icons-selector .selector-category select option {
|
||||
padding: 10px
|
||||
}
|
||||
|
||||
.icons-selector input::-webkit-input-placeholder {
|
||||
text-transform: uppercase
|
||||
}
|
||||
|
||||
.icons-selector input:-moz-placeholder {
|
||||
text-transform: uppercase
|
||||
}
|
||||
|
||||
.icons-selector input::-moz-placeholder {
|
||||
text-transform: uppercase
|
||||
}
|
||||
|
||||
.icons-selector input:-ms-input-placeholder {
|
||||
text-transform: uppercase
|
||||
}
|
||||
|
||||
.icons-selector .selector-search {
|
||||
position: relative
|
||||
}
|
||||
|
||||
.icons-selector .selector-search i {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 7px
|
||||
}
|
||||
|
||||
.icons-selector .fip-icons-container {
|
||||
width: 100%;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
padding: 5px
|
||||
}
|
||||
|
||||
.icons-selector .fip-icons-container .loading {
|
||||
font-size: 24px;
|
||||
margin: 0 auto;
|
||||
padding: 20px 0;
|
||||
text-align: center;
|
||||
width: 100%
|
||||
}
|
||||
|
||||
.icons-selector .fip-box {
|
||||
display: inline-block;
|
||||
margin: 2px;
|
||||
width: 60px;
|
||||
line-height: 42px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
vertical-align: top;
|
||||
height: 40px
|
||||
}
|
||||
|
||||
.icons-selector .selector-footer {
|
||||
line-height: 12px;
|
||||
padding: 5px 5px 0;
|
||||
text-align: center
|
||||
}
|
||||
|
||||
.icons-selector .selector-footer,
|
||||
.icons-selector .selector-footer i {
|
||||
font-size: 14px
|
||||
}
|
||||
|
||||
.icons-selector .selector-arrows {
|
||||
float: right
|
||||
}
|
||||
|
||||
.icons-selector .selector-pages {
|
||||
font-size: 11px;
|
||||
float: left
|
||||
}
|
||||
|
||||
.icons-selector .selector-arrows i {
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.icons-selector .selector-footer em {
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
.icons-selector .icons-picker-error i:before {
|
||||
color: #eee
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: iconpicker;
|
||||
src: url(iconpicker.eot?90190138);
|
||||
src: url(iconpicker.eot?90190138#iefix) format('embedded-opentype'), url(iconpicker.woff?90190138) format('woff'), url(iconpicker.ttf?90190138) format('truetype'), url(iconpicker.svg?90190138#iconpicker) format('svg');
|
||||
font-weight: 400;
|
||||
font-style: normal
|
||||
}
|
||||
|
||||
.icons-selector [class*=" fip-icon-"]:before,
|
||||
.icons-selector [class^=fip-icon-]:before {
|
||||
font-family: iconpicker;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
speak: none;
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
width: 1em;
|
||||
margin-right: .2em;
|
||||
text-align: center;
|
||||
font-variant: normal;
|
||||
text-transform: none;
|
||||
line-height: 1em;
|
||||
margin-left: .2em
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-search:before {
|
||||
content: '\e812';
|
||||
cursor: default
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-cancel:before {
|
||||
content: '\e814';
|
||||
cursor: pointer
|
||||
}
|
||||
|
||||
.icons-selector .fa-times-circle-o:before {
|
||||
color: #fed0d0;
|
||||
font-size: 18px;
|
||||
line-height: 1.85;
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-block:before {
|
||||
content: '\e84e';
|
||||
color: #fed0d0
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-down-dir:before {
|
||||
content: '\e800'
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-up-dir:before {
|
||||
content: '\e813'
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-left-dir:before {
|
||||
content: '\e801'
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-right-dir:before {
|
||||
content: '\e802'
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-spin3:before {
|
||||
content: '\e815'
|
||||
}
|
||||
|
||||
.icons-selector .fip-icon-spin3 {
|
||||
-moz-animation: spin 2s infinite linear;
|
||||
-o-animation: spin 2s infinite linear;
|
||||
-webkit-animation: spin 2s infinite linear;
|
||||
animation: spin 2s infinite linear;
|
||||
display: inline-block
|
||||
}
|
||||
|
||||
@-moz-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg)
|
||||
}
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg)
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg)
|
||||
}
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg)
|
||||
}
|
||||
}
|
||||
|
||||
@-o-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg)
|
||||
}
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg)
|
||||
}
|
||||
}
|
||||
|
||||
@-ms-keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg)
|
||||
}
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg)
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
-moz-transform: rotate(0deg);
|
||||
-o-transform: rotate(0deg);
|
||||
-webkit-transform: rotate(0deg);
|
||||
transform: rotate(0deg)
|
||||
}
|
||||
100% {
|
||||
-moz-transform: rotate(359deg);
|
||||
-o-transform: rotate(359deg);
|
||||
-webkit-transform: rotate(359deg);
|
||||
transform: rotate(359deg)
|
||||
}
|
||||
}
|
||||
|
||||
.icons-selector .selector-popup {
|
||||
width: 280px;
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
/**
|
||||
* jQuery fontIconPicker - v2.0.0
|
||||
*
|
||||
* An icon picker built on top of font icons and jQuery
|
||||
*
|
||||
* http://codeb.it/fontIconPicker
|
||||
*
|
||||
* Made by Alessandro Benoit & Swashata
|
||||
* Under MIT License
|
||||
*
|
||||
* {@link https://github.com/micc83/fontIconPicker}
|
||||
*/
|
||||
!(function(a) {
|
||||
"use strict";
|
||||
|
||||
function c(c, d) {
|
||||
(this.element = a(c)),
|
||||
(this.settings = a.extend({}, b, d)),
|
||||
this.settings.emptyIcon && this.settings.iconsPerPage--,
|
||||
(this.iconPicker = a("<div/>", {
|
||||
class: "icons-selector",
|
||||
style: "position: relative",
|
||||
html: '<div class="selector"><span class="selected-icon"><i class="fa-times-circle"></i></span><span class="selector-button"><i class="fip-icon-down-dir"></i></span></div><div class="selector-popup" style="display: none;">' +
|
||||
(this.settings.hasSearch ? '<div class="selector-search"><input type="text" name="" value="" placeholder="Search icon" class="icons-search-input"/><i class="fip-icon-search"></i></div>' : "") +
|
||||
'<div class="selector-category">' +
|
||||
'<select name="" class="icon-category-select" style="display: none">' +
|
||||
"</select>" +
|
||||
"</div>" +
|
||||
'<div class="fip-icons-container"></div>' +
|
||||
'<div class="selector-footer" style="display:none;">' +
|
||||
'<span class="selector-pages">1/2</span>' +
|
||||
'<span class="selector-arrows">' +
|
||||
'<span class="selector-arrow-left" style="display:none;">' +
|
||||
'<i class="fip-icon-left-dir"></i>' +
|
||||
"</span>" +
|
||||
'<span class="selector-arrow-right">' +
|
||||
'<i class="fip-icon-right-dir"></i>' +
|
||||
"</span>" +
|
||||
"</span>" +
|
||||
"</div>" +
|
||||
"</div>",
|
||||
})),
|
||||
(this.iconContainer = this.iconPicker.find(".fip-icons-container")),
|
||||
(this.searchIcon = this.iconPicker.find(".selector-search i")),
|
||||
(this.iconsSearched = []),
|
||||
(this.isSearch = !1),
|
||||
(this.totalPage = 1),
|
||||
(this.currentPage = 1),
|
||||
(this.currentIcon = !1),
|
||||
(this.iconsCount = 0),
|
||||
(this.open = !1),
|
||||
(this.searchValues = []),
|
||||
(this.availableCategoriesSearch = []),
|
||||
(this.triggerEvent = null),
|
||||
(this.backupSource = []),
|
||||
(this.backupSearch = []),
|
||||
(this.isCategorized = !1),
|
||||
(this.selectCategory = this.iconPicker.find(".icon-category-select")),
|
||||
(this.selectedCategory = !1),
|
||||
(this.availableCategories = []),
|
||||
(this.unCategorizedKey = null),
|
||||
this.init();
|
||||
}
|
||||
var b = {
|
||||
theme: "fip-grey",
|
||||
source: !1,
|
||||
emptyIcon: !0,
|
||||
emptyIconValue: "",
|
||||
iconsPerPage: 20,
|
||||
hasSearch: !0,
|
||||
searchSource: !1,
|
||||
useAttribute: !1,
|
||||
attributeName: "data-icon",
|
||||
convertToHex: !0,
|
||||
allCategoryText: "From all categories",
|
||||
unCategorizedText: "Uncategorized",
|
||||
};
|
||||
(c.prototype = {
|
||||
init: function() {
|
||||
this.iconPicker.addClass(this.settings.theme), this.iconPicker.css({
|
||||
left: -9999
|
||||
}).appendTo("body");
|
||||
var b = this.iconPicker.outerHeight(),
|
||||
c = this.iconPicker.outerWidth();
|
||||
if (
|
||||
(this.iconPicker.css({
|
||||
left: ""
|
||||
}),
|
||||
this.element.before(this.iconPicker),
|
||||
this.element.css({
|
||||
visibility: "hidden",
|
||||
top: 0,
|
||||
position: "relative",
|
||||
zIndex: "-1",
|
||||
left: "-" + c + "px",
|
||||
display: "inline-block",
|
||||
height: b + "px",
|
||||
width: c + "px",
|
||||
padding: "0",
|
||||
margin: "0 -" + c + "px 0 0",
|
||||
border: "0 none",
|
||||
verticalAlign: "top",
|
||||
}), !this.element.is("select"))
|
||||
) {
|
||||
var d = (function() {
|
||||
for (var a = 3, b = document.createElement("div"), c = b.all || [];
|
||||
(b.innerHTML = "<!--[if gt IE " + ++a + "]><br><![endif]-->"), c[0];);
|
||||
return a > 4 ? a : !a;
|
||||
})(),
|
||||
e = document.createElement("div");
|
||||
this.triggerEvent = 9 !== d && "oninput" in e ? ["input", "keyup"] : ["keyup"];
|
||||
}!this.settings.source && this.element.is("select") ?
|
||||
((this.settings.source = []),
|
||||
(this.settings.searchSource = []),
|
||||
this.element.find("optgroup").length ?
|
||||
((this.isCategorized = !0),
|
||||
this.element.find("optgroup").each(
|
||||
a.proxy(function(b, c) {
|
||||
var d = this.availableCategories.length,
|
||||
e = a("<option />");
|
||||
e.attr("value", d),
|
||||
e.html(a(c).attr("label")),
|
||||
this.selectCategory.append(e),
|
||||
(this.availableCategories[d] = []),
|
||||
(this.availableCategoriesSearch[d] = []),
|
||||
a(c)
|
||||
.find("option")
|
||||
.each(
|
||||
a.proxy(function(b, c) {
|
||||
var e = a(c).val(),
|
||||
f = a(c).html();
|
||||
e && e !== this.settings.emptyIconValue && (this.settings.source.push(e), this.availableCategories[d].push(e), this.searchValues.push(f), this.availableCategoriesSearch[d].push(f));
|
||||
}, this)
|
||||
);
|
||||
}, this)
|
||||
),
|
||||
this.element.find("> option").length &&
|
||||
this.element.find("> option").each(
|
||||
a.proxy(function(b, c) {
|
||||
var d = a(c).val(),
|
||||
e = a(c).html();
|
||||
return d && "" !== d && d != this.settings.emptyIconValue ?
|
||||
(null === this.unCategorizedKey &&
|
||||
((this.unCategorizedKey = this.availableCategories.length),
|
||||
(this.availableCategories[this.unCategorizedKey] = []),
|
||||
(this.availableCategoriesSearch[this.unCategorizedKey] = []),
|
||||
a("<option />").attr("value", this.unCategorizedKey).html(this.settings.unCategorizedText).appendTo(this.selectCategory)),
|
||||
this.settings.source.push(d),
|
||||
this.availableCategories[this.unCategorizedKey].push(d),
|
||||
this.searchValues.push(e),
|
||||
this.availableCategoriesSearch[this.unCategorizedKey].push(e),
|
||||
void 0) :
|
||||
!0;
|
||||
}, this)
|
||||
)) :
|
||||
this.element.find("option").each(
|
||||
a.proxy(function(b, c) {
|
||||
var d = a(c).val(),
|
||||
e = a(c).html();
|
||||
d && (this.settings.source.push(d), this.searchValues.push(e));
|
||||
}, this)
|
||||
),
|
||||
(this.backupSource = this.settings.source.slice(0)),
|
||||
(this.backupSearch = this.searchValues.slice(0)),
|
||||
this.loadCategories()) :
|
||||
this.initSourceIndex(),
|
||||
this.loadIcons(),
|
||||
this.selectCategory.on(
|
||||
"change keyup",
|
||||
a.proxy(function(b) {
|
||||
if (this.isCategorized === !1) return !1;
|
||||
var c = a(b.currentTarget),
|
||||
d = c.val();
|
||||
if ("all" === c.val())(this.settings.source = this.backupSource), (this.searchValues = this.backupSearch);
|
||||
else {
|
||||
var e = parseInt(d, 10);
|
||||
this.availableCategories[e] && ((this.settings.source = this.availableCategories[e]), (this.searchValues = this.availableCategoriesSearch[e]));
|
||||
}
|
||||
this.resetSearch(), this.loadIcons();
|
||||
}, this)
|
||||
),
|
||||
this.iconPicker.find(".selector-button").click(
|
||||
a.proxy(function() {
|
||||
this.toggleIconSelector();
|
||||
}, this)
|
||||
),
|
||||
this.iconPicker.find(".selector-arrow-right").click(
|
||||
a.proxy(function(b) {
|
||||
this.currentPage < this.totalPage && (this.iconPicker.find(".selector-arrow-left").show(), (this.currentPage = this.currentPage + 1), this.renderIconContainer()),
|
||||
this.currentPage === this.totalPage && a(b.currentTarget).hide();
|
||||
}, this)
|
||||
),
|
||||
this.iconPicker.find(".selector-arrow-left").click(
|
||||
a.proxy(function(b) {
|
||||
this.currentPage > 1 && (this.iconPicker.find(".selector-arrow-right").show(), (this.currentPage = this.currentPage - 1), this.renderIconContainer()), 1 === this.currentPage && a(b.currentTarget).hide();
|
||||
}, this)
|
||||
),
|
||||
this.iconPicker.find(".icons-search-input").keyup(
|
||||
a.proxy(function(b) {
|
||||
var c = a(b.currentTarget).val();
|
||||
return "" === c ?
|
||||
(this.resetSearch(), void 0) :
|
||||
(this.searchIcon.removeClass("fip-icon-search"),
|
||||
this.searchIcon.addClass("fip-icon-cancel"),
|
||||
(this.isSearch = !0),
|
||||
(this.currentPage = 1),
|
||||
(this.iconsSearched = []),
|
||||
a.grep(
|
||||
this.searchValues,
|
||||
a.proxy(function(a, b) {
|
||||
return a.toLowerCase().search(c.toLowerCase()) >= 0 ? ((this.iconsSearched[this.iconsSearched.length] = this.settings.source[b]), !0) : void 0;
|
||||
}, this)
|
||||
),
|
||||
this.renderIconContainer(),
|
||||
void 0);
|
||||
}, this)
|
||||
),
|
||||
this.iconPicker.find(".selector-search").on(
|
||||
"click",
|
||||
".fip-icon-cancel",
|
||||
a.proxy(function() {
|
||||
this.iconPicker.find(".icons-search-input").focus(), this.resetSearch();
|
||||
}, this)
|
||||
),
|
||||
this.iconContainer.on(
|
||||
"click",
|
||||
".fip-box",
|
||||
a.proxy(function(b) {
|
||||
this.setSelectedIcon(a(b.currentTarget).find("i").attr("data-fip-value")), this.toggleIconSelector();
|
||||
}, this)
|
||||
),
|
||||
this.iconPicker.click(function(a) {
|
||||
return a.stopPropagation(), !1;
|
||||
}),
|
||||
a("html").click(
|
||||
a.proxy(function() {
|
||||
this.open && this.toggleIconSelector();
|
||||
}, this)
|
||||
);
|
||||
},
|
||||
initSourceIndex: function() {
|
||||
if ("object" == typeof this.settings.source) {
|
||||
if (a.isArray(this.settings.source))
|
||||
(this.isCategorized = !1),
|
||||
this.selectCategory.html("").hide(),
|
||||
(this.settings.source = a.map(this.settings.source, function(a) {
|
||||
return "function" == typeof a.toString ? a.toString() : a;
|
||||
})),
|
||||
(this.searchValues = a.isArray(this.settings.searchSource) ?
|
||||
a.map(this.settings.searchSource, function(a) {
|
||||
return "function" == typeof a.toString ? a.toString() : a;
|
||||
}) :
|
||||
this.settings.source.slice(0));
|
||||
else {
|
||||
var b = a.extend(!0, {}, this.settings.source);
|
||||
(this.settings.source = []),
|
||||
(this.searchValues = []),
|
||||
(this.availableCategoriesSearch = []),
|
||||
(this.selectedCategory = !1),
|
||||
(this.availableCategories = []),
|
||||
(this.unCategorizedKey = null),
|
||||
(this.isCategorized = !0),
|
||||
this.selectCategory.html("");
|
||||
for (var c in b) {
|
||||
var d = this.availableCategories.length,
|
||||
e = a("<option />");
|
||||
e.attr("value", d), e.html(c), this.selectCategory.append(e), (this.availableCategories[d] = []), (this.availableCategoriesSearch[d] = []);
|
||||
for (var f in b[c]) {
|
||||
var g = b[c][f],
|
||||
h = this.settings.searchSource && this.settings.searchSource[c] && this.settings.searchSource[c][f] ? this.settings.searchSource[c][f] : g;
|
||||
"function" == typeof g.toString && (g = g.toString()),
|
||||
g && g !== this.settings.emptyIconValue && (this.settings.source.push(g), this.availableCategories[d].push(g), this.searchValues.push(h), this.availableCategoriesSearch[d].push(h));
|
||||
}
|
||||
}
|
||||
}
|
||||
(this.backupSource = this.settings.source.slice(0)), (this.backupSearch = this.searchValues.slice(0)), this.loadCategories();
|
||||
}
|
||||
},
|
||||
loadCategories: function() {
|
||||
this.isCategorized !== !1 && (a('<option value="all">' + this.settings.allCategoryText + "</option>").prependTo(this.selectCategory), this.selectCategory.show().val("all").trigger("change"));
|
||||
},
|
||||
loadIcons: function() {
|
||||
this.iconContainer.html('<i class="fip-icon-spin3 animate-spin loading"></i>'), this.settings.source instanceof Array && this.renderIconContainer();
|
||||
},
|
||||
renderIconContainer: function() {
|
||||
var b,
|
||||
c = [];
|
||||
if (
|
||||
((c = this.isSearch ? this.iconsSearched : this.settings.source),
|
||||
(this.iconsCount = c.length),
|
||||
(this.totalPage = Math.ceil(this.iconsCount / this.settings.iconsPerPage)),
|
||||
this.totalPage > 1 ? this.iconPicker.find(".selector-footer").show() : this.iconPicker.find(".selector-footer").hide(),
|
||||
this.iconPicker.find(".selector-pages").html(this.currentPage + "/" + this.totalPage + " <em>(" + this.iconsCount + ")</em>"),
|
||||
(b = (this.currentPage - 1) * this.settings.iconsPerPage),
|
||||
this.settings.emptyIcon)
|
||||
)
|
||||
this.iconContainer.html('<span class="fip-box"><i class="fas fa-times-circle" data-fip-value="fa-times-circle"></i></span>');
|
||||
else {
|
||||
if (c.length < 1) return this.iconContainer.html('<span class="icons-picker-error"><i class="fas fa-times-circle" data-fip-value="fa-times-circle"></i></span>'), void 0;
|
||||
this.iconContainer.html("");
|
||||
}
|
||||
c = c.slice(b, b + this.settings.iconsPerPage);
|
||||
for (var e, d = 0;
|
||||
(e = c[d++]);) {
|
||||
var f = e;
|
||||
a.grep(
|
||||
this.settings.source,
|
||||
a.proxy(function(a, b) {
|
||||
return a === e ? ((f = this.searchValues[b]), !0) : !1;
|
||||
}, this)
|
||||
),
|
||||
a("<span/>", {
|
||||
html: '<i data-fip-value="' +
|
||||
e +
|
||||
'" ' +
|
||||
(this.settings.useAttribute ? this.settings.attributeName + '="' + (this.settings.convertToHex ? "&#x" + parseInt(e, 10).toString(16) + ";" : e) + '"' : 'class=" ' + e + '"') +
|
||||
"></i>",
|
||||
class: "fip-box",
|
||||
title: f,
|
||||
}).appendTo(this.iconContainer);
|
||||
}
|
||||
this.settings.emptyIcon || (this.element.val() && -1 !== a.inArray(this.element.val(), this.settings.source)) ?
|
||||
-1 === a.inArray(this.element.val(), this.settings.source) ?
|
||||
this.setSelectedIcon() :
|
||||
this.setSelectedIcon(this.element.val()) :
|
||||
this.setSelectedIcon(c[0]);
|
||||
},
|
||||
setHighlightedIcon: function() {
|
||||
this.iconContainer.find(".current-icon").removeClass("current-icon"),
|
||||
this.currentIcon &&
|
||||
this.iconContainer
|
||||
.find('[data-fip-value="' + this.currentIcon + '"]')
|
||||
.parent("span")
|
||||
.addClass("current-icon");
|
||||
},
|
||||
setSelectedIcon: function(a) {
|
||||
if (
|
||||
("fa-times-circle" === a && (a = ""),
|
||||
this.settings.useAttribute ?
|
||||
a ?
|
||||
this.iconPicker.find(".selected-icon").html("<i " + this.settings.attributeName + '="' + (this.settings.convertToHex ? "&#x" + parseInt(a, 10).toString(16) + ";" : a) + '"></i>') :
|
||||
this.iconPicker.find(".selected-icon").html('<i class="fa-times-circle"></i>') :
|
||||
this.iconPicker.find(".selected-icon").html('<i class="fas ' + (a || "fa-times-circle") + '"></i>'),
|
||||
this.element.val("" === a ? this.settings.emptyIconValue : a).trigger("change"),
|
||||
null !== this.triggerEvent)
|
||||
)
|
||||
for (var b in this.triggerEvent) this.element.trigger(this.triggerEvent[b]);
|
||||
(this.currentIcon = a), this.setHighlightedIcon();
|
||||
},
|
||||
toggleIconSelector: function() {
|
||||
(this.open = this.open ? 0 : 1),
|
||||
this.iconPicker.find(".selector-popup").slideToggle(300),
|
||||
this.iconPicker.find(".selector-button i").toggleClass("fip-icon-down-dir"),
|
||||
this.iconPicker.find(".selector-button i").toggleClass("fip-icon-up-dir"),
|
||||
this.open && this.iconPicker.find(".icons-search-input").focus().select();
|
||||
},
|
||||
resetSearch: function() {
|
||||
this.iconPicker.find(".icons-search-input").val(""),
|
||||
this.searchIcon.removeClass("fip-icon-cancel"),
|
||||
this.searchIcon.addClass("fip-icon-search"),
|
||||
this.iconPicker.find(".selector-arrow-left").hide(),
|
||||
(this.currentPage = 1),
|
||||
(this.isSearch = !1),
|
||||
this.renderIconContainer(),
|
||||
this.totalPage > 1 && this.iconPicker.find(".selector-arrow-right").show();
|
||||
},
|
||||
}),
|
||||
(a.fn.fontIconPicker = function(b) {
|
||||
return (
|
||||
this.each(function() {
|
||||
a.data(this, "fontIconPicker") || a.data(this, "fontIconPicker", new c(this, b));
|
||||
}),
|
||||
(this.setIcons = a.proxy(function(b, c) {
|
||||
void 0 === b && (b = !1),
|
||||
void 0 === c && (c = !1),
|
||||
this.each(function() {
|
||||
(a.data(this, "fontIconPicker").settings.source = b),
|
||||
(a.data(this, "fontIconPicker").settings.searchSource = c),
|
||||
a.data(this, "fontIconPicker").initSourceIndex(),
|
||||
a.data(this, "fontIconPicker").resetSearch(),
|
||||
a.data(this, "fontIconPicker").loadIcons();
|
||||
});
|
||||
}, this)),
|
||||
(this.destroyPicker = a.proxy(function() {
|
||||
this.each(function() {
|
||||
a.data(this, "fontIconPicker") &&
|
||||
(a.data(this, "fontIconPicker").iconPicker.remove(),
|
||||
a.data(this, "fontIconPicker").element.css({
|
||||
visibility: "",
|
||||
top: "",
|
||||
position: "",
|
||||
zIndex: "",
|
||||
left: "",
|
||||
display: "",
|
||||
height: "",
|
||||
width: "",
|
||||
padding: "",
|
||||
margin: "",
|
||||
border: "",
|
||||
verticalAlign: ""
|
||||
}),
|
||||
a.removeData(this, "fontIconPicker"));
|
||||
});
|
||||
}, this)),
|
||||
(this.refreshPicker = a.proxy(function(d) {
|
||||
d || (d = b),
|
||||
this.destroyPicker(),
|
||||
this.each(function() {
|
||||
a.data(this, "fontIconPicker") || a.data(this, "fontIconPicker", new c(this, d));
|
||||
});
|
||||
}, this)),
|
||||
this
|
||||
);
|
||||
});
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user