PluginProbe
Float menu – awesome floating side menu / 3.5.3.
Float menu – awesome floating side menu v3.5.3.
7.2.5 trunk 2.1 2.2 3.0.1 3.1 3.2.2 3.3.1 3.5 3.5.1 3.5.2 3.5.3. 3.5.4 4.0 4.1 4.1.1 4.2 4.3 4.3.1 4.3.2 5.0 5.0.1 5.0.2 5.0.3 5.1 All 57 releases
float-menu / assets / js / admin-script.js

admin-script.js in Float menu – awesome floating side menu 3.5.3., at assets/js/admin-script.js

390 lines 11.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! ========= INFORMATION ============================
2 - author: Wow-Company
3 - url: https://wow-estore.com/item/float-menu-pro/
4 ==================================================== */
5
6 'use strict';
7
8 jQuery(document).ready(function($) {
9
10 $('#wow-plugin').on('submit', function(event) {
11 event.preventDefault();
12 let dataform = $(this).serialize();
13 let prefix = $('#prefix').val();
14 let data = 'action=' + prefix + '_item_save&' + dataform;
15 $('.wow-plugin .saving').animate({opacity: '0.75'});
16
17 $.post(ajaxurl, data, function(response) {
18 if (response.status == 'OK') {
19 $('#wow-message').addClass('notice notice-success is-dismissible');
20 $('#wow-message').html('<p>' + response.message + '</p>');
21 $('#add_action').val(2);
22 let tool_id = $('#tool_id').val();
23 $('.nav-tab.nav-tab-active').text('Update #' + tool_id);
24 } else {
25 $('#wow-message').addClass('notice notice-error is-dismissible');
26 $('#wow-message').html('<p>' + response.message + '</p>');
27 }
28
29
30 $('.wow-plugin .saving').animate({opacity: '0'});
31 });
32
33 });
34
35 $('.wow-plugin .tab-nav li:first').addClass('select');
36 $('.wow-plugin .tab-panels>div').hide().filter(':first').show();
37 $('.wow-plugin .tab-nav a').click(function() {
38 $('.wow-plugin .tab-panels>div').hide().filter(this.hash).show();
39 $('.wow-plugin .tab-nav li').removeClass('select');
40 $(this).parent().addClass('select');
41 return (false);
42 });
43
44 $('.wow-plugin input:checkbox:checked').each(function() {
45 $(this).siblings('input[type="hidden"]').val('1');
46 });
47
48 $('.wow-plugin input:checkbox').change(function() {
49 checkboxchecked(this);
50 },
51 );
52
53 $('.wp-color-picker-field').
54 not('#clone .wp-color-picker-field').
55 wpColorPicker();
56
57 $('.adding-menu-1').sortable();
58
59 $('body').on('click', '.item-del', function() {
60 $(this).closest('.itembox').remove();
61 });
62
63 $('body').on('click', '.toogle', function() {
64 var perent = $(this).closest('.itembox');
65 $(perent).children('.menu_block').toggle();
66 $(this).siblings('.toogle').toggle();
67 $(this).toggle();
68 });
69
70 $('.icons').not('#clone .icons').fontIconPicker({
71 theme: 'fip-darkgrey',
72 emptyIcon: false,
73 allCategoryText: 'Show all',
74 });
75
76 wow_attach_tooltips($('.wow-help').not('#clone .wow-help'));
77
78 $('body').on('hover', '.wow-help', function() {
79 if ($(this).hasClass('dashicons-lock')) {
80 $(this).removeClass('dashicons-lock');
81 $(this).addClass('dashicons-unlock');
82 } else if ($(this).hasClass('dashicons-unlock')) {
83 $(this).removeClass('dashicons-unlock');
84 $(this).addClass('dashicons-lock');
85 }
86 });
87
88 $('input.tooltip-include:checkbox').each(function() {
89 itemtooltip(this);
90 });
91
92 $('select.item-type').each(function() {
93 itemtype(this);
94 });
95
96 $('input#depending_language:checkbox').each(function() {
97 languages(this);
98 });
99
100 $('select#show').each(function() {
101 showchange(this);
102 });
103
104 $('input.item_user:radio:checked').each(function() {
105 usersroles(this);
106 });
107
108 $('input#include_mobile:checkbox').each(function() {
109 screen_less(this);
110 });
111
112 $('input#include_more_screen:checkbox').each(function() {
113 screen_more(this);
114 });
115
116 $('input#mobile_rules:checkbox').each(function() {
117 mobileRules(this);
118 });
119
120 $('.icons').css('display', 'none');
121 $('input.custom-icon:checkbox').each(function() {
122 customicon(this);
123 });
124
125 $('.item-title').children('.faq-title').click(function() {
126 var par = $(this).closest('.items');
127 $(par).children('.inside').toggle(500);
128 if ($(this).hasClass('togglehide')) {
129 $(this).removeClass('togglehide');
130 $(this).addClass('toggleshow');
131 $(this).attr('title', 'Show');
132 } else {
133 $(this).removeClass('toggleshow');
134 $(this).addClass('togglehide');
135 $(this).attr('title', 'Hide');
136 }
137 });
138
139 $('[data-share]').on('click', function(event) {
140 event.preventDefault();
141 let network = $(this).data('share');
142 let url = $('#wp-url').val();
143 let title = $('#wp-title').val();
144
145 let shareUrl;
146
147 switch (network) {
148 case 'facebook':
149 shareUrl = 'https://www.facebook.com/sharer/sharer.php?u=' + url;
150 break;
151 case 'vk':
152 shareUrl = 'http://vk.com/share.php?url=' + url;
153 break;
154 case 'twitter':
155 shareUrl = 'https://twitter.com/share?url=' + url + '&text=' + title;
156 break;
157 case 'linkedin':
158 shareUrl = 'https://www.linkedin.com/shareArticle?url=' + url +
159 '&title=' + title;
160 break;
161 case 'pinterest':
162 shareUrl = 'https://pinterest.com/pin/create/button/?url=' + url;
163 break;
164 case 'xing':
165 shareUrl = 'https://www.xing.com/spi/shares/new?url=' + url;
166 break;
167 case 'reddit':
168 shareUrl = 'http://www.reddit.com/submit?url=' + url + '&title=' +
169 title;
170 break;
171 case 'blogger':
172 shareUrl = 'https://www.blogger.com/blog-this.g?u=' + url + '&n=' +
173 title;
174 break;
175 case 'telegram':
176 shareUrl = 'https://telegram.me/share/url?url=' + url + '&text=' +
177 title;
178 break;
179
180 default:
181 shareUrl = '';
182 }
183
184 let popupWidth = 550;
185 let popupHeight = 450;
186 let topPosition = (screen.height - popupHeight) / 2;
187 let leftPosition = (screen.width - popupWidth) / 2;
188 let popup = 'width=' + popupWidth + ', height=' + popupHeight + ', top=' +
189 topPosition + ', left=' + leftPosition +
190 ', scrollbars=0, resizable=1, menubar=0, toolbar=0, status=0';
191
192 window.open(shareUrl, null, popup);
193
194 });
195
196 });
197
198 function wow_attach_tooltips(selector) {
199 selector.tooltip({
200 content: function() {
201 return jQuery(this).prop('title');
202 },
203 tooltipClass: 'wow-ui-tooltip',
204 position: {
205 my: 'center top',
206 at: 'center bottom+10',
207 collision: 'flipfit',
208 },
209 hide: {
210 duration: 200,
211 },
212 show: {
213 duration: 200,
214 },
215 });
216 }
217
218 function itemadd(menu) {
219 var menu = 'adding-menu-' + menu;
220 var nextelement = jQuery('.' + menu + ' fieldset').length * 1 + 1;
221 jQuery('#' + menu + ' .item').text(nextelement);
222 jQuery('#' + menu).clone().removeAttr('id').appendTo('.' + menu);
223 refreashel();
224 }
225
226 function refreashel() {
227 jQuery('.icons').css('display', 'none');
228 jQuery('.wp-color-picker-field').
229 not('#clone .wp-color-picker-field').
230 wpColorPicker();
231 jQuery('.icons').not('#clone .icons').fontIconPicker({
232 theme: 'fip-darkgrey',
233 emptyIcon: false,
234 allCategoryText: 'Show all',
235 });
236 wow_attach_tooltips(jQuery('.wow-help').not('#clone .wow-help'));
237
238 }
239
240 function itemremove(menu) {
241 var menu = 'adding-menu-' + menu;
242 jQuery('.' + menu + ' fieldset').last().remove();
243 }
244
245 function checkboxchecked(that) {
246 if (jQuery(that).prop('checked')) {
247 jQuery(that).siblings('input[type="hidden"]').val('1');
248 } else {
249 jQuery(that).siblings('input[type="hidden"]').val('0');
250 }
251 }
252
253 //* Change item type
254 function itemtype(that) {
255 var type = jQuery(that).val();
256 var parent = jQuery(that).parents('.container');
257 jQuery(parent).find('.type-link-blank').css('visibility', 'hidden ');
258 jQuery(that).
259 parents('.menu_block').
260 find('.button_id').
261 css('visibility', 'visible');
262 jQuery(that).
263 parents('.menu_block').
264 find('.button_class').
265 css('visibility', 'visible');
266 if (type === 'link' || type === 'smoothscroll' || type === 'email' || type ===
267 'telephone') {
268 jQuery(parent).find('.type-link').css('display', 'block');
269 jQuery(parent).find('.type-share').css('display', 'none');
270 jQuery(parent).find('.type-modal').css('display', 'none');
271 jQuery(parent).find('.type-link-text').text('Link');
272 if (type === 'link') {
273 jQuery(parent).find('.type-link-blank').css('visibility', 'visible');
274 } else if (type === 'email') {
275 jQuery(parent).find('.type-link-text').text('Email');
276 } else if (type === 'telephone') {
277 jQuery(parent).find('.type-link-text').text('Telephone');
278 }
279
280 } else if (type === 'share') {
281 jQuery(parent).find('.type-link').css('display', 'none');
282 jQuery(parent).find('.type-share').css('display', 'block');
283 jQuery(parent).find('.type-modal').css('display', 'none');
284 } else if (type === 'login' || type === 'logout' || type === 'lostpassword') {
285 jQuery(parent).find('.type-link').css('display', 'block');
286 jQuery(parent).find('.type-share').css('display', 'none');
287 jQuery(parent).find('.type-link-text').text('Redirect URL');
288 jQuery(parent).find('.type-modal').css('display', 'none');
289
290 } else if (type == 'id' || type == 'class' || type == 'modal') {
291 jQuery(parent).find('.type-link').css('display', 'none');
292 jQuery(parent).find('.type-share').css('display', 'none');
293 jQuery(parent).find('.type-modal').css('display', 'block');
294 jQuery(that).
295 parents('.menu_block').
296 find('.button_id').
297 css('visibility', 'hidden');
298 jQuery(that).
299 parents('.menu_block').
300 find('.button_class').
301 css('visibility', 'hidden');
302 } else {
303 jQuery(parent).find('.type-link').css('display', 'none');
304 jQuery(parent).find('.type-share').css('display', 'none');
305 jQuery(parent).find('.type-modal').css('display', 'none');
306 }
307 }
308
309 function itemtooltip(that) {
310 if (jQuery(that).is(':checked')) {
311 jQuery(that).siblings('.item-tooltip').css('display', 'block');
312 } else {
313 jQuery(that).siblings('.item-tooltip').css('display', 'none');
314 }
315 }
316
317 function customicon(that) {
318 jQuery('.icons').css('display', 'none');
319 if (jQuery(that).is(':checked')) {
320 jQuery(that).siblings('.custom-icon-url').css('display', 'block');
321 jQuery(that).siblings('.icons-selector').css('display', 'none');
322 } else {
323 jQuery(that).siblings('.custom-icon-url').css('display', 'none');
324 jQuery(that).siblings('.icons-selector').css('display', 'block');
325 }
326 }
327
328 //* Show language
329 function languages(that) {
330 if (jQuery(that).is(':checked')) {
331 jQuery('#language').css('display', '');
332 } else {
333 jQuery('#language').css('display', 'none');
334 }
335 }
336
337 //* When show
338 function showchange(that) {
339 var show = jQuery(that).val();
340 if (show === 'posts' || show === 'pages' || show === 'expost' || show ===
341 'expage' || show === 'taxonomy') {
342 jQuery('#id_post').css('display', '');
343 jQuery('#shortcode').css('display', 'none');
344 } else if (show === 'shortecode') {
345 jQuery('#shortcode').css('display', '');
346 jQuery('#id_post').css('display', 'none');
347 } else {
348 jQuery('#shortcode').css('display', 'none');
349 jQuery('#id_post').css('display', 'none');
350 }
351 if (show === 'taxonomy') {
352 jQuery('#taxonomy').css('display', '');
353 } else {
354 jQuery('#taxonomy').css('display', 'none');
355 }
356 }
357
358 //* Show screen
359 function screen_less(that) {
360 if (jQuery(that).is(':checked')) {
361 jQuery('#screen').css('display', '');
362 } else {
363 jQuery('#screen').css('display', 'none');
364 }
365 }
366
367 function screen_more(that) {
368 if (jQuery(that).is(':checked')) {
369 jQuery('#screenmore').css('display', '');
370 } else {
371 jQuery('#screenmore').css('display', 'none');
372 }
373 }
374
375 function mobileRules(that) {
376 if (jQuery(that).is(':checked')) {
377 jQuery('#mobile_screen_block').css('display', '');
378 } else {
379 jQuery('#mobile_screen_block').css('display', 'none');
380 }
381 }
382
383 function usersroles(that) {
384 var users = jQuery(that).val();
385 if (users == 2) {
386 jQuery('#users_roles').css('display', '');
387 } else {
388 jQuery('#users_roles').css('display', 'none');
389 }
390 }