-
Notifications
You must be signed in to change notification settings - Fork 59
/
renderer.js
85 lines (78 loc) · 2.54 KB
/
renderer.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
function isLockMode() {
const isLocked = store.get('islocked');
if (isLocked) {
$('.should-lock').css('display', 'none');
$('#exit').css('display', 'none');
$('#settings').css('display', 'none');
$('#predefined-tasks-edit').css('display', 'none');
$('#predefined-tasks-divider').css('display', 'none');
}
}//lock mode settings
isLockMode()
if (styleCache.get("is-shadowless")) {
$('html').css('border', '#33333333 1px solid')
}
history.pushState(null, null, document.URL);
window.addEventListener('popstate', function () {
history.pushState(null, null, document.URL)
})//prevent back
let titleAlternative = {
x: 10,
y: 20,
tipElements: "a, i, span, img, div, input",
noTitle: false,
init: function () {
let b = this.noTitle, isTitle;
$(this.tipElements).each(function () {
$(this).mouseover(function (e) {
if (b) {
isTitle = true
} else {
isTitle = $.trim(this.title) !== ''
}
if (isTitle) {
this.myTitle = this.title;
this.title = "";
let a = "<div class='tipsy'><div class='tipsy-arrow tipsy-arrow-n'></div><div class='tipsy-inner'>" + this.myTitle + "</div></div>";
$('body').append(a);
$('.tipsy').css({
"top": (e.pageY + 24) + "px",
"left": (e.pageX - 24) + "px"
}).show('fast');
}
}).mouseout(function () {
if (this.myTitle != null) {
this.title = this.myTitle;
$('.tipsy').remove()
}
}).mousemove(function (e) {
$('.tipsy').css({
"top": (e.pageY + 24) + "px",
"left": (e.pageX - 24) + "px"
}).show('fast');
})
})
}
}
$(function () {
try {
if (!isMiniMode)
titleAlternative.init();
} catch (e) {
titleAlternative.init();
}
})//title attr alternative
let ratioList = [0.75, 0.9, 1, 1.1, 1.25];//zoom ratio
function zoomRatioChange() {
if (store.has("zoom-ratio")) {//zoom page
const { webFrame } = require('electron');
webFrame.setZoomFactor(ratioList[store.get("zoom-ratio")]);
}
}
$(function () {
zoomRatioChange()
})
ipc.on('zoom-ratio-feedback', () => zoomRatioChange());
ipc.on('alert', (event, message) => {
alert(message);
})