summaryrefslogtreecommitdiffstats
path: root/skins/common/block.js
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-10-24 18:01:35 +0000
committerNicolas Vigier <boklm@mageia.org>2011-10-24 18:01:35 +0000
commit246b38834224f9575f7b22cf84428ff615cb5acd (patch)
tree9e856efbb5a8f14faedf83432687b2a4bef5c493 /skins/common/block.js
downloadmediawiki-246b38834224f9575f7b22cf84428ff615cb5acd.tar
mediawiki-246b38834224f9575f7b22cf84428ff615cb5acd.tar.gz
mediawiki-246b38834224f9575f7b22cf84428ff615cb5acd.tar.bz2
mediawiki-246b38834224f9575f7b22cf84428ff615cb5acd.tar.xz
mediawiki-246b38834224f9575f7b22cf84428ff615cb5acd.zip
add mediawiki themes
Diffstat (limited to 'skins/common/block.js')
-rw-r--r--skins/common/block.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/skins/common/block.js b/skins/common/block.js
new file mode 100644
index 0000000..ad04f81
--- /dev/null
+++ b/skins/common/block.js
@@ -0,0 +1,57 @@
+addOnloadHook( considerChangingExpiryFocus );
+
+function considerChangingExpiryFocus() {
+ if ( !document.getElementById ) {
+ return;
+ }
+ var drop = document.getElementById( 'wpBlockExpiry' );
+ if ( !drop ) {
+ return;
+ }
+ var field = document.getElementById( 'wpBlockOther' );
+ if ( !field ) {
+ return;
+ }
+ var opt = drop.value;
+ if ( opt == 'other' ) {
+ field.style.display = '';
+ } else {
+ field.style.display = 'none';
+ }
+}
+
+function updateBlockOptions() {
+ if ( !document.getElementById ) {
+ return;
+ }
+
+ var target = document.getElementById( 'mw-bi-target' );
+ if ( !target ) {
+ return;
+ }
+
+ var addy = target.value;
+ var isEmpty = addy.match(/^\s*$/);
+ var isIp = addy.match(/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})(\/\d+)?$/);
+ var isIpRange = isIp && addy.match(/\/\d+$/);
+
+ var anonymousRow = document.getElementById( 'wpAnonOnlyRow' );
+ if( anonymousRow ) {
+ anonymousRow.style.display = ( !isIp && !isEmpty ) ? 'none' : '';
+ }
+
+ var autoblockRow = document.getElementById( 'wpEnableAutoblockRow' );
+ if( autoblockRow ) {
+ autoblockRow.style.display = isIp && !isEmpty ? 'none' : '';
+ }
+
+ var hideuserRow = document.getElementById( 'wpEnableHideUser' );
+ if( hideuserRow ) {
+ hideuserRow.style.display = isIp && !isEmpty ? 'none' : '';
+ }
+
+ var watchuserRow = document.getElementById( 'wpEnableWatchUser' );
+ if( watchuserRow ) {
+ watchuserRow.style.display = isIpRange && !isEmpty ? 'none' : '';
+ }
+}