https://www.mediawiki.org/wiki/Special:Code/MediaWiki/108244

Revision: 108244
Author:   hashar
Date:     2012-01-06 16:02:05 +0000 (Fri, 06 Jan 2012)
Log Message:
-----------
(bug 29309) allow CSS class per tooltip (tipsy)

Let us use the new "className" upstream option to add a class per tooltip.

Partial merges of upstreams changes:
 - 602f2fe5 Per-tooltip classes
 - f5563566 Helper function for call or return idiom

Modified Paths:
--------------
    trunk/phase3/RELEASE-NOTES-1.19
    trunk/phase3/resources/jquery.tipsy/jquery.tipsy.js

Modified: trunk/phase3/RELEASE-NOTES-1.19
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.19     2012-01-06 15:56:08 UTC (rev 108243)
+++ trunk/phase3/RELEASE-NOTES-1.19     2012-01-06 16:02:05 UTC (rev 108244)
@@ -119,6 +119,7 @@
 * (bug 33456) Show $wgQueryCacheLimit on cached query pages.
 * (bug 10574) Add an option to allow all pages to be exported by 
Special:Export.
 * Use mw.jqueryMsg parser for message parsing to support PLURAL and GENDER
+* (bug 29309) allow CSS class per tooltip (tipsy)
 
 === Bug fixes in 1.19 ===
 * $wgUploadNavigationUrl should be used for file redlinks if.

Modified: trunk/phase3/resources/jquery.tipsy/jquery.tipsy.js
===================================================================
--- trunk/phase3/resources/jquery.tipsy/jquery.tipsy.js 2012-01-06 15:56:08 UTC 
(rev 108243)
+++ trunk/phase3/resources/jquery.tipsy/jquery.tipsy.js 2012-01-06 16:02:05 UTC 
(rev 108244)
@@ -4,7 +4,11 @@
 // releated under the MIT license
 
 (function($) {
-    
+
+       function maybeCall(thing, ctx) {
+               return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
+       };
+       
     function fixTitle($ele) {
         if ($ele.attr('title') || typeof($ele.attr('original-title')) != 
'string') {
             $ele.attr('original-title', $ele.attr('title') || 
'').removeAttr('title');
@@ -71,6 +75,9 @@
                 }
                 
                 $tip.css(tp).addClass('tipsy-' + gravity);
+                if (this.options.className) {
+                    $tip.addClass(maybeCall(this.options.className, 
this.$element[0]));
+                }
                 
                 if (this.options.fade) {
                     $tip.stop().css({opacity: 0, display: 'block', visibility: 
'visible'}).animate({opacity: this.options.opacity}, 100);
@@ -174,6 +181,7 @@
     };
     
     $.fn.tipsy.defaults = {
+        className: null,
         delayIn: 0,
         delayOut: 0,
         fade: true,


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to