resume-pic

This commit is contained in:
unknown
2025-05-29 18:59:13 +08:00
parent 7f5ffbf5ad
commit 9ee6da990f

View File

@@ -2,6 +2,7 @@ MixIO.log = console.log
stop_project = console.log('stop_project') stop_project = console.log('stop_project')
var lastPublishTime = [new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0)] var lastPublishTime = [new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0), new Date(0)]
var minPublishInterval = 500 var minPublishInterval = 500
function isJSON(str) { function isJSON(str) {
if (typeof str == 'string') { if (typeof str == 'string') {
try { try {
@@ -17,21 +18,18 @@ function isJSON(str) {
} }
} }
} }
function publish(topic, message, omit) { function publish(topic, message, omit) {
if(isRunning||omit) if (isRunning || omit) {
{
var newPublishTime = new Date() var newPublishTime = new Date()
if(newPublishTime-lastPublishTime[0]>=minPublishInterval) if (newPublishTime - lastPublishTime[0] >= minPublishInterval) {
{
if (!isMixly) if (!isMixly)
client.publish(globalUserName + '/' + globalProjectName + '/' + topic, message) client.publish(globalUserName + '/' + globalProjectName + '/' + topic, message)
else else
client.publish('MixIO' + '/' + globalUserName.slice(1) + '/' + globalProjectName + '/' + topic, message) client.publish('MixIO' + '/' + globalUserName.slice(1) + '/' + globalProjectName + '/' + topic, message)
lastPublishTime.shift() lastPublishTime.shift()
lastPublishTime.push(new Date()) lastPublishTime.push(new Date())
} } else {
else
{
showtext(JSLang[lang].speedLimit) showtext(JSLang[lang].speedLimit)
MixIO.log(JSLang[lang].speedLimit) MixIO.log(JSLang[lang].speedLimit)
} }
@@ -42,6 +40,7 @@ isMixly = false;
$(function() { $(function() {
init_layout(); init_layout();
get_width(); get_width();
function view_project(resJSON, userName, projectPass, projectName, timeStamp) { function view_project(resJSON, userName, projectPass, projectName, timeStamp) {
$("#prjName").html(projectName) $("#prjName").html(projectName)
$("#shareMessage").html(userName + JSLang[lang].shareAt + timeStamp) $("#shareMessage").html(userName + JSLang[lang].shareAt + timeStamp)
@@ -73,7 +72,7 @@ $(function(){
'input_weather': add_weather, 'input_weather': add_weather,
'table': add_table, 'table': add_table,
'decorate_text': add_decorate_text, 'decorate_text': add_decorate_text,
'decorate_pic':function(){}, 'decorate_pic': add_decorate_pic,
'magic': add_magic, 'magic': add_magic,
'ble': add_ble, 'ble': add_ble,
'pixel': add_pixel, 'pixel': add_pixel,
@@ -91,11 +90,9 @@ $(function(){
} }
} }
var modald = showmodaltext("<div style='text-align:center' class='nnt'><i class='fa fa-spin fa-cog' style='font-size:2rem;color:#4e73df'></i><p style='margin-top:6px;margin-bottom:0;color:#4e73df;font-size:1rem;font-weight:bold'>" + JSLang[lang].loading + "</p></div>") var modald = showmodaltext("<div style='text-align:center' class='nnt'><i class='fa fa-spin fa-cog' style='font-size:2rem;color:#4e73df'></i><p style='margin-top:6px;margin-bottom:0;color:#4e73df;font-size:1rem;font-weight:bold'>" + JSLang[lang].loading + "</p></div>")
if(getPar("sid")) if (getPar("sid")) {
{
$.get('fetchObserve', { 'sid': stringendecoder.encodeHtml(getPar("sid")) }, function(res) { $.get('fetchObserve', { 'sid': stringendecoder.encodeHtml(getPar("sid")) }, function(res) {
if(res!=-1) if (res != -1) {
{
view_project(JSON.parse(JSON.parse(res).projectLayout), JSON.parse(res).userName, JSON.parse(res).projectPass, JSON.parse(res).projectName, JSON.parse(res).timeStamp) view_project(JSON.parse(JSON.parse(res).projectLayout), JSON.parse(res).userName, JSON.parse(res).projectPass, JSON.parse(res).projectName, JSON.parse(res).timeStamp)
if (JSON.parse(res).logicStorage) if (JSON.parse(res).logicStorage)
globalCode = MixIO.preCode + stringendecoder.decodeHtml(JSON.parse(JSON.parse(res).logicStorage).code) globalCode = MixIO.preCode + stringendecoder.decodeHtml(JSON.parse(JSON.parse(res).logicStorage).code)
@@ -144,14 +141,11 @@ $(function(){
try { try {
var logicFunction = Function(globalCode); var logicFunction = Function(globalCode);
logicFunction() logicFunction()
} } catch (e) {
catch(e){
showtext(JSLang[lang].logicError) showtext(JSLang[lang].logicError)
return false; return false;
} }
} } else {
else
{
modald.close() modald.close()
showmodaltext(JSLang[lang].invalidAUPrj) showmodaltext(JSLang[lang].invalidAUPrj)
} }