idiotik.js 1.0.11 → 1.0.13

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.
Files changed (2) hide show
  1. package/package.json +7 -2
  2. package/src/idiotik.js +18 -2
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "idiotik.js",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "youareanidiot-style chaos toolkit for the browser",
5
5
  "main": "src/idiotik.js",
6
6
  "scripts": {
7
7
  "build": "node build.js"
8
8
  },
9
- "keywords": ["chaos", "prank", "browser", "youareanidiot"],
9
+ "keywords": [
10
+ "chaos",
11
+ "prank",
12
+ "browser",
13
+ "youareanidiot"
14
+ ],
10
15
  "license": "MIT",
11
16
  "files": [
12
17
  "src/",
package/src/idiotik.js CHANGED
@@ -8,6 +8,7 @@
8
8
  // ─── GLOBAL STATE ───────────────────────────────────────────────────────────
9
9
  let _recursive = true;
10
10
  let _volume = 100;
11
+ let _popup = true;
11
12
  let _activeScripts = {};
12
13
  let _activeEffects = new Set();
13
14
  let _audioCtx = null;
@@ -320,6 +321,11 @@
320
321
  return idiotik;
321
322
  },
322
323
 
324
+ popup(val) {
325
+ _popup = (val === true || val === "yes" || val === 1);
326
+ return idiotik;
327
+ },
328
+
323
329
  // ── PRESET SYSTEM ────────────────────────────────────────────────────────
324
330
 
325
331
  preset(name) {
@@ -472,8 +478,18 @@
472
478
 
473
479
  say(msg) {
474
480
  return function _say() {
475
- alert(msg);
476
- if (_recursive) setTimeout(() => _say(), 0);
481
+ if (_popup) {
482
+ const w = window.open("", "_blank", "width=300,height=150,toolbar=no,menubar=no,scrollbars=no,resizable=no");
483
+ if (w) {
484
+ w.document.write(`<html><body style="margin:0;display:flex;align-items:center;justify-content:center;height:100vh;font-family:Comic Sans MS,cursive;font-size:1.2rem;background:#fff;text-align:center;padding:1rem;">${msg}</body></html>`);
485
+ w.document.close();
486
+ if (_recursive) w.onload = () => setTimeout(_say, 100);
487
+ if (_recursive) setTimeout(_say, 100);
488
+ }
489
+ } else {
490
+ alert(msg);
491
+ if (_recursive) setTimeout(() => _say(), 0);
492
+ }
477
493
  };
478
494
  },
479
495