Last active
February 25, 2020 22:37
-
-
Save VelinGeorgiev/87a1535e12b2aca2b8d17f0f15692369 to your computer and use it in GitHub Desktop.
Hide see all on list item ootb web part using script editor
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
<script> | |
var maxAttempts = 100; | |
var currentAttempt = 0; | |
var hideListElements = function() { | |
// hide the see all urls | |
var seeAllUrls = window.document.querySelectorAll("a[data-automation-id='listViewWebPartSeeAll']"); | |
var l = seeAllUrls.length; | |
while(l--) { | |
seeAllUrls[l].style.display = 'none'; | |
} | |
// hide the list checkmarks | |
var allChecks = window.document.querySelectorAll("div[data-automationid='DetailsRowCheck']"); | |
var l = allChecks.length; | |
while(l--) { | |
allChecks[l].style.display = 'none'; | |
} | |
// hide the list sort arrows | |
var allArrows = window.document.querySelectorAll("i[data-icon-name='ChevronDown']"); | |
var l = allArrows.length; | |
while(l--) { | |
allArrows[l].style.display = 'none'; | |
} | |
// hide the header | |
var headers = window.document.querySelectorAll("div[data-automation-id='pageHeader']"); | |
if(headers.length) { | |
headers[0].style.height= '5em'; | |
} | |
} | |
var hideListElementsPerInterval = function() { | |
if(currentAttempt < maxAttempts) { | |
currentAttempt = currentAttempt + 1; | |
setTimeout(hideListElements, 300); | |
hideListElementsPerInterval(); | |
} | |
} | |
console.log('Script editor loading...'); | |
hideListElementsPerInterval(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment