jekyll-theme-teddy 0.4.1 → 0.5.0

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.
@@ -1,128 +1,128 @@
1
- "use strict";
2
-
3
- Object.defineProperty(Element.prototype, 'outerHeight', {
4
- 'get': function(){
5
- var height = this.clientHeight;
6
- var computedStyle = window.getComputedStyle(this);
7
- height += parseInt(computedStyle.marginTop, 10);
8
- height += parseInt(computedStyle.borderTopWidth, 10);
9
- height += parseInt(computedStyle.borderBottomWidth, 10);
10
- return height;
11
- }
12
- });
13
-
14
- let canvas = document.getElementById('canvas');
15
- let banner = document.getElementById('home-banner')
16
-
17
- let ctx = canvas.getContext('2d');
18
- let w;
19
- let h;
20
-
21
- let stars = [];
22
- let count = 0;
23
-
24
- const hue = 260;
25
- const maxStars = 200;
26
- const background = "black";
27
-
28
- // Cache gradient
29
- let canvas2 = document.createElement('canvas');
30
- let ctx2 = canvas2.getContext('2d');
31
-
32
- canvas2.width = 100;
33
- canvas2.height = 100;
34
-
35
- let half = canvas2.width/2;
36
- let gradient2 = ctx2.createRadialGradient(half, half, 0, half, half, half);
37
-
38
- gradient2.addColorStop(0.025, '#fff');
39
- gradient2.addColorStop(0.1, 'hsl(' + hue + ', 61%, 100%)');
40
- gradient2.addColorStop(0.25, 'hsl(' + hue + ', 64%, 0%)');
41
- gradient2.addColorStop(1, 'transparent');
42
-
43
- ctx2.fillStyle = gradient2;
44
- ctx2.beginPath();
45
- ctx2.arc(half, half, half, 0, Math.PI * 2);
46
- ctx2.fill();
47
-
48
- // End cache
49
-
50
- function setSize() {
51
- w = canvas.width = document.getElementsByTagName("html")[0].clientWidth;
52
- h = canvas.height = banner.outerHeight;
53
- }
54
-
55
- setSize();
56
-
57
- function random(min, max) {
58
- if (arguments.length < 2) {
59
- max = min;
60
- min = 0;
61
- }
62
-
63
- if (min > max) {
64
- let hold = max;
65
- max = min;
66
- min = hold;
67
- }
68
-
69
- return Math.floor(Math.random() * (max - min + 1)) + min;
70
- }
71
-
72
- function maxOrbit(x,y) {
73
- let max = Math.max(x,y),
74
- diameter = Math.round(Math.sqrt(max*max + max*max));
75
- return diameter/2;
76
- }
77
-
78
- let Star = function() {
79
-
80
- this.orbitRadius = random(maxOrbit(w/1.75,h/1.75));
81
- this.radius = random(60, this.orbitRadius) / 12;
82
- this.orbitX = w / 2;
83
- this.orbitY = h / 2;
84
- this.timePassed = random(0, maxStars);
85
- this.speed = random(this.orbitRadius) / 1000000;
86
- this.alpha = random(2, 10) / 10;
87
-
88
- count++;
89
- stars[count] = this;
90
- }
91
-
92
- Star.prototype.draw = function() {
93
- let x = Math.sin(this.timePassed) * this.orbitRadius + this.orbitX,
94
- y = Math.cos(this.timePassed) * this.orbitRadius + this.orbitY
95
-
96
- ctx.globalAlpha = this.alpha;
97
- ctx.drawImage(canvas2, x - this.radius / 2, y - this.radius / 2, this.radius, this.radius);
98
- this.timePassed += this.speed;
99
- }
100
-
101
- for (let i = 0; i < maxStars; i++) {
102
- new Star();
103
- }
104
-
105
- function animation() {
106
- ctx.globalCompositeOperation = 'source-over';
107
- ctx.globalAlpha = 0.8;
108
- ctx.fillStyle = background;
109
- ctx.fillRect(0, 0, w, h)
110
-
111
- ctx.globalCompositeOperation = 'lighter';
112
- for (let i = 1, l = stars.length; i < l; i++) {
113
- stars[i].draw();
114
- };
115
-
116
- window.requestAnimationFrame(animation);
117
- }
118
-
119
- animation();
120
-
121
- window.addEventListener('resize', () => {
122
- setSize();
123
- stars = [];
124
- count = 0;
125
- for (let i = 0; i < maxStars; i++) {
126
- new Star();
127
- }
1
+ "use strict";
2
+
3
+ Object.defineProperty(Element.prototype, 'outerHeight', {
4
+ 'get': function(){
5
+ var height = this.clientHeight;
6
+ var computedStyle = window.getComputedStyle(this);
7
+ height += parseInt(computedStyle.marginTop, 10);
8
+ height += parseInt(computedStyle.borderTopWidth, 10);
9
+ height += parseInt(computedStyle.borderBottomWidth, 10);
10
+ return height;
11
+ }
12
+ });
13
+
14
+ let canvas = document.getElementById('canvas');
15
+ let banner = document.getElementById('home-banner')
16
+
17
+ let ctx = canvas.getContext('2d');
18
+ let w;
19
+ let h;
20
+
21
+ let stars = [];
22
+ let count = 0;
23
+
24
+ const hue = 260;
25
+ const maxStars = 200;
26
+ const background = "black";
27
+
28
+ // Cache gradient
29
+ let canvas2 = document.createElement('canvas');
30
+ let ctx2 = canvas2.getContext('2d');
31
+
32
+ canvas2.width = 100;
33
+ canvas2.height = 100;
34
+
35
+ let half = canvas2.width/2;
36
+ let gradient2 = ctx2.createRadialGradient(half, half, 0, half, half, half);
37
+
38
+ gradient2.addColorStop(0.025, '#fff');
39
+ gradient2.addColorStop(0.1, 'hsl(' + hue + ', 61%, 100%)');
40
+ gradient2.addColorStop(0.25, 'hsl(' + hue + ', 64%, 0%)');
41
+ gradient2.addColorStop(1, 'transparent');
42
+
43
+ ctx2.fillStyle = gradient2;
44
+ ctx2.beginPath();
45
+ ctx2.arc(half, half, half, 0, Math.PI * 2);
46
+ ctx2.fill();
47
+
48
+ // End cache
49
+
50
+ function setSize() {
51
+ w = canvas.width = document.getElementsByTagName("html")[0].clientWidth;
52
+ h = canvas.height = banner.outerHeight;
53
+ }
54
+
55
+ setSize();
56
+
57
+ function random(min, max) {
58
+ if (arguments.length < 2) {
59
+ max = min;
60
+ min = 0;
61
+ }
62
+
63
+ if (min > max) {
64
+ let hold = max;
65
+ max = min;
66
+ min = hold;
67
+ }
68
+
69
+ return Math.floor(Math.random() * (max - min + 1)) + min;
70
+ }
71
+
72
+ function maxOrbit(x,y) {
73
+ let max = Math.max(x,y),
74
+ diameter = Math.round(Math.sqrt(max*max + max*max));
75
+ return diameter/2;
76
+ }
77
+
78
+ let Star = function() {
79
+
80
+ this.orbitRadius = random(maxOrbit(w/1.75,h/1.75));
81
+ this.radius = random(60, this.orbitRadius) / 12;
82
+ this.orbitX = w / 2;
83
+ this.orbitY = h / 2;
84
+ this.timePassed = random(0, maxStars);
85
+ this.speed = random(this.orbitRadius) / 1000000;
86
+ this.alpha = random(2, 10) / 10;
87
+
88
+ count++;
89
+ stars[count] = this;
90
+ }
91
+
92
+ Star.prototype.draw = function() {
93
+ let x = Math.sin(this.timePassed) * this.orbitRadius + this.orbitX,
94
+ y = Math.cos(this.timePassed) * this.orbitRadius + this.orbitY
95
+
96
+ ctx.globalAlpha = this.alpha;
97
+ ctx.drawImage(canvas2, x - this.radius / 2, y - this.radius / 2, this.radius, this.radius);
98
+ this.timePassed += this.speed;
99
+ }
100
+
101
+ for (let i = 0; i < maxStars; i++) {
102
+ new Star();
103
+ }
104
+
105
+ function animation() {
106
+ ctx.globalCompositeOperation = 'source-over';
107
+ ctx.globalAlpha = 0.8;
108
+ ctx.fillStyle = background;
109
+ ctx.fillRect(0, 0, w, h)
110
+
111
+ ctx.globalCompositeOperation = 'lighter';
112
+ for (let i = 1, l = stars.length; i < l; i++) {
113
+ stars[i].draw();
114
+ };
115
+
116
+ window.requestAnimationFrame(animation);
117
+ }
118
+
119
+ animation();
120
+
121
+ window.addEventListener('resize', () => {
122
+ setSize();
123
+ stars = [];
124
+ count = 0;
125
+ for (let i = 0; i < maxStars; i++) {
126
+ new Star();
127
+ }
128
128
  });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-theme-teddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teddy55Codes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-09 00:00:00.000000000 Z
11
+ date: 2024-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  requirements: []
116
- rubygems_version: 3.5.9
116
+ rubygems_version: 3.3.15
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: The theme used for https://github.com/Teddy55Codes/Blog