Problem: we have:
- image with dimensions vec2 imageDimensions
- container with dimensions vec2 containerDimensions
Problem: we have:
| /** | |
| * Get the host of the this script. The host will be used for posting the data. | |
| */ | |
| var getHost = function () { | |
| var scripts = document.getElementsByTagName("script"); | |
| var i; | |
| for (i = 0; i < scripts.length; i++) { | |
| var urlAttribute = scripts[i].attributes.getNamedItem("src"); | |
| if (urlAttribute) { | |
| var url = urlAttribute.nodeValue; |
Some NPM packages I've written or contributed to:
| // catch newsletter button - any link with `#newsletter` triggers the callback | |
| window.addEventListener('click', evt => { | |
| if( evt.target && event.target.href && typeof evt.target.href == 'string' && event.target.href.indexOf('#newsletter') != -1 ){ | |
| evt.preventDefault() | |
| // YOUR ACTION HERE... | |
| } | |
| }) | |
| // keys! |
| <template> | |
| <main class="content home"></main> | |
| </template> | |
| <script> | |
| export default {} | |
| </script> |
I hereby claim:
To claim this, I am signing this object: