Created
December 10, 2019 07:39
-
-
Save marineko/990fe8e51965b6effc9820cd757ce72c to your computer and use it in GitHub Desktop.
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 observer = new MutationObserver(function (mutations) { | |
mutations.forEach(function (mutation) { | |
if (mutation.target.className === "ms-List-cell" || mutation.target.className === "ms-List-surface") { | |
var customBody = document.getElementsByClassName('customBody'); | |
for (var i = 0, len = customBody.length | 0; i < len; i = i + 1 | 0) { | |
var ret; | |
customBody[i].innerHTML = customBody[i].textContent; | |
ret = truncate(customBody[i].textContent, 100); | |
customBody[i].innerText = ret; | |
} | |
} | |
}); | |
}); | |
var config = { | |
subtree: true, | |
childList: true | |
}; | |
observer.observe(document.documentElement, config); | |
function truncate(str, len) { | |
return str.length <= len ? str : str.substr(0, len) + "..."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment