HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<h1>BITCOIN<br>DEFI · DAPPS · LAPPS · APPS · L2 · L3</h1>
<div id="searchWrapper">
<input type="search" id="myFilter" oninput="myFilter()" placeholder=" 🔍 " spellcheck="false">
</div>
<div id="main">
<div class="note">
Assume nothing verified.<br>
Post suggestions as comments https://codepen.io/realcrypto/details/JjXyvyq
</div>
<h3>BASIC BITCOIN STATS</h3>
<div class="container">
[{5 579 710} BTC worth {~344 Billion} USD locked in P2SH smart contracts<br>
https://txstats.com/dashboard/db/p2sh-statistics?orgId=1
{443 009} BTC worth {~27 Billion} USD locked in P2WSH smart contracts (e.g. LN)
https://txstats.com/dashboard/db/p2wsh-statistics?orgId=1
(as of 2021/04/16)
(embedded consensus contracts & tokens not included)]
[Bitcoin development news
https://bitcoinops.org/en/topic-dates/
Bitcoin dashboard
https://bitcoin.clarkmoody.com/dashboard/
Relevant Bitcoin "dominance"
https://codepen.io/realcrypto/live/MWKgXYg]
</div>
<h3>DEX · L2-EX · TRADING</h3>
<div class="container">
[Counterparty layer
https://xchain.io/
https://freewallet.io/
https://counterparty.io/
https://xcpdex.com/
https://dankset.io/]
[Omni layer
https://www.omniwallet.org/dex/overview
https://www.omniwallet.org/exchange/trade
https://omnilab.online/omnibolt/
https://synonym.to/]
[RGB layer
https://www.rgbfaq.com/
https://github.com/RGB-WG
https://rgbex.io/
https://bitmask.app/]
[Tradelayer
http://www.tradelayer.org/]
[Local Trader
https://bluewallet.io/local-trader/]
[Exchange BTC and Amazon items for each other
https://purse.io/earn/btc]
[LN CFD trading
https://lnmarkets.com/]
[Hashrate derivative
trading contracts
https://powswap.com/]
[LN derivatives trading
https://kollider.xyz/]
<sub>Lending / Trading p2p</sub>
[https://bisq.network/]
[https://hodlhodl.com/]
[https://atomic.finance/]
[P2P derivatives
https://github.com/p2pderivatives/p2pderivatives-client]
[https://suredbits.com/]
<sub>Layer 2 atomic swaps</sub>
[https://boltz.exchange/]
[https://ion.radar.tech/redshift]
[https://submarineswaps.org/]
[https://opendex.network/]
<sub>Blockchain atomic swaps</sub>
[https://atomicdex.io/]
[https://blocknet.co/block-dx/]
[(inside wallet) https://beam.mw/]
[https://atomicwallet.io/]
[https://atomex.me/]
[https://stakenet.io/]
[https://switcheo.network/]
</div>
<h3>NFT · NFT TRADING</h3>
<div class="container">
[Crypto Collectibles
https://digirare.com/]
[ArtOlin
https://artolin.org/]
[Rare pepes
http://rarepepedirectory.com/
https://rarepepewallet.com/]
[https://bitcorns.com/]
[https://mafiawars.io/]
[Spells of Genesis
https://sogassets.com/assets
https://spellsofgenesis.com/]
[Gallery of NFTs for BTC address
https://rare.estate/]
[Raretoshi NFT marketplace
(on Liquid)
https://raretoshi.com/]
[LN auctions including NFTs
https://scarce.city/]
</div>
<h3>EARNING</h3>
<div class="container">
[Join Market
https://joinmarket.me/ob/
https://github.com/openoms/joininbox]
<sub>LN Channel Liquidity Leases · LCL</sub>
[Lightning pool
https://lightning.engineering/pool/
https://github.com/lightninglabs/pool]
<sub>LN Routing</sub>
[Zap Desktop
(all-in-one)
https://zaphq.io/
https://github.com/LN-Zap/zap-desktop/releases]
[https://github.com/ACINQ/eclair]
<sub></sub>
[LN to on-chain batching market
http://chainmarket.etleneum.com/]
[P2P Market https://openbazaar.org/]
</div>
<h3>PRIVACY APPS</h3>
<div class="container">
[Join market
(coinjoin)
https://github.com/joinmarket-webui/joinmarket-webui
https://github.com/JoinMarket-Org/joinmarket-clientserver]
[Samourai
(whirlpool coinjoin, BIP47 paynyms, stonewall, stowaway payjoin)
https://samouraiwallet.com/
https://www.whirlpoolfees.com/
https://docs.samourai.io/en/spend-tools]
[https://wasabiwallet.io/]
[Overview
http://www.bitcoinkpis.com/privacy]
[Trackers
https://kycp.org
https://explorer.bitquery.io/bitcoin/address/bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh/graph
https://oxt.me/]
[Payjoin list
https://en.bitcoin.it/wiki/PayJoin_adoption]
</div>
<h3>LN APPS · DAPPS</h3>
<div class="container">
<sub>Better reference lists of "lapps"</sub>
[https://www.lapps.co/all-time]
[https://dev.lightning.community/lapps/index.html]
[https://lnroute.com/category/games]
[https://etleneum.com/#/contracts]
<sub></sub>
[L3 VPN over LN
https://www.impervious.ai/]
<sub>L3 Encrypted messaging/chat/chatrooms over LN</sub>
[Sphinx
https://sphinx.chat/
https://tribes.sphinx.chat/]
[Juggernaut
https://www.getjuggernaut.com/]
[Zion https://www.getzion.com/]
<sub></sub>
[Fundraising · Crowdfunding
https://tallyco.in/]
[LN auctions for art
https://scarce.city/]
[File sharing
(pay to get)
https://poof.run/]
[Pay per pixel
https://sparkshot.io/]
[Y'alls
(Blogs readable after LN payment)
https://yalls.org/]
<sub>Paid for tasks</sub>
[https://kriptode.com/satsforlikes/index.html]
[https://app.paid.co/]
[https://www.stakwork.com/]
[https://microlancer.io/]
[https://www.earnsats.co/]
[https://bitcoin4photos.net/]
[https://www.smilesbitcoin.com/]
<sub>Games</sub>
[https://lightning-poker.com/]
[https://bitcoinbountyhunt.com/]
[https://lightnite.io/]
[https://zebedee.io/]
[https://satoshis.games/]
[https://thndr.games/games]
[https://escapeqr.com/]
[Chess challenge on lichess
https://lichess.etleneum.com/]
[https://fair.poker/]
[https://lightningpuzzle.com/]
[https://lngames.net/]
[https://moneni.com/]
</div>
<h3>WITHOUT INTERNET</h3>
<div class="container">
[https://locha.io/]
[https://txtenna.com/]
[Blockstream Satelite
https://blockstream.com/satellite/
https://spacebit.live/]
</div>
<h3>PAYMENTS · FIAT BRIDGES</h3>
<div class="container">
[Send fiat via LN
https://beta.strike.me/]
[Exchanges & services w/o KYC
https://kycnot.me/]
<sub>Cash-back in Bitcoin</sub>
[https://www.lolli.com/]
[https://foldapp.com/ (app or card)]
<sub>Accepting payments / processor</sub>
[BTCPay Server (self-custodial) https://btcpayserver.org/]
[tuxpay (self-custodial) https://github.com/blakebjorn/tuxpay]
[bitrequest (self-custodial) https://www.bitrequest.io/]
[https://www.opennode.com/]
[https://coingate.com/supported-currencies]
[https://paywithmoon.com/]
[https://www.coinpayments.net/supported-coins-all]
[https://lnpay.co/paywall]
[https://bittery.io/]
[https://www.chainside.net/en/home/]
[List of https://github.com/alexk111/awesome-bitcoin-payment-processors]
<sub>Onboarding</sub>
[https://www.bitrefill.com/]
[https://escher.app/en]
[https://bottlepay.com/]
</div>
<h3>MORE APPS · DAPPS</h3>
<div class="container">
[Decentralized websites with Bitcoin and torrents
https://zeronet.io/
https://github.com/HelloZeroNet/zeronet.io]
[Bitcoin Timelock
https://coinb.in/#newTimeLocked]
[Insurance Transaction Crafter
https://github.com/lacksfish/insure-gui]
[Open timestamps
(Prove something existed at certain time)
(Stamp tweets by replying w/: @tweet_stamp stamp)
https://opentimestamps.org/
https://twitter.com/tweet_stamp]
[Encrypted secret messaging via blockchain
https://wiki.bitmessage.org/Main_Page]
[Write messages to blockchain
https://opreturnbot.com/]
[Customizable derivatives
(DLC oracles)
https://github.com/bitcoin-s/krystal-bull
https://suredbits.com/]
["ION Decentralized identity"<br>
by Microsoft
https://github.com/decentralized-identity/ion]
[Multisig wallet generator
https://coinb.in/#newMultiSig]
[Embed messages in addresses
https://btcmessage.com/]
[Vanity addresses generator w/ split key
https://nicewalletaddress.com/
https://vanity.coin.dance/]
[Counterparty project list
https://counterparty.io/projects/]
[Bitcoin Trust Network
(on-chain website reporting)
https://bitcointrustnetwork.com/]
<sub>Prediction & Betting markets</sub>
[https://predictions.hodlhodl.com/]
[https://www.betmoose.com/]
[https://github.com/bitcoin-hivemind/hivemind]
[https://atomic.finance/odds/]
<sub>More in other sections</sub>
</div>
<h3>WALLETS</h3>
<div class="container">
<sub>Wallet choosing guides</sub>
[https://bitcoin.org/en/choose-your-wallet]
[https://bitcoin-only.com/#wallets]
[https://bitcoinops.org/en/compatibility/]
[https://bitcoin-hardware-wallet.github.io/]
[https://lightningnetworkstores.com/wallets]
[https://www.block123.com/en/feature/lightning-mobile-wallets-list]
[https://counterparty.io/wallets/]
<sub>LN - mobile - UX focus</sub>
[Breez Wallet
(podcasts, apps)
https://breez.technology/]
[Muun Wallet
https://muun.com/]
[Phoenix Wallet
https://phoenix.acinq.co/]
[https://www.walletofsatoshi.com/]
[https://blixtwallet.github.io/]
[zebedee
(custodial, static lnurl-pay qr codes)
https://zbd.gg/]
[BlueWallet
(custodial or via your own server)
https://bluewallet.io/lightning/]
[Wallet of Satoshi (custodial) https://www.walletofsatoshi.com/]
[Blixt https://blixtwallet.github.io/]
<sub>LN - for/in browser</sub>
[https://lightningjoule.com/]
[https://getalby.com/]
[https://bitmask.app/]
[CoinOS
(Custodial LN/Liquid/BTC)
(non-custodial Liquid/BTC)
https://coinos.io/]
[List of custodial accounts with LN
https://cointastical.medium.com/exchanges-with-support-for-bitcoin-lightning-network-payments-739829bcb7bc]
<sub>LN - mobile - manual channels</sub>
[Eclair (EOL)
https://play.google.com/store/apps/details?id=fr.acinq.eclair.wallet.mainnet2]
[nayuta https://medium.com/nayuta-en/nayuta-core-v-0-3-2-a-mobile-wallet-for-bitcoin-and-lightning-adds-extensions-to-lapps-604c6b504713]
[Simple Bitcoin Wallet https://sbw.app/]
<sub>On-chain focus - mobile</sub>
[https://bluewallet.io/ (remote LN node support or custodial)]
[https://pine.pm/ (UX focus, ln part in beta)]
[Samourai Wallet
(Stonewall, PayNym, Batching, Ricochet, Whirlpool)
(Cahoots, Coinjoin, privacy mixing)
https://samouraiwallet.com/]
[https://hexawallet.io/]
[Mobile full node (pruned)
https://play.google.com/store/apps/details?id=com.greenaddress.abcore]
[Bitcoin nodes in browser (pruned or csv)
https://bcoin.io/browser/]
<sub>On-chain - Desktop</sub>
[Samourai Dojo
(Stonewall, PayNym, Batching, Ricochet, Whirlpool)
(Cahoots, Coinjoin, privacy mixing)
https://samouraiwallet.com/dojo]
[Wasabi Wallet
(Tor, CoinJoin, privacy mixing)
https://www.wasabiwallet.io/]
[Bitcoin Core
(reference client)
https://bitcoin.org/en/bitcoin-core/]
[Alternative implementation of reference client
https://bitcoinknots.org/]
[Specter wallet https://specter.solutions/]
[Sparrow Wallet https://sparrowwallet.com/]
<sub>LN enabled - Desktop</sub>
[Umbrel
(Full Node & LN UI for Pi/Linux)
(1 click install addons)
https://getumbrel.com/]
[Citadel https://runcitadel.space/]
[Zap Desktop
(Routes w/ separate lnd node
all-in-one is user-only for now)
https://zaphq.io/
https://github.com/LN-Zap/zap-desktop/releases]
[https://github.com/ACINQ/eclair]
[https://zeusln.app/]
[https://mynodebtc.github.io/]
[https://start9.com/]
[https://raspiblitz.org/]
<sub>Tools</sub>
[mempool.space explorer (open source)
https://mempool.space/
https://github.com/mempool/mempool]
[esplora explorer (open source)
https://blockstream.info/
https://github.com/Blockstream/esplora]
[Lightning Terminal
(LN node management)
(submarine swap service)
(liquidity lending market)
https://github.com/lightninglabs/lightning-terminal
https://terminal.lightning.engineering/]
[Ride The Lightning (RTL)
(LN node management)
https://github.com/Ride-The-Lightning/RTL]
[Thunderhub
(LN node management)
https://thunderhub.io/
https://github.com/apotdevin/thunderhub]
<sub>Unique</sub>
[emoji based wallet
https://stepansnigirev.github.io/emoji-wallet/]
</div>
<h3>SERVICES</h3>
<div class="container">
[("Bitcoin native financial services: collaborative
multisig vaults, loans, and buy bitcoin OTC")
https://unchained-capital.com/ ]
<sub>Loans, lending</sub>
[https://blockfi.com/]
[https://nexo.io/borrow]
<sub>Onboarding</sub>
[Send BTC to phone numbers
http://sat2.io/]
<sub>Lightning</sub>
[Getting in-bound liquidity
https://plebnet.wiki/wiki/Getting_Inbound_Liquidity]
[Cloud nodes https://voltage.cloud/]
[Channel recommendations https://lnrouter.app/]
</div>
<h3>STORES · SHOPS</h3>
<div class="container">
[PC games
https://joltfun.com/]
[Pizza over LN
https://ln.pizza/]
[LN SMS sending service
https://lnsms.world/]
[Write data to blockchain
https://bitscribble.com/]
<sub>Other's lists</sub>
[Search items sold for BTC
https://spendabit.co/]
[LN Stores
https://lightningnetworkstores.com/]
[Lopp's list
https://www.lopp.net/bitcoin-information/merchant-adoption.html]
[bitcoin-only's list
https://bitcoin-only.com/#spend-bitcoin]
</div>
<h3>CONNECTED BLOCKCHAINS</h3>
<div class="container">
<sub>Federated sidechains</sub>
[Liquid
https://blockstream.com/liquid/]
[Rootstock RSK
https://www.rifos.org/
https://www.rsk.co/
https://moneyonchain.com/
https://live.sovryn.app/]
[https://defichain.com/
https://www.cakedefi.com/]
[https://hazama.io/lp.html]
[https://www.commerceblock.com/]
<sub>Commits on Bitcoin</sub>
[https://www.veriblock.org/]
</div>
<h3>CHICKEN</h3>
<div class="container">
[web 5.0
https://pollofeed.com/]
</div>
</div>
<br>
<h1>INFO SOURCES</h1>
<div id="other">
<h3>Fund Bitcoin Developers</h3>
<div class="container">
[Bitcoin Donation Portal
https://bitcoindevlist.com/]
</div>
<h3>News & articles</h3>
<div class="container">
[Weekly dev updates & more https://bitcoinops.org/]
[Bitcoin-focused articles https://bitcoinmagazine.com/]
[Community magazine https://www.citadel21.com/]
</div>
<h3>Devs</h3>
<div class="container">
[bitcoinjs for webapps
https://github.com/bitcoinjs/bitcoinjs-lib]
[Bitcoin-only's dev resources list
https://bitcoin-only.com/#dev-tools]
[Lopp's dev resources list
https://www.lopp.net/bitcoin-information/developer-tools.html]
[Miniscript playgrounds
http://bitcoin.sipa.be/miniscript/
https://magicalbitcoin.org/repl/playground/]
[Script playground
https://siminchen.github.io/bitcoinIDE/build/editor.html]
[Ivy playground
https://ivylang.org/bitcoin]
</div>
<h3>Tools</h3>
<div class="container">
[https://walletsrecovery.org/]
[Mnemonic generator BIP39
https://iancoleman.io/bip39/]
[paper, shared, split, vanity wallets generator
https://www.bitaddress.org/]
</div>
<h3>Visualizations</h3>
<div class="container">
[https://opreturn.org/]
[TxStats
https://txstats.com/]
[Script types
https://btc.com/stats/script?time_range=all&latest_block=646354&static_type=count_stats]
[https://utxo-stats.com/]
[Node counts by node version
http://luke.dashjr.org/programs/bitcoin/files/charts/branches.html]
[Visual transactions
https://yogh.io/
https://nioctib.tech/]
[Block size
https://bitcoinvisuals.com/chain-block-size]
[Coinmetrics transfers by count and value
https://coinmetrics.io/charts/#assets=btc_log=false_roll=7_left=TxTfrCnt_zoom=1310566023529.4119,1624284423529.4119
https://coinmetrics.io/charts/#assets=btc_log=false_roll=7_left=TxTfrValAdjUSD_zoom=1310566023529.4119,1624284423529.4119]
[Privacy tool stats
https://bitcoinkpis.com/privacy]
[Privacy transaction analysis
https://kycp.org/
https://oxt.me/]
</div>
<h3>VR Hangouts</h3>
<div class="container">
[https://bitpaint.club/]
[https://citadellevr.space/]
[Weekly presentations
https://www.recklessvr.com/]
</div>
</div>
<br><br><br><br>
@import url("https://fonts.googleapis.com/css2?family=Lato:[email protected]&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Nunito:[email protected];400&display=swap");
html,
body,
div,
pre,
h1,
h3,
sub,
input,
nav,
a {
padding: 0;
margin: 0;
box-sizing: border-box;
cursor: default;
}
pre {
font-family: inherit;
}
html {
font-size: calc(15px + 0.2vw);
}
body {
font-family: sans-serif;
background-attachment: fixed;
text-align: center;
background-image: linear-gradient(30deg, #0093e950 0%, #80d0c733 100%);
color: #000000;
font-size: 1.4rem;
font-weight: 300;
line-height: 1.4;
font-family: "Nunito", sans-serif;
overflow-x: hidden;
}
#main,
#other {
max-width: calc(75vmax);
margin: 0 auto;
}
a {
font-size: 1rem;
text-decoration: none;
border-radius: 0.1rem;
padding: 0.05rem 0.75rem;
margin: 0.1rem 0;
color: #00000088;
cursor: pointer;
}
.container a {
color: #ffd700d5;
word-break: normal;
display: block;
min-width: 0;
word-break: break-word;
}
a:hover {
background-color: #00000099;
color: #ffd700;
transition: background-color 0.05s;
}
h1,
h3 {
color: #ff7b00;
font-family: Lato;
text-shadow: -1px -1px 0px #44444422;
}
h1 {
font-size: 2.7rem;
line-height: 1.1;
padding: 1rem;
margin-top: 2rem;
}
h3 {
width: 100%;
font-size: 2rem;
display: inline-block;
margin-top: 3rem;
margin-bottom: 1.5rem;
}
sub {
color: #000c;
display: block;
margin-top: 1rem;
padding: 0.5rem;
font-size: 1.25rem;
flex-basis: 100%;
}
.comment {
color: #ffffff99;
display: block;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
line-height: 1.1;
font-size: 1rem;
}
.note {
font-size: 1rem;
color: #0009;
padding: 1em;
padding-bottom: 0;
line-height: 1.7;
}
.container {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: stretch;
flex-wrap: wrap;
padding: 0 5vmin;
}
.item {
color: #ffffff;
flex: 1 0 0;
background-color: #000c;
padding: 0.5rem 1.5rem;
margin: 0.25rem;
border-radius: 0.3rem;
display: grid;
line-height: 1.4;
place-items: center;
transition: background-color 0.05s;
min-width: 20rem;
}
.highlight {
display: inline-block;
color: #08f26ede;
}
#myFilter {
outline: none;
box-shadow: none;
width: 100%;
border: none;
border-radius: 0.3rem;
padding: 0.3rem;
font-size: 1.1rem;
text-align: center;
color: #00000080;
filter: saturate(0);
}
#searchWrapper {
margin: 1rem auto;
width: 20rem;
position: sticky;
top: 0.1rem;
}
#myFilter::placeholder {
color: #00000030;
text-align: left;
}
.minime {
font-size: 50%;
margin: 0;
margin-top: 2rem;
}
h3,
sub {
cursor: pointer;
}
h3:hover,
sub:hover {
background-color: #ffffff33;
}
const NUM_LETTERS_TO_KEEP = 40;
const changeText = (name) => {
const allText = window[name].innerHTML;
// replace text urls with formatted anchor tags
const pattern = /(\b(https?):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
let fixedText = allText;
// replace square brackets w/ item div
fixedText = fixedText.replace(/(\[)([\s\S]+?)(\])/g, (match, p1, p2) => {
return `<div class='item'><div>${p2.trim()}</div></div>`;
});
fixedText = fixedText.replace(pattern, (url) => {
// make matches prettier
let shortUrl = url
.replace("https://", "")
.replace("http://", "")
.replace("www.", "");
if (shortUrl.endsWith("/")) shortUrl = shortUrl.slice(0, -1);
return `<a href="${url}" target="_blank">${
shortUrl.length > NUM_LETTERS_TO_KEEP
? ".." + shortUrl.slice(-NUM_LETTERS_TO_KEEP)
: shortUrl
}</a>`;
});
// replace stuff inside () with styling span
fixedText = fixedText.replace(
/(\()([\s\S]*?)(\))/g,
'<span class="comment">$2</span>'
);
// replace stuff inside {} with styling span
fixedText = fixedText.replace(
/(\{)([\s\S]*?)(\})/g,
'<span class="highlight">$2</span>'
);
// update html
window[name].innerHTML = fixedText;
};
// simplest filter
const myFilter = () => {
const defaultItemDisplay = "grid";
const defaultContainerDisplay = "flex";
filter = window.myFilter.value.trim().toUpperCase();
containers = document.getElementsByClassName("container");
for (const container of containers) {
container.style.display = "none";
title = container.previousElementSibling;
title.classList.add("minime");
const titleMatch = title.innerHTML.toUpperCase().indexOf(filter) != -1;
// for each container div check match with title, otherwise items
for (const item of container.childNodes) {
const itemMatch = item.innerHTML?.toUpperCase().indexOf(filter) != -1;
if (item.innerHTML) {
if (titleMatch || itemMatch) {
container.style.display = defaultContainerDisplay;
title.classList.remove("minime");
item.style.display = defaultItemDisplay;
} else {
item.style.display = "none";
}
}
}
}
};
const resetFiltersOnTitleClick = () => {
const resetItems = [
...document.getElementsByTagName("h3"),
...document.getElementsByTagName("sub")
];
for (const item of resetItems) {
item.onclick = () => {
window.myFilter.value = "";
myFilter();
item.scrollIntoView({ block: "center" });
};
}
};
window.onload = () => {
// apply replacing function to following id
changeText("main");
changeText("other");
resetFiltersOnTitleClick();
};
Also see: Tab Triggers