Skip to content

Commit fd0f149

Browse files
committed
Deploying version 0.7.1
1 parent 7d3ab52 commit fd0f149

File tree

14 files changed

+656
-582
lines changed

14 files changed

+656
-582
lines changed

asset/css/styles.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

asset/js/common.js

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
// global vars
2-
var hooks = [];
3-
var call_stack = [];
4-
var non_fatal_errors = '';
5-
var migration_error = false;
6-
var connection_data;
7-
var next_step_in_migration;
2+
var wpmdb = wpmdb || {};
3+
wpmdb.common = {
4+
hooks: [],
5+
call_stack: [],
6+
non_fatal_errors: '',
7+
migration_error: false
8+
};
9+
wpmdb.functions = {};
810

911
/**
1012
* Toggle proper translated strings based on migration type selected.
@@ -32,25 +34,25 @@ function wpmdb_migration_type() {
3234
}
3335

3436
function wpmdb_call_next_hook() {
35-
if ( !call_stack.length ) {
36-
call_stack = hooks;
37+
if ( !wpmdb.common.call_stack.length ) {
38+
wpmdb.common.call_stack = wpmdb.common.hooks;
3739
}
3840

39-
var func = call_stack[0];
40-
call_stack.shift();
41-
window[func](); // Uses the string from the array to call the function of the same name
41+
var func = wpmdb.common.call_stack[ 0 ];
42+
wpmdb.common.call_stack.shift();
43+
func.call( this );
4244
}
4345

4446
function wpmdb_add_commas( number_string ) {
4547
number_string += '';
46-
var x = number_string.split( '.' );
47-
var x1 = x[0];
48-
var x2 = x.length > 1 ? '.' + x[1] : '';
48+
var number_parts = number_string.split( '.' );
49+
var integer = number_parts[ 0 ];
50+
var decimal = 1 < number_parts.length ? '.' + number_parts[ 1 ] : '';
4951
var rgx = /(\d+)(\d{3})/;
50-
while ( rgx.test( x1 ) ) {
51-
x1 = x1.replace( rgx, '$1' + ',' + '$2' );
52+
while ( rgx.test( integer ) ) {
53+
integer = integer.replace( rgx, '$1' + ',' + '$2' );
5254
}
53-
return x1 + x2;
55+
return integer + decimal;
5456
}
5557

5658
function wpmdb_parse_json( maybe_json ) {
@@ -59,7 +61,8 @@ function wpmdb_parse_json( maybe_json ) {
5961
json_object = jQuery.parseJSON( maybe_json );
6062
}
6163
catch ( e ) {
62-
// we simply return false here because the json data itself will never just contain a value of "false"
64+
65+
// We simply return false here because the json data itself will never just contain a value of "false"
6366
return false;
6467
}
6568
return json_object;
@@ -91,12 +94,12 @@ function wpmdbGetAjaxErrors( title, code, text, jqXHR ) {
9194
}
9295

9396
// Only add local connection issue if php errors (#144) or jqXHR has been provided
94-
if ( jsonErrors || jqXHR !== undefined ) {
97+
if ( jsonErrors || 'undefined' !== jqXHR ) {
9598
html += '<strong>' + title + '</strong>' + ' &mdash; ';
9699
}
97100

98101
// Only add extra error details if not php errors (#144) and jqXHR has been provided
99-
if ( !jsonErrors && jqXHR !== undefined ) {
102+
if ( !jsonErrors && 'undefined' !== jqXHR ) {
100103
html += wpmdb_strings.status + ': ' + jqXHR.status + ' ' + jqXHR.statusText;
101104
html += '<br /><br />' + wpmdb_strings.response + ':<br />';
102105
}
@@ -113,5 +116,7 @@ function wpmdbGetAjaxErrors( title, code, text, jqXHR ) {
113116
}
114117

115118
(function( $ ) {
119+
116120
// jQuery code here
121+
117122
})( jQuery );

asset/js/common.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

asset/js/hook.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
remove_hook: function( hook_type, action, tag ) {
5353
if ( undefined !== jQuery.wpmdb.hooks[hook_type][action] ) {
5454
var hooks = jQuery.wpmdb.hooks[hook_type][action];
55-
for ( var i = hooks.length - 1; i >= 0; i-- ) {
55+
for ( var i = hooks.length - 1; 0 < i; i-- ) {
5656
if ( undefined === tag || tag === hooks[i].tag ) {
5757
hooks.splice( i, 1 );
5858
}
@@ -61,4 +61,4 @@
6161
}
6262
};
6363

64-
})( jQuery );
64+
})( jQuery );

asset/js/hook.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)