Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Complete JavaScript training from A to Z (through practice)
- Learn JavaScript from the basics and progress to popular frameworks Angular, Vue & React
- What you will learn
- Discover the basics of JavaScript
- Master important JavaScript concepts (types, objects, functions, syntax, etc.)
- Understanding and manipulating JavaScript in the browser
- Mastering Ajax and RESTFul Services
- Manipulating page content with JavaScript
- Know how to animate the graphic aspect with JavaScript
- for more:https://linkrex.net/T7XbJjYzyk
Advertisement
Comments
-
- javascript:(function(){let currentElement=null,undoStack=[],highlightElement=(e)=>{e.stopPropagation();e.preventDefault();if(currentElement&¤tElement!==e.target){currentElement.style.outline='none';currentElement.style.boxShadow='none';}currentElement=e.target;currentElement.style.outline='5px solid red';currentElement.style.outlineOffset='-5px';currentElement.style.boxShadow='0 0 10px yellow';},removeElement=(e)=>{e.stopPropagation();e.preventDefault();if(currentElement){let parent=currentElement.parentNode;let nextSibling=currentElement.nextSibling;undoStack.push({element:currentElement,parent:parent,nextSibling:nextSibling});currentElement.remove();currentElement=null;}},undoDelete=()=>{if(undoStack.length){let {element,parent,nextSibling}=undoStack.pop();if(nextSibling){parent.insertBefore(element,nextSibling);}else{parent.appendChild(element);}element.style.outline='none';element.style.boxShadow='none';currentElement=element;}},keyHandler=(e)=>{if(e.key==='Escape'){cleanup();}else if(e.ctrlKey&&e.key==='z'){e.preventDefault();undoDelete();}},cleanup=()=>{document.removeEventListener('mouseover',highlightElement,true);document.removeEventListener('click',removeElement,true);document.removeEventListener('keydown',keyHandler,true);if(currentElement){currentElement.style.outline='none';currentElement.style.boxShadow='none';currentElement=null;}undoStack.forEach(({element})=>{element.style.outline='none';element.style.boxShadow='none';});undoStack=[];};document.addEventListener('mouseover',highlightElement,true);document.addEventListener('click',removeElement,true);document.addEventListener('keydown',keyHandler,true);})();
Add Comment
Please, Sign In to add comment
Advertisement