- Example Library name:
MyLib.js
- There is one module
util
Webpack should have some options set:
output: {
path: './dist',
filename: 'MyLib.js',
reactHTML.replace(/data(.*?)=['"](.*?)['"]/ig,'') |
Array.from(document.querySelectorAll('*')).map(function(e) {c=getComputedStyle(e);w=c.width;(w!=='auto')?e.setAttribute('title', parseInt(w)+'x'+parseInt(c.height)):'';}) |
Object.prototype.getCode = function() { | |
var content = this.toString().split("\n"); | |
var last = content.length-1; | |
var code = content.filter(function(line,i) { | |
return (i!==0 && i!==last) | |
}) | |
return code.join("/n") | |
} |
Have you ever wanted a complete list of all the movies you have ever watched on Netflix? This small script should be ran inside the developer console on the (viewing activity)[https://www.netflix.com/viewingactivity] page on netflix. It is in version 0.9 and some things need to be done:
String.prototype.toDataProp = function() { | |
var min = "A".charCodeAt(0), | |
max = "Z".charCodeAt(0), | |
res = "data-"; | |
this.split("").forEach(function(char, i) { | |
var cc = char.charCodeAt(0); | |
if (cc >= min && cc <= max) { | |
res += ((i > 0) ? "-" : "") + String.fromCharCode(cc + 32); | |
} else { | |
res += char; |
function ipinfo(cb, ip) { | |
var request; | |
if (window.XMLHttpRequest) { // Mozilla, Safari, ... | |
request = new XMLHttpRequest(); | |
} else if (window.ActiveXObject) { // IE | |
try { | |
request = new ActiveXObject('Msxml2.XMLHTTP'); | |
} catch (e) { | |
try { | |
request = new ActiveXObject('Microsoft.XMLHTTP'); |
These two methods can be used to convert IP addresses to and from a hash value.
See the codepen for instructions.
var body = document.body, | |
html = document.documentElement; | |
var height = Math.max(body.scrollHeight, body.offsetHeight, | |
html.clientHeight, html.scrollHeight, html.offsetHeight); | |
var bbox = document.body.getBoundingClientRect(); | |
var svg = '<svg width="' + bbox.width + '" height="' + height + '" viewBox="0 0 ' + bbox.width + ' ' + height + '"><style>rect {-webkit-user-select: none; user-select: none; pointer-events: none; stroke: red; stroke-width: 2px; fill: rgba(0,0,0,.05);}</style>'; | |
Array.prototype.forEach.call(document.querySelectorAll('*:not(.notMe)'), function(ele) { | |
var style = getComputedStyle(ele); | |
if (style.display.toLowerCase() !== 'none') { |
data-reactid="[\.\d:\D]{1,23}" |