MCPcopy Create free account
hub / github.com/GCWing/BitFun / init

Function init

MiniApp/Demo/git-graph/source/ui.js:1799–1863  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1797 const STORAGE_KEY = window.__GG.STORAGE_KEY;
1798
1799 function init() {
1800 $('btn-open-repo').addEventListener('click', window.__GG.openRepo);
1801 $('btn-empty-open').addEventListener('click', window.__GG.openRepo);
1802 $('btn-close-detail').addEventListener('click', window.__GG.closeDetail);
1803 $('btn-refresh').addEventListener('click', function () { window.__GG.loadRepo(); });
1804 $('btn-remotes').addEventListener('click', window.__GG.showRemotePanel);
1805 $('btn-remote-close').addEventListener('click', function () { show($('remote-panel'), false); });
1806 $('btn-find').addEventListener('click', window.__GG.showFindWidget);
1807 $('find-input').addEventListener('input', function () {
1808 state.findQuery = $('find-input').value;
1809 window.__GG.updateFindMatches();
1810 window.__GG.renderCommitList();
1811 $('find-result').textContent = state.findMatches.length > 0 ? (state.findIndex + 1) + ' / ' + state.findMatches.length : '0';
1812 });
1813 $('find-prev').addEventListener('click', window.__GG.findPrev);
1814 $('find-next').addEventListener('click', window.__GG.findNext);
1815 $('find-close').addEventListener('click', function () {
1816 show($('find-widget'), false);
1817 state.findQuery = '';
1818 state.findMatches = [];
1819 window.__GG.renderCommitList();
1820 });
1821 document.addEventListener('keydown', function (e) {
1822 if (e.ctrlKey && e.key === 'f') {
1823 e.preventDefault();
1824 window.__GG.showFindWidget();
1825 }
1826 if ($('find-widget').style.display !== 'none') {
1827 if (e.key === 'Escape') show($('find-widget'), false);
1828 if (e.key === 'Enter') (e.shiftKey ? window.__GG.findPrev : window.__GG.findNext)();
1829 }
1830 });
1831 var loadMore = $('btn-load-more');
1832 if (loadMore) loadMore.addEventListener('click', function () { window.__GG.loadRepo(); });
1833
1834 window.__GG.initDetailResizer();
1835
1836 var branchFilterBtn = $('btn-branch-filter');
1837 if (branchFilterBtn) {
1838 branchFilterBtn.addEventListener('click', function () {
1839 var dropdown = $('branch-filter-dropdown');
1840 var hidden = dropdown.getAttribute('aria-hidden') !== 'false';
1841 dropdown.setAttribute('aria-hidden', String(!hidden));
1842 if (hidden) window.__GG.renderBranchFilterDropdown();
1843 });
1844 }
1845
1846 if (window.app && typeof window.app.onThemeChange === 'function') {
1847 window.app.onThemeChange(function () {
1848 if (state.cwd && $('commit-list').children.length) {
1849 window.__GG.renderCommitList();
1850 }
1851 });
1852 }
1853
1854 (async function () {
1855 try {
1856 var last = await window.app.storage.get(STORAGE_KEY);

Callers 2

ui.jsFile · 0.70
runFunction · 0.50

Calls 4

onThemeChangeMethod · 0.80
addEventListenerMethod · 0.65
$Function · 0.50
getMethod · 0.45

Tested by

no test coverage detected