skele
This commit is contained in:
commit
ff024aa9bb
27 changed files with 8276 additions and 0 deletions
3
.babelrc
Normal file
3
.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"presets": ["@babel/env"]
|
||||
}
|
3
.bowerrc
Normal file
3
.bowerrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"directory": "app/bower_components"
|
||||
}
|
24
.editorconfig
Normal file
24
.editorconfig
Normal file
|
@ -0,0 +1,24 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
|
||||
# Change these settings to your own preference
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.json]
|
||||
indent_size = 2
|
||||
|
||||
# We recommend you to keep these unchanged
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
* text=auto
|
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
node_modules
|
||||
temp
|
||||
.tmp
|
||||
dist
|
||||
.sass-cache
|
||||
app/bower_components
|
||||
test/bower_components
|
||||
package
|
||||
app/scripts
|
||||
|
6
.yo-rc.json
Normal file
6
.yo-rc.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"generator-mocha": {
|
||||
"ui": "tdd",
|
||||
"rjs": false
|
||||
}
|
||||
}
|
10
app/_locales/en/messages.json
Normal file
10
app/_locales/en/messages.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"appName": {
|
||||
"message": "fed",
|
||||
"description": "The name of the application"
|
||||
},
|
||||
"appDescription": {
|
||||
"message": "feddie",
|
||||
"description": "The description of the application"
|
||||
}
|
||||
}
|
BIN
app/images/icon-128.png
Normal file
BIN
app/images/icon-128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
app/images/icon-16.png
Normal file
BIN
app/images/icon-16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 758 B |
BIN
app/images/icon-19.png
Normal file
BIN
app/images/icon-19.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
app/images/icon-38.png
Normal file
BIN
app/images/icon-38.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
1
app/libs/polyfill.min.js
vendored
Normal file
1
app/libs/polyfill.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
62
app/manifest.json
Normal file
62
app/manifest.json
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
"name": "__MSG_appName__",
|
||||
"version": "0.0.1",
|
||||
"manifest_version": 2,
|
||||
"description": "__MSG_appDescription__",
|
||||
"icons": {
|
||||
"16": "images/icon-16.png",
|
||||
"128": "images/icon-128.png"
|
||||
},
|
||||
"default_locale": "en",
|
||||
"background": {
|
||||
"scripts": [
|
||||
"libs/polyfill.min.js",
|
||||
"scripts/chromereload.js",
|
||||
"scripts/background.js"
|
||||
]
|
||||
},
|
||||
"permissions": [
|
||||
"tabs",
|
||||
"http://*/*",
|
||||
"https://*/*",
|
||||
"background",
|
||||
"clipboardRead",
|
||||
"management",
|
||||
"notifications",
|
||||
"storage",
|
||||
"webNavigation",
|
||||
"webRequest",
|
||||
"*://*.google.com/"
|
||||
],
|
||||
"options_ui": {
|
||||
"page": "options.html",
|
||||
"chrome_style": true
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": [
|
||||
"http://*/*",
|
||||
"https://*/*"
|
||||
],
|
||||
"js": [
|
||||
"scripts/contentscript.js"
|
||||
],
|
||||
"run_at": "document_end",
|
||||
"all_frames": false
|
||||
}
|
||||
],
|
||||
"omnibox": {
|
||||
"keyword": "OMNIBOX-KEYWORD"
|
||||
},
|
||||
"browser_action": {
|
||||
"default_icon": {
|
||||
"19": "images/icon-19.png",
|
||||
"38": "images/icon-38.png"
|
||||
},
|
||||
"default_title": "fed",
|
||||
"default_popup": "popup.html"
|
||||
},
|
||||
"web_accessible_resources": [
|
||||
"images/icon-48.png"
|
||||
]
|
||||
}
|
24
app/options.html
Normal file
24
app/options.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<!-- build:css styles/options-vendor.css -->
|
||||
<!-- bower:css -->
|
||||
<!-- endbower -->
|
||||
<!-- endbuild -->
|
||||
<!-- build:css styles/main.css -->
|
||||
<link href="styles/main.css" rel="stylesheet">
|
||||
<!-- endbuild -->
|
||||
</head>
|
||||
<body>
|
||||
<h1>'Allo, 'Allo!</h1>
|
||||
|
||||
<!-- build:js scripts/options-vendor.js -->
|
||||
<!-- bower:js -->
|
||||
<!-- endbower -->
|
||||
<!-- endbuild -->
|
||||
|
||||
<!-- build:js scripts/options.js -->
|
||||
<script src="scripts/options.js"></script>
|
||||
<!-- endbuild -->
|
||||
</body>
|
||||
</html>
|
25
app/popup.html
Normal file
25
app/popup.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<!-- build:css styles/popup-vendor.css -->
|
||||
<!-- bower:css -->
|
||||
<!-- endbower -->
|
||||
<!-- endbuild -->
|
||||
<!-- build:css styles/main.css -->
|
||||
<link href="styles/main.css" rel="stylesheet">
|
||||
<!-- endbuild -->
|
||||
</head>
|
||||
<body>
|
||||
<h1>'Allo, 'Allo!</h1>
|
||||
|
||||
<!-- build:js scripts/popup-vendor.js -->
|
||||
<!-- bower:js -->
|
||||
<!-- endbower -->
|
||||
<!-- endbuild -->
|
||||
|
||||
<!-- build:js scripts/popup.js -->
|
||||
<script src="scripts/popup.js"></script>
|
||||
<!-- endbuild -->
|
||||
</body>
|
||||
</html>
|
9
app/scripts.babel/background.js
Normal file
9
app/scripts.babel/background.js
Normal file
|
@ -0,0 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
chrome.runtime.onInstalled.addListener(details => {
|
||||
console.log('previousVersion', details.previousVersion);
|
||||
});
|
||||
|
||||
chrome.browserAction.setBadgeText({text: '\'Allo'});
|
||||
|
||||
console.log('\'Allo \'Allo! Event Page for Browser Action');
|
35
app/scripts.babel/chromereload.js
Normal file
35
app/scripts.babel/chromereload.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
'use strict';
|
||||
|
||||
// Reload client for Chrome Apps & Extensions.
|
||||
// The reload client has a compatibility with livereload.
|
||||
// WARNING: only supports reload command.
|
||||
|
||||
const LIVERELOAD_HOST = 'localhost:';
|
||||
const LIVERELOAD_PORT = 35729;
|
||||
const connection = new WebSocket('ws://' + LIVERELOAD_HOST + LIVERELOAD_PORT + '/livereload');
|
||||
|
||||
var lastReload = false;
|
||||
|
||||
chrome.runtime.onInstalled.addListener(function(details) {
|
||||
lastReload = Date.now();
|
||||
});
|
||||
|
||||
connection.onerror = error => {
|
||||
console.log('reload connection got error:', error);
|
||||
};
|
||||
|
||||
connection.onmessage = e => {
|
||||
if (e.data) {
|
||||
const data = JSON.parse(e.data);
|
||||
if (data && data.command === 'reload') {
|
||||
var currentTime = Date.now();
|
||||
if (lastReload && currentTime - lastReload > 60000) {
|
||||
// don't reload more than once a minute
|
||||
chrome.runtime.reload();
|
||||
chrome.developerPrivate.reload(chrome.runtime.id,
|
||||
{failQuietly: true});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
3
app/scripts.babel/contentscript.js
Normal file
3
app/scripts.babel/contentscript.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
console.log('\'Allo \'Allo! Content script');
|
3
app/scripts.babel/options.js
Normal file
3
app/scripts.babel/options.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
console.log('\'Allo \'Allo! Option');
|
3
app/scripts.babel/popup.js
Normal file
3
app/scripts.babel/popup.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
console.log('\'Allo \'Allo! Popup');
|
3
app/styles/main.css
Normal file
3
app/styles/main.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
padding: 20px;
|
||||
}
|
7
bower.json
Normal file
7
bower.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"name": "fed",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"dependencies": {},
|
||||
"devDependencies": {}
|
||||
}
|
142
gulpfile.babel.js
Normal file
142
gulpfile.babel.js
Normal file
|
@ -0,0 +1,142 @@
|
|||
// generated on 2023-10-25 using generator-chrome-extension 0.7.4
|
||||
import gulp from 'gulp';
|
||||
import gulpLoadPlugins from 'gulp-load-plugins';
|
||||
import del from 'del';
|
||||
import runSequence from 'run-sequence';
|
||||
import {stream as wiredep} from 'wiredep';
|
||||
|
||||
const $ = gulpLoadPlugins();
|
||||
|
||||
gulp.task('extras', () => {
|
||||
return gulp.src([
|
||||
'app/*.*',
|
||||
'app/_locales/**',
|
||||
'!app/scripts.babel',
|
||||
'!app/*.json',
|
||||
'!app/*.html',
|
||||
], {
|
||||
base: 'app',
|
||||
dot: true
|
||||
}).pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
function lint(files, options) {
|
||||
return () => {
|
||||
return gulp.src(files)
|
||||
.pipe($.eslint(options))
|
||||
.pipe($.eslint.format());
|
||||
};
|
||||
}
|
||||
|
||||
gulp.task('lint', lint('app/scripts.babel/**/*.js', {
|
||||
env: {
|
||||
es6: true
|
||||
}
|
||||
}));
|
||||
|
||||
gulp.task('images', () => {
|
||||
return gulp.src('app/images/**/*')
|
||||
.pipe($.if($.if.isFile, $.cache($.imagemin({
|
||||
progressive: true,
|
||||
interlaced: true,
|
||||
// don't remove IDs from SVGs, they are often used
|
||||
// as hooks for embedding and styling
|
||||
svgoPlugins: [{cleanupIDs: false}]
|
||||
}))
|
||||
.on('error', function (err) {
|
||||
console.log(err);
|
||||
this.end();
|
||||
})))
|
||||
.pipe(gulp.dest('dist/images'));
|
||||
});
|
||||
|
||||
gulp.task('html', () => {
|
||||
return gulp.src('app/*.html')
|
||||
.pipe($.useref({searchPath: ['.tmp', 'app', '.']}))
|
||||
.pipe($.sourcemaps.init())
|
||||
.pipe($.if('*.js', $.uglify()))
|
||||
.pipe($.if('*.css', $.cleanCss({compatibility: '*'})))
|
||||
.pipe($.sourcemaps.write())
|
||||
.pipe($.if('*.html', $.htmlmin({
|
||||
collapseWhitespace: true,
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
removeComments: true
|
||||
})))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('chromeManifest', () => {
|
||||
return gulp.src('app/manifest.json')
|
||||
.pipe($.chromeManifest({
|
||||
buildnumber: true,
|
||||
background: {
|
||||
target: 'scripts/background.js',
|
||||
exclude: [
|
||||
'scripts/chromereload.js'
|
||||
]
|
||||
}
|
||||
}))
|
||||
.pipe($.if('*.css', $.cleanCss({compatibility: '*'})))
|
||||
.pipe($.if('*.js', $.sourcemaps.init()))
|
||||
.pipe($.if('*.js', $.uglify()))
|
||||
.pipe($.if('*.js', $.sourcemaps.write('.')))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('babel', () => {
|
||||
return gulp.src('app/scripts.babel/**/*.js')
|
||||
.pipe($.plumber())
|
||||
.pipe($.babel({
|
||||
presets: ['@babel/env']
|
||||
}))
|
||||
.pipe(gulp.dest('app/scripts'));
|
||||
});
|
||||
|
||||
gulp.task('clean', del.bind(null, ['.tmp', 'dist']));
|
||||
|
||||
gulp.task('watch', ['lint', 'babel', 'html'], () => {
|
||||
|
||||
$.livereload.listen();
|
||||
|
||||
gulp.watch([
|
||||
'app/*.html',
|
||||
'app/scripts/**/*.js',
|
||||
'app/images/**/*',
|
||||
'app/styles/**/*',
|
||||
'app/_locales/**/*.json'
|
||||
]).on('change', $.livereload.reload);
|
||||
|
||||
gulp.watch('app/scripts.babel/**/*.js', ['lint', 'babel']);
|
||||
gulp.watch('bower.json', ['wiredep']);
|
||||
});
|
||||
|
||||
gulp.task('size', () => {
|
||||
return gulp.src('dist/**/*').pipe($.size({title: 'build', gzip: true}));
|
||||
});
|
||||
|
||||
gulp.task('wiredep', () => {
|
||||
gulp.src('app/*.html')
|
||||
.pipe(wiredep({
|
||||
ignorePath: /^(\.\.\/)*\.\./
|
||||
}))
|
||||
.pipe(gulp.dest('app'));
|
||||
});
|
||||
|
||||
gulp.task('package', function () {
|
||||
var manifest = require('./dist/manifest.json');
|
||||
return gulp.src('dist/**')
|
||||
.pipe($.zip('fed-' + manifest.version + '.zip'))
|
||||
.pipe(gulp.dest('package'));
|
||||
});
|
||||
|
||||
gulp.task('build', (cb) => {
|
||||
runSequence(
|
||||
'lint', 'babel', 'chromeManifest',
|
||||
['html', 'images', 'extras'],
|
||||
'size', cb);
|
||||
});
|
||||
|
||||
gulp.task('default', ['clean'], cb => {
|
||||
runSequence('build', cb);
|
||||
});
|
61
package.json
Normal file
61
package.json
Normal file
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"name": "fed",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.2",
|
||||
"@babel/eslint-parser": "^7.22.15",
|
||||
"@babel/preset-env": "^7.23.2",
|
||||
"@babel/register": "^7.22.15",
|
||||
"del": "^2.2.2",
|
||||
"graceful-fs": "^4.2.11",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-babel": "^8.0.0",
|
||||
"gulp-cache": "^0.4.6",
|
||||
"gulp-chrome-manifest": "0.0.13",
|
||||
"gulp-clean-css": "^2.3.2",
|
||||
"gulp-eslint": "^6.0.0",
|
||||
"gulp-htmlmin": "^2.0.0",
|
||||
"gulp-if": "^2.0.2",
|
||||
"gulp-imagemin": "^2.4.0",
|
||||
"gulp-livereload": "^3.8.1",
|
||||
"gulp-load-plugins": "^1.6.0",
|
||||
"gulp-plumber": "^1.2.1",
|
||||
"gulp-size": "^2.1.0",
|
||||
"gulp-sourcemaps": "^1.12.1",
|
||||
"gulp-uglify": "^1.5.4",
|
||||
"gulp-useref": "^3.1.6",
|
||||
"gulp-zip": "^3.2.0",
|
||||
"json3": "^3.3.3",
|
||||
"main-bower-files": "^2.13.3",
|
||||
"minimatch": "^9.0.3",
|
||||
"polyfill": "^0.1.0",
|
||||
"run-sequence": "^1.2.2",
|
||||
"svgo": "^3.0.2",
|
||||
"uuid": "^9.0.1",
|
||||
"wiredep": "^4.0.0"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"browser": true
|
||||
},
|
||||
"globals": {
|
||||
"chrome": true
|
||||
},
|
||||
"parser": "babel-eslint",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 8
|
||||
},
|
||||
"rules": {
|
||||
"eol-last": 0,
|
||||
"quotes": [
|
||||
2,
|
||||
"single"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
7801
pnpm-lock.yaml
Normal file
7801
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load diff
29
test/index.html
Normal file
29
test/index.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Mocha Spec Runner</title>
|
||||
<link rel="stylesheet" href="../bower_components/mocha/mocha.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="../bower_components/mocha/mocha.js"></script>
|
||||
<script>mocha.setup('tdd');</script>
|
||||
<script src="../bower_components/chai/chai.js"></script>
|
||||
<script>
|
||||
var assert = chai.assert;
|
||||
var expect = chai.expect;
|
||||
var should = chai.should();
|
||||
</script>
|
||||
<!-- bower:js -->
|
||||
<!-- endbower -->
|
||||
<!-- include source files here... -->
|
||||
<!-- include spec files here... -->
|
||||
<script src="spec/test.js"></script>
|
||||
<script>
|
||||
if (navigator.userAgent.indexOf('PhantomJS') === -1) {
|
||||
mocha.run();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
11
test/spec/test.js
Normal file
11
test/spec/test.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
describe('Give it some context', function () {
|
||||
describe('maybe a bit more context here', function () {
|
||||
it('should run here few assertions', function () {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
})();
|
Loading…
Reference in a new issue