mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 20:44:53 -04:00
Updates location checking.
This commit is contained in:
parent
f65f5021ae
commit
30d48fb1ef
1 changed files with 7 additions and 2 deletions
|
@ -1,11 +1,12 @@
|
||||||
|
|
||||||
modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, types, ajax) {
|
modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, types, ajax) {
|
||||||
|
|
||||||
var domain = document.domain,
|
var doc = document,
|
||||||
|
domain = doc.domain,
|
||||||
location = (function () {
|
location = (function () {
|
||||||
|
|
||||||
var testpathname = '/a b',
|
var testpathname = '/a b',
|
||||||
a = document.createElement('a'),
|
a = doc.createElement('a'),
|
||||||
isDecoded, location;
|
isDecoded, location;
|
||||||
|
|
||||||
a.href = testpathname;
|
a.href = testpathname;
|
||||||
|
@ -18,6 +19,10 @@ modulejs.define('model/entry', ['_', 'core/types', 'core/ajax'], function (_, ty
|
||||||
location = encodeURIComponent(location).replace(/%2F/ig, '/').replace(/'/g, '%27');
|
location = encodeURIComponent(location).replace(/%2F/ig, '/').replace(/'/g, '%27');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!location) {
|
||||||
|
location = doc.location.href.replace(/.*:\/\/[^\/]*/, '').replace(/[^\/]*$/, '');
|
||||||
|
}
|
||||||
|
|
||||||
return location;
|
return location;
|
||||||
}()),
|
}()),
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue