corrected fix for #751

This commit is contained in:
guybedford 2015-09-06 13:30:46 +02:00
parent b1fc92bbfa
commit 91b7bc01cb

View File

@ -38,7 +38,7 @@
}
if (typeof window != 'undefined' && typeof document != 'undefined' && window.location)
var windowOrigin = location.protocol + '//' + (location.protocol == 'file:' && location.hostname[0] != '/' ? '/' : '') + location.hostname + (location.port ? ':' + location.port : '');
var windowOrigin = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '');
hookConstructor(function(constructor) {
return function() {
@ -91,11 +91,7 @@
dirname.pop();
dirname = dirname.join('/');
if (windowOrigin && address.substr(0, windowOrigin.length) === windowOrigin) {
address = address.substr(windowOrigin.length);
dirname = dirname.substr(windowOrigin.length);
}
else if (address.substr(0, 8) == 'file:///') {
if (address.substr(0, 8) == 'file:///') {
address = address.substr(7);
dirname = dirname.substr(7);
@ -105,6 +101,10 @@
dirname = dirname.substr(1);
}
}
else if (windowOrigin && address.substr(0, windowOrigin.length) === windowOrigin) {
address = address.substr(windowOrigin.length);
dirname = dirname.substr(windowOrigin.length);
}
// disable AMD detection
var define = __global.define;