adminerevo/editor/static/editing.js

36 lines
1.1 KiB
JavaScript
Raw Normal View History

// Editor specific functions
2011-02-15 17:11:24 +00:00
function bodyLoad(version) {
}
2011-05-04 13:53:26 +00:00
2012-08-05 05:52:50 +00:00
function selectFieldChange(form) {
}
2011-05-04 13:53:26 +00:00
function whisperClick(event, field) {
var el = event.target || event.srcElement;
2013-07-12 21:06:44 +00:00
if (isTag(el, 'a') && !(event.button || event.shiftKey || event.altKey || isCtrl(event))) {
2011-05-04 13:53:26 +00:00
field.value = el.firstChild.data;
field.previousSibling.value = decodeURIComponent(el.href.replace(/.*=/, ''));
field.nextSibling.style.display = 'none';
return false;
}
}
function whisper(url, field) {
2011-05-05 05:46:36 +00:00
if (field.orig != field.value) { // ignore arrows, Shift, ...
2011-05-04 13:53:26 +00:00
field.orig = field.value;
2011-05-05 05:46:36 +00:00
field.previousSibling.value = field.value; // accept number, reject string
2011-05-04 13:53:26 +00:00
return ajax(url + encodeURIComponent(field.value), function (xmlhttp) {
2011-05-05 05:46:36 +00:00
if (xmlhttp.status && field.orig == field.value) { // ignore old responses
2011-05-04 13:53:26 +00:00
field.nextSibling.innerHTML = xmlhttp.responseText;
field.nextSibling.style.display = '';
var a = field.nextSibling.firstChild;
if (a && a.firstChild.data == field.value) {
field.previousSibling.value = decodeURIComponent(a.href.replace(/.*=/, ''));
2011-05-05 05:46:36 +00:00
a.className = 'active';
2011-05-04 13:53:26 +00:00
}
}
});
}
}