This commit is contained in:
femsci 2023-10-30 19:09:14 +01:00
parent ff024aa9bb
commit 0e7fd0a8ab
Signed by: femsci
GPG key ID: 08F7911F0E650C67
40 changed files with 1683 additions and 6472 deletions

View file

@ -1,3 +0,0 @@
{
"presets": ["@babel/env"]
}

View file

@ -1,3 +0,0 @@
{
"directory": "app/bower_components"
}

13
.gitignore vendored
View file

@ -1,10 +1,3 @@
node_modules
temp
.tmp
dist
.sass-cache
app/bower_components
test/bower_components
package
app/scripts
/node_modules
/dist
/web-ext-artifacts

5
.prettierrc Normal file
View file

@ -0,0 +1,5 @@
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true
}

View file

@ -1,6 +0,0 @@
{
"generator-mocha": {
"ui": "tdd",
"rjs": false
}
}

View file

@ -1,10 +0,0 @@
{
"appName": {
"message": "fed",
"description": "The name of the application"
},
"appDescription": {
"message": "feddie",
"description": "The description of the application"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 758 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

File diff suppressed because one or more lines are too long

View file

@ -1,62 +0,0 @@
{
"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"
]
}

View file

@ -1,24 +0,0 @@
<!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>

View file

@ -1,25 +0,0 @@
<!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>

View file

@ -1,9 +0,0 @@
'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');

View file

@ -1,35 +0,0 @@
'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});
}
}
}
};

View file

@ -1,3 +0,0 @@
'use strict';
console.log('\'Allo \'Allo! Content script');

View file

@ -1,3 +0,0 @@
'use strict';
console.log('\'Allo \'Allo! Option');

View file

@ -1,3 +0,0 @@
'use strict';
console.log('\'Allo \'Allo! Popup');

View file

@ -1,3 +0,0 @@
body {
padding: 20px;
}

4
fed/background_script.js Normal file
View file

@ -0,0 +1,4 @@
// Put all the javascript code here, that you want to execute in background.
setInterval(() => {
console.log('meow uwu~');
}, 2000);

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="style.css" rel="stylesheet" />
</head>
<body>
<h1 id="myHeading">My content</h1>
<script src="script.js"></script>
</body>
</html>

View file

@ -0,0 +1 @@
document.getElementById('myHeading').style.color = 'red';

View file

@ -0,0 +1,3 @@
h1 {
font-style: italic;
}

1
fed/content_script.js Normal file
View file

@ -0,0 +1 @@
// Put all the javascript code here, that you want to execute after page load.

BIN
fed/icons/128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
fed/icons/16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

23
fed/manifest.json Normal file
View file

@ -0,0 +1,23 @@
{
"manifest_version": 3,
"name": "fed",
"description": "feddie",
"version": "0.0.1",
"author": "femsci",
"homepage_url": "https://femsci.dev/projects/fed",
"developer": {
"name": "femsci",
"url": "https://femsci.dev/projects/fed"
},
"icons": {
"16": "icons/16.png",
"128": "icons/128.png"
},
"action": {
"default_icon": {
"128": "icons/128.png"
},
"default_title": "meowowieeee",
"default_popup": "options/index.html"
}
}

11
fed/options/index.html Normal file
View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="style.css" rel="stylesheet" />
</head>
<body>
<h1 id="myHeading">My content</h1>
<script src="script.js"></script>
</body>
</html>

1
fed/options/script.js Normal file
View file

@ -0,0 +1 @@
document.getElementById('myHeading').style.color = 'red'

3
fed/options/style.css Normal file
View file

@ -0,0 +1,3 @@
h1 {
font-style: italic;
}

11
fed/pageAction/index.html Normal file
View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="style.css" rel="stylesheet" />
</head>
<body>
<h1 id="myHeading">My content</h1>
<script src="script.js"></script>
</body>
</html>

1
fed/pageAction/script.js Normal file
View file

@ -0,0 +1 @@
document.getElementById('myHeading').style.color = 'red'

3
fed/pageAction/style.css Normal file
View file

@ -0,0 +1,3 @@
h1 {
font-style: italic;
}

View file

@ -1,142 +0,0 @@
// 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);
});

View file

@ -5,37 +5,10 @@
"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",
"create-web-ext": "^1.0.0",
"polyfill": "^0.1.0",
"run-sequence": "^1.2.2",
"svgo": "^3.0.2",
"uuid": "^9.0.1",
"wiredep": "^4.0.0"
"typescript": "^5.2.2",
"web-ext": "^7.8.0"
},
"eslintConfig": {
"env": {
@ -46,10 +19,6 @@
"globals": {
"chrome": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8
},
"rules": {
"eol-last": 0,
"quotes": [

File diff suppressed because it is too large Load diff

View file

@ -1,29 +0,0 @@
<!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>

View file

@ -1,11 +0,0 @@
(function () {
'use strict';
describe('Give it some context', function () {
describe('maybe a bit more context here', function () {
it('should run here few assertions', function () {
});
});
});
})();

19
tsconfig.json Normal file
View file

@ -0,0 +1,19 @@
{
"compilerOptions": {
"incremental": true,
"target": "es2016",
"module": "es2016",
"rootDir": "fed/",
"allowJs": true,
"checkJs": tru
"declaration": true,
"declarationMap": true,
"outDir": "./dist/",
"removeComments": true,
"importsNotUsedAsValues": "remove",
"inlineSources": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
}
}