1/** 2 * All of the code for notices on your admin-facing JavaScript source 3 * should reside in this file. 4 * 5 * @package Ultimate Woocommerce Gift Cards 6 */ 7 8(function( $ ) { 9 'use strict'; 10 11 $( document ).ready( 12 function(){ 13 // Append Image Src to the Preview. 14 $( '.wps_cgw_choose_img' ).click( 15 function(){ 16 var img_src = $( this ).prop( 'src' ); 17 $( '.wps_cgw_preview_image' ).attr( 'src', img_src ); 18 var selected_img = $( this ).data( 'img' ); 19 $( '#selected_image' ).val( selected_img ); 20 $( "#uploaded_image_value" ).val( selected_img ); 21 $.ajax( 22 { 23 method: "POST", 24 url: wps_custom.ajaxurl, 25 data: { 26 'action': 'wps_cgc_admin_uploads_name', 27 'image_name': img_src, 28 'wps_nonce' : wps_custom.wps_nonce 29 }, 30 success: function(response) { 31 } 32 } 33 ); 34 } 35 ); 36 37 // Append Price Value to the Email Template's Price. 38 $( document ).on( 39 'change', 40 '.wps_wgm_price', 41 function(){ 42 var price = $( '.wps_wgm_price' ).val(); 43 var decimal_price = price; 44 var currency = wps_custom.currency; 45 $( '.wps-cgw-pro-price' ).html( currency + decimal_price ); 46 } 47 ); 48 49 // Append Gift Mesage to the Email Template's Preview. 50 $( document ).on( 51 'change', 52 '#wps_wgm_message', 53 function(){ 54 var message = $( '#wps_wgm_message' ).val(); 55 $( '.wps-cgw-gift-content' ).html( message ); 56 } 57 ); 58 59 // Append From Name to the Email Template's Preview. 60 $( '#wps_wgm_from_name' ).change( 61 function(){ 62 var from = $( '#wps_wgm_from_name' ).val(); 63 $( '.wps_wgm_from_name' ).html( from ); 64 } 65 ); 66 67 // Append the value of select price to one input hidden field. 68 $( '.wps_cgc_price_button' ).click( 69 function(){ 70 $( '.wps_wgm_price_select' ).val( $( this ).val() ); 71 var price = $( this ).val(); 72 var decimal_price = price; 73 var currency = wps_custom.currency; 74 $( '.wps-cgw-pro-price' ).html( currency + decimal_price ); 75 76 // add active class to curreent button and remove same class from other siblings. 77 $( this ).siblings( 'input' ).removeClass( 'active' ).end().addClass( 'active' ); 78 79 } 80 ); 81 82 // Append uploaded image to the Required DIV. 83 $( '#wps_cgw_upload_img' ).change( 84 function(){ 85 $( "#wps_wgm_loader" ).show(); 86 var formData = new FormData(); 87 formData.append( 'file', $( 'input[type=file]' )[0].files[0] ); 88 formData.append( 'action', 'wps_cgc_upload_own_img' ); 89 formData.append( 'wps_nonce', wps_custom.wps_nonce ); 90 var img_name = $( 'input[type=file]' )[0].files[0]['name']; 91 var img_path = $( '#upload_path' ).val(); 92 $.ajax( 93 { 94 url: wps_custom.ajaxurl, 95 type: "POST", 96 data: formData, 97 processData: false, 98 contentType: false, 99 dataType: 'json', 100 success: function(response) { 101 $( "#wps_wgm_loader" ).hide(); 102 if (response.result == true) { 103 $( '.wps_cgw_preview_image' ).attr( 'src', img_path + '/cgw_own_img/' + img_name ); 104 } 105 } 106 } 107 ); 108 } 109 ); 110 } 111 ); 112 113})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.