August-New-Widget

This commit is contained in:
Eason010212
2023-08-31 22:16:12 +08:00
parent 694513367e
commit 4a3ad4c297
6 changed files with 1042 additions and 108 deletions

1
icons/camera.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1691160166481" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2302" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 736c-105.856 0-192-86.08-192-192 0-105.856 86.144-192 192-192 105.92 0 192 86.144 192 192 0 105.92-86.08 192-192 192z m0-320c-70.592 0-128 57.408-128 128s57.408 128 128 128 128-57.408 128-128-57.408-128-128-128z m352 480h-704c-52.928 0-96-43.072-96-96v-512C64 235.072 107.072 192 160 192H256a32 32 0 0 1 0 64H160a32 32 0 0 0-32 32v512a32 32 0 0 0 32 32h704a32 32 0 0 0 32-32v-512a32 32 0 0 0-32-32H512a32 32 0 0 1 0-64h352c52.928 0 96 43.072 96 96v512c0 52.928-43.072 96-96 96zM768 336a48 48 0 1 0 96 0 48 48 0 0 0-96 0zM480 128a32 32 0 0 1-32 32H320a32 32 0 0 1 0-64h128a32 32 0 0 1 32 32z" fill="#4e73df" p-id="2303"></path></svg>

After

Width:  |  Height:  |  Size: 970 B

1
icons/database.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1691160208019" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5253" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 384C307.2 384 85.333333 328.533333 85.333333 213.333333s221.866667-170.666667 426.666667-170.666666 426.666667 55.466667 426.666667 170.666666-221.866667 170.666667-426.666667 170.666667z m0-256C290.133333 128 170.666667 192 170.666667 213.333333s119.466667 85.333333 341.333333 85.333334 341.333333-64 341.333333-85.333334-119.466667-85.333333-341.333333-85.333333zM512 682.666667c-204.8 0-426.666667-55.466667-426.666667-170.666667 0-25.6 17.066667-42.666667 42.666667-42.666667s42.666667 17.066667 42.666667 42.666667c0 21.333333 106.666667 85.333333 341.333333 85.333333s341.333333-64 341.333333-85.333333c0-25.6 17.066667-42.666667 42.666667-42.666667s42.666667 17.066667 42.666667 42.666667c0 115.2-221.866667 170.666667-426.666667 170.666667z" p-id="5254" fill="#4e73df"></path><path d="M512 981.333333c-204.8 0-426.666667-55.466667-426.666667-170.666666V213.333333c0-25.6 17.066667-42.666667 42.666667-42.666666s42.666667 17.066667 42.666667 42.666666v597.333334c0 21.333333 106.666667 85.333333 341.333333 85.333333s341.333333-64 341.333333-85.333333V213.333333c0-25.6 17.066667-42.666667 42.666667-42.666666s42.666667 17.066667 42.666667 42.666666v597.333334c0 115.2-221.866667 170.666667-426.666667 170.666666z" p-id="5255" fill="#4e73df"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

1
icons/mic.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1691160185635" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3381" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 728.461778c59.107644 0 115.020281-20.767551 153.360374-63.900156 38.340094-38.340094 59.107644-89.460218 59.107645-145.372854V209.273011C724.468019 94.25273 631.812793 0 512 0S299.531981 94.25273 299.531981 209.273011v314.708268c0 110.227769 92.655226 204.480499 212.468019 204.480499z m-127.800312-519.188767c0-68.692668 55.912637-123.0078 127.800312-123.0078s127.800312 55.912637 127.800312 123.0078v314.708268c0 30.352574-12.780031 59.107644-33.547582 81.472699-25.560062 25.560062-59.107644 38.340094-94.25273 38.340094-71.887676 0-127.800312-55.912637-127.800312-123.007801V209.273011z" p-id="3382" fill="#4e73df"></path><path d="M852.268331 490.433697c0-25.560062-17.572543-43.132605-43.132606-43.132605s-43.132605 17.572543-43.132605 43.132605c0 145.372855-115.020281 263.588144-255.600624 263.588144s-255.600624-119.812793-255.600624-263.588144c0-25.560062-17.572543-43.132605-43.132605-43.132605s-43.132605 17.572543-43.132606 43.132605c0 178.920437 132.592824 324.293292 298.73323 345.060843v102.240249H384.199688c-25.560062 0-43.132605 17.572543-43.132605 43.132606s17.572543 43.132605 43.132605 43.132605h255.600624c25.560062 0 43.132605-17.572543 43.132605-43.132605s-17.572543-43.132605-43.132605-43.132606h-84.667707v-97.447738c166.140406-22.365055 297.135725-170.932917 297.135726-349.853354z" p-id="3383" fill="#4e73df"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -25,7 +25,7 @@ var JSLang = {
"editProper": "修改项目属性",
"viewProject": "查看和编辑项目内容",
"illegalCycle": "逻辑视图中存在循环方法,不允许后台运行",
"codeException": "代码内部存在错误",
"codeException": "当前项目的逻辑视图存在无法在后台运行的内容",
"loading": "加载中",
"loading2": "更改中",
"wrongAcc": "用户名或密码错误",
@@ -97,7 +97,7 @@ var JSLang = {
"widget": "组件",
"data": "- 数据 -",
"lineChart": "折线图表",
"barChart": "柱状图表",
"barChart": "投票器",
"dataTable": "数据表格",
"dataMap": "数据地图",
"dashboard": "仪表盘",
@@ -208,7 +208,12 @@ var JSLang = {
"invalidUType": "不正确的组件类别。",
"noUnitFound": "未找到组件。",
"platformList": "已登录平台",
"deviceList": "已连接设备"
"deviceList": "已连接设备",
"camera": "摄像头",
"mic": "麦克风",
"tinydb": "数据库",
"resolution": "分辨率",
"fps": "帧率"
},
"tw": {
"syncInterval": "自動更新頻率",
@@ -419,7 +424,12 @@ var JSLang = {
"invalidUType": "不正確的組件類別。",
"noUnitFound": "未找到組件。",
"platformList": "已登錄平台",
"deviceList": "已連接設備"
"deviceList": "已連接設備",
"camera": "攝像頭",
"mic": "麥克風",
"tinydb": "數據庫",
"resolution": "分辨率",
"fps": "幀率"
},
"en": {
"syncInterval": "Auto-sync",
@@ -630,7 +640,12 @@ var JSLang = {
"invalidUType": "Invalid unit type.",
"noUnitFound": "The unit does not exist",
"platformList": "Platforms",
"deviceList": "Devices"
"deviceList": "Devices",
"camera": "Camera",
"mic": "Microphone",
"tinydb": "Database",
"resolution": "Resolution",
"fps": "FPS"
}
}

View File

@@ -511,9 +511,13 @@ function shareKey() {
}
function switch_mode() {
grid.on("contextmenu", function(e) {
e.preventDefault()
})
grid.removeAttr("hidden")
grid2.removeAttr("hidden")
grid3.removeAttr("hidden")
if (globalProjectType == DATA_MODE) {
$("#projMode").removeClass("btn-primary")
$("#projMode").addClass("btn-light")
@@ -699,6 +703,8 @@ function view_project(projectName, projectType) {
}
})
MixIO.log = function(text) {
if(typeof text == "object")
text = JSON.stringify(text)
if (jTa2.html())
jTa2.html(jTa2.html() + '<br>' + '[' + timeStamp2String().substring(11) + '] ' + text)
else
@@ -895,6 +901,8 @@ function view_project(projectName, projectType) {
} else if (topic1.split('/').length == 3 && !isMixly) {
var tp = stringendecoder.encodeHtml(topic1.split('/')[2])
var ms = message1.toString()
if(ms.length>500)
ms = "[Too long to display]"
if(isJSON(ms))
{
var msJSON = JSON.parse(ms)
@@ -948,6 +956,8 @@ function view_project(projectName, projectType) {
} else if (topic1.split('/').length == 4 && isMixly) {
var tp = stringendecoder.encodeHtml(topic1.split('/')[3])
var ms = message1.toString()
if(ms.length>500)
ms = "[Too long to display]"
if(isJSON(ms))
{
var msJSON = JSON.parse(ms)
@@ -1010,6 +1020,14 @@ function view_project(projectName, projectType) {
var units_array = $(prev_layout)
for (var ct = 0; ct <= units_array.length - 1; ct = ct + 1) {
var un = $(units_array[ct])
var titleHidden = un.attr('title-hidden')
// if no title-hidden attribute, set it to false
if (titleHidden == undefined)
titleHidden = false
if (titleHidden == "true")
titleHidden = true
if (titleHidden == "false")
titleHidden = false
var toolkits = {
'input_button': add_button,
'input_slider': add_slider,
@@ -1030,9 +1048,10 @@ function view_project(projectName, projectType) {
'decorate_text': add_decorate_text,
'decorate_pic': add_decorate_pic,
'timer': add_timer,
'ble': add_ble
'ble': add_ble,
'camera': add_camera
}
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'), titleHidden)
}
var topicOuterDiv = $("<div style='width:100%;display:flex;align-items:center;'></div>")
var topicDiv = $("<div style='z-index:1000;margin:0;display:flex;flex-direction:row;align-items:center;justify-content:center;margin-bottom:20px;width:320px;background-color:white;border-radius:0 0 40px 0;padding-left:10px;padding-right:10px;padding-top:5px;padding-bottom:10px;box-shadow:0 .15rem 1.75rem 0 rgba(58,59,69,.15)!important;flex-wrap:wrap'></div>")
@@ -1685,6 +1704,12 @@ function add_widget() {
widget_list.append(output_dashboard_add)
var input_weather_add = $("<div class='widget_div'><div><img src='icons/input_weather.svg'><span>" + JSLang[lang].weather + "</span></div><a class='btn btn-" + (OFFLINE_MODE ? 'secondary' : 'success') + " btn-block'><i class='fa fa-" + (OFFLINE_MODE ? 'lock' : 'plus') + "'></i></a></div>")
widget_list.append(input_weather_add)
var input_camera_add = $("<div class='widget_div'><div><img src='icons/camera.svg'><span>" + JSLang[lang].camera + "</span></div><a class='btn btn-success btn-block'><i class='fa fa-plus'></i></a></div>")
widget_list.append(input_camera_add)
var input_mic_add = $("<div class='widget_div'><div><img src='icons/mic.svg'><span>" + JSLang[lang].mic + "</span></div><a class='btn btn-secondary btn-block'><i class='fa fa-plus'></i></a></div>")
widget_list.append(input_mic_add)
var input_tinydb_add = $("<div class='widget_div'><div><img src='icons/database.svg'><span>" + JSLang[lang].tinydb + "</span></div><a class='btn btn-secondary btn-block'><i class='fa fa-plus'></i></a></div>")
widget_list.append(input_tinydb_add)
widget_list.append($("<h5 style='width:100%;text-align:center;margin-bottom:5px;margin-top:10px;color:#4e73df;font-size:1.3rem;font-weight:bold'>" + JSLang[lang].text + "</h5>"))
var input_keyboard_add = $("<div class='widget_div'><div><img src='icons/input_keyboard.svg'><span>" + JSLang[lang].keyboard + "</span></div><a class='btn btn-success btn-block'><i class='fa fa-plus'></i></a></div>")
widget_list.append(input_keyboard_add)
@@ -1763,7 +1788,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df;"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11 && getByteLen(topic_input_2.val()) > 0 && getByteLen(topic_input_2.val()) < 11)
if (true) {
@@ -1793,6 +1818,71 @@ function add_widget() {
modifyDia.showModal()
})
input_camera_add.children("a").click(function() {
d.close().remove()
var editForm = $('<div class="nnt"/>')
editForm.append($('<div style="margin-top:-63px;margin-left:82.5px;margin-bottom:15px;box-shadow: 1px 1px 20px #4e73df;background-color:white;width:75px;height:75px;padding:40px;border-radius:80px;border:solid #4e73df 3px;display:flex;align-items:center;justify-content:center"><img src="icons/camera.svg" style="width:45px;"></div>'))
editForm.append($('<h5 style="text-align:center">' + JSLang[lang].unitName + '</h5>'))
var title_input_div = $('<div style="display:flex;flex-direction:row;align-items:center"/>')
var title_input = $("<input class='form-control form-control-user' style='text-align:center' autofocus='autofocus'/>")
title_input_div.append(title_input)
editForm.append(title_input_div)
editForm.append($('<h5 style="margin-top:15px;text-align:center">' + JSLang[lang].messTopic + '</h5>'))
var topic_input_div = $('<div style="display:flex;flex-direction:row;align-items:center"/>')
var topic_input = $("<input class='form-control form-control-user' style='text-align:center'/>")
topic_input_div.append(topic_input)
topic_input.val("camera")
editForm.append(topic_input_div)
// resolution selection
editForm.append($('<h5 style="margin-top:15px;text-align:center">' + JSLang[lang].resolution + '</h5>'))
var resolution_input_div = $('<div style="display:flex;flex-direction:row;align-items:center"/>')
var resolution_input = $("<select class='form-control form-control-user' style='text-align:center;cursor:pointer'/>")
resolution_input_div.append(resolution_input)
resolution_input.append($("<option value='160x120'>160x120</option>"))
resolution_input.append($("<option value='320x240'>320x240</option>"))
editForm.append(resolution_input_div)
// fps selection
editForm.append($('<h5 style="margin-top:15px;text-align:center">' + JSLang[lang].fps + '</h5>'))
var fps_input_div = $('<div style="display:flex;flex-direction:row;align-items:center"/>')
var fps_input = $("<select class='form-control form-control-user' style='text-align:center;cursor:pointer'/>")
fps_input_div.append(fps_input)
fps_input.append($("<option value='1'>1</option>"))
fps_input.append($("<option value='2'>2</option>"))
editForm.append(fps_input_div)
var bottomDiv = $('<div style="width:100%;margin-top:15px;display:flex;flex-direction:row;align-items:center;justify-content:space-around"/>')
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df;"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
if (countSubstr(grid.html(), 'user-title=\"' + title_input.val() + '\"', false) <= 0) {
add_camera(title_input.val(), topic_input.val(), resolution_input.val() + "," + fps_input.val())
modifyDia.close().remove()
} else
showtext(JSLang[lang].sameUnit)
} else
showtext("")
else
showtext(JSLang[lang].topicLenIllegal)
} else
showtext(JSLang[lang].nameLenIllegal)
})
var cancelEdit = $('<a class="btn btn-danger btn-circle"><i class="fa fa-arrow-left"></i></a>')
cancelEdit.click(function() {
modifyDia.close().remove()
add_widget()
})
bottomDiv.append(cancelEdit)
editForm.append(bottomDiv)
var modifyDia = dialog({
content: editForm[0],
cancel: false
})
modifyDia.showModal()
})
output_pixel_add.children("a").click(function() {
d.close().remove()
var editForm = $('<div class="nnt"/>')
@@ -1824,7 +1914,7 @@ function add_widget() {
xpixel_input.val(30)
ypixel_input.val(20)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (xpixel_input.val() > 0 && xpixel_input.val() < 101 && ypixel_input.val() > 0 && ypixel_input.val() < 101) {
@@ -1891,7 +1981,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df;"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -1958,7 +2048,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df;"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2007,7 +2097,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2074,7 +2164,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2123,7 +2213,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2184,7 +2274,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(Rtopic_input.val()) > 0 && getByteLen(Rtopic_input.val()) < 11 && getByteLen(Gtopic_input.val()) > 0 && getByteLen(Gtopic_input.val()) < 11 && getByteLen(Btopic_input.val()) > 0 && getByteLen(Btopic_input.val()) < 11)
if (re.test(Rtopic_input.val()) && re.test(Gtopic_input.val()) && re.test(Btopic_input.val())) {
@@ -2301,7 +2391,7 @@ function add_widget() {
if (placecode == "unselected")
showtext(JSLang[lang].locationSet)
else {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2351,7 +2441,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2417,7 +2507,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (getByteLen(message_input.val()) > 0) {
@@ -2523,7 +2613,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (getByteLen(condition1_input2.val()) > 0 && (condition2_input1.val() == "--" || getByteLen(condition2_input2.val()) > 0)) {
@@ -2584,7 +2674,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df;"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
add_magic(title_input.val(), undefined, color_select.val())
modifyDia.close().remove()
}
@@ -2624,7 +2714,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2679,7 +2769,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2743,7 +2833,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df;"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2811,7 +2901,7 @@ function add_widget() {
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (option_input.val() != "") {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2878,7 +2968,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -2932,7 +3022,7 @@ function add_widget() {
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 11) {
if (getByteLen(title_input.val()) > 0 && getByteLen(title_input.val()) < 21) {
var re = /^[a-z0-9]+$/i;
if (getByteLen(topic_input.val()) > 0 && getByteLen(topic_input.val()) < 11)
if (true) {
@@ -3001,11 +3091,17 @@ function add_widget() {
var text_input = $("<textarea class='form-control form-control-user' style='text-align:center;width:250px' autofocus='autofocus'/>")
text_input_div.append(text_input)
editForm.append(text_input_div)
editForm.append($('<h5 style="margin-top:15px;text-align:center">' + JSLang[lang].messTopic + '</h5>'))
var topic_input_div = $('<div style="display:flex;flex-direction:row;align-items:center"/>')
var topic_input = $("<input class='form-control form-control-user' style='text-align:center'/>")
topic_input.val("pic")
topic_input_div.append(topic_input)
editForm.append(topic_input_div)
var bottomDiv = $('<div style="width:100%;margin-top:15px;display:flex;flex-direction:row;align-items:center;justify-content:space-around"/>')
var confirmEdit = $('<a class="btn btn-primary btn-circle" style="margin-right:10px;box-shadow:1px 1px 5px #4e73df;"><i class="fa fa-check"></i></a>')
bottomDiv.append(confirmEdit)
confirmEdit.click(function() {
add_decorate_pic(undefined, undefined, text_input.val())
add_decorate_pic(undefined, topic_input.val(), text_input.val())
modifyDia.close().remove()
})
var cancelEdit = $('<a class="btn btn-danger btn-circle"><i class="fa fa-arrow-left"></i></a>')
@@ -3171,7 +3267,7 @@ function listen_project(projectName) {
if (code == 1) {
window.location.href = window.location.href
} else if (code == -1) {
showtext(JSLang[lang].codeException + ": " + JSON.parse(res)["exception"])
showtext(JSLang[lang].codeException + ": " + JSON.stringify(JSON.parse(res)["exception"]))
} else if (code == -2)
showtext(JSLang[lang].prj404)
else if (code == -3)
@@ -3393,6 +3489,22 @@ function publish(topic, message, omit) {
}
}
function propublish(project, topic, message){
var newPublishTime = new Date()
if (newPublishTime - lastPublishTime[0] >= minPublishInterval) {
if (!isMixly)
client.publish(globalUserName + '/' + project + '/' + topic, message)
else
client.publish('MixIO' + '/' + globalUserName.slice(1) + '/' + project + '/' + topic, message)
lastPublishTime.shift()
lastPublishTime.push(new Date())
} else {
showtext(JSLang[lang].speedLimit)
MixIO.log(JSLang[lang].speedLimit)
stop_project()
}
}
var exit = function() {
activeExit = true
save_layout(true)

File diff suppressed because it is too large Load Diff