PageSourceSearch

https://sasha-kramer.com/app.js

js sasha-kramer.com collected 2026-10-02 16:03:49 UTC 7,177 bytes, 215 lines download raw bytes

1$(function(){
2
3  // preload background?
4  var src = 'http://apod.nasa.gov/apod/image/1606/PelicanNorthAmerica_Etcheverry_3232.jpg';
5  $(window).on("load", function(){
6    $(".background").animate({opacity:1}, 200);
7  });
8
9  printASCII()
10
11  // background change
12
13  $(".container").on("mouseover", function(){
14    $("#shuffleButton").css({opacity: 1});
15    $("#infoButton").css({opacity: 1});
16  });
17
18  $(".container").on("mouseleave", function(){
19    $("#shuffleButton").css({opacity: 0});
20    $("#infoButton").css({opacity: 0});
21  });
22
23  var apodData = {};
24
25  var getAPOD = function(){
26    var randomDateChance = chance.birthday({ year: chance.year({ min: 2014, max: 2015 }) });
27    var randomDate = moment(randomDateChance).format('YYYY-MM-DD');
28
29    var apodBase = 'https://api.nasa.gov/planetary/apod?hd=true&date=' + randomDate + '&api_key=';
30    var apodKey = 'vRkyBLgP6BandXIDG4D5Fr0Ppub3dUBToDPyotMR'; // get your own key at https://api.nasa.gov/index.html#apply-for-an-api-key
31
32
33    var $ajax = $.ajax({
34      method: 'GET',
35      url: apodBase + apodKey
36    });
37
38    $ajax.done(function(data){
39      console.log('ajax data:', data);
40      apodData = data;
41      $(".background").css({
42        background: "url(" + apodData.hdurl + ")",
43        backgroundSize: "cover"
44      });
45
46      $(window).on("load", function(){
47        $(".background").animate({opacity:1});
48      });
49
50      $ajax.fail(function(){
51        // console.log('failed');
52      });
53
54      var explanation;
55      if(apodData.explanation){
56        explanation = apodData.explanation;
57      } else {
58        explanation = "Here lie familiar shapes in unfamiliar locations. On the left is an emission nebula cataloged as NGC 7000, famous partly because it resembles our fair planet's continent of North America. The emission region to the right of the North America Nebula is IC 5070, also known for its suggestive outlines as the Pelican Nebula. Separated by a dark cloud of obscuring dust, the two bright nebulae are about 1,500 light-years away. At that distance, the 4 degree wide field of view spans 100 light-years. This spectacular cosmic portrait combines narrow band images to highlight bright ionization fronts with fine details of dark, dusty forms in silhouette. Emission from atomic hydrogen, sulfur, and oxygen is captured in the narrow band image in scientifically assigned colors. These nebulae can be seen with binoculars from a dark location.";
59      }
60
61      $("#explanation").html(explanation);
62    });
63  };
64
65  $("#shuffleButton").on('click', getAPOD);
66  // getAPOD();
67
68  // background explanation
69
70  $("#infoButton").on("click", function(){
71    var explanation;
72    if(apodData.explanation){
73      explanation = apodData.explanation;
74    } else {
75      explanation = "Here lie familiar shapes in unfamiliar locations. On the left is an emission nebula cataloged as NGC 7000, famous partly because it resembles our fair planet's continent of North America. The emission region to the right of the North America Nebula is IC 5070, also known for its suggestive outlines as the Pelican Nebula. Separated by a dark cloud of obscuring dust, the two bright nebulae are about 1,500 light-years away. At that distance, the 4 degree wide field of view spans 100 light-years. This spectacular cosmic portrait combines narrow band images to highlight bright ionization fronts with fine details of dark, dusty forms in silhouette. Emission from atomic hydrogen, sulfur, and oxygen is captured in the narrow band image in scientifically assigned colors. These nebulae can be seen with binoculars from a dark location.";
76    }
77    $(".primary").toggle();
78    $("#explanation").html(explanation).toggle();
79  });
80
81  $("#explanation").on("click", function(){
82    $(".primary").toggle();
83    $("#explanation").html(explanation).toggle();
84  });
85
86  // hover text
87
88  var hoverText = '<br />';
89
90  $(".link > a").on("mouseover", function(){
91    var linkID = $(this)[0].id;
92
93    $(".hoverText").promise().done(function(){
94      switch (linkID) {
95        case 'mailLink':
96          hoverText = 'Email';
97          break;
98        case 'gitLink':
99          hoverText = 'GitHub';
100          break;
101        case 'inLink':
102          hoverText = 'LinkedIn';
103          break;
104        case 'crumpLink':
105          hoverText = 'Crump Cocktails'
106          break;
107        case 'metronomLink':
108          hoverText = 'metronom'
109          break;
110        case 'vimeoLink':
111          hoverText = 'Videos'
112          break;
113        case 'doorsLink':
114          hoverText = 'Doors 96'
115          break;
116        default:
117          hoverText = '<br />';
118      }
119
120      $(".hoverText").html(hoverText).animate({opacity: 1}, 200);
121    });
122  });
123
124  $(".link > a").on("mouseleave", function(){
125    $(".hoverText").animate({opacity:0}
125, 200);
126
127    $(".hoverText").promise().done(function(){
128      hoverText = '<br />';
129      $(".hoverText").html(hoverText);
130    });
131  });
132
133  console.log('jquery loaded.');
134});
135
136
137function printASCII(){
138    var art=`dHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHb
139    HHP%%#%%%%%%%%%%%%%%%%#%%%%%%%#%%VHH
140    HH%%%%%%%%%%#%v~~~~~~\%%%#%%%%%%%%HH
141    HH%%%%%#%%%%v'        ~~~~\%%%%%#%HH
142    HH%%#%%%%%%v'dHHb      a%%%#%%%%%%HH
143    HH%%%%%#%%v'dHHHA     :%%%%%%#%%%%HH
144    HH%%%#%%%v' VHHHHaadHHb:%#%%%%%%%%HH
145    HH%%%%%#v'   'VHHHHHHHHb:%%%%%#%%%HH
146    HH%#%%%v'      'VHHHHHHH:%%%#%%#%%HH
147    HH%%%%%'        dHHHHHHH:%%#%%%%%%HH
148    HH%%#%%        dHHHHHHHH:%%%%%%#%%HH
149    HH%%%%%       dHHHHHHHHH:%%#%%%%%%HH
150    HH#%%%%       VHHHHHHHHH:%%%%%#%%%HH
151    HH%%%%#   b    HHHHHHHHV:%%%#%%%%#HH
152    HH%%%%%   Hb   HHHHHHHV'%%%%%%%%%%HH
153    HH%%#%%   HH  dHHHHHHV'%%%#%%%%%%%HH
154    HH%#%%%   VHbdHHHHHHV'#%%%%%%%%#%%HH
155    HHb%%#%    VHHHHHHHV'%%%%%#%%#%%%%HH
156    HHHHHHHb    VHHHHHHH:%odHHHHHHbo%dHH
157    HHHHHHHHboodboooooodHHHHHHHHHHHHHHHH
158    HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
159    HHHHH  Mr. Penguin: "Hello" HHHHHHHH
160    VHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHV`;
161
162    function getCharacters(art)
163    {
164    	var i = art.length;
165    	// used to track the time at which the letter should print regardless of the current i (which is the character position including whitespace)
166    	var i_letter = 0;
167    	var s = ''; // string of whitespace
168    	var characters = [];
169    	do
170    	{
171    		i = (i + 1) % art.length;
172    		var c = art[i];
173
174    		var isWhitespace = /\s/.test(c);
175    		if (isWhitespace)
176    		{
177    			s += c;
178    			continue; // don't print the whitespace yet
179    		}
180    		else
181    		{
182    			if (s.length > 0)
183    			{
184    				c = s + c; // be sure to include the character currently being parsed
185    				s = '';
186    			}
187
188    			i_letter = (i_letter + 1) % art.length;
189
190    			characters.push(c);
191    		}
192    	}
193    	while(i);
194
195    	return characters;
196    }
197
198    var characters = getCharacters(art);
199
200    var output = '';
201    function printCharacterByIndex(characters, index, delay)
202    {
203    	if (characters[index] === undefined) return;
204
205    	output += characters[index];
206    	console.clear();
207    	console.log(output)
208
209    	window.setTimeout(printCharacterByIndex.bind(null, characters, index + 1, delay), delay);
210    }
211
212    console.clear();
213    printCharacterByIndex(getCharacters(art), 0, 10);
214
215}

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.