toolbar: add missing toolbar.js
This commit is contained in:
parent
6e82eeef5e
commit
9067de7dfe
|
@ -0,0 +1,63 @@
|
|||
function mandaye_load(url, on_success_callback) {
|
||||
var httpReq;
|
||||
|
||||
var versions = ["MSXML2.XmlHttp.5.0",
|
||||
"MSXML2.XmlHttp.4.0",
|
||||
"MSXML2.XmlHttp.3.0",
|
||||
"MSXML2.XmlHttp.2.0",
|
||||
"Microsoft.XmlHttp"];
|
||||
|
||||
if (window.XMLHttpRequest) {
|
||||
// For Mozilla, Safari (non IE browsers)
|
||||
httpReq = new XMLHttpRequest();
|
||||
} else if (window.ActiveXObject) {
|
||||
// For IE browsers
|
||||
for (var i = 0, n=versions.length; i < n; i++) {
|
||||
try {
|
||||
httpReq = new ActiveXObject(versions[i]);
|
||||
} catch(e) { }
|
||||
}
|
||||
}
|
||||
|
||||
if (!httpReq) {
|
||||
console.log('Cannot create an XMLHTTP instance');
|
||||
return false;
|
||||
}
|
||||
|
||||
httpReq.onreadystatechange = function() {
|
||||
if (httpReq.readyState === 4) {
|
||||
if (httpReq.status === 200) {
|
||||
on_success_callback(httpReq.responseText);
|
||||
}
|
||||
else {
|
||||
console.log('Request error');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
httpReq.open('GET', url);
|
||||
httpReq.send();
|
||||
}
|
||||
|
||||
function mandaye_disassociate_logout(url, account, id)
|
||||
{
|
||||
var r = confirm("Etes-vous sûr de vouloir désassocier le compte " + account + " ?");
|
||||
if (r == true)
|
||||
{
|
||||
window.location = url + "?id=" + id;
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
mandaye_load('/mandaye/toolbar', function(response) {
|
||||
var body = document.body || document.getElementsByTagName('body')[0];
|
||||
var div = document.createElement('div');
|
||||
div.innerHTML = response;
|
||||
body.insertBefore(div, body.childNodes[0]);
|
||||
});
|
||||
$("#logout_link").off('click').on("click", function() {
|
||||
window.location = "/studio/locallogout?next_url=/studio/accueil";
|
||||
});
|
||||
|
||||
}
|
Reference in New Issue