Skip to content

Commit 6610a6e

Browse files
committed
v2.11.1
replace array#flatten() with array#flat() update for SC 2.37 compatibility update demo to latest SC version
1 parent 336675f commit 6610a6e

37 files changed

Lines changed: 123 additions & 100 deletions

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"files.exclude": {
3+
"**/node_modules": true,
4+
"scripts/minified": true
5+
}
6+
}

cmfsc2.code-workspace

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"folders": [
3+
{
4+
"path": ".",
5+
}
6+
]
7+
}

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Chapel's Custom Macro Collection (v2.11.0)
1+
## Chapel's Custom Macro Collection (v2.11.1)
22

33
- [Try the demo!](https://macros.twinelab.net/demo) ([Sausage](https://github.com/ChapelR/custom-macros-demo))
44
- [Downloads](https://macros.twinelab.net/download)

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
[Back to the main page](./README.md).
44

5+
### July 22, 2024 (v2.11.1)
6+
7+
- **[Update]** SugarCube v2.37.0 dropped the `array#flatten()` polyfill, so all instances were replaced with `array#flat()`. I should have probably done this a while ago, but there's no time like the last possible second!
8+
59
### February 20, 2024 (v2.11.0)
610

711
- **[Retired]** Removed Simple Inventory 2 in favor of [Simple Inventory 3](https://inventory.twinelab.net/).

docs/demo/index.html

Lines changed: 55 additions & 49 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "custom-macros-for-sugarcube-2",
3-
"version": "2.9.0",
3+
"version": "2.11.1",
44
"description": "Collection of custom macros and systems for Twine/SugarCube2.",
55
"main": "build.js",
66
"directories": {

scripts/continue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
if (State.length > 0) {
2929
return false;
3030
}
31-
var args = [].slice.call(arguments).flatten();
31+
var args = [].slice.call(arguments).flat(Infinity);
3232
ignored = ignored.concat(args);
3333
return true;
3434
}
@@ -56,7 +56,7 @@
5656
}
5757

5858
function reset () {
59-
var args = [].slice.call(arguments).flatten();
59+
var args = [].slice.call(arguments).flat(Infinity);
6060
ignored = ignored.concat(args);
6161
$(document).off('.continue-macro');
6262
ignoreMe();

scripts/css-macro.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
function cssChanger (/*element, args...*/) {
4141
try {
42-
var args = [].slice.call(arguments).flatten(),
42+
var args = [].slice.call(arguments).flat(Infinity),
4343
$el = args.shift(),
4444
map;
4545
if (typeof args[0] === 'string') {

scripts/cycles.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
if (pl.args.length < 1) {
2828
return null;
2929
}
30-
var phases = pl.args.flatten();
30+
var phases = pl.args.flat(Infinity);
3131
if (!phases.every(function (ph) {
3232
return typeof ph === 'string';
3333
})) {
@@ -141,7 +141,7 @@
141141
},
142142
check : function (name) {
143143
if (Cycle.has(name)) {
144-
var phases = [].slice.call(arguments).flatten().slice(1);
144+
var phases = [].slice.call(arguments).flat(Infinity).slice(1);
145145
return Cycle.get(name).check(phases);
146146
}
147147
},
@@ -256,7 +256,7 @@
256256
return this.increment;
257257
},
258258
check : function () {
259-
var phases = [].slice.call(arguments).flatten();
259+
var phases = [].slice.call(arguments).flat(Infinity);
260260
return phases.includes(this.current());
261261
}
262262
});
@@ -317,7 +317,7 @@
317317
// render the payload tags' args as cycles
318318
var phases = this.payload.slice(1).map( function (pl) {
319319
return _payloadMapper(pl);
320-
}).flatten();
320+
}).flat(Infinity);
321321

322322
if (phases.includes(null)) {
323323
// throw on junk phases

scripts/dialog-api-macro-set.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Macro.add('dialog', {
1111
var errors = [];
1212
var content = '', onOpen = null, onClose = null;
1313
var title = (this.args.length > 0) ? this.args[0] : '';
14-
var classes = (this.args.length > 1) ? this.args.slice(1).flatten() : [];
14+
var classes = (this.args.length > 1) ? this.args.slice(1).flat(Infinity) : [];
1515

1616
this.payload.forEach( function (pl, idx) {
1717
if (idx === 0) {
@@ -66,7 +66,7 @@ Macro.add('popup', {
6666
// passage name and title
6767
var psg = this.args[0];
6868
var title = (this.args.length > 1) ? this.args[1] : '';
69-
var classes = (this.args.length > 2) ? this.args.slice(2).flatten() : [];
69+
var classes = (this.args.length > 2) ? this.args.slice(2).flat(Infinity) : [];
7070

7171
// add the macro- class
7272
classes.push('macro-' + this.name);

0 commit comments

Comments
 (0)