Skip to content

Commit 6e659a9

Browse files
committedNov 21, 2019
Documentation ...
1 parent e1ea3d3 commit 6e659a9

File tree

8 files changed

+149
-124
lines changed

8 files changed

+149
-124
lines changed
 

‎deploy.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env sh
2+
3+
# abort on errors
4+
set -e
5+
6+
# build
7+
npm run docs:build
8+
9+
# navigate into the build output directory
10+
cd docs/.vuepress/dist
11+
12+
# if you are deploying to a custom domain
13+
# echo 'www.example.com' > CNAME
14+
15+
git init
16+
git add -A
17+
git commit -m 'deploy'
18+
19+
# if you are deploying to https://<USERNAME>.github.io
20+
# git push -f git@github.com:<USERNAME>/<USERNAME>.github.io.git master
21+
22+
# if you are deploying to https://<USERNAME>.github.io/<REPO>
23+
git push -f git@github.com:Masth0/ScratchCard.git master:gh-pages
24+
25+
cd -

‎docs/.vuepress/components/brush-circle.vue

+29-29
Original file line numberDiff line numberDiff line change
@@ -65,38 +65,38 @@
6565
</style>
6666

6767
<script>
68-
import '../../../build/scratchcard.min';
69-
7068
export default {
7169
mounted() {
72-
const scContainer = document.getElementById('js--sc--container')
73-
const scInfos = document.querySelector('.sc__infos');
74-
const sc = new ScratchCard('#js--sc--container', {
75-
scratchType: SCRATCH_TYPE.CIRCLE,
76-
containerWidth: scContainer.offsetWidth,
77-
containerHeight: 300,
78-
imageForwardSrc: '/images/scratchcard.jpg',
79-
imageBackgroundSrc: '/images/result.png',
80-
htmlBackground: '',
81-
clearZoneRadius: 20,
82-
nPoints: 30,
83-
pointSize: 4,
84-
callback: function () {
85-
alert('Now the window will reload !')
86-
window.location.reload()
87-
}
88-
})
89-
90-
// Init
91-
sc.init().then(() => {
92-
sc.canvas.addEventListener('scratch.move', () => {
93-
let percent = sc.getPercent().toFixed(0);
94-
scInfos.innerHTML = percent + '%';
95-
console.log(percent)
70+
import('../../../build/scratchcard.min').then(() => {
71+
const scContainer = document.getElementById('js--sc--container')
72+
const scInfos = document.querySelector('.sc__infos');
73+
const sc = new ScratchCard('#js--sc--container', {
74+
scratchType: SCRATCH_TYPE.CIRCLE,
75+
containerWidth: scContainer.offsetWidth,
76+
containerHeight: 300,
77+
imageForwardSrc: '/images/scratchcard.jpg',
78+
imageBackgroundSrc: '/images/result.png',
79+
htmlBackground: '',
80+
clearZoneRadius: 20,
81+
nPoints: 30,
82+
pointSize: 4,
83+
callback: function () {
84+
alert('Now the window will reload !')
85+
window.location.reload()
86+
}
9687
})
97-
}).catch((error) => {
98-
// image not loaded
99-
alert(error.message);
88+
89+
// Init
90+
sc.init().then(() => {
91+
sc.canvas.addEventListener('scratch.move', () => {
92+
let percent = sc.getPercent().toFixed(0);
93+
scInfos.innerHTML = percent + '%';
94+
console.log(percent)
95+
})
96+
}).catch((error) => {
97+
// image not loaded
98+
alert(error.message);
99+
});
100100
});
101101
}
102102
}

‎docs/.vuepress/components/brush-html.vue

+30-30
Original file line numberDiff line numberDiff line change
@@ -126,39 +126,39 @@
126126
</style>
127127

128128
<script>
129-
import '../../../build/scratchcard.min';
130-
131129
export default {
132130
mounted() {
133-
const scContainer = document.getElementById('js--sc--container')
134-
const scInfos = document.querySelector('.sc__infos');
135-
const sc = new ScratchCard('#js--sc--container', {
136-
scratchType: SCRATCH_TYPE.CIRCLE,
137-
containerWidth: scContainer.offsetWidth,
138-
containerHeight: 300,
139-
brushSrc: '',
140-
imageForwardSrc: '/images/scratchcard.jpg',
141-
imageBackgroundSrc: '',
142-
htmlBackground: `<div class="inner_html"><p>Html content</p></div>`,
143-
clearZoneRadius: 30,
144-
nPoints: 50,
145-
pointSize: 4,
146-
callback: function () {
147-
alert('Now the window will reload !')
148-
window.location.reload()
149-
}
150-
})
151-
152-
// Init
153-
sc.init().then(() => {
154-
sc.canvas.addEventListener('scratch.move', () => {
155-
let percent = sc.getPercent().toFixed(0);
156-
scInfos.innerHTML = percent + '%';
157-
console.log(percent)
131+
import('../../../build/scratchcard.min').then(() => {
132+
const scContainer = document.getElementById('js--sc--container')
133+
const scInfos = document.querySelector('.sc__infos');
134+
const sc = new ScratchCard('#js--sc--container', {
135+
scratchType: SCRATCH_TYPE.CIRCLE,
136+
containerWidth: scContainer.offsetWidth,
137+
containerHeight: 300,
138+
brushSrc: '',
139+
imageForwardSrc: '/images/scratchcard.jpg',
140+
imageBackgroundSrc: '',
141+
htmlBackground: `<div class="inner_html"><p>Html content</p></div>`,
142+
clearZoneRadius: 30,
143+
nPoints: 50,
144+
pointSize: 4,
145+
callback: function () {
146+
alert('Now the window will reload !')
147+
window.location.reload()
148+
}
158149
})
159-
}).catch((error) => {
160-
// image not loaded
161-
alert(error.message);
150+
151+
// Init
152+
sc.init().then(() => {
153+
sc.canvas.addEventListener('scratch.move', () => {
154+
let percent = sc.getPercent().toFixed(0);
155+
scInfos.innerHTML = percent + '%';
156+
console.log(percent)
157+
})
158+
}).catch((error) => {
159+
// image not loaded
160+
alert(error.message);
161+
});
162162
});
163163
}
164164
}

‎docs/.vuepress/components/brush-brush.vue ‎docs/.vuepress/components/brush-img.vue

+30-31
Original file line numberDiff line numberDiff line change
@@ -66,40 +66,39 @@
6666
</style>
6767

6868
<script>
69-
import '../../../build/scratchcard.min';
70-
7169
export default {
7270
mounted() {
73-
const scContainer = document.getElementById('js--sc--container')
74-
const scInfos = document.querySelector('.sc__infos');
75-
const sc = new ScratchCard('#js--sc--container', {
76-
scratchType: SCRATCH_TYPE.BRUSH,
77-
containerWidth: scContainer.offsetWidth,
78-
containerHeight: 300,
79-
brushSrc: '/images/brush.png',
80-
imageForwardSrc: '/images/scratchcard.jpg',
81-
imageBackgroundSrc: '/images/result.png',
82-
htmlBackground: '',
83-
clearZoneRadius: 0,
84-
nPoints: 30,
85-
pointSize: 4,
86-
callback: function () {
87-
alert('Now the window will reload !')
88-
window.location.reload()
89-
}
90-
})
91-
92-
// Init
93-
sc.init().then(() => {
94-
sc.canvas.addEventListener('scratch.move', () => {
95-
let percent = sc.getPercent().toFixed(0);
96-
scInfos.innerHTML = percent + '%';
97-
console.log(percent)
71+
import('../../../build/scratchcard.min').then(() => {
72+
const scContainer = document.getElementById('js--sc--container')
73+
const scInfos = document.querySelector('.sc__infos');
74+
const sc = new ScratchCard('#js--sc--container', {
75+
scratchType: SCRATCH_TYPE.BRUSH,
76+
containerWidth: scContainer.offsetWidth,
77+
containerHeight: 300,
78+
brushSrc: '/images/brush.png',
79+
imageForwardSrc: '/images/scratchcard.jpg',
80+
imageBackgroundSrc: '/images/result.png',
81+
htmlBackground: '',
82+
clearZoneRadius: 0,
83+
nPoints: 30,
84+
pointSize: 4,
85+
callback: function () {
86+
alert('Now the window will reload !')
87+
window.location.reload()
88+
}
9889
})
99-
}).catch((error) => {
100-
// image not loaded
101-
alert(error.message);
102-
});
90+
91+
// Init
92+
sc.init().then(() => {
93+
sc.canvas.addEventListener('scratch.move', () => {
94+
let percent = sc.getPercent().toFixed(0);
95+
scInfos.innerHTML = percent + '%';
96+
})
97+
}).catch((error) => {
98+
// image not loaded
99+
alert(error.message);
100+
});
101+
})
103102
}
104103
}
105104
</script>

‎docs/.vuepress/components/brush-spray.vue

+29-29
Original file line numberDiff line numberDiff line change
@@ -65,38 +65,38 @@
6565
</style>
6666

6767
<script>
68-
import '../../../build/scratchcard.min';
69-
7068
export default {
7169
mounted() {
72-
const scContainer = document.getElementById('js--sc--container')
73-
const scInfos = document.querySelector('.sc__infos');
74-
const sc = new ScratchCard('#js--sc--container', {
75-
scratchType: SCRATCH_TYPE.SPRAY,
76-
containerWidth: scContainer.offsetWidth,
77-
containerHeight: 300,
78-
imageForwardSrc: '/images/scratchcard.jpg',
79-
imageBackgroundSrc: '/images/result.png',
80-
htmlBackground: '',
81-
clearZoneRadius: 50,
82-
nPoints: 30,
83-
pointSize: 4,
84-
callback: function () {
85-
alert('Now the window will reload !')
86-
window.location.reload()
87-
}
88-
})
89-
90-
// Init
91-
sc.init().then(() => {
92-
sc.canvas.addEventListener('scratch.move', () => {
93-
let percent = sc.getPercent().toFixed(0);
94-
scInfos.innerHTML = percent + '%';
95-
console.log(percent)
70+
import('../../../build/scratchcard.min').then(() => {
71+
const scContainer = document.getElementById('js--sc--container')
72+
const scInfos = document.querySelector('.sc__infos');
73+
const sc = new ScratchCard('#js--sc--container', {
74+
scratchType: SCRATCH_TYPE.SPRAY,
75+
containerWidth: scContainer.offsetWidth,
76+
containerHeight: 300,
77+
imageForwardSrc: '/images/scratchcard.jpg',
78+
imageBackgroundSrc: '/images/result.png',
79+
htmlBackground: '',
80+
clearZoneRadius: 50,
81+
nPoints: 30,
82+
pointSize: 4,
83+
callback: function () {
84+
alert('Now the window will reload !')
85+
window.location.reload()
86+
}
9687
})
97-
}).catch((error) => {
98-
// image not loaded
99-
alert(error.message);
88+
89+
// Init
90+
sc.init().then(() => {
91+
sc.canvas.addEventListener('scratch.move', () => {
92+
let percent = sc.getPercent().toFixed(0);
93+
scInfos.innerHTML = percent + '%';
94+
console.log(percent)
95+
})
96+
}).catch((error) => {
97+
// image not loaded
98+
alert(error.message);
99+
});
100100
});
101101
}
102102
}

‎docs/.vuepress/config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
{ text: 'Home', link: '/' },
77
],
88
port: 8088,
9-
base: '/scratchcard-js/',
9+
base: '/ScratchCard/',
1010
configureWebpack: {},
1111
themeConfig: {
1212
search: false,
@@ -23,7 +23,7 @@ module.exports = {
2323
{ text: 'Html background', link: '/brushes/html-bg/' },
2424
]
2525
},
26-
{ text: 'github', link: 'https://github.com/fluffy-factory/toolbox' },
26+
{ text: 'github', link: 'https://github.com/Masth0/ScratchCard' },
2727
{ text: 'npm', link: 'https://www.npmjs.com/package/scratchcard-js' },
2828
],
2929
}

‎docs/brushes/brush.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Brush
22

3-
<brush-brush></brush-brush>
3+
<brush-img></brush-img>
44

55
:::warning
66
The **brushSrc** is mandatory and the **clearZoneRadius** must be set to **0**.

‎docs/readme.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ or just copy the file [scratchard.min.js](https://raw.githubusercontent.com/Mast
1414
```js
1515
import { ScratchCard, SCRATCH_TYPE } from 'scratchcard-js';
1616
// or
17-
import 'scratchcard-js';
17+
import 'scratchcard-js';
1818
```
1919

2020
## Configuration
@@ -24,9 +24,10 @@ See the SCRATCH_TYPES in action: [Spray](), [Circle](/brushes/circle), [Brush]()
2424
| **scratchType** | SCRATCH_TYPE | SPRAY | Possibles values : SPRAY, CIRCLE, BRUSH |
2525
| **containerWidth** | number | 100 | |
2626
| **containerHeight** | number | 100 | |
27+
| **brushSrc** | string | "" | For SCRATCH_TYPE.BRUSH |
2728
| **imageForwardSrc** | string | "" | |
2829
| **imageBackgroundSrc** | string | "" | |
29-
| **htmlBackground** | string | "" | |
30+
| **htmlBackground** | string | "" | <br> ``` `<p>Html-content<p>` ``` |
3031
| **callback** | function | function() { alert('done.'); } | |
3132
| **clearZoneRadius** | number | 0 | For SCRATCH_TYPE.CIRCLE |
3233
| **nPoints** | number | 30 | For SCRATCH_TYPE.SPRAY |

0 commit comments

Comments
 (0)
Failed to load comments.