* 绑定截图UI的事件
(container)
| 1132 | * 绑定截图UI的事件 |
| 1133 | */ |
| 1134 | function bindEvents(container) { |
| 1135 | const btnVisible = document.getElementById('btnVisible'); |
| 1136 | const btnWhole = document.getElementById('btnWhole'); |
| 1137 | const btnClose = document.getElementById('btnClose'); |
| 1138 | |
| 1139 | if (btnVisible) { |
| 1140 | btnVisible.onclick = function() { |
| 1141 | container.remove(); |
| 1142 | goCapture({captureType: 'visible'}); |
| 1143 | }; |
| 1144 | } |
| 1145 | |
| 1146 | if (btnWhole) { |
| 1147 | btnWhole.onclick = function() { |
| 1148 | container.remove(); |
| 1149 | goCapture({captureType: 'whole'}); |
| 1150 | }; |
| 1151 | } |
| 1152 | |
| 1153 | if (btnClose) { |
| 1154 | btnClose.onclick = function() { |
| 1155 | container.remove(); |
| 1156 | }; |
| 1157 | } |
| 1158 | |
| 1159 | // 添加自动关闭 |
| 1160 | setTimeout(() => { |
| 1161 | if (container && document.body.contains(container)) { |
| 1162 | container.remove(); |
| 1163 | } |
| 1164 | }, 30000); |
| 1165 | } |
| 1166 | |
| 1167 | // 添加键盘快捷键支持 |
| 1168 | document.addEventListener('keydown', function(e) { |
no test coverage detected