-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.js
44 lines (37 loc) · 1.14 KB
/
script.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
// ==UserScript==
// @name eiv
// @description A simple script to get eruda running on via browser
// @namespace https://github.com/qxb3/eiv
// @version 1.0.1
// @run-at document-start
// @match *
// @grant none
// ==/UserScript==
(function() {
const cdnUrl = '//cdn.jsdelivr.net/npm/'
const toCamelCase = (str) => str.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (_, chr) => chr.toUpperCase())
const loadScript = (name, callback) => {
const script = document.createElement('script')
script.src = cdnUrl + name
script.onload = callback
document.body.appendChild(script)
}
const loadPlugins = (plugins) => {
plugins = plugins.map(plugin => 'eruda-' + plugin)
plugins.forEach(plugin => {
loadScript(plugin, () => {
eruda.add(window[toCamelCase(plugin)])
})
})
}
loadScript('eruda', () => {
eruda.init({
defaults: {
displaySize: 55,
theme: 'Dark'
}
})
// Visit: https://github.com/liriliri/eruda#plugins to see available plugins (NOTE: don't include the 'eruda' at the beginning)
loadPlugins(['fps', 'code', 'dom'])
})
})()