-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
143 lines (124 loc) · 4.36 KB
/
Copy pathmain.js
File metadata and controls
143 lines (124 loc) · 4.36 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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
const { app, BrowserWindow, globalShortcut, ipcMain } = require('electron');
const path = require('path');
let win;
let isMousePassthrough = false;
let currentOpacity = 0.95;
function createWindow() {
win = new BrowserWindow({
width: 330, // İsteğin üzerine 330'a çekildi
height: 600,
frame: false,
transparent: true,
backgroundColor: '#000000',
alwaysOnTop: true,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true,
nodeIntegration: false,
},
});
win.setAlwaysOnTop(true, 'screen-saver');
win.setOpacity(currentOpacity);
win.loadURL('https://www.tiktok.com/foryou?lang=tr', {
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
});
win.webContents.on('did-finish-load', () => {
const pinpointScript = `
const pinVideo = () => {
let style = document.getElementById('pinpoint-style');
if (!style) {
style = document.createElement('style');
style.id = 'pinpoint-style';
document.head.appendChild(style);
}
style.textContent = \`
//
video {
position: fixed !important;
top: 50% !important;
left: 50% !important;
//
transform: translate(-50%, -50%) scale(1.02) !important;
width: 100vw !important;
height: 100vh !important;
object-fit: cover !important;
z-index: 2147483645 !important;
background: black !important;
}
#__overlay_bar__, #__overlay_bar__ * {
z-index: 2147483647 !important;
visibility: visible !important;
}
//
[class*="DivActionItemContainer"], [class*="DivSideNav"],
[class*="DivHeader"], [class*="ButtonDownload"],
[class*="DivBottomBar"], [class*="DivAvatarContainer"],
[class*="DivVideoDescriptionContainer"], [data-e2e="nav-sidebar"],
[class*="DivBookmarkWrapper"], [class*="DivShareWrapper"],
header, nav, aside, footer {
display: none !important;
opacity: 0 !important;
}
//
html, body {
background: black !important;
overflow: hidden !important;
margin: 0 !important;
padding: 0 !important;
}
\`;
};
pinVideo();
setInterval(pinVideo, 1000);
`;
win.webContents.executeJavaScript(pinpointScript).catch(e => console.error(e));
});
}
app.whenReady().then(() => {
createWindow();
// Alt+N → İleri
globalShortcut.register('Alt+N', () => {
if (!win) return;
win.webContents.executeJavaScript(`
(function() {
window.scrollBy(0, window.innerHeight);
const ev = new KeyboardEvent('keydown', { key: 'ArrowDown', keyCode: 40, bubbles: true });
document.body.dispatchEvent(ev);
const btn = document.querySelector('[data-e2e="arrow-down"]');
if(btn) btn.click();
})();
`);
});
// Alt+M → Geri
globalShortcut.register('Alt+M', () => {
if (!win) return;
win.webContents.executeJavaScript(`
(function() {
window.scrollBy(0, -window.innerHeight);
const ev = new KeyboardEvent('keydown', { key: 'ArrowUp', keyCode: 38, bubbles: true });
document.body.dispatchEvent(ev);
})();
`);
});
// Alt+G → Şeffaflık Geçirgenliği
globalShortcut.register('Alt+G', () => {
isMousePassthrough = !isMousePassthrough;
win.setIgnoreMouseEvents(isMousePassthrough, { forward: true });
win.webContents.send('passthrough-changed', isMousePassthrough);
});
// Parlaklık / Şeffaflık Kontrolü
globalShortcut.register('Alt+Up', () => {
currentOpacity = Math.min(currentOpacity + 0.1, 1.0);
win.setOpacity(currentOpacity);
win.webContents.send('opacity-changed', currentOpacity);
});
globalShortcut.register('Alt+Down', () => {
currentOpacity = Math.max(currentOpacity - 0.1, 0.2);
win.setOpacity(currentOpacity);
win.webContents.send('opacity-changed', currentOpacity);
});
globalShortcut.register('Alt+Q', () => app.quit());
});
ipcMain.on('close-app', () => app.quit());
ipcMain.on('minimize-app', () => win && win.minimize());
app.on('will-quit', () => globalShortcut.unregisterAll());