PageSourceSearch

https://myelingroup.github.io/js/main.js

js myelingroup.github.io collected 2026-10-03 09:39:13 UTC 12,978 bytes, 458 lines download raw bytes

1var VH = window.innerHeight;
2var VW = window.innerWidth;
3var mobile = true;
4if(VW>600){mobile=false}
5var scrollScale = 60;
6if(mobile) scrollScale = 20;
7
8let item = document.getElementById("BodyContainer");
9let scroll = document.getElementById("scroll-wrapper");
10let s = document.getElementById("lazyDrift");
11
12let oldPos =  item.scrollTop;
13let target = item.scrollTop;
14
15var keys = {37: 1, 38: 1, 39: 1, 40: 1};
16
17function preventDefault(e) {
18  e = e || window.event;
19  if (e.preventDefault)
20      e.preventDefault();
21  e.returnValue = false;  
22}
23
24function preventDefaultForScrollKeys(e) {
25    if (keys[e.keyCode]) {
26        preventDefault(e);
27        return false;
28    }
29}
30
31function disableScroll() {
32  console.log("HSBDIHBDIfj")
33  document.getElementById("BodyContainer").style.overflow = "hidden";
34  // if (window.addEventListener) // older FF
35  //     window.addEventListener('DOMMouseScroll', preventDefault, false);
36  // window.onwheel = preventDefault; // modern standard
37  // window.onmousewheel = document.onmousewheel = preventDefault; // older browsers, IE
38  // window.ontouchmove  = preventDefault; // mobile
39  // document.onkeydown  = preventDefaultForScrollKeys;
40}
41
42function enableScroll() {
43  document.getElementById("BodyContainer").style.overflowY = "scroll";
44
45    // if (window.removeEventListener)
46    // //     window.removeEventListener('DOMMouseScroll', preventDefault, false);
47    // window.onmousewheel = document.onmousewheel = null; 
48    // window.onwheel = null; 
49    // window.ontouchmove = null;  
50    // document.onkeydown = null;  
51}
52
53animationFunctions = []
54
55function throttle(callback, delay) {
56  let isThrottled = false;
57  let savedArgs;
58
59  function wrapper() {
60      if (isThrottled) { 
61          savedArgs = arguments; 
62          return;
63      }
64
65      callback.apply(this, arguments); 
66
67      isThrottled = true;
68
69      setTimeout(() => {
70          isThrottled = false; 
71          if (savedArgs) {
72              wrapper.apply(this, savedArgs); 
73              savedArgs = null; 
74          }
75      }, delay);
76  }
77
78  return wrapper;
79}
80
81
82''
83function parallax() {
84  var yPos = item.scrollTop;
85  if(yPos-oldPos > 6000){
86    yPos = oldPos + 10;
87    
88  }else if(yPos-oldPos < -6000){
89    yPos = oldPos - 10;
90  }
91  oldPos = yPos;
92  // s.style.top = 0 - yPos/scrollScale + "%"; 
93  
94  var range = [100,VH*.8];
95  if(yPos<range[0]){
96    scroll.style.opacity = 1;
97  }else if(yPos<range[1]){
98    scroll.style.opacity = 1-(yPos - range[0])/(range[1]-range[0])
99  }else{
100    scroll.style.opacity = 0;
101  }
102
103  range = [VH,(VH*2.5)];
104  if(yPos<range[0]){
105    s.style.opacity = 1;
106  }else if(yPos<range[1]){
107    s.style.opacity = 1-(yPos - range[0])/(range[1]-range[0])
108  }else{
109    s.style.opacity = 0;
110  }
111  
112
113}
114
115// item.addEventListener("scroll", function(){
116//     target = item.scrollTop;
117//     parallax();
118    
119// });
120
121const parallaxElements = document.querySelectorAll('.parallax-layer');
122
123function handleScroll() { 
124    const scrollY = item.scrollTop;
125    const scrollProgress = scrollY / (item.scrollHeight - window.innerHeight);
126
127    parallaxElements.forEach(element => {
128      if(element.style.opacity == 0){
129
130        return;
131
132      }
133      console.log()
134        const speed = element.dataset.parallaxSpeed || 0.5; // Get speed from data attribute 
135        const offset = scrollProgress * speed * -200; // Customize offset value as needed
136
137        anime({
138            targets: element,
139            translateY: offset,  
140            easing: 'linear', 
141            duration: 50  // Adjust for smoother transitions (optional)
142        });
143    });
144
145}
146
147function openKeyboard(close = false) {
148  ele = document.getElementById('hiddenInput')
149console.log("keyboard")
150  if(close==true){
151    ele.blur();
152    ele.disabled = true;
153    ele.readOnly = true;
154
155  }else{
156    ele.focus();
157
158    ele.disabled = false;
159    ele.readOnly = false;
160  }
161  // ele.setAttribute('tabindex', '0');
162
163
164}
165let scrollEventDebounce = true;
166let hackerHouseRunOnce = false; // ensures onyl single run
167function hackerHouseAnimation(){
168  const element = document.getElementById('Hackerhouse_inner'); 
169  const rect = element.getBoundingClientRect();
170  const distanceFromTop = rect.top;
171  var cursorBlinker = null;
172  if(distanceFromTop<350&&distanceFromTop>-200){
173    if(scrollEventDebounce && !hackerHouseRunOnce){
174      hackerHouseRunOnce=true;
175      disableScroll();
176    scrollEventDebounce= false;
177    console.log(item.scrollTop+distanceFromTop)
178
179    
180
181
182    anime({
183      targets:item,
184      easing: 'easeInOutQuad', 
185      scrollTop:item.scrollTop+distanceFromTop-80,
186      duration: 900,
187    });
188
189    anime({
190      targets: document.getElementById("Terminal_Filler"),
191      easing: 'easeInOutQuad', 
192      keyframes: [
193        {opacity: 0},
194        {opacity: .7},
195    ],
196      duration: 1500,
197      loop: true
198    });
199
200    anime({
201      targets:element,
202      easing: 'easeInOutQuad',
203      backgroundColor: "#000",
204      minHeight: "90vh",
205      duration: 1000,
206      callback:()=>{}
207    });
208
209    anime({
210      targets:document.getElementById('Hackerhouse'),
211      easing: 'easeInOutQuad', 
212      // width: "100vw",
213      padding: 0,
214      // height: "100vh",
215      duration: 1000
216    });
217
218    var cursor = true;
219    var speed = 600;
220    if(cursorBlinker==null){
221      openKeyboard();
222    var cursorBlinker = setInterval(() => {
223      ele = document.getElementsByClassName('cursor_blinking')[0]
224      if(cursor) {
225        anime({
226          targets: ele,
227          easing: 'linear', 
228          opacity: "1",
229          duration: 50,
230        });
231        cursor = false;
232      }else {
233        anime({
234          targets: ele,
235          easing: 'linear', 
236          opacity: "0",
237          duration: 50,
238        });        
239        cursor = true;
240      }
241    }, speed);
242  }
243
244    var terminalState = 0;
245    var segments = [2,1,1,1,2,2,3,4,5,5,5,5,5]
246    var text = "./top_secret/projects/arborhouse.sh"
247    var textSplit = [];
248    let curIndex = 0;
249    let backspaceAnimationRunning = false;
250
251    segments.forEach(x=>{
252      if(curIndex>text.length) return;
253      if(curIndex+x>text.length) textSplit.concat(text.slice(curIndex));
254      textSplit.push(text.slice(curIndex,curIndex+x));
255      // console.log(text.slice(curIndex,curIndex+x),curIndex);
256
257      curIndex +=x;
258
259    })
260
261    function terminalTyper(event){
262
263      if(terminalState==textSplit.length){
264
265        if(event.key=="Enter"){          
266          enableScroll();
267          anime({
268            targets: document.getElementById("Terminal_loading"),
269            easing: 'linear', 
270            opacity: ".7",
271            duration: 1000,
272          });
273
274          anime({
275            targets: document.getElementById("Terminal_Enter_Text"),
276            easing: 'linear', 
277            opacity: "0",
278            duration: 50,
279          });
280
281          setTimeout(()=>{
282            anime({
283              targets: document.getElementById("Terminal_loading"),
284              easing: 'linear', 
285              opacity: "0",
286              duration: 1000,
287            });
288            setTimeout(()=>{
289            anime({
290              targets: document.getElementsByClassName("Coming_Soon_Text")[0],
291              easing: 'linear', 
292              opacity: "1",
293              duration: 100,
294            });
295            var comingSoonState = 0;
296            var typeComingSoon = setInterval(() => {
297              var text = "Coming Soon"
298              comingSoonState+=1
299              if(comingSoonState==text.length)clearInterval(typeComingSoon);
300              $(".Coming_Soon_Text a")[0].textContent = text.slice(0,comingSoonState)
301              
302            }, 100);
303          },1000);
304
305          },2000)
306
307          document.getElementsByClassName('cursor_blinking')[0].style.opacity = 0;
308          clearInterval(cursorBlinker);
309          cursorBlinker = null;
310          window.removeEventListener("keypress",terminalTyper)
311          terminalState+=1
312          openKeyboard(true);
313
314        }else{
315        document.getElementById("Terminal_Enter_Text").textContent="Press Enter"
316        if(backspaceAnimationRunning){anime.remove( document.getElementById("Terminal_Enter_Text"));}
317          anime({
318            targets: document.getElementById("Terminal_Enter_Text"),
319            easing: 'easeInOutQuad', 
320            keyframes: [
321              {opacity: .5},
322            ],
323            duration: 1000,
324          });
325        } 
326        return;
327      }
328      console.log(backspaceAnimationRunning)
329      if(event.key=="Backspace"){
330        if(!backspaceAnimationRunning){
331          backspaceAnimationRunning = true
332        document.getElementById("Terminal_Enter_Text").textContent="    Keep Typing"
333
334          anime({
335            targets: document.getElementById("Terminal_Enter_Text"),
336            easing: 'easeInOutQuad', 
337            keyframes: [
338              {opacity: .85},
339              {opacity: 0},
340          ],
341            duration: 2000,
342            loop: true
343          });
344        }
345       
346        }else{
347          document.getElementById("Terminal_Enter_Text").style.opacity = 0;
348          if(backspaceAnimationRunning){anime.remove( document.getElementById("Terminal_Enter_Text"));}
349          backspaceAnimationRunning = false;
350          terminalState+=1;
351          document.getElementById("Terminal_Filler").textContent = "";
352          document.getElementById("Terminal").textContent = textSplit.slice(0,terminalState).join("");
353        }
354    }
355    window.addEventListener("keydown",terminalTyper)
356
357    
358
359
360  }
361  }else{
362    scrollEventDebounce = true;
363  }
364
365
366
367
368}
369
370
371animationFunctions.push(handleScroll)
372animationFunctions.push(parallax)
373animationFunctions.push(hackerHouseAnimation)
374
375
376
377// var calEle = document.getElementById('calenderEle');
378
379// var settings={
380//   Color: '#999',                //(string - color) font color of whole calendar.
381//   LinkColor: '#333',            //(string - color) font color of event titles.
382//   NavShow: true,                //(bool) show navigation arrows.
383//   NavVertical: false,           //(bool) show previous and coming months.
384//   NavLocation: '#foo',          //(string - element) where to display navigation, if not in default position.
385//   DateTimeShow: true,           //(bool) show current date.
386//   DateTimeFormat: 'mmm, yyyy',  //(string - dateformat) format previously mentioned date is shown in.
387//   DatetimeLocation: '',         //(string - element) where to display previously mentioned date, if not in default position.
388//   EventClick: '',               //(function) a function that should instantiate on the click of any event. parameters passed in via data link attribute.
389//   EventTargetWholeDay: false,   //(bool) clicking on the whole date will trigger event action, as opposed to just clicking on the title.
390//   DisabledDays: [],             //(array of numbers) days of the week to be slightly transparent. ie: [1,6] to fade Sunday and Saturday.
391//   ModelChange: model            //(array of objects) new data object to pass into calendar (serving suggestion: passing through only the currently selected month's events if working with large dataset.
392// }
393
394// var events = [
395//   {'Date': new Date(2023, 8, 20), 'Title': 'Doctor appointment at 3:25pm.'},
396//   {'Date': new Date(2023, 8, 17), 'Title': 'New Garfield movie comes out!', 'Link': 'https://garfield.com'},
397//   {'Date': new Date(2023, 8, 11), 'Title': '25 year anniversary', 'Link': 'https://www.google.com.au/#q=anniversary+gifts'},
398// ];
399
400// caleandar(calEle, events);
401
402//Click Through Functionality
403// $('#ScrollBody').click(e => {
404//   $('#ScrollBody').hide();
405//   $(document.elementFromPoint(e.clientX, e.clientY)).trigger("click");
406//   $('#ScrollBody').show();
407// });
408var popUpDisabled = true;
409
410  document.addEventListener("DOMContentLoaded", function() { //pop up notif scripting
411    const menu = document.getElementById("popUpMenu");
412    const closeButton = document.getElementById("close-button");
413    const continueButton = document.getElementById("continue-button");
414    const bellIcon = document.getElementById("bell-icon");
415
416    // Show menu on load
417    if(!popUpDisabled){
418
419    menu.style.display = "flex";
420
421    // Function to close menu and unfreeze background scrolling
422    const closeMenu = () => {
423      menu.style.display = "none";
424    };
425    const showMenu = () => {
426      menu.style.display = "flex";
427    };
428
429    // Close menu on 'X' or 'Continue'
430    closeButton.addEventListener("click", closeMenu);
431    bellIcon.addEventListener("click", showMenu);
432  }else{
433    menu.style.display = "none";
434    bellIcon.style.display = "none";
435
436
437  }
438
439  
440  });
441
442
443document.addEventListener("DOMContentLoaded", function() {
444  console.log(document.getElementById("lazyDrift").style);
445  function animationLoop(){
446    animationFunctions.forEach(ele =>{
447      ele();
448
449    });
450    requestAnimationFrame(animationLoop)
451  }
452  requestAnimationFrame(animationLoop)
453
454  document.getElementById("Terminal_outer").addEventListener("click",openKeyboard)
455
456  // item.addEventListener('scroll', handleScroll);
457
458});

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.