This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var oldCreateElement = document.createElement; | |
| document.createElement = function () { | |
| var tagName = arguments[0]; | |
| var element = oldCreateElement.apply(document, arguments); | |
| if (tagName === 'script') { | |
| element.setAttribute('defer', ''); | |
| } | |
| return element; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (navigator.getBattery) { | |
| navigator.getBattery().then((battery) => { | |
| if (battery && battery.level < 0.2) { | |
| let disableAnimations = document.createElement('style'); | |
| disableAnimations.type = 'text/css'; | |
| disableAnimations.innerHTML = ` | |
| * { | |
| transition-property: none !important; | |
| animation: none !important; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var esprima = require('esprima'); | |
| var esquery = require('esquery'); | |
| var ast = esprima.parse('function hello () { }'); | |
| var func = esquery(ast, 'FunctionDeclaration'); | |
| console.log(ast.body[0] === func); // false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var getCSSSelector = function () { | |
| var path, node = this; | |
| while (node.length) { | |
| var realNode = node[0], name = realNode.localName; | |
| if (!name) break; | |
| name = name.toLowerCase(); | |
| var parent = node.parent(); | |
| var sameTagSiblings = parent.children(name); | |
| if (sameTagSiblings.length > 1) { |
NewerOlder