1(function($) { 2 'use strict'; 3 4 var $bar = $('#mr-social-bar'); 5 if (!$bar.length) { 6 return; 7 } 8 9 var measureLabels = function() { 10 $bar.find('.mr-social-btn-wrap').each(function() { 11 var label = this.querySelector('.mr-social-label'); 12 if (!label) { 13 return; 14 } 15 var width = label.offsetWidth; 16 if (width > 0) { 17 this.style.setProperty('--label-w', width + 'px'); 18 } 19 }); 20 }; 21 var storageKey = 'mr_social_expanded'; 22 try { 23 if (localStorage.getItem(storageKey) === '1') { 24 $bar.addClass('is-expanded'); 25 } 26 } catch (e) {} 27 28 measureLabels(); 29 if (document.fonts && document.fonts.ready) { 30 document.fonts.ready.then(measureLabels); 31 } 32 33 $bar.on('click', '.mr-social-toggle', function(e) { 34 e.preventDefault(); 35 $bar.toggleClass('is-expanded'); 36 try { 37 localStorage.setItem(storageKey, $bar.hasClass('is-expanded') ? '1' : '0'); 38 } catch (e) {} 39 if ($bar.hasClass('is-expanded')) { 40 measureLabels(); 41 } 42 }); 43 44 $bar.on('click', '.mr-social-go-top', function(e) { 45 e.preventDefault(); 46 window.scrollTo({ top: 0, behavior: 'smooth' }); 47 }); 48 49 var $fbSlide = $('#mr-social-fb-slide'); 50 if ($fbSlide.length) { 51 var $fbInner = $fbSlide.find('#mr-social-fb-inner'); 52 var $fbPage = $fbSlide.find('.fb-page'); 53 var isOpen = false; 54 55 var syncFbHeight = function() { 56 if (!$fbPage.length) return; 57 var height = Math.max(420, window.innerHeight || document.documentElement.clientHeight || 500); 58 $fbPage.attr('data-height', height); 59 }; 60 61 var fbParsed = false; 62 var parseFb = function(retries) { 63 if (!$fbPage.length) return; 64 if (typeof window.FB !== 'undefined' && window.FB && window.FB.XFBML) { 65 window.FB.XFBML.parse($fbSlide[0]); 66 fbParsed = true; 67 } else if (retries > 0) { 68 setTimeout(function() { parseFb(retries - 1); }, 1000); 69 } 70 }; 71 72 $('#mr-social-fb-btn').on('click', function() { 73 isOpen = !isOpen; 74 if (isOpen) { 75 syncFbHeight(); 76 $fbInner.addClass('mr-social-panel-open'); 77 if (!fbParsed) { 78 setTimeout(function() { parseFb(5); }, 600); 79 } 80 } else { 81 $fbInner.removeClass('mr-social-panel-open'); 82 } 83 }); 84 85 $(window).on('resize', function() { 86 if (!isOpen) return; 87 syncFbHeight(); 88 parseFb(3); 89 }); 90 } 91 92})(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.