PluginProbe
QuadMenu – Mega Menu / 1.8.8
QuadMenu – Mega Menu v1.8.8
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / lib / redux / icons / field_icons.js

field_icons.js in QuadMenu – Mega Menu 1.8.8, at lib/redux/icons/field_icons.js

115 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*global redux_change, wp, redux*/
2
3 (function ($) {
4 "use strict";
5
6 redux.field_objects = redux.field_objects || {};
7 redux.field_objects.icons = redux.field_objects.icons || {};
8
9
10 $(document).ready(
11 function () {
12 //redux.field_objects.icons.init();
13 }
14 );
15
16 redux.field_objects.icons.init = function (selector) {
17
18 if (!selector) {
19 selector = $(document).find(".redux-group-tab:visible").find('.redux-container-icons:visible');
20 }
21
22 $(selector).each(
23 function () {
24 var el = $(this);
25
26 redux.field_objects.media.init(el);
27
28 el.parent().prev().hide();
29 var parent = el;
30 if (!el.hasClass('redux-field-container')) {
31 parent = el.parents('.redux-field-container:first');
32 }
33 if (parent.is(":hidden")) { // Skip hidden fields
34 return;
35 }
36
37 if (parent.hasClass('redux-container-icons')) {
38 parent.addClass('redux-field-init');
39 }
40
41 if (parent.hasClass('redux-field-init')) {
42 parent.removeClass('redux-field-init');
43 } else {
44 return;
45 }
46
47 el.find('.redux-icons-remove').live(
48 'click', function () {
49 redux_change($(this));
50
51 $(this).parent().siblings().find('input[type="text"]').val('');
52 $(this).parent().siblings().find('textarea').val('');
53 $(this).parent().siblings().find('input[type="hidden"]').val('');
54
55 var slideCount = $(this).parents('.redux-container-icons:first').find('.redux-icons-accordion-group').length;
56
57 if (slideCount > 1) {
58 $(this).parents('.redux-icons-accordion-group:first').slideUp(
59 'medium', function () {
60 $(this).remove();
61 }
62 );
63 } else {
64 var content_new_title = $(this).parent('.redux-icons-accordion').data('new-content-title');
65
66 $(this).parents('.redux-icons-accordion-group:first').find('.remove-image').click();
67 $(this).parents('.redux-container-icons:first').find('.redux-icons-accordion-group:last').find('.redux-icons-header').text(content_new_title);
68 }
69 }
70 );
71
72 //el.find( '.redux-icons-add' ).click(
73 el.find('.redux-icons-add').off('click').click(
74 function () {
75 var newSlide = $(this).prev().find('.redux-icons-accordion-group:last').clone(true);
76
77 var slideCount = $(newSlide).find('.slide-title').attr("name").match(/[0-9]+(?!.*[0-9])/);
78 var slideCount1 = slideCount * 1 + 1;
79
80 $(newSlide).find('input[type="text"], input[type="hidden"], textarea, .redux-icons-add-icon').each(
81 function () {
82
83 $(this).attr(
84 "name", jQuery(this).attr("name").replace(/[0-9]+(?!.*[0-9])/, slideCount1)
85 ).attr("id", $(this).attr("id").replace(/[0-9]+(?!.*[0-9])/, slideCount1));
86 $(this).val('');
87 if ($(this).hasClass('slide-sort')) {
88 $(this).val(slideCount1);
89 }
90 }
91 );
92
93 var content_new_title = $(this).prev().data('new-content-title');
94
95 $(newSlide).find('.screenshot').removeAttr('style');
96 $(newSlide).find('.screenshot').addClass('hide');
97 $(newSlide).find('.screenshot a').attr('href', '');
98 $(newSlide).find('.remove-image').addClass('hide');
99 $(newSlide).find('.redux-option-image').attr('src', '').removeAttr('id');
100 $(newSlide).find('h3').text('').append('<span class="redux-icons-header">' + content_new_title + '</span>');
101 $(this).prev().append(newSlide);
102 }
103 );
104
105 el.find('.slide-title').keyup(
106 function (event) {
107 var newTitle = event.target.value;
108 $(this).parents().eq(3).find('.redux-icons-header').text(newTitle);
109 }
110 );
111
112 }
113 );
114 };
115 })(jQuery);