r114206 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114205‎ | r114206 | r114207 >
Date:22:26, 19 March 2012
Author:awjrichards
Status:reverted
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/references.js (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/library/WURFL/Handlers/Utils.php (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/stylesheets/beta_common.css (modified) (history)
  • /branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/SearchTemplate.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/library/WURFL/Handlers/Utils.php
@@ -174,12 +174,12 @@
175175 }
176176
177177 /**
178 - * The nth($ordinal) occurance of $needle in $haystack or -1 if no match is found
 178+ * The nth($ordinal) occurrence of $needle in $haystack or -1 if no match is found
179179 * @param string $haystack
180180 * @param string $needle
181181 * @param int $ordinal
182182 * @throws InvalidArgumentException
183 - * @return int Char index of occurance
 183+ * @return int Char index of occurrence
184184 */
185185 public static function ordinalIndexOf($haystack, $needle, $ordinal) {
186186 if (is_null ( $haystack ) || empty ( $haystack )) {
@@ -206,7 +206,7 @@
207207 }
208208
209209 /**
210 - * First occurance of a / character
 210+ * First occurrence of a / character
211211 * @param string $string Haystack
212212 * @return int Char index
213213 */
@@ -216,7 +216,7 @@
217217 }
218218
219219 /**
220 - * Second occurance of a / character
 220+ * Second occurrence of a / character
221221 * @param string $string Haystack
222222 * @return int Char index
223223 */
@@ -228,7 +228,7 @@
229229 }
230230
231231 /**
232 - * First occurance of a space character
 232+ * First occurrence of a space character
233233 * @param string $string Haystack
234234 * @return int Char index
235235 */
@@ -238,7 +238,7 @@
239239 }
240240
241241 /**
242 - * First occurance of a ; character or length
 242+ * First occurrence of a ; character or length
243243 * @param string $string Haystack
244244 * @return int Char index
245245 */
@@ -247,7 +247,7 @@
248248 }
249249
250250 /**
251 - * First occurance of $toMatch string or length
 251+ * First occurrence of $toMatch string or length
252252 * @param string $string Haystack
253253 * @param string $toMatch Needle
254254 * @return int Char index
@@ -339,4 +339,4 @@
340340 public static function removeLocale($userAgent) {
341341 return preg_replace ( self::LANGUAGE_PATTERN, "", $userAgent, 1 );
342342 }
343 -}
\ No newline at end of file
 343+}
Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/references.js
@@ -1,7 +1,12 @@
22 if( typeof jQuery !== 'undefined' ) {
33 MobileFrontend.references = (function($) {
4 - var calculatePosition;
 4+ var calculatePosition, hashtest, options = {};
55
 6+ hashtest = window.location.hash.substr(1).match(/refspeed:([0-9]*)/);
 7+ options.animationSpeed = hashtest ? parseInt( hashtest[1], 10 ) : 500;
 8+ hashtest = window.location.hash.substr(1).match(/refanimation:([a-z]*)/);
 9+ options.animation = hashtest ? hashtest[1] : null;
 10+
611 function collect() {
712 var references = {};
813 $( 'ol.references li' ).each(function(i, el) {
@@ -28,27 +33,51 @@
2934
3035 function init() {
3136 $( '<div id="mf-references"><div></div></div>' ).hide().appendTo( document.body );
32 - var close = function( ev ) {
33 - $( '#mf-references' ).fadeOut( 500 );
34 - };
 37+ var close = function() {
 38+ var top;
 39+ lastLink = null;
 40+ if( options.animation === 'none' ) {
 41+ $( '#mf-references' ).hide();
 42+ } else if( options.animation === 'slide' ){
 43+ top = window.innerHeight + window.pageYOffset;
 44+ $( '#mf-references' ).show().animate( { top: top }, options.animationSpeed );
 45+ } else {
 46+ $( '#mf-references' ).fadeOut( options.animationSpeed );
 47+ }
 48+ }, lastLink;
3549 $( '<button>close</button>' ).click( close ).appendTo( '#mf-references' );
3650 $( '.mw-cite-backlink a' ).click( close );
3751
3852 var data, html, href, references = collect();
3953 $( 'sup a' ).click( function(ev) {
 54+ var top, oh;
4055 href = $(this).attr( 'href' );
4156 data = href && href.charAt(0) === '#' ?
4257 references[ href.substr( 1, href.length ) ] : null;
4358
44 - if( data ) {
45 - html = '<h3>[' + data.label + ']</h3>' + data.html;
 59+ if( !$("#mf-references").is(":visible") || lastLink !== href) {
 60+ lastLink = href;
 61+ if( data ) {
 62+ html = '<h3>[' + data.label + ']</h3>' + data.html;
 63+ } else {
 64+ html = $( '<a />' ).text( $(this).text() ).
 65+ attr( 'href', href ).appendTo('<div />').parent().html();
 66+ }
 67+ $( '#mf-references div' ).html( html );
 68+ calculatePosition();
 69+ if( options.animation === 'none' ) {
 70+ $( '#mf-references' ).show();
 71+ } else if( options.animation === 'slide' ){
 72+ top = window.innerHeight + window.pageYOffset;
 73+ oh = $( '#mf-references' ).outerHeight();
 74+ $( '#mf-references' ).show().css( { 'top': top } ).
 75+ animate( { top: top - oh }, options.animationSpeed );
 76+ } else {
 77+ $( '#mf-references' ).fadeIn( options.animationSpeed );
 78+ }
4679 } else {
47 - html = $( '<a />' ).text( $(this).text() ).
48 - attr( 'href', href ).appendTo('<div />').parent().html();
 80+ close();
4981 }
50 - $( '#mf-references div' ).html( html );
51 - $( '#mf-references' ).fadeIn( 1000 );
52 - calculatePosition();
5382 ev.preventDefault();
5483 });
5584 }
Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/stylesheets/beta_common.css
@@ -854,7 +854,7 @@
855855 left: 0;
856856 right: 0;
857857 background-color: #E4E4E4;
858 - padding: 22px 34px;
 858+ padding: 22px;
859859 -webkit-box-shadow: 0px -20px 10px -16px #aaa;
860860 -moz-box-shadow: 0px -20px 10px -16px #aaa;
861861 -o-box-shadow: 0px -20px 10px -16px #aaa;
@@ -866,8 +866,8 @@
867867
868868 #mf-references button {
869869 top: 22px;
870 - right: 16px; /* padding of mf-references - width 18 */
871 - width: 18px;
 870+ right: 22px; /* padding of #content_wrapper */
 871+ width: 16px;
872872 height: 12px;
873873 background: url(images/close-button-beta.png) no-repeat scroll 0 0 transparent;
874874 margin: 0;
Index: branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/SearchTemplate.php
@@ -26,7 +26,7 @@
2727
2828 $languageSelection = $this->data['buildLanguageSelection'] . '<br/>';
2929 $languageSelectionText = '<b>' . $this->data['messages']['mobile-frontend-language'] . ':</b><br/>';
30 - $languageSelectionDiv = '<div id="languageselection">' . $languageSelectionText . $languageSelection . '</div>';
 30+ $languageSelectionDiv = $languageSelectionText . $languageSelection;
3131
3232 $searchWebkitHtml = <<<HTML
3333 <div id='header'>
Property changes on: branches/wmf/1.19wmf1/extensions/MobileFrontend
___________________________________________________________________
Modified: svn:mergeinfo
3434 Merged /trunk/extensions/MobileFrontend:r114134,114136,114144-114145,114150,114152,114157

Follow-up revisions

RevisionCommit summaryAuthorDate
r114223Revert r114221,r114216,r114213,r114207,r114206,r114205,r114203,r114202,r11420...awjrichards00:26, 20 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r114134make references close on a second click...jdlrobson13:03, 19 March 2012
r114136allow experimentation with animation speed...jdlrobson13:19, 19 March 2012
r114144Many other occurance/occurence typosreedy14:59, 19 March 2012
r114145remove languageselection div...jdlrobson15:12, 19 March 2012
r114150make references line up with content_wrapper...jdlrobson16:32, 19 March 2012
r114152track last link...jdlrobson16:40, 19 March 2012
r114157provide different animations for references...jdlrobson17:17, 19 March 2012

Status & tagging log