r57700 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57699‎ | r57700 | r57701 >
Date:09:28, 14 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
Merge r57686, toolbar prettiness updates and textbox autogrow
Modified paths:
  • /branches/wmf-deployment/extensions/LiquidThreads (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/classes/View.php (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/icons/edit-desat.png (deleted) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/icons/edit.png (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/icons/link-desat.png (deleted) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/icons/link.png (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/icons/quote.png (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/icons/quote.svg (deleted) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/icons/reply.png (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/jquery/jquery.autogrow.js (added) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/lqt.css (modified) (history)
  • /branches/wmf-deployment/extensions/LiquidThreads/lqt.js (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/LiquidThreads/jquery/jquery.autogrow.js
@@ -0,0 +1,133 @@
 2+/*
 3+ * Auto Expanding Text Area (1.2.2)
 4+ * by Chrys Bader (www.chrysbader.com)
 5+ * chrysb@gmail.com
 6+ *
 7+ * Special thanks to:
 8+ * Jake Chapa - jake@hybridstudio.com
 9+ * John Resig - jeresig@gmail.com
 10+ *
 11+ * Copyright (c) 2008 Chrys Bader (www.chrysbader.com)
 12+ * Dual licensed under the MIT (MIT-LICENSE.txt)
 13+ * and GPL (GPL-LICENSE.txt) licenses.
 14+ *
 15+ *
 16+ * NOTE: This script requires jQuery to work. Download jQuery at www.jquery.com
 17+ *
 18+ */
 19+
 20+(function($) {
 21+
 22+ var self = null;
 23+
 24+ $.fn.autogrow = function(o)
 25+ {
 26+ return this.each(function() {
 27+ new $.autogrow(this, o);
 28+ });
 29+ };
 30+
 31+
 32+ /**
 33+ * The autogrow object.
 34+ *
 35+ * @constructor
 36+ * @name $.autogrow
 37+ * @param Object e The textarea to create the autogrow for.
 38+ * @param Hash o A set of key/value pairs to set as configuration properties.
 39+ * @cat Plugins/autogrow
 40+ */
 41+
 42+ $.autogrow = function (e, o)
 43+ {
 44+ this.options = o || {};
 45+ this.dummy = null;
 46+ this.interval = null;
 47+ this.line_height = this.options.lineHeight || parseInt($(e).css('line-height'));
 48+ this.min_height = this.options.minHeight || parseInt($(e).css('min-height'));
 49+ this.max_height = this.options.maxHeight || parseInt($(e).css('max-height'));;
 50+ this.textarea = $(e);
 51+
 52+ if(this.line_height == NaN)
 53+ this.line_height = 0;
 54+
 55+ // Only one textarea activated at a time, the one being used
 56+ this.init();
 57+ };
 58+
 59+ $.autogrow.fn = $.autogrow.prototype = {
 60+ autogrow: '1.2.2'
 61+ };
 62+
 63+ $.autogrow.fn.extend = $.autogrow.extend = $.extend;
 64+
 65+ $.autogrow.fn.extend({
 66+
 67+ init: function() {
 68+ var self = this;
 69+ this.textarea.css({overflow: 'hidden', display: 'block'});
 70+ this.textarea.bind('focus', function() { self.startExpand() } ).bind('blur', function() { self.stopExpand() });
 71+ this.checkExpand();
 72+ },
 73+
 74+ startExpand: function() {
 75+ var self = this;
 76+ this.interval = window.setInterval(function() {self.checkExpand()}, 400);
 77+ },
 78+
 79+ stopExpand: function() {
 80+ clearInterval(this.interval);
 81+ },
 82+
 83+ checkExpand: function() {
 84+
 85+ if (this.dummy == null)
 86+ {
 87+ this.dummy = $('<div></div>');
 88+ this.dummy.css({
 89+ 'font-size' : this.textarea.css('font-size'),
 90+ 'font-family': this.textarea.css('font-family'),
 91+ 'width' : this.textarea.css('width'),
 92+ 'padding' : this.textarea.css('padding'),
 93+ 'line-height': this.line_height + 'px',
 94+ 'overflow-x' : 'hidden',
 95+ 'position' : 'absolute',
 96+ 'top' : 0,
 97+ 'left' : -9999
 98+ }).appendTo('body');
 99+ }
 100+
 101+ // Strip HTML tags
 102+ var html = this.textarea.val().replace(/(<|>)/g, '');
 103+
 104+ // IE is different, as per usual
 105+ if ($.browser.msie)
 106+ {
 107+ html = html.replace(/\n/g, '<BR>new');
 108+ }
 109+ else
 110+ {
 111+ html = html.replace(/\n/g, '<br>new');
 112+ }
 113+
 114+ if (this.dummy.html() != html)
 115+ {
 116+ this.dummy.html(html);
 117+
 118+ if (this.max_height > 0 && (this.dummy.height() + this.line_height > this.max_height))
 119+ {
 120+ this.textarea.css('overflow-y', 'auto');
 121+ }
 122+ else
 123+ {
 124+ this.textarea.css('overflow-y', 'hidden');
 125+ if (this.textarea.height() < this.dummy.height() + this.line_height || (this.dummy.height() < this.textarea.height()))
 126+ {
 127+ this.textarea.animate({height: (this.dummy.height() + this.line_height) + 'px'}, 100);
 128+ }
 129+ }
 130+ }
 131+ }
 132+
 133+ });
 134+})(jQuery);
\ No newline at end of file
Property changes on: branches/wmf-deployment/extensions/LiquidThreads/jquery/jquery.autogrow.js
___________________________________________________________________
Name: svn:eol-style
1135 + native
Name: svn:executable
2136 + *
Index: branches/wmf-deployment/extensions/LiquidThreads/lqt.css
@@ -1,4 +1,10 @@
22
 3+#wpTextbox1 {
 4+ /* Textareas in lqt use auto-sizing based on these properties */
 5+ height: 5em;
 6+ max-height: 10em;
 7+ min-height: 5em;
 8+}
39 .lqt_watchlist_messages_notice {
410 background-color: #eee;
511 border: 1px solid #ddd;
@@ -132,14 +138,13 @@
133139 list-style-type: none;
134140 padding-right: 0.6em;
135141 }
136 -
137142 #lqt_subject_field {
138143 margin-top: 0.7em;
139144 margin-bottom: 0.5em;
140145 width: 80%;
141146 }
142147
143 -li#ca-nstab-thread {
 148+body.skin-monobook li#ca-nstab-thread {
144149 /* from #ca-talk */
145150 margin-right: 1.6em;
146151 }
@@ -230,9 +235,8 @@
231236 }
232237
233238 .lqt-thread-actions-trigger {
234 - padding: 0.5em;
235239 margin-top: 8px;
236 - border: 1px transparent solid;
 240+ border: none;
237241 color: #002BB8;
238242 }
239243
@@ -249,15 +253,14 @@
250254 list-style: none;
251255 padding: 0;
252256 z-index: 10;
253 - margin-top: 8px;
 257+ margin-top: 0px;
254258
255259 }
256 -
257260 .lqt-thread-toolbar-command-list li {
258261 padding-left: 0.5em;
259262 padding-right: 0.5em;
260 - margin-top: 0;
261 - margin-bottom: 0;
 263+ margin-top: 0;
 264+ margin-bottom: 0;
262265 list-style-type: none;
263266 list-style-image: none;
264267 display: block;
@@ -274,16 +277,14 @@
275278 }
276279
277280 .lqt-thread-actions-icon {
 281+ display: block;
 282+ width: 1.5em;
 283+ height: 2em;
 284+ padding-left: 0.5em;
278285 background-image: url('icons/arrow-down-icon.png');
279 - background-position: center-bottom;
 286+ background-position: center center;
280287 background-repeat: no-repeat;
281 - height: 80%;
282 - width: 1em;
283 - height: 2em;
284 - padding-bottom: 0.2em;
285 - padding-left: 26px;
286288 }
287 -
288289 .lqt-talkpage-search {
289290 /*float: left;*/
290291 display: inline-block;
@@ -308,6 +309,8 @@
309310 height: 1px;
310311 padding: 0;
311312 margin: 0;
 313+ margin-left: 1em;
 314+ margin-bottom: -1px;
312315 background-image: url(images/break.png);
313316 background-position: bottom;
314317 background-repeat: repeat-x;
@@ -321,7 +324,7 @@
322325 }
323326
324327 .lqt-thread-replies {
325 - margin-left: 2em;
 328+ margin-left: 1em;
326329 }
327330
328331 .lqt-thread-topmost,
@@ -341,10 +344,12 @@
342345 background-image: url(images/corner.png);
343346 background-repeat: no-repeat;
344347 background-position: bottom left;
 348+ /* The space is caused by the use of a non-breaking space, so we need to use line-height here */
 349+ line-height: 1em;
345350 }
346351
347352 .lqt-post-wrapper {
348 - padding: 0.5em;
 353+ padding: 0.5em 1em;
349354 }
350355
351356 .lqt-thread-info-panel {
@@ -383,74 +388,54 @@
384389 background-repeat: no-repeat;
385390 padding-right: 8px;
386391 }
387 -
388 -.lqt-thread-toolbar-commands > .lqt-command > a {
389 - height: 1.25em;
390 - background-repeat: no-repeat;
391 - background-position: center;
 392+.lqt-command {
 393+ margin-top: 8px;
 394+ padding: 0;
392395 }
393 -
394 -.lqt-thread-toolbar-commands {
395 - height: 30px;
396 -}
397 -
398 -.lqt-command-reply {
399 - margin-right: 8px;
400 -}
401 -
402396 .lqt-thread-toolbar .lqt-command > a {
403397 display: block;
404398 }
405399
406 -.lqt-thread-toolbar-commands > .lqt-command-edit a {
407 - background-image: url(icons/edit.png);
408 - padding-left: 26px;
 400+.lqt-command-link a {
 401+ margin-left: 1em;
 402+ height: 2em;
 403+ width: 2em;
 404+ background-image: url(icons/link.png) !important;
 405+ background-repeat: no-repeat;
409406 }
410 -
411 -.lqt-thread-toolbar-commands > .lqt-command-reply a {
 407+.lqt-command-reply a {
 408+ margin-left: 1em;
 409+ height: 2em;
412410 background-image: url(icons/reply.png);
413 - background-position: left;
 411+ background-position: left center !important;
 412+ background-repeat: no-repeat;
414413 padding-left: 26px;
415 - margin-left: 8px;
 414+ line-height: 2em;
416415 }
417 -
418 -.lqt-thread-toolbar-commands > .lqt-command-history {
419 - margin-left: 8px;
420 -}
421 -
422416 .lqt-command-quote a {
 417+ margin-left: 1em;
 418+ height: 2em;
423419 background-image: url(icons/quote.png);
424 - margin-left: 8px;
425 - padding-left: 26px;
426420 background-position: left center !important;
427 -}
428 -
429 -.lqt-command-merge-to {
430 - margin-left: 8px;
431 -}
432 -
433 -.lqt-command-link a {
434 - background-image: url(icons/link.png) !important;
 421+ background-repeat: no-repeat;
435422 padding-left: 26px;
 423+ line-height: 2em;
436424 }
437 -
438 -ul.lqt-thread-toolbar-commands {
 425+.lqt-thread-toolbar-menu {
 426+ margin-top: 8px;
 427+ height: 2em;
 428+}
 429+.lqt-thread-toolbar-commands {
439430 list-style: none;
440431 padding: 0;
441432 margin: 0;
442433 line-height: 1em;
 434+ height: 1em;
443435 }
444 -
445436 .lqt-thread-toolbar-commands > .lqt-command,
446437 .lqt-thread-toolbar-menu {
447438 float: left;
448439 }
449 -
450 -.lqt-command {
451 - margin-top: 8px;
452 - padding: 0;
453 -}
454 -
455440 .lqt-thread-toolbar * {
456441 text-decoration: none !important;
457442 }
Index: branches/wmf-deployment/extensions/LiquidThreads/classes/View.php
@@ -631,15 +631,16 @@
632632 'href' => $thread->title()->getFullURL(),
633633 'enabled' => true, 'icon' => 'link.png',
634634 'tooltip' => wfMsgExt( 'lqt_permalink', 'parseinline' ) );
635 -
 635+ /*
636636 if ( $thread->root()->getTitle()->quickUserCan( 'edit' ) ) {
637637 $commands['edit'] = array(
638638 'label' => wfMsgExt( 'edit', 'parseinline' ),
639639 'href' => $this->talkpageUrl( $this->title, 'edit', $thread,
640 - true /* include fragment */, $this->request ),
 640+ true, $this->request ),
641641 'enabled' => true, 'icon' => 'edit.png',
642642 'tooltip' => wfMsgExt( 'edit', 'parseinline' ) );
643643 }
 644+ */
644645
645646 return $commands;
646647 }
@@ -702,6 +703,8 @@
703704 $wgOut->addExtensionStyle( "{$wgScriptPath}/extensions/LiquidThreads/jquery/jquery-ui-1.7.2.css" );
704705 }
705706
 707+ $wgOut->addScriptFile( "{$wgScriptPath}/extensions/LiquidThreads/jquery/jquery.autogrow.js" );
 708+
706709 $wgOut->addScriptFile( "{$wgScriptPath}/extensions/LiquidThreads/lqt.js" );
707710 $wgOut->addExtensionStyle( "{$wgScriptPath}/extensions/LiquidThreads/lqt.css?{$wgStyleVersion}" );
708711
@@ -770,7 +773,7 @@
771774 $commands = $this->threadCommands( $thread );
772775 $menuHTML = Xml::tags( 'ul', array( 'class' => 'lqt-thread-toolbar-command-list' ),
773776 $this->listItemsForCommands( $commands ) );
774 -
 777+
775778 $triggerText = Xml::tags( 'span', array( 'class' => 'lqt-thread-actions-icon' ),
776779 '&nbsp;' );
777780 $dropDownTrigger = Xml::tags( 'div',
@@ -783,7 +786,7 @@
784787 array( 'class' => 'lqt-thread-toolbar-menu' ),
785788 $dropDownTrigger );
786789 }
787 -
 790+
788791 $html .= implode( ' ', $headerParts );
789792
790793 $html = Xml::tags( 'ul', array( 'class' => 'lqt-thread-toolbar-commands' ), $html );
Index: branches/wmf-deployment/extensions/LiquidThreads/lqt.js
@@ -64,8 +64,8 @@
6565 // Buffer at the top, roughly enough to see the heading and one line
6666 targetOffset -= 100;
6767 $j('html,body').animate({scrollTop: targetOffset}, 'slow');
68 -
69 - $j(container).find('#wpTextbox1').focus();
 68+ // Auto-focus and set to auto-grow as well
 69+ $j(container).find('#wpTextbox1').focus().autogrow();
7070 // Focus the subject field if there is one. Overrides previous line.
7171 $j(container).find('#lqt_subject_field').focus();
7272 }
@@ -227,30 +227,25 @@
228228 toolbar.hide();
229229
230230 post.hover(
231 - function() {
232 - toolbar.fadeIn(100);
233 - liquidThreads.currentToolbar = toolbar;
234 - } /* over */,
235 - function() {
236 - if ( liquidThreads.currentToolbar &&
237 - liquidThreads.currentToolbar.is(toolbar) ) {
238 - liquidThreads.currentToolbar = null;
239 - }
240 -
241 - toolbar.fadeOut(20);
242 - }/*out */ );
 231+ function() {
 232+ toolbar.fadeIn(100);
 233+ liquidThreads.currentToolbar = toolbar;
 234+ },
 235+ function() {
 236+ if ( liquidThreads.currentToolbar &&
 237+ liquidThreads.currentToolbar.is(toolbar) ) {
 238+ liquidThreads.currentToolbar = null;
 239+ }
 240+ toolbar.fadeOut(20);
 241+ }
 242+ );
243243
244244 var menu = post.find('.lqt-thread-toolbar-command-list');
245245 var menuContainer = post.find( '.lqt-thread-toolbar-menu' );
246246 menu.remove().appendTo( menuContainer );
247247 menuContainer.find('.lqt-thread-toolbar-command-list').hide();
248 -
249 - var menuTrigger = menuContainer.find( '.lqt-thread-actions-trigger' );
250 -
251 - menuTrigger.hover( function() { menu.fadeIn(); } );
252 - toolbar.hover( function() {}, function() { menu.fadeOut(); } );
253 -
254 - menuTrigger.show();
 248+ menuContainer.hover( function() { menu.fadeIn(); }, function() { menu.fadeOut(); } );
 249+ menuContainer.find( '.lqt-thread-actions-trigger' ).show();
255250 },
256251
257252 'checkForUpdates' : function() {
@@ -612,5 +607,8 @@
613608
614609 // Set up periodic update checking
615610 setInterval( liquidThreads.checkForUpdates, 60000 );
 611+
 612+ // Autogrowing textarea - this only affects the new-topic page
 613+ $j('#wpTextbox1').autogrow();
616614 } );
617615
Index: branches/wmf-deployment/extensions/LiquidThreads/icons/edit-desat.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/wmf-deployment/extensions/LiquidThreads/icons/quote.svg
Cannot display: file marked as a binary type.
svn:mime-type = image/svg+xml
Index: branches/wmf-deployment/extensions/LiquidThreads/icons/link-desat.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/wmf-deployment/extensions/LiquidThreads/icons/link.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/wmf-deployment/extensions/LiquidThreads/icons/quote.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/wmf-deployment/extensions/LiquidThreads/icons/edit.png
Cannot display: file marked as a binary type.
svn:mime-type = image/png
Index: branches/wmf-deployment/extensions/LiquidThreads/icons/reply.png
@@ -1,5 +1,5 @@
22 �PNG
33 
44 -IHDR�j� tEXtSoftwareAdobe ImageReadyq�e<�PLTE������1`�P��d��H�Aj�%c�/d�9f�C{����"Z�N�H~�9x�Ls�h��([�&d�8q�5k�E}�!T�j��5q�=h�U��*i�K��K��K�En�+j�N�&f�������)]�,]�(Y�������H����<yƲ��M����끘�c��������<v����0o����L}�)^�������U��X��M�P�.^�6v�:v����5u�"U����Pu����������(d����Q��Q��Jp�������7s����6v�V��;{�p��&Y�V��F�����>{�!U� V�%W�#W�F�7g�V�ͦ�Ԫ�ӵ�څ��0n�3s�h��\~�a��M��G}����P��S��Y��������W��<q�=r�?r�,]�Z��������@v��������IDATx�b��
5 -�ly��@La+ ��D?Nnt�z��J � ����b��R �z�2ټ T� ��E�,R���zJ@��VQBI�ݐ����V�PF��.��,��h�Va��bS��(���+TΧ�� V5Iq����TΪՁs+��e����9?��#D�!�G6�54��_7),_��˴8.��;i1u/����aN�vPRH�A�@�f��h(`0b�;�؅�}q�%20�=�C�^7IEND�B`�
\ No newline at end of file
 5+IHDR�j� tEXtSoftwareAdobe ImageReadyq�e<�PLTE������z��Nn���ȶ�����_|���ϲ��������I�Aj�Jp�I�O�N�%X�*^�)\�2`�9h�Iy�Go�Pu����!V�'^�)a�,e�(Z�0e�3k�9g�Cv����������3n�7r�9q�=w�?x�?v�>s�E{�H~�Q��W��Z��d��h��$a�+h�9u�M��R��[��f�������������6�@tRNS����������������������������������������������������������������{�D�IDATx�t���0`\���*RwA8W����JLU������P2i᯹w����˻n�p��Zz�W~Y���1���j��H��z�&xQ�s�ʫ��MS���m�%xk�Y�wXk^hFk��^���N^�L�\�I���x�#.?�מ.�{�2� =��l�� B���ה��Ҕ���ª�1�aZ���. ��dg�9R�*r�
 6+�n)�&��c�+yA�IEND�B`�
\ No newline at end of file
Property changes on: branches/wmf-deployment/extensions/LiquidThreads
___________________________________________________________________
Name: svn:mergeinfo
67 - /branches/REL1_15/phase3/extensions/LiquidThreads:51646
/trunk/extensions/LiquidThreads:56151-57571,57651,57653-57654,57663,57667,57670-57671,57673
/trunk/phase3/extensions/LiquidThreads:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447
78 + /branches/REL1_15/phase3/extensions/LiquidThreads:51646
/trunk/extensions/LiquidThreads:56151-57571,57651,57653-57654,57663,57667,57670-57671,57673,57686
/trunk/phase3/extensions/LiquidThreads:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57686Lots of UI changes, mostly to do with the toolbar. Also added auto-grow funct...tparscal23:01, 13 October 2009

Status & tagging log