diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2008-08-21 09:38:06 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-08-21 09:38:06 +0800 |
commit | c561ebe710d6e6a43aa4afc6c2036a215378ce87 (patch) | |
tree | 7d4a56233ef53a0457646c47895ac5c6e7a65d31 /htdocs/js | |
download | patchwork-c561ebe710d6e6a43aa4afc6c2036a215378ce87.tar.bz2 patchwork-c561ebe710d6e6a43aa4afc6c2036a215378ce87.tar.xz |
Inital commit
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'htdocs/js')
-rw-r--r-- | htdocs/js/autocomplete.js | 43 | ||||
-rw-r--r-- | htdocs/js/filters.js | 78 | ||||
-rw-r--r-- | htdocs/js/people.js | 5 |
3 files changed, 126 insertions, 0 deletions
diff --git a/htdocs/js/autocomplete.js b/htdocs/js/autocomplete.js new file mode 100644 index 0000000..115ffba --- /dev/null +++ b/htdocs/js/autocomplete.js @@ -0,0 +1,43 @@ + + +function ac_keyup(input) +{ + input.autocomplete.keyup(); +} + +function AutoComplete(input) +{ + this.input = input; + this.div = null; + this.last_value = ''; + + input.autocomplete = this; + + this.hide = function() + { + if (this.div) { + this.div.style.display = 'none'; + this.div = null; + } + + } + + this.show = function() + { + if (!this.div) { + this.div = + + this.keyup = function() + { + value = input.value; + + if (value == this.last_value) + return; + + if (value.length < 3) { + this.hide(); + } + + +} + diff --git a/htdocs/js/filters.js b/htdocs/js/filters.js new file mode 100644 index 0000000..d8596ea --- /dev/null +++ b/htdocs/js/filters.js @@ -0,0 +1,78 @@ + +var available_filters = new Array(); + +function Filter(param, input_html, fn) +{ + this.param = param; + this.input_html = input_html; + this.fn = fn; +} + +function add_filter_change(input) +{ + index = input.selectedIndex - 1; + + if (index < 0 || index >= available_filters.length) + return; + + filter = available_filters[index]; + + value_element = document.getElementById("addfiltervalue"); + value_element.innerHTML = filter.input_html; +} + +function filter_form_submit(form) +{ + filter_index = form.filtertype.selectedIndex - 1; + + if (filter_index < 0 || filter_index >= available_filters.length) + return false; + + filter = available_filters[filter_index]; + + value = filter.fn(form); + updated = false; + + form = document.forms.filterparams; + + for (x = 0; x < form.elements.length; x++) { + if (form.elements[x].name == filter.param) { + form.elements[x].value = value; + updated = true; + } + } + + if (!updated && value) { + form.innerHTML = form.innerHTML + + '<input type="hidden" name="' + filter.param + + '" value="' + value + '"/>'; + } + + form.submit(); + + return false; +} + + +var submitter_input_prev_value = ''; + +function submitter_input_change(input) +{ + value = input.value; + + if (value.length < 3) + return; + + if (value == submitter_input_prev_value) + return; + + div = document.getElementById('submitter_complete'); + div.innerHTML = value; + div.style.display = 'block'; + div.style.position = 'relative'; + div.style.top = '4em'; + div.style.width = '15em'; + div.style.background = '#f0f0f0'; + div.style.padding = '0.2em'; + div.style.border = 'thin solid red'; +} diff --git a/htdocs/js/people.js b/htdocs/js/people.js new file mode 100644 index 0000000..7fb4e9f --- /dev/null +++ b/htdocs/js/people.js @@ -0,0 +1,5 @@ + +function personpopup(name) +{ + alert("meep!"); +} |