r107672 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107671‎ | r107672 | r107673 >
Date:23:58, 30 December 2011
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
style fix
Modified paths:
  • /trunk/extensions/EducationProgram/resources/ep.pager.js (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/resources/ep.pager.js
@@ -6,36 +6,38 @@
77 * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
88 */
99
10 -(function( $, mw, ep ) {
11 -
12 - $( document ).ready( function() {
13 -
14 - $( '.ep-pager-clear' ).click( function() {
 10+(function ( $, mw, ep ) {
 11+
 12+ $( document ).ready( function () {
 13+
 14+ $( '.ep-pager-clear' ).click( function () {
1515 var $form = $( this ).closest( 'form' );
1616 $form.find( 'select' ).val( '' );
1717 $form.submit();
1818 return false;
1919 } );
20 -
21 - $( '.ep-pager-delete' ).click( function() {
 20+
 21+ $( '.ep-pager-delete' ).click( function () {
2222 if ( confirm( mw.msg( 'ep-pager-confirm-delete' ) ) ) {
23 - $this = $( this );
24 -
 23+ var $this = $( this );
 24+
2525 ep.api.remove(
2626 {
2727 'type': $this.attr( 'data-type' ),
2828 'ids': [ $this.attr( 'data-id' ) ]
2929 },
30 - function( result ) {
 30+ function ( result ) {
3131 if ( result.success ) {
32 - $tr = $this.closest( 'tr' );
33 - $table = $tr.closest( 'table' );
34 -
 32+ var $tr = $this.closest( 'tr' );
 33+ var $table = $tr.closest( 'table' );
 34+
3535 if ( $table.find( 'tr' ).length > 2 ) {
36 - $tr.slideUp( 'slow', function() { $tr.remove(); } );
 36+ $tr.slideUp( 'slow', function () {
 37+ $tr.remove();
 38+ } );
3739 }
3840 else {
39 - $table.slideUp( 'slow', function() {
 41+ $table.slideUp( 'slow', function () {
4042 $table.remove();
4143 } );
4244 }
@@ -47,19 +49,19 @@
4850 );
4951 }
5052 } );
51 -
52 - $( '.ep-pager-select-all' ).change( function() {
53 - var a = $( this ).closest( 'table' ).find( 'input:checkbox' ).prop( 'checked', $( this ).is( ':checked' ) );
 53+
 54+ $( '.ep-pager-select-all' ).change( function () {
 55+ $( this ).closest( 'table' ).find( 'input:checkbox' ).prop( 'checked', $( this ).is( ':checked' ) );
5456 } );
5557
56 - $( '.ep-pager-delete-selected' ).click( function() {
57 - var $deleteButton = $( this );
 58+ $( '.ep-pager-delete-selected' ).click( function () {
 59+ var $deleteButton = $( this );
5860 var $selectAllCheckbox = $( '#ep-pager-select-all-' + $( this ).attr( 'data-pager-id' ) );
59 - var $table = $selectAllCheckbox.closest( 'table' );
 61+ var $table = $selectAllCheckbox.closest( 'table' );
6062
6163 var ids = [];
6264
63 - $table.find( 'input[type=checkbox]:checked' ).each( function( i, element ) {
 65+ $table.find( 'input[type=checkbox]:checked' ).each( function ( i, element ) {
6466 ids.push( $( element ).val() );
6567 } );
6668
@@ -74,21 +76,21 @@
7577 'type': $( this ).attr( 'data-type' ),
7678 'ids': ids
7779 },
78 - function( result ) {
 80+ function ( result ) {
7981 if ( result.success ) {
80 - if ( ids.length > 0 && ( $table.find( 'tr' ).length - ids.length > 1 ) ) {
81 - for ( i in ids ) {
82 - if ( ids.hasOwnProperty( i ) ) {
83 - $( '#select-' + pagerId + '-' + ids[i] ).closest( 'tr' ).remove();
84 - }
85 - }
86 - }
87 - else {
88 - $table.slideUp( 'slow', function() {
89 - $table.remove();
90 - $deleteButton.closest( 'fieldset' ).remove();
91 - } );
92 - }
 82+ if ( ids.length > 0 && ( $table.find( 'tr' ).length - ids.length > 1 ) ) {
 83+ for ( i in ids ) {
 84+ if ( ids.hasOwnProperty( i ) ) {
 85+ $( '#select-' + pagerId + '-' + ids[i] ).closest( 'tr' ).remove();
 86+ }
 87+ }
 88+ }
 89+ else {
 90+ $table.slideUp( 'slow', function () {
 91+ $table.remove();
 92+ $deleteButton.closest( 'fieldset' ).remove();
 93+ } );
 94+ }
9395 }
9496 else {
9597 alert( mw.msg( 'ep-pager-delete-selected-fail' ) ); // TODO
@@ -96,7 +98,7 @@
9799 }
98100 );
99101 } );
100 -
 102+
101103 } );
102 -
103 -})( window.jQuery, window.mediaWiki, window.educationProgram )
\ No newline at end of file
 104+
 105+})( window.jQuery, window.mediaWiki, window.educationProgram );
\ No newline at end of file

Sign-offs

UserFlagDate
Nikerabbitinspected09:30, 31 December 2011

Status & tagging log