Jack Phoenix has submitted this change and it was merged.

Change subject: * Stylized * Added typeof check for _gaq variable -- Google 
Analytics is not always there! * Added missing iPhone/iPad-related variables, 
which are only used here
......................................................................


* Stylized
* Added typeof check for _gaq variable -- Google Analytics is not always there!
* Added missing iPhone/iPad-related variables, which are only used here

Change-Id: Ic726d3f700cfb3e1f7baae336525b7bbd6cbdf84
---
M resources/js/social.js
1 file changed, 39 insertions(+), 27 deletions(-)

Approvals:
  Jack Phoenix: Verified; Looks good to me, approved



diff --git a/resources/js/social.js b/resources/js/social.js
index 94e714d..012da71 100644
--- a/resources/js/social.js
+++ b/resources/js/social.js
@@ -1,49 +1,61 @@
-(function ($) {
-       $(document).ready(function() {
+( function ( $ ) {
+       $( document ).ready( function() {
                WH.addScrollEffectToTOC();
-       });
+       } );
 
-       $(window).load(function() {
-               if ($('.twitter-share-button').length && (!$.browser.msie || 
$.browser.version > 7)) {
-
-                       $.getScript("https://platform.twitter.com/widgets.js";, 
function() {
-                               twttr.events.bind('tweet', function(event) {
-                                       if (event) {
+       $( window ).load( function() {
+               if ( $( '.twitter-share-button' ).length && ( !$.browser.msie 
|| $.browser.version > 7 ) ) {
+                       $.getScript( 'https://platform.twitter.com/widgets.js', 
function() {
+                               twttr.events.bind( 'tweet', function ( event ) {
+                                       if ( event ) {
                                                var targetUrl;
-                                               if (event.target && 
event.target.nodeName == 'IFRAME') {
-                                                       targetUrl = 
extractParamFromUri(event.target.src, 'url');
+                                               if ( event.target && 
event.target.nodeName == 'IFRAME' ) {
+                                                       targetUrl = 
extractParamFromUri( event.target.src, 'url' );
                                                }
-                                               _gaq.push(['_trackSocial', 
'twitter', 'tweet', targetUrl]);
+                                               if ( typeof _gaq !== 
'undefined' ) {
+                                                       _gaq.push( 
['_trackSocial', 'twitter', 'tweet', targetUrl] );
+                                               }
                                        }
-                               });
-
-                       });
+                               } );
+                       } );
                }
 
-               if (isiPhone < 0 && isiPad < 0 && $('.gplus1_button').length) {
+               var ua = navigator.userAgent.toLowerCase(),
+                       isiPad = ua.indexOf( 'ipad' ),
+                       isiPhone = ua.indexOf( 'iphone' );
+
+               if ( isiPhone < 0 && isiPad < 0 && $( '.gplus1_button' ).length 
) {
                        WH.setGooglePlusOneLangCode();
-                       var node2 = document.createElement('script');
+                       var node2 = document.createElement( 'script' );
                        node2.type = 'text/javascript';
                        node2.async = true;
                        node2.src = 'http://apis.google.com/js/plusone.js';
-                       $('body').append(node2);
+                       $( 'body' ).append( node2 );
                }
-               if (typeof WH.FB != 'undefined') WH.FB.init('new');
-               if (typeof WH.GP != 'undefined') WH.GP.init();
 
-               if ($('#pinterest').length) {
-                       var node3 = document.createElement('script');
+               // Init Facebook components
+               if ( typeof WH.FB != 'undefined' ) {
+                       WH.FB.init( 'new' );
+               }
+
+               // Init Google+ Sign In components
+               if ( typeof WH.GP != 'undefined' ) {
+                       WH.GP.init();
+               }
+
+               if ( $( '#pinterest' ).length ) {
+                       var node3 = document.createElement( 'script' );
                        node3.type = 'text/javascript';
                        node3.async = true;
                        node3.src = 'http://assets.pinterest.com/js/pinit.js';
-                       $('body').append(node3);
+                       $( 'body' ).append( node3 );
                }
 
-               if (typeof WH.imageFeedback != 'undefined') {
+               if ( typeof WH.imageFeedback != 'undefined' ) {
                        WH.imageFeedback();
                }
-               if (typeof WH.uciFeedback != 'undefined') {
+               if ( typeof WH.uciFeedback != 'undefined' ) {
                        WH.uciFeedback();
                }
-       });
-})(jQuery);
\ No newline at end of file
+       } );
+} )( jQuery );
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/134970
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic726d3f700cfb3e1f7baae336525b7bbd6cbdf84
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/skins/BlueSky
Gerrit-Branch: master
Gerrit-Owner: Jack Phoenix <j...@countervandalism.net>
Gerrit-Reviewer: Jack Phoenix <j...@countervandalism.net>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to