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

Revision: 114206
Author:   awjrichards
Date:     2012-03-19 22:26:47 +0000 (Mon, 19 Mar 2012)
Log Message:
-----------
MFT r114134, r114136, r114144, r114145, r114150, r114152, r114157

Modified Paths:
--------------
    branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/references.js
    
branches/wmf/1.19wmf1/extensions/MobileFrontend/library/WURFL/Handlers/Utils.php
    branches/wmf/1.19wmf1/extensions/MobileFrontend/stylesheets/beta_common.css
    branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/SearchTemplate.php

Property Changed:
----------------
    branches/wmf/1.19wmf1/extensions/MobileFrontend/


Property changes on: branches/wmf/1.19wmf1/extensions/MobileFrontend
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk/extensions/MobileFrontend:99727,113463,113465-113466,113469-113472,113486,113488,113512,113553,113640,113642,113644-113645,113685,113693,113695,113714,113720-113721,113726,113730,113769-113771,113778,113807,113831-113832,113865-113866,113870-113872,113876,113880-113883,113885,113887,113897-113901,113930,113942,113971,113987,114005,114025,114100
   + 
/trunk/extensions/MobileFrontend:99727,113463,113465-113466,113469-113472,113486,113488,113512,113553,113640,113642,113644-113645,113685,113693,113695,113714,113720-113721,113726,113730,113769-113771,113778,113807,113831-113832,113865-113866,113870-113872,113876,113880-113883,113885,113887,113897-113901,113930,113942,113971,113987,114005,114025,114100,114134,114136,114144-114145,114150,114152,114157

Modified: 
branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/references.js
===================================================================
--- branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/references.js   
2012-03-19 22:25:24 UTC (rev 114205)
+++ branches/wmf/1.19wmf1/extensions/MobileFrontend/javascripts/references.js   
2012-03-19 22:26:47 UTC (rev 114206)
@@ -1,7 +1,12 @@
 if( typeof jQuery !== 'undefined' ) {
        MobileFrontend.references = (function($) {
-               var calculatePosition;
+               var calculatePosition, hashtest, options = {};
 
+               hashtest = 
window.location.hash.substr(1).match(/refspeed:([0-9]*)/);
+               options.animationSpeed = hashtest ? parseInt( hashtest[1], 10 ) 
: 500;
+               hashtest = 
window.location.hash.substr(1).match(/refanimation:([a-z]*)/);
+               options.animation = hashtest ? hashtest[1] : null;
+
                function collect() {
                        var references = {};
                        $( 'ol.references li' ).each(function(i, el) {
@@ -28,27 +33,51 @@
 
                function init() {
                        $( '<div id="mf-references"><div></div></div>' 
).hide().appendTo( document.body );
-                       var close = function( ev ) {
-                               $( '#mf-references' ).fadeOut( 500 );
-                       };
+                       var close = function() {
+                               var top;
+                               lastLink = null;
+                               if( options.animation === 'none' ) {
+                                       $( '#mf-references' ).hide();
+                               } else if( options.animation === 'slide' ){
+                                       top = window.innerHeight + 
window.pageYOffset;
+                                       $( '#mf-references' ).show().animate( { 
top: top }, options.animationSpeed );
+                               } else {
+                                       $( '#mf-references' ).fadeOut( 
options.animationSpeed );
+                               }
+                       }, lastLink;
                        $( '<button>close</button>' ).click( close ).appendTo( 
'#mf-references' );
                        $( '.mw-cite-backlink a' ).click( close );
                        
                        var data, html, href, references = collect();
                        $( 'sup a' ).click( function(ev) {
+                               var top, oh;
                                href = $(this).attr( 'href' );
                                data = href && href.charAt(0) === '#' ?
                                        references[ href.substr( 1, href.length 
) ] : null;
 
-                               if( data ) {
-                                       html = '<h3>[' + data.label + ']</h3>' 
+ data.html;
+                               if( !$("#mf-references").is(":visible") || 
lastLink !== href) {
+                                       lastLink = href;
+                                       if( data ) {
+                                               html = '<h3>[' + data.label + 
']</h3>' + data.html;
+                                       } else {
+                                               html = $( '<a />' ).text( 
$(this).text() ).
+                                                       attr( 'href', href 
).appendTo('<div />').parent().html();
+                                       }
+                                       $( '#mf-references div' ).html( html );
+                                       calculatePosition();
+                                       if( options.animation === 'none' ) {
+                                               $( '#mf-references' ).show();
+                                       } else if( options.animation === 
'slide' ){
+                                               top = window.innerHeight + 
window.pageYOffset;
+                                               oh = $( '#mf-references' 
).outerHeight();
+                                               $( '#mf-references' 
).show().css( { 'top': top } ).
+                                                       animate( { top: top - 
oh }, options.animationSpeed );
+                                       } else {
+                                               $( '#mf-references' ).fadeIn( 
options.animationSpeed );
+                                       }
                                } else {
-                                       html = $( '<a />' ).text( 
$(this).text() ).
-                                               attr( 'href', href 
).appendTo('<div />').parent().html();
+                                       close();
                                }
-                               $( '#mf-references div' ).html( html );
-                               $( '#mf-references' ).fadeIn( 1000 );
-                               calculatePosition();
                                ev.preventDefault();
                        });
                }

Modified: 
branches/wmf/1.19wmf1/extensions/MobileFrontend/library/WURFL/Handlers/Utils.php
===================================================================
--- 
branches/wmf/1.19wmf1/extensions/MobileFrontend/library/WURFL/Handlers/Utils.php
    2012-03-19 22:25:24 UTC (rev 114205)
+++ 
branches/wmf/1.19wmf1/extensions/MobileFrontend/library/WURFL/Handlers/Utils.php
    2012-03-19 22:26:47 UTC (rev 114206)
@@ -174,12 +174,12 @@
        }
        
        /**
-        * The nth($ordinal) occurance of $needle in $haystack or -1 if no 
match is found
+        * The nth($ordinal) occurrence of $needle in $haystack or -1 if no 
match is found
         * @param string $haystack
         * @param string $needle
         * @param int $ordinal
         * @throws InvalidArgumentException
-        * @return int Char index of occurance
+        * @return int Char index of occurrence
         */
        public static function ordinalIndexOf($haystack, $needle, $ordinal) {
                if (is_null ( $haystack ) || empty ( $haystack )) {
@@ -206,7 +206,7 @@
        }
        
        /**
-        * First occurance of a / character
+        * First occurrence of a / character
         * @param string $string Haystack
         * @return int Char index
         */
@@ -216,7 +216,7 @@
        }
        
        /**
-        * Second occurance of a / character
+        * Second occurrence of a / character
         * @param string $string Haystack
         * @return int Char index
         */
@@ -228,7 +228,7 @@
        }
        
        /**
-        * First occurance of a space character
+        * First occurrence of a space character
         * @param string $string Haystack
         * @return int Char index
         */
@@ -238,7 +238,7 @@
        }
        
        /**
-        * First occurance of a ; character or length
+        * First occurrence of a ; character or length
         * @param string $string Haystack
         * @return int Char index
         */
@@ -247,7 +247,7 @@
        }
        
        /**
-        * First occurance of $toMatch string or length
+        * First occurrence of $toMatch string or length
         * @param string $string Haystack
         * @param string $toMatch Needle
         * @return int Char index
@@ -339,4 +339,4 @@
        public static function removeLocale($userAgent) {
                return preg_replace ( self::LANGUAGE_PATTERN, "", $userAgent, 1 
);
        }
-}
\ No newline at end of file
+}

Modified: 
branches/wmf/1.19wmf1/extensions/MobileFrontend/stylesheets/beta_common.css
===================================================================
--- branches/wmf/1.19wmf1/extensions/MobileFrontend/stylesheets/beta_common.css 
2012-03-19 22:25:24 UTC (rev 114205)
+++ branches/wmf/1.19wmf1/extensions/MobileFrontend/stylesheets/beta_common.css 
2012-03-19 22:26:47 UTC (rev 114206)
@@ -854,7 +854,7 @@
        left: 0;
        right: 0;
        background-color: #E4E4E4;
-       padding: 22px 34px;
+       padding: 22px;
        -webkit-box-shadow: 0px -20px 10px -16px #aaa;
        -moz-box-shadow: 0px -20px 10px -16px #aaa;
        -o-box-shadow: 0px -20px 10px -16px #aaa;
@@ -866,8 +866,8 @@
 
 #mf-references button {
        top: 22px;
-       right: 16px; /* padding of mf-references - width 18 */
-       width: 18px;
+       right: 22px; /* padding of #content_wrapper */
+       width: 16px;
        height: 12px;
        background: url(images/close-button-beta.png) no-repeat scroll 0 0 
transparent;
        margin: 0;

Modified: 
branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/SearchTemplate.php
===================================================================
--- 
branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/SearchTemplate.php    
    2012-03-19 22:25:24 UTC (rev 114205)
+++ 
branches/wmf/1.19wmf1/extensions/MobileFrontend/templates/SearchTemplate.php    
    2012-03-19 22:26:47 UTC (rev 114206)
@@ -26,7 +26,7 @@
 
                $languageSelection = $this->data['buildLanguageSelection'] . 
'<br/>';
                $languageSelectionText = '<b>' . 
$this->data['messages']['mobile-frontend-language'] . ':</b><br/>';
-               $languageSelectionDiv = '<div id="languageselection">' . 
$languageSelectionText . $languageSelection . '</div>';
+               $languageSelectionDiv = $languageSelectionText . 
$languageSelection;
 
                $searchWebkitHtml = <<<HTML
                <div id='header'>


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

Reply via email to