Index: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tipsy.js |
— | — | @@ -23,10 +23,11 @@ |
24 | 24 | var title = this.getTitle(); |
25 | 25 | if (title && this.enabled) { |
26 | 26 | var $tip = this.tip(); |
27 | | - |
28 | 27 | $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title); |
29 | 28 | $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity |
30 | | - $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body); |
| 29 | + // the remove strips events |
| 30 | + //$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body); |
| 31 | + $tip.css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body); |
31 | 32 | |
32 | 33 | var pos = $.extend({}, this.$element.offset(), { |
33 | 34 | width: this.$element[0].offsetWidth, |
— | — | @@ -71,12 +72,14 @@ |
72 | 73 | } |
73 | 74 | } |
74 | 75 | }, |
75 | | - |
| 76 | + |
76 | 77 | hide: function() { |
77 | | - if (this.options.fade) { |
78 | | - this.tip().stop().fadeOut(function() { $(this).remove(); }); |
79 | | - } else { |
80 | | - this.tip().remove(); |
| 78 | + if (!this.sticky) { |
| 79 | + if (this.options.fade) { |
| 80 | + this.tip().stop().fadeOut(function() { $(this).hide(); }); |
| 81 | + } else { |
| 82 | + this.tip().hide(); |
| 83 | + } |
81 | 84 | } |
82 | 85 | }, |
83 | 86 | |
— | — | @@ -86,10 +89,10 @@ |
87 | 90 | var title, o = this.options; |
88 | 91 | if (typeof o.title == 'string') { |
89 | 92 | title = $e.attr(o.title == 'title' ? 'original-title' : o.title); |
| 93 | + title = ('' + title).replace(/(^\s*|\s*$)/, ""); |
90 | 94 | } else if (typeof o.title == 'function') { |
91 | 95 | title = o.title.call($e[0]); |
92 | 96 | } |
93 | | - title = ('' + title).replace(/(^\s*|\s*$)/, ""); |
94 | 97 | return title || o.fallback; |
95 | 98 | }, |
96 | 99 | |
— | — | @@ -137,7 +140,7 @@ |
138 | 141 | setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn); |
139 | 142 | } |
140 | 143 | }; |
141 | | - |
| 144 | + |
142 | 145 | function leave() { |
143 | 146 | var tipsy = get(this); |
144 | 147 | tipsy.hoverState = 'out'; |
Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js |
— | — | @@ -94,7 +94,9 @@ |
95 | 95 | "mwe-upwiz-tooltip-sign": "You can use your wiki User name or your real name. In both cases, this will be linked to your wiki User page", |
96 | 96 | "mwe-upwiz-tooltip-title": "A short title for the image. You may use plain language with spaces, but no line breaks. This title must be unlike all other titles in this wiki.", |
97 | 97 | "mwe-upwiz-tooltip-description": "Briefly describe everything notable about the work. For a photo, mention the main things that are depicted, the occasion or the place.", |
98 | | - "mwe-upwiz-tooltip-other": "Any other information you want to include about this work. You may use wikitext code." |
| 98 | + "mwe-upwiz-tooltip-other": "Any other information you want to include about this work. You may use wikitext code.", |
| 99 | + |
| 100 | + "mwe-upwiz-tooltip-more-info": "Learn more." |
99 | 101 | |
100 | 102 | } ); |
101 | 103 | |
— | — | @@ -978,8 +980,8 @@ |
979 | 981 | $j(_this.languageMenu).addClass('mwe-upwiz-desc-lang-select'); |
980 | 982 | _this.description = $j('<textarea name="desc" rows="2" cols="36" class="mwe-upwiz-desc-lang-text"></textarea>') |
981 | 983 | .attr( 'title', gM( 'mwe-upwiz-tooltip-description' ) ) |
982 | | - .tipsy( { gravity: 'w', trigger: 'focus' } ) |
983 | | - .growTextArea(); |
| 984 | + .growTextArea() |
| 985 | + .tipsyPlus( { plus: 'even more stuff' } ); |
984 | 986 | _this.div = $j('<div class="mwe-upwiz-desc-lang-container"></div>') |
985 | 987 | .append( _this.languageMenu ) |
986 | 988 | .append( _this.description ); |
— | — | @@ -3117,6 +3119,46 @@ |
3118 | 3120 | |
3119 | 3121 | ( function( $j ) { |
3120 | 3122 | |
| 3123 | + $j.fn.tipsyPlus = function( options ) { |
| 3124 | + var titleOption = 'title'; |
| 3125 | + var htmlOption = false; |
| 3126 | + var el = this; |
| 3127 | + |
| 3128 | + if (options.plus) { |
| 3129 | + htmlOption = true; |
| 3130 | + titleOption = function() { |
| 3131 | + return $j( '<span />' ).append( |
| 3132 | + $j( this ).attr( 'original-title' ), |
| 3133 | + $j( '<a class="mwe-upwiz-tooltip-link"/>' ) |
| 3134 | + .attr( 'href', '#' ) |
| 3135 | + .append( gM( 'mwe-upwiz-tooltip-more-info' ) ) |
| 3136 | + .mouseenter( function() { |
| 3137 | + el.data('tipsy').sticky = true; |
| 3138 | + } ) |
| 3139 | + .mouseleave( function() { |
| 3140 | + el.data('tipsy').sticky = false; |
| 3141 | + } ) |
| 3142 | + .click( function() { |
| 3143 | + // show the wiki page with more |
| 3144 | + alert( options.plus ); |
| 3145 | + // pass this in as a closure to be called on dismiss |
| 3146 | + el.focus(); |
| 3147 | + el.data('tipsy').sticky = false; |
| 3148 | + } ) |
| 3149 | + ); |
| 3150 | + }; |
| 3151 | + } |
| 3152 | + |
| 3153 | + return this.tipsy( { |
| 3154 | + gravity: 'w', |
| 3155 | + trigger: 'focus', |
| 3156 | + title: titleOption, |
| 3157 | + html: htmlOption |
| 3158 | + } ); |
| 3159 | + |
| 3160 | + } |
| 3161 | + |
| 3162 | + |
3121 | 3163 | /** |
3122 | 3164 | * Prevent the closing of a window with a confirm message (the onbeforeunload event seems to |
3123 | 3165 | * work in most browsers |