annotate WebContent/jscripts/tiny_mce/utils/editable_selects.js @ 9:e9fd2e1e0979

consumer key and secret store (property file).
author casties
date Mon, 19 Mar 2012 21:26:20 +0100
parents 0be9d53a6967
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
1 /**
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
2 * editable_selects.js
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
3 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
4 * Copyright 2009, Moxiecode Systems AB
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
5 * Released under LGPL License.
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
6 *
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
7 * License: http://tinymce.moxiecode.com/license
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
8 * Contributing: http://tinymce.moxiecode.com/contributing
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
9 */
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
10
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
11 var TinyMCE_EditableSelects = {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
12 editSelectElm : null,
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 init : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 var nl = document.getElementsByTagName("select"), i, d = document, o;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 for (i=0; i<nl.length; i++) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 if (nl[i].className.indexOf('mceEditableSelect') != -1) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19 o = new Option(tinyMCEPopup.editor.translate('value'), '__mce_add_custom__');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 o.className = 'mceAddSelectValue';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 nl[i].options[nl[i].options.length] = o;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 onChangeEditableSelect : function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 var d = document, ne, se = window.event ? window.event.srcElement : e.target;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 ne = d.createElement("input");
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 ne.id = se.id + "_custom";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 ne.name = se.name + "_custom";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36 ne.type = "text";
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 ne.style.width = se.offsetWidth + 'px';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39 se.parentNode.insertBefore(ne, se);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 se.style.display = 'none';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 ne.focus();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42 ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 TinyMCE_EditableSelects.editSelectElm = se;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
45 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
46 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
47
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
48 onBlurEditableSelectInput : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49 var se = TinyMCE_EditableSelects.editSelectElm;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51 if (se) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52 if (se.previousSibling.value != '') {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53 addSelectValue(document.forms[0], se.id, se.previousSibling.value, se.previousSibling.value);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
54 selectByValue(document.forms[0], se.id, se.previousSibling.value);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
55 } else
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
56 selectByValue(document.forms[0], se.id, '');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
57
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
58 se.style.display = 'inline';
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
59 se.parentNode.removeChild(se.previousSibling);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
60 TinyMCE_EditableSelects.editSelectElm = null;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
61 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
62 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
63
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
64 onKeyDown : function(e) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
65 e = e || window.event;
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
66
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
67 if (e.keyCode == 13)
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
68 TinyMCE_EditableSelects.onBlurEditableSelectInput();
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
69 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
70 };