(examples)
| 49 | } |
| 50 | |
| 51 | function createTabs(examples) { |
| 52 | const languages = Object.keys(examples); |
| 53 | let tabs = '<div class="tabs-overview-container"><div class="tabs-overview">'; |
| 54 | let content = '<div class="tab-content">'; |
| 55 | |
| 56 | languages.forEach((lang, index) => { |
| 57 | const hash = hashString(examples[lang]); |
| 58 | tabs += `<button class="tab-button ${index === 0 ? 'active' : ''}" onclick="openTab(event, '${lang}')"><b class="tab-title" title=" ${lang} "> ${lang} </b></button>`; |
| 59 | content += `<div id="${lang}" class="tabcontent" style="display: ${index === 0 ? 'block' : 'none'};"> |
| 60 | <div class="doxygen-awesome-fragment-wrapper"> |
| 61 | <div class="fragment"> |
| 62 | ${examples[lang].split('\n').map(line => `<div class="line">${line}</div>`).join('')} |
| 63 | </div> |
| 64 | <doxygen-awesome-fragment-copy-button id="copy-button-${lang}-${hash}" title="Copy to clipboard"> |
| 65 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"> |
| 66 | <path d="M0 0h24v24H0V0z" fill="none"></path> |
| 67 | <path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path> |
| 68 | </svg> |
| 69 | </doxygen-awesome-fragment-copy-button> |
| 70 | </div> |
| 71 | </div>`; |
| 72 | }); |
| 73 | |
| 74 | tabs += '</div></div>'; |
| 75 | content += '</div>'; |
| 76 | |
| 77 | setTimeout(() => { |
| 78 | languages.forEach((lang, index) => { |
| 79 | const hash = hashString(examples[lang]); |
| 80 | const copyButton = document.getElementById(`copy-button-${lang}-${hash}`); |
| 81 | copyButton.addEventListener('click', copyContent); |
| 82 | }); |
| 83 | }, 0); |
| 84 | |
| 85 | return tabs + content; |
| 86 | } |
| 87 | |
| 88 | function copyContent() { |
| 89 | const content = this.previousElementSibling.cloneNode(true); |
nothing calls this directly
no test coverage detected