PageRenderTime 62ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/broken-link-checker/includes/admin/options-page-js.php

https://bitbucket.org/lgorence/quickpress
PHP | 122 lines | 95 code | 20 blank | 7 comment | 11 complexity | 7df961599619f8c46df916bcaf748336 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <script type="text/javascript">
  2. jQuery(function($){
  3. $('#blc-tabs').tabs();
  4. //Refresh the "Status" box every 10 seconds
  5. function blcUpdateStatus(){
  6. $.getJSON(
  7. "<?php echo admin_url('admin-ajax.php'); ?>",
  8. {
  9. 'action' : 'blc_full_status',
  10. 'random' : Math.random()
  11. },
  12. function (data, textStatus){
  13. if ( data && ( typeof(data['text']) != 'undefined' ) ){
  14. $('#wsblc_full_status').html(data.text);
  15. } else {
  16. $('#wsblc_full_status').html('<?php _e('[ Network error ]', 'broken-link-checker'); ?>');
  17. }
  18. setTimeout(blcUpdateStatus, 10000);
  19. }
  20. );
  21. }
  22. blcUpdateStatus();
  23. //Refresh the avg. load display every 10 seconds
  24. function blcUpdateLoad(){
  25. $.get(
  26. "<?php echo admin_url('admin-ajax.php'); ?>",
  27. {
  28. 'action' : 'blc_current_load'
  29. },
  30. function (data, textStatus){
  31. $('#wsblc_current_load').html(data);
  32. setTimeout(blcUpdateLoad, 10000); //...update every 10 seconds
  33. }
  34. );
  35. }
  36. //Only do it if load limiting is available on this server, though.
  37. if ( $('#wsblc_current_load').length > 0 ){
  38. blcUpdateLoad();
  39. }
  40. var toggleButton = $('#blc-debug-info-toggle');
  41. toggleButton.click(function(){
  42. var box = $('#blc-debug-info');
  43. box.toggle();
  44. if( box.is(':visible') ){
  45. toggleButton.text('<?php _e('Hide debug info', 'broken-link-checker'); ?>');
  46. } else {
  47. toggleButton.text('<?php _e('Show debug info', 'broken-link-checker'); ?>');
  48. }
  49. });
  50. $('#toggle-broken-link-css-editor').click(function(){
  51. var box = $('#broken-link-css-wrap').toggleClass('hidden');
  52. $.cookie(
  53. box.attr('id'),
  54. box.hasClass('hidden')?'0':'1',
  55. {
  56. expires : 365
  57. }
  58. );
  59. return false;
  60. });
  61. $('#toggle-removed-link-css-editor').click(function(){
  62. var box = $('#removed-link-css-wrap').toggleClass('hidden');
  63. $.cookie(
  64. box.attr('id'),
  65. box.hasClass('hidden')?'0':'1',
  66. {
  67. expires : 365
  68. }
  69. );
  70. return false;
  71. });
  72. //Show/hide per-module settings
  73. $('.toggle-module-settings').click(function(){
  74. var settingsBox = $(this).parent().find('.module-extra-settings');
  75. if ( settingsBox.length > 0 ){
  76. settingsBox.toggleClass('hidden');
  77. $.cookie(
  78. settingsBox.attr('id'),
  79. settingsBox.hasClass('hidden')?'0':'1',
  80. {
  81. expires : 365
  82. }
  83. );
  84. }
  85. return false;
  86. });
  87. //When the user ticks the "Custom fields" box, display the field list input
  88. //so that they notice that they need to enter the field names.
  89. $('#module-checkbox-custom_field').click(function(){
  90. var box = $(this);
  91. var fieldList = $('#blc_custom_fields');
  92. if ( box.is(':checked') && ( $.trim(fieldList.val()) == '' ) ){
  93. $('#module-extra-settings-custom_field').removeClass('hidden');
  94. }
  95. });
  96. //Handle the "Recheck" button
  97. $('#start-recheck').click(function(){
  98. $('#recheck').val('1'); //populate the hidden field
  99. $('#link_checker_options input[name="submit"]').click(); //.submit() didn't work for some reason
  100. });
  101. });
  102. </script>