MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / open_link

Function open_link

wasm/open_link.js:1–34  ·  view source on GitHub ↗
(link)

Source from the content-addressed store, hash-verified

1var 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}

Callers 1

OpenLinkFunction · 0.85

Calls 6

is_iosFunction · 0.85
is_macFunction · 0.85
is_safariFunction · 0.85
createOverlayPopupFunction · 0.85
removeKeyboardEventsFunction · 0.85
openMethod · 0.80

Tested by

no test coverage detected