No regular expressions were active.
1 |
|
/**
|
|
1 |
|
/**
|
2 |
|
*
$Id:
editable_s
elects.js
16
2
200
7
-01-0
3
16:
16
:
5
2Z
spocke
$
|
|
2 |
|
*
$Id:
editable_s
elects.js
5
2
0
200
8
-01-0
7
16:
30
:
3
2Z
spocke
$
|
3 |
|
*
|
|
3 |
|
*
|
4 |
|
* Makes s
elect boxe
s editable
.
|
|
4 |
|
* Makes s
elect boxe
s editable
.
|
5 |
|
*
|
|
5 |
|
*
|
6 |
|
* @author
Moxiecode
|
|
6 |
|
* @author
Moxiecode
|
7 |
|
*
@copyright
Copyright
©
2004-200
7
,
Moxiecode
Systems
AB,
All
rights
reserved.
|
|
7 |
|
*
@copyright
Copyright
©
2004-200
8
,
Moxiecode
Systems
AB,
All
rights
reserved.
|
8 |
|
*/
|
|
8 |
|
*/
|
9 |
|
|
|
9 |
|
|
10 |
|
var TinyMC
E_Editable
Selects =
{
|
|
10 |
|
var TinyMC
E_Editable
Selects =
{
|
11 |
|
editSe
lectElm :
null,
|
|
11 |
|
editSe
lectElm :
null,
|
12 |
|
|
|
12 |
|
|
13 |
|
init :
function(
) {
|
|
13 |
|
init :
function(
) {
|
14 |
|
va
r nl = doc
ument.getE
lementsByT
agName("se
lect"), i,
d = docum
ent, o;
|
|
14 |
|
va
r nl = doc
ument.getE
lementsByT
agName("se
lect"), i,
d = docum
ent, o;
|
15 |
|
|
|
15 |
|
|
16 |
|
fo
r (i=0; i<
nl.length;
i++) {
|
|
16 |
|
fo
r (i=0; i<
nl.length;
i++) {
|
17 |
|
if (nl[i
].classNam
e.indexOf(
'mceEditab
leSelect')
!= -1) {
|
|
17 |
|
if (nl[i
].classNam
e.indexOf(
'mceEditab
leSelect')
!= -1) {
|
18 |
|
o =
new Option
('(value)'
, '__mce_a
dd_custom_
_');
|
|
18 |
|
o =
new Option
('(value)'
, '__mce_a
dd_custom_
_');
|
19 |
|
|
|
19 |
|
|
20 |
|
o.cl
assName =
'mceAddSel
ectValue';
|
|
20 |
|
o.cl
assName =
'mceAddSel
ectValue';
|
21 |
|
|
|
21 |
|
|
22 |
|
nl[i
].options[
nl[i].opti
ons.length
] = o;
|
|
22 |
|
nl[i
].options[
nl[i].opti
ons.length
] = o;
|
23 |
|
nl[i].
setAttribu
te('
onchange
',
'
TinyMCE_Ed
itableSele
cts.onChan
geEditable
Select
(this);')
;
|
|
23 |
|
nl[i].
onchange
=
TinyMCE_Ed
itableSele
cts.onChan
geEditable
Select
;
|
24 |
|
}
|
|
24 |
|
}
|
25 |
|
}
|
|
25 |
|
}
|
26 |
|
},
|
|
26 |
|
},
|
27 |
|
|
|
27 |
|
|
28 |
|
onChangeEd
itableSele
ct
:
function(
s
e)
{
|
|
28 |
|
onChangeEd
itableSele
ct
:
function(
e)
{
|
29 |
|
va
r d = docu
ment, ne;
|
|
29 |
|
va
r d = docu
ment, ne,
se = windo
w.event ?
window.eve
nt.srcElem
ent : e.ta
rget;
|
30 |
|
|
|
30 |
|
|
31 |
|
if
(se.optio
ns[se.sele
ctedIndex]
.value ==
'__mce_add
_custom__'
) {
|
|
31 |
|
if
(se.optio
ns[se.sele
ctedIndex]
.value ==
'__mce_add
_custom__'
) {
|
32 |
|
ne = d.c
reateEleme
nt("input"
);
|
|
32 |
|
ne = d.c
reateEleme
nt("input"
);
|
33 |
|
ne.id =
se.id + "_
custom";
|
|
33 |
|
ne.id =
se.id + "_
custom";
|
34 |
|
ne.name
= se.name
+ "_custom
";
|
|
34 |
|
ne.name
= se.name
+ "_custom
";
|
35 |
|
ne.type
= "text";
|
|
35 |
|
ne.type
= "text";
|
36 |
|
|
|
36 |
|
|
37 |
|
ne.style.w
idth
=
se.
cli
e
n
tWidth
;
|
|
37 |
|
ne.style.w
idth
=
se.
offs
e
tWidth
+
'px'
;
|
38 |
|
se.paren
tNode.inse
rtBefore(n
e, se);
|
|
38 |
|
se.paren
tNode.inse
rtBefore(n
e, se);
|
39 |
|
se.style
.display =
'none';
|
|
39 |
|
se.style
.display =
'none';
|
40 |
|
ne.focus
();
|
|
40 |
|
ne.focus
();
|
41 |
|
ne.onblu
r = TinyMC
E_Editable
Selects.on
BlurEditab
leSelectIn
put;
|
|
41 |
|
ne.onblu
r = TinyMC
E_Editable
Selects.on
BlurEditab
leSelectIn
put;
|
42 |
|
TinyMCE_
EditableSe
lects.edit
SelectElm
= se;
|
|
42 |
|
TinyMCE_
EditableSe
lects.edit
SelectElm
= se;
|
43 |
|
}
|
|
43 |
|
}
|
44 |
|
},
|
|
44 |
|
},
|
45 |
|
|
|
45 |
|
|
46 |
|
onBlur
EditableSe
lectInput
: function
() {
|
|
46 |
|
onBlur
EditableSe
lectInput
: function
() {
|
47 |
|
va
r se = Tin
yMCE_Edita
bleSelects
.editSelec
tElm;
|
|
47 |
|
va
r se = Tin
yMCE_Edita
bleSelects
.editSelec
tElm;
|
48 |
|
|
|
48 |
|
|
49 |
|
if
(se) {
|
|
49 |
|
if
(se) {
|
50 |
|
if (se.p
reviousSib
ling.value
!= '') {
|
|
50 |
|
if (se.p
reviousSib
ling.value
!= '') {
|
51 |
|
addS
electValue
(document.
forms[0],
se.id, se.
previousSi
bling.valu
e, se.prev
iousSiblin
g.value);
|
|
51 |
|
addS
electValue
(document.
forms[0],
se.id, se.
previousSi
bling.valu
e, se.prev
iousSiblin
g.value);
|
52 |
|
sele
ctByValue(
document.f
orms[0], s
e.id, se.p
reviousSib
ling.value
);
|
|
52 |
|
sele
ctByValue(
document.f
orms[0], s
e.id, se.p
reviousSib
ling.value
);
|
53 |
|
} else
|
|
53 |
|
} else
|
54 |
|
sele
ctByValue(
document.f
orms[0], s
e.id, '');
|
|
54 |
|
sele
ctByValue(
document.f
orms[0], s
e.id, '');
|
55 |
|
|
|
55 |
|
|
56 |
|
se.style
.display =
'inline';
|
|
56 |
|
se.style
.display =
'inline';
|
57 |
|
se.paren
tNode.remo
veChild(se
.previousS
ibling);
|
|
57 |
|
se.paren
tNode.remo
veChild(se
.previousS
ibling);
|
58 |
|
TinyMCE_
EditableSe
lects.edit
SelectElm
= null;
|
|
58 |
|
TinyMCE_
EditableSe
lects.edit
SelectElm
= null;
|
59 |
|
}
|
|
59 |
|
}
|
60 |
|
}
|
|
60 |
|
}
|
61 |
|
};
|
|
61 |
|
};
|