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 31// IIFE - Immediately Invoked Function Expression 32 33var ssbPlugin = ssbPlugin || {}; 34 35(function ($, window, document) { 36 'use strict'; 37 38 function absint($int) { 39 return parseInt($int, 10); 40 } 41 42 var ssbPostData = {}; 43 44 ssbPlugin.fetchFacebookShares = function () { 45 /** 46 * Run all the API calls 47 */ 48 $.when( 49 $.get('https://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=' + ssb_post_url), 50 $.get('https://graph.facebook.com/?fields=og_object{likes.summary(true).limit(0)},share&id=' + ssb_alternate_post_url) 51 ).then(function (a, b) { 52 if (typeof a[0].share !== 'undefined') { 53 var f1 = absint(a[0].share.share_count); 54 var f2 = absint(a[0].share.comment_count); 55 var f3 = typeof a[0].og_object !== 'undefined' ? absint(a[0].og_object.likes.summary.total_count) : 0; 56 var fShares = f1 + f2 + f3; 57 if (ssb_alternate_post_url && typeof b[0].share !== 'undefined') { 58 var f4 = absint(b[0].share.share_count); 59 var f5 = absint(b[0].share.comment_count); 60 var f6 = typeof b[0].og_object !== 'undefined' ? absint(b[0].og_object.likes.summary.total_count) : 0; 61 var fShares2 = f4 + f5 + f6; 62 if (fShares !== fShares2) { 63 fShares += fShares2; 64 } 65 } 66 ssbPostData = { 67 action: 'ssb_facebook_shares_update', 68 security: SSB.fb_share_nonce, 69 post_id: ssb_post_id, 70 share_counts: fShares 71 }; 72 $.post(SSB.ajax_url, ssbPostData); 73 } 74 }); 75 }; 76 77 // Listen for the jQuery ready event on the document 78 $(function () { 79 // The DOM is ready! 80 if ($('div[class*="simplesocialbuttons-float"]').length > 0) { 81 $('body').addClass('body_has_simplesocialbuttons'); 82 } 83 }); 84 85 $(window).on('load', function () { 86 var allMods = $(".simplesocialbuttons_inline"); 87 // Already visible modules 88 allMods.each(function (i, el) { 89 var $el = $(el); 90 if ($el.visible(true)) { 91 $el.addClass('simplesocialbuttons-inline-in'); 92 } 93 }); 94 95 $(window).on('scroll', function () { 96 allMods.each(function (i, el) { 97 var $el = $(el); 98 if ($el.visible(true)) { 99 $el.addClass('simplesocialbuttons-inline-in'); 100 } 101 }); 102 }); 103 104 var sidebarwidth = $('div[class*="simplesocialbuttons-float"]>a:first-child').outerWidth(true); 105 $('div[class*="simplesocialbuttons-float"]').css('width', sidebarwidth + 'px'); 106 $('.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-copy-link):not(.simplesocial-linkedin-share)').each(function () { 107 var $el = $(this); 108 setTimeout(function () { 109 var $elWidth = $el.children('.ssb_counter').innerWidth(); 110 $el.css('padding-right', $elWidth + 10); 111 }, 100); 112 }); 113 }); 114 115 function docLoadedFun() { 116 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>'; 117 if (document.querySelector('div[class*="simplesocialbuttons-float"]')) { 118 document.querySelector('div[class*="simplesocialbuttons-float"]').insertAdjacentHTML('beforeend', hideSidebarButton); 119 document.querySelector('.ssb-hide-floating-bar').addEventListener('click', toggleSidebarButtons); 120 } 121 } 122 123 function toggleSidebarButtons() { 124 var leftSidebar = document.querySelector('div[class*="simplesocialbuttons-float"]'); 125 leftSidebar.classList.toggle('ssb-hide-float-buttons'); 126 } 127 128 document.addEventListener('DOMContentLoaded', docLoadedFun); 129 130}
130)(window.jQuery, window, document); 131 132// function to copy the current link to clipboard 133function ssb_copy_share_link(clickedButton) { 134 const textArea = document.createElement('textarea'); 135 const url = clickedButton.dataset.href; 136 textArea.value = url; 137 document.body.appendChild(textArea); 138 textArea.select(); 139 140 try { 141 const copied = document.execCommand('copy'); 142 if (copied) { 143 if(jQuery(clickedButton).closest('.simplesocial-simple-round').length === 0){ 144 jQuery(clickedButton).attr('data-tooltip', 'Copied'); 145 }else{ 146 jQuery(clickedButton).find('.ssb_tooltip').show(); 147 } 148 clickedButton.classList.add('ssb_copy_btn'); 149 setTimeout(() => { 150 jQuery(clickedButton).removeAttr('data-tooltip'); 151 clickedButton.classList.remove('ssb_copy_btn'); 152 jQuery(clickedButton).find('.ssb_tooltip').hide(); 153 }, 1500); 154 155 } else { 156 console.warn('Failed to copy URL using text area selection.'); 157 } 158 } catch (err) { 159 console.error('Failed to copy URL:', err); 160 } finally { 161 document.body.removeChild(textArea); 162 } 163}
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.