meeting-scroll.js javascript: void ((() = { /*自动滚动到当前时段 v1.0.0*/ const getHour = (date) = { let d; if (date) { d = new Date(date); } else { d = new Date(); } return d.getHours(); }; const gen = (api) = { return (doms, fn)
javascript: void ((() => { /*自动滚动到当前时段 v1.0.0*/ const getHour = (date) => { let d; if (date) { d = new Date(date); } else { d = new Date(); } return d.getHours(); }; const gen = (api) => { return (doms, fn) => { return Array.prototype[api].call(doms, fn); }; }; const map = gen('map'); const filter = gen('filter'); const condition = (curTime = getHour()) => { return (item) => { return item.textContent.startsWith(curTime); }; }; const getDomTime = (roomDetail) => { const times = roomDetail.querySelectorAll('.time'); const o = filter(times, condition()); if (o.length) { return o[0]; } return null; }; const HeaderHeight = document.querySelector('#schedule-content .description').offsetHeight;/*表头遮盖高度*/ const roomDetail = document.querySelectorAll('.room-detail'); map(roomDetail, item => { let room = getDomTime(item); if (room) { item.scrollTop = room.offsetTop - HeaderHeight; } }); })())