Posts Tagged “SharePoint”

Hide SharePoint Toolbar

Posted on June 2nd, 2016 by webninjataylor

/**************************************/ /* SUITE BAR DISPLAY FOR ADMIN OPT-IN */ /**************************************/ /* Setting the flag on the admin page */ $(window).load(function($){ if(localStorage.getItem(‘suiteBar’) === ‘true’){ jQuery(‘.message’).html(‘SharePoint Suite Bar Status: ON’); } else { jQuery(‘.message’).html(‘SharePoint Suite Bar Status: OFF’); } jQuery(‘.suite-bar-opt-in’).click(function(){ localStorage.setItem(‘suiteBar’,’true’); jQuery(‘.message’).html(‘SharePoint Suite Bar Status: ON’); }); jQuery(‘.suite-bar-opt-out’).click(function(){ localStorage.setItem(‘suiteBar’,’false’); jQuery(‘.message’).html(‘SharePoint Suite Bar Status: OFF’); }); }); if(localStorage.getItem(‘suiteBar’) […]

Remove SharePoint Induced White Spaces

Posted on June 2nd, 2016 by webninjataylor

jQuery(‘#s4-bodyContainer’).html(jQuery(‘#s4-bodyContainer’).html().replace(/\u200B|\u200C|\u200D|\uFEFF|&nbsp\;/g,”)); jQuery(‘#s4-bodyContainer’).find(‘br’).last().remove();

SharePoint Timer

Posted on February 5th, 2015 by webninjataylor

SharePoint has a nasty habit of fooling JavaScript into thinking the DOM is loaded when there are actually still elements popping in afterwards.  Here’s a dirty script for testing the existence of a given element when you’re in a pinch… var wnt_spTimer, wnt_spElement; wnt_spTimer = window.setInterval(function(){ wnt_spElement = $(‘div[data-widget=”tools”] .heading-main h2’).length; if(wnt_spElement === 0){ console.log(‘******** […]

SharePoint 2013 Developer Tips

Posted on June 23rd, 2014 by webninjataylor

Tips You can add scripts to page layouts after a snippet’s <div></div>, but not within the snippet in the layout file Bootstrap JS files conflict with SP core; edits won’t save in browser HTML for SharePoint Ingestion No <form> tags No <style> tags Use ms-design-css-conversion=”no” in the CSS <link> tag if using web fonts SP […]

Event Binding Woes

Posted on June 9th, 2014 by webninjataylor

In addition to viewing current events bound to an object with … $._data( $(‘SELECTOR’)[0], ‘events’ ); …in the console.  I’ve discovered it is sometimes necessary to bind the event to a parent which already exists on the page as some scenarios don’t have all objects ready when the .ready() method is fired (*ahem* SharePoint, I’m […]