viewsrc: show message source in a fancybox via ajax

This commit is contained in:
Fabio Comuni 2012-03-28 11:44:04 +02:00
parent c92861618b
commit 5adb4ef803

View file

@ -11,13 +11,25 @@
function viewsrc_install() { function viewsrc_install() {
register_hook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu'); register_hook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu');
register_hook('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end');
} }
function viewsrc_uninstall() { function viewsrc_uninstall() {
unregister_hook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu'); unregister_hook('item_photo_menu', 'addon/viewsrc/viewsrc.php', 'viewsrc_item_photo_menu');
unregister_hook('page_end', 'addon/viewsrc/viewsrc.php', 'viewsrc_page_end');
} }
function viewsrc_page_end(&$a, &$o){
$a->page['htmlhead'] .= <<< EOS
<script>
$(function(){
$('a[href*="/viewsrc/"]').fancybox();
});
</script>
EOS;
}
function viewsrc_item_photo_menu(&$a,&$b) { function viewsrc_item_photo_menu(&$a,&$b) {
if(! local_user()) if(! local_user())