Açıklama Yok

mods.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* global pagenow, ajaxurl, CalypsoifyOpts */
  2. ( function ( $ ) {
  3. $( window ).load( function () {
  4. // On Plugins.php
  5. if ( 'plugins' === pagenow ) {
  6. // pagenow === $current_screen->id
  7. // Remove | and () from the plugins filter bar
  8. $.each( $( 'ul.subsubsub li' ), function ( i, el ) {
  9. var li = $( el );
  10. li.html( li.html().replace( '|', '' ).replace( '(', '' ).replace( ')', '' ) );
  11. } );
  12. // Add in the AJAX-y goodness for toggling autoupdates.
  13. $( 'input.autoupdate-toggle' ).change( function ( event ) {
  14. var el = event.target;
  15. el.disabled = true;
  16. el.classList.add( 'is-toggling' );
  17. jQuery.post(
  18. ajaxurl,
  19. {
  20. action: 'jetpack_toggle_autoupdate',
  21. type: 'plugins',
  22. slug: el.dataset.slug,
  23. active: el.checked,
  24. _wpnonce: CalypsoifyOpts.nonces.autoupdate_plugins,
  25. },
  26. function () {
  27. // Add something to test and confirm that `el.dataset.slug` is missing from `response.data` ?
  28. el.disabled = false;
  29. el.classList.remove( 'is-toggling' );
  30. }
  31. );
  32. } );
  33. }
  34. $( '#wp-admin-bar-root-default' ).on( 'click', 'li', function ( event ) {
  35. location.href = $( event.target ).closest( 'a' ).attr( 'href' );
  36. } );
  37. $( '#wp-admin-bar-top-secondary' ).on( 'click', 'li#wp-admin-bar-my-account', function (
  38. event
  39. ) {
  40. location.href = $( event.target ).closest( 'a' ).attr( 'href' );
  41. } );
  42. if ( document && document.location && document.location.search ) {
  43. var params_array = document.location.search.substr( 1 ).split( '&' ),
  44. params_object = {},
  45. body = $( document.body ),
  46. i,
  47. key_value,
  48. pluginEl;
  49. if ( params_array && params_array.length ) {
  50. for ( i = 0; i < params_array.length; i++ ) {
  51. key_value = params_array[ i ].split( '=' );
  52. params_object[ key_value[ 0 ] ] = key_value[ 1 ];
  53. }
  54. if ( params_object.s && params_object[ 'modal-mode' ] && params_object.plugin ) {
  55. pluginEl = $(
  56. '.plugin-card-' + params_object.plugin + ' .thickbox.open-plugin-details-modal'
  57. );
  58. if ( pluginEl && pluginEl.length ) {
  59. pluginEl.click();
  60. }
  61. }
  62. }
  63. body.on( 'thickbox:iframe:loaded', function () {
  64. $( '#TB_window' ).on( 'click', 'button#TB_closeWindowButton', function () {
  65. $( '#TB_closeWindowButton' ).click();
  66. } );
  67. } );
  68. }
  69. } );
  70. } )( jQuery );