PageSourceSearch

https://jamaicatimeline.com/js/setupdom.js

js jamaicatimeline.com collected 2026-10-03 00:45:54 UTC 7,040 bytes, 155 lines download raw bytes

1//Add Fiwi Roots Brand Icon
2
3
4//SETUP NAVs
5let m=[];
6
7function setupNav(x, y) {
8console.log(x, y);
9if (y == 'top') { m[1]='active';}
10if (y == 'history') { m[2]='active';}
11if (y == 'music') { m[3]='active';}
12if (y == 'people') { m[4]='active';}
13if (y == 'industry') { m[5]='active';}
14  
15  if (x=='tl-main') {
16    updateMainLeftNavs('main');
17  } else {
18   if (x=='tl-sub') {
19    updateSubLeftNavs('sub');
20   }
21  }
22  
23  rotateLogo();
24}
25
26//Setup Navigation at Main Directory level
27function updateMainLeftNavs(level) {
28  if ( level == 'main') {
29    document.getElementById("nav-main-l").innerHTML =
30      '<li><a href="index.html" title="Main Page" class='+m[1]+' ><i class="fa fa-film" aria-hidden="true"></i></a></li> \
31      <li><a href="history.html" title="History Category"  class='+m[2]+'><i class="fa fa-history" aria-hidden="true"></i></a></li>\
32      <li><a href="music.html" title="Music Category"  class='+m[3]+'><i class="fa fa-music" aria-hidden="true"></i></a></li> \
33      <li><a href="people.html" title="People Category"  class='+m[4]+'><i class="fa fa-users" aria-hidden="true"></i></a></li> \
34      <li><a href="industry.html" title="Industry Category"  class='+m[5]+'><i class="fa fa-industry" aria-hidden="true"></i></a></li>' // added 1/10/24
35    
36    //Right Navigation
37    document.getElementById('nav-main-r').innerHTML =
38    '<li><a href="http://fiwiroots.com/about.html">ABOUT US</a></li> \
39     <li style="top: 12px; font-size: 16px"> \
40      <select name="whereto" onchange="pagejump(this.options[this.selectedIndex].value)"> \
41      <option>Select Timeline...</option> \
42      <option value="history.html">History</option> \
43      <option value="music.html">Music</option>\
44      <option value="people.html">People</option> \
45      <option value="https://fiwiroots.com/trivia/index.html">Trivia</option></select></li>'
46  };
47}
48
49//Setup Navigation at Main Directory level
50function updateSubLeftNavs(level) {
51  if ( level == 'sub') {
52    document.getElementById("nav-main-l").innerHTML =
53      '<li><a href="../index.html" title="Main Page" class='+m[1]+' ><i class="fa fa-film" aria-hidden="true"></i></a></li> \
54      <li><a href="../history.html" title="History Category"  class='+m[2]+'><i class="fa fa-history" aria-hidden="true"></i></a></li>\
55      <li><a href="../music.html" title="Music Category"  class='+m[3]+'><i class="fa fa-music" aria-hidden="true"></i></a></li> \
56      <li><a href="../people.html" title="People Category"  class='+m[4]+'><i class="fa fa-users" aria-hidden="true"></i></a></li> \
57      <li><a href="../industry.html" title="Industry Category"  class='+m[5]+'><i class="fa fa-industry" aria-hidden="true"></i></a></li>' // added 1/10/24
58    
59    //Right Navigation
60    document.getElementById('nav-main-r').innerHTML =
61    '<li><a href="http://fiwiroots.com/about.html">ABOUT US</a></li> \
62     <li style="top: 12px; font-size: 16px"> \
63      <select name="whereto" onchange="pagejump(this.options[this.selectedIndex].value)"> \
64      <option>Select Timeline...</option> \
65      <option value="../history.html">History</option> \
66      <option value="../music.html">Music</option>\
67      <option value="../people.html">People</option> \
68      <option value="../industry.html">Industry</option> \
69      <option value="https://fiwiroots.com/trivia/index.html">Trivia</option></select></li>'
70  };
71}
72  
73
74// Rotate Logo
75
76//$(window).load(function(){
77function rotateLogo() {
78 
79  x = Math.floor(Math.random() * 10);
80  console.log('images/logo-jtl-'+x+'.jpg');
81
82  $("#logo").attr("src", "https://jamaicatimeline.com/images/logo-jtl-"+x+".jpg");
83  //$('#logo-jtl').html('<img src="images/logo-jtl-'+x+'.jpg" alt="Jamaica Timeline" class="img-responsive center-block">');
84  
85  //$('#logo-jtl').html('<img src="https://fiwiroots.com/images/fr-brand-icon-blk.png" class="text-responsive" style="position: absolute; top: 0; left: 2%; opacity: 100%; width: 80px; z-index: 2">');
86}
87
88/* JumpTo */
89function pagejump(to_url) {
90  if (to_url != "") {
91    window.location=to_url;
92  }
93}
94
95/* ************************ */
96(function () {
97  const masthead = document.querySelector('.masthead');
98  const logoImg = masthead?.querySelector('img[src*="logo-jtl"]');
99  if (!logoImg) return;
100
101  const parentDiv = logoImg.closest('div');
102  if (!parentDiv) return;
103
104  // Prevent duplicates by checking if the icon image is already inside this div
105  //const brandAlreadyExists = parentDiv.querySelector('img[src*="fr-brand-icon-wht"]');
106  //const brandAlreadyExists = parentDiv.querySelector('img[src*="fr-brand-icon-wht"]');
107  const brandAlreadyExists = parentDiv.querySelector('img[src*="fr-brand-icon-ackee"]');
108  if (brandAlreadyExists) return;
109
110  // Ensure proper positioning
111  const style = window.getComputedStyle(parentDiv);
112  if (style.position === 'static') {
113    parentDiv.style.position = 'relative';
114  }
115
116  const iconHTML = `
117    <div class="hidden-xs hidden-sm" style="position: absolute; top: 5; right: 15em; opacity: 75%;"> <!-- was 65% -->
118      <a href="https://fiwiroots.com/about.html" target="_blank">
119        <!--<img src="https://fiwiroots.com/images/fr-brand-icon-wht.png" class="text-responsive" style="width: 65px;">-->
120        <img src="https://fiwiroots.com/images/fr-brand-icon-ackee.jpg" class="text-responsive" style="width: 65px; border-radius: 50%">
121      </a>
122    </div>
123    <div class="hidden-md hidden-lg hidden-xl" style="position: absolute; top: 2; right: 1em; opacity: 75%;"> <!-- was 65% -->
124      <a href="https://fiwiroots.com/about.html" target="_blank">
125        <!--<img src="https://fiwiroots.com/images/fr-brand-icon-wht.png" class="text-responsive" style="width: 45px; ">-->
126        <img src="https://fiwiroots.com/images/fr-brand-icon-ackee.jpg" class="text-responsive" style="width: 45px; border-radius: 50%">
127      </a>
128    </div>
129  `;
130
131  parentDiv.insertAdjacentHTML('beforeend', iconHTML);
132})();
133
134
135/* ------------------------ */
136/*Add Fiwi Roots Brand Icon */
137/* ------------------------ *
138
139// Find the class .masthead element
140const masthead = document.querySelector('.masthead');
141console.log(masthead);
142
143// Find the image within the masthead and any nested divs
144const image = masthead.querySelector('img[src*="logo-jtl"]');
145
146// Find the closest ancestor div of the image
147const parentDiv = image.closest('div');
148
149// Create the new divs to append
150const iconDivs = '<div class="hidden-xs hidden-sm" style="position: absolute; bottom: 0; left: 1em; opacity: 65%;"><a href="https://fiwiroots.com/about.html" target="_blank" id="fr-icon"><img src="https://fiwiroots.com/images/fr-brand-icon-wht.png" class="text-responsive" style="width: 7rem;"></a></div><div class="hidden-md hidden-lg hidden-xl" style="position: absolute; bottom: 0; left: 1em; opacity: 85%;"><a href="https://fiwiroots.com/about.html" target="_blank" id="fr-icon"><img src="https://fiwiroots.com/images/fr-brand-icon-wht.png" class="text-responsive" style="width: 5rem;"></a></div>';
151
152// Append the new divs to the parent div
153parentDiv.insertAdjacentHTML('beforeend', iconDivs);
154
155/* End of Brand Icon */

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.