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 14 if ( wps_custom.pricing_type == 'wps_wgm_variable_price' ) { 15 var price = $( '#wps_wgm_price option:selected' ).val(); 16 var currency = wps_custom.currency; 17 $( '.wps-cgw-pro-price' ).html( currency + price); 18 } 19 20 // Append Image Src to the Preview. 21 $( '.wps_cgw_choose_img' ).click( 22 function(){ 23 var img_src = $( this ).prop( 'src' ); 24 $( '.wps_cgw_preview_image' ).attr( 'src', img_src ); 25 var selected_img = $( this ).data( 'img' ); 26 $( '#selected_image' ).val( selected_img ); 27 $( "#uploaded_image_value" ).val( selected_img ); 28 $.ajax( 29 { 30 method: "POST", 31 url: wps_custom.ajaxurl, 32 data: { 33 'action': 'wps_cgc_admin_uploads_name', 34 'image_name': img_src, 35 'wps_nonce' : wps_custom.wps_nonce 36 }, 37 success: function(response) { 38 } 39 } 40 ); 41 } 42 ); 43 44 // Append Price Value to the Email Template's Price. 45 $( document ).on( 46 'change', 47 '.wps_wgm_price', 48 function(){ 49 var price = $( '.wps_wgm_price' ).val(); 50 var decimal_price = price; 51 var currency = wps_custom.currency; 52 $( '.wps-cgw-pro-price' ).html( currency + decimal_price ); 53 } 54 ); 55 56 // Append Gift Mesage to the Email Template's Preview. 57 $( document ).on( 58 'change', 59 '#wps_wgm_message', 60 function(){ 61 var message = $( '#wps_wgm_message' ).val(); 62 $( '.wps-cgw-gift-content' ).html( message ); 63 } 64 ); 65 66 // Append From Name to the Email Template's Preview. 67 $( '#wps_wgm_from_name' ).change( 68 function(){ 69 var from = $( '#wps_wgm_from_name' ).val(); 70 $( '.wps_wgm_from_name' ).html( from ); 71 } 72 ); 73 74 // Append the value of select price to one input hidden field. 75 $( '.wps_cgc_price_button' ).click( 76 function(){ 77 $( '.wps_wgm_price_select' ).val( $( this ).val() ); 78 var price = $( this ).val(); 79 var decimal_price = price; 80 var currency = wps_custom.currency; 81 $( '.wps-cgw-pro-price' ).html( currency + decimal_price ); 82 83 // add active class to curreent button and remove same class from other siblings. 84 $( this ).siblings( 'input' ).removeClass( 'active' ).end().addClass( 'active' ); 85 86 } 87 ); 88 89 // Append uploaded image to the Required DIV. 90 $( '#wps_cgw_upload_img' ).change( 91 function(){ 92 $( "#wps_wgm_loader" ).show(); 93 var formData = new FormData(); 94 formData.append( 'file', $( 'input[type=file]' )[0].files[0] ); 95 formData.append( 'action', 'wps_cgc_upload_own_img' ); 96 formData.append( 'wps_nonce', wps_custom.wps_nonce ); 97 var img_name = $( 'input[type=file]' )[0].files[0]['name']; 98 var img_path = $( '#upload_path' ).val(); 99 $.ajax( 100 { 101 url: wps_custom.ajaxurl, 102 type: "POST", 103 data: formData, 104 processData: false, 105 contentType: false, 106 dataType: 'json', 107 success: function(response) { 108 $( "#wps_wgm_loader" ).hide(); 109 if (response.result == true) { 110 $( '.wps_cgw_preview_image' ).attr( 'src', img_path + '/cgw_own_img/' + img_name ); 111 } 112 } 113 } 114 ); 115 } 116 ); 117 } 118 ); 119 120})( 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.