Node-red-dashboard clock in toolbar

This flow uses a template node that is added to site <head> and adds a clock on the top right corner of the dashboard toolbar

Inspired by: https://discourse.nodered.org/t/time-date-on-the-dashboard/2415/6

Buy Me A Coffee

Preview

dashbaord-toolbar-clock

[{"id":"b97bc1c0.cb899","type":"ui_template","z":"7583a640.3bbbd8","group":"c982fbb8.1deb38","name":"Clock Toolbar","order":2,"width":"0","height":"0","format":"<script id=\"titleScript\" type=\"text/javascript\">\n\n$(function() {\n    if($('.md-toolbar-tools').length != 0){\n        loadClock();\n    }else setTimeout(loadClock, 500)\n});\n\nfunction loadClock(){\n    $('#clock').remove();\n    var toolbar = $('.md-toolbar-tools');\n    \n    var div = $('<div/>');\n    var p = $('<p/ id=\"clock\">');\n    \n    div.append(p);\n    div[0].style.margin = '5px 5px 5px auto';\n    toolbar.append(div);\n\n    function displayTitle(lh) {\n        p.text(lh); \n    }\n    \n    function upTime() {\n        var d = new Date();\n        p.text(d.toLocaleString());\n    }\n\n    if(document.clockInterval){ \n            clearInterval(document.clockInterval);\n            document.clockInterval = null;\n    }\n        \n    document.clockInterval = setInterval(upTime,1000);\n}\n\n</script>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"global","x":420,"y":80,"wires":[[]]},{"id":"c982fbb8.1deb38","type":"ui_group","z":"","name":"hidden_group","tab":"7c447e96.4b96a","disp":false,"width":"6","collapse":false},{"id":"7c447e96.4b96a","type":"ui_tab","z":"","name":"Zooland Sys","icon":"home","order":1,"disabled":false,"hidden":false}]

Flow Info

Created 6 years, 3 months ago
Updated 4 years, 8 months ago
Rating: 4.9 10

Owner

Actions

Rate:

Node Types

Other
  • ui_group (x1)
  • ui_tab (x1)
  • ui_template (x1)

Tags

  • clock
  • node-red-dashboard
  • toolbar
  • template
  • ui
  • dashboard
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option