diff options
author | lpsolit%gmail.com <> | 2009-11-26 00:03:30 +0000 |
---|---|---|
committer | lpsolit%gmail.com <> | 2009-11-26 00:03:30 +0000 |
commit | d2800f79b4a99751fab0dfd9db509e11b4106432 (patch) | |
tree | 5eddeb2a0daef9a85f2e4214f985228e496365ed /template/en | |
parent | c0ab2bbac2c7b7265e26a158672d9940d21b4cdc (diff) | |
download | bugs-d2800f79b4a99751fab0dfd9db509e11b4106432.tar bugs-d2800f79b4a99751fab0dfd9db509e11b4106432.tar.gz bugs-d2800f79b4a99751fab0dfd9db509e11b4106432.tar.bz2 bugs-d2800f79b4a99751fab0dfd9db509e11b4106432.tar.xz bugs-d2800f79b4a99751fab0dfd9db509e11b4106432.zip |
Bug 477465: Move JS code out of flag/list.html.tmpl - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'template/en')
-rw-r--r-- | template/en/default/flag/list.html.tmpl | 56 |
1 files changed, 2 insertions, 54 deletions
diff --git a/template/en/default/flag/list.html.tmpl b/template/en/default/flag/list.html.tmpl index 5c810480f..adf12565c 100644 --- a/template/en/default/flag/list.html.tmpl +++ b/template/en/default/flag/list.html.tmpl @@ -18,60 +18,6 @@ # Contributor(s): Myk Melez <myk@mozilla.org> #%] -<script type="text/javascript"> -<!-- - // Enables or disables a requestee field depending on whether or not - // the user is requesting the corresponding flag. - function toggleRequesteeField(flagField, no_focus) - { - // Convert the ID of the flag field into the ID of its corresponding - // requestee field and then use the ID to get the field. - var id = flagField.name.replace(/flag(_type)?-(\d+)/, "requestee$1-$2"); - var requesteeField = document.getElementById(id); - if (!requesteeField) return; - - // Enable or disable the requestee field based on the value - // of the flag field. - if (flagField.value == "?") { - requesteeField.disabled = false; - if (!no_focus) requesteeField.focus(); - } else - requesteeField.disabled = true; - } - - // Disables requestee fields when the window is loaded since they shouldn't - // be enabled until the user requests that flag type. - function disableRequesteeFields() - { - var inputElements = document.getElementsByTagName("input"); - var selectElements = document.getElementsByTagName("select"); - //You cannot update Node lists, so you must create an array to combine the NodeLists - var allElements = []; - for( var i=0; i < inputElements.length; i++ ) { - allElements[allElements.length] = inputElements.item(i); - } - for( var i=0; i < selectElements.length; i++ ) { //Combine inputs with selects - allElements[allElements.length] = selectElements.item(i); - } - var inputElement, id, flagField; - for ( var i=0 ; i<allElements.length ; i++ ) - { - inputElement = allElements[i]; - if (inputElement.name.search(/^requestee(_type)?-(\d+)$/) != -1) - { - // Convert the ID of the requestee field into the ID of its corresponding - // flag field and then use the ID to get the field. - id = inputElement.name.replace(/requestee(_type)?-(\d+)/, "flag$1-$2"); - flagField = document.getElementById(id); - if (flagField && flagField.value != "?") - inputElement.disabled = true; - } - } - } - YAHOO.util.Event.addListener(window, "load", disableRequesteeFields); -// --> -</script> - [% IF user.id %] [%# We list flags by looping twice over the flag types relevant for the bug. @@ -84,6 +30,8 @@ [% DEFAULT flag_table_id = "flags" %] +<script type="text/javascript" src="js/flag.js"></script> + <table id="[% flag_table_id FILTER html %]"> [% UNLESS flag_no_header %] <tr> |