PluginProbe
Float menu – awesome floating side menu / 3.3.1
Float menu – awesome floating side menu v3.3.1
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.3.1, at assets/js/admin-script.js

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