reader.js
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
/* global, layout, slickgrid, Cookies, common */
layout.content_height = function() {
"use strict";
return $(window).height() - $('#header').height() - 5;
};
layout.grid_height = function() {
"use strict";
return $('#left').innerHeight() - parseInt($('#content').css('padding-top'), 10) + 5;
};
layout.adjust_tabs = function() {
"use strict";
var right = $('#right'), content = $('#content');
right.height(content.height() + 5);
right.outerWidth(
content.width() - $('#left').outerWidth() - $('.vsplitbar').width());
};
layout.left_width = 340;
$(function() {
"use strict";
var menu_containers = $('.menu-container');
$('#dict-name').mouseenter(function() {
$('#main-menu-container').addClass('active');
});
$('#settings-menu-container').mouseenter(function() {
$(this).addClass('active');
});
menu_containers.click(function(event) {
var $t = $(this);
if (!$t.hasClass('active')) {
$t.addClass('active pinned');
}
event.stopPropagation();
});
menu_containers.mouseleave(function() {
var $t = $(this);
if (!$t.hasClass('pinned'))
$t.removeClass('active');
});
$(document).click(function() {
menu_containers.removeClass('active pinned');
});
var splash_hidden;
var storage_present = common.storage_present();
if (storage_present) {
splash_hidden = Cookies.get('splash') || localStorage.getItem('splash');
Cookies.remove('splash');
} else {
splash_hidden = Cookies.get('splash');
}
var splash_overlay = $('#splash-overlay');
if (splash_hidden) {
// przedłużamy
if (!storage_present)
Cookies.set('splash', 'hidden', {expires: 365});
} else {
splash_overlay.show();
}
splash_overlay.add('#splash-button').click(function() {
splash_overlay.hide();
if (storage_present) {
localStorage.setItem('splash', 'hidden');
} else {
Cookies.set('splash', 'hidden', {expires: 365});
}
});
$('#splash').click(function(event) {
event.stopPropagation();
});
$('.show-splash').click(function() {
splash_overlay.show();
});
});