Repository navigation
Expand file tree
/
Copy pathgraphsgfysscript.js
More file actions
89 lines (85 loc) · 2.23 KB
/
Copy pathgraphsgfysscript.js
File metadata and controls
89 lines (85 loc) · 2.23 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
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
if (typeof noofgfys === 'undefined'){
var noofgfys = 0;
}
(function(d, t) {
var g = d.createElement(t),
s = d.getElementsByTagName(t)[0];
g.src = 'http://assets.gfycat.com/js/gfyajax-0.517d.js';
s.parentNode.insertBefore(g, s);
}(document, 'script'));
spoiler = 0;
$(document).ready(function(){
$(".spoilercontent").hide();
if (mobile === false){
$(".maximize").hover(function(){
$(this).fadeTo(300, 0.5);
}, function(){
$(this).fadeTo(300, 0);
});
$(".ig-button").hover(function(){
$(this).toggleClass("ighighlighted");
});
$(".fullsize").hover(function(){
$(this).toggleClass("highlighted");
});
}
else {
$(".maximize").attr("src", "assets/tapenlarge.png").css("opacity",100);
}
$(".maximize").click(function(){
var char = $(this).parents("#ig-content").attr('class');
var num = $(this).attr('id');
if (num.length > 2){
char = "";
}
if ($("#bigimg").length === 0){
var w = $(window).width();
var h = $(window).height();
var code ='<img id="bigimg" src="assets/infographs/'+char+num+'.jpg"/>';
$("#bigimgcontainer").append(code);
var $bigimg = $("#bigimg");
$bigimg.load(function(){
var ratio = $bigimg.width() / $bigimg.height() ;
var top = h - $bigimg.height();
var left = w - $bigimg.width();
if (top < 40 || left < 40){
if (top < 40){
$bigimg.height((h-40));
top = 0;
$bigimg.width($bigimg.height() * ratio);
left = (w - $bigimg.width())*0.5 - 20;
}
else if (left < 40){
$bigimg.width((w-40));
left = 0;
$bigimg.height($bigimg.width() / ratio);
top = (h - $bigimg.height())*0.5 - 20;
}
}
else {
top = top * 0.5 - 20;
left = left * 0.5 - 20;
}
$bigimg.css({"top":top+"px","left":left+"px"});
});
$bigimg.click(function(){
$("#bigimgcontainer").empty();
});
}
});
$(".spoilerbutton").hover(function(){
$(this).toggleClass("spoilerbuttonhighlight");
});
$(".spoilerbutton").click(function(){
if (spoiler){
$(".spoilercontent").hide();
spoiler = 0;
$(".spoilerbutton").children("p").empty().append("Show");
}
else {
$(".spoilercontent").show();
spoiler = 1;
$(".spoilerbutton").children("p").empty().append("Hide");
}
});
});