1(function ($) { 2 3 /** 4 * Copyright 2012, Digital Fusion 5 * Licensed under the MIT license. 6 * http://teamdf.com/jquery-plugins/license/ 7 * 8 * @author Sam Sehnert 9 * @desc A small plugin that checks whether elements are within 10 * the user visible viewport of a web browser. 11 * only accounts for vertical position, not horizontal. 12 */ 13 14 $.fn.visible = function (partial) { 15 16 var $t = $(this), 17 $w = $(window), 18 viewTop = $w.scrollTop(), 19 viewBottom = viewTop + $w.height(), 20 _top = $t.offset().top, 21 _bottom = _top + $t.height(), 22 compareTop = partial === true ? _bottom : _top, 23 compareBottom = partial === true ? _top : _bottom; 24 25 return ((compareBottom <= viewBottom) && (compareTop >= viewTop)); 26 27 }; 28 29})(jQuery); 30// IIFE - Immediately Invoked Function Expression 31 32var ssbPlugin = ssbPlugin || {}; 33 34 35(function ($, window, document) { 36 'use strict'; 37 38 39 function absint($int) { 40 return parseInt($int, 10); 41 } 42 43 44 var ssbPostData = {}; 45 ssbPlugin.fetchFacebookShares = function() { 46 /** 47 * Run all the API calls 48 */ 49 50 $.when( 51 $.get('https://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=' + ssb_post_url), 52 $.get('https://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=' + ssb_alternate_post_url ) 53 ) 54 .then(function(a, b) { 55 56 if('undefined' !== typeof a[0].share) { 57 var f1 = absint(a[0].share.share_count); 58 var f2 = absint(a[0].share.comment_count); 59 if('undefined' !== typeof a[0].og_object){ 60 var f3 = absint(a[0].og_object.likes.summary.total_count); 61 } else { 62 var f3 = 0; 63 } 64 var fShares = f1 + f2 + f3; 65 if(ssb_alternate_post_url) { 66 if (typeof b[0].share !== 'undefined') { 67 var f4 = absint(b[0].share.share_count); 68 var f5 = absint(b[0].share.comment_count); 69 } else { 70 var f4 = 0, f5 = 0; 71 } 72 if (typeof b[0].og_object !== 'undefined') { 73 var f6 = absint(b[0].og_object.likes.summary.total_count); 74 } else { 75 var f6 = 0 76 } 77 var fShares2 = f4 + f5 + f6; 78 if (fShares !== fShares2) { 79 fShares = fShares + fShares2; 80 } 81 } 82 83 ssbPostData = { 84 action: 'ssb_facebook_shares_update', 85 post_id: ssb_post_id, 86 share_counts: fShares 87 }; 88 89 $.post(ssb_admin_ajax, ssbPostData); 90 } 91 }); 92 } 93 94 95 // Listen for the jQuery ready event on the document 96 $(function () { 97 98 // The DOM is ready! 99 if ($('div[class*="simplesocialbuttons-float"]').length > 0) { 100 $('body').addClass('body_has_simplesocialbuttons'); 101 } 102 103 }); 104 105 $(window).load(function () { 106 var allMods = $(".simplesocialbuttons_inline"); 107 108 // Already visible modules 109 allMods.each(function (i, el) { 110 var el = $(el); 111 if (el.visible(true)) { 112 el.addClass('simplesocialbuttons-inline-in'); 113 } 114 }); 115 116 $(window).scroll(function (event) { 117 118 allMods.each(function (i, el) { 119 var el = $(el); 120 if (el.visible(true)) { 121 el.addClass('simplesocialbuttons-inline-in'); 122 } 123 }); 124 125 }); 126 // $('.simplesocialbuttons_inline').addClass('simplesocialbuttons-inline-in'); 127 var sidebarwidth = $('div[class*="simplesocialbuttons-float"]>a:first-child').outerWidth(true); 128 $('div[class*="simplesocialbuttons-float"]').css('width', sidebarwidth + 'px'); 129 $('.simplesocialbuttons.ssb_counter-activate:not(.simplesocial-round-txt):not(.simplesocial-round-icon):not(.simplesocial-simple-icons) button:not(.simplesocial-viber-share):not(.simplesocial-whatsapp-share):not(.simplesocial-msng-share):not(.simplesocial-email-share):not(.simplesocial-print-share):not(.simplesocial-linkedin-share)').each(function(){ 130 var $elWidth = $(this).children('.ssb_counter').outerWidth(); 131 $(this).css('padding-right', $elWidth + 10); 132 console.log($elWidth, $elWidth + 10, $(this).attr('class')); 133 }); 134 // var sidebaroffset = $(window).width() - 1100; 135 // if($('.simplesocialbuttons-float-left-post').length>0){ 136 // $('.simplesocialbuttons-float-left-post').css('left', sidebaroffset/2+'px'); 137 // $('.simplesocialbuttons-float-left-post').removeClass('float-touched-sidebar'); 138 // } 139 // if($('.simplesocialbuttons-float-right-post').length>0){ 140 // $('.simplesocialbuttons-float-right-post').css('right', sidebaroffset/2+'px'); 141 // $('.simplesocialbuttons-float-left-post').removeClass('float-touched-sidebar'); 142 // $('.simplesocialbuttons-float-right-post').removeClass('float-touched-sidebar'); 143 // } 144 // if(sidebaroffset/2 <= 50){ 145 // $('.simplesocialbuttons-float-left-post').addClass('float-touched-sidebar'); 146 // $('.simplesocialbuttons-float-right-post').addClass('float-touched-sidebar'); 147 // } 148 }); 149 // $(window).on('resize',function(){ 150 // var sidebaroffset = $(window).width() - 1100; 151 // if($('.simplesocialbuttons-float-left-post').length>0){ 152 // $('.simplesocialbuttons-float-left-post').css('left', sidebaroffset/2+'px'); 153 // $('.simplesocialbuttons-float-left-post').removeClass('float-touched-sidebar'); 154 // } 155 // if($('.simplesocialbuttons-float-right-post').length>0){ 156 // $('.simplesocialbuttons-float-right-post').css('right', sidebaroffset/2+'px'); 157 // $('.simplesocialbuttons-float-left-post').removeClass('float-touched-sidebar'); 158 // } 159 // if(sidebaroffset/2 <= 50){ 160 // $('.simplesocialbuttons-float-left-post').addClass('float-touched-sidebar'); 161 // } 162 // }); 163 164 165 // $(window).on('scroll', function(){ 166 // if($('.simplesocialbuttons-float-left-post').length>0){ 167 // if($(window).scrollTop() >= 500){ 168 // $('.simplesocialbuttons-float-left-post').addClass('float-in') 169 // }else{ 170 // $('.simplesocialbuttons-float-left-post').removeClass('float-in') 171 // } 172 // } 173 // if($('.simplesocialbuttons-float-right-post').length>0){ 174 // if($(window).scrollTop() >= 500){ 175 // $('.simplesocialbuttons-float-right-post').addClass('float-in') 176 // }else{ 177 // $('.simplesocialbuttons-float-right-post').removeClass('float-in') 178 // } 179 // } 180 // }) 181 182}(window.jQuery, window, document)); 183 184function docLoadedFun(){ 185 var hideSidebarButton = '<span class="ssb-hide-floating-bar"> <svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 370.814 370.814"><path d="M292.92 24.848L268.781 0 77.895 185.401l190.886 185.413 24.139-24.853-165.282-160.56"></path></svg> </span>'; 186 if(document.querySelector('div[class*="simplesocialbuttons-float"]')){ 187 document.querySelector('div[class*="simplesocialbuttons-float"]').insertAdjacentHTML( 'beforeend', hideSidebarButton ) 188 document.querySelector('.ssb-hide-floating-bar').addEventListener( 'click' , toggleSidebarButtons) 189} 190} 191document.addEventListener( 'DOMContentLoaded', docLoadedFun ); 192 193function toggleSidebarButtons(){ 194 var leftSidebar = document.querySelector('div[class*="simplesocialbuttons-float"]'); 195 leftSidebar.classList.toggle('ssb-hide-float-buttons') 196}
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.