13 lines
243 B
Plaintext
13 lines
243 B
Plaintext
|
// Convert '-10px' to -10
|
||
|
function px_to_int(pixels) {
|
||
|
if (typeof pixels != 'string') {
|
||
|
return 0;
|
||
|
}
|
||
|
var result = pixels.replace(/[^-0-9]/g, '');
|
||
|
if (result.length == 0) {
|
||
|
return 0;
|
||
|
} else {
|
||
|
return parseInt(result);
|
||
|
}
|
||
|
}
|