PageSourceSearch

https://news.sru.edu/wp-content/plugins/simple-social-buttons/assets/js/front.js?ver=6.2.0

js sru.edu collected 2026-10-01 10:38:45 UTC 5,846 bytes, 169 lines download raw bytes

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		$('.ssb_custom-button').on('click', function () {
87			$('.ssb_wrapper_mobile').addClass('ssb_wrapper_mobile_open');
88		});
89		$('.ssb_wrapper-closed').on('click', function () {
90			$('.ssb_wrapper_mobile').removeClass('ssb_wrapper_mobile_open');
91		});
92		var allMods = $(".simplesocialbuttons_inline");
93		// Already visible modules
94		allMods.each(function (i, el) {
95			var $el = $(el);
96			if ($el.visible(true)) {
97				$el.addClass('simplesocialbuttons-inline-in');
98			}
99		});
100
101		$(window).on('scroll', function () {
102			allMods.each(function (i, el) {
103				var $el = $(el);
104				if ($el.visible(true)) {
105					$el.addClass('simplesocialbuttons-inline-in');
106				}
107			});
108		});
109
110		var sidebarwidth = $('div[class*="simplesocialbuttons-float"]>a:first-child').outerWidth(true);
111		$('div[class*="simplesocialbuttons-float"]').css('width', sidebarwidth + 'px');
112		$('.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 () {
113			var $el = $(this);
114			setTimeout(function () {
115				var $elWidth = $el.children('.ssb_counter').innerWidth();
116				$el.css('padding-right', $elWidth + 10);
117			}, 100);
118		});
119	});
120
121	function docLoadedFun() {
122		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>';
123		if (document.querySelector('div[class*="simplesocialbuttons-float"]')) {
124			document.querySelector('div[class*="simplesocialbuttons-float"]').insertAdjacentHTML('beforeend', hideSidebarButton);
125			document.querySelector('.ssb-hide-floating-bar').addEventListener('click', toggleSidebarButtons);
126		}
127	}
128
129	function toggleSidebarButtons() {
130		var leftSidebar = document.querySelector('div[class*="simplesocialbuttons-float"]');
131		leftSidebar.classList.toggle('ssb-hide-float-buttons');
132	}
133
134	document.addEventListener('DOMContentLoaded', docLoadedFun);
135
136}
136)(window.jQuery, window, document);
137
138// function to copy the current link to clipboard
139function ssb_copy_share_link(clickedButton) {
140    const textArea = document.createElement('textarea');
141    const url = clickedButton.dataset.href;
142    textArea.value = url;
143    document.body.appendChild(textArea);
144    textArea.select();
145
146    try {
147        const copied = document.execCommand('copy');
148        if (copied) {
149			if(jQuery(clickedButton).closest('.simplesocial-simple-round').length === 0){
150				jQuery(clickedButton).attr('data-tooltip', 'Copied');
151			}else{
152				jQuery(clickedButton).find('.ssb_tooltip').show();
153			}
154			clickedButton.classList.add('ssb_copy_btn');
155			setTimeout(() => {
156				jQuery(clickedButton).removeAttr('data-tooltip');
157				clickedButton.classList.remove('ssb_copy_btn');
158				jQuery(clickedButton).find('.ssb_tooltip').hide();
159			}, 1500);
160            
161        } else {
162            console.warn('Failed to copy URL using text area selection.');
163        }
164    } catch (err) {
165        console.error('Failed to copy URL:', err);
166    } finally {
167        document.body.removeChild(textArea); 
168    }
169}

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.