-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
executable file
·132 lines (119 loc) · 5.59 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
$(document).ready(function() {
SmoothScroll();
GATrack();
window.CurrentIcon = "";
window.cheatsenabled = false;
// Determine anchor positions
var LifeWatchAnchor = $('#LifeWatchPage').offset().top;
var ProjectsAnchor = $('#ProjectsPage').offset().top;
var CodeAnchor = $('#CodePage').offset().top;
UpdateIcon();
$(window).scroll(function() {
UpdateIcon();
});
function UpdateIcon() { // As the user scrolls...
var scroll = $(window).scrollTop() + 300; // Get current scroll. Offset changes the icon when most of the section is displayed.
if (scroll < ProjectsAnchor) { // If at home
if (window.cheatsenabled === true) { // If cheats are enabled
window.CurrentIcon = "url(/Icons%20and%20Attr/Egg/icon_14559.svg)";
} else {
window.CurrentIcon = "";
}
}
if (scroll >= LifeWatchAnchor && scroll < ProjectsAnchor) { // If at LifeWatch section
window.CurrentIcon = "url(/Icons%20and%20Attr/LifeWatch/WhiteIcon.svg)";
$('#LifeWatchCell').addClass("LifeWatchBar");
} else {
$('#LifeWatchCell').removeClass("LifeWatchBar");
}
if (scroll >= ProjectsAnchor && scroll < CodeAnchor) { // If at Project section
window.CurrentIcon = "url(/Icons%20and%20Attr/Wrench/noun_399553_cc.svg)";
$('#ProjectsCell').addClass("ProjectsBar");
} else {
$('#ProjectsCell').removeClass("ProjectsBar");
}
if (scroll >= CodeAnchor) { // If at Code section
window.CurrentIcon = "url(/Icons%20and%20Attr/Code/icon_20826.svg)";
$('#CodeCell').addClass("CodeBar"); // Add Menubar highlight
} else {
$('#CodeCell').removeClass("CodeBar"); // Remove Menubar highlight
}
if ($('#IconOverlay').css('background-image') != window.CurrentIcon) {
$('#IconOverlay').css('background-image', window.CurrentIcon); // Set current icon
}
// if (scroll >= LifeWatchAnchor && window.MusicLoaded === false) {
// window.MusicLoaded = true;
// }
}
$('a[rel*=leanModal]').leanModal({ top : 70, closeButton: ".modal_close" }); // Define modal close button
$(".ProjectMedia").slick({
dots: true,
arrows: true,
// infinite: true,
slidesToShow: 1,
initialSlide: 0,
lazyLoad: 'progressive'
});
$(".patch-container").patchpanel();
$('.patch-item').click(function(element) {
if (!$(this).find('div').hasClass('patch-open')) {
ga('send', 'event', 'ProjectView', $(this)[0].dataset.patchPanel);
}
$(this).find('div').toggleClass('patch-open');
$('.patch-item').not(this).find('div').removeClass('patch-open');
setTimeout(function() {calcAnchors();}, 1000);
});
function calcAnchors() {
ProjectsAnchor = $('#ProjectsPage').offset().top;
CodeAnchor = $('#CodePage').offset().top;
LifeWatchAnchor = $('#LifeWatchPage').offset().top;
MusicAnchor = $('#MusicPage').offset().top;
}
// Easter eggs below
window.cheatsenabled = false;
alertify.set({ delay: 3000 });
cheet('up up down down left right left right b a', function () { // Konami code to enable
if (window.cheatsenabled === false) {
window.cheatsenabled = true;
alertify.log("You have enabled easter eggs.");
setTimeout(function(){
alertify.log("Type back, glasses, astro, or bart.");
},4000);
$(window).scrollTop($(window).scrollTop()+1); // Reset home icon by triggering $(window).scroll()
cheet('g l a s s e s', function () {$('body').toggleClass('GlassesClass');});
cheet('b a c k', function () {
alertify.log("Background enabled.");
$('#HomeBlack').css('display', 'block');
//Change colors
$('#IntroHead').css('color', 'white');
$('#BBLogo').css('background-image', 'url(/Resources/logo-white.svg)');
$('#BottomMenu a').mouseover(function() {
$(this).css('color', 'white');
}).mouseout(function(){
$(this).css('color', '#b6b6b6');
});
$('#ResumeIcon').css('background-image', 'url(/Icons%20and%20Attr/Resume/icon_30547_white.svg)');
$('#EmailIcon').css('background-image', 'url(/Icons%20and%20Attr/Envelope/icon_13468_white.svg)');
$('#LinkedInIcon').css('background-image', 'url(/Icons%20and%20Attr/Profiles/linkedin_white.svg)');
$('#GithubIcon').css('background-image', 'url(/Icons%20and%20Attr/Profiles/github_white.svg)');
$('#CreditsIcon').css('background-image', 'url(/Icons%20and%20Attr/List/icon_11515_white.svg)');
});
cheet('a s t r o', function () {
var KICKASSVERSION='2.0';
var s = document.createElement('script');
s.type='text/javascript';
document.body.appendChild(s);
s.src='//hi.kickassapp.com/kickass.js';
void(0);
});
} else {
//Disable codes
window.cheatsenabled = false;
alertify.log("You have disabled easter eggs.");
cheet.disable('g l a s s e s');
cheet.disable('b a c k');
cheet.disable('b a r t');
$(window).scrollTop($(window).scrollTop()+1); // Reset home icon by triggering $(window).scroll()
}
});
});