Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
dragon731012
GitHub Repository: dragon731012/-WORKING-bookmarklets-and-games
Path: blob/main/fun/draw on your screen!.js
15563 views
1
javascript:
2
var opt=1;alert("keyboard commands:c=color picker. u=pen up. d=pen down. s=size. o=opacity. reload to clear.");
3
var pen='none';
4
var size=10;
5
function repeat(event){(function(){
6
var color=document.createElement('div');
7
var body=document.getElementsByTagName('body')[0];
8
body.appendChild(color);
9
color.style.position='fixed';
10
color.style.bottom='0px';
11
color.style.right='0px';
12
color.style.margin='0px';
13
color.style.paddingTop='0px';
14
color.style.width='1366px';
15
color.style.height='20px';
16
color.style.zIndex=10000;
17
color.style.opacity=0.8;
18
color.style.color='white';
19
color.style.backgroundColor='black';
20
color.style.border='0px solid black';
21
color.style.textAlign='center';
22
color.style.cursor='pointer';
23
color.id='color';
24
color.style.display='circle';
25
color.innerText='by dragonmaster73101';
26
document.getElementById('me').addEventListener('click',function(){window.open('https://github.com/dragon731012');});}());}
27
function mousemove(event){
28
var x=event.clientX;
29
var y=event.clientY;
30
x=x-9-size;y=y-12-size;
31
(function(){
32
var elem=document.createElement('div');
33
var body=document.getElementsByTagName('body')[0];
34
body.appendChild(elem);
35
elem.style.position='fixed';
36
elem.style.top=''+y+'px';
37
elem.style.left=''+x+'px';
38
elem.style.margin='10px';
39
elem.style.paddingTop='10px';
40
elem.style.width=''+size+'px';
41
elem.style.height=''+size+'px';
42
elem.style.zIndex=10000;
43
elem.style.opacity=opt;
44
elem.style.color=''+clr+'';
45
elem.style.backgroundColor=''+clr+'';
46
elem.style.border='0px solid white';
47
elem.style.textAlign='center';
48
elem.id='paint';
49
elem.style.display=''+pen+'';
50
elem.innerText='';}());}
51
window.addEventListener("keydown",function(event){
52
if (event.key=="c"){
53
clr=prompt("what color do you want? must be very broad, and with no caps or special characters. ex:blue");
54
elem.style.display=%27block%27;}});
55
window.addEventListener("keydown",function(event){
56
if (event.key=="s"){
57
size=prompt("what size do you want? no caps, letters, or special characters. ex: 10");
58
elem.style.display=%27block%27;}});
59
window.addEventListener("keydown",function(event){
60
if(event.key=="u"){
61
pen=%27none%27;}});
62
window.addEventListener("keydown",function(event){
63
if(event.key=="d"){
64
pen=%27circle%27;}});
65
window.addEventListener("keydown",function(event){
66
if(event.key=="o"){
67
opt=prompt("what do you want the opacity to be? 1 to 0. 1=none. 0=a lot.");}});
68
window.addEventListener(%27mousemove%27,mousemove);
69
repeat();
70
71