浏览代码

use favicon.ico to indicate connection status

wangweimin 5 年之前
父节点
当前提交
b8812be2a3

二进制
pywebio/html/image/favicon_closed_16.png


二进制
pywebio/html/image/favicon_closed_32.png


二进制
pywebio/html/image/favicon_open_16.png


二进制
pywebio/html/image/favicon_open_32.png


+ 2 - 1
pywebio/html/index.html

@@ -3,7 +3,8 @@
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <title>PyWebIO</title>
-
+    <link rel="icon" type="image/png" sizes="32x32" href="image/favicon_open_32.png" id="favicon32">
+    <link rel="icon" type="image/png" sizes="16x16" href="image/favicon_open_16.png" id="favicon16">
     <link rel="stylesheet" href="css/mditor.min.css">
     <link rel="stylesheet" href="css/bootstrap.min.css">
     <link rel="stylesheet" href="css/codemirror.css">

+ 2 - 2
pywebio/html/js/pywebio.js

@@ -1008,8 +1008,8 @@
     function WebIOController(webio_session, output_container_elem, input_container_elem) {
         WebIOSession_ = webio_session;
         webio_session.on_session_close = function () {
-            document.title = 'Closed';
-            $('#title').text('Closed');  // todo
+            $('#favicon32').attr('href', 'image/favicon_closed_32.png');  // todo:remove hard code
+            $('#favicon16').attr('href', 'image/favicon_closed_16.png');
         };
 
         this.output_ctrl = new OutputController(webio_session, output_container_elem);