Ox.PATH: remove onload dependency on Ox.slice
This commit is contained in:
parent
137124a903
commit
3619316f78
1 changed files with 10 additions and 5 deletions
|
@ -88,11 +88,16 @@ Ox.SHORT_MONTHS = Ox.MONTHS.map(function(val) {
|
|||
return val.slice(0, 3);
|
||||
});
|
||||
//@ Ox.PATH <str> Path of Ox.js
|
||||
Ox.PATH = Ox.toArray(
|
||||
document.getElementsByTagName('script')
|
||||
).reverse().filter(function(element) {
|
||||
return /Ox\.js(\?\d+|)$/.test(element.src);
|
||||
})[0].src.replace(/Ox\.js(\?\d+|)$/, '');
|
||||
Ox.PATH = (function() {
|
||||
// IE8 can't apply slice to NodeLists, see Ox.slice
|
||||
var index, scripts = document.getElementsByTagName('script');
|
||||
for (index = scripts.length; index >= 0; index--) {
|
||||
var src = element.src;
|
||||
if (/Ox\.js(\?\d+|)$/.test(src)) {
|
||||
return src.replace(/Ox\.js(\?\d+|)$/, '');
|
||||
}
|
||||
}
|
||||
}());
|
||||
//@ Ox.PREFIXES <[str]> `['', 'K', 'M', 'G', 'T', 'P']`
|
||||
Ox.PREFIXES = ['', 'K', 'M', 'G', 'T', 'P'];
|
||||
//@ Ox.SEASONS <[s]> Names of the seasons of the year
|
||||
|
|
Loading…
Reference in a new issue