1(function( $ ) { 2 'use strict'; 3 4 $(document).ready(function() { 5 6 /* 7 * click handler 8 */ 9 $('.social-rocket-button, .social-rocket-floating-button, .social-rocket-tweet').on('click',function(e){ 10 11 if ( $( this ).hasClass( 'social-rocket-no-pop' ) ) { 12 $( this ).find( 'a' ).removeAttr( 'target' ); 13 return; 14 } 15 16 e.preventDefault(); 17 18 var href = $( this ).find('a').attr( 'href' ); 19 var network = $(this).data('network'); 20 var height = 500; 21 var width = 500; 22 23 if ( network === 'pinterest' ) { 24 var hasMedia = href.indexOf('&media=') > 0 ? true : false; 25 if ( ! hasMedia ) { 26 var el = document.createElement('script'); 27 el.setAttribute('type','text/javascript'); 28 el.setAttribute('charset','UTF-8'); 29 el.setAttribute('src','//assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999); 30 document.body.appendChild(el); 31 return false; 32 } 33 height = 900; 34 width = 800; 35 } 36 37 var top = window.screenY + (window.innerHeight - height) / 2; 38 var left = window.screenX + (window.innerWidth - width) / 2; 39 var windowFeatures = 'height=' + height + ',width=' + width + ',top=' + top + ',left=' + left; 40 var instance = window.open( href, '_blank', windowFeatures ); 41 42 return false; 43 }); 44 45 46 /* 47 * hover handler 48 */ 49 /* 50 $('.social-rocket-button').on('mouseenter',function(){ 51 // reserved for future use 52 }); 53 54 $('.social-rocket-button').on('mouseleave',function(){ 55 // reserved for future use 56 }); 57 */ 58 59 60 /* 61 * More button 62 */ 63 $( document ).on( 'click', '.social-rocket-more-button', function( e ) { 64 65 e.preventDefault(); 66 67 var $parent; 68 var $toggle = $( this ); 69 var $target = $toggle.next('.social-rocket-more-buttons'); 70 71 var togglePosition = $toggle.position(); 72 73 var isFloating = $toggle.closest( '.social-rocket-floating-buttons' ).length ? true : false; 74 var isInline = $toggle.closest( '.social-rocket-buttons' ).length ? true : false; 75 76 var left = 0; 77 var top = 0; 78 79 if ( isFloating ) { 80 $parent = $toggle.closest( '.social-rocket-floating-buttons' ); 81 $target.css({ 82 'width': ( $toggle.width() + 30 ) + 'px' 83 }); 84 } 85 86 if ( isInline ) { 87 $parent = $toggle.closest( '.social-rocket-buttons' ); 88 } 89 90 if ( $target.hasClass('bottom') ) { 91 left = togglePosition.left - $target.width() / 2; 92 top = togglePosition.top + $toggle.height() + 9; 93 } else { 94 left = togglePosition.left; 95 top = togglePosition.top - $target.height() - 30; 96 } 97 98 if ( $parent.hasClass( 'social-rocket-position-left' ) ) { 99 left = left + $toggle.width() + 5; 100 } else if ( $parent.hasClass( 'social-rocket-position-right' ) ) { 101 left = left - $toggle.width() - 35; 102 } else if ( $parent.hasClass( 'social-rocket-position-top' ) ) { 103 top = $toggle.height() + 5; 104 } 105 106 $target.css({ 107 'left': left + 'px', 108 'top': top + 'px' 109 }); 110 111 $target.toggle(); 112 e.stopPropagation(); 113 114 }); 115 116 $( document ).on( 'click', function (e) { 117 $( '.social-rocket-more-buttons' ).hide(); 118 }); 119 120 $( '.social-rocket-more-buttons' ).click(function ( e ) { 121 e.stopPropagation(); 122 }); 123 124 125 /* 126 * vertically center left/right floating buttons 127 */ 128 var $floatingButtonsToCenter = $('#social-rocket-floating-buttons.social-rocket-vertical-position-center'); 129 130 $floatingButtonsToCenter.css('top', ( window.innerHeight - $('#social-rocket-floating-buttons').height() ) / 2 ); 131 132 $(window).on( 'resize', function() { 133 $floatingButtonsToCenter.css('top', ( window.innerHeight - $('#social-rocket-floating-buttons').height() ) / 2 ); 134 }); 135 136 /* 137 * position top floating buttons if WP admin bar present 138 */ 139 var $floatingButtonsToPosition = $('.admin-bar .social-rocket-floating-buttons.social-rocket-position-top'); 140 var floatingButtonsPositionFix = function() { 141 if ( $('#wpadminbar').css('position') === 'fixed' ) { 142 $floatingButtonsToPosition.css('top',''); 143 return; 144 } 145 var adminBarHeight = $('#wpadminbar').height(); 146 var scrollPosition = $(window).scrollTop(); 147 var buttonsOffset = $floatingButtonsToPosition.offset().top; 148 $floatingButtonsToPosition.css('top',( adminBarHeight - scrollPosition > 0 ? adminBarHeight - scrollPosition : 0 )+'px'); 149 } 150 if ( $floatingButtonsToPosition.length ) { 151 $(window).on( 'scroll', function() { 152 floatingButtonsPositionFix();
153 }); 154 floatingButtonsPositionFix(); 155 } 156 157 /* 158 * add padding for top/bottom floating buttons 159 */ 160 var $topFloatingButtons = $('.social-rocket-floating-buttons.social-rocket-position-top'); 161 var $bottomFloatingButtons = $('.social-rocket-floating-buttons.social-rocket-position-bottom'); 162 var floatButtonsPaddingFix = function() { 163 var buttonBarHeight; 164 if ( $topFloatingButtons.length ) { 165 buttonBarHeight = $topFloatingButtons.is(':visible') ? $topFloatingButtons.height() : 0; 166 $('body').css('padding-top',buttonBarHeight+'px'); 167 } 168 if ( $bottomFloatingButtons.length ) { 169 buttonBarHeight = $bottomFloatingButtons.is(':visible') ? $bottomFloatingButtons.height() : 0; 170 $('body').css('padding-bottom',buttonBarHeight+'px'); 171 } 172 } 173 if ( $topFloatingButtons.length || $bottomFloatingButtons.length ) { 174 $(window).on( 'resize', function() { 175 floatButtonsPaddingFix(); 176 }); 177 floatButtonsPaddingFix(); 178 } 179 180 }); 181 182})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.