diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..d38e740
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,51 @@
+module.exports = function(grunt) {
+
+ // Project configuration.
+ grunt.initConfig({
+ pkg: grunt.file.readJSON('package.json'),
+
+ uglify: {
+ batch: {
+ src: 'js/batch.js',
+ dest: 'js/batch.min.js'
+ }
+ },
+
+
+ stylus: {
+ compile: {
+
+ files: {
+ 'css/batch.css':'css/batch.styl'
+ }
+ }
+ },
+
+ csso: {
+ dist: {
+ files: {
+ 'css/batch.css':'css/batch.css'
+ }
+ }
+ }
+
+ });
+
+
+
+ // Load the plugin that provides the "uglify" task.
+ grunt.loadNpmTasks('grunt-contrib-jshint');
+ grunt.loadNpmTasks('grunt-contrib-internal');
+ grunt.loadNpmTasks('grunt-contrib-uglify');
+
+ grunt.loadNpmTasks('grunt-contrib-clean');
+ grunt.loadNpmTasks('grunt-csso');
+ grunt.loadNpmTasks('grunt-contrib-stylus');
+
+ grunt.registerTask('js',['uglify']);
+ grunt.registerTask('css',['stylus','csso']);
+
+ // Default task(s).
+ grunt.registerTask('default', ['css','js']);
+
+};
\ No newline at end of file
diff --git a/batch.php b/batch.php
index 9318fdd..14d080e 100644
--- a/batch.php
+++ b/batch.php
@@ -77,11 +77,12 @@ function batch_operations_add_page() {
* View batch operations page
*/
function batch_operations_page_view() {
+ global $batch_operations_version;
global $wpdb;
//WP>=3.3
wp_enqueue_script( 'jquery' );
- wp_enqueue_script( 'batch_operations_script', plugin_dir_url('') . 'batch_operations/js/batch.min.js' );
- wp_enqueue_style( 'batch_operations_script', plugin_dir_url('') . 'batch_operations/css/batch.css' );
+ wp_enqueue_script( 'batch_operations_script', plugin_dir_url('') . 'batch_operations/js/batch.min.js', array(), $batch_operations_version );
+ wp_enqueue_style( 'batch_operations_script', plugin_dir_url('') . 'batch_operations/css/batch.css', array(), $batch_operations_version );
$id = ( intval( $_REQUEST["id"] ) < 0 )? 0 : intval( $_REQUEST["id"] );
@@ -105,6 +106,7 @@ function batch_operations_page_view() {
+
diff --git a/batch_test.php b/batch_test.php
index 29a89d6..1ba4b14 100644
--- a/batch_test.php
+++ b/batch_test.php
@@ -30,6 +30,14 @@ function batch_operations_test_page_view() {
batch_operations_start($batch);
break;
+ case 4:
+ $batch['operations'][]=array('test_batch_operation',array());
+ $batch['operations'][]=array('test_batch_operation',array());
+ $batch['operations'][]=array('test_batch_operation',array());
+ $batch['operations'][]=array('test_batch_operation',array());
+ $batch['operations'][]=array('test_batch_operation',array());
+ batch_operations_start($batch);
+ break;
default:
break;
}
@@ -42,6 +50,7 @@ function batch_operations_test_page_view() {
$current_array is empty
Default title & init_message
Set custom title & custom init_message
+ 5 operations
span{display:block;height:100%;background-color:#1834ff;background-image:-moz-linear-gradient(#4d80ff,#002ffb);background-image:-webkit-linear-gradient(#4d80ff,#002ffb);background-image:-o-linear-gradient(#4d80ff,#002ffb);background-image:-ms-linear-gradient(#4d80ff,#002ffb);background-image:linear-gradient(#4d80ff,#002ffb);-webkit-border-radius:6px;-moz-border-radius:6px;-o-border-radius:6px;-ms-border-radius:6px;-khtml-border-radius:6px;border-radius:6px;position:relative;overflow:hidden}
\ No newline at end of file
+.batch-progress{height:30px;position:relative;background:#fff;-webkit-border-radius:8px;-moz-border-radius:8px;-o-border-radius:8px;-ms-border-radius:8px;-khtml-border-radius:8px;border-radius:8px;border:1px solid #ccc;margin:10px 0;padding:2px}.batch-progress>span{display:block;height:100%;background-color:#1834ff;background-image:-moz-linear-gradient(#4d80ff,#002ffb);background-image:-webkit-linear-gradient(#4d80ff,#002ffb);background-image:-o-linear-gradient(#4d80ff,#002ffb);background-image:-ms-linear-gradient(#4d80ff,#002ffb);background-image:linear-gradient(#4d80ff,#002ffb);-webkit-border-radius:6px;-moz-border-radius:6px;-o-border-radius:6px;-ms-border-radius:6px;-khtml-border-radius:6px;border-radius:6px;position:relative;overflow:hidden}.batch-percent{float:right}.batch-percent,.batch-progress-message{display:inline-block}.batch-progress-message,.batch-percent,.batch-message{font-size:120%;font-weight:700}
\ No newline at end of file
diff --git a/css/batch.styl b/css/batch.styl
index 27f5c66..53d505f 100644
--- a/css/batch.styl
+++ b/css/batch.styl
@@ -17,3 +17,16 @@
-pos relative
overflow hidden
+.batch-percent
+ -d inline-block
+ -fl right
+
+.batch-progress-message
+ -d inline-block
+
+.batch-progress-message
+.batch-percent
+.batch-message
+ -fs 120%
+ -fw 700
+
diff --git a/js/batch.js b/js/batch.js
index 0a6fdf2..0f09a71 100644
--- a/js/batch.js
+++ b/js/batch.js
@@ -1,5 +1,6 @@
jQuery(document).ready(function($) {
var batch_progress = function (percent){
+ $(".batch-percent").html(percent + "%");
return $(".batch-progress > span").animate({ width: percent + "%" }, 600);
};
diff --git a/js/batch.min.js b/js/batch.min.js
index 5abfcd4..dc83f10 100644
--- a/js/batch.min.js
+++ b/js/batch.min.js
@@ -1 +1 @@
-jQuery(document).ready(function(a){function b(){a.post(ajaxurl+"?action=batch_operations&id="+batch_id,function(d){"finish"==d["do"]?(c(d.percent),a(".batch-message").html(d.message).delay(1500).queue(function(){a(location).attr("href",successful_page),a(this).dequeue()})):(a(".batch-message").html(d.message),c(d.percent),b())})}var c=function(b){return a(".batch-progress > span").animate({width:b+"%"},600)};b()});
\ No newline at end of file
+jQuery(document).ready(function(a){function b(){a.post(ajaxurl+"?action=batch_operations&id="+batch_id,function(d){"finish"==d["do"]?(c(d.percent),a(".batch-message").html(d.message).delay(1500).queue(function(){a(location).attr("href",successful_page),a(this).dequeue()})):(a(".batch-message").html(d.message),c(d.percent),b())})}var c=function(b){return a(".batch-percent").html(b+"%"),a(".batch-progress > span").animate({width:b+"%"},600)};b()});
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..57d31cb
--- /dev/null
+++ b/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "Batch_operations",
+ "version": "0.1.0",
+ "devDependencies": {
+ "grunt": "~0.4.5",
+ "grunt-contrib-internal": "~0.4.5",
+ "grunt-contrib-jshint": "~0.10.0",
+ "grunt-contrib-nodeunit": "~0.4.1",
+ "grunt-contrib-uglify": "~0.5.0",
+ "grunt-contrib-clean": "~0.5.0",
+ "grunt-csso": "~0.5.0",
+ "grunt-contrib-stylus": "~0.10.0"
+ }
+}
\ No newline at end of file