Download tasks/leetcode/environment/reference/clone/static/js/home.js from TIGER-Lab/WebsiteBench: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/leetcode/environment/reference/clone/static/js/home.js
- Command line
-
hf download hf://datasets/TIGER-Lab/WebsiteBench/tasks/leetcode/environment/reference/clone/static/js/home.js
-
curl -L -o home.js https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/leetcode/environment/reference/clone/static/js/home.js
1.35 kB
| /* Home page: the Developer section's Playground sample switcher. | |
| * The captured desktop page uses a list of links; the captured mobile page | |
| * uses a native select. Both drive the same code panel here. */ | |
| (function () { | |
| "use strict"; | |
| var panel = document.querySelector("[data-playground-code]"); | |
| if (!panel) { | |
| return; | |
| } | |
| var sources = Array.prototype.map.call( | |
| document.querySelectorAll("[data-playground-source]"), | |
| function (node) { | |
| return node.innerHTML; | |
| } | |
| ); | |
| var tabs = Array.prototype.slice.call( | |
| document.querySelectorAll("[data-playground-tab]") | |
| ); | |
| var select = document.querySelector("[data-playground-select]"); | |
| function show(index) { | |
| if (index < 0 || index >= sources.length) { | |
| return; | |
| } | |
| panel.innerHTML = sources[index]; | |
| tabs.forEach(function (tab, position) { | |
| var active = position === index; | |
| tab.classList.toggle("is-active", active); | |
| tab.setAttribute("aria-selected", active ? "true" : "false"); | |
| }); | |
| if (select && Number(select.value) !== index) { | |
| select.value = String(index); | |
| } | |
| } | |
| tabs.forEach(function (tab, index) { | |
| tab.addEventListener("click", function () { | |
| show(index); | |
| }); | |
| }); | |
| if (select) { | |
| select.addEventListener("change", function () { | |
| show(Number(select.value)); | |
| }); | |
| } | |
| })(); | |