From d3abaedf97f88100caabaaa8adfbaa5fcd175aac Mon Sep 17 00:00:00 2001 From: Eason010212 <1371033826@qq.com> Date: Wed, 24 Apr 2024 20:26:08 +0800 Subject: [PATCH] fix-ob-bug --- js/observe.js | 7 ++++--- js/widgets.js | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/js/observe.js b/js/observe.js index 032e936..cd6c210 100644 --- a/js/observe.js +++ b/js/observe.js @@ -78,10 +78,11 @@ $(function(){ 'ble': add_ble, 'pixel': add_pixel, 'input_mic': add_mic, - 'tinydb': add_tinydb + 'tinydb': add_tinydb, + 'timer': add_timer } console.log(un.attr('user-type')) - toolkits[un.attr('user-type')](un.attr('user-title'),un.attr('user-topic'),un.attr('user-content'),un.attr('style')); + toolkits[un.attr('user-type')](un.attr('user-title'),un.attr('user-topic'),un.attr('user-content'),un.attr('style'),un.attr('title_style'),true); } } var modald = showmodaltext("

"+JSLang[lang].loading+"

") @@ -92,7 +93,7 @@ $(function(){ { 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) - globalCode = stringendecoder.decodeHtml(JSON.parse(JSON.parse(res).logicStorage).code) + globalCode = MixIO.preCode + stringendecoder.decodeHtml(JSON.parse(JSON.parse(res).logicStorage).code) else globalCode = '' $("#grid").removeClass("gridbg") diff --git a/js/widgets.js b/js/widgets.js index ee25056..f485ea9 100644 --- a/js/widgets.js +++ b/js/widgets.js @@ -2350,7 +2350,7 @@ function add_magic(user_title, user_topic, user_content, user_style, title_style itemdiv.attr('style', user_style) } -function add_timer(user_title, user_topic, user_content, user_style, title_style) { +function add_timer(user_title, user_topic, user_content, user_style, title_style, isObserve) { var isAlive = true var contents = [] var title = $("

" + user_title + "

") @@ -2388,8 +2388,8 @@ function add_timer(user_title, user_topic, user_content, user_style, title_style }, triggerInterval) } MixIO.triggersToPreCode() - MixIO.editor.setValue(MixIO.preCode + Blockly.JavaScript.workspaceToCode(workspace)) - + if(!isObserve) + MixIO.editor.setValue(MixIO.preCode + Blockly.JavaScript.workspaceToCode(workspace)) var delete_on_click = function() { title.parent().parent().remove(); isAlive = false