PageSourceSearch

https://vox.news/Javascripts/Jean.js

js vox.news collected 2026-10-08 20:50:39 UTC 13,528 bytes, 446 lines download raw bytes

1//EXPORTED ON 4/30/2020 8:28:37 AM
2//FOR FETCH SITES
3
4jQuery(document).ready(function() {
5CreateSpots();
6});
7
8////////////////////////////////////////////////////////////////////////////////////////////////////////
9
10function LoadMarkers(vSpot1,vSpot2,vSpot3) {
11
12MediumRectangle01('#Marker1','#Marker2','#Marker3',vSpot1,vSpot2,vSpot3);
13
14};
15
16////////////////////////////////////////////////////////////////////////////////////////////////////////
17
18// Generate class names for each ad spot (making sure they all have a unique name)
19function CreateSpots() {
20var spot = new Array();
21spot[0] = "";
22spot[1] = "";
23spot[2] = "";
24for (var i = 0; i < spot.length; i++) {
25x = spot[i];
26for (var a = 0; a < spot.length; a++) {
27y = spot[a];
28if (y == x) {
29spot[a] = GenerateName();
30};
31};
32};
33vSpot1 = spot[0];
34vSpot2 = spot[1];
35vSpot3 = spot[2];
36GenerateStyles(vSpot1,vSpot2,vSpot3);
37};
38
39/////////////////////////////////////////////////////////////////////////////////////////////////
40
41// Add attributes to all the new class 
41names
42function GenerateStyles(vSpot1,vSpot2,vSpot3) {
43var vStyle = '';
44vStyle += '<style>';
45vStyle += '.' + vSpot1 + ' { display: block; width: 300px; height: 250px; margin: 15px auto; }';
46vStyle += '.' + vSpot2 + ' { display: block; width: 300px; height: 250px; margin: 15px auto; }';
47vStyle += '.' + vSpot3 + ' { display: block; width: 300px; height: 250px; margin: 15px auto; }';
48vStyle += '</style>';
49jQuery('head').append(vStyle);
50LoadMarkers(vSpot1,vSpot2,vSpot3);
51};
52
53////////////////////////////////////////////////////////////////////////////////////////////////////////
54////////////////////////////////////////////////////////////////////////////////////////////////////////
55////////////////////////////////////////////////////////////////////////////////////////////////////////
56////////////////////////////////////////////////////////////////////////////////////////////////////////
57////////////////////////////////////////////////////////////////////////////////////////////////////////
58////////////////////////////////////////////////////////////////////////////////////////////////////////
59////////////////////////////////////////////////////////////////////////////////////////////////////////
60////////////////////////////////////////////////////////////////////////////////////////////////////////
61////////////////////////////////////////////////////////////////////////////////////////////////////////
62////////////////////////////////////////////////////////////////////////////////////////////////////////
63
64//Loads text ads into one of two divs
65function MediumRectangle01(vMarkerA,vMarkerB,vMarkerC,vDivA,vDivB,vDivC) {
66var vTotalItems = 7;
67if (vTotalItems > 0) {
68var vTotal = 3;
69vMarkerA = jQuery(vMarkerA);
70vMarkerB = jQuery(vMarkerB);
71vMarkerC = jQuery(vMarkerC);
72if (vMarkerA.length > 0 && vMarkerB.length > 0 && vMarkerC.length > 0) {
73jQuery('<div class="' + vDivA + '"></div>').insertAfter(vMarkerA);
74jQuery('<div class="' + vDivB + '"></div>').insertAfter(vMarkerB);
75jQuery('<div class="' + vDivC + '"></div>').insertAfter(vMarkerC);
76vCount = 0;
77//---------------------------------------------------------
78//Begin each
79var ranNums = shuffle([ 1,2,3,4,5,6,7 ]);
80jQuery.each(ranNums, function( index, x ) {
81switch (x) {
82
83case 1:
84vID = "5477";
85vSponsor = "Annatto Vitamin E";
86vStart = "4/29/2020";
87vExpire = "";
88vPercent = "";
89vReserve = "False";
90vHottopic = "False";
91vHeadline = "";
92vText = "";
93vLink = "";
94vImage = "Annatto-Vitamin-E-MR.jpg";
95vURL = "WBA-5477.html";
96vKeywords = "Annatto, Vitamin E, Tocotrienols";
97break;
98
99case 2:
100vID = "5436";
101vSponsor = "The 5G Summit - 2020";
102vStart = "4/22/2020";
103vExpire = "6/7/2020";
104vPercent = "";
105vReserve = "False";
106vHottopic = "False";
107vHeadline = "";
108vText = "";
109vLink = "";
110vImage = "The-5G-Summit-2020-MR.jpg";
111vURL = "WBA-5436.html";
112vKeywords = "";
113break;
114
115case 3:
116vID = "5371";
117vSponsor = "The Truth About Vaccines - 2020";
118vStart = "4/13/2020";
119vExpire = "4/30/2020";
120vPercent = "";
121vReserve = "False";
122vHottopic = "False";
123vHeadline = "";
124vText = "";
125vLink = "";
126vImage = "The-Truth-About-Vaccines-2020-MR.jpg";
127vURL = "WBA-5371.html";
128vKeywords = "";
129break;
130
131case 4:
132vID = "5341";
133vSponsor = "Organic Flax Milk Powder";
134vStart = "4/6/2020";
135vExpire = "";
136vPercent = "";
137vReserve = "False";
138vHottopic = "False";
139vHeadline = "";
140vText = "";
141vLink = "";
142vImage = "Organic-Flax-Milk-Powder-MR.jpg";
143vURL = "WBA-5341.html";
144vKeywords = "Flax, Milk";
145break;
146
147case 5:
148vID = "5321";
149vSponsor = "Cubeb Pepper Berries";
150vStart = "3/30/2020";
151vExpire = "";
152vPercent = "";
153vReserve = "False";
154vHottopic = "False";
155vHeadline = "";
156vText = "";
157vLink = "";
158vImage = "Cubeb-Pepper-Berries-MR.jpg";
159vURL = "WBA-5321.html";
160vKeywords = "Cubeb";
161break;
162
163case 6:
164vID = "5311";
165vSponsor = "Colloidal Silver Extra Strength Spray";
166vStart = "3/23/2020";
167vExpire = "";
168vPercent = "";
169vReserve = "False";
170vHottopic = "False";
171vHeadline = "";
172vText = "";
173vLink = "";
174vImage = "Colloidal-Silver-Extra-Strength-Spray-MR.jpg";
175vURL = "WBA-5311.html";
176vKeywords = "Colloidal, Silver";
177break;
178
179case 7:
180vID = "4739";
181vSponsor = "Organic Bee Pollen - Back in Stock";
182vStart = "10/30/2019";
183vExpire = "";
184vPercent = "";
185vReserve = "False";
186vHottopic = "False";
187vHeadline = "";
188vText = "";
189vLink = "";
190vImage = "Organic-Bee-Pollen-Back-in-Stock-MR.jpg";
191vURL = "WBA-4739.html";
192vKeywords = "Bee, Pollen";
193break;
194
195
196
197
198};
199//---------------------------------------------------------
200var vRemove = false; //dont remove (default state)
201if (vRemove == false && vExpire != "") {
202vRemove = ExpireCheck(vExpire); // AD Expire date exists, check to see if it should be removed
203};
204if (vRemove == false) {
205var vBlock = '<a href="WBA/' + vURL + '" target="_blank"><img src="WBA/' + vImage + '"></a>';
206vCount++;
207if (vCount == 1) {
208jQuery('.' + vDivA).append(vBlock);
209};
210if (vCount == 2) {
211jQuery('.' + vDivB).append(vBlock);
212};
213if (vCount == 3) {
214jQuery('.' + vDivC).append(vBlock);
215};
216if (vCount == vTotal) {
217return false; //stop each loop
218};
219}; //remove = false
220}); //each
221UpdateStatus("MR01 Inserted")
222}; //marker found
223}; //Total Items
224}; //end function
225
226////////////////////////////////////////////////////////////////////////////////////////////////////////
227////////////////////////////////////////////////////////////////////////////////////////////////////////
228////////////////////////////////////////////////////////////////////////////////////////////////////////
229////////////////////////////////////////////////////////////////////////////////////////////////////////
230////////////////////////////////////////////////////////////////////////////////////////////////////////
231////////////////////////////////////////////////////////////////////////////////////////////////////////
232////////////////////////////////////////////////////////////////////////////////////////////////////////
233////////////////////////////////////////////////////////////////////////////////////////////////////////
234////////////////////////////////////////////////////////////////////////////////////////////////////////
235////////////////////////////////////////////////////////////////////////////////////////////////////////
236
237function GenerateName() {
238var vCharacters = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"
239var vShuffled = vCharacters.split(',').sort(function(){return 0.5-Math.random()}).join(',');
240var a = vShuffled.split(",");
241var vClassName = '';
242for (var x = 0, y = 12; x < y; x++) {
243vClassName = vClassName + a[x];
244};
245vClassName = vClassName.substring(0, vClassName.length);
246return vClassName;
247};
248
249////////////////////////////////////////////////////////////////////////////////////////////////////////
250
251function shuffle(array) {
252var i = array.length,
253j = 0,
254temp;
255while (i--) {
256j = Math.floor(Math.random() * (i+1));
257// swap randomly chosen element with current element
258temp = array[i];
259array[i] = array[j];
260array[j] = temp;
261};
262return array;
263};
264
265////////////////////////////////////////////////////////////////////////////////////////////////////////
266
267function CharacterCleanup(vText) {
268vText = vText.replace(/[^a-zA-Z0-9 ]/g, ''); //removes all characters from string (except letters, numbers and spaces)
269vText = vText.replace('  ',' '); //remove double spaces
270vText = vText.toLowerCase(); //make lowercase
271return vText;
272};
273
274////////////////////////////////////////////////////////////////////////////////////////////////////////
275
276function AuthorCheck() {
277//=====================
278var vApprovedList = "Kristine Payne";
279//=====================
280var vApproved = false;
281vAuthor =jQuery("[rel=author]");
282if (jQuery(vAuthor).length ) { 
283vAuthor =jQuery("[rel=author]").html();
284vAuthor = vAuthor.trim();
285var a = vApprovedList.split(",");
286for (var x = 0, y = a.length; x < y; x++) {
287var vTemp = a[x];
288vTemp = vTemp.trim();
289if (vTemp == vAuthor) {
290vApproved = true;
291UpdateStatus("Author Approved");
292};
293}; 
294}; //length
295return vApproved;
296};
297
298////////////////////////////////////////////////////////////////////////////////////////////////////////
299
300function HotTopicCheck(vKeywords) {
301var vTitle =jQuery(document).find("title").text();
302var vDescription =jQuery('meta[property="og:description"]').attr('content');
303var vMetaKeywords =jQuery("meta[name='keywords']").attr("content");
304if (vTitle != null) {
305vTitle = CharacterCleanup(vTitle);
306} else {
307vTitle = "";
308};
309if (vDescription != null) {
310vDescription = CharacterCleanup(vDescription);
311} else {
312vDescription = "";
313};
314if (vMetaKeywords != null) {
315vMetaKeywords = CharacterCleanup(vMetaKeywords);
316} else {
317vMetaKeywords = "";
318};
319var vRemove = false;
320var a = vKeywords.split(",");
321for (var x = 0, y = a.length; x < y; x++) {
322var vKey = a[x];
323vKey = vKey.trim();
324vKey = vKey.toLowerCase();
325if (vMetaKeywords.indexOf(vKey) >= 0) { //keyword found in metakeywords
326UpdateStatus('"' + vKey + '" found in keywords');
327vRemove = true;
328};
329if (vTitle.indexOf(vKey) >= 0) { //keyword found in title
330UpdateStatus('"' + vKey + '" found in title');
331vRemove = true;
332};
333if (vDescription.indexOf(vKey) >= 0) { //keyword found in description
334UpdateStatus('"' + vKey + '" found in description');
335vRemove = true;
336};
337}; //for each
338return vRemove;
339};
340
341////////////////////////////////////////////////////////////////////////////////////////////////////////
342
343function KeywordCheck(vKeywords) {
344var vTitle =jQuery(document).find("title").text();
345var vDescription =jQuery('meta[property="og:description"]').attr('content');
346var vMetaKeywords = '';
347var vMetaKeywords =jQuery("meta[name='keywords']").attr("content");jQuery('meta[property=article\\:tag]').each(function() {
348var vTest =jQuery(this).attr('content');
349vMetaKeywords += vTest + ", ";
350});
351if (vTitle != null) {
352vTitle = CharacterCleanup(vTitle);
353} else {
354vTitle = "";
355};
356if (vDescription != null) {
357vDescription = CharacterCleanup(vDescription);
358} else {
359vDescription = "";
360};
361if (vMetaKeywords != null) {
362vMetaKeywords = CharacterCleanup(vMetaKeywords);
363} else {
364vMetaKeywords = "";
365};
366var vRemove = false;
367var a = vKeywords.split(",");
368for (var x = 0, y = a.length; x < y; x++) {
369var vKey = a[x];
370vKey = vKey.trim();
371vKey = vKey.toLowerCase();
372if (vMetaKeywords.indexOf(vKey) >= 0) { //keyword found in metakeywords
373vRemove = true;
374UpdateStatus('"' + vKey + '" found in keywords');
375};
376if (vTitle.indexOf(vKey) >= 0) { //keyword found in title
377vRemove = true;
378UpdateStatus('"' + vKey + '" found in title');
379};
380if (vDescription.indexOf(vKey) >= 0) { //keyword found in description
381vRemove = true;
382UpdateStatus('"' + vKey + '" found in description');
383};
384};
385return vRemove;
386};
387
388////////////////////////////////////////////////////////////////////////////////////////////////////////
389
390function ConvertDate(vDate) {
391// vbscript format: 8/14/2018 7:16:00 PM
392// would become: 2018-08-14T19:16:00-00:00
393a = vDate.split(" ")
394b = a[0].split("/")
395vMonth = b[0];
396vDay = b[1];
397vYear = b[2];
398if (vMonth < 10) {
399vMonth = '0' + vMonth;
400};
401if (vDay < 10) {
402vDay = '0' + vDay;
403};
404vDate = vYear + '-' + vMonth + '-' + vDay;
405b = a[1].split(":")
406vHour = b[0];
407vMinute = b[1];
408vSecond = b[2];
409if (a[2] == 'PM' && vHour < 12) { //add 12 hours
410vHour = Number(vHour); //convert to number
411vHour = vHour + 12;
412};
413if (a[2] == 'AM' && vHour < 10) { //add a zero in front
414vHour = '0' + vHour;
415};
416vSecond = vSecond + '-00:00';
417vTime = vHour + ':' + vMinute + ':' + vSecond;
418vDate = vDate + 'T' + vTime;
419return vDate;
420};
421
422////////////////////////////////////////////////////////////////////////////////////////////////////////
423
424function ExpireCheck(vDate) {
425var vRemove = false; //default value
426var a = vDate.split("/");
427var vMonth = (a[0] - 1); // Jan is 0, Dec is 11
428var vDay = a[1];
429var vYear = a[2];
430var vToday = new Date();
431var vExpireDate = new Date();
432vExpireDate.setFullYear(vYear, vMonth, vDay);
433if (vToday > vExpireDate) {
434var vRemove = true; //has expired
435UpdateStatus("Has Expired - " + vDate);
436};
437return vRemove;
438};
439
440////////////////////////////////////////////////////////////////////////////////////////////////////////
441
442function UpdateStatus(vText) {
443console.log(vText);
444};
445
446////////////////////////////////////////////////////////////////////////////////////////////////////////

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.