changeset 2813:91567b869c36

make js toggling of comments and transclusion tooltips less dependent on theme DOM structure
author RogerHaase <haaserd@gmail.com>
date Wed, 08 Oct 2014 09:21:37 -0700
parents 2f77d0af91e5
children c8c498da08dd
files MoinMoin/static/js/common.js MoinMoin/templates/itemviews.html MoinMoin/themes/basic/templates/show.html
diffstat 3 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/static/js/common.js	Tue Oct 07 13:53:13 2014 -0700
+++ b/MoinMoin/static/js/common.js	Wed Oct 08 09:21:37 2014 -0700
@@ -45,14 +45,14 @@
 MoinMoin.prototype.toggleComments = function () {
     "use strict";
     // Toggle visibility of every tag with class "comment"
-    var pageComments = $('.comment'),   // will hold list of elements with class "comment"
-        buttons = $('.moin-toggle-comments-button > a, button.moin-toggle-comments-button');
+    var pageComments = $('.comment'),
+        tooltips = $('.moin-toggle-comments-tooltip');
     if (pageComments.is(':hidden')) {
         pageComments.show();
-        buttons.attr('title', _("Hide comments"));
+        tooltips.attr('title', _("Hide comments"));
     } else {
         pageComments.hide();
-        buttons.attr('title', _("Show comments"));
+        tooltips.attr('title', _("Show comments"));
     }
     return false;  // do not scroll to top of page
 };
@@ -78,15 +78,15 @@
 MoinMoin.prototype.toggleTransclusionOverlays = function () {
     "use strict";
     var overlays = $('.moin-item-overlay-ul, .moin-item-overlay-lr'),
-        buttons;
+        tooltips;
     if (overlays.length > 0) {
-        buttons = $('.moin-transclusions-button > a, .moin-transclusions-button');
+        tooltips = $('.moin-transclusions-tooltip');
         if (overlays.is(':visible')) {
             overlays.hide();
-            buttons.attr('title', _("Show transclusions"));
+            tooltips.attr('title', _("Show transclusions"));
         } else {
             overlays.show();
-            buttons.attr('title', _("Hide transclusions"));
+            tooltips.attr('title', _("Hide transclusions"));
         }
     }
     return false;  // do not scroll to top of page
--- a/MoinMoin/templates/itemviews.html	Tue Oct 07 13:53:13 2014 -0700
+++ b/MoinMoin/templates/itemviews.html	Wed Oct 08 09:21:37 2014 -0700
@@ -67,13 +67,13 @@
 
             {%- if endpoint == 'special.comments' %}
                 <li class="moin-toggle-comments-button" style="display:none;">
-                    <a href="#" title="{{ title }}">{{ label }}</a>
+                    <a class="moin-toggle-comments-tooltip" href="#" title="{{ title }}">{{ label }}</a>
                 </li>
             {%- endif %}
 
         {% if endpoint == 'special.transclusions' -%}
             <li class="moin-transclusions-button" style="display:none;">
-                <a href="#" title="{{ title }}">{{ label }}</a>
+                <a class="moin-transclusions-tooltip" href="#" title="{{ title }}">{{ label }}</a>
             </li>
         {%- endif %}
             {%- if endpoint == 'special.supplementation' and fqname %}
--- a/MoinMoin/themes/basic/templates/show.html	Tue Oct 07 13:53:13 2014 -0700
+++ b/MoinMoin/themes/basic/templates/show.html	Wed Oct 08 09:21:37 2014 -0700
@@ -45,7 +45,7 @@
         </div>
         <div id="view-options" class="hidden">
             <button type="button"
-                    class="btn btn-default moin-user-action-special moin-toggle-comments-button"
+                    class="btn btn-default moin-user-action-special moin-toggle-comments-button moin-toggle-comments-tooltip"
                     data-toggle="button"
                     title="Show Comments">
                 <span class="pull-left">
@@ -54,7 +54,7 @@
                 </span>
             </button>
             <button type="button"
-                    class="btn btn-default moin-user-action-special moin-transclusions-button"
+                    class="btn btn-default moin-user-action-special moin-transclusions-button moin-transclusions-tooltip"
                     data-toggle="button"
                     title="Show Transclusions">
                 <span class="pull-left">