r108270 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108269‎ | r108270 | r108271 >
Date:19:20, 6 January 2012
Author:reedy
Status:ok
Tags:
Comment:
jquery.tipsy is in core (and REL1_18/1.18wmf1)
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizardHooks.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.css (deleted) (history)
  • /trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.error.gif (deleted) (history)
  • /trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.gif (deleted) (history)
  • /trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.help.gif (deleted) (history)
  • /trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.js (deleted) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardHooks.php
@@ -18,6 +18,7 @@
1919 'jquery.ui.datepicker',
2020 'jquery.ui.progressbar',
2121 'jquery.suggestions',
 22+ 'jquery.tipsy',
2223 'jquery.ui.widget',
2324 'mediawiki.language',
2425 'mediawiki.Uri',
@@ -34,14 +35,13 @@
3536 ),
3637 'scripts' => array(
3738 // jquery interface helpers
38 - 'resources/jquery/jquery.tipsy.js',
3939 'resources/jquery/jquery.morphCrossfade.js',
4040 'resources/jquery/jquery.validate.js',
4141 'resources/jquery/jquery.arrowSteps.js',
4242 'resources/jquery/jquery.autocomplete.js',
4343 'resources/jquery/jquery.spinner.js',
4444 'resources/jquery/jquery.removeCtrl.js',
45 - 'resources/jquery/jquery.showThumbCtrl.js',
 45+ 'resources/jquery/jquery.showThumbCtrl.js',
4646 'resources/jquery/jquery.pubsub.js',
4747
4848 // common utilities
@@ -99,7 +99,6 @@
100100 'UploadWizardPage.js'
101101 ),
102102 'styles' => array(
103 - 'resources/jquery/jquery.tipsy.css',
104103 'resources/uploadWizard.css',
105104 'resources/jquery/jquery.arrowSteps.css',
106105 'resources/jquery/jquery.mwCoolCats.css',
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.help.gif
Cannot display: file marked as a binary type.
svn:mime-type = image/gif
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.error.gif
Cannot display: file marked as a binary type.
svn:mime-type = image/gif
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.gif
Cannot display: file marked as a binary type.
svn:mime-type = image/gif
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.js
@@ -1,217 +0,0 @@
2 -// tipsy, facebook style tooltips for jquery
3 -// version 1.0.0a+
4 -// (c) 2008-2010 jason frame [jason@onehackoranother.com]
5 -// released under the MIT license
6 -
7 -(function($) {
8 -
9 - function Tipsy(element, options) {
10 - this.$element = $(element);
11 - this.options = options;
12 - this.enabled = true;
13 - this.displayed = false;
14 - this.fixTitle();
15 - }
16 -
17 - Tipsy.prototype = {
18 - show: function() {
19 - var title = this.getTitle();
20 - if (title && this.enabled) {
21 - var $tip = this.tip();
22 -
23 - $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
24 - $tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
25 - $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
26 -
27 - var pos = $.extend({}, this.$element.offset(), {
28 - width: this.$element[0].offsetWidth,
29 - height: this.$element[0].offsetHeight
30 - });
31 -
32 - var actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight;
33 - var gravity = (typeof this.options.gravity == 'function')
34 - ? this.options.gravity.call(this.$element[0])
35 - : this.options.gravity;
36 -
37 - var tp;
38 - switch (gravity.charAt(0)) {
39 - case 'n':
40 - tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
41 - break;
42 - case 's':
43 - tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
44 - break;
45 - case 'e':
46 - tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
47 - break;
48 - case 'w':
49 - tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
50 - break;
51 - }
52 -
53 - if (gravity.length == 2) {
54 - if (gravity.charAt(1) == 'w') {
55 - tp.left = pos.left + pos.width / 2 - 15;
56 - } else {
57 - tp.left = pos.left + pos.width / 2 - actualWidth + 15;
58 - }
59 - }
60 -
61 - $tip.css(tp).addClass('tipsy-' + gravity);
62 -
63 - if (this.options.fade) {
64 - $tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
65 - } else {
66 - $tip.css({visibility: 'visible', opacity: this.options.opacity});
67 - }
68 -
69 - this.displayed = true;
70 - }
71 - },
72 -
73 - hide: function() {
74 - if (this.options.fade) {
75 - this.tip().stop().fadeOut(function() { $(this).remove(); });
76 - } else {
77 - this.tip().remove();
78 - }
79 - this.displayed = false;
80 - },
81 -
82 - toggle: function() {
83 - if ( this.displayed ) {
84 - this.hide();
85 - } else {
86 - $('.mwe-upwiz-hint').each( function(i) { $(this).tipsy('hide'); } );
87 - this.show();
88 - }
89 - },
90 -
91 - fixTitle: function() {
92 - var $e = this.$element;
93 - if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
94 - $e.attr('original-title', $e.attr('title') || '').removeAttr('title');
95 - }
96 - },
97 -
98 - getTitle: function() {
99 - var title, $e = this.$element, o = this.options;
100 - this.fixTitle();
101 - var title, o = this.options;
102 - if (typeof o.title == 'string') {
103 - title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
104 - } else if (typeof o.title == 'function') {
105 - title = o.title.call($e[0]);
106 - }
107 - if ( typeof title === 'string' ) {
108 - title = ('' + title).replace(/(^\s*|\s*$)/, "");
109 - }
110 - return title || o.fallback;
111 - },
112 -
113 - tip: function() {
114 - if (!this.$tip) {
115 - this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
116 - }
117 - return this.$tip;
118 - },
119 -
120 - validate: function() {
121 - if (!this.$element[0].parentNode) {
122 - this.hide();
123 - this.$element = null;
124 - this.options = null;
125 - }
126 - },
127 -
128 - enable: function() { this.enabled = true; },
129 - disable: function() { this.enabled = false; },
130 - toggleEnabled: function() { this.enabled = !this.enabled; }
131 - };
132 -
133 - $.fn.tipsy = function(options) {
134 -
135 - if (options === true) {
136 - return this.data('tipsy');
137 - } else if (typeof options == 'string') {
138 - var tipsy = this.data('tipsy');
139 - if (tipsy) tipsy[options]();
140 - return this;
141 - }
142 -
143 - options = $.extend({}, $.fn.tipsy.defaults, options);
144 -
145 - function get(ele) {
146 - var tipsy = $.data(ele, 'tipsy');
147 - if (!tipsy) {
148 - tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
149 - $.data(ele, 'tipsy', tipsy);
150 - }
151 - return tipsy;
152 - }
153 -
154 - function enter() {
155 - var tipsy = get(this);
156 - tipsy.hoverState = 'in';
157 - if (options.delayIn == 0) {
158 - tipsy.show();
159 - } else {
160 - tipsy.fixTitle();
161 - setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
162 - }
163 - };
164 -
165 - function leave() {
166 - var tipsy = get(this);
167 - tipsy.hoverState = 'out';
168 - if (options.delayOut == 0) {
169 - tipsy.hide();
170 - } else {
171 - setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
172 - }
173 - };
174 -
175 - if (!options.live) this.each(function() { get(this); });
176 -
177 - if (options.trigger != 'manual') {
178 - var binder = options.live ? 'live' : 'bind',
179 - eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
180 - eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
181 - this[binder](eventIn, enter)[binder](eventOut, leave);
182 - }
183 -
184 - return this;
185 -
186 - };
187 -
188 - $.fn.tipsy.defaults = {
189 - delayIn: 0,
190 - delayOut: 0,
191 - fade: false,
192 - fallback: '',
193 - gravity: 'n',
194 - html: false,
195 - live: false,
196 - offset: 0,
197 - opacity: 0.8,
198 - title: 'title',
199 - trigger: 'hover'
200 - };
201 -
202 - // Overwrite this method to provide options on a per-element basis.
203 - // For example, you could store the gravity in a 'tipsy-gravity' attribute:
204 - // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
205 - // (remember - do not modify 'options' in place!)
206 - $.fn.tipsy.elementOptions = function(ele, options) {
207 - return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
208 - };
209 -
210 - $.fn.tipsy.autoNS = function() {
211 - return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
212 - };
213 -
214 - $.fn.tipsy.autoWE = function() {
215 - return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
216 - };
217 -
218 -})(jQuery);
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.tipsy.css
@@ -1,12 +0,0 @@
2 -.tipsy { padding: 5px; font-size: small; position: absolute; z-index: 100000; }
3 - .tipsy-inner { padding: 5px 8px 4px 8px; background-color:#e8f5ff; color: black; max-width: 200px; text-align: center; }
4 - .tipsy-inner { border-radius: 3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
5 - .tipsy-arrow { position: absolute; background: url('jquery.tipsy.help.gif') no-repeat top left; width: 9px; height: 5px; }
6 - .tipsy-n .tipsy-arrow { top: 0; left: 50%; margin-left: -4px; }
7 - .tipsy-nw .tipsy-arrow { top: 0; left: 10px; }
8 - .tipsy-ne .tipsy-arrow { top: 0; right: 10px; }
9 - .tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -4px; background-position: bottom left; }
10 - .tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; background-position: bottom left; }
11 - .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; background-position: bottom left; }
12 - .tipsy-e .tipsy-arrow { top: 50%; margin-top: -4px; right: 0; width: 5px; height: 9px; background-position: top right; }
13 - .tipsy-w .tipsy-arrow { top: 50%; margin-top: -4px; left: 0; width: 5px; height: 9px; }

Status & tagging log