| 1 |
(function( $ ) { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
$(document).ready( function() { |
| 5 |
|
| 6 |
enableViewMode(); |
| 7 |
|
| 8 |
$('#toggle-editing').click(function() { |
| 9 |
enableEditMode(); |
| 10 |
}); |
| 11 |
|
| 12 |
}); // end of (document).ready(); |
| 13 |
|
| 14 |
function enableViewMode() { |
| 15 |
|
| 16 |
$('.wrap h1').remove(); |
| 17 |
$('.fileedit-title').remove(); |
| 18 |
|
| 19 |
$('.wrap').prepend('<div class="fileedit-title"><h1>View Plugins</h1><button id="toggle-editing" class="button button-small button-secondary">Enable Editing</button></div>'); |
| 20 |
|
| 21 |
$('.fileedit-sub h2').text($(".fileedit-sub h2").text().replace("Editing", "Viewing")); |
| 22 |
|
| 23 |
// Plugin selector label |
| 24 |
$(".fileedit-sub label#theme-plugin-editor-selector").text($(".fileedit-sub label#theme-plugin-editor-selector").text().replace("edit", "view")); |
| 25 |
|
| 26 |
$('.editor-notices').hide(); |
| 27 |
$('.submit').hide(); |
| 28 |
|
| 29 |
} |
| 30 |
|
| 31 |
function enableEditMode() { |
| 32 |
|
| 33 |
$('.fileedit-title').remove(); |
| 34 |
$('.wrap').prepend('<div class="fileedit-title"><h1>Edit Plugins</h1></div>'); |
| 35 |
|
| 36 |
$('.fileedit-sub h2').text($(".fileedit-sub h2").text().replace("Viewing", "Editing")); |
| 37 |
|
| 38 |
$('.editor-notices').show(); |
| 39 |
$('.submit').show(); |
| 40 |
} |
| 41 |
|
| 42 |
})( jQuery ); |