Skip to content

Commit 6ef07f8

Browse files
authored
Merge pull request #3 from NSTechBytes/working2
Working2
2 parents af40d37 + bb91877 commit 6ef07f8

File tree

5 files changed

+136
-165
lines changed

5 files changed

+136
-165
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,16 @@ Height=600
6464
| `X` | X position offset in pixels | 0 | No |
6565
| `Y` | Y position offset in pixels | 0 | No |
6666
| `Hidden` | Hide the WebView on load (0 = visible, 1 = hidden) | 0 | No |
67+
| `DynamicVariables` | Enable dynamic variable updates (0 or 1) | 0 | No |
68+
69+
**Notes**:
70+
- Transparent background is always enabled by default. Developer tools (F12) are always available.
71+
- When `DynamicVariables=1`, the plugin intelligently handles updates:
72+
- **URL changes**: Navigates to the new URL without recreating the WebView
73+
- **Dimension/Position changes** (`W`, `H`, `X`, `Y`): Applied instantly without flickering
74+
- **Visibility changes** (`Hidden`): Applied instantly
75+
- The WebView is only created once on first load, preventing flickering issues
6776

68-
**Note**: Transparent background is always enabled by default. Developer tools (F12) are always available.
6977

7078
### Bang Commands
7179

@@ -77,13 +85,7 @@ Execute commands from your skin using `[!CommandMeasure MeasureName "Command"]`:
7785
| `Reload` | Reload the current page | `[!CommandMeasure MeasureWebView "Reload"]` |
7886
| `GoBack` | Navigate to the previous page in history | `[!CommandMeasure MeasureWebView "GoBack"]` |
7987
| `GoForward` | Navigate to the next page in history | `[!CommandMeasure MeasureWebView "GoForward"]` |
80-
| `Show` | Make the WebView visible | `[!CommandMeasure MeasureWebView "Show"]` |
81-
| `Hide` | Hide the WebView | `[!CommandMeasure MeasureWebView "Hide"]` |
8288
| `ExecuteScript <script>` | Execute JavaScript code in the WebView | `[!CommandMeasure MeasureWebView "ExecuteScript alert('Hello')"]` |
83-
| `SetW <width>` | Set the width of the WebView in pixels | `[!CommandMeasure MeasureWebView "SetW 1024"]` |
84-
| `SetH <height>` | Set the height of the WebView in pixels | `[!CommandMeasure MeasureWebView "SetH 768"]` |
85-
| `SetX <x>` | Set the X position offset in pixels | `[!CommandMeasure MeasureWebView "SetX 100"]` |
86-
| `SetY <y>` | Set the Y position offset in pixels | `[!CommandMeasure MeasureWebView "SetY 50"]` |
8789
| `OpenDevTools` | Open the browser developer tools (F12) | `[!CommandMeasure MeasureWebView "OpenDevTools"]` |
8890

8991
## 🔌 JavaScript API

Resources/Skins/WebView2/BangCommand/BangCommand.ini

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,33 @@ Information=Demonstrates controlling WebView2 via !CommandMeasure bangs.
1010
Version=1.0
1111
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
1212

13+
[Variables]
14+
WebURL=https://nstechbytes.pages.dev/
15+
WebW=600
16+
WebH=350
17+
WebX=300
18+
WebY=25
19+
Hidden=0
1320
; ========================================
1421
; Measure
1522
; ========================================
1623
[MeasureWebView]
1724
Measure=Plugin
1825
Plugin=WebView2
19-
URL=https://nstechbytes.pages.dev/
20-
W=600
21-
H=350
22-
X=300
23-
Y=25
26+
URL=#WebURL#
27+
W=#WebW#
28+
H=#WebH#
29+
X=#WebX#
30+
Y=#WebY#
31+
Hidden=#Hidden#
32+
DynamicVariables=1
2433

2534
; ========================================
2635
; Background
2736
; ========================================
2837
[MeterBackground]
2938
Meter=Shape
30-
Shape=Rectangle 0,0,950,400 | FillColor 0,0,0,1 | StrokeWidth 0
39+
Shape=Rectangle 0,0,950,420,12 | FillColor 0,0,0,200 | StrokeWidth 0
3140

3241
[Title]
3342
Meter=String
@@ -36,7 +45,7 @@ FontSize=16
3645
FontColor=255,255,255,255
3746
AntiAlias=1
3847
X=25
39-
Y=5
48+
Y=10
4049

4150
[StyleButtonText]
4251
FontColor=255,255,255,255
@@ -48,22 +57,38 @@ StringAlign=CenterCenter
4857
SolidColor=0,200,255,150
4958

5059
; ========================================
51-
; Navigate to URL
60+
; Navigate to URL (Dynamic Variables)
5261
; ========================================
53-
[TxtNavigate]
62+
[TxtNavigateGoogle]
5463
Meter=String
5564
MeterStyle=StyleButtonText
56-
Text=Navigate to https://example.com
65+
Text=Navigate to Google (via Variable)
5766
X=150
5867
Y=58
68+
LeftMouseUpAction=[!SetVariable WebURL "https://www.google.com"][!UpdateMeasure MeasureWebView][!Redraw]
69+
70+
[TxtNavigateGitHub]
71+
Meter=String
72+
MeterStyle=StyleButtonText
73+
Text=Navigate to GitHub (via Variable)
74+
X=150
75+
Y=88
76+
LeftMouseUpAction=[!SetVariable WebURL "https://github.com"][!UpdateMeasure MeasureWebView][!Redraw]
77+
78+
[TxtNavigateExample]
79+
Meter=String
80+
MeterStyle=StyleButtonText
81+
Text=Navigate to Example (via Bang)
82+
X=150
83+
Y=118
5984
LeftMouseUpAction=[!CommandMeasure MeasureWebView "Navigate https://example.com"]
6085

6186
[TxtReload]
6287
Meter=String
6388
MeterStyle=StyleButtonText
6489
Text=Reload
6590
X=150
66-
Y=88
91+
Y=148
6792
LeftMouseUpAction=[!CommandMeasure MeasureWebView "Reload"]
6893

6994
[TxtGoBack]
@@ -73,7 +98,7 @@ Text=Go Back
7398
W=122
7499
H=24
75100
X=86
76-
Y=118
101+
Y=178
77102
LeftMouseUpAction=[!CommandMeasure MeasureWebView "GoBack"]
78103

79104
[TxtGoForward]
@@ -83,7 +108,7 @@ Text=Go Forward
83108
W=125
84109
H=24
85110
X=212
86-
Y=118
111+
Y=178
87112
LeftMouseUpAction=[!CommandMeasure MeasureWebView "GoForward"]
88113

89114
[TxtShow]
@@ -93,8 +118,8 @@ Text=Show
93118
W=122
94119
H=24
95120
X=86
96-
Y=148
97-
LeftMouseUpAction=[!CommandMeasure MeasureWebView "Show"]
121+
Y=208
122+
LeftMouseUpAction=[!SetVariable Hidden 0][!UpdateMeasure MeasureWebView][!Redraw]
98123

99124
[TxtHide]
100125
Meter=String
@@ -103,53 +128,56 @@ Text=Hide
103128
W=125
104129
H=24
105130
X=212
106-
Y=148
107-
LeftMouseUpAction=[!CommandMeasure MeasureWebView "Hide"]
131+
Y=208
132+
LeftMouseUpAction=[!SetVariable Hidden 1][!UpdateMeasure MeasureWebView][!Redraw]
108133

109134
[TxtExecuteScript]
110135
Meter=String
111136
MeterStyle=StyleButtonText
112137
Text=Execute Script
113138
X=150
114-
Y=178
139+
Y=238
115140
LeftMouseUpAction=[!CommandMeasure MeasureWebView "ExecuteScript alert('Hello!')"]
116141

117142
[TxtOpenDevTools]
118143
Meter=String
119144
MeterStyle=StyleButtonText
120145
Text=Open DevTools
121146
X=150
122-
Y=208
147+
Y=268
123148
LeftMouseUpAction=[!CommandMeasure MeasureWebView "OpenDevTools"]
124149

125150
[TxtSetWidth]
126151
Meter=String
127152
MeterStyle=StyleButtonText
128-
Text=Set Width: 500
153+
Text=Set Width: 500 (via Variable)
129154
X=150
130-
Y=238
131-
LeftMouseUpAction=[!CommandMeasure MeasureWebView "SetW 500"]
155+
Y=298
156+
LeftMouseUpAction=[!SetVariable WebW 500][!UpdateMeasure MeasureWebView][!Redraw]
132157

133158
[TxtSetHeight]
134159
Meter=String
135160
MeterStyle=StyleButtonText
136-
Text=Set Height: 400
161+
Text=Set Height: 400 (via Variable)
137162
X=150
138-
Y=268
139-
LeftMouseUpAction=[!CommandMeasure MeasureWebView "SetH 400"]
163+
Y=328
164+
LeftMouseUpAction=[!SetVariable WebH 400][!UpdateMeasure MeasureWebView][!Redraw]
140165

141166
[TxtSetX]
142167
Meter=String
143168
MeterStyle=StyleButtonText
144-
Text=Set X: 100
169+
Text=Set X: 100 (via Variable)
145170
X=150
146-
Y=298
147-
LeftMouseUpAction=[!CommandMeasure MeasureWebView "SetX 100"]
171+
Y=358
172+
LeftMouseUpAction=[!SetVariable WebX 100][!UpdateMeasure MeasureWebView][!Redraw]
148173

149174
[TxtSetY]
150175
Meter=String
151176
MeterStyle=StyleButtonText
152-
Text=Set Y: 50
177+
Text=Set Y: 50 (via Variable)
153178
X=150
154-
Y=328
155-
LeftMouseUpAction=[!CommandMeasure MeasureWebView "SetY 50"]
179+
Y=388
180+
LeftMouseUpAction=[!SetVariable WebY 50][!UpdateMeasure MeasureWebView][!Redraw]
181+
182+
183+

Resources/skin_definition.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"skinDir": ".\\Resources\\Skins",
3-
"version": "0.0.3",
3+
"version": "0.0.4",
44
"minimumVersion": "4.5",
55
"author": "nstechbytes",
66
"variableFiles": "",
@@ -14,8 +14,8 @@
1414
],
1515
"name": "WebView2",
1616
"loadType": "Skin",
17-
"load": "WebView2\\Main.ini",
17+
"load": "WebView2\\Clock\\Clock.ini",
1818
"headerImage": ".\\Resources\\banner.bmp",
1919
"configPrefix": "WebView2",
20-
"output": ".\\dist\\WebView2_v0.0.3_Alpha.rmskin"
20+
"output": ".\\dist\\WebView2_v0.0.4_Alpha4.rmskin"
2121
}

0 commit comments

Comments
 (0)