| 1 |
/*! |
| 2 |
* Admin screen helper for Gianism |
| 3 |
*/ |
| 4 |
|
| 5 |
jQuery(document).ready(function ($) { |
| 6 |
|
| 7 |
"use strict"; |
| 8 |
|
| 9 |
// Create appendix |
| 10 |
$('.gianism-wrap').find('h3,caption').each(function (index, elt) { |
| 11 |
$(elt).attr('id', 'index_' + index); |
| 12 |
$('#index-list').append('<li><a href="#index_' + index + '">' + $(elt).text() + '</a></li>'); |
| 13 |
}); |
| 14 |
|
| 15 |
// Notice dismiss |
| 16 |
$('.gianism-admin-notice').click(function(e){ |
| 17 |
e.preventDefault(); |
| 18 |
var $btn = $(this); |
| 19 |
$.get( $btn.attr('data-endpoint') ).done(function(response){ |
| 20 |
if ( response.success ) { |
| 21 |
$btn.parents('div.error').remove(); |
| 22 |
} else { |
| 23 |
window.alert( 'Error' ); |
| 24 |
} |
| 25 |
}).fail(function(response){ |
| 26 |
window.alert(response.responseJSON.data); |
| 27 |
}); |
| 28 |
}); |
| 29 |
}); |