Created
January 9, 2019 19:55
-
-
Save malipetek/b07089df8446535fe97cc4c94c106fd4 to your computer and use it in GitHub Desktop.
Beeline replicator. *this may be working only in chrome.
This file contains 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 d = document.createElement('div') | |
d.innerHTML += ` | |
<style> | |
.grdnt { | |
-webkit-text-fill-color: transparent; | |
background: -webkit-gradient(linear, left top, right bottom, from(#26BDA6), to(#FF5722)); | |
-webkit-background-clip: text; | |
background-size: 100% 1.5em; | |
} | |
</style>` | |
document.head.appendChild(d); | |
function dig(el){ | |
el.childNodes.forEach(n => { | |
if(n.nodeType == 3){ | |
var sc = document.createElement('span') | |
n.textContent.split(/(?=[\.\,\:\;])/gi).forEach(sentence => { | |
s = document.createElement('span') | |
s.textContent = sentence | |
s.classList.add('grdnt') | |
sc.appendChild(s) | |
}) | |
n.replaceWith(sc) | |
}else if(n.classList && !n.classList.contains('grdnt')){ | |
dig(n) | |
} | |
}) | |
} | |
dig(document.body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment