Search
Project
General
Profile
Home
Projects
Help
Sign in
Register
Search
:
Redmine
All Projects
Redmine
Overview
Download
Activity
Roadmap
Issues
News
Wiki
Plugins
Forums
Repository
Download (1.11 KB)
Feature #2859
» linked_lists.js
Vasia Pupkin
, 2009-03-07 09:53
function
number
(
str
,
n
){
if
(
n
<=
0
)
return
""
;
else
if
(
n
>
String
(
str
).
length
)
return
str
;
else
return
String
(
str
).
substring
(
0
,
n
);
}
function
parse
(
object
){
var
NodeList
=
object
.
getElementsByTagName
(
'
option
'
);
var
nodes
=
$A
(
NodeList
);
var
array
=
new
Array
();
for
(
i
=
0
;
i
<
$
(
nodes
).
length
;
i
++
){
array
[
i
]
=
$
(
nodes
)[
i
].
innerHTML
;
}
return
array
;
}
function
del
(
object
){
var
NodeList
=
object
.
getElementsByTagName
(
'
option
'
);
var
nodes
=
$A
(
NodeList
);
nodes
.
each
(
function
(
node
){
if
(
$
(
node
).
innerHTML
!=
'
--- Выберите ---
'
){
$
(
node
).
remove
();
};
});
}
function
add
(
object
,
name
)
{
object
.
options
.
add
(
new
Option
(
name
,
name
,
false
,
false
));
}
Event
.
observe
(
window
,
'
load
'
,
function
()
{
var
select
=
$
(
'
issue_custom_field_values_13
'
);
var
array
=
parse
(
select
);
del
(
select
);
Event
.
observe
(
$
(
'
issue_custom_field_values_12
'
),
'
change
'
,
function
()
{
del
(
select
);
var
block_selected
=
$F
(
'
issue_custom_field_values_12
'
);
for
(
i
=
0
;
i
<
array
.
length
;
i
++
)
{
if
(
number
(
array
[
i
],
1
)
==
number
(
block_selected
,
1
))
{
add
(
select
,
array
[
i
]);
};
};
});
});
« Previous
1
2
Next »
(1-1/2)
Loading...