clean up Ox.PATH

This commit is contained in:
rolux 2013-12-04 17:21:27 +01:00
parent 10a5481d47
commit 4d5291c340

View file

@ -90,11 +90,12 @@ Ox.SHORT_MONTHS = Ox.MONTHS.map(function(val) {
//@ Ox.PATH <str> Path of Ox.js
Ox.PATH = (function() {
// IE8 can't apply slice to NodeLists, see Ox.slice
var index, scripts = document.getElementsByTagName('script');
var index, regexp = /Ox\.js(\?\d+|)$/,
scripts = document.getElementsByTagName('script'), src;
for (index = scripts.length - 1; index >= 0; index--) {
var src = scripts[index].src;
if (/Ox\.js(\?\d+|)$/.test(src)) {
return src.replace(/Ox\.js(\?\d+|)$/, '');
src = scripts[index].src;
if (regexp.test(src)) {
return src.replace(regexp, '');
}
}
}());