kopia lustrzana https://github.com/backface/turtlestitch
Porównaj commity
7 Commity
354d1fd7a8
...
bae5cfe357
Autor | SHA1 | Data |
---|---|---|
Michael Aschauer | bae5cfe357 | |
Michael Aschauer | 17963caf8c | |
Michael | 5e032b15c5 | |
Michael | 13a4348840 | |
Simon-Mong | ae54341037 | |
Simon-Mong | c39cc089f3 | |
Michael | 6b85025c94 |
|
@ -45,10 +45,10 @@
|
||||||
<script type="text/javascript" src="stitchcode/morphic.js?version=2021-12-14"></script>
|
<script type="text/javascript" src="stitchcode/morphic.js?version=2021-12-14"></script>
|
||||||
<script type="text/javascript" src="stitchcode/symbols.js?version=2021-12-14"></script>
|
<script type="text/javascript" src="stitchcode/symbols.js?version=2021-12-14"></script>
|
||||||
<script type="text/javascript" src="stitchcode/blocks.js?version=2021-12-14"></script>
|
<script type="text/javascript" src="stitchcode/blocks.js?version=2021-12-14"></script>
|
||||||
<script type="text/javascript" src="stitchcode/threads.js?version=2021-12-14"></script>
|
<script type="text/javascript" src="stitchcode/threads.js?version=2022-10-05"></script>
|
||||||
<script type="text/javascript" src="stitchcode/objects.js?version=2022-08-25-"></script>
|
<script type="text/javascript" src="stitchcode/objects.js?version=2022-10-05"></script>
|
||||||
<script type="text/javascript" src="stitchcode/turtlecloud.js?version=2022-06-14"></script>
|
<script type="text/javascript" src="stitchcode/turtlecloud.js?version=2022-10-05"></script>
|
||||||
<script type="text/javascript" src="stitchcode/gui.js?version=2022-08-25"></script>
|
<script type="text/javascript" src="stitchcode/gui.js?version=2022-10-05"></script>
|
||||||
<script type="text/javascript" src="stitchcode/store.js?version=2022-06-14"></script>
|
<script type="text/javascript" src="stitchcode/store.js?version=2022-06-14"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,4 @@
|
||||||
VERSION="2.7.8.2"
|
VERSION="2.7.9"
|
||||||
|
|
||||||
// get debug mode
|
// get debug mode
|
||||||
url = new URL(window.location.href);
|
url = new URL(window.location.href);
|
||||||
|
@ -270,13 +270,13 @@ IDE_Morph.prototype.newProject = function () {
|
||||||
var project = new Project();
|
var project = new Project();
|
||||||
|
|
||||||
project.addDefaultScene();
|
project.addDefaultScene();
|
||||||
|
|
||||||
this.source = this.cloud.username ? 'cloud' : null;
|
this.source = this.cloud.username ? 'cloud' : null;
|
||||||
if (location.hash.substr(0, 6) !== '#lang:') {
|
if (location.hash.substr(0, 6) !== '#lang:') {
|
||||||
location.hash = '';
|
location.hash = '';
|
||||||
}
|
}
|
||||||
this.openProject(project);
|
this.openProject(project);
|
||||||
|
|
||||||
StageMorph.prototype.dimensions = new Point(480, 360);
|
StageMorph.prototype.dimensions = new Point(480, 360);
|
||||||
StageMorph.prototype.hiddenPrimitives = {};
|
StageMorph.prototype.hiddenPrimitives = {};
|
||||||
StageMorph.prototype.codeMappings = {};
|
StageMorph.prototype.codeMappings = {};
|
||||||
|
@ -336,7 +336,7 @@ IDE_Morph.prototype.exportProject = function (name) {
|
||||||
project.origCreator = this.origCreator;
|
project.origCreator = this.origCreator;
|
||||||
project.creator = this.creator;
|
project.creator = this.creator;
|
||||||
project.remixHistory = this.remixHistory;
|
project.remixHistory = this.remixHistory;
|
||||||
|
|
||||||
str = this.serializer.serialize(
|
str = this.serializer.serialize(
|
||||||
project
|
project
|
||||||
);
|
);
|
||||||
|
@ -1625,16 +1625,16 @@ IDE_Morph.prototype.setProjectName = function (string) {
|
||||||
this.controlBar.updateLabel();
|
this.controlBar.updateLabel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.replace(/['"]/g, '') != this.projectName || SnapCloud.username != this.creator) {
|
if (string.replace(/['"]/g, '') != this.projectName || SnapCloud.username != this.creator) {
|
||||||
this.remixHistory = this.creator + ":" + this.projectName + ";" + this.remixHistory
|
this.remixHistory = this.creator + ":" + this.projectName + ";" + this.remixHistory
|
||||||
this.origName = this.projectName;
|
this.origName = this.projectName;
|
||||||
}
|
}
|
||||||
this.origName = this.projectName;
|
this.origName = this.projectName;
|
||||||
this.origCreator = SnapCloud.username != this.creator ? this.creator : SnapCloud.username;
|
this.origCreator = SnapCloud.username != this.creator ? this.creator : SnapCloud.username;
|
||||||
this.creator = SnapCloud.username ? SnapCloud.username : "anonymous";
|
this.creator = SnapCloud.username ? SnapCloud.username : "anonymous";
|
||||||
this.projectName = string.replace(/['"]/g, '');
|
this.projectName = string.replace(/['"]/g, '');
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2901,6 +2901,102 @@ DialogBoxMorph.prototype.informWithLink = function (
|
||||||
this.popUp(world);
|
this.popUp(world);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
|
||||||
|
this.projectList = pl[0] ? pl : [];
|
||||||
|
this.projectList.sort((x, y) =>
|
||||||
|
x.projectname.toLowerCase() < y.projectname.toLowerCase() ? -1 : 1
|
||||||
|
);
|
||||||
|
|
||||||
|
this.listField.destroy();
|
||||||
|
this.listField = new ListMorph(
|
||||||
|
this.projectList,
|
||||||
|
this.projectList.length > 0 ?
|
||||||
|
(element) => {return element.projectname || element; }
|
||||||
|
: null,
|
||||||
|
[ // format: display shared project names bold
|
||||||
|
[
|
||||||
|
'bold',
|
||||||
|
proj => proj.ispublic
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'italic',
|
||||||
|
proj => proj.ispublished
|
||||||
|
]
|
||||||
|
],
|
||||||
|
() => this.ok()
|
||||||
|
);
|
||||||
|
this.fixListFieldItemColors();
|
||||||
|
this.listField.fixLayout = nop;
|
||||||
|
this.listField.edge = InputFieldMorph.prototype.edge;
|
||||||
|
this.listField.fontSize = InputFieldMorph.prototype.fontSize;
|
||||||
|
this.listField.typeInPadding = InputFieldMorph.prototype.typeInPadding;
|
||||||
|
this.listField.contrast = InputFieldMorph.prototype.contrast;
|
||||||
|
this.listField.render = InputFieldMorph.prototype.render;
|
||||||
|
this.listField.drawRectBorder = InputFieldMorph.prototype.drawRectBorder;
|
||||||
|
|
||||||
|
this.listField.action = (item) => {
|
||||||
|
if (item === undefined) {return; }
|
||||||
|
if (this.nameField) {
|
||||||
|
this.nameField.setContents(item.projectname || '');
|
||||||
|
}
|
||||||
|
if (this.task === 'open' || this.task === 'add') {
|
||||||
|
this.notesText.text = item.notes || '';
|
||||||
|
this.notesText.rerender();
|
||||||
|
this.notesField.contents.adjustBounds();
|
||||||
|
this.preview.texture = '';
|
||||||
|
this.preview.rerender();
|
||||||
|
// we ask for the thumbnail when selecting a project
|
||||||
|
this.ide.cloud.getThumbnail(
|
||||||
|
null, // username is implicit
|
||||||
|
item.projectname,
|
||||||
|
thumbnail => {
|
||||||
|
this.preview.texture = thumbnail;
|
||||||
|
this.preview.cachedTexture = null;
|
||||||
|
this.preview.rerender();
|
||||||
|
});
|
||||||
|
new SpeechBubbleMorph(new TextMorph(
|
||||||
|
localize('last changed') + '\n' + item.updated + item.ispublic + item.Public,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
'center'
|
||||||
|
)).popUp(
|
||||||
|
this.world(),
|
||||||
|
this.preview.rightCenter().add(new Point(2, 0))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (item.ispublic) {
|
||||||
|
this.shareButton.hide();
|
||||||
|
this.unshareButton.show();
|
||||||
|
} else {
|
||||||
|
this.unshareButton.hide();
|
||||||
|
this.shareButton.show();
|
||||||
|
}
|
||||||
|
this.buttons.fixLayout();
|
||||||
|
this.fixLayout();
|
||||||
|
this.publishButton.hide();
|
||||||
|
this.edit();
|
||||||
|
|
||||||
|
};
|
||||||
|
this.body.add(this.listField);
|
||||||
|
if (this.task === 'open' || this.task === 'add') {
|
||||||
|
this.recoverButton.hide();
|
||||||
|
this.tagsField.hide();
|
||||||
|
this.tagsLabelField.hide();
|
||||||
|
this.unshareButton.hide();
|
||||||
|
this.shareButton.hide();
|
||||||
|
this.unpublishButton.hide();
|
||||||
|
}
|
||||||
|
this.deleteButton.show();
|
||||||
|
this.buttons.fixLayout();
|
||||||
|
this.fixLayout();
|
||||||
|
if (this.task === 'open' || this.task === 'add') {
|
||||||
|
this.clearDetails();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
|
ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
|
||||||
|
@ -2983,51 +3079,34 @@ ProjectDialogMorph.prototype.installCloudProjectList = function (pl) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
*/
|
||||||
ProjectDialogMorph.prototype.fixLayoutOrig = ProjectDialogMorph.prototype.fixLayout;
|
ProjectDialogMorph.prototype.fixLayoutOrig = ProjectDialogMorph.prototype.fixLayout;
|
||||||
ProjectDialogMorph.prototype.buildContentsOrig = ProjectDialogMorph.prototype.buildContents;
|
|
||||||
ProjectDialogMorph.prototype.initOrig = ProjectDialogMorph.prototype.init;
|
ProjectDialogMorph.prototype.initOrig = ProjectDialogMorph.prototype.init;
|
||||||
ProjectDialogMorph.prototype.saveProjectOrig = ProjectDialogMorph.prototype.saveProject;
|
ProjectDialogMorph.prototype.saveProjectOrig = ProjectDialogMorph.prototype.saveProject;
|
||||||
|
|
||||||
ProjectDialogMorph.prototype.buildContents = function () {
|
|
||||||
this.buildContentsOrig();
|
|
||||||
this.tagsLabelField = new TextMorph("Tags (New cloud projects only):");
|
|
||||||
this.body.add(this.tagsLabelField);
|
|
||||||
this.notesLabelField = new TextMorph("Notes");
|
|
||||||
this.notesLabelField.edge = InputFieldMorph.prototype.edge;
|
|
||||||
this.body.add(this.notesLabelField);
|
|
||||||
this.tagsField = new InputFieldMorph("");
|
|
||||||
this.tagsField.edge = InputFieldMorph.prototype.edge;
|
|
||||||
this.tagsField.contrast = InputFieldMorph.prototype.contrast;
|
|
||||||
// this.tagsField.fixLayout = InputFieldMorph.prototype.fixLayout;
|
|
||||||
this.body.add(this.tagsField);
|
|
||||||
this.fixLayout();
|
|
||||||
};
|
|
||||||
|
|
||||||
ProjectDialogMorph.prototype.fixLayout = function () {
|
ProjectDialogMorph.prototype.fixLayout = function () {
|
||||||
this.fixLayoutOrig();
|
this.fixLayoutOrig();
|
||||||
var th = fontHeight(this.titleFontSize) + this.titlePadding * 2,
|
var th = fontHeight(this.titleFontSize) + this.titlePadding * 2,
|
||||||
thin = this.padding / 2,
|
thin = this.padding / 2,
|
||||||
oldFlag = Morph.prototype.trackChanges;
|
oldFlag = Morph.prototype.trackChanges;
|
||||||
|
|
||||||
if (this.body && this.tagsField) {
|
if (this.preview) {
|
||||||
this.notesLabelField.setTop(this.preview.bottom() + thin);
|
this.preview.setHeight(310);
|
||||||
this.notesLabelField.setLeft(this.preview.left() + 1);
|
}
|
||||||
|
if (this.body && this.tagsField) {
|
||||||
this.notesField.setTop(this.notesLabelField.bottom());
|
this.notesLabelField.setTop(this.preview.bottom() + thin);
|
||||||
this.notesField.setLeft(this.preview.left());
|
this.notesLabelField.setLeft(this.preview.left() + 1);
|
||||||
this.notesField.setHeight(this.body.bottom() - this.notesLabelField.bottom() - this.notesLabelField.height() - thin);
|
this.notesField.setTop(this.notesLabelField.bottom());
|
||||||
|
this.notesField.setLeft(this.preview.left());
|
||||||
this.tagsLabelField.setTop(this.notesField.bottom() + thin);
|
this.notesField.setHeight(this.body.bottom() - this.notesLabelField.bottom() - this.notesLabelField.height() - thin);
|
||||||
this.tagsLabelField.setLeft(this.notesField.left() + 1);
|
this.tagsLabelField.setTop(this.notesField.bottom() + thin);
|
||||||
|
this.tagsLabelField.setLeft(this.notesField.left() + 1);
|
||||||
this.tagsField.setTop(this.notesField.bottom() + 2);
|
this.tagsField.setTop(this.notesField.bottom() + 2);
|
||||||
this.tagsField.setLeft(this.tagsLabelField.right());
|
this.tagsField.setLeft(this.tagsLabelField.right());
|
||||||
this.tagsField.setWidth(this.notesField.width() - this.tagsLabelField.width() - 1);
|
this.tagsField.setWidth(this.notesField.width() - this.tagsLabelField.width() - 1);
|
||||||
|
}
|
||||||
|
this.changed();
|
||||||
}
|
|
||||||
this.changed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3042,6 +3121,7 @@ ProjectDialogMorph.prototype.saveProject = function () {
|
||||||
this.saveProjectOrig();
|
this.saveProjectOrig();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
StageMorph.prototype.backgroundColor = new Color(255,255,255);
|
StageMorph.prototype.backgroundColor = new Color(255,255,255);
|
||||||
StageMorph.prototype.defaultPenColor = new Color(0,0,0,1);
|
StageMorph.prototype.defaultPenColor = new Color(0,0,0,1);
|
||||||
|
|
||||||
|
@ -3270,9 +3350,9 @@ IDE_Morph.prototype.switchToScene = function (
|
||||||
this.selectSprite(this.scene.currentSprite, true);
|
this.selectSprite(this.scene.currentSprite, true);
|
||||||
// this.corral.album.updateSelection();
|
// this.corral.album.updateSelection();
|
||||||
this.fixLayout();
|
this.fixLayout();
|
||||||
|
|
||||||
scene.applyGlobalSettings();
|
scene.applyGlobalSettings();
|
||||||
|
|
||||||
this.toggleAppMode(appMode);
|
this.toggleAppMode(appMode);
|
||||||
this.controlBar.stopButton.refresh();
|
this.controlBar.stopButton.refresh();
|
||||||
this.world().keyboardFocus = this.stage;
|
this.world().keyboardFocus = this.stage;
|
||||||
|
|
|
@ -56,16 +56,16 @@ Project.prototype.toXML = function (serializer) {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
thumbdata = null;
|
thumbdata = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return serializer.format(
|
return serializer.format(
|
||||||
'<project name="@" app="@" version="@">' +
|
'<project name="@" app="@" version="@">' +
|
||||||
'<notes>$</notes>' +
|
'<notes>$</notes>' +
|
||||||
'<thumbnail>$</thumbnail>' +
|
'<thumbnail>$</thumbnail>' +
|
||||||
'<scenes select="@">%</scenes>\n' +
|
'<scenes select="@">%</scenes>\n' +
|
||||||
'<creator>$</creator>\n' +
|
'<creator>$</creator>\n' +
|
||||||
'<origCreator>$</origCreator>\n' +
|
'<origCreator>$</origCreator>\n' +
|
||||||
'<origName>$</origName>\n' +
|
'<origName>$</origName>\n' +
|
||||||
'<remixHistory>$</remixHistory>\n' +
|
'<remixHistory>$</remixHistory>\n' +
|
||||||
'</project>',
|
'</project>',
|
||||||
this.name || localize('Untitled'),
|
this.name || localize('Untitled'),
|
||||||
serializer.app,
|
serializer.app,
|
||||||
|
@ -98,8 +98,8 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode, ide, remixID) {
|
||||||
'\n\nand may be incompatible or fail to load here.'
|
'\n\nand may be incompatible or fail to load here.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
project_model = {project: xmlNode };
|
project_model = {project: xmlNode };
|
||||||
//project.notes = project_model.project.childNamed('notes') ? project_model.project.childNamed('notes').contents : ""
|
//project.notes = project_model.project.childNamed('notes') ? project_model.project.childNamed('notes').contents : ""
|
||||||
project.name = project_model.project.attributes.name;
|
project.name = project_model.project.attributes.name;
|
||||||
project.origName = project_model.project.childNamed('origName') ? project_model.project.childNamed('origName').contents : ""
|
project.origName = project_model.project.childNamed('origName') ? project_model.project.childNamed('origName').contents : ""
|
||||||
|
@ -113,7 +113,7 @@ SnapSerializer.prototype.loadProjectModel = function (xmlNode, ide, remixID) {
|
||||||
ide.origCreator = project.origCreator || '';
|
ide.origCreator = project.origCreator || '';
|
||||||
ide.creator = project.creator || '';
|
ide.creator = project.creator || '';
|
||||||
ide.remixHistory = project.remixHistory || '';
|
ide.remixHistory = project.remixHistory || '';
|
||||||
|
|
||||||
if (scenesModel) {
|
if (scenesModel) {
|
||||||
if (scenesModel.attributes.select) {
|
if (scenesModel.attributes.select) {
|
||||||
project.sceneIdx = +scenesModel.attributes.select;
|
project.sceneIdx = +scenesModel.attributes.select;
|
||||||
|
@ -441,4 +441,3 @@ SnapSerializer.prototype.loadScene = function (xmlNode, remixID) {
|
||||||
this.objects = {};
|
this.objects = {};
|
||||||
return scene.initialize();
|
return scene.initialize();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,41 @@ Process.prototype.reportPi = function (min, max) {
|
||||||
return Math.PI;
|
return Math.PI;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Process URI retrieval (interpolated)
|
||||||
|
|
||||||
|
Process.prototype.reportURL = function (url) {
|
||||||
|
var response;
|
||||||
|
if (!this.httpRequest) {
|
||||||
|
// use the location protocol unless the user specifies otherwise
|
||||||
|
if (url.indexOf('//') < 0 || url.indexOf('//') > 8) {
|
||||||
|
if (location.protocol === 'file:') {
|
||||||
|
// allow requests from locally loaded sources
|
||||||
|
url = 'https://' + url;
|
||||||
|
} else {
|
||||||
|
url = location.protocol + '//' + url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.httpRequest = new XMLHttpRequest();
|
||||||
|
this.httpRequest.open("GET", url, true);
|
||||||
|
// cache-control, commented out for now
|
||||||
|
// added for Snap4Arduino but has issues with local robot servers
|
||||||
|
// this.httpRequest.setRequestHeader('Cache-Control', 'max-age=0');
|
||||||
|
this.httpRequest.send(null);
|
||||||
|
if (this.context.isCustomCommand) {
|
||||||
|
// special case when ignoring the result, e.g. when
|
||||||
|
// communicating with a robot to control its motors
|
||||||
|
this.httpRequest = null;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else if (this.httpRequest.readyState === 4) {
|
||||||
|
response = this.httpRequest.responseText;
|
||||||
|
this.httpRequest = null;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
this.pushContext('doYield');
|
||||||
|
this.pushContext();
|
||||||
|
};
|
||||||
|
|
||||||
Process.prototype.reportProxiedURL = function (url) {
|
Process.prototype.reportProxiedURL = function (url) {
|
||||||
return this.reportURL(this.proxy + '/' + url);
|
return this.reportURL(this.proxy + '/' + url);
|
||||||
};
|
};
|
||||||
|
@ -61,7 +96,7 @@ Process.prototype.origReportDistanceTo = Process.prototype.reportDistanceTo;
|
||||||
Process.prototype.reportDistanceTo = function (name) {
|
Process.prototype.reportDistanceTo = function (name) {
|
||||||
var thisObj = this.blockReceiver();
|
var thisObj = this.blockReceiver();
|
||||||
if (thisObj && this.inputOption(name) === 'mouse-pointer') {
|
if (thisObj && this.inputOption(name) === 'mouse-pointer') {
|
||||||
return new Point(thisObj.xPosition(), thisObj.yPosition()).distanceTo(new Point(this.reportMouseX(), this.reportMouseY()));
|
return new Point(thisObj.xPosition(), thisObj.yPosition()).distanceTo(new Point(this.reportMouseX(), this.reportMouseY()));
|
||||||
} else {
|
} else {
|
||||||
return this.origReportDistanceTo(name);
|
return this.origReportDistanceTo(name);
|
||||||
}
|
}
|
||||||
|
@ -71,9 +106,9 @@ Process.prototype.origDoGotoObject = Process.prototype.doGotoObject;
|
||||||
Process.prototype.doGotoObject = function (name) {
|
Process.prototype.doGotoObject = function (name) {
|
||||||
var thisObj = this.blockReceiver(),
|
var thisObj = this.blockReceiver(),
|
||||||
stage;
|
stage;
|
||||||
|
|
||||||
if (thisObj && this.inputOption(name) === 'random position') {
|
if (thisObj && this.inputOption(name) === 'random position') {
|
||||||
stage = thisObj.parentThatIsA(StageMorph);
|
stage = thisObj.parentThatIsA(StageMorph);
|
||||||
if (stage) {
|
if (stage) {
|
||||||
thisObj.gotoXY(
|
thisObj.gotoXY(
|
||||||
this.reportBasicRandom(stage.reportX(stage.left()), stage.reportX(stage.right())),
|
this.reportBasicRandom(stage.reportX(stage.left()), stage.reportX(stage.right())),
|
||||||
|
@ -88,11 +123,11 @@ Process.prototype.doGotoObject = function (name) {
|
||||||
Process.prototype.reportRandomPosition = function () {
|
Process.prototype.reportRandomPosition = function () {
|
||||||
var thisObj = this.blockReceiver(),
|
var thisObj = this.blockReceiver(),
|
||||||
stage;
|
stage;
|
||||||
|
|
||||||
if (thisObj) {
|
if (thisObj) {
|
||||||
stage = thisObj.parentThatIsA(StageMorph);
|
stage = thisObj.parentThatIsA(StageMorph);
|
||||||
return new List([this.reportBasicRandom(stage.reportX(stage.left()), stage.reportX(stage.right())),
|
return new List([this.reportBasicRandom(stage.reportX(stage.left()), stage.reportX(stage.right())),
|
||||||
this.reportBasicRandom(stage.reportY(stage.top()), stage.reportY(stage.bottom()))]);
|
this.reportBasicRandom(stage.reportY(stage.top()), stage.reportY(stage.bottom()))]);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -76,6 +76,56 @@ BeetleCloud.prototype.get = function (path, callBack, errorCall, errorMsg) {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
BeetleCloud.prototype.getImage = function (path, callBack, errorCall, errorMsg) {
|
||||||
|
var request = new XMLHttpRequest(),
|
||||||
|
myself = this;
|
||||||
|
|
||||||
|
try {
|
||||||
|
request.open(
|
||||||
|
'GET',
|
||||||
|
this.url + path,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
request.setRequestHeader(
|
||||||
|
'Content-Type',
|
||||||
|
'application/json; charset=utf-8'
|
||||||
|
);
|
||||||
|
|
||||||
|
request.withCredentials = true;
|
||||||
|
request.onreadystatechange = function () {
|
||||||
|
if (request.readyState === 4) {
|
||||||
|
if (request.responseText) {
|
||||||
|
if(request.status === 404) {
|
||||||
|
if (errorCall)
|
||||||
|
errorCall.call(
|
||||||
|
null,
|
||||||
|
myself.url,
|
||||||
|
errorMsg
|
||||||
|
);
|
||||||
|
else
|
||||||
|
console.log("error in checking credentials")
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
callBack.call(null, request.responseText);
|
||||||
|
} else {
|
||||||
|
if (typeof errorCall != 'undefined') {
|
||||||
|
errorCall.call(
|
||||||
|
null,
|
||||||
|
myself.url,
|
||||||
|
errorMsg
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
request.send();
|
||||||
|
} catch (err) {
|
||||||
|
errorCall.call(this, err.toString(), 'TurtleCloud');
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
BeetleCloud.prototype.post = function (path, body, callBack, errorCall, errorMsg) {
|
BeetleCloud.prototype.post = function (path, body, callBack, errorCall, errorMsg) {
|
||||||
var request = new XMLHttpRequest(),
|
var request = new XMLHttpRequest(),
|
||||||
myself = this;
|
myself = this;
|
||||||
|
@ -327,6 +377,16 @@ BeetleCloud.prototype.getProjectList = function (callBack, errorCall) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
BeetleCloud.prototype.getThumbnail = function (username, projectName, callBack, errorCall) {
|
||||||
|
this.getImage('/users/' + this.username
|
||||||
|
+ '/projects/' + encodeURIComponent(projectName)
|
||||||
|
+ '/image', // path
|
||||||
|
callBack, // ok callback
|
||||||
|
() => {}, // error callback
|
||||||
|
'Could not fetch thumbnail'); // error message
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
Cloud = BeetleCloud;
|
Cloud = BeetleCloud;
|
||||||
|
|
||||||
var SnapCloud = new BeetleCloud(
|
var SnapCloud = new BeetleCloud(
|
||||||
|
@ -562,6 +622,17 @@ ProjectDialogMorph.prototype.buildContents = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.originalBuildContents();
|
this.originalBuildContents();
|
||||||
|
this.tagsLabelField = new TextMorph("Tags (New cloud projects only):");
|
||||||
|
this.body.add(this.tagsLabelField);
|
||||||
|
this.notesLabelField = new TextMorph("Notes");
|
||||||
|
this.notesLabelField.edge = InputFieldMorph.prototype.edge;
|
||||||
|
this.body.add(this.notesLabelField);
|
||||||
|
this.tagsField = new InputFieldMorph("");
|
||||||
|
this.tagsField.edge = InputFieldMorph.prototype.edge;
|
||||||
|
this.tagsField.contrast = InputFieldMorph.prototype.contrast;
|
||||||
|
// this.tagsField.fixLayout = InputFieldMorph.prototype.fixLayout;
|
||||||
|
this.body.add(this.tagsField);
|
||||||
|
this.fixLayout();
|
||||||
/*
|
/*
|
||||||
this.preview.setExtent(
|
this.preview.setExtent(
|
||||||
new Point(320,240).add(this.preview.edge * 2)
|
new Point(320,240).add(this.preview.edge * 2)
|
||||||
|
@ -659,6 +730,7 @@ ProjectDialogMorph.prototype.shareProject = function () {
|
||||||
proj.ProjectName,
|
proj.ProjectName,
|
||||||
function () {
|
function () {
|
||||||
proj.Public = 'true';
|
proj.Public = 'true';
|
||||||
|
proj.ispublic = 'true';
|
||||||
myself.unshareButton.show();
|
myself.unshareButton.show();
|
||||||
myself.shareButton.hide();
|
myself.shareButton.hide();
|
||||||
entry.label.isBold = true;
|
entry.label.isBold = true;
|
||||||
|
@ -703,6 +775,7 @@ ProjectDialogMorph.prototype.unshareProject = function () {
|
||||||
proj.ProjectName,
|
proj.ProjectName,
|
||||||
function () {
|
function () {
|
||||||
proj.Public = 'false';
|
proj.Public = 'false';
|
||||||
|
proj.ispublic = 'true';
|
||||||
myself.shareButton.show();
|
myself.shareButton.show();
|
||||||
myself.unshareButton.hide();
|
myself.unshareButton.hide();
|
||||||
entry.label.isBold = false;
|
entry.label.isBold = false;
|
||||||
|
|
Ładowanie…
Reference in New Issue