提交 17226fe7 编写于 作者: C Catouse

* fix error in jQuery 3.* and jQuery 2.*.

上级 485ec8d8
......@@ -287,41 +287,47 @@
var dataType = url.endsWith('.json') ? 'json' : 'html';
var loadFromRemote = function() {
$.get(url, function(data) {
if(data !== null) {
if(isIndexJson) {
dataVersion = data.version;
docIndex = data;
} else if(isIconsJson) {
iconsIndex = {
$.ajax({
url: url,
type: 'GET',
dataType: dataType,
success: function(data) {
if(data !== null) {
if(isIndexJson) {
dataVersion = data.version;
docIndex = data;
} else if(isIconsJson) {
iconsIndex = {
data: data,
version: dataVersion
};
}
cacheData = {
data: data,
version: dataVersion
};
$.zui.store.set('//' + url, data);
$.zui.store.set('//' + url + '::V', dataVersion);
if(debug) console.log('Load', url, 'from remote:', cacheData);
callback(data, 'remote');
} else if(isHasCache && !isIndexJson) {
if(debug) console.log('Failed load', url, 'from remote, instead load cache:', cacheData);
callback(cacheData.data, 'cache');
}
},
error: function() {
if(debug) console.warn("Ajax error:", url);
if(isHasCache && !isIndexJson) {
if(debug) console.log('Failed load', url, 'from remote with error, instead load cache:', cacheData);
callback(cacheData.data, 'cache');
} else {
callback(null, 'error');
}
cacheData = {
data: data,
version: dataVersion
};
$.zui.store.set('//' + url, data);
$.zui.store.set('//' + url + '::V', dataVersion);
if(debug) console.log('Load', url, 'from remote:', cacheData);
callback(data, 'remote');
} else if(isHasCache && !isIndexJson) {
if(debug) console.log('Failed load', url, 'from remote, instead load cache:', cacheData);
callback(cacheData.data, 'cache');
}
}, dataType).error(function() {
if(debug) console.warn("Ajax error:", url);
if(isHasCache && !isIndexJson) {
if(debug) console.log('Failed load', url, 'from remote with error, instead load cache:', cacheData);
callback(cacheData.data, 'cache');
} else {
callback(null, 'error');
}
if($body.hasClass('page-open')) {
$pageBody.children('.loader').addClass('with-error');
if($body.hasClass('page-open')) {
$pageBody.children('.loader').addClass('with-error');
}
}
});
}
......
......@@ -114,9 +114,10 @@
selector = $this.attr('href')
selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}
var $parent = selector && $(selector)
var $parent;
try {
$parent = selector && $(selector);
} catch(e) {}
return $parent && $parent.length ? $parent : $this.parent()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册