()
| 449 | } |
| 450 | `) |
| 451 | function showConfig() { |
| 452 | const modalHTML = ` |
| 453 | <div class="modal-overlay"> |
| 454 | <div class="modal-content"> |
| 455 | <h3 class="modal-title">${translate.gui_title}</h3> |
| 456 | <p class="modal-description">${translate.gui_tokeninput} |
| 457 | <a href="https://github.com/settings/tokens/new?description=Web%20Clipper%20Token%20UserScript&scopes=repo" target="_blank" rel="noopener noreferrer">${translate.gui_github_generate}</a> |
| 458 | </p> |
| 459 | <input type="text" id="github-token-input" class="gui-input" placeholder="${translate.gui_tokeninput}"> |
| 460 | <p class="modal-description">${translate.gui_github_owner}</p> |
| 461 | <input type="text" id="github-owner-input" class="gui-input" placeholder="${translate.gui_github_owner}"> |
| 462 | <p class="modal-description">${translate.gui_github_repo}</p> |
| 463 | <input type="text" id="github-repo-input" class="gui-input" placeholder="${translate.gui_github_repo}"> |
| 464 | <button id="save-token">${translate.gui_save}</button> |
| 465 | <button id="cancel-token" class="cancel">${translate.gui_cancel}</button> |
| 466 | </div> |
| 467 | </div> |
| 468 | ` |
| 469 | const modalContainer = document.createElement('div') |
| 470 | modalContainer.innerHTML = modalHTML |
| 471 | document.body.appendChild(modalContainer) |
| 472 | const elements = { |
| 473 | token: modalContainer.querySelector('#github-token-input'), |
| 474 | owner: modalContainer.querySelector('#github-owner-input'), |
| 475 | repo: modalContainer.querySelector('#github-repo-input'), |
| 476 | saveButton: modalContainer.querySelector('#save-token'), |
| 477 | cancelButton: modalContainer.querySelector('#cancel-token') |
| 478 | } |
| 479 | elements.token.value = GM_getValue('github_token', '') |
| 480 | elements.owner.value = GM_getValue('OWNER', '') |
| 481 | elements.repo.value = GM_getValue('REPO', '') |
| 482 | elements.saveButton.addEventListener('click', () => { |
| 483 | if (elements.token.value && elements.owner.value && elements.repo.value) { |
| 484 | GM_setValue('github_token', elements.token.value) |
| 485 | GM_setValue('OWNER', elements.owner.value) |
| 486 | GM_setValue('REPO', elements.repo.value) |
| 487 | modalContainer.remove() |
| 488 | } else { |
| 489 | alert(`${translate.configure}`) |
| 490 | } |
| 491 | }) |
| 492 | elements.cancelButton.addEventListener('click', () => modalContainer.remove()) |
| 493 | } |
| 494 | function showDialog(info, link) { |
| 495 | const modalHTML = ` |
| 496 | <div class="modal-overlay"> |
no outgoing calls
no test coverage detected