Skip to content

Commit

Permalink
recent changes to via
Browse files Browse the repository at this point in the history
  • Loading branch information
qxb3 committed Oct 28, 2022
1 parent 739d7b2 commit e20252e
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
// ==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 *localhost*
// @match *127.0.0.1*
// @match about:blank
// @match *.netlify.app*
// @match *.vercel.app*
// @match *.ngrok.io*
// @match *.is-a.dev*
// @match *.tk*
// @grant none
// ==/UserScript==

/**
* A simple script to get https://github.com/liriliri/eruda working with via browser with an easy to use plugin loader.
*
* Date of creation: April 15, 2022
* @author qxb3 https://github.com/qxb3
* @license MIT
*/
*/

(() => {
const cdnUrl = "//cdn.jsdelivr.net/npm/"
(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")
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 = plugins.map(plugin => 'eruda-' + plugin)

plugins.forEach(plugin => {
loadScript(plugin, () => {
Expand All @@ -28,10 +45,15 @@
})
}

loadScript("eruda", () => {
eruda.init()
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"])
// Visit: https://github.com/liriliri/eruda#plugins to see available plugins (NOTE: don't include the 'eruda' at the beginning)
loadPlugins(['fps', 'code', 'dom'])
})
})()

0 comments on commit e20252e

Please sign in to comment.