Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion splt.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ function splt({ target = '.splt', reveal = false }) {
//grab instances
const inst = document.querySelectorAll(target);

// MOD - support for html entity decoding
const decoded = function (encodedStr) {
let textarea = document.createElement('textarea')
textarea.innerHTML = encodedStr
return textarea.value
};

for (let a = 0; a < inst.length; a++) {
inst[a].setAttribute('id', 'i' + [a + 1]);

//saves original text to an array for revert functionality
saveOriginal.push(inst[a].innerHTML);

//split instance text
const instChars = inst[a].innerHTML.split('');
const instChars = decoded(inst[a].innerHTML).split('');
for (let b = 0; b < instChars.length; b++) {
//nest child span
const span = document.createElement('span');
Expand Down