[FIX] website tour test: import with ajax insead of jquery (and auto load jquery)
bzr revid: chm@openerp.com-20140207143437-uptdehmpegzze61y
This commit is contained in:
parent
d432e56661
commit
f767f6ca47
|
@ -1,27 +1,32 @@
|
|||
(function () {
|
||||
var scripts = [];
|
||||
|
||||
function LoadScript(src) {
|
||||
xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function() {
|
||||
if(xmlHttp.readyState == 4) {
|
||||
if (xmlHttp.status == 200 || xmlHttp.status == 304) {
|
||||
new Function(xmlHttp.responseText)();
|
||||
} else {
|
||||
throw new Error("Can't load JavaScript.\nhref: " + window.location.href + "\nsrc: " + src);
|
||||
}
|
||||
}
|
||||
};
|
||||
xmlHttp.open("GET", src, false);
|
||||
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
xmlHttp.send(null);
|
||||
}
|
||||
|
||||
if (typeof jQuery === "undefined")
|
||||
LoadScript("/web/static/lib/jquery/jquery.js");
|
||||
if (typeof openerp === "undefined") {
|
||||
scripts.push("/web/static/lib/qweb/qweb2.js");
|
||||
scripts.push("/web/static/lib/qweb/openerpframework.js");
|
||||
LoadScript("/web/static/lib/qweb/qweb2.js");
|
||||
LoadScript("/web/static/lib/qweb/openerpframework.js");
|
||||
}
|
||||
if (typeof openerp === "undefined" || !openerp.website || !openerp.website.add_template_file)
|
||||
scripts.push("/website/static/src/js/website.js");
|
||||
LoadScript("/website/static/src/js/website.js");
|
||||
if (typeof openerp === "undefined" || !openerp.website.Tour)
|
||||
scripts.push("/website/static/src/js/website.tour.js");
|
||||
if (typeof Tour === "undefined") {
|
||||
scripts.push("/website/static/lib/bootstrap-tour/bootstrap-tour.js");
|
||||
}
|
||||
for (var i in scripts) {
|
||||
if (typeof jQuery === "undefined") {
|
||||
throw new Error("jQuery not found.\nhref: " + window.location.href + (document && document.body ? "\n\n" + document.body.innerHTML : ""));
|
||||
}
|
||||
jQuery.ajax({
|
||||
async: false,
|
||||
type: 'GET',
|
||||
data: null,
|
||||
url: scripts[i],
|
||||
dataType: "script",
|
||||
error: function (a,b,e) {throw e;}
|
||||
});
|
||||
}
|
||||
LoadScript("/website/static/src/js/website.tour.js");
|
||||
if (typeof Tour === "undefined")
|
||||
LoadScript("/website/static/lib/bootstrap-tour/bootstrap-tour.js");
|
||||
|
||||
})();
|
Loading…
Reference in New Issue