PageSourceSearch

https://blackterror.news/wp-content/themes/NTTheme/js/Social.js

js blackterror.news collected 2026-10-08 20:25:40 UTC 8,794 bytes, 236 lines download raw bytes

1//UPDATED ON 9/09/2020 @ 12:26PM
2
3///////////////////////////////////////////////////////////////
4
5$(document).ready(function() {
6AddIcons();
7GetViews();
8
9if($('meta[property="og:url"]').length) {
10var vURL = $('meta[property="og:url"]').attr('content');
11} else {
12var vURL = document.URL;
13};
14
15var vTitle = document.title
16vTitle = vTitle.replace("'","\\'"); //Escape the apostrophe with  backslashes
17vTitle = encodeURIComponent(vTitle);
18vURL = encodeURIComponent(vURL);
19
20//===================================
21
22$('.SocialButtons .Facebook').click(function() { ShareWindow('Facebook',vTitle,vURL); });
23$('.SocialButtons .Twitter').click(function() { ShareWindow('Twitter',vTitle,vURL); });
24$('.SocialButtons .Google').click(function() { ShareWindow('Google',vTitle,vURL); });
25$('.SocialButtons .Add2Any').click(function() { ShareWindow('Add2Any',vTitle,vURL); });
26$('.SocialButtons .Email').click(function() { EmailWindow(vURL); });
27$('.SocialButtons .Print').click(function() { PrintWindow(); });
28$('.SocialButtons .Comments').click(function() { scrollToComments(); });
29
30//===================================
31
32$('.SocialButtons .Facebook').hover(function(){
33$(this).addClass('Facebook-Hover');
34}, function(){
35$(this).removeClass('Facebook-Hover');
36});
37
38$('.SocialButtons .Twitter').hover(function(){
39$(this).addClass('Twitter-Hover');
40}, function(){
41$(this).removeClass('Twitter-Hover');
42});
43
44$('.SocialButtons .Add2Any').hover(function(){
45$(this).addClass('Add2Any-Hover');
46}, function(){
47$(this).removeClass('Add2Any-Hover');
48});
49
50$('.SocialButtons .Email').hover(function(){
51$(this).addClass('Email-Hover');
52}, function(){
53$(this).removeClass('Email-Hover');
54});
55
56$('.SocialButtons .Print').hover(function(){
57$(this).addClass('Print-Hover');
58}, function(){
59$(this).removeClass('Print-Hover');
60});
61
62$('.SocialButtons .Comments').hover(function(){
63$(this).addClass('Comments-Hover');
64}, function(){
65$(this).removeClass('Comments-Hover');
66});
67
68});
69
70//////////////////////////////////////////////////////////////////////////////////////////////
71
72$(window).load(function() {
73
74});
75
76//////////////////////////////////////////////////////////////////////////////////////////////
77//////////////////////////////////////////////////////////////////////////////////////////////
78//////////////////////////////////////////////////////////////////////////////////////////////
79//////////////////////////////////////////////////////////////////////////////////////////////
80//////////////////////////////////////////////////////////////////////////////////////////////
81
82function AddIcons() {
83$('.Social').each(function( index ) {
84var vURL = $(this).parent().parent().find(".Title").find("a").attr('href');
85var vTitle = $(this).parent().parent().find(".Title").text();
86var vHTTP = vURL.indexOf('http://');
87var vHTTPS = vURL.indexOf('https://');
88var vDoubleSlash = vURL.indexOf('//');
89if ( vDoubleSlash < 0 && (vHTTP < 0 || vHTTPS < 0)) { //link must be relative (no http, https, or //)
90vURL = document.location.href + vURL;
91};
92vTitle = vTitle.replace("'","\\'"); //Escape the apostrophe with  backslashes
93vURL = encodeURIComponent(vURL);
94vTitle = encodeURIComponent(vTitle);
95
96//var vFB = "Javascript: ShareWindow('Facebook','" + vTitle + "','" + vURL + "')";
97//var vGP = "Javascript: ShareWindow('Google','" + vTitle + "','" + vURL + "')";
98var vMD = "Javascript: ShareWindow('Mastodon','" + vTitle + "','" + vURL + "')";
99var vGAB = "Javascript: ShareWindow('GAB','" + vTitle + "','" + vURL + "')";
100var vTW = "Javascript: ShareWindow('Twitter','" + vTitle + "','" + vURL + "')";
101
102var vBlock = '<div class="Table">';
103vBlock += '<div class="Col"><a href="' + vGAB + '"><img src="/wp-content/themes/NTTheme/images/GAB-16x16.svg" title="Share on GAB"></a></div>';
104vBlock += '<div class="Col"><a href="' + vTW + '"><img src="/wp-content/themes/NTTheme/images/Twitter-16x16.svg" title="Share on Twitter"></a></div>';
105vBlock += '</div>';
106
107$(this).html(vBlock);
108
109});
110};
111
112//////////////////////////////////////////////////////////////////////////////////////////////
113
114function ShareWindow(vType, vTitle, vURL) {
115
116
117if (vType == 'Add2Any') {
118vURL = 'https://www.addtoany.com/share_save#url=' + vURL;
119};
120
121if (vType == 'GAB') {
122vURL = 'https://gab.com/';
123};
124
125if (vType == 'Twitter') {
126vURL = 'https://twitter.com/intent/tweet?text=' + vTitle + '&url=' + vURL;
127};
128
129//if (vType == 'Facebook') {
130//vURL = 'http://www.facebook.com/sharer/sharer.php?u=' + vURL;
131//};
132
133//if (vType == 'Google') {
134//vURL = 'https://plus.google.com/share?url=' + vURL;
135//};
136
137var iMyWidth = ( window.screen.width / 2 ) - ( 300 + 10 );
138var iMyHeight = ( window.screen.height / 2 ) - ( 400 + 50 );
139shareWindow = window.open( vURL, 'shareWin', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=700,height=450,left=' + iMyWidth + ',top=200' );
140shareWindow.focus();
141};
142
143//////////////////////////////////////////////////////////////////////////////////////////////
144
145function EmailWindow(url) {
146var vTitle = document.title;
147window.location.href = "mailto:?subject=Check out this interesting article&body=" + url + "%0A%0A";
148};
149
150//////////////////////////////////////////////////////////////////////////////////////////////
151
152function PrintWindow() {
153var vURL = document.URL;
154var vDomain = vURL.substring(0, vURL.lastIndexOf("/") + 1); //assumes the file is kept in the root, not subfolders
155var vHeadline = $('.PostTitle').text();
156var vAuthor = $('.PostInfo').text();
157var vArticle = $('.PostArticle').html();
158var iMyWidth = ( window.screen.width / 2 ) - ( 300 + 10 );
159newWindow = window.open('', 'PrintFriendly', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=700,height=450,left=' + iMyWidth + ',top=200' );
160newWindow.focus();
161var text = '<html><head><title>' + vHeadline + '</title>';
162text += '</head><body>';
163text += '<div style="font-family: arial, helvetica, san-serif;">';
164text += '<p><button style="float: right;" onclick="window.print();">Print</button></p><h1>' + vHeadline + '</h1>' + '<p>' + vAuthor + '</p><p>This article was printed from: '+ vURL + '</p><p>' + vArticle + '</p><p>See more articles like this at: ' + vDomain + '</p>';
165text += '</div></body></html>';
166newWindow.document.write(text);
167newWindow.print();
168};
169
170//////////////////////////////////////////////////////////////////////////////////////////////
171
172function formatNumber(vCount) {
173if (vCount >999999) {
174vCount = Math.floor(vCount/1000000);
175vCount = vCount.toString();
176var vFinalCount = vCount + "M" //Million
177} else if (vCount >9999) {
178vCount = Math.floor(vCount/1000);
179vCount = vCount.toString();
180var vFinalCount = vCount + "k" //Thousand
181} else {
182var vFinalCount  = vCount .toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); //add comma(s) to final number
183};
184return vFinalCount;
185};
186
187//////////////////////////////////////////////////////////////////////////////////////////////
188
189function GetViews() {
190var vDomain = document.URL;
191var vDomain = vDomain.substring(0, vDomain.lastIndexOf("/") + 1); //assumes the file is kept in the root, not subfolders
192var vFilename = vDomain.substring(vDomain.lastIndexOf("/") + 1, vDomain.length);
193$('.Views').each(function() {				 
194var vElement = $(this);
195var vURL = $(this).html();
196if (vURL ==''){
197vURL = $('meta[property="og:url"]').attr('content');
198};				 
199if (vURL === null || vURL === undefined){
200vURL = document.URL;
201};
202var vViewPage = 'GetViews.asp?url=';
203var vPage = vDomain + vViewPage + vURL;
204var request = $.get(vPage);
205request.success(function(data) { //Get views successful
206var vCount = formatNumber(data);
207vElement.html(vCount + ' Views');
208});
209});	
210};
211
212//////////////////////////////////////////////////////////////////////////////////////////////
213
214function WriteSocialBlock() {	
215var SocialBlock = "";
216SocialBlock += '<div class="SocialButtons">';
217//SocialBlock += '<div class="Facebook" title="Share on Facebook"></div>';
218SocialBlock += '<div class="Twitter" title="Share on Twitter"></div>';
219SocialBlock += '<div class="Add2Any a2a_dd"></div>';
220SocialBlock += '<div class="Comments" title="Read Comments"></div>';
221SocialBlock += '<div class="Email" title="Email This"></div>';
222SocialBlock += '<div class="Print" title="Print This"></div>';
223SocialBlock += '</div>';
224document.write(SocialBlock);
225};
226
227//////////////////////////////////////////////////////////////////////////////////////////////
228
229function scrollToComments() {
230var aTag = $('.PostComments');
231$('html,body').animate({
232scrollTop: aTag.offset().top
233}, 'slow');
234};
235
236//////////////////////////////////////////////////////////////////////////////////////////////

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.