I hereby claim:
- I am kaki87 on github.
- I am kaki87 (https://keybase.io/kaki87) on keybase.
- I have a public key ASAfDWR7OZyZANunJVBqheAv2pTHaIKKqFrh5ggHNxVd4go
To claim this, I am signing this object:
/* | |
One element progress bar | |
by KaKi87 | |
22.03.18 | |
*/ | |
/* | |
Get browser prefix (for CSS) | |
https://stackoverflow.com/questions/8889014/setting-vendor-prefixed-css-using-javascript | |
https://davidwalsh.name/vendor-prefix |
/* | |
First version | |
*/ | |
function getCustomVariables(){ | |
let page_variables = Object.keys(window); // current page's variables | |
let default_variables = Object.keys(document.head.appendChild(document.createElement('iframe')).contentWindow); // empty DOM's variables | |
let custom_variables = page_variables.filter(variable => default_variables.indexOf(variable) == -1); // comparison | |
return custom_variables; | |
} |
// Simple. | |
document.body.innerHTML = `<pre>${JSON.stringify(JSON.parse(document.body.textContent), null, 4)}</pre>`; |
I hereby claim:
To claim this, I am signing this object:
const querystring = object => Object.keys(object).map(key => `${key}=${object[key]}`).join('&'); |
@import url('https://use.fontawesome.com/releases/v5.8.1/css/all.css'); | |
@import url('https://fonts.googleapis.com/css?family=Open+Sans'); | |
body { | |
font-family: 'Open Sans'; | |
} | |
:root { | |
--color-white: #ecf0f1; | |
--color-darkblue: #2c3e50; |
const indexOfAll = (string, value) => string.split('').reduce((a, e, i) => (e === value) ? a.concat(i) : a, []); |
// ==UserScript== | |
// @name XDA Forums - Threads meta | |
// @namespace https://kaki87.net/ | |
// @version 1.0 | |
// @match https://forum.xda-developers.com/* | |
// @author KaKi87 | |
// @license MIT | |
// ==/UserScript== | |
window.addEventListener('DOMContentLoaded', () => { |
const getParents = element => { | |
const parents = []; | |
for (; element && element !== document; element = element.parentElement){ | |
parents.push(element); | |
} | |
return parents; | |
}; | |
/* | |
Source : https://gomakethings.com/how-to-get-all-parent-elements-with-vanilla-javascript/ |
const isIpInCidr = (ip, cidr) => { | |
const [range, bits = 32] = cidr.split('/'); | |
const mask = ~(2 ** (32 - bits) - 1); | |
const ip4ToInt = ip => ip.split('.').reduce((int, oct) => (int << 8) + parseInt(oct, 10), 0) >>> 0; | |
return (ip4ToInt(ip) & mask) === (ip4ToInt(range) & mask); | |
}; | |
/* | |
Source : https://tech.mybuilder.com/determining-if-an-ipv4-address-is-within-a-cidr-range-in-javascript/ | |
*/ |