replace alert w/ alert2 for onshape

This commit is contained in:
Stewart Allen 2019-01-18 16:46:17 -05:00
commit 7bf66a1de7
2 changed files with 19 additions and 19 deletions

View file

@ -556,7 +556,7 @@ self.kiri.license = exports.LICENSE;
* Stats accumulator * Stats accumulator
******************************************************************* */ ******************************************************************* */
window.alert = function alert(message, time) { function alert2(message, time) {
alerts.push([message, Date.now(), time]); alerts.push([message, Date.now(), time]);
updateAlerts(); updateAlerts();
} }
@ -908,7 +908,7 @@ self.kiri.license = exports.LICENSE;
if (!WIDGETS[i].slices || WIDGETS[i].isModified()) { if (!WIDGETS[i].slices || WIDGETS[i].isModified()) {
prepareSlices(function() { prepareSlices(function() {
if (!WIDGETS[i].slices || WIDGETS[i].isModified()) { if (!WIDGETS[i].slices || WIDGETS[i].isModified()) {
alert("nothing to print"); alert2("nothing to print");
} else { } else {
preparePrint(callback); preparePrint(callback);
} }
@ -1054,11 +1054,11 @@ self.kiri.license = exports.LICENSE;
apik = octo_apik.value; apik = octo_apik.value;
if (host.indexOf("http") !== 0) { if (host.indexOf("http") !== 0) {
alert("host missing protocol (http:// or https://)"); alert2("host missing protocol (http:// or https://)");
return; return;
} }
if (SECURE && !isSecure(host)) { if (SECURE && !isSecure(host)) {
alert("host must begin with 'https' on a secure site"); alert2("host must begin with 'https' on a secure site");
return; return;
} }
@ -1074,7 +1074,7 @@ self.kiri.license = exports.LICENSE;
if (status >= 200 && status < 300) { if (status >= 200 && status < 300) {
hideModal(); hideModal();
} else { } else {
alert("octoprint error\nstatus: "+status+"\nmessage: "+ajax.responseText); alert2("octoprint error\nstatus: "+status+"\nmessage: "+ajax.responseText);
} }
} }
}; };
@ -1158,19 +1158,19 @@ self.kiri.license = exports.LICENSE;
target = SDB['grid-target'] || ''; target = SDB['grid-target'] || '';
if (target === '') { if (target === '') {
alert('invalid or missing target'); alert2('invalid or missing target');
return; return;
} }
if (host.indexOf("http") !== 0) { if (host.indexOf("http") !== 0) {
alert("host missing protocol (http:// or https://)"); alert2("host missing protocol (http:// or https://)");
return; return;
} }
if (host.indexOf("://") < 0) { if (host.indexOf("://") < 0) {
alert("host:port malformed"); alert2("host:port malformed");
return; return;
} }
if (SECURE && !isSecure(host)) { if (SECURE && !isSecure(host)) {
alert("host must begin with 'https' on a secure site"); alert2("host must begin with 'https' on a secure site");
return; return;
} }
@ -1187,10 +1187,10 @@ self.kiri.license = exports.LICENSE;
ajax(host+"/api/wait?key="+json.key, function(data) { ajax(host+"/api/wait?key="+json.key, function(data) {
data = js2o(data); data = js2o(data);
DBUG.log(data); DBUG.log(data);
alert("print to "+target+": "+data.status, 600); alert2("print to "+target+": "+data.status, 600);
}); });
} else { } else {
alert("grid:host error\nstatus: "+status+"\nmessage: "+xhtr.responseText, 10000); alert2("grid:host error\nstatus: "+status+"\nmessage: "+xhtr.responseText, 10000);
} }
setProgress(0); setProgress(0);
} }
@ -1380,7 +1380,7 @@ self.kiri.license = exports.LICENSE;
setViewMode(VIEWS.ARRANGE); setViewMode(VIEWS.ARRANGE);
setOpacity(model_opacity); setOpacity(model_opacity);
widgetDeselect(); widgetDeselect();
alert(error); alert2(error);
} }
}, function(update, msg) { }, function(update, msg) {
if (msg !== lastMsg) { if (msg !== lastMsg) {
@ -1860,7 +1860,7 @@ self.kiri.license = exports.LICENSE;
loadFiles(event.target.files); loadFiles(event.target.files);
}; };
$('load-file').click(); $('load-file').click();
// alert("drag/drop STL files onto platform to import\nreload page to return to last saved state"); // alert2("drag/drop STL files onto platform to import\nreload page to return to last saved state");
} }
// kiri api // kiri api
@ -2775,7 +2775,7 @@ self.kiri.license = exports.LICENSE;
updateFields(); updateFields();
} catch (e) { } catch (e) {
console.log(e); console.log(e);
alert("invalid settings format"); alert2("invalid settings format");
} }
} }
break; break;
@ -2862,7 +2862,7 @@ self.kiri.license = exports.LICENSE;
function rotateInputSelection() { function rotateInputSelection() {
if (selectedMeshes.length === 0) { if (selectedMeshes.length === 0) {
alert("select object to rotate"); alert2("select object to rotate");
return; return;
} }
var coord = prompt("Enter X,Y,Z degrees of rotation").split(','), var coord = prompt("Enter X,Y,Z degrees of rotation").split(','),
@ -2876,7 +2876,7 @@ self.kiri.license = exports.LICENSE;
function positionSelection() { function positionSelection() {
if (selectedMeshes.length === 0) { if (selectedMeshes.length === 0) {
alert("select object to position"); alert2("select object to position");
return; return;
} }
var center = settings.process.outputOriginCenter, var center = settings.process.outputOriginCenter,
@ -2920,7 +2920,7 @@ self.kiri.license = exports.LICENSE;
var res = JSON.parse(reply); var res = JSON.parse(reply);
if (res && res.ver) { if (res && res.ver) {
LOC.hash = res.space + "/" + res.ver; LOC.hash = res.space + "/" + res.ver;
if (display) alert("unique settings id is: " + res.space + "/" + res.ver); if (display) alert2("unique settings id is: " + res.space + "/" + res.ver);
} }
} else { } else {
updateSpaceState(); updateSpaceState();
@ -3147,7 +3147,7 @@ self.kiri.license = exports.LICENSE;
saveSettings(); saveSettings();
} catch (e) { } catch (e) {
console.log({error:e, device:code}); console.log({error:e, device:code});
// alert("invalid or deprecated device. please select a new device."); // alert2("invalid or deprecated device. please select a new device.");
showDevices(); showDevices();
} }
clearWidgetCache(); clearWidgetCache();

View file

@ -1,7 +1,7 @@
var exports = { var exports = {
COPYRIGHT:"Copyright (C) 2014-2018 Stewart Allen <sa@grid.space> - All Rights Reserved", COPYRIGHT:"Copyright (C) 2014-2018 Stewart Allen <sa@grid.space> - All Rights Reserved",
LICENSE:"See the license.md file included with the source distribution", LICENSE:"See the license.md file included with the source distribution",
VERSION:"1.2.5" VERSION:"1.2.5a"
}; };
if (!module) var module = {}; if (!module) var module = {};
module.exports = exports; module.exports = exports;