(link)
| 1 | var open_link = function (link) { |
| 2 | if ( !is_ios() && !(is_mac() && is_safari()) ) |
| 3 | { |
| 4 | window.open( link ); |
| 5 | return; |
| 6 | } |
| 7 | |
| 8 | var { overlay, popup } = createOverlayPopup('open_link_dialog', '', 200, 100); |
| 9 | |
| 10 | var linkItem = document.createElement('a'); |
| 11 | linkItem.setAttribute('href', link); |
| 12 | linkItem.innerHTML = 'Follow link'; |
| 13 | linkItem.setAttribute('target', '_blank'); |
| 14 | linkItem.setAttribute('onclick', 'document.getElementById(\'open_link_dialog\').remove(),addKeyboardEvents()'); |
| 15 | linkItem.setAttribute('style', |
| 16 | 'position: absolute;\ |
| 17 | width: 100px;height: 28px;\ |
| 18 | top: 50%;left: 50%;\ |
| 19 | transform: translate(-50%, -50%);\ |
| 20 | border-radius: 4px;color: #fff;\ |
| 21 | font-size: 14px;\ |
| 22 | font-weight: 600;\ |
| 23 | border: none;\ |
| 24 | display: flex;\ |
| 25 | align-items: center;\ |
| 26 | justify-content: center;'); |
| 27 | linkItem.setAttribute('class', 'button'); |
| 28 | |
| 29 | popup.appendChild(linkItem); |
| 30 | overlay.appendChild(popup); |
| 31 | |
| 32 | removeKeyboardEvents(); |
| 33 | document.body.appendChild(overlay); |
| 34 | } |
no test coverage detected