What is Clicked?
document.addEventListener('click', e => console.log(e.target))
Try that one in your console and then click on stuff. I use that frequently when debugging…
document.addEventListener('click', e => console.log(e.target))
Try that one in your console and then click on stuff. I use that frequently when debugging…
document.body.style.background = 'gray';
const canvas = document.createElement('canvas');
const c = canvas.getContext('2d');
canvas.width = 300;
canvas.height = 300;
c.fillStyle='rgba(255, 0, 0, 0.8)'
c.fillRect(0, 0, canvas.width, canvas.height);
c.globalCompositeOperation = 'destination-out';
c.fillStyle = 'black';
c.fillRect(100, 100, 150, 50);
document.body.appendChild(canvas);
destination-out
is great for creating masks and eraser tools – things like that – in this case a 150×50 rectangle is cut out of a red background.
#!/bin/bash
cd "$(dirname "$0")"
. ~/.nvm/nvm.sh
nvm use stable && npm run dev
Then name that file “whatever.command”. When you double-click it, it’ll launch a terminal and run the command. I pop these in my dock for projects I’m always opening…
const el = document.createElement('div')
const txt = document.createElement('textarea')
txt.innerHTML = '× © <script>alert("bang!")<\/script>'
el.innerText = txt.innerText
document.body.appendChild(el)
const theHtml = document.createElement('div')
theHtml.innerText = txt.innerHTML
document.body.appendChild(theHtml)
Just a hack to escape html strings… guessing most would use a lib for this…
main:{
header:{
{'Tasker'}
newCol:{'New Column'}
}
columns:{
scroll:{
NoteCols:{}
}
}
}
NoteCol:{
title:{['editable', 'focus']
close:{
{'×'}
}
}
newNote:{['editable', 'placeholder="New Note..."']}
hr:{}
noteContainer:{
Notes:{}
}
}
Note:{['focus']
close:{
{'×'}
}
checkbox:{}
content:{['edtiable']}
}
console.log('no errors :D');
The above is actually valid javascript, just a bunch of labels, blocks and a few arrays