I am working on sharepoint server 2013 (on-premise & office 365). and sometime i have to write some custom JavaScripts and custom style which hide/relocate certain HTML components. Example of these include the following 2 cases:-
1- Inside the built-in discussion board view there is a link named "What's Hot" and i did not find any way to hide this link, other than writing this custom style:-
<style>
a.ms-pivotControl-surfacedOpt[aria-label^='What']
{
display:none !important;
}
</style>
2- Inside the built-in create/edit discussion board forms, there is a check box named "Question", and to hide it i wrote the following custom javascript :-
<script>
$( document ).ready(function() {
$('.ms-formtable nobr:contains("Question")').closest('tr').hide();
});
</script>
keeping in mind that the question check box is disabled inside the Discussion content type (for a reason or another) so i can not hide it from the content type using the regular appraoch.
now if i am building my own .net application i would write these custom javascript and style without any worry, since i own the markup. but in sharepoint i do not own the markup and from my own experience that this markup might chnage if we apply a CU or a single update to sharepoint.
so i am not sure which appraoch can be considered valid in sharepoint:-
- I should avoid writing such a custom javascripts and custom style in sharepoint, since the classes i am depending on can change in the future?
- those customizations are valid and i am not doing any thing wrong,, but if these custom javascripts and/or cusotm style break after installing an update, then the normal process will be to update these custom javascripts and/or custom style to match the new classes names...
i am asking this question, because currently i am preparing a document on how we need to manage updating sharepoint servers (including installing sharepoint CU and/or SP security updates). and i need to mention what we need to do in-case a cusotm JavaScript and/or cusotm style breaks.. so will the normal process be to update these cusotm scripts and style to match the new classes? or it is our problem from the beginning that we have defined these cusotm JavaScript and custom style ?