Skip to content

Commit

Permalink
v2.11.1
Browse files Browse the repository at this point in the history
replace array#flatten() with array#flat()

update for SC 2.37 compatibility

update demo to latest SC version
  • Loading branch information
ChapelR committed Jul 22, 2024
1 parent 336675f commit 6610a6e
Show file tree
Hide file tree
Showing 37 changed files with 123 additions and 100 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files.exclude": {
"**/node_modules": true,
"scripts/minified": true
}
}
7 changes: 7 additions & 0 deletions cmfsc2.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"folders": [
{
"path": ".",
}
]
}
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Chapel's Custom Macro Collection (v2.11.0)
## Chapel's Custom Macro Collection (v2.11.1)

- [Try the demo!](https://macros.twinelab.net/demo) ([Sausage](https://github.com/ChapelR/custom-macros-demo))
- [Downloads](https://macros.twinelab.net/download)
Expand Down
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

### July 22, 2024 (v2.11.1)

- **[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!

### February 20, 2024 (v2.11.0)

- **[Retired]** Removed Simple Inventory 2 in favor of [Simple Inventory 3](https://inventory.twinelab.net/).
Expand Down
104 changes: 55 additions & 49 deletions docs/demo/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-macros-for-sugarcube-2",
"version": "2.9.0",
"version": "2.11.1",
"description": "Collection of custom macros and systems for Twine/SugarCube2.",
"main": "build.js",
"directories": {
Expand Down
4 changes: 2 additions & 2 deletions scripts/continue.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
if (State.length > 0) {
return false;
}
var args = [].slice.call(arguments).flatten();
var args = [].slice.call(arguments).flat(Infinity);
ignored = ignored.concat(args);
return true;
}
Expand Down Expand Up @@ -56,7 +56,7 @@
}

function reset () {
var args = [].slice.call(arguments).flatten();
var args = [].slice.call(arguments).flat(Infinity);
ignored = ignored.concat(args);
$(document).off('.continue-macro');
ignoreMe();
Expand Down
2 changes: 1 addition & 1 deletion scripts/css-macro.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

function cssChanger (/*element, args...*/) {
try {
var args = [].slice.call(arguments).flatten(),
var args = [].slice.call(arguments).flat(Infinity),
$el = args.shift(),
map;
if (typeof args[0] === 'string') {
Expand Down
8 changes: 4 additions & 4 deletions scripts/cycles.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
if (pl.args.length < 1) {
return null;
}
var phases = pl.args.flatten();
var phases = pl.args.flat(Infinity);
if (!phases.every(function (ph) {
return typeof ph === 'string';
})) {
Expand Down Expand Up @@ -141,7 +141,7 @@
},
check : function (name) {
if (Cycle.has(name)) {
var phases = [].slice.call(arguments).flatten().slice(1);
var phases = [].slice.call(arguments).flat(Infinity).slice(1);
return Cycle.get(name).check(phases);
}
},
Expand Down Expand Up @@ -256,7 +256,7 @@
return this.increment;
},
check : function () {
var phases = [].slice.call(arguments).flatten();
var phases = [].slice.call(arguments).flat(Infinity);
return phases.includes(this.current());
}
});
Expand Down Expand Up @@ -317,7 +317,7 @@
// render the payload tags' args as cycles
var phases = this.payload.slice(1).map( function (pl) {
return _payloadMapper(pl);
}).flatten();
}).flat(Infinity);

if (phases.includes(null)) {
// throw on junk phases
Expand Down
4 changes: 2 additions & 2 deletions scripts/dialog-api-macro-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Macro.add('dialog', {
var errors = [];
var content = '', onOpen = null, onClose = null;
var title = (this.args.length > 0) ? this.args[0] : '';
var classes = (this.args.length > 1) ? this.args.slice(1).flatten() : [];
var classes = (this.args.length > 1) ? this.args.slice(1).flat(Infinity) : [];

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

// add the macro- class
classes.push('macro-' + this.name);
Expand Down
2 changes: 1 addition & 1 deletion scripts/minified/articles.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scripts/minified/continue.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scripts/minified/css-macro.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6610a6e

Please sign in to comment.