forked from Hemmingsson/Freeze
-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
df93d60
commit 52b9262
Showing
44 changed files
with
8,944 additions
and
1 deletion.
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,3 @@ | ||
{ | ||
"presets": ["es2015"] | ||
} |
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,14 @@ | ||
# editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = false | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
insert_final_newline = false |
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 @@ | ||
node_modules | ||
temp | ||
.tmp | ||
dist | ||
.sass-cache | ||
.DS_Store | ||
build |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 Bharani / Email This | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -1,2 +1,38 @@ | ||
# downtime | ||
New Tab Cinemagraphs Browser Extensions | ||
Curated Cinemagraphs on Every New Tab | ||
|
||
|
||
## Running Dev Environement | ||
### Installation | ||
1. Clone the repository `git clone https://github.com/Hemmingsson/downtime-extension` | ||
2. Run `npm install` | ||
3. Run `npm run build` | ||
|
||
##### Load the extension in Chrome & Opera | ||
1. Open Chrome/Opera browser and navigate to chrome://extensions | ||
2. Select "Developer Mode" and then click "Load unpacked extension..." | ||
3. From the file browser, choose to `extension-boilerplate/build/chrome` or (`extension-boilerplate/build/opera`) | ||
|
||
|
||
##### Load the extension in Firefox | ||
1. Open Firefox browser and navigate to about:debugging | ||
2. Click "Load Temporary Add-on" and from the file browser, choose `extension-boilerplate/build/firefox` | ||
|
||
|
||
### Developing | ||
The following tasks can be used when you want to start developing the extension and want to enable live reload - | ||
|
||
- `npm run chrome-watch` | ||
- `npm run opera-watch` | ||
- `npm run firefox-watch` | ||
|
||
### Packaging | ||
Run `npm run dist` to create a zipped, production-ready extension for each browser. You can then upload that to the appstore. | ||
|
||
|
||
## Credits | ||
|
||
downtime was made with : | ||
|
||
- Extension Boilerplate from Bharani: https://github.com/EmailThis/extension-boilerplate | ||
- Cinemagraphs sourced from: https://imgur.com |
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,3 @@ | ||
{ | ||
"extension": "chrome" | ||
} |
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,3 @@ | ||
{ | ||
"env": "development" | ||
} |
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,3 @@ | ||
{ | ||
"extension": "firefox" | ||
} |
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,3 @@ | ||
{ | ||
"extension": "opera" | ||
} |
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,3 @@ | ||
{ | ||
"env": "production" | ||
} |
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,159 @@ | ||
import fs from 'fs' | ||
import gulp from 'gulp' | ||
import {merge} from 'event-stream' | ||
import browserify from 'browserify' | ||
import source from 'vinyl-source-stream' | ||
import buffer from 'vinyl-buffer' | ||
import preprocessify from 'preprocessify' | ||
import gulpif from 'gulp-if' | ||
|
||
const $ = require('gulp-load-plugins')() | ||
|
||
var production = process.env.NODE_ENV === 'production' | ||
var target = process.env.TARGET || 'chrome' | ||
var environment = process.env.NODE_ENV || 'development' | ||
|
||
var generic = JSON.parse(fs.readFileSync(`./config/${environment}.json`)) | ||
var specific = JSON.parse(fs.readFileSync(`./config/${target}.json`)) | ||
var context = Object.assign({}, generic, specific) | ||
|
||
var manifest = { | ||
dev: { | ||
'background': { | ||
'scripts': [ | ||
'scripts/livereload.js', | ||
'scripts/background.js' | ||
] | ||
} | ||
}, | ||
|
||
firefox: { | ||
'applications': { | ||
'gecko': { | ||
'id': '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Tasks | ||
gulp.task('clean', () => { | ||
return pipe(`./build/${target}`, $.clean()) | ||
}) | ||
|
||
gulp.task('build', (cb) => { | ||
$.runSequence('clean', 'styles', 'ext', cb) | ||
}) | ||
|
||
gulp.task('watch', ['build'], () => { | ||
$.livereload.listen() | ||
|
||
gulp.watch(['./src/**/*']).on('change', () => { | ||
$.runSequence('build', $.livereload.reload) | ||
}) | ||
}) | ||
|
||
gulp.task('default', ['build']) | ||
|
||
gulp.task('ext', ['manifest', 'js'], () => { | ||
return mergeAll(target) | ||
}) | ||
|
||
// ----------------- | ||
// COMMON | ||
// ----------------- | ||
gulp.task('js', () => { | ||
return buildJS(target) | ||
}) | ||
|
||
gulp.task('styles', () => { | ||
return gulp.src('src/styles/**/*.scss') | ||
.pipe($.plumber()) | ||
.pipe($.sass.sync({ | ||
outputStyle: 'expanded', | ||
precision: 10, | ||
includePaths: ['.'] | ||
}).on('error', $.sass.logError)) | ||
.pipe(gulp.dest(`build/${target}/styles`)) | ||
}) | ||
|
||
gulp.task('manifest', () => { | ||
return gulp.src('./manifest.json') | ||
.pipe(gulpif(!production, $.mergeJson({ | ||
fileName: 'manifest.json', | ||
jsonSpace: ' '.repeat(4), | ||
endObj: manifest.dev | ||
}))) | ||
.pipe(gulpif(target === 'firefox', $.mergeJson({ | ||
fileName: 'manifest.json', | ||
jsonSpace: ' '.repeat(4), | ||
endObj: manifest.firefox | ||
}))) | ||
.pipe(gulp.dest(`./build/${target}`)) | ||
}) | ||
|
||
// ----------------- | ||
// DIST | ||
// ----------------- | ||
gulp.task('dist', (cb) => { | ||
$.runSequence('build', 'zip', cb) | ||
}) | ||
|
||
gulp.task('zip', () => { | ||
return pipe(`./build/${target}/**/*`, $.zip(`${target}.zip`), './dist') | ||
}) | ||
|
||
// Helpers | ||
function pipe (src, ...transforms) { | ||
return transforms.reduce((stream, transform) => { | ||
const isDest = typeof transform === 'string' | ||
return stream.pipe(isDest ? gulp.dest(transform) : transform) | ||
}, gulp.src(src)) | ||
} | ||
|
||
function mergeAll (dest) { | ||
return merge( | ||
pipe('./src/icons/**/*', `./build/${dest}/icons`), | ||
pipe(['./src/_locales/**/*'], `./build/${dest}/_locales`), | ||
pipe([`./src/images/${target}/**/*`], `./build/${dest}/images`), | ||
pipe(['./src/images/shared/**/*'], `./build/${dest}/images`), | ||
pipe(['./src/**/*.html'], `./build/${dest}`) | ||
) | ||
} | ||
|
||
function buildJS (target) { | ||
const files = [ | ||
'background.js', | ||
'contentscript.js', | ||
'options.js', | ||
'popup.js', | ||
'livereload.js', | ||
'newtab.js' | ||
] | ||
|
||
let tasks = files.map(file => { | ||
return browserify({ | ||
entries: 'src/scripts/' + file, | ||
debug: true | ||
}) | ||
.transform('babelify', { presets: ['es2015'] }) | ||
.transform(preprocessify, { | ||
includeExtensions: ['.js'], | ||
context: context | ||
}) | ||
.bundle() | ||
.pipe(source(file)) | ||
.pipe(buffer()) | ||
.pipe(gulpif(!production, $.sourcemaps.init({ loadMaps: true }))) | ||
.pipe(gulpif(!production, $.sourcemaps.write('./'))) | ||
.pipe(gulpif(production, $.uglify({ | ||
'mangle': false, | ||
'output': { | ||
'ascii_only': true | ||
} | ||
}))) | ||
.pipe(gulp.dest(`build/${target}/scripts`)) | ||
}) | ||
|
||
return merge.apply(null, tasks) | ||
} |
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,30 @@ | ||
{ | ||
"name": "__MSG_appName__", | ||
"version": "0.0.1", | ||
"manifest_version": 2, | ||
"description": "__MSG_appDescription__", | ||
"icons": { | ||
"16": "icons/icon-16.png", | ||
"128": "icons/icon-128.png" | ||
}, | ||
"default_locale": "en", | ||
"chrome_url_overrides": { | ||
"newtab": "newtab.html" | ||
}, | ||
"permissions": [ | ||
"storage" | ||
], | ||
"options_ui": { | ||
"page": "options.html" | ||
}, | ||
"browser_action": { | ||
"default_icon": { | ||
"19": "icons/icon-19.png", | ||
"38": "icons/icon-38.png" | ||
}, | ||
"default_title": "Extension Boilerplate", | ||
"default_popup": "popup.html" | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.