MCPcopy Create free account
hub / github.com/breck7/scroll / addExpandButtons

Method addExpandButtons

external/.tableSearch.js:183–199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

181 }
182
183 addExpandButtons() {
184 let buttons = document.querySelectorAll(".buttons-copy")
185
186 buttons.forEach(button => {
187 let ariaControls = button.getAttribute("aria-controls")
188 let newHTML = `<button id="expandToggle${ariaControls}" aria-controls="${ariaControls}" class="dt-button buttons-html5 expandCollapseButton" tabindex="1" type="button"><span>Expand</span></button>`
189
190 button.insertAdjacentHTML("afterend", newHTML)
191
192 let newButton = document.getElementById(`expandToggle${ariaControls}`)
193
194 newButton.onclick = function () {
195 this.innerHTML = this.innerHTML.includes("Expand") ? "Collapse" : "Expand"
196 document.querySelector("#" + ariaControls).classList.toggle("expandedTable")
197 }
198 })
199 }
200
201 get orderFromHash() {
202 const order = this.objectFromHash.order

Callers 1

createDatatableMethod · 0.95

Calls 4

forEachMethod · 0.80
getAttributeMethod · 0.80
getElementByIdMethod · 0.45
toggleMethod · 0.45

Tested by

no test coverage detected