]> git.mxchange.org Git - friendica-addons.git/commitdiff
viewsrc: show message source in a fancybox via ajax
authorFabio Comuni <fabrix.xm@gmail.com>
Wed, 28 Mar 2012 09:44:04 +0000 (11:44 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Wed, 28 Mar 2012 09:44:04 +0000 (11:44 +0200)
viewsrc/viewsrc.php

index e39fe8a6a7215b959ba339bc7789279405509a72..a610b76cac399f3a6215eedc2301c286f3d3384c 100644 (file)
 
 function viewsrc_install() {
        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() {
        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) {
        if(! local_user())