Skip to content

Commit

Permalink
adding content
Browse files Browse the repository at this point in the history
  • Loading branch information
ramyakrishnai committed Aug 5, 2024
1 parent 0533f16 commit 301671c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
6 changes: 6 additions & 0 deletions includes/Migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
20 changes: 9 additions & 11 deletions includes/import-tools-changes.js
Original file line number Diff line number Diff line change
@@ -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 = "<div class='migrate-screen'> \
<div class='nfd-migration-loading'><span class='nfd-migration-loader'></span><h2 class='nfd-migration-title'> Let's migrate your existing site.</h2></div> \
Please wait a few seconds while we get your new account ready to import your existing WordPress site. \
</div>";
node.innerHTML = `<div class='migrate-screen'>
<div class='nfd-migration-loading'><span class='nfd-migration-loader'></span><h2 class='nfd-migration-title'>${migration.migration_title}</h2></div>
${migration.migration_description}
</div>`;

node.style.position = "absolute";
node.style.top = "0";
Expand All @@ -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');
});

0 comments on commit 301671c

Please sign in to comment.