Links in FirePad
How do I make an links in firepad?
What is a links in firepad? How do you make a links in firepad? This script and codes were developed by Ken Lane on 25 October 2022, Tuesday.
Links in FirePad - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Links in FirePad</title>
</head>
<body> <html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.17.0/codemirror.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.17.0/codemirror.css"/>
<style> html, body { height:100%; } .CodeMirror .cm-url { color: blue; } .pop-url { color: blue; cursor:pointer; } button {background:white;} .pop-url:hover { text-decoration:underline; }
</style>
</head>
<body>
<script>
var cm = CodeMirror(document.body);
cm.setValue('Hover over the links below and then click the pop-up link to open page in a new window.\n------------------------------------------------------\nlink1 https://plnkr.co/edit/5m31E14HUEhSXrXtOkNJ some text\nlink2 google.com\nlink3 szl.it\nlink4 tanjo.ai');
hyperlinkOverlay(cm);
function hoverWidgetOnOverlay(cm, overlayClass, widget) { cm.addWidget({line:0, ch:0}, widget, true); widget.style.position = 'fixed'; widget.style.zIndex=100000; widget.style.top=widget.style.left='-1000px'; // hide it widget.dataset.token=null; cm.getWrapperElement().addEventListener('mousemove', e => { let onToken=e.target.classList.contains("cm-"+overlayClass), onWidget=(e.target===widget || widget.contains(e.target)); if (onToken && e.target.innerText!==widget.dataset.token) { // entered token, show widget var rect = e.target.getBoundingClientRect(); widget.style.left=rect.left+'px'; widget.style.top=rect.bottom+'px'; //let charCoords=cm.charCoords(cm.coordsChar({ left: e.pageX, top:e.pageY })); //widget.style.left=(e.pageX-5)+'px'; //widget.style.top=(cm.charCoords(cm.coordsChar({ left: e.pageX, top:e.pageY })).bottom-1)+'px'; widget.dataset.token=e.target.innerText; widget.innerHTML = '→ <span class="pop-url">'+ widget.dataset.token +'</span>'; if (typeof widget.onShown==='function') widget.onShown(); } else if ((e.target===widget || widget.contains(e.target))) { // entered widget, call widget.onEntered if (widget.dataset.entered==='true' && typeof widget.onEntered==='function') widget.onEntered(); widget.dataset.entered='true'; } else if (!onToken && widget.style.left!=='-1000px') { // we stepped outside widget.style.top=widget.style.left='-1000px'; // hide it delete widget.dataset.token; widget.dataset.entered='false'; if (typeof widget.onHidden==='function') widget.onHidden(); } return true; });
}
function hyperlinkOverlay(cm) { if (!cm) return; const rx_word = "\" "; // Define what separates a word function isUrl(s) { if (!isUrl.rx_url) { // taken from https://gist.github.com/dperini/729294 isUrl.rx_url=/^(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,}))\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/i; // valid prefixes isUrl.prefixes=['http:\/\/', 'https:\/\/', 'ftp:\/\/', 'www.']; // taken from https://w3techs.com/technologies/overview/top_level_domain/all isUrl.domains=['com','ru','net','org','de','jp','uk','br','pl','in','it','fr','au','info','nl','ir','cn','es','cz','kr','ua','ca','eu','biz','za','gr','co','ro','se','tw','mx','vn','tr','ch','hu','at','be','dk','tv','me','ar','no','us','sk','xyz','fi','id','cl','by','nz','il','ie','pt','kz','io','my','lt','hk','cc','sg','edu','pk','su','bg','th','top','lv','hr','pe','club','rs','ae','az','si','ph','pro','ng','tk','ee','asia','mobi', 'ai']; } if (!isUrl.rx_url.test(s)) return false; for (let i=0; i<isUrl.prefixes.length; i++) if (s.startsWith(isUrl.prefixes[i])) return true; for (let i=0; i<isUrl.domains.length; i++) if (s.endsWith('.'+isUrl.domains[i]) || s.includes('.'+isUrl.domains[i]+'\/') ||s.includes('.'+isUrl.domains[i]+'?')) return true; return false; } cm.addOverlay({ token: function(stream) { let ch = stream.peek(); let word = ""; if (rx_word.includes(ch) || ch==='\uE000' || ch==='\uE001') { stream.next(); return null; } while ((ch = stream.peek()) && !rx_word.includes(ch)) { word += ch; stream.next(); } if (isUrl(word)) return "url"; // CSS class: cm-url }}, { opaque : true } // opaque will remove any spelling overlay etc ); let widget=document.createElement('button'); widget.innerHTML='→'; widget.onclick=function(e) { if (!widget.dataset.token) return; let link=widget.dataset.token; if (!(new RegExp('^(?:(?:https?|ftp):\/\/)', 'i')).test(link)) link="http:\/\/"+link; window.open(link, '_blank'); return true; }; hoverWidgetOnOverlay(cm, 'url', widget);
}
</script>
</body>
</html>
</body>
</html>
Developer | Ken Lane |
Username | kenlane22 |
Uploaded | October 25, 2022 |
Rating | 3 |
Size | 3,201 Kb |
Views | 16,192 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
CSS Box Shadow on Left and Right Only For Tab UI | 2,502 Kb |
ZoomCards | 2,926 Kb |
Twinkling Word Cloud React | 3,705 Kb |
PinGame3 | 18,875 Kb |
Word Array Into Sentences | 2,953 Kb |
Pin Game2 | 18,417 Kb |
Magnify Linked Page Area | 7,515 Kb |
A Pen by Ken Lane | 1,707 Kb |
Filter Buttons With Count | 3,183 Kb |
CSS Tab UI with SVG diagonal lines | 4,405 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Sony Xperia Z3 Flat MockUp | Dapinitial | 4,379 Kb |
Calculator | Rzencoder | 4,572 Kb |
A vuejs widget | Chrgl86 | 2,869 Kb |
Twitch API | Coderpilot | 3,412 Kb |
CSS3 Selectables with information rollover | Jasonmayes | 9,565 Kb |
Long Shadow Button | Uixcrazy | 3,550 Kb |
Force Counter | Kenlauguico | 2,732 Kb |
Mini Profile | Frytyler | 3,828 Kb |
Pruebas de d3.js | Juanmanuelcarnerero | 2,485 Kb |
Birthday Party Starter | Aussieyang | 1,629 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!