Skip to content
Snippets Groups Projects
Commit 137af3a6 authored by ezsh's avatar ezsh
Browse files

Update SugarCube to 2.29.0

parent 7c23f602
No related branches found
No related tags found
1 merge request!4969Update SugarCube to 2.29.0
This diff is collapsed.
Source diff could not be displayed: it is too large. Options to address this: view the blob.
diff -r df721eb4cd55 src/lib/jquery-plugins.js
--- a/src/lib/jquery-plugins.js Sun Dec 16 04:39:00 2018 -0600
+++ b/src/lib/jquery-plugins.js Fri Jan 25 00:54:01 2019 +0100
@@ -43,14 +43,9 @@
return function () {
const $this = jQuery(this);
- // Exit if the element is disabled.
- //
- // NOTE: This should only be necessary for elements which are not disableable
- // per the HTML specification as disableable elements should be made inert
- // automatically.
- if ($this.ariaIsDisabled()) {
- return;
- }
+ const dataPassage = $this.attr('data-passage');
+ const initialDataPassage = window && window.SugarCube && window.SugarCube.State && window.SugarCube.State.passage;
+ const savedYOffset = window.pageYOffset;
// Toggle "aria-pressed" status, if the attribute exists.
if ($this.is('[aria-pressed]')) {
@@ -59,6 +54,11 @@
// Call the true handler.
fn.apply(this, arguments);
+
+ const doJump = function(){ window.scrollTo(0, savedYOffset); }
+ if ( dataPassage && (window.lastDataPassageLink === dataPassage || initialDataPassage === dataPassage))
+ doJump();
+ window.lastDataPassageLink = dataPassage;
};
}
diff -r df721eb4cd55 src/lib/simplestore/adapters/webstorage.js
--- a/src/lib/simplestore/adapters/webstorage.js Sun Dec 16 04:39:00 2018 -0600
+++ b/src/lib/simplestore/adapters/webstorage.js Fri Jan 25 00:54:01 2019 +0100
@@ -189,11 +189,11 @@
}
static _serialize(obj) {
- return LZString.compressToUTF16(JSON.stringify(obj));
+ return JSON.stringify(obj);
}
static _deserialize(str) {
- return JSON.parse(LZString.decompressFromUTF16(str));
+ return JSON.parse((!str || str[0] == "{") ? str : LZString.decompressFromUTF16(str));
}
}
diff -r df721eb4cd55 src/state.js
--- a/src/state.js Sun Dec 16 04:39:00 2018 -0600
+++ b/src/state.js Fri Jan 25 00:54:01 2019 +0100
@@ -104,7 +104,7 @@
}
if (_expired.length > 0) {
- stateObj.expired = [..._expired];
+ stateObj.expired = [];
}
if (_prng !== null) {
diff -r df721eb4cd55 src/ui.js
--- a/src/ui.js Sun Dec 16 04:39:00 2018 -0600
+++ b/src/ui.js Fri Jan 25 00:54:01 2019 +0100
@@ -334,6 +334,7 @@
if (saves.slots[i]) {
// Add the load button.
$tdLoad.append(
+ createButton('save', 'ui-close', L10n.get('savesLabelSave'), i, Save.slots.save),
createButton('load', 'ui-close', L10n.get('savesLabelLoad'), i, slot => {
jQuery(document).one(':dialogclose', () => Save.slots.load(slot));
})
diff -r df721eb4cd55 src/lib/jquery-plugins.js diff -r 3892fa22d6fa src/lib/jquery-plugins.js
--- a/src/lib/jquery-plugins.js Sun Dec 16 04:39:00 2018 -0600 --- a/src/lib/jquery-plugins.js Thu Jun 27 16:10:07 2019 -0500
+++ b/src/lib/jquery-plugins.js Fri Jan 25 00:54:01 2019 +0100 +++ b/src/lib/jquery-plugins.js Sun Jul 07 22:52:13 2019 +0200
@@ -43,14 +43,9 @@ @@ -43,14 +43,9 @@
return function () { return function () {
const $this = jQuery(this); const $this = jQuery(this);
- // Exit if the element is disabled. - // Exit if the element is disabled.
- // - //
- // NOTE: This should only be necessary for elements which are not disableable - // NOTE: This should only be necessary for elements which are not disableable
...@@ -16,58 +16,58 @@ diff -r df721eb4cd55 src/lib/jquery-plugins.js ...@@ -16,58 +16,58 @@ diff -r df721eb4cd55 src/lib/jquery-plugins.js
+ const dataPassage = $this.attr('data-passage'); + const dataPassage = $this.attr('data-passage');
+ const initialDataPassage = window && window.SugarCube && window.SugarCube.State && window.SugarCube.State.passage; + const initialDataPassage = window && window.SugarCube && window.SugarCube.State && window.SugarCube.State.passage;
+ const savedYOffset = window.pageYOffset; + const savedYOffset = window.pageYOffset;
// Toggle "aria-pressed" status, if the attribute exists. // Toggle "aria-pressed" status, if the attribute exists.
if ($this.is('[aria-pressed]')) { if ($this.is('[aria-pressed]')) {
@@ -59,6 +54,11 @@ @@ -59,6 +54,11 @@
// Call the true handler. // Call the true handler.
fn.apply(this, arguments); fn.apply(this, arguments);
+ +
+ const doJump = function(){ window.scrollTo(0, savedYOffset); } + const doJump = function(){ window.scrollTo(0, savedYOffset); }
+ if ( dataPassage && (window.lastDataPassageLink === dataPassage || initialDataPassage === dataPassage)) + if ( dataPassage && (window.lastDataPassageLink === dataPassage || initialDataPassage === dataPassage))
+ doJump(); + doJump();
+ window.lastDataPassageLink = dataPassage; + window.lastDataPassageLink = dataPassage;
}; };
} }
diff -r df721eb4cd55 src/lib/simplestore/adapters/webstorage.js diff -r 3892fa22d6fa src/lib/simplestore/adapters/webstorage.js
--- a/src/lib/simplestore/adapters/webstorage.js Sun Dec 16 04:39:00 2018 -0600 --- a/src/lib/simplestore/adapters/webstorage.js Thu Jun 27 16:10:07 2019 -0500
+++ b/src/lib/simplestore/adapters/webstorage.js Fri Jan 25 00:54:01 2019 +0100 +++ b/src/lib/simplestore/adapters/webstorage.js Sun Jul 07 22:52:13 2019 +0200
@@ -189,11 +189,11 @@ @@ -189,11 +189,11 @@
} }
static _serialize(obj) { static _serialize(obj) {
- return LZString.compressToUTF16(JSON.stringify(obj)); - return LZString.compressToUTF16(JSON.stringify(obj));
+ return JSON.stringify(obj); + return JSON.stringify(obj);
} }
static _deserialize(str) { static _deserialize(str) {
- return JSON.parse(LZString.decompressFromUTF16(str)); - return JSON.parse(LZString.decompressFromUTF16(str));
+ return JSON.parse((!str || str[0] == "{") ? str : LZString.decompressFromUTF16(str)); + return JSON.parse((!str || str[0] == "{") ? str : LZString.decompressFromUTF16(str));
} }
} }
diff -r df721eb4cd55 src/state.js diff -r 3892fa22d6fa src/state.js
--- a/src/state.js Sun Dec 16 04:39:00 2018 -0600 --- a/src/state.js Thu Jun 27 16:10:07 2019 -0500
+++ b/src/state.js Fri Jan 25 00:54:01 2019 +0100 +++ b/src/state.js Sun Jul 07 22:52:13 2019 +0200
@@ -104,7 +104,7 @@ @@ -104,7 +104,7 @@
} }
if (_expired.length > 0) { if (_expired.length > 0) {
- stateObj.expired = [..._expired]; - stateObj.expired = [..._expired];
+ stateObj.expired = []; + stateObj.expired = [];
} }
if (_prng !== null) { if (_prng !== null) {
diff -r df721eb4cd55 src/ui.js diff -r 3892fa22d6fa src/ui.js
--- a/src/ui.js Sun Dec 16 04:39:00 2018 -0600 --- a/src/ui.js Thu Jun 27 16:10:07 2019 -0500
+++ b/src/ui.js Fri Jan 25 00:54:01 2019 +0100 +++ b/src/ui.js Sun Jul 07 22:52:13 2019 +0200
@@ -334,6 +334,7 @@ @@ -334,6 +334,7 @@
if (saves.slots[i]) { if (saves.slots[i]) {
// Add the load button. // Add the load button.
$tdLoad.append( $tdLoad.append(
+ createButton('save', 'ui-close', L10n.get('savesLabelSave'), i, Save.slots.save), + createButton('save', 'ui-close', L10n.get('savesLabelSave'), i, Save.slots.save),
createButton('load', 'ui-close', L10n.get('savesLabelLoad'), i, slot => { createButton('load', 'ui-close', L10n.get('savesLabelLoad'), i, slot => {
jQuery(document).one(':dialogclose', () => Save.slots.load(slot)); jQuery(document).one(':dialogclosed', () => Save.slots.load(slot));
}) })
Source diff could not be displayed: it is too large. Options to address this: view the blob.
../../../../devNotes/sugarcube stuff/2.29.0-format.js
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment