-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
118 lines (106 loc) · 2.98 KB
/
script.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
$(document).ready(function()
{
procenta = 0;
$("#divek").show();
$("#nastaveni").hide();
$.get('lol.txt', function(data)
{
$("#divek").html(data);
if (localStorage.pozice)
{
$('body').scrollTop(localStorage.pozice);
}
$(window).scroll(function (event)
{
scroll = $(window).scrollTop();
if ($("#divek").is(":visible"))
{
localStorage.pozice = scroll;
procenta = parseInt(scroll)/$(document).height()*100;
$("#lista").css(
{
'width' : procenta+"%",
'opacity' : '1',
'transition' : 'none'
});
setTimeout(function(){ $("#lista").css({ 'opacity':'0.5', 'transition':'opacity 5s linear'}); }, 2000);
}
});
if (localStorage.velikost)
{
$("#divek").css("font-size", hodnota);
$("#font-size").text(hodnota);
}
}, 'text');
$("#ikona").click(function()
{
nastaveni();
});
});
function nastaveni()
{
if ($("#divek").is(":visible"))
{
$("#vyska").html(Math.round(procenta*100)/100);
$('#divek').hide();
$('#nastaveni').show();
if ($("#divek").css("opacity") >= 1)
$("#opacity-plus").prop("disabled", true);
else
if ($("#divek").css("opacity") <= 0.1)
$("#opacity-minus").prop("disabled", true);
if (parseInt($("#divek").css("font-size"))/16 >= 3)
$("#font-size-plus").prop("disabled", true);
else
if (parseInt($("#divek").css("font-size"))/16 <= 0.5)
$("#font-size-minus").prop("disabled", true);
}
else
{
$('#divek').show();
$('#nastaveni').hide();
$('body').scrollTop(localStorage.pozice);
}
}
souhlas = false;
function zmenit(typ, toto)
{
if (typ == "font-size" && souhlas != true)
{
if (!confirm("Změna velikosti písma může ovlivnit záložku v knize!"))
return false;
else
souhlas = true;
}
var hodnota = parseFloat($("#divek").css(typ));
if (typ == "font-size")
var hodnota = hodnota/16;
if (toto.val() == "+")
var hodnota = hodnota+0.1;
else
var hodnota = hodnota-0.1;
var hodnota = Math.round(hodnota*10)/10;
if ((typ == "opacity" && (hodnota <= 0.1 || hodnota >= 1)) || (typ == "font-size" && (hodnota <= 0.5 || hodnota >= 1.5)))
{
if (typ == "font-size")
var hodnota = Math.round(hodnota*10)/10+"em";
toto.prop('disabled', true);
if (hodnota == 0.1 || hodnota == 1 || parseFloat(hodnota) == 0.5 || parseFloat(hodnota) == 1.5)
{
$("#divek").css(typ, hodnota);
$("#"+typ).text(hodnota);
if (typ == "font-size")
localStorage.velikost = hodnota;
}
}
else
{
if (typ == "font-size")
var hodnota = Math.round(hodnota*10)/10+"em";
$("#"+typ+"-minus, #"+typ+"-plus").prop('disabled', false);
$("#divek").css(typ, hodnota);
$("#"+typ).text(hodnota);
if (typ == "font-size")
localStorage.velikost = hodnota;
}
}