diff options
author | Andreas Gohr <andi@splitbrain.org> | 2010-08-29 14:22:01 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2010-08-29 14:22:01 +0200 |
commit | 2c053ed58376c6709596ab48fc40dceb90d4e89d (patch) | |
tree | c8d0f78c2f47f373473419396d3c0855ec671eca /lib/scripts/subscriptions.js | |
parent | cb4a07568e84d853fbcd9d5eca37f572fa10786f (diff) | |
parent | 5479a8c3341247ca228026819f20f3ab5c34a80f (diff) | |
download | rpg-2c053ed58376c6709596ab48fc40dceb90d4e89d.tar.gz rpg-2c053ed58376c6709596ab48fc40dceb90d4e89d.tar.bz2 |
Merge branch 'master' into stable
Conflicts:
conf/msg
lib/plugins/acl/ajax.php
Diffstat (limited to 'lib/scripts/subscriptions.js')
-rw-r--r-- | lib/scripts/subscriptions.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/scripts/subscriptions.js b/lib/scripts/subscriptions.js new file mode 100644 index 000000000..d701f258f --- /dev/null +++ b/lib/scripts/subscriptions.js @@ -0,0 +1,46 @@ +/** + * Hide list subscription style if target is a page + * + * @author Adrian Lang <lang@cosmocode.de> + */ + +addInitEvent(function () { + var form = $('subscribe__form'); + if (!form) { + return; + } + + var styleradios = {}; + + function update_state() { + if (!this.checked) { + return; + } + if (this.value.match(/:$/)) { + styleradios.list.parentNode.style.display = ''; + } else { + styleradios.list.parentNode.style.display = 'none'; + if (styleradios.list.checked) { + styleradios.digest.checked = 'checked'; + } + } + } + + var cur_sel = null; + + var inputs = form.getElementsByTagName('input'); + for (var i = 0; i < inputs.length ; ++i) { + switch (inputs[i].name) { + case 'sub_target': + addEvent(inputs[i], 'click', update_state); + if (inputs[i].checked) { + cur_sel = inputs[i]; + } + break; + case 'sub_style': + styleradios[inputs[i].value] = inputs[i]; + break; + } + } + update_state.call(cur_sel); +}); |