dashboard-review-ask.js
4 years ago
ewd-us-admin.js
3 years ago
ewd-us-blocks.js
3 years ago
ewd-us-helper-install-notice.js
4 years ago
ewd-us-welcome-screen.js
4 years ago
ewd-us.js
4 years ago
jquery.iframetracker.js
4 years ago
plugin-deactivation.js
1 month ago
ultimate-lightbox.js
4 years ago
ewd-us-admin.js
282 lines
| 1 | jQuery(function() { |
| 2 | wireReorderList(); |
| 3 | }); |
| 4 | |
| 5 | function wireReorderList() { |
| 6 | jQuery(".wp-list-table tbody").sortable({ |
| 7 | stop: function( event, ui ) {saveOrderClick(); } |
| 8 | }).disableSelection(); |
| 9 | } |
| 10 | |
| 11 | function saveOrderClick() { |
| 12 | // ----- Retrieve the li items inside our sortable list |
| 13 | var items = jQuery(".wp-list-table tbody tr"); |
| 14 | |
| 15 | var linkIDs = [items.size()]; |
| 16 | var index = 0; |
| 17 | |
| 18 | // ----- Iterate through each li, extracting the ID embedded as an attribute |
| 19 | items.each( |
| 20 | function(intIndex) { |
| 21 | linkIDs[intIndex] = jQuery(this).attr("id").substring(5); |
| 22 | jQuery(this).find('.menu_order').html(intIndex); |
| 23 | index++; |
| 24 | }); |
| 25 | |
| 26 | var params = { |
| 27 | IDs: JSON.stringify( linkIDs ), |
| 28 | nonce: ewd_us_admin_php_data.nonce, |
| 29 | action: 'ewd_us_slides_update_order' |
| 30 | }; |
| 31 | |
| 32 | var data = jQuery.param( params ); |
| 33 | |
| 34 | jQuery.post(ajaxurl, data, function(response) { |
| 35 | |
| 36 | jQuery( 'td.column-us_menu_order' ).each( function( index, el ) { |
| 37 | jQuery( this ).html( index ); |
| 38 | }); |
| 39 | }); |
| 40 | |
| 41 | //$get("<%=txtExampleItemsOrder.ClientID %>").value = linkIDs.join(","); |
| 42 | } |
| 43 | |
| 44 | function ShowOptionTab(TabName) { |
| 45 | jQuery(".ewd-us-option-set").each(function() { |
| 46 | jQuery(this).addClass("ewd-us-hidden"); |
| 47 | }); |
| 48 | jQuery("#"+TabName).removeClass("ewd-us-hidden"); |
| 49 | |
| 50 | jQuery(".options-subnav-tab").each(function() { |
| 51 | jQuery(this).removeClass("options-subnav-tab-active"); |
| 52 | }); |
| 53 | jQuery("#"+TabName+"_Menu").addClass("options-subnav-tab-active"); |
| 54 | jQuery('input[name="Display_Tab"]').val(TabName); |
| 55 | } |
| 56 | |
| 57 | jQuery(document).ready(function(){ |
| 58 | jQuery('.ewd-us-meta-menu-item').on('click', function() { |
| 59 | var ID = jQuery(this).attr('id'); |
| 60 | var ID_Base = ID.substring(5); |
| 61 | |
| 62 | jQuery(".ewd-us-meta-body").each(function() { |
| 63 | jQuery(this).addClass("ewd-us-hidden"); |
| 64 | }); |
| 65 | jQuery('#Body_'+ID_Base).removeClass("ewd-us-hidden"); |
| 66 | |
| 67 | jQuery(".ewd-us-meta-menu-item").each(function() { |
| 68 | jQuery(this).removeClass("meta-menu-tab-active"); |
| 69 | }); |
| 70 | jQuery(this).addClass("meta-menu-tab-active"); |
| 71 | }); |
| 72 | }); |
| 73 | |
| 74 | jQuery(document).ready(function() { |
| 75 | SetButtonDeleteHandlers(); |
| 76 | SetButtonDisableHandlers(); |
| 77 | |
| 78 | jQuery('.ewd-us-add-button-list-item').on('click', function(event) { |
| 79 | var ID = jQuery(this).data('nextid'); |
| 80 | |
| 81 | var HTML = "<tr id='ewd-us-button-list-item-" + ID + "'>"; |
| 82 | HTML += "<td><a class='ewd-us-delete-button-list-item' data-buttonid='" + ID + "'>Delete</a></td>"; |
| 83 | HTML += "<td><input type='text' name='Button_List_" + ID + "_Text'></td>"; |
| 84 | HTML += "<td><select name='Button_List_" + ID + "_Post_ID' class='ewd-us-post-select' id='ewd-us-post-select-" + ID + "'><option value='0'>Custom Link</option></select></td>"; |
| 85 | HTML += "<td><input type='text' name='Button_List_" + ID + "_Custom_Link' id='ewd-us-post-link-" + ID + "'></td>"; |
| 86 | HTML += "</tr>"; |
| 87 | |
| 88 | //jQuery('table > tr#ewd-uasp-add-reminder').before(HTML); |
| 89 | jQuery('#ewd-us-buttons-list-table tr:last').before(HTML); |
| 90 | |
| 91 | AJAXPostIDs("#ewd-us-post-select-" + ID); |
| 92 | |
| 93 | ID++; |
| 94 | jQuery(this).data('nextid', ID); //updates but doesn't show in DOM |
| 95 | |
| 96 | SetButtonDeleteHandlers(); |
| 97 | SetButtonDisableHandlers(); |
| 98 | |
| 99 | event.preventDefault(); |
| 100 | }); |
| 101 | }); |
| 102 | |
| 103 | function SetButtonDeleteHandlers() { |
| 104 | jQuery('.ewd-us-delete-button-list-item').on('click', function(event) { |
| 105 | var ID = jQuery(this).data('buttonid'); |
| 106 | var tr = jQuery('#ewd-us-button-list-item-'+ID); |
| 107 | |
| 108 | tr.fadeOut(400, function(){ |
| 109 | tr.remove(); |
| 110 | }); |
| 111 | |
| 112 | event.preventDefault(); |
| 113 | }); |
| 114 | } |
| 115 | |
| 116 | function SetButtonDisableHandlers() { |
| 117 | jQuery('.ewd-us-post-select').on('change', function() { |
| 118 | var Full_ID = jQuery(this).attr('id'); |
| 119 | var ID = Full_ID.substring(19); |
| 120 | |
| 121 | if (jQuery(this).val() != 0) { |
| 122 | jQuery('#ewd-us-post-link-'+ID).prop('disabled', true); |
| 123 | } |
| 124 | else { |
| 125 | jQuery('#ewd-us-post-link-'+ID).prop('disabled', false); |
| 126 | } |
| 127 | }) |
| 128 | } |
| 129 | |
| 130 | jQuery(document).ready(function() { |
| 131 | jQuery('.ewd-us-image-radio').on('change', function() { |
| 132 | if (jQuery(this).val() == "youtube_video") {jQuery('#ewd-us-youtube-url').prop('disabled', false);} |
| 133 | else {jQuery('#ewd-us-youtube-url').prop('disabled', true);} |
| 134 | }); |
| 135 | }); |
| 136 | |
| 137 | function AJAXPostIDs(selectID) { |
| 138 | |
| 139 | var params = { |
| 140 | nonce: ewd_us_admin_php_data.nonce, |
| 141 | action: 'ewd_us_get_post_ids' |
| 142 | }; |
| 143 | |
| 144 | var data = jQuery.param( params ); |
| 145 | |
| 146 | jQuery.post(ajaxurl, data, function(response) { |
| 147 | response = response.substring(0, response.length - 1); |
| 148 | var posts_array = jQuery.parseJSON(response); |
| 149 | jQuery(posts_array).each(function(index, post) { |
| 150 | //console.log('post', post); |
| 151 | jQuery(selectID).append("<option value='"+post.ID+"'>"+post.Name+"</option>"); |
| 152 | }); |
| 153 | }); |
| 154 | } |
| 155 | |
| 156 | jQuery(document).ready(function() { |
| 157 | jQuery('.ewd-us-widget-slider-type').each(function() { |
| 158 | var id = jQuery(this).attr('id'); |
| 159 | var widget_id = id.slice(0,-11); |
| 160 | var slider_type = jQuery(this).val(); |
| 161 | |
| 162 | EWD_US_Fill_Widget_Categories_Select(widget_id, slider_type); |
| 163 | }); |
| 164 | |
| 165 | jQuery('.ewd-us-widget-slider-type').on('change', function() { |
| 166 | var id = jQuery(this).attr('id'); |
| 167 | var widget_id = id.slice(0,-11); |
| 168 | var slider_type = jQuery(this).val(); |
| 169 | alert("Type: " + slider_type); alert("Widget ID: " + widget_id); |
| 170 | EWD_US_Fill_Widget_Categories_Select(widget_id, slider_type); |
| 171 | }); |
| 172 | }); |
| 173 | |
| 174 | function EWD_US_Fill_Widget_Categories_Select(widget_id, slider_type) { |
| 175 | jQuery('#'+widget_id+'category').find('option').remove().end(); |
| 176 | |
| 177 | jQuery('#'+widget_id+'category').append('<option value="">All</option>'); |
| 178 | |
| 179 | if (slider_type == 'woocommerce') { |
| 180 | if (typeof woocommerce_categories !== 'undefined' && woocommerce_categories !== null) { |
| 181 | jQuery(woocommerce_categories).each(function(index, el) { |
| 182 | jQuery('#'+widget_id+'category').append('<option value="'+el.Category_Slug+'">'+el.Category_Name+'</option>'); |
| 183 | }); |
| 184 | } |
| 185 | } |
| 186 | else if (slider_type == 'upcp') { |
| 187 | if (typeof upcp_categories !== 'undefined' && upcp_categories !== null) { |
| 188 | jQuery(upcp_categories).each(function(index, el) { |
| 189 | jQuery('#'+widget_id+'category').append('<option value="'+el.Category_Slug+'">'+el.Category_Name+'</option>'); |
| 190 | }); |
| 191 | } |
| 192 | } |
| 193 | else { |
| 194 | if (typeof slider_categories !== 'undefined' && slider_categories !== null) { |
| 195 | jQuery(slider_categories).each(function(index, el) { |
| 196 | console.log(el); |
| 197 | jQuery('#'+widget_id+'category').append('<option value="'+el.Category_Slug+'">'+el.Category_Name+'</option>'); |
| 198 | }); |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | |
| 204 | /*NEW DASHBOARD MOBILE MENU AND WIDGET TOGGLING*/ |
| 205 | jQuery(document).ready(function($){ |
| 206 | $('#ewd-us-dash-mobile-menu-open').click(function(){ |
| 207 | $('.ewd-us-admin-header-menu .nav-tab:nth-of-type(1n+2)').toggle(); |
| 208 | $('#ewd-us-dash-mobile-menu-up-caret').toggle(); |
| 209 | $('#ewd-us-dash-mobile-menu-down-caret').toggle(); |
| 210 | return false; |
| 211 | }); |
| 212 | |
| 213 | $(function(){ |
| 214 | $(window).resize(function(){ |
| 215 | if($(window).width() > 800){ |
| 216 | $('.ewd-us-admin-header-menu .nav-tab:nth-of-type(1n+2)').show(); |
| 217 | } |
| 218 | else{ |
| 219 | $('.ewd-us-admin-header-menu .nav-tab:nth-of-type(1n+2)').hide(); |
| 220 | $('#ewd-us-dash-mobile-menu-up-caret').hide(); |
| 221 | $('#ewd-us-dash-mobile-menu-down-caret').show(); |
| 222 | } |
| 223 | }).resize(); |
| 224 | }); |
| 225 | |
| 226 | $('#ewd-us-dashboard-support-widget-box .ewd-us-dashboard-new-widget-box-top').click(function(){ |
| 227 | $('#ewd-us-dashboard-support-widget-box .ewd-us-dashboard-new-widget-box-bottom').toggle(); |
| 228 | $('#ewd-us-dash-mobile-support-up-caret').toggle(); |
| 229 | $('#ewd-us-dash-mobile-support-down-caret').toggle(); |
| 230 | }); |
| 231 | |
| 232 | $('#ewd-us-dashboard-optional-table .ewd-us-dashboard-new-widget-box-top').click(function(){ |
| 233 | $('#ewd-us-dashboard-optional-table .ewd-us-dashboard-new-widget-box-bottom').toggle(); |
| 234 | $('#ewd-us-dash-optional-table-up-caret').toggle(); |
| 235 | $('#ewd-us-dash-optional-table-down-caret').toggle(); |
| 236 | }); |
| 237 | |
| 238 | }); |
| 239 | |
| 240 | // About Us Page |
| 241 | jQuery( document ).ready( function( $ ) { |
| 242 | |
| 243 | jQuery( '.ewd-us-about-us-tab-menu-item' ).on( 'click', function() { |
| 244 | |
| 245 | jQuery( '.ewd-us-about-us-tab-menu-item' ).removeClass( 'ewd-us-tab-selected' ); |
| 246 | jQuery( '.ewd-us-about-us-tab' ).addClass( 'ewd-us-hidden' ); |
| 247 | |
| 248 | var tab = jQuery( this ).data( 'tab' ); |
| 249 | |
| 250 | jQuery( this ).addClass( 'ewd-us-tab-selected' ); |
| 251 | jQuery( '.ewd-us-about-us-tab[data-tab="' + tab + '"]' ).removeClass( 'ewd-us-hidden' ); |
| 252 | } ); |
| 253 | |
| 254 | jQuery( '.ewd-us-about-us-send-feature-suggestion' ).on( 'click', function() { |
| 255 | |
| 256 | var feature_suggestion = jQuery( '.ewd-us-about-us-feature-suggestion textarea' ).val(); |
| 257 | var email_address = jQuery( '.ewd-us-about-us-feature-suggestion input[name="feature_suggestion_email_address"]' ).val(); |
| 258 | |
| 259 | var params = {}; |
| 260 | |
| 261 | params.nonce = ewd_us_admin_php_data.nonce; |
| 262 | params.action = 'ewd_us_send_feature_suggestion'; |
| 263 | params.feature_suggestion = feature_suggestion; |
| 264 | params.email_address = email_address; |
| 265 | |
| 266 | var data = jQuery.param( params ); |
| 267 | jQuery.post( ajaxurl, data, function() {} ); |
| 268 | |
| 269 | jQuery( '.ewd-us-about-us-feature-suggestion' ).prepend( '<p>Thank you, your feature suggestion has been submitted.' ); |
| 270 | } ); |
| 271 | } ); |
| 272 | |
| 273 | |
| 274 | //SETTINGS PREVIEW SCREENS |
| 275 | |
| 276 | jQuery( document ).ready( function() { |
| 277 | |
| 278 | jQuery( '.ewd-us-settings-preview' ).prevAll( 'h2' ).hide(); |
| 279 | jQuery( '.ewd-us-settings-preview' ).prevAll( '.sap-tutorial-toggle' ).hide(); |
| 280 | jQuery( '.ewd-us-settings-preview .sap-tutorial-toggle' ).hide(); |
| 281 | }); |
| 282 |