kopia lustrzana https://github.com/backface/turtlestitch
Fixed #47
rodzic
15718f44a3
commit
8342c06e27
|
@ -5629,7 +5629,7 @@ InputSlotMorph.prototype.dropDownMenu = function () {
|
||||||
}
|
}
|
||||||
menu.addItem(' ', null);
|
menu.addItem(' ', null);
|
||||||
for (key in choices) {
|
for (key in choices) {
|
||||||
if (choices.hasOwnProperty(key)) {
|
if (Object.prototype.hasOwnProperty.call(choices, key)) {
|
||||||
if (key[0] === '~') {
|
if (key[0] === '~') {
|
||||||
menu.addLine();
|
menu.addLine();
|
||||||
} else {
|
} else {
|
||||||
|
|
4
gui.js
4
gui.js
|
@ -2079,7 +2079,7 @@ IDE_Morph.prototype.aboutSnap = function () {
|
||||||
+ '\nJoe Otto: Morphic Testing and Debugging';
|
+ '\nJoe Otto: Morphic Testing and Debugging';
|
||||||
|
|
||||||
for (module in modules) {
|
for (module in modules) {
|
||||||
if (modules.hasOwnProperty(module)) {
|
if (Object.prototype.hasOwnProperty.call(modules, module)) {
|
||||||
versions += ('\n' + module + ' (' +
|
versions += ('\n' + module + ' (' +
|
||||||
modules[module] + ')');
|
modules[module] + ')');
|
||||||
}
|
}
|
||||||
|
@ -3814,7 +3814,7 @@ ProjectDialogMorph.prototype.getLocalProjectList = function () {
|
||||||
var stored, name, dta,
|
var stored, name, dta,
|
||||||
projects = [];
|
projects = [];
|
||||||
for (stored in localStorage) {
|
for (stored in localStorage) {
|
||||||
if (localStorage.hasOwnProperty(stored)
|
if (Object.prototype.hasOwnProperty.call(localStorage, stored)
|
||||||
&& stored.substr(0, 14) === '-snap-project-') {
|
&& stored.substr(0, 14) === '-snap-project-') {
|
||||||
name = stored.substr(14);
|
name = stored.substr(14);
|
||||||
dta = {
|
dta = {
|
||||||
|
|
10
locale.js
10
locale.js
|
@ -61,13 +61,16 @@ function Localizer(language, dict) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Localizer.prototype.translate = function (string) {
|
Localizer.prototype.translate = function (string) {
|
||||||
return this.dict[this.language][string] || string;
|
return Object.prototype.hasOwnProperty.call(
|
||||||
|
this.dict[this.language],
|
||||||
|
string
|
||||||
|
) ? this.dict[this.language][string] || string;
|
||||||
};
|
};
|
||||||
|
|
||||||
Localizer.prototype.languages = function () {
|
Localizer.prototype.languages = function () {
|
||||||
var property, arr = [];
|
var property, arr = [];
|
||||||
for (property in this.dict) {
|
for (property in this.dict) {
|
||||||
if (this.dict.hasOwnProperty(property)) {
|
if (Object.prototype.hasOwnProperty.call(this.dict, property)) {
|
||||||
arr.push(property);
|
arr.push(property);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +103,8 @@ Localizer.prototype.unload = function () {
|
||||||
if (lang !== 'en') {
|
if (lang !== 'en') {
|
||||||
dict = myself.dict[lang];
|
dict = myself.dict[lang];
|
||||||
for (key in dict) {
|
for (key in dict) {
|
||||||
if (dict.hasOwnProperty(key) && !contains(keep, key)) {
|
if (Object.prototype.hasOwnProperty.call(dict, key)
|
||||||
|
&& !contains(keep, key)) {
|
||||||
delete dict[key];
|
delete dict[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
morphic.js
16
morphic.js
|
@ -1114,7 +1114,7 @@ function sizeOf(object) {
|
||||||
// answer the number of own properties
|
// answer the number of own properties
|
||||||
var size = 0, key;
|
var size = 0, key;
|
||||||
for (key in object) {
|
for (key in object) {
|
||||||
if (object.hasOwnProperty(key)) {
|
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
||||||
size += 1;
|
size += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1251,7 +1251,7 @@ function copy(target) {
|
||||||
target.constructor !== Object) {
|
target.constructor !== Object) {
|
||||||
c = clone(target.constructor.prototype);
|
c = clone(target.constructor.prototype);
|
||||||
for (property in target) {
|
for (property in target) {
|
||||||
if (target.hasOwnProperty(property)) {
|
if (Object.prototype.hasOwnProperty.call(target, property)) {
|
||||||
c[property] = target[property];
|
c[property] = target[property];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6202,7 +6202,10 @@ InspectorMorph.prototype.buildPanes = function () {
|
||||||
[ // format element: [color, predicate(element]
|
[ // format element: [color, predicate(element]
|
||||||
new Color(0, 0, 180),
|
new Color(0, 0, 180),
|
||||||
function (element) {
|
function (element) {
|
||||||
return myself.target.hasOwnProperty(element);
|
return Object.prototype.hasOwnProperty.call(
|
||||||
|
myself.target,
|
||||||
|
element
|
||||||
|
);
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
@ -9579,7 +9582,10 @@ HandMorph.prototype.processMouseScroll = function (event) {
|
||||||
if (morph) {
|
if (morph) {
|
||||||
morph.mouseScroll(
|
morph.mouseScroll(
|
||||||
(event.detail / -3) || (
|
(event.detail / -3) || (
|
||||||
event.hasOwnProperty('wheelDeltaY') ?
|
Object.prototype.hasOwnProperty.call(
|
||||||
|
event,
|
||||||
|
'wheelDeltaY'
|
||||||
|
) ?
|
||||||
event.wheelDeltaY / 120 :
|
event.wheelDeltaY / 120 :
|
||||||
event.wheelDelta / 120
|
event.wheelDelta / 120
|
||||||
),
|
),
|
||||||
|
@ -10499,7 +10505,7 @@ WorldMorph.prototype.about = function () {
|
||||||
var versions = '', module;
|
var versions = '', module;
|
||||||
|
|
||||||
for (module in modules) {
|
for (module in modules) {
|
||||||
if (modules.hasOwnProperty(module)) {
|
if (Object.prototype.hasOwnProperty.call(modules, module)) {
|
||||||
versions += ('\n' + module + ' (' + modules[module] + ')');
|
versions += ('\n' + module + ' (' + modules[module] + ')');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
77
store.js
77
store.js
|
@ -319,7 +319,8 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) {
|
||||||
if (!project.name) {
|
if (!project.name) {
|
||||||
nameID = 1;
|
nameID = 1;
|
||||||
while (
|
while (
|
||||||
localStorage.hasOwnProperty(
|
Object.prototype.hasOwnProperty.call(
|
||||||
|
localStorage,
|
||||||
'-snap-project-Untitled ' + nameID
|
'-snap-project-Untitled ' + nameID
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
@ -339,7 +340,10 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) {
|
||||||
model.stage = model.project.require('stage');
|
model.stage = model.project.require('stage');
|
||||||
StageMorph.prototype.frameRate = 0;
|
StageMorph.prototype.frameRate = 0;
|
||||||
project.stage = new StageMorph(project.globalVariables);
|
project.stage = new StageMorph(project.globalVariables);
|
||||||
if (model.stage.attributes.hasOwnProperty('id')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.stage.attributes,
|
||||||
|
'id'
|
||||||
|
)) {
|
||||||
this.objects[model.stage.attributes.id] = project.stage;
|
this.objects[model.stage.attributes.id] = project.stage;
|
||||||
}
|
}
|
||||||
if (model.stage.attributes.name) {
|
if (model.stage.attributes.name) {
|
||||||
|
@ -399,17 +403,24 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode) {
|
||||||
var watcher, color, target, hidden, extX, extY;
|
var watcher, color, target, hidden, extX, extY;
|
||||||
|
|
||||||
color = myself.loadColor(model.attributes.color);
|
color = myself.loadColor(model.attributes.color);
|
||||||
target = model.attributes.hasOwnProperty('scope') ?
|
target = Object.prototype.hasOwnProperty.call(
|
||||||
project.sprites[model.attributes.scope] : null;
|
model.attributes,
|
||||||
|
'scope'
|
||||||
|
) ? project.sprites[model.attributes.scope] : null;
|
||||||
|
|
||||||
// determine whether the watcher is hidden, slightly
|
// determine whether the watcher is hidden, slightly
|
||||||
// complicated to retain backward compatibility
|
// complicated to retain backward compatibility
|
||||||
// with former tag format: hidden="hidden"
|
// with former tag format: hidden="hidden"
|
||||||
// now it's: hidden="true"
|
// now it's: hidden="true"
|
||||||
hidden = model.attributes.hasOwnProperty('hidden')
|
hidden = Object.prototype.hasOwnProperty.call(
|
||||||
&& (model.attributes.hidden !== 'false');
|
model.attributes,
|
||||||
|
'hidden'
|
||||||
|
) && (model.attributes.hidden !== 'false');
|
||||||
|
|
||||||
if (model.attributes.hasOwnProperty('var')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'var'
|
||||||
|
)) {
|
||||||
watcher = new WatcherMorph(
|
watcher = new WatcherMorph(
|
||||||
model.attributes['var'],
|
model.attributes['var'],
|
||||||
color,
|
color,
|
||||||
|
@ -584,7 +595,10 @@ SnapSerializer.prototype.loadCostumes = function (object, model) {
|
||||||
if (costumes) {
|
if (costumes) {
|
||||||
object.costumes = this.loadValue(costumes.require('list'));
|
object.costumes = this.loadValue(costumes.require('list'));
|
||||||
}
|
}
|
||||||
if (model.attributes.hasOwnProperty('costume')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'costume'
|
||||||
|
)) {
|
||||||
costume = object.costumes.asArray()[model.attributes.costume - 1];
|
costume = object.costumes.asArray()[model.attributes.costume - 1];
|
||||||
if (costume) {
|
if (costume) {
|
||||||
if (costume.loaded) {
|
if (costume.loaded) {
|
||||||
|
@ -807,7 +821,10 @@ SnapSerializer.prototype.loadBlock = function (model, isReporter) {
|
||||||
// private
|
// private
|
||||||
var block, info, inputs, isGlobal, rm, receiver;
|
var block, info, inputs, isGlobal, rm, receiver;
|
||||||
if (model.tag === 'block') {
|
if (model.tag === 'block') {
|
||||||
if (model.attributes.hasOwnProperty('var')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'var'
|
||||||
|
)) {
|
||||||
return SpriteMorph.prototype.variableBlock(
|
return SpriteMorph.prototype.variableBlock(
|
||||||
model.attributes['var']
|
model.attributes['var']
|
||||||
);
|
);
|
||||||
|
@ -930,19 +947,28 @@ SnapSerializer.prototype.loadValue = function (model) {
|
||||||
myself = this;
|
myself = this;
|
||||||
|
|
||||||
function record() {
|
function record() {
|
||||||
if (model.attributes.hasOwnProperty('id')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'id'
|
||||||
|
)) {
|
||||||
myself.objects[model.attributes.id] = v;
|
myself.objects[model.attributes.id] = v;
|
||||||
}
|
}
|
||||||
if (model.attributes.hasOwnProperty('mediaID')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'mediaID'
|
||||||
|
)) {
|
||||||
myself.mediaDict[model.attributes.mediaID] = v;
|
myself.mediaDict[model.attributes.mediaID] = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (model.tag) {
|
switch (model.tag) {
|
||||||
case 'ref':
|
case 'ref':
|
||||||
if (model.attributes.hasOwnProperty('id')) {
|
if (Object.prototype.hasOwnProperty.call(model.attributes, 'id')) {
|
||||||
return this.objects[model.attributes.id];
|
return this.objects[model.attributes.id];
|
||||||
}
|
}
|
||||||
if (model.attributes.hasOwnProperty('mediaID')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'mediaID'
|
||||||
|
)) {
|
||||||
return this.mediaDict[model.attributes.mediaID];
|
return this.mediaDict[model.attributes.mediaID];
|
||||||
}
|
}
|
||||||
throw new Error('expecting a reference id');
|
throw new Error('expecting a reference id');
|
||||||
|
@ -1060,16 +1086,28 @@ SnapSerializer.prototype.loadValue = function (model) {
|
||||||
return v;
|
return v;
|
||||||
case 'costume':
|
case 'costume':
|
||||||
center = new Point();
|
center = new Point();
|
||||||
if (model.attributes.hasOwnProperty('center-x')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'center-x'
|
||||||
|
)) {
|
||||||
center.x = parseFloat(model.attributes['center-x']);
|
center.x = parseFloat(model.attributes['center-x']);
|
||||||
}
|
}
|
||||||
if (model.attributes.hasOwnProperty('center-y')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'center-y'
|
||||||
|
)) {
|
||||||
center.y = parseFloat(model.attributes['center-y']);
|
center.y = parseFloat(model.attributes['center-y']);
|
||||||
}
|
}
|
||||||
if (model.attributes.hasOwnProperty('name')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'name'
|
||||||
|
)) {
|
||||||
name = model.attributes.name;
|
name = model.attributes.name;
|
||||||
}
|
}
|
||||||
if (model.attributes.hasOwnProperty('image')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'image'
|
||||||
|
)) {
|
||||||
image = new Image();
|
image = new Image();
|
||||||
if (model.attributes.image.indexOf('data:image/svg+xml') === 0
|
if (model.attributes.image.indexOf('data:image/svg+xml') === 0
|
||||||
&& !MorphicPreferences.rasterizeSVGs) {
|
&& !MorphicPreferences.rasterizeSVGs) {
|
||||||
|
@ -1108,7 +1146,10 @@ SnapSerializer.prototype.loadValue = function (model) {
|
||||||
audio = new Audio();
|
audio = new Audio();
|
||||||
audio.src = model.attributes.sound;
|
audio.src = model.attributes.sound;
|
||||||
v = new Sound(audio, model.attributes.name);
|
v = new Sound(audio, model.attributes.name);
|
||||||
if (model.attributes.hasOwnProperty('mediaID')) {
|
if (Object.prototype.hasOwnProperty.call(
|
||||||
|
model.attributes,
|
||||||
|
'mediaID'
|
||||||
|
)) {
|
||||||
myself.mediaDict[model.attributes.mediaID] = v;
|
myself.mediaDict[model.attributes.mediaID] = v;
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
|
10
threads.js
10
threads.js
|
@ -1821,10 +1821,10 @@ Process.prototype.reportIsIdentical = function (a, b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
if (a.hasOwnProperty(tag)) {
|
if (Object.prototype.hasOwnProperty.call(a, tag)) {
|
||||||
delete a[tag];
|
delete a[tag];
|
||||||
}
|
}
|
||||||
if (b.hasOwnProperty(tag)) {
|
if (Object.prototype.hasOwnProperty.call(b, tag)) {
|
||||||
delete b[tag];
|
delete b[tag];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2710,7 +2710,7 @@ VariableFrame.prototype.deleteVar = function (name) {
|
||||||
VariableFrame.prototype.names = function () {
|
VariableFrame.prototype.names = function () {
|
||||||
var each, names = [];
|
var each, names = [];
|
||||||
for (each in this.vars) {
|
for (each in this.vars) {
|
||||||
if (this.vars.hasOwnProperty(each)) {
|
if (Object.prototype.hasOwnProperty.call(this.vars, each)) {
|
||||||
names.push(each);
|
names.push(each);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2723,7 +2723,7 @@ VariableFrame.prototype.allNamesDict = function () {
|
||||||
function addKeysToDict(srcDict, trgtDict) {
|
function addKeysToDict(srcDict, trgtDict) {
|
||||||
var eachKey;
|
var eachKey;
|
||||||
for (eachKey in srcDict) {
|
for (eachKey in srcDict) {
|
||||||
if (srcDict.hasOwnProperty(eachKey)) {
|
if (Object.prototype.hasOwnProperty.call(srcDict, eachKey)) {
|
||||||
trgtDict[eachKey] = eachKey;
|
trgtDict[eachKey] = eachKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2744,7 +2744,7 @@ VariableFrame.prototype.allNames = function () {
|
||||||
var answer = [], each, dict = this.allNamesDict();
|
var answer = [], each, dict = this.allNamesDict();
|
||||||
|
|
||||||
for (each in dict) {
|
for (each in dict) {
|
||||||
if (dict.hasOwnProperty(each)) {
|
if (Object.prototype.hasOwnProperty.call(dict, each)) {
|
||||||
answer.push(each);
|
answer.push(each);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2776,7 +2776,7 @@ InputFieldMorph.prototype.dropDownMenu = function () {
|
||||||
}
|
}
|
||||||
menu.addItem(' ', null);
|
menu.addItem(' ', null);
|
||||||
for (key in choices) {
|
for (key in choices) {
|
||||||
if (choices.hasOwnProperty(key)) {
|
if (Object.prototype.hasOwnProperty.call(choices, key)) {
|
||||||
if (key[0] === '~') {
|
if (key[0] === '~') {
|
||||||
menu.addLine();
|
menu.addLine();
|
||||||
} else {
|
} else {
|
||||||
|
|
3
xml.js
3
xml.js
|
@ -246,7 +246,8 @@ XML_Element.prototype.toString = function (isFormatted, indentationLevel) {
|
||||||
|
|
||||||
// attributes, if any
|
// attributes, if any
|
||||||
for (key in this.attributes) {
|
for (key in this.attributes) {
|
||||||
if (this.attributes.hasOwnProperty(key) && this.attributes[key]) {
|
if (Object.prototype.hasOwnProperty.call(this.attributes, key)
|
||||||
|
&& this.attributes[key]) {
|
||||||
result += ' ' + key + '="' + this.attributes[key] + '"';
|
result += ' ' + key + '="' + this.attributes[key] + '"';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue