MCPcopy Create free account
hub / github.com/error311/FileRise / buildZoomControls

Function buildZoomControls

public/js/fileListView.js:5847–5922  ·  view source on GitHub ↗
(host)

Source from the content-addressed store, hash-verified

5845}
5846
5847function buildZoomControls(host) {
5848 const wrap = document.createElement("div");
5849 wrap.className = "vo-control";
5850
5851 const label = document.createElement("div");
5852 label.className = "vo-label";
5853 label.textContent = t("zoom") || "Zoom";
5854
5855 const row = document.createElement("div");
5856 row.className = "vo-slider-row";
5857
5858 const slider = document.createElement("input");
5859 slider.type = "range";
5860 slider.min = "60";
5861 slider.max = "140";
5862 slider.step = "5";
5863 slider.value = currentZoomPercent();
5864 slider.id = "zoomPercentSlider";
5865
5866 const value = document.createElement("span");
5867 value.id = "zoomPercentValue";
5868 value.className = "vo-value";
5869 value.textContent = `${slider.value}%`;
5870
5871 const applyZoom = (pct) => {
5872 const api = window.fileriseZoom;
5873 if (api && typeof api.setPercent === "function") {
5874 api.setPercent(pct);
5875 } else {
5876 document.documentElement.style.setProperty('--app-zoom', String(pct / 100));
5877 }
5878 value.textContent = `${pct}%`;
5879 slider.value = String(pct);
5880 };
5881
5882 slider.addEventListener("input", () => {
5883 applyZoom(parseInt(slider.value, 10));
5884 });
5885
5886 const btnRow = document.createElement("div");
5887 btnRow.className = "vo-zoom-btns";
5888
5889 const mkBtn = (icon, title, handler) => {
5890 const b = document.createElement("button");
5891 b.type = "button";
5892 b.className = "btn btn-sm btn-light vo-zoom-btn";
5893 b.title = title;
5894 b.innerHTML = `<span class="material-icons">${icon}</span>`;
5895 b.addEventListener("click", handler);
5896 return b;
5897 };
5898
5899 btnRow.appendChild(mkBtn("remove", t("zoom_out") || "Zoom out", () => {
5900 const api = window.fileriseZoom;
5901 const next = api && api.out ? api.out() : currentZoomPercent() - 5;
5902 applyZoom(next);
5903 }));
5904 btnRow.appendChild(mkBtn("add", t("zoom_in") || "Zoom in", () => {

Callers 1

showViewOptionsPopoverFunction · 0.85

Calls 5

tFunction · 0.85
currentZoomPercentFunction · 0.85
applyZoomFunction · 0.85
mkBtnFunction · 0.85
outMethod · 0.80

Tested by

no test coverage detected