Skip to content
Snippets Groups Projects
Commit 007ef18c authored by Pregmodder's avatar Pregmodder
Browse files

Merge branch 'pregmod-dev' into 'pregmod-master'

Pregmod v2.0.0

See merge request !3453
parents 3343df34 1cce26c7
No related branches found
No related tags found
1 merge request!3453Pregmod v2.0.0
{ {
"browser": true, "browser": true,
"devel": true,
"jquery": true,
"esversion": 6, "esversion": 6,
"eqeqeq": true, "eqeqeq": true,
"nocomma": true, "nocomma": true,
"undef": true, "undef": true,
"maxerr": 150 "maxerr": 150,
"unused": true,
"globals": {
"SugarCube": false,
"Config": false,
"State": false,
"Story": false,
"settings": false,
"setup": false,
"prehistory": true,
"predisplay": true,
"prerender": true,
"postrender": true,
"postdisplay": true
}
} }
Pregmod Pregmod
0.10.7.1-2.0.x
01/28/2019
0
-core sugarcube changes (now built from source)
0.10.7.1-1.7.x 0.10.7.1-1.7.x
01/28/2019 01/28/2019
......
diff -r cd5d732c8669 src/lib/jquery-plugins.js
--- a/src/lib/jquery-plugins.js Fri Mar 09 07:43:39 2018 -0600
+++ b/src/lib/jquery-plugins.js Fri Jan 25 18:37:15 2019 +0100
@@ -37,6 +37,10 @@
return function () {
const $this = jQuery(this);
+ 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]')) {
$this.attr('aria-pressed', $this.attr('aria-pressed') === 'true' ? 'false' : 'true');
@@ -44,6 +48,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 cd5d732c8669 src/lib/simplestore/adapters/webstorage.js
--- a/src/lib/simplestore/adapters/webstorage.js Fri Mar 09 07:43:39 2018 -0600
+++ b/src/lib/simplestore/adapters/webstorage.js Fri Jan 25 18:37:15 2019 +0100
@@ -192,11 +192,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 cd5d732c8669 src/state.js
--- a/src/state.js Fri Mar 09 07:43:39 2018 -0600
+++ b/src/state.js Fri Jan 25 18:37:15 2019 +0100
@@ -104,7 +104,7 @@
}
if (_expired.length > 0) {
- stateObj.expired = [..._expired];
+ stateObj.expired = [];
}
if (_prng !== null) {
diff -r cd5d732c8669 src/ui.js
--- a/src/ui.js Fri Mar 09 07:43:39 2018 -0600
+++ b/src/ui.js Fri Jan 25 18:37:15 2019 +0100
@@ -337,6 +337,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
--- 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));
})
Source diff could not be displayed: it is too large. Options to address this: view the blob.
########################################################################################################################
#
# sugarcube-2.py
#
# Copyright (c) 2013-2018 Thomas Michael Edwards <thomasmedwards@gmail.com>. All rights reserved.
# Use of this source code is governed by a BSD 2-clause "Simplified" License, which may be found in the LICENSE file.
#
########################################################################################################################
import os, os.path, header
from collections import OrderedDict
class Header (header.Header):
def filesToEmbed(self):
userLibPath = self.path + os.sep + 'userlib.js'
if os.path.isfile(userLibPath):
return OrderedDict([
('"USER_LIB"', userLibPath)
])
else:
return OrderedDict()
def storySettings(self):
return "SugarCube 2.x does not support the StorySettings special passage.\n\nInstead, you should use its configuration object, config.\n See: http://www.motoslave.net/sugarcube/2/docs/config-object.html"
def isEndTag(self, name, tag):
return (name == ('/' + tag) or name == ('end' + tag))
def nestedMacros(self):
return [
# standard macros
'append',
'button',
'capture',
'createplaylist',
'for',
'if',
'link',
'linkappend',
'linkprepend',
'linkreplace',
'nobr',
'prepend',
'repeat',
'replace',
'script',
'switch',
'silently',
'timed',
'widget',
# deprecated macros
'click'
]
def passageTitleColor(self, passage):
additionalSpecialPassages = [
'PassageDone',
'PassageFooter',
'PassageHeader',
'PassageReady',
'StoryBanner',
'StoryCaption',
'StoryInterface',
'StoryShare'
]
if passage.isStylesheet():
return ((111, 49, 83), (234, 123, 184))
elif passage.isScript():
return ((89, 66, 28), (226, 170, 80))
elif ('widget' in passage.tags):
return ((80, 106, 26), (134, 178, 44))
elif passage.isInfoPassage() or (passage.title in additionalSpecialPassages):
return ((28, 89, 74), (41, 214, 113))
elif passage.title == 'Start':
return ('#4ca333', '#4bdb24')
def passageChecks(self):
return super(Header, self).passageChecks()
:: StorySettings
ifid:18dfc483-910e-4d3b-ac31-71ae10c5015a
:: Start [nobr] :: Start [nobr]
......
...@@ -469,7 +469,8 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { ...@@ -469,7 +469,8 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) {
</div> </div>
<<run updateFamilyTree($activeSlave, $slaves, $PC)>> <<run updateFamilyTree($activeSlave, $slaves, $PC)>>
<script>updateFamilyTree()</script> html_script_tag updateFamilyTree() end_html_script_tag
// tweego freaks out if the actual end of script tag is used even inside a comment
If you want to update the tree, just re-call the run line. If you want to update the tree, just re-call the run line.
If there's no active slave, you can do: If there's no active slave, you can do:
......
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