| 104 | } |
| 105 | |
| 106 | function AutoFill() { |
| 107 | if (typeof QWebChannel === 'undefined') { |
| 108 | console.error('AutoFill: QWebChannel not loaded'); |
| 109 | return; |
| 110 | } |
| 111 | if (typeof qt === 'undefined') { |
| 112 | console.error('AutoFill: qt not available'); |
| 113 | return; |
| 114 | } |
| 115 | if (!qt.webChannelTransport) { |
| 116 | console.error('AutoFill: qt.webChannelTransport not available'); |
| 117 | return; |
| 118 | } |
| 119 | |
| 120 | // 等待 QWebChannel 可用(qwebchannel.js 已被注入) |
| 121 | new QWebChannel(qt.webChannelTransport, function(channel) { |
| 122 | start(channel); |
| 123 | }); |
| 124 | } |
| 125 | |
| 126 | //console.log("AutoFill: doumment.readyState:" + document.readyState); |
| 127 | //如果 QWebChannel 已经可用,直接 AutoFill; 否则在 ready 事件后再试 |