catpop 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/catpop.js +34 -0
- data/lib/catpop/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99bfb013a015035be8a7c7ab3c11c620e566c707fc0dd1e71c9ad774ae01d087
|
4
|
+
data.tar.gz: d73c17c3649383b1db70f338dce8122b4b93e185763d9eac2d71bb25e12f3aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d7d27b44fc4dd3b318511221b125bae4583708e7311b968fb6fc79e3a3f808c073cefbe66e46246621d61dbd28efa60ef3c6fce24a82faac8d8a014ad1e4e7c
|
7
|
+
data.tar.gz: 263f52b088fe1f66f86807651d8afe1c3a46452f13dbfdbd34cb2ed01eda6a9b314c83252f7b136a1143366471d1d96bbef68d856b65e49c2b373b1453c707c1
|
@@ -0,0 +1,34 @@
|
|
1
|
+
document.addEventListener('DOMContentLoaded', function() {
|
2
|
+
const SHOWING_TIME = 3000;
|
3
|
+
const INTERVAL_TIME = 1000;
|
4
|
+
|
5
|
+
function showCat() {
|
6
|
+
// define emojis
|
7
|
+
const emojis = ["🐱", "🐈", "🐈⬛"];
|
8
|
+
const emoji = emojis[Math.floor(Math.random() * emojis.length)];
|
9
|
+
|
10
|
+
// define the size of the cat (1 ~ 10 em)
|
11
|
+
const catSize = Math.floor(Math.random() * 10) + 1;
|
12
|
+
|
13
|
+
// create div element
|
14
|
+
const catDiv = document.createElement('div');
|
15
|
+
catDiv.className = 'catpop';
|
16
|
+
catDiv.style.position = 'fixed';
|
17
|
+
catDiv.style.top = Math.floor(Math.random() * 90) + 'vh';
|
18
|
+
catDiv.style.left = Math.floor(Math.random() * 90) + 'vw';
|
19
|
+
catDiv.style.fontSize = catSize + 'em';
|
20
|
+
catDiv.innerText = emoji;
|
21
|
+
|
22
|
+
// append the div element to the body
|
23
|
+
document.body.appendChild(catDiv);
|
24
|
+
|
25
|
+
// remove the div element after a while
|
26
|
+
setTimeout(() => catDiv.remove(), SHOWING_TIME);
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
showCat();
|
31
|
+
|
32
|
+
// show cat every INTERVAL_TIME
|
33
|
+
setInterval(showCat, INTERVAL_TIME);
|
34
|
+
});
|
data/lib/catpop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: catpop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tmasuyama1114
|
@@ -19,6 +19,7 @@ executables: []
|
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
|
+
- lib/assets/javascripts/catpop.js
|
22
23
|
- lib/catpop.rb
|
23
24
|
- lib/catpop/popup_helper.rb
|
24
25
|
- lib/catpop/railtie.rb
|