Files
SnowLuma/.pnpm-store/v11/files/97/602c370d6a9f3c47b99fa70143613f9231e125b8085c76c1dca69950aa081ddb28d4955d26e6d542eb841d411d3bb14056be96b6d01e724de0d332b3d314f6
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

53 lines
1.3 KiB
Plaintext

exports.setLocation = function setLocation(
isReplace,
activeSort,
isFlat,
activeFilters,
fileFilter,
expandedLines
) {
const params = [
activeSort.sortKey,
activeSort.order,
isFlat,
activeFilters.low,
activeFilters.medium,
activeFilters.high,
encodeURIComponent(fileFilter),
expandedLines.map(encodeURIComponent).join(',')
];
const newUrl = `#${params.join('/')}`;
if (newUrl === location.hash) {
return;
}
window.history[isReplace ? 'replaceState' : 'pushState'](null, '', newUrl);
};
exports.decodeLocation = function decodeLocation() {
const items = location.hash.substr(1).split('/');
if (items.length !== 8) {
return null;
}
try {
return {
activeSort: {
sortKey: items[0],
order: items[1]
},
isFlat: JSON.parse(items[2]),
activeFilters: {
low: JSON.parse(items[3]),
medium: JSON.parse(items[4]),
high: JSON.parse(items[5])
},
fileFilter: decodeURIComponent(items[6]),
expandedLines: items[7].split(',').map(decodeURIComponent)
};
} catch (e) {
return null;
}
};