-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vladislav.saifulin
committed
Oct 4, 2019
1 parent
640ab2c
commit d697464
Showing
12 changed files
with
10,480 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
## IDEs ### | ||
*.sublime-workspace | ||
.tag* | ||
.tern-project | ||
.idea | ||
|
||
### OSX ### | ||
.DS_Store | ||
.AppleDouble | ||
.LSOverride | ||
Icon | ||
|
||
# Thumbnails | ||
._* | ||
|
||
# Files that might appear on external disk | ||
.Spotlight-V100 | ||
.Trashes | ||
|
||
### Windows ### | ||
# Windows image file caches | ||
Thumbs.db | ||
ehthumbs.db | ||
|
||
# Folder config file | ||
Desktop.ini | ||
|
||
# Recycle Bin used on file shares | ||
$RECYCLE.BIN/ | ||
|
||
dist/ | ||
node_modules/ | ||
.tmp | ||
GumGumScreenshots_*.crx | ||
updates.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"printWidth": 100, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": false, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
[33mcommit 640ab2cc8521ec24ba902478236da72ae9ab59fe[m[33m ([m[1;36mHEAD -> [m[1;32mmaster[m[33m)[m | ||
Author: vladislav.saifulin <[email protected]> | ||
Date: Sat Oct 5 02:55:47 2019 +0300 | ||
|
||
first commit | ||
|
||
[1mdiff --git a/README.md b/README.md[m | ||
[1mnew file mode 100644[m | ||
[1mindex 0000000..bdd5def[m | ||
[1m--- /dev/null[m | ||
[1m+++ b/README.md[m | ||
[36m@@ -0,0 +1,75 @@[m | ||
[32m+[m[32m# chrome-extension-template[m | ||
[32m+[m | ||
[32m+[m[32m## Introduction[m | ||
[32m+[m | ||
[32m+[m[32mThis project aims to provide an easy to use boilerplate for chrome extensions, showcasing communication between its different scripts.[m | ||
[32m+[m | ||
[32m+[m[32mNot all extensions will need of all scripts or all types of messaging. All code snippets are optional. Text and images should be replaced with your own.[m | ||
[32m+[m | ||
[32m+[m[32m## Installation[m | ||
[32m+[m | ||
[32m+[m[32mClone the repo:[m | ||
[32m+[m | ||
[32m+[m[32m```[m | ||
[32m+[m[32mgit clone [email protected]:edrpls/chrome-extension-template.git name-of-your-project[m | ||
[32m+[m[32m```[m | ||
[32m+[m | ||
[32m+[m[32mSet git to track your own repository instead of this one:[m | ||
[32m+[m | ||
[32m+[m[32m```[m | ||
[32m+[m[32mgit remote set-url --delete origin [email protected]:edrpls/chrome-extension-template.git # Remove old origin[m | ||
[32m+[m[32mgit remote set-url --add origin [YOUR REPO URL] # Add new origin[m | ||
[32m+[m[32m```[m | ||
[32m+[m | ||
[32m+[m[32mInstall dependencies:[m | ||
[32m+[m | ||
[32m+[m[32m```[m | ||
[32m+[m[32myarn install # or npm install[m | ||
[32m+[m[32m```[m | ||
[32m+[m | ||
[32m+[m[32m## Usage[m | ||
[32m+[m | ||
[32m+[m[32mTo run a development server that will watch for file changes and rebuild the scripts, run:[m | ||
[32m+[m | ||
[32m+[m[32m```[m | ||
[32m+[m[32myarn start[m | ||
[32m+[m[32m```[m | ||
[32m+[m | ||
[32m+[m[32mTo just build the files without the development server:[m | ||
[32m+[m | ||
[32m+[m[32m```[m | ||
[32m+[m[32myarn build[m | ||
[32m+[m[32m```[m | ||
[32m+[m | ||
[32m+[m[32mBoth commands will create a `dist/` directory, it will contain the built files that should be loaded into the browser or packed.[m | ||
[32m+[m | ||
[32m+[m[32m## Load into Chrome[m | ||
[32m+[m | ||
[32m+[m[32mTo load the built files into Chrome, open [chrome://extensions/](chrome://extensions/).[m | ||
[32m+[m | ||
[32m+[m[32mEnable "Developer mode" if it's not enabled yet:[m | ||
[32m+[m | ||
[32m+[m[32m![Developer Mode Checkbox](assets/dev_mode.png)[m | ||
[32m+[m | ||
[32m+[m[32mClick on "Load unpacked":[m | ||
[32m+[m | ||
[32m+[m[32m![Load Unpacked Button](assets/load_unpacked.png)[m | ||
[32m+[m | ||
[32m+[m[32mFind the `dist/` directory on your system and open it.[m | ||
[32m+[m | ||
[32m+[m[32mThe extension should be now at the top of the page:[m | ||
[32m+[m | ||
[32m+[m[32m![Extension Loaded](assets/ext_loaded.png)[m | ||
[32m+[m | ||
[32m+[m[32m## Publishing[m | ||
[32m+[m | ||
[32m+[m[32m[Follow the official docs](https://developer.chrome.com/webstore/publish) to learn how to publish a Chrome extension.[m | ||
[32m+[m[32mPlease note that Google has its own process to review public extensions and using this boilerplate **does not guarantee** that the extension will pass it. Passing the review process is your responsibility![m | ||
[32m+[m | ||
[32m+[m[32m## External resources[m | ||
[32m+[m | ||
[32m+[m[32m* [Sample extension built with this template](https://github.com/edrpls/social-network-alert)[m | ||
[32m+[m | ||
[32m+[m[32m* [Chrome Developer Documentation](https://developer.chrome.com/extensions/devguide)[m | ||
[32m+[m | ||
[32m+[m[32m* [Overview slides about Chrome Extensions](https://github.com/edrpls/chrome-extensions-what-why-how)[m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Shortcuts for Yandex.Music™", | ||
"version": "1.0.0", | ||
"description": "Shortcuts support for Yandex.Music™. \nIcons made by https://www.flaticon.com/authors/smashicons from www.flaticon.com", | ||
"icons": { | ||
"128": "128.png" | ||
}, | ||
"browser_action": { | ||
"default_title": "Yandex.Music™ global shortcuts" | ||
}, | ||
"content_scripts": [ | ||
{ | ||
"matches": [ | ||
"https://music.yandex.ru/*" | ||
], | ||
"js": [ | ||
"in-content.js" | ||
] | ||
} | ||
], | ||
"background": { | ||
"scripts": [ | ||
"background.js" | ||
], | ||
"persistent": true | ||
}, | ||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'; img-src * data: 'self' 'unsafe-eval'", | ||
"offline_enabled": true, | ||
"permissions": [], | ||
"commands": { | ||
"next-track": { | ||
"suggested_key": { | ||
"default": "Ctrl+Shift+3" | ||
}, | ||
"description": "Go to next", | ||
"global": true | ||
}, | ||
"prev-track": { | ||
"suggested_key": { | ||
"default": "Ctrl+Shift+1" | ||
}, | ||
"description": "Go to previous", | ||
"global": true | ||
}, | ||
"toggle-pause": { | ||
"suggested_key": { | ||
"default": "Ctrl+Shift+2" | ||
}, | ||
"description": "Play/pause", | ||
"global": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"name": "chrome-extension-template", | ||
"version": "0.0.9", | ||
"description": "Chrome extension boilerplate, replace all values!", | ||
"main": "src/index.js", | ||
"repository": "[email protected]:edrpls/chrome-extension-template.git", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^7.2.3", | ||
"babel-loader": "^7.1.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-plugin-transform-react-jsx": "^6.24.1", | ||
"babel-preset-env": "^1.6.1", | ||
"copy-webpack-plugin": "^4.0.1", | ||
"crx-webpack-plugin": "^0.1.5", | ||
"eslint": "^4.2.0", | ||
"eslint-plugin-react": "^7.1.0", | ||
"rimraf": "^2.6.1", | ||
"webpack": "^3.2.0" | ||
}, | ||
"scripts": { | ||
"start": "nodemon --exec yarn build", | ||
"prebuild": "rimraf dist", | ||
"build": "webpack" | ||
}, | ||
"nodemonConfig": { | ||
"ignore": [ | ||
"dist/", | ||
"node_modules" | ||
], | ||
"execMap": { | ||
"js": "node" | ||
}, | ||
"ext": "js html css", | ||
"verbose": true | ||
}, | ||
"dependencies": { | ||
"nodemon": "^1.14.12" | ||
}, | ||
"resolutions": { | ||
"**/event-stream": "^4.0.1" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
chrome.commands.onCommand.addListener(function(command) { | ||
chrome.tabs.query({}, function(tabs){ | ||
for (let i = 0; i < tabs.length; i++) { | ||
chrome.tabs.sendMessage(tabs[i].id, command); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function inject(code) { | ||
const th = document.getElementsByTagName("head")[0]; | ||
const s = document.createElement("script"); | ||
s.setAttribute("type", "text/javascript"); | ||
s.innerText = code; | ||
th.appendChild(s); | ||
console.log("Injected " + code); | ||
} | ||
|
||
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) { | ||
console.log(message); | ||
if (message === "next-track") { | ||
inject("externalAPI.next();"); | ||
} else if (message === "prev-track") { | ||
inject("externalAPI.prev();"); | ||
} else if (message === "toggle-pause") { | ||
inject("externalAPI.togglePause();"); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const path = require('path'); | ||
const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||
const Crx = require('crx-webpack-plugin'); | ||
const { version } = require('./package.json'); | ||
|
||
module.exports = { | ||
entry: { | ||
background: './src/js/background.js', | ||
'in-content': './src/js/in-content.js' | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
filename: '[name].js' | ||
}, | ||
|
||
cache: true, | ||
devtool: 'eval-cheap-module-source-map', | ||
|
||
module: { | ||
loaders: [ | ||
{ | ||
test: /\.js?$/, | ||
include: [path.resolve(__dirname, 'src')], | ||
loader: 'babel-loader' | ||
} | ||
] | ||
}, | ||
|
||
plugins: [ | ||
new CopyWebpackPlugin([ | ||
{ from: './manifest.json' }, | ||
{ from: './src/images' }, | ||
{ from: './src/views' } | ||
]) | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="WEB_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
Oops, something went wrong.