PageSourceSearch

https://www.naturalnews.com/wp-content/themes/NaturalNews2022/Javascripts/Pageload.js

js naturalnews.com collected 2026-09-24 08:28:18 UTC 45,977 bytes, 1,504 lines download raw bytes

1// NN - UPDATED 9/10/2026 @ 10:43 AM
2
3////////////////////////////////////////////////////////////////
4
5$(document).ready(function() {
6
7WindowLoad();
8GetViews();
9
10////////////////////////////////////////////////////////////////
11
12$(document).on('click touchend', 'html', function(e) {
13HTMLClick(e);
14});
15
16////////////////////////////////////////////////////////////////
17
18$(window).resize(function() { 
19
20if (!$(document.activeElement).is('input, textarea')) {
21WindowResize();
22};
23
24});
25
26	
27//$(window).resize(function() { 
28//WindowResize();
29//});
30
31////////////////////////////////////////////////////////////////
32
33$(window).scroll(function() {
34BacktoTopShow();
35});
36
37////////////////////////////////////////////////////////////////
38
39//Page Navigation
40
41window.addEventListener("pageshow", () => {
42var vCurrent = $('.PageCurrent input').attr('placeholder');
43$('.PageCurrent input').val(vCurrent);
44});
45
46$(document).on('click touchend', '.PagePrevious', function() { PagePrevious(); });
47$(document).on('click touchend', '.PageNext', function() { PageNext(); });
48$(document).on('keyup', '.PageCurrent input', function(e) { PageCalculate(e); });
49$(document).on('focus', '.PageCurrent input', function() { $(this).select(); });
50
51////////////////////////////////////////////////////////////////
52
53//Search
54
55$(document).on('keyup', '.query', function() { SearchClearError(); });
56$(document).on('click touchend', '.SearchClear', function() { SearchClear(); });
57$(document).on('click touchend', '.SearchRight', function() { $('.SearchForm').submit(); });
58
59$(document).on('submit', '.SearchForm', function( event ) {
60if ( $('.query').val() != '' ) {
61return;
62} else {
63SearchError();	
64return false;	
65};
66});
67
68////////////////////////////////////////////////////////////////
69
70//Menus
71
72$(document).on('focus', '#ShareURL', function() { $(this).select(); });
73
74$(document).on('click touchend', '.Share', function() { 
75$(this).parents('.Post').addClass('ActivePost');
76ShareMenuOpen();					
77});
78
79////////////////////////////////////////////////////////////////
80
81//UI
82
83$(document).on('click touchend', '.ActionCopy', function() { 
84var vDiv = $(this).parents('.ActionForm').find('.AutoSelect').attr('id');
85CopyText(vDiv);
86}); 
87
88$(document).on('click touchend', '.AutoSelect', function() { $(this).select(); });
89$(document).on('click touchend', '.Comments', function() { ScrollTo($("#Comments").offset().top); });
90$(document).on('click touchend', '#TopLinksCenter, #BacktoTop', function() { ScrollTo(0); });
91$(document).on('click touchend', '#ButtonSections', function() { MenuOpen('MenuNavigation'); });
92$(document).on('click touchend', '#ButtonBack', function() { MenuBack(); });
93$(document).on('click touchend', '.MenuClose', function() { MenuClose(); });
94																																			
95$(document).on('click touchend', '.ArticleBoxAction', function() {
96var vID = $(this).parents('.ArticleBox').attr('id');
97ArticleBoxScroll(vID);
98});
99
100$('.ArticleBoxScroll').scroll(function() {				
101var vID = $(this).parents('.ArticleBox').attr('id');
102ArticleBoxScrolling(vID);
103});
104
105$(document).on('click touchend', '.ArticleTabs span', function() {
106var vID = $(this).parents('.ArticleBox').attr('id');
107//console.log("vID = " + vID);
108var vNumber = $(this).index() + 1;
109//console.log("vNumber = " + vNumber);
110ArticleBoxSwitch(vID,vNumber);
111});
112
113////////////////////////////////////////////////////////////////
114
115});
116
117//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
118//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
119//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
120//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
121//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
122//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
123//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
124//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
125//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
126//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
127//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
128//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
129//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
130//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
131//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
132//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
133//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
134//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
135//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
136//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
137
138//A
139
140/////////////////////////////////////////////////////////////////////////////
141
142function ActionItems() {
143var vHeadline = $('title').text();
144var vURL = window.location.href.split('?')[0];
145$('#Permalink').val(vURL);
146$('#ArticleLink').val('<a href="' + vURL + '">' + vHeadline + '</a>');
147};
148
149/////////////////////////////////////////////////////////////////////////////
150
151function ArticleBoxScrolling(vID) {
152var a = $('#' + vID + ' .ArticleBoxScroll').height();
153var b = $('#' + vID + ' .ArticleBoxScroll')[0].scrollTop;
154var c = $('#' + vID + ' .ArticleBoxScroll')[0].scrollHeight;
155if (a + b >= c) {
156$('#' + vID + ' .ArticleBoxAction').addClass('ArticleBoxActionUp')
157$('#' + vID + ' .ArticleBoxAction').attr('title','Scroll Up');
158} else {
159$('#' + vID + ' .ArticleBoxAction').removeClass('ArticleBoxActionUp')
160$('#' + vID + ' .ArticleBoxAction').attr('title','Scroll Down');
161};
162};
163
164/////////////////////////////////////////////////////////////////////////////
165
166function ArticleBoxScroll(vID) {
167var a = $('#' + vID + ' .ArticleBoxScroll').height();
168var b = $('#' + vID + ' .ArticleBoxScroll')[0].scrollTop;
169if ($('#' + vID + ' .ArticleBoxAction').hasClass('ArticleBoxActionUp') == true) {
170$('#' + vID + ' .ArticleBoxScroll').animate({ scrollTop: 0 }, 500);
171} else {
172$('#' + vID + ' .ArticleBoxScroll').animate({ scrollTop: a+b }, 500);
173};
174};
175
176/////////////////////////////////////////////////////////////////////////////
177
178function ArticleBoxSwitch(vID,vNumber) {
179$('#' + vID).find('.ArticleTabs span').removeClass('TabVisible');
180$('#' + vID).find('.ArticleBoxScroll .Widget').removeClass('PopularVisible');
181$('#' + vID).find('.ArticleTabs span:nth-child(' + vNumber + ')').addClass('TabVisible');
182$('#' + vID).find('.ArticleBoxScroll .Widget:nth-child(' + vNumber + ')').addClass('PopularVisible');
183$('#' + vID + ' .ArticleBoxScroll').animate({ scrollTop: 0 }, 100);
184};
185
186/////////////////////////////////////////////////////////////////////////////
187
188//B
189
190/////////////////////////////////////////////////////////////////////////////
191
192function BacktoTopShow() {
193if (window.matchMedia('(min-width: 1400px)').matches) {
194var x = $(document).scrollTop();
195if (x >= 100) {
196$('#BacktoTop').fadeIn(150);
197} else {
198$('#BacktoTop').fadeOut(150);
199};
200};
201};
202
203/////////////////////////////////////////////////////////////////////////////
204
205function ScrollTo(x) {
206$('html, body').animate({ scrollTop: x }, 300);
207};
208
209////////////////////////////////////////////////////////////////////////////
210
211//C
212
213////////////////////////////////////////////////////////////////////////////
214
215function ConvertSeconds(vTime) {
216var p = vTime.split(':'),
217s = 0, m = 1;
218while (p.length > 0) {
219s += m * parseInt(p.pop(), 10);
220m *= 60;
221};
222return s;
223};
224
225/////////////////////////////////////////////////////////////////////////////
226
227function CopyText(vDiv) {
228//$('#' + vDiv).select();
229//document.execCommand('copy');
230//UIMessage('Copied to Clipboard');
231
232const input = document.getElementById(vDiv);
233navigator.clipboard.writeText(input.value)
234.then(() => {
235//console.log('Copied!');
236UIMessage('Copied to Clipboard');
237})
238.catch((err) => {
239//console.error('Failed to copy:', err);
240});
241
242};
243
244////////////////////////////////////////////////////////////////////////////
245
246//D
247
248/////////////////////////////////////////////////////////////////////////////
249
250//E
251
252/////////////////////////////////////////////////////////////////////////////
253
254function EmailURL() {
255if ($('.ActivePost').length == 0) { //share from home/index page
256var vHeadline = $('title').text();
257var vURL = window.location.href.split('?')[0];
258} else {
259var vHeadline = GetActiveHeadline();
260var vURL = GetActiveURL();
261};
262vURL = vURL.replace("http://", "");
263vURL = vURL.replace("https://", "");
264vURL = vURL.replace("www.", "");
265vURL = vURL.replace("naturalnews.com/", "");
266vURL = "https://naturalnews.com/" + vURL;
267vURL = vURL.replace("naturalnews.com///", "naturalnews.com/");
268vURL = vURL.replace("naturalnews.com//", "naturalnews.com/");
269window.location.href = "mailto:?subject=Check out this interesting article&body=" + vHeadline + "%0A%0A" + vURL + "%0A%0A";
270};
271
272/////////////////////////////////////////////////////////////////////////////
273
274//F
275
276/////////////////////////////////////////////////////////////////////////////
277
278//G
279
280/////////////////////////////////////////////////////////////////////////////
281
282function GetActiveHeadline() {
283return $('.ActivePost .Headline a').text();
284};
285
286/////////////////////////////////////////////////////////////////////////////
287
288function GetActiveURL() {
289var vURL = $('.ActivePost .Headline a').attr('href').split('?')[0];
290
291if (vURL.indexOf('//') != 0) { //is not an absolute url
292//vURL = 'https://www.naturalnews.com/' + vURL; //must be a url relative to NN
293};
294
295vURL = vURL.replace(document.domain, "");
296vURL = vURL.replace("http://", "");
297vURL = vURL.replace("https://", "");
298vURL = vURL.replace("naturalnews.com/", "");
299vURL = "https://naturalnews.com/" + vURL;
300vURL = vURL.replace("naturalnews.com///", "naturalnews.com/");
301vURL = vURL.replace("naturalnews.com//", "naturalnews.com/");
302//console.log("get active url = "+ vURL);
303
304return vURL;
305};
306
307/////////////////////////////////////////////////////////////////////////////
308
309function GetTime(seconds) {
310var hours = parseInt( seconds / 3600 ) % 24;
311var minutes = parseInt( seconds / 60 ) % 60;
312var seconds =  Math.floor(seconds % 60);
313if (hours < 10) {
314hours = "0" + hours;
315};
316if (minutes < 10) {
317minutes = "0" + minutes;
318};
319if (seconds < 10) {
320seconds = "0" + seconds;
321};
322if (hours > 0) {
323hours = hours + ":";
324} else {
325hours = "";
326};
327minutes = minutes + ":";
328var number = hours + minutes + seconds;			 
329return number;
330};
331
332/////////////////////////////////////////////////////////////////////////////
333
334function GetURLParameter(sParam) {
335var vValue = '';
336var sPageURL = window.location.search.substring(1);
337var sURLVariables = sPageURL.split('&');
338for (var i = 0; i < sURLVariables.length; i++) {
339var sParameterName = sURLVariables[i].split('=');
340if (sParameterName[0] == sParam) {
341vValue = sParameterName[1] ;
342};
343};
344return vValue;
345};
346
347/////////////////////////////////////////////////////////////////////////////
348
349//H
350
351/////////////////////////////////////////////////////////////////////////////
352
353function HTMLClick(e) {
354if ($(e.target).hasClass('Button') || $(e.target).parents('.Button').length || $(e.target).hasClass('Share') || $(e.target).attr('id') == 'SearchBar' || $(e.target).parents('#SearchBar').length || $(e.target).hasClass('MenuBox') || $(e.target).parents('.MenuBox').length) {
355//DO NOTHING
356} else {
357UIHide();
358};
359};
360
361/////////////////////////////////////////////////////////////////////////////
362
363//I
364
365/////////////////////////////////////////////////////////////////////////////
366
367//J
368
369/////////////////////////////////////////////////////////////////////////////
370
371//K
372
373/////////////////////////////////////////////////////////////////////////////
374
375//L
376
377/////////////////////////////////////////////////////////////////////////////
378
379function LoadPage(vURL, vHistory) {
380$.ajax({ url: vURL,
381dataType: 'html',
382success: function(response) {
383var vHash = vURL.split('#')[1];	
384var vTitle = $(response).filter('title').text();
385var vDescription = $(response).filter('meta[name="description"]').attr("content");
386var vKeywords = $(response).filter('meta[name="keywords"]').attr("content");
387var vBody = $(response).filter('#Page');
388$(document).prop('title', vTitle);
389$('meta[name="title"]').attr("content", vTitle);
390$('meta[name="description"]').attr("content", vDescription);
391$('meta[name="keywords"]').attr("content", vKeywords);
392$('#Page').replaceWith(vBody);
393if (vHash != null) {
394location.hash = "#" + vHash;
395};
396if (vHistory == true) {
397history.pushState(null, null, vURL);
398};
399WindowReload();
400},
401error: function(response) {
402window.location.href = vURL;
403}
404});
405};
406
407/////////////////////////////////////////////////////////////////////////////
408
409//M
410
411/////////////////////////////////////////////////////////////////////////////
412
413function MenuBack() {
414OpenURL('/',false);
415};
416
417/////////////////////////////////////////////////////////////////////////////
418
419function MenuClose() {
420$('#Page').removeClass('Blur');
421$('.ButtonCover').remove();
422$('.Menu').removeClass('MenuOpen');
423$('.Post').removeClass('ActivePost');
424$('body').removeClass('BodyDisable');
425};
426
427/////////////////////////////////////////////////////////////////////////////
428
429function MenuOpen(vID) {
430$('#Page').addClass('Blur');
431$('<div class="ButtonCover ButtonCoverDark"></div>').appendTo($('body'));
432$('#' + vID).addClass('MenuOpen');
433};
434
435/////////////////////////////////////////////////////////////////////////////
436
437//N
438
439/////////////////////////////////////////////////////////////////////////////
440
441//0
442
443/////////////////////////////////////////////////////////////////////////////
444
445function OpenURL(vURL,vNew) {
446if (vNew == false) {
447window.location.href = vURL; //same window
448} else {
449window.open(vURL); //new window
450};
451};
452
453/////////////////////////////////////////////////////////////////////////////
454
455//P
456
457//////////////////////////////////////////////////////////////////////////
458
459function PopulateSocial() {
460var vBlock = ''+
461
462'<a href="//brighteon.io/naturalnews" target="_blank" class="Link">Brighteon.io</a>' +
463'<a href="//brighteon.social/@healthranger" target="_blank" class="Link">Brighteon.Social</a>' +
464'<a href="//t.me/RealHealthRanger" target="_blank" class="Link">Telegram</a>' +
465'<a href="//app.parler.com/naturalnews" target="_blank" class="Link">Parler</a>' +
466'<a href="//truthsocial.com/@NaturalNews" target="_blank" class="Link">Truth Social</a>' +
467'<a href="//gettr.com/user/naturalnews" target="_blank" class="Link">Gettr</a>' +
468'<a href="//freetalk.app/NaturalNews" target="_blank" class="Link">FreeTalk</a>' +
469'<a href="https://mewe.com/p/naturalnews" target="_blank" class="Link">MeWe</a>' +
470'<a href="https://gab.com/NaturalNews" target="_blank" class="Link">GAB</a>' +
471'<a href="//usa.life/naturalnews" target="_blank" class="Link">USA.Life</a>';
472
473$('.SocialLinks').html(vBlock);
474};
475
476/////////////////////////////////////////////////////////////////////////////
477
478function PageCalculate(e) {
479var vURL = window.location.toString();
480var ASCIICode = (e.which) ? e.which : e.keyCode;
481var vTotal = PageGetTotal();
482var vCurrent = $('.PageCurrent input').attr('placeholder');
483var vPage = $('.PageCurrent input').val();
484vPage = vPage.replace(/[^0-9]/g,''); //remove non-numbers
485vPage = Number(vPage); 
486if (vPage < 1) {
487vPage = vCurrent;
488};
489if (vPage > vTotal) {
490vPage = vTotal;
491};
492$('.PageCurrent input').val(vPage);
493if (e.which == 13) { //ENTER BUTTON
494vURL = UpdateURL(vPage);
495OpenURL(vURL, false);
496};	
497if (e.which == 38) { //UP
498var vNext = vPage + 1;
499if (vNext > vTotal) {
500vNext = vTotal;
501};
502$('.PageCurrent input').val(vNext);
503};	
504if (e.which == 40) { //DOWN
505var vPrevious = vPage - 1;
506if (vPrevious < 1) {
507vPrevious = 1;
508};
509$('.PageCurrent input').val(vPrevious);
510};	
511
512PageInputUpdate();
513
514};
515
516/////////////////////////////////////////////////////////////////////////////
517
518function PageGetTotal() {
519return Number($('.PageTotal').text().replace('of ', ''));
520};
521
522/////////////////////////////////////////////////////////////////////////////
523
524function PageInputUpdate() {
525if ($('.PageCurrent input').length) {
526var len = $('.PageCurrent input').val().length;
527var vWidth = len * 16;
528if (vWidth > 50) {
529$('.PageCurrent input').css('width',vWidth + 'px');
530} else {
531vWidth = 50;
532$('.PageCurrent input').removeAttr('style');
533};
534};
535};
536
537/////////////////////////////////////////////////////////////////////////////
538
539function PageUpdate() {
540if ($('.PageCurrent input').length) {
541var vCurrent = $('.PageCurrent input').attr('placeholder');
542if (vCurrent == 1) {
543$('.PagePrevious').hide();
544};
545};
546};
547
548/////////////////////////////////////////////////////////////////////////////
549
550function PageNext() {
551var vTotal = PageGetTotal();
552var vPage = Number($('.PageCurrent input').attr('placeholder'));
553if (vPage == '') {
554vPage = 1;
555};
556var vNext = vPage + 1;
557if (vNext > vTotal) {
558vNext = vTotal;
559};
560vURL = UpdateURL(vNext);
561OpenURL(vURL, false);
562};
563
564/////////////////////////////////////////////////////////////////////////////
565
566function PagePrevious() {
567var vTotal = PageGetTotal();
568var vPage = Number($('.PageCurrent input').attr('placeholder'));
569if (vPage == '') {
570vPage = 1;
571};
572var vPrevious = vPage - 1;
573if (vPrevious < 1) {
574vPrevious= 1;
575};
576vURL = UpdateURL(vPrevious);
577OpenURL(vURL, false);
578};
579
580/////////////////////////////////////////////////////////////////////////////
581
582//Q
583
584/////////////////////////////////////////////////////////////////////////////
585
586//R
587
588/////////////////////////////////////////////////////////////////////////////
589
590function ReorderMobile() { //Mobile Layout
591$('#Page').removeClass('PageLargeDesktop');
592$('#Page').removeClass('PageDesktop');
593$('#Page').addClass('PageMobile');
594
595//-----------------------------
596
597$('.Ticker').prependTo('#Index01');
598
599$('.MainCenter').appendTo('.MainTable');
600$('.MainRight').appendTo('.MainTable');
601$('.MainLeft').appendTo('.MainTable');
602
603//-----------------------------
604
605$('#Index01').appendTo('.MainCenter');
606$('#Index06').appendTo('.MainCenter');
607$('#Index03').appendTo('.MainCenter');
608$('#Index04').appendTo('.MainCenter');
609$('#Index05').appendTo('.MainCenter');
610$('#Index09').appendTo('.MainCenter');
611$('#Index02').appendTo('.MainCenter');
612$('#Index07').appendTo('.MainCenter');
613$('#Index08').appendTo('.MainCenter');
614
615//-----------------------------
616
617$('#Article02').appendTo('.MainCenter');
618$('#Article01').appendTo('.MainCenter');
619
620//-----------------------------
621
622};
623
624/////////////////////////////////////////////////////////////////////////////
625
626function ReorderLargeDesktop() { //Default Layout
627$('#Page').removeClass('PageMobile');
628$('#Page').removeClass('PageDesktop');
629$('#Page').addClass('PageLargeDesktop');
630
631//-----------------------------
632
633$('.Ticker').appendTo('#IndexTicker');
634
635$('.MainLeft').appendTo('.MainTable');
636$('.MainRight').appendTo('.MainTable');
637$('.MainCenter').appendTo('.MainTable');
638
639//-----------------------------
640
641$('#Index01').appendTo('.MainCenter');
642$('#Index02').appendTo('.MainCenter');
643
644$('#Index03').appendTo('.SidebarLeft');
645$('#Index04').appendTo('.SidebarLeft');
646$('#Index05').appendTo('.SidebarLeft');
647$('#Index09').appendTo('.SidebarLeft');
648
649$('#Index06').appendTo('.SidebarRight');
650$('#Index07').appendTo('.SidebarRight');
651$('#Index08').appendTo('.SidebarRight');
652
653//-----------------------------
654
655$('#Article01').appendTo('.SidebarLeft');
656$('#Article02').appendTo('.SidebarRight');
657
658//-----------------------------
659
660};
661
662/////////////////////////////////////////////////////////////////////////////
663
664function ReorderDesktop() {
665$('#Page').removeClass('PageMobile');
666$('#Page').removeClass('PageLargeDesktop');
667$('#Page').addClass('PageDesktop');
668
669//-----------------------------
670
671$('.Ticker').appendTo('#IndexTicker');
672
673$('.MainLeft').appendTo('.MainTable');
674$('.MainRight').appendTo('.MainTable');
675$('.MainCenter').appendTo('.MainTable');
676
677//-----------------------------
678
679$('#Index01').appendTo('.MainCenter');
680$('#Index04').appendTo('.MainCenter');
681$('#Index05').appendTo('.MainCenter');
682$('#Index02').appendTo('.MainCenter');
683
684$('#Index03').appendTo('.SidebarRight');
685$('#Index06').appendTo('.SidebarRight');
686$('#Index07').appendTo('.SidebarRight');
687$('#Index08').appendTo('.SidebarRight');
688
689$('#Index09').appendTo('.SidebarRight');
690
691//-----------------------------
692
693$('#Article02').appendTo('.SidebarRight');
694$('#Article01').appendTo('.SidebarRight');
695
696//-----------------------------
697
698};
699
700/////////////////////////////////////////////////////////////////////////////
701
702function ReorderArticle() {
703
704$('.ArticleLatestNews').each(function() {
705var vBlock = ''+
706'<div class="Suggested01 ThreeWide"></div>' +
707'<div class="Suggested02 ThreeWide"></div>';
708$(vBlock).appendTo($(this).find('.Posts'));
709var vSug01 = $(this).find('.Posts').find('.Suggested01');
710var vSug02 = $(this).find('.Posts').find('.Suggested02');
711var vCount = 1;
712
713//-----------------------------
714
715$(this).find('.Posts').find('.Post').each(function() {
716
717if (vCount <= 3) {
718$(this).appendTo(vSug01);
719$(this).wrap('<div class="TW"></div>');
720vCount++;
721} else {
722$(this).appendTo(vSug02);
723$(this).wrap('<div class="TW"></div>');
724};
725
726});
727
728//-----------------------------
729
730});
731
732};
733
734/////////////////////////////////////////////////////////////////////////////
735
736function ReorderHome() {
737
738//-----------------------------
739
740var vBlock = ''+
741'<div class="Home01 TwoWide"></div>' +
742'<div class="Home02 TwoWide"></div>' +
743'<div class="Home03 ThreeWide"></div>' +
744'<div class="Home04 TwoWide"></div>' +
745'<div class="Home05"></div>' +
746'<div class="Home06 ThreeWide"></div>';
747
748$(vBlock).insertBefore('.HomePosts');
749
750//-----------------------------
751
752var vCount = 1;
753
754$('.HomePosts .Post').each(function( index ) {
755
756if (vCount <= 2) {
757$(this).appendTo('.Home01');
758$(this).wrap('<div class="TW"></div>');
759vCount++;
760return true;
761};
762
763if (vCount <= 4) {
764$(this).appendTo('.Home02');
765$(this).wrap('<div class="TW"></div>');
766vCount++;
767return true;
768};
769
770if (vCount <= 7) {
771$(this).appendTo('.Home03');
772$(this).wrap('<div class="TW"></div>');
773vCount++;
774return true;
775return true;
776};
777
778if (vCount <= 9) {
779$(this).appendTo('.Home04');
780$(this).wrap('<div class="TW"></div>');
781vCount++;
782return true;
783};
784
785if (vCount <= 12) {
786$(this).appendTo('.Home05');
787$(this).wrap('<div class="TW"></div>');
788vCount++;
789return true;
790};
791
792if (vCount <= 15) {
793$(this).appendTo('.Home06');
794$(this).wrap('<div class="TW"></div>');
795vCount++;
796return true;
797};
798
799if (vCount == 15) {
800return false; // breaks each loop
801};
802
803});
804
805//-----------------------------
806
807$('.IndexCat').each(function() {
808var vFirst = $(this).find('.PhotoSquare .Posts .Post:first-child');
809var vNew = $(this).find('.PhotoLeft .Posts');
810$(vFirst).appendTo(vNew);
811});
812
813//-----------------------------
814
815};
816
817/////////////////////////////////////////////////////////////////////////////
818
819function ReorderSearch() {
820SearchHide();
821if (window.matchMedia('(max-width: 1040px)').matches) {
822$('#SearchBar').insertAfter('#Header');
823} else {
824$('#SearchBar').insertAfter('#TopLinks');
825};
826};
827
828/////////////////////////////////////////////////////////////////////////////
829
830function ReorderWidgets() {
831
832if (window.matchMedia('(max-width: 1039px)').matches) {
833if (!$('#Page').hasClass('PageMobile')) {
834ReorderMobile();
835};
836};
837
838if (window.matchMedia('(min-width: 1040px) and (max-width: 1279px)').matches) {
839if (!$('#Page').hasClass('PageDesktop')) {
840ReorderDesktop();
841};
842};
843
844if (window.matchMedia('(min-width: 1280px)').matches) {
845if (!$('#Page').hasClass('PageLargeDesktop')) {
846ReorderLargeDesktop();
847};
848};
849
850};
851
852/////////////////////////////////////////////////////////////////////////////
853
854//S
855
856/////////////////////////////////////////////////////////////////////////////
857
858function SearchClear() {
859$('.query').val('');
860SearchClearError();
861};
862
863/////////////////////////////////////////////////////////////////////////////
864
865function SearchClearError() {
866var vSearch = $('.query').val();
867if (vSearch == '') {
868$('.SearchClear').removeClass('ShowClear');
869} else {
870$('.SearchClear').addClass('ShowClear');
871};
872var vText = 'What are you searching for?';
873$('.query').removeClass('SearchError');
874$('.query').attr("placeholder", vText);
875};
876
877/////////////////////////////////////////////////////////////////////////////
878
879function SearchError() {
880var vText = 'Type something here first...';
881$('.query').attr("placeholder", vText);
882$('.query').addClass('SearchError');
883};
884
885/////////////////////////////////////////////////////////////////////////////
886
887function SearchHide() {
888if (window.matchMedia('(min-width: 1040px)').matches) {
889$('#SearchBar').slideUp(150, function(){
890$('#SearchLink').removeClass('SearchClose');
891//$('#SearchBar .SearchClear').removeClass('ShowClear');
892$('#SearchBar .Content').css('opacity','0');
893$('#SearchLink').prop('title', 'Search');
894//$('#SearchBar .query').val('');	
895});
896} else {
897$('#SearchBar').removeAttr('style');
898$('#SearchBar .Content').removeAttr('style');
899};
900};
901
902/////////////////////////////////////////////////////////////////////////////
903
904function SearchShow() {
905$('#SearchBar').slideDown(150, function(){
906$('#SearchLink').addClass('SearchClose');
907$('#SearchBar .Content').animate({opacity: "1"}, 300)
908$('#SearchBar .query').focus();	
909$('#SearchLink').prop('title', 'Close Search');
910});
911if ($('#SearchBar .query').val() != '') {
912$('.SearchClear').addClass('ShowClear');
913};
914};
915
916//////////////////////////////////////////////////////////////////////////////
917
918function SearchToggle() {
919if ($('#SearchLink').hasClass('SearchClose') == false) {
920SearchShow();
921} else {
922SearchHide();
923};
924};
925
926/////////////////////////////////////////////////////////////////////////////
927
928function ShareMenuOpen() {
929//console.log("Output;");  
930//console.log(location.hostname);
931//console.log(document.domain);
932if ($('.ActivePost').length == 0) { //share from home/index page
933//console.log("share menu open: home/index page");
934var vHeadline = $('title').text();
935var vURL = window.location.href.split('?')[0];
936var vAltURL = $('#ArticleID').val();
937} else {
938//console.log("share menu open: other page");
939var vHeadline = GetActiveHeadline();
940var vURL = GetActiveURL();
941var vAltURL = $('.ActivePost').attr('id');
942};
943vURL = vURL.replace(document.domain, "");
944vURL = vURL.replace("http://", "");
945vURL = vURL.replace("https://", "");
946vURL = vURL.replace("www.", "");
947vURL = vURL.replace("naturalnews.com/", "");
948vURL = "https://naturalnews.com/" + vURL;
949vURL = vURL.replace("naturalnews.com///", "naturalnews.com/");
950vURL = vURL.replace("naturalnews.com//", "naturalnews.com/");
951//console.log("share url = "+ vURL);
952
953vAltURL = 'https://www.citizens.news/' + vAltURL + '.html';
954
955$('#ShareBox .MenuHeadline').text(vHeadline);
956$('#ShareBox .MenuURL').text(vURL);
957$('#ShareURL').val(vURL);
958$('#ShareAltURL').val(vAltURL);
959$('body').addClass('BodyDisable');
960MenuOpen('ShareBox');
961};
962
963/////////////////////////////////////////////////////////////////////////////
964
965function specialCharactersHandler(vText) {
966
967vText = vText.replaceAll('   ', ' '); //triple space
968vText = vText.replaceAll('  ', ' '); //double space
969
970vText = vText.replaceAll('&#8211;', ' -- '); //endash
971vText = vText.replaceAll('&#8212;', ' -- '); //emdash
972vText = vText.replaceAll("&#8216;", "'"); //left curly apostrophe
973vText = vText.replaceAll("&#8217;", "'"); //right curly apostrophe
974vText = vText.replaceAll("&rsquo;", "'"); //right curly apostrophe
975
976vText = vText.replaceAll('—', ' -- '); //emdash
977vText = vText.replaceAll('–', ' -- '); //endash
978vText = vText.replaceAll('…', '...'); //ellipsis
979vText = vText.replaceAll('“', '"'); //left quote
980vText = vText.replaceAll('”', '"'); //right quote
981vText = vText.replaceAll("‘", "’"); // left curly apostrophe
982vText = vText.replaceAll("’", "'"); // right curly apostrophe
983
984vText = vText.replaceAll('&', 'and'); //ampersand
985
986//console.log(vText);
987
988return vText
989};
990
991/////////////////////////////////////////////////////////////////////////////
992
993function ShareBrighteonIO() {
994if ($('.ActivePost').length == 0) { //share from home/index page
995var vHeadline = $('title').text();
996var vURL = window.location.href.split('?')[0];
997} else {
998var vHeadline = GetActiveHeadline();
999var vURL = GetActiveURL();
1000};
1001
1002var k = $("meta[name='keywords']").attr("content");
1003pos = k.indexOf(",");
1004pos = k.indexOf(",",pos+1);
1005pos = k.indexOf(",",pos+1);
1006k = k.substring(0,pos);
1007tags = k.split(",");
1008
1009vHeadline = specialCharactersHandler(vHeadline)
1010
1011const share = window.bastyonLib.share({
1012share: {
1013description: vHeadline,
1014url: vURL,
1015tags: tags
1016}
1017})
1018const brighteonIOShareURL = share.makeURL()
1019const win = window.open(
1020brighteonIOShareURL,
1021'_blank',
1022'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0'
1023)
1024win?.focus()
1025};
1026
1027/////////////////////////////////////////////////////////////////////////////
1028
1029
1030function ShareWindowOpen(vSite) {
1031if ($('.ActivePost').length == 0) { //share from home/index page
1032//console.log("share window open: home/index page");
1033var vHeadline = $('title').text();
1034var vURL = window.location.href.split('?')[0];
1035} else {
1036//console.log("share window open: other page");
1037var vHeadline = GetActiveHeadline();
1038var vURL = GetActiveURL();
1039};
1040//console.log("share url = "+ vURL);
1041vURL = vURL.replace("http://", "");
1042vURL = vURL.replace("https://", "");
1043vURL = vURL.replace("www.", "");
1044vURL = vURL.replace("naturalnews.com/", "");
1045vURL = "https://naturalnews.com/" + vURL;
1046vURL = vURL.replace("naturalnews.com///", "naturalnews.com/");
1047vURL = vURL.replace("naturalnews.com//", "naturalnews.com/");
1048
1049vHeadline = vHeadline.replace("'","\\'"); //Escape the apostrophe with backslashes
1050vHeadline = encodeURIComponent(vHeadline);
1051vURL = encodeURIComponent(vURL);
1052
1053//-------------------------------------
1054
1055if (vSite == 'BrighteonSocial') {
1056vURL = 'https://brighteon.social/share?text=' + vHeadline +'%20' + vURL;
1057};
1058if (vSite == 'Facebook') {
1059vURL = 'https://www.facebook.com/sharer/sharer.php?u=' + vURL + '&t=' + vHeadline;
1060};
1061if (vSite == 'Twitter') {
1062vURL = 'https://twitter.com/intent/tweet?text=' + vHeadline + '%20' + vURL;
1063};
1064if (vSite == 'Telegram') {
1065vURL = 'https://telegram.me/share/url?url=' + vURL + '&text=' + vHeadline;
1066};
1067if (vSite == 'Gab') {
1068vURL = 'https://gab.com/compose?text=' + vHeadline +'&url=' + vURL;
1069};
1070if (vSite == 'Parler') {
1071vURL = 'https://app.parler.com/new-post?message=' + vHeadline + '%20' + vURL;
1072};
1073if (vSite == 'TruthSocial') {
1074vURL = 'https://truthsocial.com/share?text=' + vHeadline +'&url=' + vURL;
1075};
1076if (vSite == 'Gettr') {
1077vURL = 'https://gettr.com/share?url=' + vURL + '&t=' + vHeadline;
1078};
1079if (vSite == 'MeWe') {
1080vURL = 'https://mewe.com/share?link=' + vURL;
1081};
1082if (vSite == 'Diaspora') {
1083vURL = 'https://www.addtoany.com/add_to/diaspora?linkurl=' + vURL + '&type=page&linkname=' + vHeadline;
1084};
1085if (vSite == 'Mastodon') {
1086vURL = 'https://www.addtoany.com/add_to/mastodon?linkurl=' + vURL + '&type=page&linkname=' + vHeadline;
1087};
1088if (vSite == 'SMS') {
1089vURL = 'https://www.addtoany.com/add_to/sms?linkurl=' + vURL + '&type=page&linkname=' + vHeadline;
1090};
1091if (vSite == 'Add2Any') {
1092var vURL = 'https://www.addtoany.com/share#url=' + vURL + '&title=' + vHeadline;
1093};
1094if (vSite == 'USALife') {
1095vURL = 'https://usa.life/NaturalNews';
1096};
1097if (vSite == 'X') {
1098vURL = 'https://x.com/intent/post?text=' + vHeadline + '%20' + vURL;
1099};
1100
1101//-------------------------------------
1102
1103var iMyWidth = ( window.screen.width / 2 ) - ( 300 + 10 );
1104var iMyHeight = ( window.screen.height / 2 ) - ( 400 + 50 );
1105shareWindow = 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' );
1106shareWindow.focus();
1107};
1108
1109
1110
1111function ShareWindowOpen_bak(vSite) {
1112if ($('.ActivePost').length == 0) { //share from home/index page
1113var vHeadline = $('title').text();
1114var vURL = window.location.href.split('?')[0];
1115} else {
1116var vHeadline = GetActiveHeadline();
1117var vURL = GetActiveURL();
1118};
1119vHeadline = vHeadline.replace("'","\\'"); //Escape the apostrophe with  backslashes
1120vHeadline = encodeURIComponent(vHeadline);
1121vURL = encodeURIComponent(vURL);
1122
1123//-------------------------------------
1124
1125if (vSite == 'BrighteonSocial') {
1126vURL = 'https://brighteon.social/share?text=' + vHeadline +'%20' + vURL;
1127};
1128if (vSite == 'Gab') {
1129vURL = 'https://gab.com/home';
1130};
1131if (vSite == 'USALife') {
1132vURL = 'https://usa.life/NaturalNews';
1133};
1134if (vSite == 'Parler') {
1135vURL = 'https://parler.com/profile/naturalnews/posts';
1136};
1137if (vSite == 'MeWe') {
1138vURL = 'https://mewe.com/share?link=' + vURL;
1139};
1140if (vSite == 'Diaspora') {
1141vURL = 'https://www.addtoany.com/add_to/diaspora?linkurl=' + vURL + '&type=page&linkname=' + vHeadline;
1142};
1143if (vSite == 'Mastodon') {
1144vURL = 'https://www.addtoany.com/add_to/mastodon?linkurl=' + vURL + '&type=page&linkname=' + vHeadline;
1145};
1146if (vSite == 'SMS') {
1147vURL = 'https://www.addtoany.com/add_to/sms?linkurl=' + vURL + '&type=page&linkname=' + vHeadline;
1148};
1149if (vSite == 'Add2Any') {
1150var vURL = 'https://www.addtoany.com/share#url=' + vURL + '&title=' + vHeadline;
1151};
1152
1153//-------------------------------------
1154
1155var iMyWidth = ( window.screen.width / 2 ) - ( 300 + 10 );
1156var iMyHeight = ( window.screen.height / 2 ) - ( 400 + 50 );
1157shareWindow = 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' );
1158shareWindow.focus();
1159};
1160
1161/////////////////////////////////////////////////////////////////////////////
1162
1163function ShowDate() {
1164var vDiv = $('#TopLinksCenter');
1165var objDate = new Date();
1166var locale = "en-us";
1167var vMonth = objDate.toLocaleString(locale, { month: "long"});
1168var vWeekday = objDate.toLocaleString(locale, { weekday: "long"});
1169var vYear = objDate.getFullYear();
1170var vDay = objDate.getDate();
1171if (vDay < 10) {
1172vDay = "0" + vDay;
1173};
1174vDiv.text(vWeekday + ", " + vMonth + " " + vDay + ", " + vYear);
1175};
1176
1177/////////////////////////////////////////////////////////////////////////////
1178
1179//T
1180
1181/////////////////////////////////////////////////////////////////////////////
1182
1183//U
1184
1185/////////////////////////////////////////////////////////////////////////////
1186
1187function UIHide() {
1188SearchHide();
1189MenuClose();
1190};
1191
1192/////////////////////////////////////////////////////////////////////////////
1193
1194/*
1195function UpdateURL(vPage) {
1196if (vPage == 1) {
1197var vURL = '//www.naturalnews.com/all-posts.html';
1198} else {
1199var vURL = '//www.naturalnews.com/all-posts/page/' + vPage;
1200};
1201return vURL;
1202};
1203*/
1204
1205function UpdateURL(vPage) {
1206
1207//var vDomain = 'https://www.robotics.news'; //for testing
1208//var vDomain = 'https://www.' + window.location.hostname;
1209var vPath = location.pathname;
1210pos = vPath.indexOf("/page");
1211if (pos!=-1)
1212 {
1213  vPath = vPath.substr(0, pos);
1214 }
1215
1216if (vPage == 1) {
1217//var vURL = vDomain + '/all-posts.html';
1218var vURL = vPath;
1219} else {
1220//var vURL = vDomain + '/all-posts/page/' + vPage;
1221var vURL = vPath + '/page/' + vPage;
1222};
1223return vURL;
1224};
1225
1226/////////////////////////////////////////////////////////////////////////////
1227
1228function UIMessageClose() {
1229$('.UIMessage').fadeOut(150, function() {
1230$('.UIMessage').remove();
1231});
1232};
1233
1234/////////////////////////////////////////////////////////////////////////////
1235
1236function UIMessage(vText) {
1237$('.UIMessage').remove();	
1238var vBlock = '';
1239vBlock += '<div class="UIMessage NoSelect">';
1240vBlock += '<div class="UIBox">';
1241vBlock += vText;
1242vBlock += '</div>';
1243vBlock += '</div>';
1244$(vBlock).appendTo('body');
1245$('.UIMessage').fadeIn(150);
1246$('.UIMessage').css('bottom','30px');
1247setTimeout(function() {
1248UIMessageClose();
1249}, 1500);
1250};
1251
1252/////////////////////////////////////////////////////////////////////////////
1253
1254function UISwap() {
1255if (window.matchMedia('(max-width: 799px)').matches) {
1256
1257//---------------------------
1258
1259if ($('#HomeSection').length == false) { // not homepage
1260$('#ButtonSections').addClass('ButtonHidden');
1261$('#ButtonBack').addClass('ButtonVisible');
1262};
1263
1264//---------------------------
1265
1266};
1267};
1268
1269/////////////////////////////////////////////////////////////////////////////
1270
1271//V
1272
1273/////////////////////////////////////////////////////////////////////////////
1274
1275/*
1276function VideoWrap() {
1277$('#Article iframe').wrap('<div class="Video"></div>');
1278};
1279*/
1280function VideoWrap() {
1281
1282$('iframe').each(function() {
1283var src = $(this).attr('src').toLowerCase();
1284//console.log(src);
1285if (src.includes('twitter')) {
1286//console.log('twitter');
1287// do nothing
1288} else {
1289//console.log('video');
1290$(this).wrap('<div class="Video"></div>');
1291};
1292});
1293
1294};
1295
1296/////////////////////////////////////////////////////////////////////////////
1297
1298//W
1299
1300/////////////////////////////////////////////////////////////////////////////
1301
1302function WindowLoad() {
1303ShowDate();
1304VideoWrap();
1305PageUpdate();
1306PageInputUpdate();
1307PopulateSocial();
1308ActionItems();
1309};
1310
1311/////////////////////////////////////////////////////////////////////////////
1312
1313function WindowResize() {
1314UISwap();
1315MenuClose();
1316ReorderSearch();
1317ReorderWidgets();
1318};
1319
1320/////////////////////////////////////////////////////////////////////////////
1321
1322//X
1323
1324/////////////////////////////////////////////////////////////////////////////
1325
1326//Y
1327
1328/////////////////////////////////////////////////////////////////////////////
1329
1330//Z
1331
1332/////////////////////////////////////////////////////////////////////////////
1333
1334function GetCount(vURL) {
1335
1336var vCount = 0; //default value for any errors
1337
1338vCount = Math.floor(Math.random() * 36000) + 1; //for mockup only
1339
1340// 1 talk to server/database
1341// 2 get number of views
1342// 3 format number (add commas, abbreviations, etc)
1343
1344vCount = makeFriendly(vCount);
1345
1346return vCount;
1347};
1348
1349/////////////////////////////////////////////////////////////////////////////
1350
1351function GetViews() {
1352var vArticle = document.getElementById("ArticleID");
1353var vViews = document.getElementsByClassName('Views');
1354var vCount;
1355
1356        		 var url = document.URL;
1357                         pos = url.lastIndexOf("/") + 1;
1358                         url = url.substr(pos, url.length - pos);
1359              		 $.get( window.location.protocol + "//naturalnews.com/getviews3.asp?url="+url, function( data ) {
1360        		 	if (data !== undefined) {
1361        		 		vCount = data;
1362			 		//console.log("views for = " + url + ":" + data);
1363        		 		vCount = parseInt(vCount);
1364					vCount = makeFriendly(vCount);
1365					if (vCount)
1366					 {
1367        		 		  linka = document.getElementById("viewscount");
1368					  if (typeof(linka) != 'undefined' && linka != null)
1369        		 		   {
1370        		 		    document.getElementById("viewscount").innerHTML = vCount;
1371        		 		   }
1372        		 		 }
1373        		 	}
1374        		 });
1375        		 
1376if (vArticle) { //must be article page
1377var vURL = window.location.href.split('?')[0]; //get the view count of this url
1378//var vCount = GetCount(vURL);
1379for (var i = 0; i < vViews.length; i++) {
1380//vViews[i].innerHTML = vCount;
1381};
1382
1383} else { //must be index/other page
1384
1385$('.Views').each(function() {
1386var vURL = $(this).parents('.Post').find('.Headline a').attr('href');
1387//vURL = vURL.replace("/naturalnewscom", "https://naturalnews.com");
1388                         pos = vURL.lastIndexOf("/") + 1;
1389                         vURL = vURL.substr(pos, vURL.length - pos);
1390//var vCount = GetCount(vURL);
1391//$(this).html(vCount);
1392el = $(this);
1393elid = el.attr("id");
1394
1395viewsurl = vURL;
1396viewsurl = viewsurl.replace("_link0", "");
1397viewsurl = viewsurl.replace("_link1", "");
1398viewsurl = viewsurl.replace("_link2", "");
1399viewsurl = viewsurl.replace("_link3", "");
1400viewsurl = viewsurl.replace("_link4", "");
1401viewsurl = viewsurl.replace("_link5", "");
1402viewsurl = viewsurl.replace("_link6", "");
1403viewsurl = viewsurl.replace("_link7", "");
1404viewsurl = viewsurl.replace("_link8", "");
1405
1406        		 $.get( window.location.protocol + "//naturalnews.com/getviews3.asp?url="+viewsurl, function( data ) {
1407        		 	if (data !== undefined) {
1408			 		//console.log("1.views for = " + vURL + ":" + data);
1409//			 		console.log("data = " + data);
1410        		 		vCount = data;
1411//        		 		console.log("vCount1 = " + vCount);
1412        		 		vCount = parseInt(vCount);
1413//        		 		console.log("vCount2 = " + vCount);
1414					vCount = makeFriendly(vCount);
1415//        		 		console.log("vCount3 = " + vCount);
1416			 		//console.log("1.views for = " + vURL + ":" + vCount);
1417
1418					el = vURL;
1419					el = el.replace("https://naturalnews.com/", "");
1420					el = el.replace("https://www.naturalnews.com/", "");
1421					el = el.replace(".html", "");
1422					el = "article_" + el;
1423//					console.log("url = " + vURL);
1424			 		//console.log("el = " + vURL);
1425        		 	
1426        		 		linka = document.getElementById(el);
1427					if (typeof(linka) != 'undefined' && linka != null)
1428        		 		 {
1429        		 		  document.getElementById(el).innerHTML = vCount;
1430        		 		 }
1431        		 		link0 = document.getElementById(el+"_link0");
1432					if (typeof(link0) != 'undefined' && link0 != null)
1433					 {
1434        		 		  document.getElementById(el+"_link0").innerHTML = vCount;
1435					 }
1436        		 		link1 = document.getElementById(el+"_link1");
1437					if (typeof(link1) != 'undefined' && link1 != null)
1438					 {
1439        		 		  document.getElementById(el+"_link1").innerHTML = vCount;
1440					 }
1441        		 		link2 = document.getElementById(el+"_link2");
1442					if (typeof(link2) != 'undefined' && link2 != null)
1443					 {
1444        		 		  document.getElementById(el+"_link2").innerHTML = vCount;
1445					 }
1446        		 		link3 = document.getElementById(el+"_link3");
1447					if (typeof(link3) != 'undefined' && link3 != null)
1448					 {
1449        		 		  document.getElementById(el+"_link3").innerHTML = vCount;
1450					 }
1451        		 		link4 = document.getElementById(el+"_link4");
1452					if (typeof(link4) != 'undefined' && link4 != null)
1453					 {
1454        		 		  document.getElementById(el+"_link4").innerHTML = vCount;
1455					 }
1456        		 		link5 = document.getElementById(el+"_link5");
1457					if (typeof(link5) != 'undefined' && link5 != null)
1458					 {
1459        		 		  document.getElementById(el+"_link5").innerHTML = vCount;
1460					 }
1461        		 		link6 = document.getElementById(el+"_link6");
1462					if (typeof(link6) != 'undefined' && link6 != null)
1463					 {
1464        		 		  document.getElementById(el+"_link6").innerHTML = vCount;
1465					 }
1466        		 		link7 = document.getElementById(el+"_link7");
1467					if (typeof(link7) != 'undefined' && link7 != null)
1468					 {
1469        		 		  document.getElementById(el+"_link7").innerHTML = vCount;
1470					 }
1471        		 		link8 = document.getElementById(el+"_link8");
1472					if (typeof(link8) != 'undefined' && link8 != null)
1473					 {
1474        		 		  document.getElementById(el+"_link8").innerHTML = vCount;
1475					 }
1476//					console.log("el = " + el.parent().text());
1477        		 	}
1478        		 });
1479
1480});
1481
1482
1483
1484};
1485};
1486
1487/////////////////////////////////////////////////////////////////////////////
1488
1489function intlFormat(num) {
1490return new Intl.NumberFormat().format(Math.floor(num*10)/10);
1491};
1492
1493/////////////////////////////////////////////////////////////////////////////
1494
1495function makeFriendly(num) {
1496if (num >= 1000000)
1497return intlFormat(num/1000000)+'M';
1498if (num >= 1000)
1499return intlFormat(num/1000)+'K';
1500return intlFormat(num);
1501}
1502
1503/////////////////////////////////////////////////////////////////////////////
1504

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.