From 301671c874e5941ea0058a4a270c060b15047623 Mon Sep 17 00:00:00 2001 From: Ramya krishna Date: Mon, 5 Aug 2024 13:06:27 +0530 Subject: [PATCH] adding content --- includes/Migration.php | 6 ++++++ includes/import-tools-changes.js | 20 +++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/includes/Migration.php b/includes/Migration.php index bf2f0d5..9d0802f 100644 --- a/includes/Migration.php +++ b/includes/Migration.php @@ -149,5 +149,11 @@ public function wordpress_migration_tool() { public function set_import_tools() { \wp_enqueue_script( 'nfd_migration_tool', NFD_MIGRATION_PLUGIN_URL . 'vendor/newfold-labs/wp-module-migration/includes/import-tools-changes.js', array( 'jquery' ), '1.0', true ); wp_enqueue_style( 'nfd_migration_tool', NFD_MIGRATION_PLUGIN_URL . 'vendor/newfold-labs/wp-module-migration/includes/styles.css', array(), '1.0', 'all' ); + $migration_data = array( + 'migration_title' => __( 'Let\'s migrate your existing site.', 'wp-module-migration' ), + 'migration_description' => __( 'Please wait a few seconds while we get your new account ready to import your existing WordPress site.', 'wp-module-migration' ), + 'wordpress_title' => __( 'WordPress Content', 'wp-module-migration' ) + ); + wp_localize_script( 'nfd_migration_tool', 'migration', $migration_data ); } } diff --git a/includes/import-tools-changes.js b/includes/import-tools-changes.js index 6687473..df68da8 100644 --- a/includes/import-tools-changes.js +++ b/includes/import-tools-changes.js @@ -1,18 +1,19 @@ -const importer_titles = document.getElementsByClassName("importer-title"); +//Changes the text of the wordpress to wordpress content in import + const importer_titles = document.getElementsByClassName("importer-title"); if( importer_titles ){ [...importer_titles].forEach((val, index) => { if( val?.outerText === 'WordPress'){ - document.getElementsByClassName("importer-title")[index].innerText = 'WordPress Content' - val?.outerText === 'WordPress Content' + document.getElementsByClassName("importer-title")[index].innerText = migration.wordpress_title } }) } + // designs a modal for migration tool const node = document.createElement("div"); -node.innerHTML = "
\ -

Let's migrate your existing site.

\ -Please wait a few seconds while we get your new account ready to import your existing WordPress site. \ -
"; +node.innerHTML = `
+

${migration.migration_title}

+${migration.migration_description} +
`; node.style.position = "absolute"; node.style.top = "0"; @@ -23,16 +24,13 @@ node.style.backgroundColor = "#ffffff5e"; node.style.display = "none"; node.style.alignItems = "center"; node.style.justifyContent = "center"; - node.setAttribute("id", "migration-progress-modal") -// document.getElementById("myList").appendChild(node); document.getElementById("wpbody-content").appendChild(node) - // Bind to the click event of the Run Importer link +// load a pop up when user clicks on run importer for wordpress migration tool document.querySelector('a[href*="import=site_migration_wordpress_importer"]').addEventListener('click', function(e) { e.preventDefault(); document.getElementById("migration-progress-modal").style.display = "flex"; - // debugger; window.location.href = this.getAttribute('href'); });