-
Notifications
You must be signed in to change notification settings - Fork 0
/
dynamic.js
51 lines (37 loc) · 1.02 KB
/
dynamic.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
// scripts to enhance the dYNAMICNESS of my website
const SONG_CHANCE = 0.1;
// On loading the main page ...
$(function() {
console.log( "ready!" );
// PLAY SONGS (not implemented)
var newSongChance = Math.random();
// Random meme
//var memelist = $.getJSON("./other-data/memes.json");
// BUTTON FUNCTIONALITY
// MEME BUTTON
$("#meme-button").click(function () {
console.log("MEME BUTTON CLICKED");
$.getJSON("./other-data/memes.json", function(data) {
var memeCount = data.videos.length;
var memePick = Math.floor(Math.random() * memeCount);
window.open(data.videos[memePick].link, data.videos[memePick].title);
});
});
});
// PIC FLICKERING (in development)
$(".flick").hover(function() {
// First, find out if the alternate pic exists
var originalPic = $("img").attr("width","500");
$.ajax({
url:'http://haoda.fan/somefile.ext',
type:'HEAD',
error: function()
{
//file not exists
},
success: function()
{
//file exists
}
});
});