Skip to content

Instantly share code, notes, and snippets.

@Legends
Legends / how-to-view-source-of-chrome-extension.md
Last active April 17, 2023 10:22 — forked from paulirish/how-to-view-source-of-chrome-extension.md
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

<html>
<head> ... </head>
<body>
...
<script src="script.js">
....
</body>
</html>
const vw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
const vh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
// Math.max: --> return the heighest of these two provided
// document.documentElement.clientHeight = Height without scrollbars
// window.innerHeight = Height including scrollbars
<html>
<head>
<style>
.ind {
height: 10px;
width: 0%;
background-color: red;
position: fixed;
}
.wrapper {
position: relative;
background-color: red;
}
.childDiv {
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
background-color: yellow;
console.log(getEventListeners(document.body));
// Animate.css also provides css classes to determine speed and delay:
// https://github.com/daneden/animate.css/#setting-delay-and-speed
// Add the `animated` class to your element:
<div id="personal" class="animated">
// Set animation via css:
#personal{
animation-name: fadeIn;
animation-delay: 0.3s;
"<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<title>Document</title>
<link href='mystyle.css' rel='stylesheet'/></head>
<body>
// ############################################## DEBUG YOUR WEBPACK-DEV-SERVER BUILD
launch.json (Debug->Add Configuration->Node):
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
//--> WebpackCompilation is an exported class inside Compilation.js
/** @typedef {import("webpack/lib/Compilation.js")} WebpackCompilation */
//--> WebpackCompiler is an exported class inside Compiler.js
/** @typedef {import("webpack/lib/Compiler.js")} WebpackCompiler */
//--> WebpackOptions is an exported interface inside WebpackOptions.d.ts file
/** @typedef {import("webpack/declarations/WebpackOptions").WebpackOptions} WebpackOptions */
/* ###################################### EXAMPLES #################################################*/