File: editing.js

package info (click to toggle)
adminer 3.3.3-1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 1,528 kB
  • sloc: php: 14,363; sh: 49; makefile: 36
file content (36 lines) | stat: -rw-r--r-- 1,200 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Editor specific functions

function bodyLoad(version) {
	if (history.state !== undefined) {
		onpopstate(history);
	}
}

function whisperClick(event, field) {
	var el = event.target || event.srcElement;
	if (/^a$/i.test(el.tagName) && !(event.button || event.ctrlKey || event.shiftKey || event.altKey || event.metaKey)) {
		field.value = el.firstChild.data;
		field.previousSibling.value = decodeURIComponent(el.href.replace(/.*=/, ''));
		field.nextSibling.style.display = 'none';
		eventStop(event);
		return false;
	}
}

function whisper(url, field) {
	if (field.orig != field.value) { // ignore arrows, Shift, ...
		field.orig = field.value;
		field.previousSibling.value = field.value; // accept number, reject string
		return ajax(url + encodeURIComponent(field.value), function (xmlhttp) {
			if (xmlhttp.status && field.orig == field.value) { // ignore old responses
				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(/.*=/, ''));
					a.className = 'active';
				}
			}
		});
	}
}