editingRestrictionWidget = infuseIfExists( $( '#mw-input-wpEditingRestriction' ) ),
preventTalkPageEdit = infuseIfExists( $( '#mw-input-wpDisableUTEdit' ) ),
pageRestrictionsWidget = infuseIfExists( $( '#mw-input-wpPageRestrictions' ) ),
- namespaceRestrictionsWidget = infuseIfExists( $( '#mw-input-wpNamespaceRestrictions' ) );
+ namespaceRestrictionsWidget = infuseIfExists( $( '#mw-input-wpNamespaceRestrictions' ) ),
+ createAccountWidget = infuseIfExists( $( '#mw-input-wpCreateAccount' ) ),
+ userChangedCreateAccount = false,
+ updatingBlockOptions = false;
function updateBlockOptions() {
var blocktarget = blockTargetWidget.getValue().trim(),
) === -1
);
}
+ if ( !userChangedCreateAccount ) {
+ updatingBlockOptions = true;
+ createAccountWidget.setSelected( isSitewide );
+ updatingBlockOptions = false;
+ }
}
namespaceRestrictionsWidget.on( 'change', updateBlockOptions );
}
+ createAccountWidget.on( 'change', function () {
+ if ( !updatingBlockOptions ) {
+ userChangedCreateAccount = true;
+ }
+ } );
+
// Call them now to set initial state (ie. Special:Block/Foobar?wpBlockExpiry=2+hours)
updateBlockOptions();
}