Notebook - Welcome to Notebook

Contact/Report Bugs
You can contact me at: bkenwright@xbdev.net












h3 Example of how to upload and access a File Upload Button to imgur h3 input type file id myFile button id submitBtn onclick submit this Submit button br br script document body style minHeight 200px async function submit let imgFile document getElementById myFile files 0 console log imgFile imgFile let ret await fetch https api imgur com 3 image headers Content Type application json Content Type application x www form urlencoded Authorization Client ID aca6d2502f5bfd8 Accept application json method post mode cors no cors cors same origin cache no cache body imgFile let res await ret text console log return res let details JSON parse res details details data let link document createElement a link innerHTML Link to img details link link href details link document body appendChild link script Extends previous example but works with base64 h3 Example of how to upload and access a File Upload Button to imgur h3 input type file id myFile button id submitBtn onclick submit this Submit button br br script document body style minHeight 200px async function submit let imgFile document getElementById myFile files 0 console log imgFile imgFile var dataUrl data image gif base64 dataBase64 const reader new FileReader reader readAsDataURL imgFile reader onload async let base64 reader result data image jpeg base64 9j 4AAQSkZJRgABAQEAYAB console log base64 slice 0 100 let database64 base64 split base64 1 console log database64 slice 0 20 let data JSON stringify type base64 image database64 let ret await fetch https api imgur com 3 image headers Content Type application json Content Type application x www form urlencoded Authorization Client ID aca6d2502f5bfd8 Accept application json method post mode cors no cors cors same origin cache no cache body data let res await ret text console log return res let details JSON parse res details details data let link document createElement a link innerHTML Link to img details link link href details link document body appendChild link end onload reader script Copy and paste image directly takes image from clipboad and uploads it then gives you the link document body style minHeight 300px document onpaste function e console log pasted e var items e clipboardData e originalEvent clipboardData items for let i 0 i items length i if items i type includes image continue looking for image png image jpg if items i kind file continue var blob items i getAsFile console log blob blob var reader new FileReader reader onload function event console log event target result data url look something like this data image png base64 iVBORw0KGgoA uploadtoimgur event target result reader readAsDataURL blob async function uploadtoimgur base64Img data image png base64 iVBORw0KGgoA let database64 base64Img split base64 1 console log base64 data database64 slice 0 20 let data JSON stringify type base64 image database64 let ret await fetch https api imgur com 3 image headers Content Type application json Content Type application x www form urlencoded Authorization Client ID aca6d2502f5bfd8 Accept application json method post mode cors no cors cors same origin cache no cache body data let res await ret text console log return res let details JSON parse res details details data let link document createElement a link innerHTML Link to img details link link href details link document body appendChild link let img document createElement img document body appendChild img img src details link console log select screen output and paste something Progress status also markdown insert replace 1 select where in the textarea you want to insert the image 2 click page if it s an image not text it will upload it to imgur while uploading it inserts a unique identifier in the format sasdkaflej223 3 when finished uploading and has the correct url it replaces the temp identier with the url textarea id textarea style width 100 min height 300px textarea script async version of the XMLHttpRequest async function asyncXMLHttpRequest method url formData headers return new Promise function resolve reject let xhr new XMLHttpRequest xhr open method url Object keys headers forEach k let v headers k xhr setRequestHeader k v xhr onload function if this status 200 this status 300 resolve xhr response else reject status this status statusText xhr statusText xhr upload onprogress function e if e lengthComputable let percentComplete e loaded e total 100 toFixed 3 console log percentComplete uploaded xhr onerror function reject status this status statusText xhr statusText xhr send formData script script Random string ref url https notebook xbdev net index php page randomstring const randomString len let res for let m 0 m len m ascii 0 9 a z A Z const digit a return a charCodeAt 0 const ascii d return String fromCharCode d let v 0 9 a z A Z let n Math floor Math random 3 let lo digit v n 0 let hi digit v n 1 res ascii lo Math floor hi lo Math random return res script script document body style minHeight 500px function typeInTextarea textToInsert el const start end el selectionStart el selectionEnd update the value with our text inserted el value el value slice 0 start textToInsert el value slice end update cursor to be at the end of insertion el selectionStart el selectionEnd start textToInsert length var dopaste function e console log pasted e var items e clipboardData e originalEvent clipboardData items for let i 0 i items length i if items i type includes image continue looking for image png image jpg if items i kind file continue var blob items i getAsFile console log blob blob const uid randomString 20 const uidstring uid typeInTextarea uidstring document getElementById textarea var reader new FileReader reader onload function event console log event target result data url look something like this data image png base64 iVBORw0KGgoA uploadtoimgur event target result uidstring reader readAsDataURL blob document getElementById textarea addEventListener paste dopaste async function uploadtoimgur base64Img uidstring data image png base64 iVBORw0KGgoA let database64 base64Img split base64 1 console log base64 data database64 slice 0 20 let data JSON stringify type base64 image database64 let headers Content Type application json Content Type application x www form urlencoded Authorization Client ID aca6d2502f5bfd8 Accept application json let res await asyncXMLHttpRequest post https api imgur com 3 image data headers console log return res let details JSON parse res details details data const ta document getElementById textarea ta value ta value replaceAll uidstring details link let link document createElement a link innerHTML Link to img details link link href details link document body appendChild link let img document createElement img document body appendChild img img src details link img width 100 img height 100 console log select screen output and paste something script

ste something Progress status also markdown insert replace 1 select where in the textarea you want to insert the image 2 click page if it s an image not text it will upload it to imgur while uploading it inserts a unique identifier in the format sasdkaflej223 3 when finished uploading and has the correct url it replaces the temp identier with the url textarea id textarea style width 100 min height 300px textarea script async version of the XMLHttpRequest async function asyncXMLHttpRequest method url formData headers return new Promise function resolve reject let xhr new XMLHttpRequest xhr open method url Object keys headers forEach k let v headers k xhr setRequestHeader k v xhr onload function if this status 200 this status 300 resolve xhr response else reject status this status statusText xhr statusText xhr upload onprogress function e if e lengthComputable let percentComplete e loaded e total 100 toFixed 3 console log percentComplete uploaded xhr onerror function reject status this status statusText xhr statusText xhr send formData script script Random string ref url https notebook xbdev net index php page randomstring const randomString len let res for let m 0 m len m ascii 0 9 a z A Z const digit a return a charCodeAt 0 const ascii d return String fromCharCode d let v 0 9 a z A Z let n Math floor Math random 3 let lo digit v n 0 let hi digit v n 1 res ascii lo Math floor hi lo Math random return res script script document body style minHeight 500px function typeInTextarea textToInsert el const start end el selectionStart el selectionEnd update the value with our text inserted el value el value slice 0 start textToInsert el value slice end update cursor to be at the end of insertion el selectionStart el selectionEnd start textToInsert length var dopaste function e console log pasted e var items e clipboardData e originalEvent clipboardData items for let i 0 i items length i if items i type includes image continue looking for image png image jpg if items i kind file continue var blob items i getAsFile console log blob blob const uid randomString 20 const uidstring uid typeInTextarea uidstring document getElementById textarea var reader new FileReader reader onload function event console log event target result data url look something like this data image png base64 iVBORw0KGgoA uploadtoimgur event target result uidstring reader readAsDataURL blob document getElementById textarea addEventListener paste dopaste async function uploadtoimgur base64Img uidstring data image png base64 iVBORw0KGgoA let database64 base64Img split base64 1 console log base64 data database64 slice 0 20 let data JSON stringify type base64 image database64 let headers Content Type application json Content Type application x www form urlencoded Authorization Client ID aca6d2502f5bfd8 Accept application json let res await asyncXMLHttpRequest post https api imgur com 3 image data headers console log return res let details JSON parse res details details data const ta document getElementById textarea ta value ta value replaceAll uidstring details link let link document createElement a link innerHTML Link to img details link link href details link document body appendChild link let img document createElement img document body appendChild img img src details link img width 100 img height 100 console log select screen output and paste something script

3dplot
a4print
about
acejs
acejs2
acejs3
aessecurity
angularjs
animbackgroundimage
aseformat
assert
asteroidsjs
backgrounds01
backgrounds02
backgrounds03
barnsleyfern
base26
base64
bib
binary
bodypix
bouncy
box2dweb
breakoutjs
browserversion
buslanes
busybutton
bvhreader
calendar
canvas
canvas2
canvas3
canvasmandelbrot
canvasmandelbrot2
canvasnumbers
canvaszoom
capsule
changingimages
chatgptusingopenai
chatgptusingopenai2
chatgptusingopenai3
checkboxtoggle
chinesetiles
classes
classfeatures
clipboardbutton
clonenode
codedropdown
codemirror
codemirror2
collada
colorpick
columnresizer
contextmenu
convnet
cookiebanner
countdown
countdown2
countdown3
crop
css3dbarchart
css3dbarchart2
css3dbook
css3dscene
csscube
csscube2
csscube3
csscubevideos
cssfilelist
csshas
csspulse
cssresizeaspect
cssspin
csszooming
csvtoarray
customcheckbox
d3datamap
d3js
d3js10
d3js11
d3js2
d3js3
d3js4
d3js5
d3js6
d3js7
d3js8
d3js9
d3jsanimatedgrid
d3jsarctransition
d3jsarctransition2
d3jsaxis
d3jsaxischanging
d3jsbars
d3jsbrushing
d3jsbuslanes
d3jsbuslanes2
d3jscalendar
d3jscheat
d3jsclock
d3jscloudmap
d3jscogs
d3jscolors
d3jscovid
d3jscovid2
d3jscovid3
d3jsdashboard
d3jsdashboard2
d3jsdashboard3
d3jsdatakeyfunction
d3jsdensity
d3jsdragresizing
d3jsdragresizing2
d3jseach
d3jsease
d3jsevents
d3jsflower
d3jsforcegroups
d3jsforces
d3jsforces2
d3jsfractaltree
d3jsgeo
d3jsgroupbars
d3jsgroups
d3jsheatmap
d3jshex
d3jshierarchies
d3jshierarchies2
d3jshistogram
d3jshistogram2
d3jshistogram3
d3jshistogram4
d3jsinterpolate
d3jsjoin
d3jskmean
d3jskmean2
d3jsline
d3jsline2
d3jsline3
d3jsline4
d3jslinetransition
d3jslinetransition0
d3jslinetransition2
d3jsmaplocations
d3jsmaps
d3jsmaps2
d3jsmaps3
d3jsmisc
d3jsmisc2
d3jsmodule
d3jsmodulecolor
d3jsmultistyles
d3jsnobel
d3jsoverlappinggraphs
d3jspanel
d3jspie
d3jspieinterpolate
d3jssankey
d3jssankey2
d3jsscatter
d3jsshapes
d3jsslider
d3jsspending
d3jsspending2
d3jsspiralplot
d3jsspirograph
d3jssquare
d3jsstack
d3jsstackedbar
d3jsstackedbar2
d3jssunburst
d3jssunmoon
d3jssvglines
d3jssymbols
d3jstimelines
d3jsuk
d3jsvoronoi
d3scatterplot
d3timeline
d3timeline2
datalist
datamuse
date
dblclickhighlight
deviceorientation
dictionaryapi
dockermenu
doodlepad
downloadgif
dragdroplistitems
dragrotateresizediv
dragrotateresizediv2
dragrotateresizediv3
dragrotateresizediv4
dragrotateresizefontsize
dragselectbrush
drawlinesdiv
dropdown
dualquaternionimages
dynamicgrid
easefunctions
easeinterpolate3dplots
echart
echart2
echart3
encapsulation
epubviewer
errorstack
excalidraw
excalidraw2
excalidraw3
excalidraw5
expandable
faker
fetchplus
fileupload
fixedtopbar
fonts
fonts2
footerbar
fractalmaze
fractalmaze2
fractalnoiseimage
fractals
fractals2
fractaltree
freesvg
fresnel
froggerjs
gantt
gifgiphyapi
gifhex
gltffromscratch
gradients
griditems
griditems2
griditems3
griditems4
gridworms
heat
hexview
hexview2
highlight
icons
icons2
iframes
ik
imagetracertosvg
imgur
inputfile
invadersjs
ipynb
ipynb2
ipynb3
ipynb4
isbn13
isbn2
jpghex
jquery
jquery2
jqueryui
jqueryui2
jsdraganddrop
jslint
jsobfuscate
jsraytracer
jstree
jstree2
jszip
jszipimages
jszipread
keyframes
l2dwidget
lda
leftmenu
less
less2
lineargradientimage
linenumbers
loadimagefromfile
makepdf
maps
markdown
markdown2
markdownalerts
markdownalerts2
markdownbookmarks
markovimage
markovpixelblocks
mathjax
matrices
matsandvects
mazegamejs
md2tex
metrotiles
metrowindows
milestones
misc
misc2
modules
myipdetails
neataptic
networkstructures
networkstructures2
number
obj
objtojson
openaiimages
opencv
opencv2
opencv3
opencv4
opencv5
outline
p2
p5fractalleaf
p5fractalshape
p5js
p5js2
p5js3
p5jsanimatedcover
p5mengercube
p5snowflakes
palindrome
panel
parallax
paste
paste2
pasteimgfromurl
pdfjs
pdfjs2
pdfkit
pdfkit2
pdfkit3
pdfkit4
pdfkit5
pdfkit6
pdfmake
pdfmake2
pdfmake3
pdfmake4
pdfmake5
pdfmake6
perlin
perlin2
perlin3
perspective
pexels
playground
plotly
plotlynoise
plotlyranddist
plyloader
plyloader2
pngtxtencoder
pongjs
pptxgenjs
prettycode
prism
prn
problems
progress
pseudorandom
px2svg
python
quotes
racergame
random
randomprofilepatterns
randomstring
rating
rayambient
raymonte
raymonteprogressive
raymonteprogressive2
raymontewarmstart
reexpcross
reexpcross2
regex
regexbib
regexpfixbib
regexpmultiline
repeatwordsregexp
resizabletable
resizabletable2
revealjs
revealjs2
revealjsmulti
ritalanguage
ritalanguage2
ritalanguage3
rotateimg
rough
rsapublicprivatekeys
rss
rss2
sankey
scrappingsvg
scrolltext
scrolltext2
scrollwidth
sdfboxinboxtwist
sdfhollowbox
setintervalexception
shareurl
shuffle
sidecomment
similarity
simplehighlighter
simpleplatformgamejs
sinecanvas
sliderpopout
slides
smileys
snowfall
snowman
sound
soundsignal
sphererayintersection
springs
sqljs
steganography
stereogram
stringmatching
svg
svgchaos
svgdragresize
svgdragresize2
svgdragresize3
svgdragrotate
svgdrawing
svglines
svglines2
svglines3
svglines4
svglines5
svglinesmandelbrot
svgpathsdragrotate
svgpathsdragrotateresize
svgpie
svgpie2
svgpie3
svgpiepath
svgpiepath2
svgrandomfaces
symbols
synaptic
synaptic2
synonyms
tablerotatecells
tablerotatecells2
tablerotatecells3
tablerotatecells3b
tablerotatecells4
tables
tablezebra
tabularjs
tabularjs2
tabulatordownload
tagcanvas
tensorflowgan
tensorflowjs
tensorflowjsbasic
tensorflowjscnn
tensorflowjssinewave
tensorflowjssound
tensorflowmobilenet
tetrahedronfractal
tetrahedronfractalfolding
tetris
textarea
textareaauto
textareadiv
textareadiv2
textmaskimage
theirorthere
thesaurus
threejs
threejs2
threejs3
threejs4
threejsgltf
threejstokyo
tiles
toaster
tooltip
transition
transitionexpandabledropdown
treeview
treeview2
tricks
tshirt
tshirt2
tshirt3
turningpages
unsplash
urlblob
urlblob2
userdefinepoints
vector
videos
videos2
visualsort
vue
w2ui
w2uientertextdialog
webcam
webgl
webgl2
webgl3
webgl4
webgl5
webglbasic1
webglbasic2
webglcube
webglfov
webglfrustum
webgljson
webglleaves
webgllighting
webglorthographic
webglpoints1
webglpoints2
webglpoints3
webglsquare
webgltexture1
webgltexture2
webgltexture3
webgltransforms
webgltriangle
webgpu
webgpu10
webgpu11
webgpu12
webgpu13
webgpu14
webgpu15
webgpu16
webgpu17
webgpu2
webgpu3
webgpu4
webgpu5
webgpu6
webgpu7
webgpu8
webgpu9
webgpubars
webgpubuffers
webgpubuffers2
webgpucellnoise
webgpuclouds
webgpuclydescope
webgpucompute
webgpucubemap
webgpucubemap2
webgpudeferred
webgpudepth
webgpudof
webgpudrops
webgpuetha
webgpufire
webgpufractalcubes
webgpuglassrain
webgpugltf
webgpugltf2
webgpugrass
webgpugrid
webgpukernel
webgpukleinian
webgpulabupdates
webgpulighting
webgpumandelbrot
webgpumeta3d
webgpumetaballs
webgpumouse
webgpunoise
webgpunormalmapping
webgpuobj
webgpuparallax
webgpuparallax2
webgpuparallax3
webgpuparallaxshadow
webgpuparallaxshadow2
webgpupixel
webgpuquad
webgpuray1
webgpuraytracing
webgpuraytracing2
webgpushadowmaps
webgpushadowmaps2
webgpusierpinski2d
webgpusierpinski3d
webgpusinusoid
webgpussao
webgpustadiumobj
webgpuswirl
webgputestpipe3
webgputoon
webgputopology
webgputt
webgpuvolcloud
webgpuwater
webgpuwireframe
webgpuwireframe2
webpcanvas
webworkers
webxr
webxr2
wiggly
wikipedia