Skip to content

Commit 6d0d0e1

Browse files
committed
Add new Rainmeter skins for API bridge and event handling demos with associated resources.
1 parent e8ad6e2 commit 6d0d0e1

File tree

7 files changed

+209
-3
lines changed

7 files changed

+209
-3
lines changed
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Event Handler Test</title>
6+
<style>
7+
body {
8+
font-family: 'Segoe UI', sans-serif;
9+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
10+
color: white;
11+
padding: 40px;
12+
margin: 0;
13+
}
14+
15+
.test-box {
16+
background: rgba(255, 255, 255, 0.1);
17+
border: 2px solid white;
18+
border-radius: 10px;
19+
padding: 30px;
20+
margin: 20px 0;
21+
cursor: pointer;
22+
transition: all 0.3s;
23+
}
24+
25+
.test-box:hover {
26+
background: rgba(255, 255, 255, 0.2);
27+
transform: scale(1.05);
28+
}
29+
30+
.test-box:active {
31+
background: rgba(255, 255, 255, 0.3);
32+
}
33+
34+
#output {
35+
background: rgba(0, 0, 0, 0.3);
36+
padding: 20px;
37+
border-radius: 8px;
38+
margin-top: 20px;
39+
font-family: 'Courier New', monospace;
40+
min-height: 100px;
41+
}
42+
43+
button {
44+
background: white;
45+
color: #667eea;
46+
border: none;
47+
padding: 15px 30px;
48+
font-size: 16px;
49+
border-radius: 8px;
50+
cursor: pointer;
51+
margin: 10px;
52+
font-weight: 600;
53+
transition: all 0.3s;
54+
}
55+
56+
button:hover {
57+
transform: translateY(-2px);
58+
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
59+
}
60+
61+
input {
62+
width: 100%;
63+
padding: 10px;
64+
margin: 10px 0;
65+
border-radius: 5px;
66+
border: none;
67+
font-size: 14px;
68+
}
69+
</style>
70+
</head>
71+
<body>
72+
<h1>🧪 Event Handler Test</h1>
73+
<p>Test if mouse and keyboard events are working in WebView2</p>
74+
75+
<div class="test-box" onclick="testClick()">
76+
<h2>Click Test</h2>
77+
<p>Click this box to test mouse events</p>
78+
</div>
79+
80+
<div class="test-box" onmousemove="testMouseMove(event)">
81+
<h2>Mouse Move Test</h2>
82+
<p>Move your mouse over this box</p>
83+
<p id="mousePos">Position: (0, 0)</p>
84+
</div>
85+
86+
<div>
87+
<h2>Keyboard Test</h2>
88+
<input type="text" id="keyInput" placeholder="Type here to test keyboard events" onkeyup="testKeyboard(event)">
89+
</div>
90+
91+
<div>
92+
<h2>Button Tests</h2>
93+
<button onclick="testButton('Button 1')">Button 1</button>
94+
<button onclick="testButton('Button 2')">Button 2</button>
95+
<button onclick="testRainmeterAPI()">Test Rainmeter API</button>
96+
</div>
97+
98+
<div id="output">
99+
<strong>Event Log:</strong><br>
100+
Waiting for events...
101+
</div>
102+
103+
<script>
104+
let eventCount = 0;
105+
106+
function log(message) {
107+
eventCount++;
108+
const output = document.getElementById('output');
109+
const time = new Date().toLocaleTimeString();
110+
output.innerHTML += `<br>[${time}] ${eventCount}. ${message}`;
111+
output.scrollTop = output.scrollHeight;
112+
}
113+
114+
function testClick() {
115+
log('✓ Click event fired!');
116+
}
117+
118+
function testMouseMove(event) {
119+
const mousePos = document.getElementById('mousePos');
120+
mousePos.textContent = `Position: (${event.clientX}, ${event.clientY})`;
121+
}
122+
123+
function testKeyboard(event) {
124+
log(`✓ Keyboard event: Key "${event.key}" pressed`);
125+
}
126+
127+
function testButton(name) {
128+
log(`✓ ${name} clicked!`);
129+
}
130+
131+
async function testRainmeterAPI() {
132+
try {
133+
if (typeof rm === 'undefined') {
134+
log('❌ Rainmeter API (rm) not available');
135+
return;
136+
}
137+
138+
log('✓ Rainmeter API available!');
139+
140+
// Test reading a value
141+
const width = await rm.ReadInt('Width', 800);
142+
log(`✓ Read Width: ${width}`);
143+
144+
// Test logging
145+
rm.Log('Event handler test successful!', 'Notice');
146+
log('✓ Logged to Rainmeter');
147+
148+
} catch (error) {
149+
log(`❌ Error: ${error.message}`);
150+
}
151+
}
152+
153+
// Test on page load
154+
window.addEventListener('DOMContentLoaded', function() {
155+
log('✓ Page loaded successfully');
156+
log('✓ DOM Content Loaded event fired');
157+
158+
// Check if Rainmeter API is available
159+
if (typeof rm !== 'undefined') {
160+
log('✓ Rainmeter API (rm object) detected');
161+
} else {
162+
log('⚠ Rainmeter API not detected (this is normal for non-plugin pages)');
163+
}
164+
});
165+
166+
// Test mouse enter/leave
167+
document.querySelectorAll('.test-box').forEach(box => {
168+
box.addEventListener('mouseenter', () => {
169+
log('✓ Mouse entered test box');
170+
});
171+
box.addEventListener('mouseleave', () => {
172+
log('✓ Mouse left test box');
173+
});
174+
});
175+
</script>
176+
</body>
177+
</html>

Resources/Skins/WebView2/APIDemo.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ SolidColor=0,0,0,1
77
Name=WebView2 API Bridge Demo
88
Author=NSTechBytes
99
Information=Demonstrates Rainmeter API bridge in JavaScript
10-
Version=1.0.0
10+
Version=0.0.3
11+
License=MIT
1112

1213
[Variables]
1314
ColorPrimary=100,70,255
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[Rainmeter]
2+
Update=1000
3+
BackgroundMode=2
4+
SolidColor=0,0,0,1
5+
6+
[Metadata]
7+
Name=Event Handler Test
8+
Author=NSTechBytes
9+
Information=Test page to verify mouse and keyboard events work in WebView2
10+
Version=0.0.3
11+
License=MIT
12+
13+
[Variables]
14+
WebWidth=800
15+
WebHeight=600
16+
17+
; ========================================
18+
; WebView2 Measure
19+
; ========================================
20+
[MeasureWebView]
21+
Measure=Plugin
22+
Plugin=WebView2
23+
Url=#@#event-test.html
24+
Width=#WebWidth#
25+
Height=#WebHeight#
26+
X=0
27+
Y=0
28+
Visible=1

Resources/Skins/WebView2/Main.ini

0 Bytes
Binary file not shown.

Resources/banner.bmp

0 Bytes
Binary file not shown.

Resources/skin_definition.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"skinDir": ".\\Resources\\Skins",
3-
"version": "1.2.0",
3+
"version": "0.0.3",
44
"minimumVersion": "4.5",
55
"author": "nstechbytes",
66
"variableFiles": "",
@@ -17,5 +17,5 @@
1717
"load": "WebView2\\Main.ini",
1818
"headerImage": ".\\Resources\\banner.bmp",
1919
"configPrefix": "WebView2",
20-
"output": ".\\dist\\WebView2_Alpha2.rmskin"
20+
"output": ".\\dist\\WebView2_v0.0.3_Alpha.rmskin"
2121
}

WebView2/WebView2.rc

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)