wpXtreme / wpdk

WordPress Development Kit
http://wpxtreme.github.io/wpdk/
Other
79 stars 19 forks source link

Introducing Toggle Button #40

Closed gfazioli closed 10 years ago

gfazioli commented 10 years ago

Inspired:

      // Stop Rebuild
      $( document ).on( 'click', 'button[name="wpxcf-tools-media-pause"]', false, function()
      {
        var toggle = $( this ).data( 'toggle' );

        var toggle_value = $( this ).data( 'toggle_value' ) || "true";
        var _toggle = $( this ).data( '_toggle' ) || $( this ).html();

        if( "true" === toggle_value ) {
          $( this ).data( 'toggle_value', "false" );
          $( this ).data( '_toggle', _toggle );
          $( this ).html( toggle );

          $( 'div#wpxcf-media-tools-attachment-meta-progress' ).children( 'div' ).removeClass( 'active' );

          clearInterval( _WPXCFMediaTool.heartbaet );

        }
        else {
          $( this ).data( 'toggle_value', "true" );
          $( this ).html( _toggle );

          $( 'div#wpxcf-media-tools-attachment-meta-progress' ).children( 'div' ).addClass( 'active' );

          _WPXCFMediaTool.heartbaet = setInterval( _heartbeat, 5000 );
        }

        return false;
      } );