From 3efd24877b766958e0253c15ca07eb380d93c361 Mon Sep 17 00:00:00 2001 From: devansh016 Date: Fri, 19 Jul 2024 13:33:36 +0530 Subject: [PATCH 1/2] Fix get code button working only one time --- js/b2w-redirection-ajax.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/b2w-redirection-ajax.js b/js/b2w-redirection-ajax.js index 41649fc..603bd2d 100644 --- a/js/b2w-redirection-ajax.js +++ b/js/b2w-redirection-ajax.js @@ -40,7 +40,14 @@ function rt_start_config( nonce ){ function generate_code( domain_name, curr_domain, nonce){ jQuery( '#code_here' ).show(); - var response = jQuery( '#code_here' ).html(); + let originalHtml = jQuery('#code_here').data('original-html'); + + if (!originalHtml) { + originalHtml = jQuery('#code_here').html(); + jQuery('#code_here').data('original-html', originalHtml); + } + + let response = originalHtml; response = response.replace( /{{curr_domain}}/g, curr_domain ); response = response.replace( /{{domain_name}}/g, domain_name ); response = response.replace( /{{nonce}}/g, nonce ); From 9efb3a3fb03955e83189758db1214d59b2c11d30 Mon Sep 17 00:00:00 2001 From: devansh016 Date: Wed, 24 Jul 2024 13:03:31 +0530 Subject: [PATCH 2/2] Fix indentation --- js/b2w-redirection-ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/b2w-redirection-ajax.js b/js/b2w-redirection-ajax.js index 603bd2d..ab862b3 100644 --- a/js/b2w-redirection-ajax.js +++ b/js/b2w-redirection-ajax.js @@ -44,7 +44,7 @@ function generate_code( domain_name, curr_domain, nonce){ if (!originalHtml) { originalHtml = jQuery('#code_here').html(); - jQuery('#code_here').data('original-html', originalHtml); + jQuery('#code_here').data('original-html', originalHtml); } let response = originalHtml;