-
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
0 parents
commit 771d08e
Showing
17 changed files
with
497 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,16 @@ | ||
{ | ||
"presets": [ | ||
"es2015", | ||
"stage-0", | ||
"react" | ||
], | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
"es2015", | ||
"stage-0", | ||
"react" | ||
] | ||
} | ||
} | ||
} |
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,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = 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 @@ | ||
node_modules |
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,34 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
es6: true, | ||
}, | ||
extends: [ | ||
'standard', | ||
'plugin:vue/recommended', | ||
], | ||
globals: { | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly', | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
parser: 'babel-eslint', | ||
}, | ||
plugins: [ | ||
'vue', | ||
], | ||
rules: { | ||
'dot-notation': [ | ||
'error', | ||
{ | ||
'allowPattern': '^$', | ||
}, | ||
], | ||
'comma-dangle': [ | ||
'error', | ||
'always-multiline', | ||
], | ||
}, | ||
} |
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,39 @@ | ||
--- | ||
name: Bug report | ||
about: Create a bug report to help us improve | ||
title: "[Bug Report] " | ||
labels: '' | ||
assignees: '' | ||
--- | ||
|
||
## Describe the bug | ||
|
||
A clear and concise description of what the bug is. | ||
|
||
## Steps To Reproduce | ||
|
||
If possbile, please create a reproduce repository so we can reproduce the bug quickly. | ||
|
||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
## Screenshots | ||
|
||
If applicable, add screenshots to help explain your problem. | ||
|
||
## Expected behavior | ||
|
||
A clear and concise description of what you expected to happen. | ||
|
||
## Environment (please complete the following information): | ||
|
||
- Version: [e.g. v1.0.0] | ||
- OS: [e.g. Windows 10, iOS, Android] | ||
- Browser: [e.g. chrome 74] | ||
|
||
## Additional context | ||
|
||
Add any other context about the problem here. |
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,23 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this theme | ||
title: "[Feature Request] " | ||
labels: '' | ||
assignees: '' | ||
--- | ||
|
||
## What problem does the feature solve? | ||
|
||
A clear and concise description of what the problem is, and why we need this feature. | ||
|
||
## Proposed solution | ||
|
||
Describe what you want to happen, and the solution you'd like. | ||
|
||
## Alternative solutions | ||
|
||
Any alternative solutions or features you've considered. | ||
|
||
## Additional context | ||
|
||
Add any other context or screenshots about the feature request here. |
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,58 @@ | ||
# Configuration for probot-stale - https://github.com/probot/stale | ||
|
||
# Number of days of inactivity before an Issue or Pull Request becomes stale | ||
daysUntilStale: 60 | ||
|
||
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. | ||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. | ||
daysUntilClose: 7 | ||
|
||
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) | ||
onlyLabels: [] | ||
|
||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable | ||
exemptLabels: | ||
- bug | ||
|
||
# Set to true to ignore issues in a project (defaults to false) | ||
exemptProjects: false | ||
|
||
# Set to true to ignore issues in a milestone (defaults to false) | ||
exemptMilestones: false | ||
|
||
# Set to true to ignore issues with an assignee (defaults to false) | ||
exemptAssignees: false | ||
|
||
# Label to use when marking as stale | ||
staleLabel: stale | ||
|
||
# Comment to post when marking as stale. Set to `false` to disable | ||
markComment: > | ||
This issue has been automatically marked as stale because it has not had | ||
recent activity. It will be closed if no further activity occurs. Thank you | ||
for your contributions. | ||
# Comment to post when removing the stale label. | ||
# unmarkComment: > | ||
# Your comment here. | ||
|
||
# Comment to post when closing a stale Issue or Pull Request. | ||
# closeComment: > | ||
# Your comment here. | ||
|
||
# Limit the number of actions per hour, from 1-30. Default is 30 | ||
limitPerRun: 30 | ||
|
||
# Limit to only `issues` or `pulls` | ||
# only: issues | ||
|
||
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': | ||
# pulls: | ||
# daysUntilStale: 30 | ||
# markComment: > | ||
# This pull request has been automatically marked as stale because it has not had | ||
# recent activity. It will be closed if no further activity occurs. Thank you | ||
# for your contributions. | ||
|
||
# issues: | ||
# exemptLabels: | ||
# - confirmed |
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,20 @@ | ||
.DS_Store | ||
node_modules | ||
|
||
# Log files | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Editor directories and files | ||
.idea | ||
.vscode | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
yarn.lock | ||
package-lock.json | ||
.temp |
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 @@ | ||
message="build: version %s" |
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,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 cnguu | ||
|
||
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# watermark-base64 | ||
|
||
 | ||
 | ||
|
||
## Install | ||
|
||
```bash | ||
npm i watermark-base64 | ||
``` | ||
|
||
## Use | ||
|
||
```html | ||
<script type="text/javascript" src="dist/watermark-base64.min.js"></script> | ||
// or | ||
const watermarkBase64 = require('watermark-base64'); | ||
// or | ||
import watermarkBase64 from 'watermark-base64'; | ||
``` | ||
|
||
## API | ||
|
||
The unique API is: **watermarkBase64(text, options)**. | ||
|
||
- **text** (String): required, the text in the watermark image. | ||
- **options** (Object): optional, the options of watermark, with keys below: | ||
- **width** (Number): default is `140`. | ||
- **height** (Number): default is `60`. | ||
- **color** (String): the text color, default is `#666666`. | ||
- **alpha** (Float): the text alpha(0 ~ 1), default is `0.1`. | ||
- **font** (String): the text font style, default is `18px Arial Bold`. | ||
|
||
The api return **the base64 string of watermark image** which can be used in css background / img tag. | ||
|
||
```js | ||
watermarkBase64('北鱼游戏 888888'); | ||
|
||
watermarkBase64('北鱼游戏 888888', { color: '#f6dcd7' }); | ||
|
||
watermarkBase64('北鱼游戏 888888', { alpha: 0.5 }); | ||
``` | ||
|
||
## Build & Test | ||
|
||
```bash | ||
npm install | ||
|
||
npm run build | ||
|
||
npm test | ||
``` | ||
|
||
## License | ||
|
||
[MIT](https://cdn.jsdelivr.net/gh/cnguu/watermark-base64@master/LICENSE) |
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,52 @@ | ||
// eslint-disable-next-line no-unused-expressions | ||
!(function (root, factory) { | ||
if (typeof module === 'object' && module.exports) { | ||
module.exports = factory(root) | ||
module.exports.default = module.exports | ||
} else { | ||
root.watermarkBase64 = factory(root) | ||
} | ||
}(typeof window !== 'undefined' ? window : this, function () { | ||
var canvas, ctx | ||
|
||
function mergeOptions (options) { | ||
return Object.assign({ | ||
width: 140, | ||
height: 60, | ||
color: '#666666', | ||
alpha: 0.1, | ||
font: '18px Arial Bold', | ||
}, options) | ||
} | ||
|
||
return function (text, options) { | ||
if (!canvas || !ctx) { | ||
if (typeof document !== 'undefined') { | ||
canvas = document.createElement('canvas') | ||
} else { | ||
// eslint-disable-next-line no-eval | ||
var Canvas = eval('module.require("canvas")') | ||
canvas = new Canvas() | ||
} | ||
ctx = canvas && canvas.getContext && canvas.getContext('2d') | ||
if (!canvas || !ctx) return '' | ||
} | ||
options = mergeOptions(options) | ||
var width = options.width | ||
var height = options.height | ||
canvas.width = width | ||
canvas.height = height | ||
ctx.clearRect(0, 0, width, height) | ||
ctx.globalAlpha = 0 | ||
ctx.fillRect(0, 0, width, height) | ||
ctx.globalAlpha = options.alpha | ||
ctx.fillStyle = options.color | ||
ctx.font = options.font | ||
ctx.textAlign = 'left' | ||
ctx.textBaseline = 'bottom' | ||
ctx.translate(width * 0.1, height * 0.9) | ||
ctx.rotate(-Math.PI / 12) | ||
ctx.fillText(text, 0, 0) | ||
return canvas.toDataURL() | ||
} | ||
})) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
const gulp = require('gulp') | ||
const injectVersion = require('gulp-inject-version') | ||
const uglify = require('gulp-uglify') | ||
const rename = require('gulp-rename') | ||
|
||
gulp.task('build', function () { | ||
gulp.src('src/watermark-base64.js') | ||
.pipe(injectVersion()) | ||
.pipe(gulp.dest('dist/')) | ||
.pipe(uglify({ | ||
preserveComments: 'license', | ||
})) | ||
.pipe(rename('watermark-base64.min.js')) | ||
.pipe(gulp.dest('dist/')) | ||
}) |
Oops, something went wrong.