Cool Tips
Change List New Item to …
Code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script> $(document).ready(function(){ var spans = document.getElementsByTagName("span");
for(var i=0;i<spans.length; i++) {
if(spans[i].innerHTML == "new item") {
spans[i].innerHTML = "new person";
break;
}
}
});
</script>
SharePoint List Type Column to show icon based on file type attached
Code:
<script type="text/javascript" src="{reference to jquery library}">
</script>
<script type="text/javascript">
$(document).ready(function(){
$('.ms-listviewtable > tbody > tr').each(function () {
var docTypeIcon = getDocTypeImage($(this).find("td:nth-child(<column count*>)").text());
//alert(docTypeIcon);
$(this).find("td:nth-child(<column count*>)").find("img").attr("src",docTypeIcon);
});
function getDocTypeImage(x)
{
var imageUrl = '';
switch(x)
{
case 'pdf' : imageUrl = "/_layouts/images/pdficon_small.gif";
break;
case 'pptx' : imageUrl = "/_layouts/images/icpptx.png";
break;
case 'ppt' : imageUrl = "/_layouts/images/icppt.png";
break;
case 'docx' : imageUrl = "/_layouts/images/icdocx.png";
break;
case 'doc' : imageUrl = "/_layouts/images/icdoc.png";
break;
case 'xlsx' : imageUrl = "/_layouts/images/icxlsx.png";
break;
case 'xls' : imageUrl = "/_layouts/images/icxls.png";
break;
case 'zip' : imageUrl = "/_layouts/images/iczip.gif";
break;
default: imageUrl = "/_layouts/images/icgen.gif";
break;
}
return imageUrl;
}
});
</script>
Reference
https://drboolean.gitbooks.io/mostly-adequate-guide/content/
No comments:
Post a Comment