Advertisement
Guest User

OOUI checkboxes for action=edit

a guest
Nov 12th, 2015
374
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $( function () {
  2.     mw.loader.using( [ 'oojs-ui' ] ).done( function () {
  3.         $( '.editCheckboxes input[type=checkbox]' ).each( function () {
  4.                 var checkboxWidget,
  5.                     $this = $( this ),
  6.                     id = $this.attr( 'id' );
  7.  
  8.                 checkboxWidget = new OO.ui.CheckboxInputWidget( {
  9.                     name: $this.attr( 'name' ),
  10.                     tabIndex: Number($this.attr( 'tabindex' )),
  11.                     accessKey: $this.attr( 'accesskey' ),
  12.                     value: $this.attr( 'value' ),
  13.                     selected: this.checked
  14.                 } );
  15.  
  16.                 checkboxWidget.$input.attr( 'id', id );
  17.                 checkboxWidget.$element.css( 'display', 'inline-block' );
  18.  
  19.                 $this.replaceWith( checkboxWidget.$element );
  20.         } );
  21.     } );
  22. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement