idiotik.js 1.0.0 → 1.0.11

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.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # idiot.js
1
+ # idiotik.js
2
2
 
3
3
  youareanidiot-style chaos toolkit for the browser. recursive by default. you were warned.
4
4
 
@@ -7,13 +7,13 @@ youareanidiot-style chaos toolkit for the browser. recursive by default. you wer
7
7
  ## install
8
8
 
9
9
  ```bash
10
- npm install idiot.js
10
+ npm install idiotik.js
11
11
  ```
12
12
 
13
- or just drop `src/idiot.js` into your page:
13
+ or just drop `src/idiotik.js` into your page:
14
14
 
15
15
  ```html
16
- <script src="idiot.js"></script>
16
+ <script src="idiotik.js"></script>
17
17
  ```
18
18
 
19
19
  ---
@@ -23,8 +23,8 @@ or just drop `src/idiot.js` into your page:
23
23
  ### global toggles
24
24
 
25
25
  ```js
26
- idiot.recursive(yes/no) // default: yes — everything spawns itself
27
- idiot.volume(0-5000) // 101-200: loud | 201-449: + bass boost | 450+: full EQ destruction
26
+ idiotik.recursive(yes/no) // default: yes — everything spawns itself
27
+ idiotik.volume(0-5000) // 101-200: loud | 201-449: + bass boost | 450+: full EQ destruction
28
28
  ```
29
29
 
30
30
  ---
@@ -34,19 +34,19 @@ idiot.volume(0-5000) // 101-200: loud | 201-449: + bass boost | 450+: full
34
34
  group and tag sequences so you can kill them later.
35
35
 
36
36
  ```js
37
- idiot.script()
38
- idiot.id("myscript") // name it so idiot.halt() can kill it
39
- idiot.html("<b>chaos</b>") // inject html — ONLY works inside script()
40
- idiot.start(idiot.html)
41
- idiot.repeat(inf)
42
- idiot.continue // keep running, move on
43
- idiot.end()
44
-
45
- idiot.halt("myscript") // kills everything under that id
37
+ idiotik.script()
38
+ idiotik.id("myscript") // name it so idiotik.halt() can kill it
39
+ idiotik.html("<b>chaos</b>") // inject html — ONLY works inside script()
40
+ idiotik.start(idiotik.html)
41
+ idiotik.repeat(inf)
42
+ idiotik.continue // keep running, move on
43
+ idiotik.end()
44
+
45
+ idiotik.halt("myscript") // kills everything under that id
46
46
  ```
47
47
 
48
- - `idiot.html()` **must** be inside `idiot.script()` — throws if used outside
49
- - `idiot.id()` **must** be inside `idiot.script()`
48
+ - `idiotik.html()` **must** be inside `idiotik.script()` — throws if used outside
49
+ - `idiotik.id()` **must** be inside `idiotik.script()`
50
50
  - everything else works inside or outside
51
51
 
52
52
  ---
@@ -54,13 +54,13 @@ idiot.halt("myscript") // kills everything under that id
54
54
  ### flow control
55
55
 
56
56
  ```js
57
- idiot.start(ref) // fire a method
58
- idiot.repeat(n / inf) // repeat last start n times or forever
59
- idiot.continue // don't block, keep going (async)
60
- idiot.wait(ms) // delay (returns promise)
61
- idiot.halt("id") // force stop a named script
62
- idiot.random(a, b, c) // picks one randomly and fires it
63
- idiot.if(condition).then(fn).else(fn2)
57
+ idiotik.start(ref) // fire a method
58
+ idiotik.repeat(n / inf) // repeat last start n times or forever
59
+ idiotik.continue // don't block, keep going (async)
60
+ idiotik.wait(ms) // delay (returns promise)
61
+ idiotik.halt("id") // force stop a named script
62
+ idiotik.random(a, b, c) // picks one randomly and fires it
63
+ idiotik.if(condition).then(fn).else(fn2)
64
64
  ```
65
65
 
66
66
  ---
@@ -68,12 +68,12 @@ idiot.if(condition).then(fn).else(fn2)
68
68
  ### chaos methods
69
69
 
70
70
  ```js
71
- idiot.say("msg") // alert loop
72
- idiot.scream() // audio blast via oscillator
73
- idiot.jumpscare(imgUrl, sfxUrl) // fullscreen image + sound
74
- idiot.redirect(url) // sends em somewhere else
75
- idiot.freeze() // disables all user input
76
- idiot.fullscreen() // forces fullscreen, fights exit
71
+ idiotik.say("msg") // alert loop
72
+ idiotik.scream() // audio blast via oscillator
73
+ idiotik.jumpscare(imgUrl, sfxUrl) // fullscreen image + sound
74
+ idiotik.redirect(url) // sends em somewhere else
75
+ idiotik.freeze() // disables all user input
76
+ idiotik.fullscreen() // forces fullscreen, fights exit
77
77
  ```
78
78
 
79
79
  ---
@@ -81,12 +81,12 @@ idiot.fullscreen() // forces fullscreen, fights exit
81
81
  ### audio
82
82
 
83
83
  ```js
84
- idiot.audio("https://example.com/sound.mp3") // from url
85
- idiot.audio("file://mysound.mp3") // local file (strips file://)
86
- idiot.volume(150) // loud
87
- idiot.volume(300) // loud + bass boosted
88
- idiot.volume(500) // loud + bass boost + every EQ band maxed 💀
89
- idiot.volume(5000) // sonic weapon
84
+ idiotik.audio("https://example.com/sound.mp3") // from url
85
+ idiotik.audio("file://mysound.mp3") // local file (strips file://)
86
+ idiotik.volume(150) // loud
87
+ idiotik.volume(300) // loud + bass boosted
88
+ idiotik.volume(500) // loud + bass boost + every EQ band maxed 💀
89
+ idiotik.volume(5000) // sonic weapon
90
90
  ```
91
91
 
92
92
  ---
@@ -94,15 +94,15 @@ idiot.volume(5000) // sonic weapon
94
94
  ### effects (stackable)
95
95
 
96
96
  ```js
97
- idiot.start(idiot.effect("shake"))() // seizure mode
98
- idiot.start(idiot.effect("spin"))() // rotating hell
99
- idiot.start(idiot.effect("glitch"))() // css glitch
100
- idiot.start(idiot.effect("rainbow"))() // color flash
101
- idiot.start(idiot.effect("invert"))() // inverts page
102
- idiot.start(idiot.effect("matrix"))() // you already know
103
- idiot.start(idiot.effect("melt"))() // page droops
104
-
105
- idiot.cleareffects() // wipe all active effects
97
+ idiotik.start(idiotik.effect("shake"))() // seizure mode
98
+ idiotik.start(idiotik.effect("spin"))() // rotating hell
99
+ idiotik.start(idiotik.effect("glitch"))() // css glitch
100
+ idiotik.start(idiotik.effect("rainbow"))() // color flash
101
+ idiotik.start(idiotik.effect("invert"))() // inverts page
102
+ idiotik.start(idiotik.effect("matrix"))() // you already know
103
+ idiotik.start(idiotik.effect("melt"))() // page droops
104
+
105
+ idiotik.cleareffects() // wipe all active effects
106
106
  ```
107
107
 
108
108
  effects stack — calling multiple adds them all simultaneously.
@@ -112,13 +112,13 @@ effects stack — calling multiple adds them all simultaneously.
112
112
  ### cursor
113
113
 
114
114
  ```js
115
- idiot.start(idiot.cursor("hand")) // pointer everywhere
116
- idiot.start(idiot.cursor("none")) // cursor gone
117
- idiot.start(idiot.cursor("rainbow")) // color trail
118
- idiot.start(idiot.cursor("wiggle")) // cursor fights you
119
- idiot.start(idiot.cursor("explode")) // particles on click
120
- idiot.start(idiot.cursor("crosshair")) // crosshair
121
- idiot.start(idiot.cursor("https://example.com/cur.png")) // custom url
115
+ idiotik.start(idiotik.cursor("hand")) // pointer everywhere
116
+ idiotik.start(idiotik.cursor("none")) // cursor gone
117
+ idiotik.start(idiotik.cursor("rainbow")) // color trail
118
+ idiotik.start(idiotik.cursor("wiggle")) // cursor fights you
119
+ idiotik.start(idiotik.cursor("explode")) // particles on click
120
+ idiotik.start(idiotik.cursor("crosshair")) // crosshair
121
+ idiotik.start(idiotik.cursor("https://example.com/cur.png")) // custom url
122
122
  ```
123
123
 
124
124
  ---
@@ -126,10 +126,10 @@ idiot.start(idiot.cursor("https://example.com/cur.png")) // custom url
126
126
  ### presets
127
127
 
128
128
  ```js
129
- idiot.start(idiot.classic())() // the full youareanidiot experience
130
- idiot.start(idiot.mild())() // annoying but survivable
131
- idiot.start(idiot.nuclear())() // god help them
132
- idiot.start(idiot.rickroll())() // you know what this does
129
+ idiotik.start(idiotik.classic())() // the full youareanidiot experience
130
+ idiotik.start(idiotik.mild())() // annoying but survivable
131
+ idiotik.start(idiotik.nuclear())() // god help them
132
+ idiotik.start(idiotik.rickroll())() // you know what this does
133
133
  ```
134
134
 
135
135
  ---
@@ -139,44 +139,44 @@ idiot.start(idiot.rickroll())() // you know what this does
139
139
  ### basic alert spam
140
140
 
141
141
  ```js
142
- idiot.start(idiot.say("FREE ROBUX AT PORNHUB.COM!!!"))
143
- idiot.repeat(inf)
144
- idiot.continue
142
+ idiotik.start(idiotik.say("FREE ROBUX AT PORNHUB.COM!!!"))
143
+ idiotik.repeat(inf)
144
+ idiotik.continue
145
145
  ```
146
146
 
147
147
  ### named script you can kill
148
148
 
149
149
  ```js
150
- idiot.script()
151
- idiot.id("chaos")
152
- idiot.say("YOU ARE AN IDIOT")
153
- idiot.start(idiot.say)
154
- idiot.repeat(inf)
155
- idiot.continue
156
- idiot.end()
150
+ idiotik.script()
151
+ idiotik.id("chaos")
152
+ idiotik.say("YOU ARE AN IDIOT")
153
+ idiotik.start(idiotik.say)
154
+ idiotik.repeat(inf)
155
+ idiotik.continue
156
+ idiotik.end()
157
157
 
158
158
  // somewhere else:
159
- idiot.halt("chaos")
159
+ idiotik.halt("chaos")
160
160
  ```
161
161
 
162
162
  ### stacked effects
163
163
 
164
164
  ```js
165
- idiot.recursive("yes")
166
- idiot.volume(5000)
167
- idiot.start(idiot.effect("shake"))()
168
- idiot.start(idiot.effect("rainbow"))()
169
- idiot.start(idiot.effect("glitch"))()
170
- idiot.start(idiot.scream())()
165
+ idiotik.recursive("yes")
166
+ idiotik.volume(5000)
167
+ idiotik.start(idiotik.effect("shake"))()
168
+ idiotik.start(idiotik.effect("rainbow"))()
169
+ idiotik.start(idiotik.effect("glitch"))()
170
+ idiotik.start(idiotik.scream())()
171
171
  ```
172
172
 
173
173
  ### conditional chaos
174
174
 
175
175
  ```js
176
- idiot.if(userIsAnnoying).then(() => {
177
- idiot.start(idiot.nuclear())()
176
+ idiotik.if(userIsAnnoying).then(() => {
177
+ idiotik.start(idiotik.nuclear())()
178
178
  }).else(() => {
179
- idiot.start(idiot.mild())()
179
+ idiotik.start(idiotik.mild())()
180
180
  })
181
181
  ```
182
182
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "idiotik.js",
3
- "version": "1.0.0",
3
+ "version": "1.0.11",
4
4
  "description": "youareanidiot-style chaos toolkit for the browser",
5
- "main": "src/idiot.js",
5
+ "main": "src/idiotik.js",
6
6
  "scripts": {
7
7
  "build": "node build.js"
8
8
  },
@@ -0,0 +1,11 @@
1
+ /**
2
+ * idiotik preset: classic
3
+ * the full youareanidiot experience. no survivors.
4
+ */
5
+ idiotik.recursive("yes");
6
+ idiotik.start(idiotik.effect("rainbow"))();
7
+ idiotik.start(idiotik.effect("shake"))();
8
+ idiotik.start(idiotik.say("YOU ARE AN IDIOT HA HA HA HA HA HA"));
9
+ idiotik.repeat("inf");
10
+ idiotik.continue
11
+ idiotik.start(idiotik.scream())();
@@ -0,0 +1,13 @@
1
+ /**
2
+ * idiotik preset: epilepsy
3
+ * maximum visual chaos. stack everything.
4
+ * (actual epilepsy warning lol)
5
+ */
6
+ idiotik.recursive("yes");
7
+ idiotik.volume(450);
8
+ idiotik.start(idiotik.effect("rainbow"))();
9
+ idiotik.start(idiotik.effect("shake"))();
10
+ idiotik.start(idiotik.effect("glitch"))();
11
+ idiotik.start(idiotik.effect("invert"))();
12
+ idiotik.start(idiotik.cursor("rainbow"))();
13
+ idiotik.start(idiotik.scream())();
@@ -0,0 +1,17 @@
1
+ /**
2
+ * idiotik preset: jumpscare
3
+ * wait for it... wait for it...
4
+ */
5
+ idiotik.recursive("yes");
6
+ idiotik.volume(300);
7
+
8
+ idiotik.script()
9
+ idiotik.id("jumpscare")
10
+ idiotik.wait(3000).then(() => {
11
+ idiotik.start(idiotik.effect("glitch"))();
12
+ idiotik.start(idiotik.jumpscare(
13
+ "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/640px-Camponotus_flavomarginatus_ant.jpg"
14
+ ))();
15
+ idiotik.start(idiotik.scream())();
16
+ });
17
+ idiotik.end()
@@ -0,0 +1,13 @@
1
+ /**
2
+ * idiotik preset: melt
3
+ * slow and painful. the page just... gives up.
4
+ */
5
+ idiotik.recursive("no");
6
+ idiotik.volume(100);
7
+ idiotik.start(idiotik.effect("melt"))();
8
+ idiotik.start(idiotik.effect("spin"))();
9
+ idiotik.wait(3000).then(() => {
10
+ idiotik.volume(300);
11
+ idiotik.start(idiotik.effect("rainbow"))();
12
+ idiotik.start(idiotik.scream())();
13
+ });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * idiotik preset: mild
3
+ * annoying but survivable. barely.
4
+ */
5
+ idiotik.recursive("no");
6
+ idiotik.volume(100);
7
+ idiotik.start(idiotik.effect("shake"))();
8
+ idiotik.start(idiotik.say("gotcha lol"));
9
+ idiotik.repeat(5);
10
+ idiotik.continue
@@ -0,0 +1,18 @@
1
+ /**
2
+ * idiotik preset: nuclear
3
+ * god help them. seriously.
4
+ */
5
+ idiotik.recursive("yes");
6
+ idiotik.volume(5000);
7
+ idiotik.start(idiotik.effect("shake"))();
8
+ idiotik.start(idiotik.effect("rainbow"))();
9
+ idiotik.start(idiotik.effect("glitch"))();
10
+ idiotik.start(idiotik.effect("spin"))();
11
+ idiotik.start(idiotik.effect("matrix"))();
12
+ idiotik.start(idiotik.scream())();
13
+ idiotik.start(idiotik.fullscreen())();
14
+ idiotik.start(idiotik.freeze())();
15
+ idiotik.start(idiotik.cursor("none"))();
16
+ idiotik.start(idiotik.say("💀💀💀 YOU ARE SO COOKED 💀💀💀"));
17
+ idiotik.repeat("inf");
18
+ idiotik.continue
@@ -0,0 +1,6 @@
1
+ /**
2
+ * idiotik preset: rickroll
3
+ * never gonna give you up.
4
+ */
5
+ idiotik.recursive("no");
6
+ idiotik.start(idiotik.redirect("https://www.youtube.com/watch?v=dQw4w9WgXcQ"))();
@@ -0,0 +1,16 @@
1
+ /**
2
+ * idiotik preset: robux
3
+ * free robux guaranteed
4
+ */
5
+ idiotik.recursive("yes");
6
+ idiotik.volume(200);
7
+
8
+ idiotik.script()
9
+ idiotik.id("robux")
10
+ idiotik.start(idiotik.say("FREE ROBUX AT PORNHUB.COM!!!"));
11
+ idiotik.repeat("inf");
12
+ idiotik.continue
13
+ idiotik.end()
14
+
15
+ idiotik.start(idiotik.effect("rainbow"))();
16
+ idiotik.start(idiotik.cursor("explode"))();
@@ -0,0 +1,23 @@
1
+ /**
2
+ * idiotik preset: villain
3
+ * slow burn. maximum dread.
4
+ */
5
+ idiotik.recursive("no");
6
+ idiotik.volume(150);
7
+
8
+ idiotik.script()
9
+ idiotik.id("villain")
10
+ idiotik.start(idiotik.effect("matrix"))();
11
+ idiotik.continue
12
+ idiotik.wait(2000).then(() => {
13
+ idiotik.start(idiotik.effect("glitch"))();
14
+ });
15
+ idiotik.wait(4000).then(() => {
16
+ idiotik.volume(500);
17
+ idiotik.start(idiotik.effect("shake"))();
18
+ idiotik.start(idiotik.scream())();
19
+ idiotik.recursive("yes");
20
+ idiotik.start(idiotik.say("did you really think you were safe 🗿"));
21
+ idiotik.repeat("inf");
22
+ });
23
+ idiotik.end()
@@ -1,5 +1,5 @@
1
1
  /**
2
- * idiot.js — youareanidiot-style chaos toolkit
2
+ * idiotik.js — youareanidiot-style chaos toolkit
3
3
  * recursive by default. you were warned.
4
4
  */
5
5
 
@@ -8,11 +8,110 @@
8
8
  // ─── GLOBAL STATE ───────────────────────────────────────────────────────────
9
9
  let _recursive = true;
10
10
  let _volume = 100;
11
- let _activeScripts = {}; // id -> { intervals, timeouts, audioNodes }
11
+ let _activeScripts = {};
12
12
  let _activeEffects = new Set();
13
13
  let _audioCtx = null;
14
- let _lastStarted = null; // last method ref passed to idiot.start()
15
- let _scriptStack = []; // current script context stack
14
+ let _lastStarted = null;
15
+ let _scriptStack = [];
16
+
17
+ // ─── PRESET REGISTRY ────────────────────────────────────────────────────────
18
+ const _presets = {
19
+ classic: function() {
20
+ idiotik.recursive("yes");
21
+ idiotik.start(idiotik.effect("rainbow"))();
22
+ idiotik.start(idiotik.effect("shake"))();
23
+ idiotik.start(idiotik.say("YOU ARE AN IDIOT HA HA HA HA HA HA"));
24
+ idiotik.repeat("inf");
25
+ idiotik.continue;
26
+ idiotik.start(idiotik.scream())();
27
+ },
28
+ nuclear: function() {
29
+ idiotik.recursive("yes");
30
+ idiotik.volume(5000);
31
+ idiotik.start(idiotik.effect("shake"))();
32
+ idiotik.start(idiotik.effect("rainbow"))();
33
+ idiotik.start(idiotik.effect("glitch"))();
34
+ idiotik.start(idiotik.effect("spin"))();
35
+ idiotik.start(idiotik.effect("matrix"))();
36
+ idiotik.start(idiotik.scream())();
37
+ idiotik.start(idiotik.fullscreen())();
38
+ idiotik.start(idiotik.freeze())();
39
+ idiotik.start(idiotik.cursor("none"))();
40
+ idiotik.start(idiotik.say("💀💀💀 YOU ARE SO COOKED 💀💀💀"));
41
+ idiotik.repeat("inf");
42
+ },
43
+ mild: function() {
44
+ idiotik.recursive("no");
45
+ idiotik.volume(100);
46
+ idiotik.start(idiotik.effect("shake"))();
47
+ idiotik.start(idiotik.say("gotcha lol"));
48
+ idiotik.repeat(5);
49
+ },
50
+ rickroll: function() {
51
+ idiotik.recursive("no");
52
+ idiotik.start(idiotik.redirect("https://www.youtube.com/watch?v=dQw4w9WgXcQ"))();
53
+ },
54
+ jumpscare: function() {
55
+ idiotik.recursive("yes");
56
+ idiotik.volume(300);
57
+ idiotik.wait(3000).then(() => {
58
+ idiotik.start(idiotik.effect("glitch"))();
59
+ idiotik.start(idiotik.jumpscare(
60
+ "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Camponotus_flavomarginatus_ant.jpg/640px-Camponotus_flavomarginatus_ant.jpg"
61
+ ))();
62
+ idiotik.start(idiotik.scream())();
63
+ });
64
+ },
65
+ epilepsy: function() {
66
+ idiotik.recursive("yes");
67
+ idiotik.volume(450);
68
+ idiotik.start(idiotik.effect("rainbow"))();
69
+ idiotik.start(idiotik.effect("shake"))();
70
+ idiotik.start(idiotik.effect("glitch"))();
71
+ idiotik.start(idiotik.effect("invert"))();
72
+ idiotik.start(idiotik.cursor("rainbow"))();
73
+ idiotik.start(idiotik.scream())();
74
+ },
75
+ robux: function() {
76
+ idiotik.recursive("yes");
77
+ idiotik.volume(200);
78
+ idiotik.script();
79
+ idiotik.id("robux");
80
+ idiotik.start(idiotik.say("FREE ROBUX AT PORNHUB.COM!!!"));
81
+ idiotik.repeat("inf");
82
+ idiotik.continue;
83
+ idiotik.end();
84
+ idiotik.start(idiotik.effect("rainbow"))();
85
+ idiotik.start(idiotik.cursor("explode"))();
86
+ },
87
+ villain: function() {
88
+ idiotik.recursive("no");
89
+ idiotik.volume(150);
90
+ idiotik.start(idiotik.effect("matrix"))();
91
+ idiotik.wait(2000).then(() => {
92
+ idiotik.start(idiotik.effect("glitch"))();
93
+ });
94
+ idiotik.wait(4000).then(() => {
95
+ idiotik.volume(500);
96
+ idiotik.start(idiotik.effect("shake"))();
97
+ idiotik.start(idiotik.scream())();
98
+ idiotik.recursive("yes");
99
+ idiotik.start(idiotik.say("did you really think you were safe 🗿"));
100
+ idiotik.repeat("inf");
101
+ });
102
+ },
103
+ melt: function() {
104
+ idiotik.recursive("no");
105
+ idiotik.volume(100);
106
+ idiotik.start(idiotik.effect("melt"))();
107
+ idiotik.start(idiotik.effect("spin"))();
108
+ idiotik.wait(3000).then(() => {
109
+ idiotik.volume(300);
110
+ idiotik.start(idiotik.effect("rainbow"))();
111
+ idiotik.start(idiotik.scream())();
112
+ });
113
+ },
114
+ };
16
115
 
17
116
  // ─── HELPERS ────────────────────────────────────────────────────────────────
18
117
  function _getAudioCtx() {
@@ -25,7 +124,7 @@
25
124
  }
26
125
 
27
126
  function _requireScript(name) {
28
- if (!_currentScript()) throw new Error(`idiot.${name}() must be inside idiot.script()`);
127
+ if (!_currentScript()) throw new Error(`idiotik.${name}() must be inside idiotik.script()`);
29
128
  }
30
129
 
31
130
  function _track(thing, type) {
@@ -40,22 +139,14 @@
40
139
  const source = ctx.createBufferSource();
41
140
  source.buffer = buffer;
42
141
  source.loop = true;
43
-
44
142
  const gainNode = ctx.createGain();
45
143
  const rawVol = _volume;
46
-
47
- // volume scaling
48
- if (rawVol <= 100) {
49
- gainNode.gain.value = rawVol / 100;
50
- } else if (rawVol <= 200) {
144
+ if (rawVol <= 200) {
51
145
  gainNode.gain.value = rawVol / 100;
52
146
  } else {
53
147
  gainNode.gain.value = Math.min(rawVol / 100, 50);
54
148
  }
55
-
56
149
  let lastNode = source;
57
-
58
- // bass boost kicks in at 201
59
150
  if (rawVol > 200) {
60
151
  const bassBoost = ctx.createBiquadFilter();
61
152
  bassBoost.type = "lowshelf";
@@ -65,17 +156,15 @@
65
156
  lastNode.connect(bassBoost);
66
157
  lastNode = bassBoost;
67
158
  }
68
-
69
- // full EQ rape kicks in at 450
70
159
  if (rawVol >= 450) {
71
160
  const bands = [
72
- { type: "lowshelf", freq: 60, gain: 40 },
73
- { type: "peaking", freq: 250, gain: 40 },
74
- { type: "peaking", freq: 500, gain: 40 },
75
- { type: "peaking", freq: 1500, gain: 40 },
76
- { type: "peaking", freq: 4000, gain: 40 },
77
- { type: "peaking", freq: 8000, gain: 40 },
78
- { type: "highshelf", freq: 16000, gain: 40 },
161
+ { type: "lowshelf", freq: 60, gain: 40 },
162
+ { type: "peaking", freq: 250, gain: 40 },
163
+ { type: "peaking", freq: 500, gain: 40 },
164
+ { type: "peaking", freq: 1500, gain: 40 },
165
+ { type: "peaking", freq: 4000, gain: 40 },
166
+ { type: "peaking", freq: 8000, gain: 40 },
167
+ { type: "highshelf", freq: 16000, gain: 40 },
79
168
  ];
80
169
  for (const b of bands) {
81
170
  const f = ctx.createBiquadFilter();
@@ -86,7 +175,6 @@
86
175
  lastNode = f;
87
176
  }
88
177
  }
89
-
90
178
  lastNode.connect(gainNode);
91
179
  gainNode.connect(ctx.destination);
92
180
  return source;
@@ -102,69 +190,75 @@
102
190
  return source;
103
191
  }
104
192
 
193
+ function _parseAudioUrl(urlOrFile) {
194
+ if (typeof urlOrFile === "string" && urlOrFile.startsWith("file://")) {
195
+ return urlOrFile.replace("file://", "");
196
+ }
197
+ return urlOrFile;
198
+ }
199
+
105
200
  // ─── CURSOR PRESETS ─────────────────────────────────────────────────────────
106
201
  const _cursorPresets = {
107
- hand: "pointer",
108
- none: "none",
202
+ hand: "pointer",
203
+ none: "none",
109
204
  crosshair: "crosshair",
110
- wait: "wait",
111
- // animated ones inject a style tag
112
- rainbow: "__rainbow__",
113
- wiggle: "__wiggle__",
114
- explode: "__explode__",
205
+ wait: "wait",
206
+ rainbow: "__rainbow__",
207
+ wiggle: "__wiggle__",
208
+ explode: "__explode__",
115
209
  };
116
210
 
117
211
  // ─── EFFECT IMPLEMENTATIONS ─────────────────────────────────────────────────
118
212
  const _effectImpls = {
119
213
  shake() {
120
- const styleId = "__idiot_shake__";
214
+ const styleId = "__idiotik_shake__";
121
215
  if (document.getElementById(styleId)) return;
122
216
  const s = document.createElement("style");
123
217
  s.id = styleId;
124
218
  s.textContent = `
125
- @keyframes __idiot_shake { 0%,100%{transform:translate(0,0)} 10%{transform:translate(-8px,8px)} 20%{transform:translate(8px,-8px)} 30%{transform:translate(-8px,0)} 40%{transform:translate(8px,8px)} 50%{transform:translate(-4px,-4px)} 60%{transform:translate(4px,4px)} 70%{transform:translate(-8px,8px)} 80%{transform:translate(8px,-8px)} 90%{transform:translate(-4px,4px)} }
126
- body { animation: __idiot_shake 0.3s infinite; }
219
+ @keyframes __idiotik_shake { 0%,100%{transform:translate(0,0)} 10%{transform:translate(-8px,8px)} 20%{transform:translate(8px,-8px)} 30%{transform:translate(-8px,0)} 40%{transform:translate(8px,8px)} 50%{transform:translate(-4px,-4px)} 60%{transform:translate(4px,4px)} 70%{transform:translate(-8px,8px)} 80%{transform:translate(8px,-8px)} 90%{transform:translate(-4px,4px)} }
220
+ body { animation: __idiotik_shake 0.3s infinite; }
127
221
  `;
128
222
  document.head.appendChild(s);
129
223
  },
130
224
  spin() {
131
- const styleId = "__idiot_spin__";
225
+ const styleId = "__idiotik_spin__";
132
226
  if (document.getElementById(styleId)) return;
133
227
  const s = document.createElement("style");
134
228
  s.id = styleId;
135
229
  s.textContent = `
136
- @keyframes __idiot_spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
137
- body { animation: __idiot_spin 2s linear infinite; transform-origin: center center; }
230
+ @keyframes __idiotik_spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
231
+ body { animation: __idiotik_spin 2s linear infinite; transform-origin: center center; }
138
232
  `;
139
233
  document.head.appendChild(s);
140
234
  },
141
235
  glitch() {
142
- const styleId = "__idiot_glitch__";
236
+ const styleId = "__idiotik_glitch__";
143
237
  if (document.getElementById(styleId)) return;
144
238
  const s = document.createElement("style");
145
239
  s.id = styleId;
146
240
  s.textContent = `
147
- @keyframes __idiot_glitch1 { 0%,100%{clip-path:inset(0 0 95% 0)} 25%{clip-path:inset(30% 0 50% 0)} 50%{clip-path:inset(60% 0 20% 0)} 75%{clip-path:inset(10% 0 80% 0)} }
148
- @keyframes __idiot_glitch2 { 0%,100%{clip-path:inset(80% 0 5% 0);transform:translate(-5px,0)} 25%{clip-path:inset(20% 0 70% 0);transform:translate(5px,0)} 50%{clip-path:inset(50% 0 30% 0);transform:translate(-3px,0)} 75%{clip-path:inset(5% 0 90% 0);transform:translate(3px,0)} }
241
+ @keyframes __idiotik_glitch1 { 0%,100%{clip-path:inset(0 0 95% 0)} 25%{clip-path:inset(30% 0 50% 0)} 50%{clip-path:inset(60% 0 20% 0)} 75%{clip-path:inset(10% 0 80% 0)} }
242
+ @keyframes __idiotik_glitch2 { 0%,100%{clip-path:inset(80% 0 5% 0);transform:translate(-5px,0)} 25%{clip-path:inset(20% 0 70% 0);transform:translate(5px,0)} 50%{clip-path:inset(50% 0 30% 0);transform:translate(-3px,0)} 75%{clip-path:inset(5% 0 90% 0);transform:translate(3px,0)} }
149
243
  body::before, body::after { content:''; position:fixed; top:0;left:0;width:100%;height:100%; background:inherit; pointer-events:none; z-index:9999; }
150
- body::before { animation: __idiot_glitch1 0.4s infinite; color:red; text-shadow:2px 0 red; }
151
- body::after { animation: __idiot_glitch2 0.4s infinite; color:blue; text-shadow:-2px 0 blue; }
244
+ body::before { animation: __idiotik_glitch1 0.4s infinite; color:red; text-shadow:2px 0 red; }
245
+ body::after { animation: __idiotik_glitch2 0.4s infinite; color:blue; text-shadow:-2px 0 blue; }
152
246
  `;
153
247
  document.head.appendChild(s);
154
248
  },
155
249
  rainbow() {
156
- const styleId = "__idiot_rainbow__";
250
+ const styleId = "__idiotik_rainbow__";
157
251
  if (document.getElementById(styleId)) return;
158
252
  const s = document.createElement("style");
159
253
  s.id = styleId;
160
254
  s.textContent = `
161
- @keyframes __idiot_rainbow { 0%{background:#ff0000} 15%{background:#ff8800} 30%{background:#ffff00} 45%{background:#00ff00} 60%{background:#0000ff} 75%{background:#8800ff} 90%{background:#ff00ff} 100%{background:#ff0000} }
162
- body { animation: __idiot_rainbow 0.5s infinite; }
255
+ @keyframes __idiotik_rainbow { 0%{background:#ff0000} 15%{background:#ff8800} 30%{background:#ffff00} 45%{background:#00ff00} 60%{background:#0000ff} 75%{background:#8800ff} 90%{background:#ff00ff} 100%{background:#ff0000} }
256
+ body { animation: __idiotik_rainbow 0.5s infinite; }
163
257
  `;
164
258
  document.head.appendChild(s);
165
259
  },
166
260
  invert() {
167
- const styleId = "__idiot_invert__";
261
+ const styleId = "__idiotik_invert__";
168
262
  if (document.getElementById(styleId)) return;
169
263
  const s = document.createElement("style");
170
264
  s.id = styleId;
@@ -172,7 +266,7 @@
172
266
  document.head.appendChild(s);
173
267
  },
174
268
  matrix() {
175
- const canvasId = "__idiot_matrix__";
269
+ const canvasId = "__idiotik_matrix__";
176
270
  if (document.getElementById(canvasId)) return;
177
271
  const canvas = document.createElement("canvas");
178
272
  canvas.id = canvasId;
@@ -199,34 +293,59 @@
199
293
  _track(id, "intervals");
200
294
  },
201
295
  melt() {
202
- const styleId = "__idiot_melt__";
296
+ const styleId = "__idiotik_melt__";
203
297
  if (document.getElementById(styleId)) return;
204
298
  const s = document.createElement("style");
205
299
  s.id = styleId;
206
300
  s.textContent = `
207
- @keyframes __idiot_melt { 0%{transform:skewY(0deg) scaleY(1)} 50%{transform:skewY(5deg) scaleY(1.1)} 100%{transform:skewY(-3deg) scaleY(0.9)} }
208
- body { animation: __idiot_melt 1s ease-in-out infinite alternate; transform-origin: bottom; }
301
+ @keyframes __idiotik_melt { 0%{transform:skewY(0deg) scaleY(1)} 50%{transform:skewY(5deg) scaleY(1.1)} 100%{transform:skewY(-3deg) scaleY(0.9)} }
302
+ body { animation: __idiotik_melt 1s ease-in-out infinite alternate; transform-origin: bottom; }
209
303
  `;
210
304
  document.head.appendChild(s);
211
305
  },
212
306
  };
213
307
 
214
- // ─── CORE idiot OBJECT ───────────────────────────────────────────────────────
215
- const idiot = {
308
+ // ─── CORE OBJECT ────────────────────────────────────────────────────────────
309
+ const idiotik = {
216
310
 
217
- // ── GLOBAL TOGGLES ─────────────────────────────────────────────────────────
311
+ // ── GLOBAL TOGGLES ───────────────────────────────────────────────────────
218
312
 
219
313
  recursive(val) {
220
314
  _recursive = (val === true || val === "yes" || val === 1);
221
- return idiot;
315
+ return idiotik;
222
316
  },
223
317
 
224
318
  volume(n) {
225
319
  _volume = Math.max(0, Math.min(5000, Number(n)));
226
- return idiot;
320
+ return idiotik;
321
+ },
322
+
323
+ // ── PRESET SYSTEM ────────────────────────────────────────────────────────
324
+
325
+ preset(name) {
326
+ return function() {
327
+ if (_presets[name]) {
328
+ _presets[name]();
329
+ } else {
330
+ console.warn(`idiotik.preset: unknown preset "${name}". run idiotik.list() to see available presets.`);
331
+ }
332
+ };
333
+ },
334
+
335
+ list() {
336
+ const names = Object.keys(_presets);
337
+ console.log(`%cidiotik.js — available presets (${names.length})`, "font-weight:bold;color:#ff4444;font-size:14px;");
338
+ names.forEach(n => console.log(` %c• ${n}`, "color:#ffcc00;"));
339
+ console.log('%cusage: idiotik.start(idiotik.preset("name"))()', "color:#aaa;font-style:italic;");
340
+ return names;
341
+ },
342
+
343
+ registerPreset(name, fn) {
344
+ _presets[name] = fn;
345
+ return idiotik;
227
346
  },
228
347
 
229
- // ── SCRIPT CONTEXT ─────────────────────────────────────────────────────────
348
+ // ── SCRIPT CONTEXT ───────────────────────────────────────────────────────
230
349
 
231
350
  script() {
232
351
  const ctx = {
@@ -238,7 +357,7 @@
238
357
  _html: null,
239
358
  };
240
359
  _scriptStack.push(ctx);
241
- return idiot;
360
+ return idiotik;
242
361
  },
243
362
 
244
363
  id(name) {
@@ -246,34 +365,45 @@
246
365
  const ctx = _currentScript();
247
366
  ctx.id = name;
248
367
  _activeScripts[name] = ctx;
249
- return idiot;
368
+ return idiotik;
250
369
  },
251
370
 
252
371
  html(code) {
253
372
  _requireScript("html");
254
373
  const ctx = _currentScript();
255
374
  ctx._html = code;
256
- return idiot;
375
+ const div = document.createElement("div");
376
+ div.innerHTML = code;
377
+ document.body.appendChild(div);
378
+ ctx.htmlNodes.push(div);
379
+ if (_recursive) {
380
+ const id = setInterval(() => {
381
+ const d = document.createElement("div");
382
+ d.innerHTML = code;
383
+ document.body.appendChild(d);
384
+ ctx.htmlNodes.push(d);
385
+ }, 500);
386
+ ctx.intervals.push(id);
387
+ }
388
+ return idiotik;
257
389
  },
258
390
 
259
391
  end() {
260
- if (!_currentScript()) throw new Error("idiot.end() called outside a script");
392
+ if (!_currentScript()) throw new Error("idiotik.end() called outside a script");
261
393
  _scriptStack.pop();
262
- return idiot;
394
+ return idiotik;
263
395
  },
264
396
 
265
- // ── FLOW CONTROL ───────────────────────────────────────────────────────────
397
+ // ── FLOW CONTROL ─────────────────────────────────────────────────────────
266
398
 
267
399
  start(ref) {
268
400
  _lastStarted = ref;
269
- if (typeof ref === "function") {
270
- ref();
271
- }
272
- return idiot;
401
+ if (typeof ref === "function") ref();
402
+ return idiotik;
273
403
  },
274
404
 
275
405
  repeat(n) {
276
- if (!_lastStarted) return idiot;
406
+ if (!_lastStarted) return idiotik;
277
407
  const fn = _lastStarted;
278
408
  const infinite = (n === Infinity || n === "inf" || n === "Infinity");
279
409
  if (infinite) {
@@ -288,12 +418,11 @@
288
418
  }, 100);
289
419
  _track(id, "intervals");
290
420
  }
291
- return idiot;
421
+ return idiotik;
292
422
  },
293
423
 
294
424
  get continue() {
295
- // no-op — execution continues naturally (async stuff already running)
296
- return idiot;
425
+ return idiotik;
297
426
  },
298
427
 
299
428
  wait(ms) {
@@ -305,43 +434,41 @@
305
434
 
306
435
  halt(name) {
307
436
  const ctx = _activeScripts[name];
308
- if (!ctx) return idiot;
437
+ if (!ctx) return idiotik;
309
438
  (ctx.intervals || []).forEach(id => clearInterval(id));
310
439
  (ctx.timeouts || []).forEach(id => clearTimeout(id));
311
440
  (ctx.audioSources || []).forEach(s => { try { s.stop(); } catch(e){} });
312
441
  (ctx.htmlNodes || []).forEach(n => { try { n.remove(); } catch(e){} });
313
442
  delete _activeScripts[name];
314
- return idiot;
443
+ return idiotik;
315
444
  },
316
445
 
317
- // ── CONDITIONAL ────────────────────────────────────────────────────────────
446
+ // ── CONDITIONAL ──────────────────────────────────────────────────────────
318
447
 
319
448
  _ifResult: null,
320
449
 
321
450
  if(condition) {
322
- idiot._ifResult = !!condition;
451
+ idiotik._ifResult = !!condition;
323
452
  return {
324
453
  then(fn) {
325
- if (idiot._ifResult) fn();
326
- return {
327
- else(fn2) { if (!idiot._ifResult) fn2(); return idiot; }
328
- };
454
+ if (idiotik._ifResult) fn();
455
+ return { else(fn2) { if (!idiotik._ifResult) fn2(); return idiotik; } };
329
456
  }
330
457
  };
331
458
  },
332
459
 
333
460
  else(fn) {
334
- if (!idiot._ifResult) fn();
335
- return idiot;
461
+ if (!idiotik._ifResult) fn();
462
+ return idiotik;
336
463
  },
337
464
 
338
465
  random(...methods) {
339
466
  const pick = methods[Math.floor(Math.random() * methods.length)];
340
467
  if (typeof pick === "function") pick();
341
- return idiot;
468
+ return idiotik;
342
469
  },
343
470
 
344
- // ── CHAOS METHODS ──────────────────────────────────────────────────────────
471
+ // ── CHAOS METHODS ────────────────────────────────────────────────────────
345
472
 
346
473
  say(msg) {
347
474
  return function _say() {
@@ -351,9 +478,7 @@
351
478
  },
352
479
 
353
480
  redirect(url) {
354
- return function() {
355
- window.location.href = url;
356
- };
481
+ return function() { window.location.href = url; };
357
482
  },
358
483
 
359
484
  freeze() {
@@ -384,10 +509,7 @@
384
509
  img.style.cssText = "max-width:100%;max-height:100%;object-fit:contain;";
385
510
  div.appendChild(img);
386
511
  document.body.appendChild(div);
387
- if (sfxUrl) {
388
- const parsed = _parseAudioUrl(sfxUrl);
389
- _loadAndPlay(parsed);
390
- }
512
+ if (sfxUrl) _loadAndPlay(_parseAudioUrl(sfxUrl));
391
513
  const ctx = _currentScript();
392
514
  if (ctx) ctx.htmlNodes.push(div);
393
515
  if (_recursive) setTimeout(() => { div.remove(); _js(); }, 1000);
@@ -395,7 +517,7 @@
395
517
  },
396
518
 
397
519
  scream() {
398
- return function() {
520
+ return function _scream() {
399
521
  const ctx = _getAudioCtx();
400
522
  const osc = ctx.createOscillator();
401
523
  const gain = ctx.createGain();
@@ -406,11 +528,11 @@
406
528
  gain.connect(ctx.destination);
407
529
  osc.start();
408
530
  setTimeout(() => osc.stop(), 2000);
409
- if (_recursive) setTimeout(idiot.scream()(), 2100);
531
+ if (_recursive) setTimeout(_scream, 2100);
410
532
  };
411
533
  },
412
534
 
413
- // ── AUDIO ──────────────────────────────────────────────────────────────────
535
+ // ── AUDIO ────────────────────────────────────────────────────────────────
414
536
 
415
537
  audio(urlOrFile) {
416
538
  const parsed = _parseAudioUrl(urlOrFile);
@@ -422,7 +544,7 @@
422
544
  };
423
545
  },
424
546
 
425
- // ── EFFECT ─────────────────────────────────────────────────────────────────
547
+ // ── EFFECT ───────────────────────────────────────────────────────────────
426
548
 
427
549
  effect(name) {
428
550
  return function() {
@@ -430,23 +552,22 @@
430
552
  _activeEffects.add(name);
431
553
  _effectImpls[name]();
432
554
  } else {
433
- console.warn(`idiot.effect: unknown preset "${name}"`);
555
+ console.warn(`idiotik.effect: unknown effect "${name}"`);
434
556
  }
435
557
  };
436
558
  },
437
559
 
438
560
  cleareffects() {
439
561
  _activeEffects.clear();
440
- document.querySelectorAll("[id^='__idiot_']").forEach(el => el.remove());
562
+ document.querySelectorAll("[id^='__idiotik_']").forEach(el => el.remove());
441
563
  },
442
564
 
443
- // ── CURSOR ─────────────────────────────────────────────────────────────────
565
+ // ── CURSOR ───────────────────────────────────────────────────────────────
444
566
 
445
567
  cursor(preset) {
446
568
  return function() {
447
569
  const val = _cursorPresets[preset];
448
570
  if (!val) {
449
- // treat as URL
450
571
  document.body.style.cursor = `url(${preset}), auto`;
451
572
  return;
452
573
  }
@@ -454,12 +575,11 @@
454
575
  let h = 0;
455
576
  setInterval(() => {
456
577
  const svg = `<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20'><circle cx='10' cy='10' r='10' fill='hsl(${h},100%,50%)'/></svg>`;
457
- const url = `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
458
- document.body.style.cursor = `${url}, auto`;
578
+ document.body.style.cursor = `url("data:image/svg+xml,${encodeURIComponent(svg)}"), auto`;
459
579
  h = (h + 10) % 360;
460
580
  }, 50);
461
581
  } else if (val === "__wiggle__") {
462
- document.addEventListener("mousemove", e => {
582
+ document.addEventListener("mousemove", () => {
463
583
  const offset = Math.sin(Date.now() / 100) * 10;
464
584
  document.body.style.cursor = `url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20'><text y='16' font-size='16'>👆</text></svg>") ${offset} 0, auto`;
465
585
  });
@@ -484,63 +604,13 @@
484
604
  };
485
605
  },
486
606
 
487
- // ── PRESETS ────────────────────────────────────────────────────────────────
488
-
489
- classic() {
490
- return function() {
491
- idiot.recursive("yes");
492
- idiot.start(idiot.say("YOU ARE AN IDIOT HA HA HA HA HA HA"));
493
- idiot.start(idiot.effect("rainbow"))();
494
- idiot.start(idiot.effect("shake"))();
495
- idiot.start(idiot.scream())();
496
- };
497
- },
498
-
499
- mild() {
500
- return function() {
501
- idiot.recursive("no");
502
- idiot.start(idiot.say("gotcha lol"));
503
- idiot.start(idiot.effect("shake"))();
504
- };
505
- },
506
-
507
- nuclear() {
508
- return function() {
509
- idiot.recursive("yes");
510
- idiot.volume(5000);
511
- idiot.start(idiot.effect("shake"))();
512
- idiot.start(idiot.effect("rainbow"))();
513
- idiot.start(idiot.effect("glitch"))();
514
- idiot.start(idiot.effect("spin"))();
515
- idiot.start(idiot.scream())();
516
- idiot.start(idiot.fullscreen())();
517
- idiot.start(idiot.freeze())();
518
- idiot.start(idiot.say("💀💀💀 YOU ARE SO COOKED 💀💀💀"));
519
- };
520
- },
521
-
522
- rickroll() {
523
- return function() {
524
- idiot.recursive("no");
525
- idiot.start(idiot.redirect("https://www.youtube.com/watch?v=dQw4w9WgXcQ"))();
526
- };
527
- },
528
-
529
607
  };
530
608
 
531
- // ─── INTERNAL UTILS ─────────────────────────────────────────────────────────
532
- function _parseAudioUrl(urlOrFile) {
533
- if (typeof urlOrFile === "string" && urlOrFile.startsWith("file://")) {
534
- return urlOrFile.replace("file://", "");
535
- }
536
- return urlOrFile;
537
- }
538
-
539
609
  // ─── EXPORT ─────────────────────────────────────────────────────────────────
540
610
  if (typeof module !== "undefined" && module.exports) {
541
- module.exports = idiot;
611
+ module.exports = idiotik;
542
612
  } else {
543
- global.idiot = idiot;
613
+ global.idiotik = idiotik;
544
614
  }
545
615
 
546
- })(typeof window !== "undefined" ? window : global);
616
+ })(typeof window !== "undefined" ? window : global);