1.获取一周日期数组
前一周
[...Array(7).keys()].map(days => new Date(Date.now() - 86400000 * days));
后一周
[...Array(7).keys()].map(days => new Date(Date.now() + 86400000 * days));
2. 获取地址栏(url)参数
q={};location.search.replace(/([^?&=]+)=([^&]+)/g,(_,k,v)=>q[k]=v);q;
3. 生成随机颜色
'#' + Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, '0');
4. 数组去重
[...new Set(arr)]
4. 返回一个键盘(装逼用)
(_=>[..."`1234567890-=~~QWERTYUIOP[]\~ASDFGHJKL;'~~ZXCVBNM,./~"].map(x=>(o+=`/${b='_'.repeat(w=x<y?2:' 667699'[x=["BS","TAB","CAPS","ENTER"][p++]||'SHIFT',p])}\|`,m+=y+(x+' ').slice(0,w)+y+y,n+=y+b+y+y,l+=' __'+b)[73]&&(k.push(l,m,n,o),l='',m=n=o=y),m=n=o=y='|',p=l=k=[])&&k.join`
`)()