PageRenderTime 47ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/backupbuddy2/pluginbuddy/js/admin.js

https://gitlab.com/mattswann/launch-housing
JavaScript | 85 lines | 64 code | 19 blank | 2 comment | 7 complexity | dd8b1ad0bcccc109a75329ea2d880d0a MD5 | raw file
  1. jQuery(document).ready(function() {
  2. jQuery('.backupbuddy-do_bulk_action').click( function(){
  3. if ( ! confirm( 'Are you sure you want to do this to all selected items?' ) ) {
  4. return false;
  5. }
  6. });
  7. jQuery('.pb_debug_show').click(function(e) {
  8. jQuery(this).hide();
  9. jQuery(this).parent().children( '.pb_debug_hide').show();
  10. jQuery(this).parent().css( 'float', 'left' );
  11. jQuery(this).parent().css( 'width', '80%' );
  12. jQuery(this).parent().children( 'div').show();
  13. });
  14. jQuery('.pb_debug_hide').click(function(e) {
  15. jQuery(this).hide();
  16. jQuery(this).parent().children( '.pb_debug_show').show();
  17. jQuery(this).parent().css( 'float', 'right' );
  18. jQuery(this).parent().css( 'width', '40px' );
  19. jQuery(this).parent().children( 'div').hide();
  20. });
  21. jQuery( '.advanced-toggle-title' ).click(function(){
  22. containerWrap = jQuery(this).closest( 'form' );
  23. titleToggle = containerWrap.find( '.advanced-toggle-title' );
  24. rightArrow = titleToggle.find( '.dashicons-arrow-right' );
  25. if ( rightArrow.length > 0 ) {
  26. rightArrow.removeClass( 'dashicons-arrow-right' ).addClass( 'dashicons-arrow-down' );
  27. } else {
  28. titleToggle.find( '.dashicons-arrow-down' ).removeClass( 'dashicons-arrow-down' ).addClass( 'dashicons-arrow-right' );
  29. }
  30. containerWrap.find( '.advanced-toggle' ).toggle();
  31. });
  32. jQuery('.pluginbuddy_tip').tooltip(); // Now using jQuery UI tooltip.
  33. if (typeof jQuery.tableDnD !== 'undefined') { // If tableDnD function loaded.
  34. jQuery('.pb_reorder').tableDnD({
  35. onDrop: function(tbody, row) {
  36. var new_order = new Array();
  37. var rows = tbody.rows;
  38. for (var i=0; i<rows.length; i++) {
  39. new_order.push( rows[i].id.substring(11) );
  40. }
  41. new_order = new_order.join( ',' );
  42. jQuery( '#pb_order' ).val( new_order )
  43. },
  44. dragHandle: "pb_draghandle"
  45. });
  46. }
  47. jQuery('.pb_toggle').click(function(e) {
  48. jQuery( '#pb_toggle-' + jQuery(this).attr('id') ).slideToggle();
  49. });
  50. // Hide a dismissable alert and send AJAX call so it won't be shown in the future.
  51. jQuery( '.pb_backupbuddy_disalert' ).click( function(e) {
  52. var this_unique_id = jQuery(this).parents('.pb_backupbuddy_alert').attr('rel');
  53. var this_disalert_url = jQuery(this).attr('alt');
  54. //alert( unique_id );
  55. jQuery.post( this_disalert_url,
  56. { unique_id: this_unique_id },
  57. function(data) {
  58. data = jQuery.trim( data );
  59. if ( data != '1' ) {
  60. alert( 'Error saving dismissal. The alert may return. Error: ' + data );
  61. }
  62. }
  63. );
  64. jQuery(this).parents('.pb_backupbuddy_alert').slideUp();
  65. });
  66. });