Last active
June 12, 2018 17:02
-
-
Save vaderj/0e60766790da38678f8a70ada0fbbd1f to your computer and use it in GitHub Desktop.
SharePoint information bar #Javascript #SharePoint
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
// Information bar | |
// https://msdn.microsoft.com/en-us/pnp_articles/customize-your-sharepoint-site-ui-by-using-javascript | |
// | |
function RemoteManager_Inject() { | |
loadScript(jQuery, function () { | |
$(document).ready(function () { | |
var message = "<img src='/_Layouts/Images/STS_ListItem_43216.gif' align='absmiddle'> <font color='#AA0000'>JavaScript customization is <i>fun</i>!</font>" | |
// Execute status setter only after SP.JS has been loaded | |
SP.SOD.executeOrDelayUntilScriptLoaded(function () { SetStatusBar(message); }, 'sp.js'); | |
// Customize the viewlsts.aspx page | |
if (IsOnPage("viewlsts.aspx")) { | |
//hide the subsites link on the viewlsts.aspx page | |
$("#createnewsite").parent().hide(); | |
} | |
}); | |
}); | |
} | |
function SetStatusBar(message) { | |
var strStatusID = SP.UI.Status.addStatus("Information : ", message, true); | |
SP.UI.Status.setStatusPriColor(strStatusID, "yellow"); | |
} | |
function IsOnPage(pageName) { | |
if (window.location.href.toLowerCase().indexOf(pageName.toLowerCase()) > -1) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment