()
| 58 | checkInstalled(); |
| 59 | |
| 60 | function checkInstalled() { |
| 61 | switch (browser) { |
| 62 | case 'chrome': |
| 63 | case 'opera': { |
| 64 | chrome.runtime.sendMessage(EXT_ID, { message: 'version' }, (resp) => { |
| 65 | if (resp) { |
| 66 | setInstalled(); |
| 67 | } |
| 68 | }); |
| 69 | break; |
| 70 | } |
| 71 | case 'mozilla': { |
| 72 | let timer = setInterval(() => { |
| 73 | if (document.body.getAttribute('data-github-hovercard')) { |
| 74 | setInstalled(); |
| 75 | clearTimeout(timer); |
| 76 | } |
| 77 | }, 100); |
| 78 | break; |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | function setInstalled(isInstalledNow) { |
| 84 | $installBtn.text('Installed').prop('disabled', true).addClass('disabled'); |
no test coverage detected