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 if('undefined' !== typeof a[0].share) { 56 var f1 = absint(a[0].share.share_count); 57 var f2 = absint(a[0].share.comment_count); 58 if('undefined' !== typeof a[0].og_object){ 59 var f3 = absint(a[0].og_object.likes.summary.total_count); 60 } else { 61 var f3 = 0; 62 } 63 var fShares = f1 + f2 + f3; 64 if(ssb_alternate_post_url) { 65 if (typeof b[0].share !== 'undefined') { 66 var f4 = absint(b[0].share.share_count); 67 var f5 = absint(b[0].share.comment_count); 68 } else { 69 var f4 = 0, f5 = 0; 70 } 71 if (typeof b[0].og_object !== 'undefined') { 72 var f6 = absint(b[0].og_object.likes.summary.total_count); 73 } else { 74 var f6 = 0 75 } 76 var fShares2 = f4 + f5 + f6; 77 if (fShares !== fShares2) { 78 fShares = fShares + fShares2; 79 } 80 } 81 82 ssbPostData = { 83 action: 'ssb_facebook_shares_update', 84 security: SSB.fb_share_nonce, 85 post_id: ssb_post_id, 86 share_counts: fShares 87 }; 88 89 $.post( SSB.ajax_url, 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 el = $(this); 131 setTimeout(function(){ 132 var $elWidth = el.children('.ssb_counter').innerWidth(); 133 el.css('padding-right', $elWidth + 10); 134 }, 100); 135 }); 136 // var sidebaroffset = $(window).width() - 1100; 137 // if($('.simplesocialbuttons-float-left-post').length>0){ 138 // $('.simplesocialbuttons-float-left-post').css('left', sidebaroffset/2+'px'); 139 // $('.simplesocialbuttons-float-left-post').removeClass('float-touched-sidebar'); 140 // } 141 // if($('.simplesocialbuttons-float-right-post').length>0){ 142 // $('.simplesocialbuttons-float-right-post').css('right', sidebaroffset/2+'px'); 143 // $('.simplesocialbuttons-float-left-post').removeClass('float-touched-sidebar'); 144 // $('.simplesocialbuttons-float-right-post').removeClass('float-touched-sidebar'); 145 // } 146 // if(sidebaroffset/2 <= 50){ 147 // $('.simplesocialbuttons-float-left-post').addClass('float-touched-sidebar'); 148 // $('.simplesocialbuttons-float-right-post').addClass('float-touched-sidebar'); 149 // } 150 }); 151 // $(window).on('resize',function(){ 152 // var sidebaroffset = $(window).width() - 1100; 153 // if($('.simplesocialbuttons-float-left-post').length>0){ 154 // $('.simplesocialbuttons-float-left-post').css('left', sidebaroffset/2+'px'); 155 // $('.simplesocialbuttons-float-left-post').removeClass('float-touched-sidebar'); 156 // } 157 // if($('.simplesocialbuttons-float-right-post').length>0){ 158 // $('.simplesocialbuttons-float-right-post').css('right', sidebaroffset/2+'px'); 159 // $('.simplesocialbuttons-float-left-post').removeClass('float-touched-sidebar'); 160 // } 161 // if(sidebaroffset/2 <= 50){ 162 // $('.simplesocialbuttons-float-left-post').addClass('float-touched-sidebar'); 163 // } 164 // }); 165 166 167 // $(window).on('scroll', function(){ 168 // if($('.simplesocialbuttons-float-left-post').length>0){ 169 // if($(window).scrollTop() >= 500){ 170 // $('.simplesocialbuttons-float-left-post').addClass('float-in') 171 // }else{ 172 // $('.simplesocialbuttons-float-left-post').removeClass('float-in') 173 // } 174 // } 175 // if($('.simplesocialbuttons-float-right-post').length>0){ 176 // if($(window).scrollTop() >= 500){ 177 // $('.simplesocialbuttons-float-right-post').addClass('float-in') 178 // }else{ 179 // $('.simplesocialbuttons-float-right-post').removeClass('float-in') 180 // } 181 // } 182 // }) 183 184}(window.jQuery, window, document)); 185 186function docLoadedFun(){ 187 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>'; 188 if(document.querySelector('div[class*="simplesocialbuttons-float"]')){ 189 document.querySelector('div[class*="simplesocialbuttons-float"]').insertAdjacentHTML( 'beforeend', hideSidebarButton ) 190 document.querySelector('.ssb-hide-floating-bar').addEventListener( 'click' , toggleSidebarButtons) 191} 192} 193document.addEventListener( 'DOMContentLoaded', docLoadedFun ); 194 195function toggleSidebarButtons(){ 196 var leftSidebar = document.querySelector('div[class*="simplesocialbuttons-float"]'); 197 leftSidebar.classList.toggle('ssb-hide-float-buttons') 198}
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.