-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
184 lines (147 loc) · 3.6 KB
/
main.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
* Oh hello there, Mr. Hacker! , so you want to see some code?
* Sure thing, join me!
* Visit now https://github.com/sarthak-1998
*
*/
$(function () {
//not ready for mobile
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
$('body').html("Umm, Please use a bigger screen. The thing you are trying to view is too awesome to conatin in this screen size");
}
//Print this in console as well.
console.log(`/*
* Oh hello there, Mr. Hacker! , so you want to see some code?
* Sure thing, join me!
* Visit now https://github.com/sarthak-1998
* Have Fun!
*
*/`);
var style = `
/**
* Hello, I guess you are here to meet me.
* My name is Sarthak Jain. I am a web developer. Oh, and also pusuing B.Tech
* Major in CSE.
*
* Well this is quite boring isn't it?, How about some live coding?
*/
/**
* We start by animating. Animate what you ask?.. well everything
*/
* {
-webkit-transition: all 1s;
}
/**
* Well, that didn't do much. But you'll see.
* and yes, i know text is too small, let's fix that.
*/
pre,a {
font-size: 15px;
}
/**
* Black on white? Well, this is ins't 1990s so ..The Background !
*/
html{
background-color: #6c1f45;
}
/**
* Hold On!
*
*/
pre,a {
color: whitesmoke;
}
/**
* Gosh!. Look at all this empty space, lets fit into
* something more comfy.
*/
pre {
overflow : auto;
width : 49%;
background: rgb(48,48,48);
border: 1px solid #ccc;
max-height: 44.6%;
width: 49%;
font-size: 14px;
font-family: monospace;
padding: 10px 10px 20px;
box-shadow: -4px 4px 2px 0 rgba(0,0,0,0.3);
white-space: pre-wrap;
outline: 0;
}
/**
* Let's add some colors to the code, make it pretty..
* That more like it. What more comfortable than highlighted code
* in a terminal.
*/
Prism.highlightAll();
/**
* Now we're getting somewhere
* Time to get some perspective
*/
body {
-webkit-perspective: 1000px;
}
pre {
position : absolute;
}
/**
* Are you thinking what i'm thinking?.
* Some 3D? Yes please.
*
*/
#premain {
-webkit-transform : perspective(700px) translateX(110%) rotateY(-10deg);
max-height : 85%;
width : 43%;
margin-top : 8px;
}
/**
* Okay, so now that i have your full attention.
* Here's the real thing, plain old & simple
*/
#realDeal {
-webkit-transform : perspective(700px) rotateY(10deg);
max-height : 85%;
display:block;
visibility : visible;
opacity : 1 ;
}
/**
* So i think we're good for now.
* Hope you liked this. While you're at it please share your views about this.
* Thanks for your patience and have a nice day!
* Peace out.
*/
`;
var highlight = false;
function skip()
{
$('style').html(style);
}
function writeCode(index ,time)
{
var tx = time;
var char = style.charAt(index);
$('#main').append(char);
$('style').html( $('style').html() + char);
if( char == '.' )
tx = 400 ;
else if(char == ',')
tx = 100;
else if(char == '?' || char=='}')
tx = 320;
else if(char == '/' && style.charAt(index-1) == '*' )
tx = 900;
if(highlight)
Prism.highlightAll();
else if( (char == 'A') && (style.substr(index , 6).localeCompare("All();") == 0 ) )
highlight = true;
var elem = document.getElementById("premain");
elem.scrollTop = elem.scrollHeight;
$('html,body').scrollTop(100000000000000000);
if(index < style.length)
setTimeout( function () { writeCode(index+1 , time) }, tx);
}
writeCode(0, 60);
});