-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhi10anime.js
More file actions
57 lines (54 loc) · 1.96 KB
/
hi10anime.js
File metadata and controls
57 lines (54 loc) · 1.96 KB
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
// function to show buttons in old posts e.g. Detective Conan.
function showSpoiler(obj) {
var randinner = obj.parentNode.getElementsByTagName("div")[0];
if (randinner.style.display == "none") randinner.style.display = "";
else randinner.style.display = "none";
}
function createSpoiler(nameArray) {
// ==== ID Formatting ====
// Base ID: 1080
// Link ID: btn1080
// Pane ID: pane1080
nameArray.forEach((elem, idx) => {
// initialization
if (idx !== 0) {
jQuery('#btn' + elem).fadeTo(0, 0.4);
jQuery('#pane' + elem).hide();
}
// event handling
jQuery('#btn' + elem).click(function (event) {
event.preventDefault();
nameArray.forEach(currElem => {
if (jQuery('#pane' + currElem).is(':visible')) {
jQuery('#btn' + currElem).fadeTo('fast', 0.4, function () {
jQuery('#btn' + elem).fadeTo('fast', 1.0);
});
jQuery('#pane' + currElem).fadeOut('medium', function () {
jQuery('#pane' + elem).slideDown('slow');
});
return false;
}
});
});
});
};
function imageShift(code, newImageLink) {
const keys = [];
const origImageLink = jQuery('#cover').attr('src');
(new Image()).src = newImageLink; // preload the hidden image
jQuery(document).keydown(function(event) {
keys.push( event.keyCode );
if ( keys.toString().indexOf(code) >= 0 ) {
// do something when the konami code is executed
jQuery('#cover').stop().fadeOut(function() {
const link = jQuery('#cover').attr('src') == origImageLink ? newImageLink : origImageLink;
jQuery('#cover').attr('src', link).fadeIn();
});
// empty the array containing the key sequence entered by the user
keys.length = 0;
// cache limiter
if ( keys.toString().length >= code.length ) keys.shift();
}
}
);
};