Skip to content

Commit 1a62347

Browse files
committed
bits
1 parent 96d1e12 commit 1a62347

File tree

6 files changed

+68
-58
lines changed

6 files changed

+68
-58
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## Devhelper web
22

3-
A web interface to debug some bits of Kodi. Enable the web server and remote control, then install
4-
and access the web interface at "http://[hostname]:[port]/addons/webinterface.devhelper/", no need to
5-
change the 'Web interface' setting. With most browsers you can also unpack it and open 'index.html'
6-
right from your local file system without installing it as an add-on.
3+
A web interface to debug some bits of Kodi. Enable Kodi's web server and remote control, then install
4+
this add-on and access the web interface at "http://[kodihostname]:[port]/addons/webinterface.devhelper/",
5+
no need to change the 'Web interface' setting. With some browsers you can also unpack it and
6+
open 'index.html' right from your local file system without installing it as an add-on.
77

88
Latest stable [installable zip](https://github.com/rmrector/repository.rector.stuff/raw/master/latest/webinterface.devhelper-latest.zip).
99

@@ -12,7 +12,7 @@ It can also be installed from my [development repo], which will keep it updated.
1212
[development repo]: (https://github.com/rmrector/repository.rector.stuff/raw/master/latest/repository.rector.stuff-latest.zip).
1313

1414
There is a running data section that watches InfoLabels and InfoBooleans available to skins. This
15-
provides access to much of the information that would be used in a debug overlay during skinning,
15+
provides access to much of the information that would be used in a **debug overlay for skin design**,
1616
and there is plenty of room to show more info without obscuring your design.
1717

1818
![Running data](resources/screenshot1.jpg)

css/rainbowhork.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
background-color: hsl(0, 100%, 83%);
33
}
44
a#maintitle {
5-
background: linear-gradient(to right, hsla(0, 100%, 17%, 1), hsla(39, 100%, 13%, 1),
5+
background-image: linear-gradient(to right, hsla(0, 100%, 17%, 1), hsla(39, 100%, 13%, 1),
66
hsla(60, 100%, 11%, 1), hsla(120, 100%, 12%, 1), hsla(180, 100%, 13%, 1),
77
hsla(240, 100%, 20%, 1), hsla(300, 89%, 15%, 1));
88
color: transparent;
99
-webkit-background-clip: text;
10-
background-clip: text;
10+
background-clip: text;
1111
}
1212
.conbox {
1313
background-color: hsl(30, 100%, 80%);

css/style.css

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $RESET Fix box and simple reset + base */
1+
/* $$RESET Fix box and simple reset + base */
22
html { box-sizing: border-box; }
33
*, *:before, *:after { box-sizing: inherit; margin: 0; padding: 0; }
44
ul { list-style: none; }
@@ -18,7 +18,7 @@ body {
1818
box-shadow: inset 0 0 3px rgba(0, 0, 0, .3);
1919
}
2020

21-
/* $LAYOUT */
21+
/* $$LAYOUT */
2222
.header__titleandbuttons, .conbox__content, .conbox__shortcontent, .content,
2323
.notifications, .footer, .execution-container {
2424
padding: 10px;
@@ -48,13 +48,13 @@ body {
4848
}
4949
.method-list {
5050
box-shadow: 0px 0px 4px 2px hsla(0, 0%, 0%, 0.35);
51+
display: flex;
5152
flex: 1 230px;
53+
flex-direction: column;
54+
height: 100%;
5255
padding-left: 10px;
5356
position: relative;
5457
z-index: 1;
55-
display: flex;
56-
flex-direction: column;
57-
height: 100%;
5858
}
5959
.content-box {
6060
flex: 9999 1 500px;
@@ -126,7 +126,7 @@ body {
126126
}
127127
}
128128

129-
/* $GENERAL */
129+
/* $$GENERAL */
130130
pre {
131131
font-family: 'Roboto Mono', monospace;
132132
font-size: 13.5px;
@@ -176,10 +176,10 @@ i.material-icons {
176176
}
177177
@keyframes rotation {
178178
from { transform: rotate(0deg); }
179-
to { transform: rotate(359deg); }
179+
to { transform: rotate(359.999deg); }
180180
}
181181

182-
/* $BUTTONS */
182+
/* $$BUTTONS */
183183
.flatbutton {
184184
border: none;
185185
color: white;
@@ -229,8 +229,8 @@ i.material-icons {
229229
transition: box-shadow 0.5s, background-color 0.5s, color 0.5s;
230230
}
231231
.action-button:disabled {
232-
color: #CCCCCC;
233232
background-color: #999999;
233+
color: #CCCCCC;
234234
}
235235
.action-button:hover:not(:disabled) {
236236
background-color: #777777;
@@ -250,8 +250,8 @@ i.material-icons {
250250
background-color: hsla(0, 0%, 55%, 0.35);
251251
border-radius: 5px;
252252
display: inline-block;
253-
padding: 5px;
254253
margin: 5px;
254+
padding: 5px;
255255
}
256256
/* Used in connectionbox and contentbox */
257257
.inline-popout {
@@ -268,7 +268,7 @@ i.material-icons {
268268
box-shadow: 0px 0px 5px 2px hsla(222, 100%, 50%, 0.75);
269269
}
270270

271-
/* $Sindex */
271+
/* $$index */
272272
.header__titleandbuttons {
273273
font-size: 26px;
274274
font-weight: bold;
@@ -290,10 +290,13 @@ i.material-icons {
290290
margin-top: -10px;
291291
}
292292
.footer .footer-buttons button {
293-
box-shadow: unset;
294293
height: 40px;
295294
padding-top: 9px;
296295
}
296+
footer .footer-buttons .clearbutton:hover {
297+
background-color: hsla(0, 0%, 100%, 0.5);
298+
box-shadow: unset;
299+
}
297300
.footer .madeby {
298301
width: 100%;
299302
text-align: right;
@@ -304,8 +307,8 @@ i.material-icons {
304307
.splash {
305308
background-color: white;
306309
bottom: 0;
307-
position: absolute;
308310
left: 0;
311+
position: absolute;
309312
right: 0;
310313
top: 0;
311314
transition: opacity 0.2s;
@@ -344,7 +347,7 @@ i.material-icons {
344347
margin-right: 5px;
345348
}
346349

347-
/* $Sconnectionbox */
350+
/* $$connectionbox */
348351
.conbox__content input {
349352
margin-left: 5px;
350353
}
@@ -418,7 +421,7 @@ i.material-icons {
418421
background-color: hsla(0, 0%, 50%, 0.75);
419422
}
420423

421-
/* $Smethodlist */
424+
/* $$methodlist */
422425
.clear-search {
423426
position: absolute;
424427
right: 10px;
@@ -445,7 +448,7 @@ i.material-icons {
445448
top: 0;
446449
}
447450

448-
/* $Scontentbox */
451+
/* $$contentbox */
449452
.runningdata-section {
450453
max-width: 500px;
451454
vertical-align: top;
@@ -545,7 +548,7 @@ i.material-icons {
545548
color: hsl(0, 50%, 35%);
546549
}
547550

548-
/* $Sexecutionbox */
551+
/* $$executionbox */
549552
.execution-container form {
550553
align-items: stretch;
551554
display: flex;
@@ -625,3 +628,4 @@ i.material-icons {
625628
.renderjson .boolean { color: blueviolet; }
626629
.renderjson .key { color: darkblue; }
627630
.renderjson .keyword { color: blue; }
631+
.renderjson .closure, .renderjson .disclosure { color: hsla(240, 101%, 56%, 0.5); }

index.html

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,25 @@
102102
<div class="content-container">
103103
<main id="content-js" class="content"><div class="result">
104104
<p>You can add more Kodi hosts in the orange section to the far right along the top.
105-
<p>Click the "Show running data" button in the right of the red section along the top to watch InfoLabels
106-
and InfoBooleans, the same data available to skins.
105+
<p>Click the "Show running data" button in the right of the red section along the top
106+
to watch InfoLabels and InfoBooleans, the <strong>same data available to skins</strong>.
107+
<p>All notifications from the connected Kodi host will show up on the right, and you can explore
108+
JSON-RPC methods to the left, then fill out the params and execute it below.
109+
<p>URLs power much of the functionality, which can be bookmarked for quick access.
110+
<p>A details box will show up at the bottom of the column to the right, showing details
111+
of certain items as your mouse cursor passes over them. Param details will show up here,
112+
as well as the <strong>full JSON-RPC request</strong> over the title of method "Calling"
113+
and "Result" info, and images from image URLs in requests and the "Available art"
114+
running data section. Click on the item <strong>to pin the details</strong> so
115+
that your mouse cursor can roam.
116+
<p id="webpdb-desc-js" class="nodisplay">See
117+
<a href="http://kodi.wiki/view/HOW-TO:Debug_Python_Scripts_with_Web-PDB" target="_blank">Web PDB</a>
118+
for super Python debugging powers.</p>
107119
<p id="log-desc-js" class="nodisplay">To use the "View Kodi log" button, add "special://logpath/"
108120
as a media source in Kodi (pictures, music, or videos; the file browser won't work).
109121
Do note that this can allow HTTP requests to Kodi to read everything in the same folder
110122
as the log, including subdirectories.
111123
On Windows this includes everything in Kodi's entire data directory.</p>
112-
<p id="webpdb-desc-js" class="nodisplay">See
113-
<a href="http://kodi.wiki/view/HOW-TO:Debug_Python_Scripts_with_Web-PDB" target="_blank">Web PDB</a>
114-
for super Python debugging powers.</p>
115-
<p>All notifications from the connected Kodi host will show up on the right, and you can explore
116-
JSON-RPC methods to the left, then fill out the params and execute it below.
117-
<p>URLs power much of the functionality, which can be bookmarked for quick access.
118-
<p>A details box will show up at the bottom of the column to the right, showing details of certain items
119-
as your mouse cursor passes over them. Param details will show up here, as well as the full JSON-RPC request over
120-
the title of method "Calling" and "Result" info, and images from image URLs in requests and the
121-
"Available art" running data section. Click on the item to pin the details so that your mouse cursor can roam.
122124
</div></main>
123125
<div class="notify-preview-box">
124126
<div class="notify-box-buttons">
@@ -165,6 +167,7 @@
165167
</div>
166168
<address class="madeby">Made by <a href="https://github.com/rmrector" target="_blank">Ryan Rector</a></address>
167169
</footer>
170+
168171
<div id="settings-dialog-vue">
169172
<dialog-window header="Settings" v-show="show" @close="close">
170173
<ul class="settings-list">
@@ -182,7 +185,7 @@
182185
</div>
183186
<div id="artlist-editor-vue">
184187
<dialog-window header="Custom art list" v-show="show" @close="close"
185-
description="Artwork types to look for in RunningData. One art type per line.">
188+
description="Artwork types to look for in RunningData. One art type per line. &quot;Load from Kodi Library&quot; can take a long time.">
186189
<div style="width: 710px;">
187190
<div class="artlist__mediatype"><label>movie:
188191
<textarea v-model.lazy="mediatype_movie"></textarea>
@@ -212,11 +215,12 @@
212215
<div class="splash" id="splash-js"></div>
213216

214217
<div id="uishim-vue">
215-
<link class="themesheet" href="css/rainbowhork.css" rel="stylesheet" title="Default theme"
218+
<link class="themesheet-js" href="css/rainbowhork.css" rel="stylesheet" title="Default theme"
216219
:disabled="shared.settings.theme !== 'Default theme'">
217-
<link class="themesheet" href="css/light.css" rel="alternate stylesheet" title="Light theme"
220+
<link class="themesheet-js" href="css/light.css" rel="alternate stylesheet" title="Light theme"
218221
:disabled="shared.settings.theme !== 'Light theme'">
219222
</div>
223+
220224
<script src="js/ui.js"></script>
221225
<script src="js/frontend.js"></script>
222226
<script>start_app()</script>

js/kodi.js

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ const TIMEOUT = 60000
44

55
// Kodi doesn't like requests > 1024 bytes
66
let LIMIT_WEBSOCKET = 1024
7+
78
const jskodi = {}
89

9-
jskodi.imageencode = image =>
10-
image.startswith('image://') ? image : 'image://' + encodeURIComponent(image) + '/'
11-
jskodi.imagedecode = image =>
12-
decodeURIComponent(image.slice(8, -1))
10+
jskodi.imageencode = image_url =>
11+
image_url.startswith('image://') ? image_url : 'image://' + encodeURIComponent(image_url) + '/'
12+
jskodi.imagedecode = image_url =>
13+
image_url.startswith('image://') ? decodeURIComponent(image_url.slice(8, -1)) : image_url
1314

1415
/**
1516
* A connection to Kodi's websocket port
@@ -186,21 +187,22 @@ jskodi.Connection = class {
186187
this.socket.send(strequest)
187188
})
188189
}
189-
http_call(method, params, {id=undefined, logcall=debug.other_jsonrpc, alldata=false}={}) {
190+
async http_call(method, params, {id=undefined, logcall=debug.other_jsonrpc, alldata=false}={}) {
190191
if (id == null)
191192
id = this.nextid++
192193
const request = {jsonrpc: '2.0', method, params, id}
193194
if (logcall)
194195
console.log('Request', request)
195-
return fetch(this.host + '/jsonrpc', {method: 'POST', body: JSON.stringify(request),
196-
headers: {'Content-Type': 'application/json'}
197-
}).then(r => r.json()).then(data => {
198-
if (logcall)
199-
console.log('Result', data)
200-
if (data.result)
201-
return alldata ? data : data.result
202-
throw (alldata ? data : data.error) || this.build_connection_error('no-result')
203-
})
196+
let data = await fetch(this.host + '/jsonrpc', {
197+
method: 'POST',
198+
body: JSON.stringify(request),
199+
headers: { 'Content-Type': 'application/json' }
200+
}).json()
201+
if (logcall)
202+
console.log('Result', data)
203+
if (data.result)
204+
return alldata ? data : data.result
205+
throw (alldata ? data : data.error) || this.build_connection_error('no-result')
204206
}
205207
async populatedata() {
206208
const args = {getmetadata: true}

js/ui.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ methodlist_toggle.addEventListener('click', () => {
107107
})
108108
methodlist.filtered = ''
109109
methodsearch.addEventListener('keyup', e => {
110-
if (e.keyCode === 13)
110+
if (e.keyCode === 13) // Enter key
111111
return
112112
const filter = methodsearch.value.toLowerCase()
113113
if (filter === methodlist.filtered)
@@ -693,19 +693,19 @@ UI.set_custominfo_options = function(labels, booleans) {
693693
custombooleans.value = booleans.join('\n')
694694
}
695695

696-
UI.get_themes = () => $ls('link.themesheet').map(e => e.title)
696+
UI.get_themes = () => $ls('link.themesheet-js').map(elm => elm.title)
697697
UI.set_theme = new_theme => {
698698
// Firefox doesn't like the way Vue disables stylesheets
699699
let theme_set = false
700-
for (const elem of $ls('link.themesheet')) {
700+
for (const elem of $ls('link.themesheet-js')) {
701701
if (elem.title == new_theme) {
702702
elem.disabled = false
703703
theme_set = true
704704
} else
705705
elem.disabled = true
706-
if (!theme_set)
707-
$ls('link.themesheet').disabled = false
708706
}
707+
if (!theme_set)
708+
$ls('link.themesheet-js')[0].disabled = false
709709
}
710710
UI.hidesplash = function() {
711711
const splash = $('#splash-js')

0 commit comments

Comments
 (0)