-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More verbose messaging during the updates process.
- Loading branch information
1 parent
c6893a9
commit 62c1678
Showing
7 changed files
with
312 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
( function( $ ) { | ||
|
||
/** | ||
* Call backend to check the job status and display its status to the user. | ||
* | ||
* @param string jobType | ||
*/ | ||
showDiffyStatus = function(jobType) { | ||
var showDiffyStatusInterval = setInterval(function() { | ||
|
||
var data = { | ||
'action': jobType | ||
}; | ||
$.post(settings.ajaxurl, data, function (response) { | ||
var data = response.data; | ||
|
||
if (response.success) { | ||
if (response.data.status == 'completed') { | ||
clearInterval(showDiffyStatusInterval); | ||
} | ||
$('.diffy-message').html(response.data.message); | ||
} else { | ||
|
||
} | ||
}) | ||
.fail(function () { | ||
console.log("Diffy ajax error"); | ||
}); | ||
}, 5000); | ||
}; | ||
|
||
// Triggered right before ajax request is sent to update plugin. | ||
$( document ).on('wp-plugin-updating', function(){ | ||
$('.update-message').after('<div class="notice inline notice-alt notice-info"><p class="diffy-message">Diffy creates first set of screenshots (before update).</p></div>'); | ||
|
||
showDiffyStatus('diffy_first_screenshots'); | ||
}); | ||
|
||
// Triggered after plugin was successfully updated. | ||
$( document ).on('wp-plugin-update-success', function(){ | ||
$('.diffy-message').html('Updates completed. Now Diffy creates second set of screenshots and comparison.'); | ||
|
||
showDiffyStatus('diffy_second_screenshots'); | ||
}); | ||
|
||
|
||
|
||
})( jQuery ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.