Skip to content

Commit

Permalink
commit init
Browse files Browse the repository at this point in the history
  • Loading branch information
Kholid060 committed Jul 21, 2019
0 parents commit 38f368d
Show file tree
Hide file tree
Showing 48 changed files with 10,773 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"plugins": [
"@babel/plugin-proposal-optional-chaining",
[
"component",
{
"libraryName": "element-ui",
"styleLibraryName": "theme-chalk"
}
]
],
"presets": [
["@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": 3,
"targets": {
// https://jamie.build/last-2-versions
"browsers": ["> 0.25%", "not ie 11", "not op_mini all"]
}
}]
]
}
55 changes: 55 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// https://eslint.org/docs/user-guide/configuring
// File taken from https://github.com/vuejs-templates/webpack/blob/1.3.1/template/.eslintrc.js, thanks.

module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint',
},
env: {
browser: true,
webextensions: true,
},
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
extends: ['plugin:vue/essential', 'airbnb-base', 'plugin:prettier/recommended'],
// required to lint *.vue files
plugins: ['vue'],
// check if imports actually resolve
settings: {
'import/resolver': {
webpack: {
config: './webpack.config.js',
},
},
},
// add your custom rules here
rules: {
// don't require .vue extension when importing
'import/extensions': [
'error',
'always',
{
js: 'never',
vue: 'never',
},
],
// disallow reassignment of function parameters
// disallow parameter object manipulation except for specific exclusions
'no-param-reassign': [
'error',
{
props: true,
ignorePropertyModificationsFor: [
'state', // for vuex state
'acc', // for reduce accumulators
'e', // for e.returnvalue
],
},
],
// disallow default export over named export
'import/prefer-default-export': 'off',
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
};
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
/*.log
/dist
/dist-zip
*.crx
*.pem
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"singleQuote": true,
"printWidth": 180,
"trailingComma": "es5"
}
71 changes: 71 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "oTab",
"version": "0.9.0",
"description": "a better way to organize your browser and manage your notes and tasks in one place.",
"author": "kholid060 <[email protected]>",
"license": "MIT",
"scripts": {
"lint": "eslint --ext .js,.vue src",
"prettier": "prettier \"src/**/*.{js,vue}\"",
"prettier:write": "npm run prettier -- --write",
"build": "cross-env NODE_ENV=production webpack --hide-modules",
"build:dev": "cross-env NODE_ENV=development webpack --hide-modules",
"build-zip": "node scripts/build-zip.js",
"watch": "npm run build -- --watch",
"watch:dev": "cross-env HMR=true npm run build:dev -- --watch"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"dependencies": {
"element-ui": "^2.10.0",
"tiptap": "^1.23.1",
"tiptap-extensions": "^1.24.1",
"vue": "^2.6.10",
"vue-unicons": "^1.3.2",
"vuedraggable": "^2.23.0",
"vuex": "^3.0.1",
"webextension-polyfill": "^0.3.1"
},
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.1.0",
"@babel/runtime-corejs3": "^7.4.0",
"archiver": "^3.0.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.2",
"babel-plugin-component": "^1.1.1",
"copy-webpack-plugin": "^4.5.3",
"core-js": "^3.0.1",
"cross-env": "^5.2.0",
"css-loader": "^2.1.1",
"ejs": "^2.6.1",
"eslint": "^5.16.0",
"eslint-config-airbnb-base": "^13.0.0",
"eslint-config-prettier": "^4.3.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-import-resolver-webpack": "^0.10.1",
"eslint-loader": "^2.1.2",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-vue": "^5.2.2",
"file-loader": "^1.1.11",
"husky": "^2.4.0",
"mini-css-extract-plugin": "^0.4.4",
"node-sass": "^4.9.3",
"prettier": "^1.17.1",
"pretty-quick": "^1.8.0",
"sass-loader": "^7.1.0",
"url-loader": "^2.0.1",
"vue-loader": "^15.4.2",
"vue-template-compiler": "^2.6.10",
"web-ext-types": "^2.1.0",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-extension-reloader": "^1.1.0"
}
}
53 changes: 53 additions & 0 deletions scripts/build-zip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env node

const fs = require('fs');
const path = require('path');
const archiver = require('archiver');

const DEST_DIR = path.join(__dirname, '../dist');
const DEST_ZIP_DIR = path.join(__dirname, '../dist-zip');

const extractExtensionData = () => {
const extPackageJson = require('../package.json');

return {
name: extPackageJson.name,
version: extPackageJson.version,
};
};

const makeDestZipDirIfNotExists = () => {
if (!fs.existsSync(DEST_ZIP_DIR)) {
fs.mkdirSync(DEST_ZIP_DIR);
}
};

const buildZip = (src, dist, zipFilename) => {
console.info(`Building ${zipFilename}...`);

const archive = archiver('zip', { zlib: { level: 9 } });
const stream = fs.createWriteStream(path.join(dist, zipFilename));

return new Promise((resolve, reject) => {
archive
.directory(src, false)
.on('error', err => reject(err))
.pipe(stream);

stream.on('close', () => resolve());
archive.finalize();
});
};

const main = () => {
const { name, version } = extractExtensionData();
const zipFilename = `${name}-v${version}.zip`;

makeDestZipDirIfNotExists();

buildZip(DEST_DIR, DEST_ZIP_DIR, zipFilename)
.then(() => console.info('OK'))
.catch(console.err);
};

main();
21 changes: 21 additions & 0 deletions src/assets/slide-transitions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@mixin slideTransition($direction, $value: 10px, $duration: 0.3s) {
$translateOrientation: translateX($value);
@if $direction == left or $direction == right {
$translateOrientation: translateX($value);
} @else {
$translateOrientation: translateY($value);
}
.slide-fade-#{$direction}-enter-active {
transition: all $duration ease;
overflow: hidden;
}
.slide-fade-#{$direction}-leave-active {
transition: all $duration ease;
}
.slide-fade-#{$direction}-enter,
.slide-fade-#{$direction}-leave-to {
transform: $translateOrientation;
overflow: hidden;
opacity: 0;
}
}
29 changes: 29 additions & 0 deletions src/assets/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#app {
height: 100%;
}

html,
body {
margin: 0;
overflow: hidden;
}
.nb {
border: none !important;
}
.bb {
border-bottom: 1px solid #eee;
}
.br {
border-right: 1px solid #eee;
}
.right {
float: right !important;
}

.capitalize {
text-transform: capitalize;
}

.font-weight-bold {
font-weight: 600;
}
73 changes: 73 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import './store/';

global.browser = require('webextension-polyfill');

browser.runtime.onInstalled.addListener(async e => {
let storage = browser.storage.sync;
let data = await storage.get('myApp');
if (Object.entries(data).length === 0 && data.constructor === Object) {
storage.set({
myApp: {
boards: [
{
title: 'Primary Board',
id: 'primary_board',
allTags: [
{ name: 'daily', color: '#7cd451', id: 'daily#7cd451' },
{ name: 'social', color: '#409EFF', id: 'social#409EFF' },
{ name: 'work', color: '#F56C6C', id: 'work#F56C6C' },
],
},
],
collections: {
primary_board: [
{
title: 'my collections',
tags: [{ name: 'daily', color: '#7cd451', id: 'daily#7cd451' }, { name: 'social', color: '#409EFF', id: 'social#409EFF' }],
tabs: [
{
title: 'Google',
url: 'https://google.com',
favIconUrl: 'https://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png',
},
{
title: 'Facebook',
url: 'https://www.facebook.com',
favIconUrl: 'https://static.xx.fbcdn.net/rsrc.php/yo/r/iRmz9lCMBD2.ico',
},
],
},
],
},
notes: {
primary_board: [
{
title: 'My Note',
content: `<p>This is my first note</p>`,
tags: [{ name: 'social', color: '#409EFF', id: 'social#409EFF' }],
id: 'kx20rhdcrt',
},
],
},
tasks: {
primary_board: [
{
title: 'my task',
tasks: [
{
name: 'something',
done: false,
},
{
name: 'to do',
done: true,
},
],
tags: [{ name: 'daily', color: '#7cd451', id: 'daily#7cd451' }, { name: 'social', color: '#409EFF', id: 'social#409EFF' }],
},
],
},
},
});
}
});
Binary file added src/icons/icon.xcf
Binary file not shown.
Binary file added src/icons/icon_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/icons/icon_48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "override",
"description": "a better way to organize your browser and manage your notes and tasks in one place.",
"version": null,
"manifest_version": 2,
"icons": {
"48": "icons/icon_48.png",
"128": "icons/icon_128.png"
},
"browser_action": {
"default_title": "override",
"default_popup": "popup/popup.html"
},
"background": {
"scripts": ["background.js"]
},
"chrome_url_overrides": {
"newtab": "tab/tab.html"
},
"permissions": ["tabs", "storage"]
}
Loading

0 comments on commit 38f368d

Please sign in to comment.