• Stars
    star
    857
  • Rank 53,206 (Top 2 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Easily import JS and CSS resources from Chrome console.

Console Importer

Chrome Web Store Chrome Web Store Chrome Web Store

Demo

Installation

Install it from Chrome Web Store:

https://chrome.google.com/webstore/detail/console-importer/hgajpakhafplebkdljleajgbpdmplhie

Usage

Open Chrome devtools console, a function named $i could be used to import JavaScript and CSS resources.

$i('jquery')

Import specific version:

$i('jquery@2')

Also, you can import a valid script URL:

$i('https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js')

CSS is supported, too:

$i('https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css')

Import ES Module

ES module has been widely supported in modern browsers. $i.esm method can be useful in this case:

d3 = await $i.esm('d3')

or specify a version:

d3 = await $i.esm('d3@7')

The advantage of this approach is that no global variables are added to the window, which allows better control over the scope of side effects. For more details, see https://esm.run.

Trouble shooting

Q: $i doesn't work as expected

Some websites like Google Inbox already have $i used as a global variable. This extension doesn't overwrite it.

You can use console.$i on these websites.

Q: $i fail to import resources

On some websites like GitHub, $i will fail to import resources. Console errors may be like follows:

# js errors example
Refused to connect to 'https://api.cdnjs.com/libraries?search=jquery' because it violates the following Content Security Policy directive:

# css errors example
Refused to load the stylesheet 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' because it violates the following Content Security Policy directive:

It is because of strict Content Security Policy of these websites. For more information, see Content Security Policy (CSP) wiki

How does it work?

  • If it is like a JavaScript lib name, like jquery, try to load it from cdnjs
  • If it has version number, like jquery@2, try to load it from unpkg
  • If it is a valid URL(CSS or JS), load it directly

For advanced use, there are also two functions $i.unpkg and $i.cdnjs which could be used to import resources from specific CDN.

License

MIT

More Repositories

1

hashmd

Hackable Markdown Editor and Viewer (WIP)
TypeScript
4,343
star
2

git-touch

An open-source app for GitHub, GitLab, Bitbucket, Gitea, and Gitee(็ ไบ‘), built with Flutter
Dart
1,560
star
3

debugtron

Debug in-production Electron based app
TypeScript
1,359
star
4

octohint

The missing IntelliSense hint forย GitHub and GitLab
TypeScript
962
star
5

vite-plugin-svgr

Vite plugin to transform SVGs into React components
TypeScript
540
star
6

unpub

Self-hosted private Dart Pub server for Enterprise
Dart
435
star
7

chrome-ui

Chrome browser UI built with web technologies
JavaScript
237
star
8

json-viewer

Port of Firefox's JSON Viewer for Chromium-based Browsers
JavaScript
221
star
9

npmview

A web application to view npm package files
TypeScript
130
star
10

http-indicator

Indicator for HTTP/2, QUIC and HTTP/3
TypeScript
101
star
11

tiza

Console styling for browsers
TypeScript
86
star
12

system-monitor

A browser extension to monitor system status like CPU and memory
TypeScript
81
star
13

flutter-vector-icons

Customizable Icons for Flutter. Port of react-native-vector-icons
Dart
78
star
14

friendly-error

Show uncaught errors friendly in Node.js.
JavaScript
73
star
15

lottiefy

Render Lottie to any engine
JavaScript
62
star
16

octoview

The missing preview feature for GitHub
TypeScript
53
star
17

nanoid-dart

Dart implementation of ai/nanoid
Dart
48
star
18

tampery

A programmable tool to tamper browser requests
TypeScript
33
star
19

cnode-pwa

Progressive Web App for CNode community
TypeScript
32
star
20

echojs-reader

Open source EchoJS reader built with React Native
ReScript
24
star
21

nn

A full featured, cross platform, zero dependencies Node.js version manager
JavaScript
20
star
22

memcached-cli

A simple memcached CLI tool with SASL support
JavaScript
16
star
23

promisify-all

Promisify all Node.js builtin async methods
JavaScript
14
star
24

ant-design-mobile-flutter

Flutter implementation of Ant Design Mobile
Dart
14
star
25

cnode-weapp

WeChat APP for CNode community.
JavaScript
12
star
26

memory-monitor

Moved to https://github.com/pd4d10/system-monitor
JavaScript
11
star
27

moment

Dart
10
star
28

dart-hn

Hacker News PWA built with AngularDart
Dart
9
star
29

flutterdoc

Generate gallery for your Flutter widgets with one command
Dart
9
star
30

userscript-meta

Parse and stringify Userscript metadata.
JavaScript
7
star
31

electron-update-notification

Update notifier for open source Electron apps
TypeScript
5
star
32

devtron-next

Deprecated, see https://github.com/electron-userland/devtron/pull/221
TypeScript
3
star
33

gulp-userscript

Generate Userscript metadata.
JavaScript
3
star
34

nes

WIP
Dart
3
star
35

pd4d10

2
star
36

graphyne

TypeScript
2
star
37

unplugin-properties

TypeScript
2
star
38

airplay

Airplay
JavaScript
1
star
39

qrcode-helper

A Chrome extension to generate and read QRCode
TypeScript
1
star
40

express-server-timing

[DEPRECATED] Add server timing header for express
JavaScript
1
star
41

prettier-plugin-thrift

Prettier Thrift Plugin
TypeScript
1
star
42

device-art

Wrap app screenshots in device artwork
JavaScript
1
star
43

rescript-webext

ReScript bindings for Web Extensions
ReScript
1
star
44

teambition-enhancer

Copy Teambition task link URL
JavaScript
1
star
45

uppjs

Unity PlayerPrefs parser and dumper in JavaScript
TypeScript
1
star