Move post widget's image lightbox setup from template to resources section, so it doesn't run once per post on the page (and thus make duplicate lightboxes and takes more clicks to make the lightbox go away
diff --git a/Allura/allura/lib/widgets/discuss.py b/Allura/allura/lib/widgets/discuss.py
index 99c0400..a527dd9 100644
--- a/Allura/allura/lib/widgets/discuss.py
+++ b/Allura/allura/lib/widgets/discuss.py
@@ -300,6 +300,11 @@
         for w in self.widgets.itervalues():
             for r in w.resources():
                 yield r
+        yield ew.CSSScript('''
+        div.moderate {
+            color:grey;
+        }
+        ''')
         yield ew.JSLink('js/jquery.lightbox_me.js')
         yield ew.JSScript('''
         (function () {
@@ -415,6 +420,19 @@
                     });
                 }
             });
+
+            //lightbox_me script to create lightbox of attached images
+            $('.lightbox').click(function(e) {
+                var image_source = $(this).data("src");
+                var image = $('#lightbox').find('img:first');
+                image.attr("src", image_source);
+
+                $('#lightbox').lightbox_me({
+                    centered: true
+                });
+
+                e.preventDefault();
+            });
         }());
         ''')
 
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index ec1876b..e387c4b 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -176,33 +176,3 @@
   </div>
 
 </div>
-
-{% block extra_css %}
-<style type="text/css">
-    div.moderate {
-        color:grey;
-    }
-</style>
-{% endblock %}
-
-{% block extra_js %}
-<script type="text/javascript">
-
-    $(document).ready( function(){
-        //lightbox_me script to create lightbox of attached images
-        $('.lightbox').click(function(e) {
-            var image_source = $(this).data("src");
-            var image = $('#lightbox').find('img:first');
-            image.attr("src", image_source);
-
-            $('#lightbox').lightbox_me({
-                centered: true
-            });
-
-            e.preventDefault();
-        });
-    });
-
-</script>
-
-{% endblock %}
\ No newline at end of file