Skip to content

Instantly share code, notes, and snippets.


Ali Robertson alirobe

View GitHub Profile
alirobe / sp2010 full breadcrumb.aspx
Created Oct 14, 2011
Full SP2010 Breadcrumb (for master page)
View sp2010 full breadcrumb.aspx
Preview -
<div id="new-breadcrumb" class="s4-notdlg">
<div class="s4-titletext">
<h1 name="onetidProjectPropertyTitle">
<asp:SiteMapPath runat="server" SiteMapProvider="SPContentMapProvider">
<span class="s4-nothome s4-bcsep s4-titlesep">
<SharePoint:ClusteredDirectionalSeparatorArrow runat="server"/>
alirobe / spf-dropdown.js
Last active Sep 27, 2015
SharePoint Foundation Drop-down Navigation
View spf-dropdown.js
spfDropDowns v.1 by @alirobe - gist: 1312059
To use this, just structure your top-menu bar links by using a leading '-- '
to denote submenu items, e.g.
Menu Item
-- Submenu Item
Menu Item
-- Submenu Item
-- Submenu Item
alirobe / loadfont.js
Created Nov 4, 2011
SharePoint 2010 Font Loader
View loadfont.js
// in IE only, we must ensure that we don't load the font when the page is loaded in a dialog, because this
// breaks the font reference.
// Dialogs work by appending ?isDlg=1 to the end of an existing page and loading it into an iFrame.
function loadFont(fontName) {
var iAmInternetExplorer = navigator.userAgent.indexOf('MSIE') != -1;
var iAmNotInADialog = window.location.href.indexOf('IsDlg') == -1;
// for other browsers, we load this in a conditional comment.
// due to a bug in IE, WOFF fonts can't be loaded twice.
if (iAmInternetExplorer && iAmNotInADialog) {
alirobe / style library-v5-script-v5.js
Last active Sep 29, 2015's Responsive SP2010 (sans HTML5, via @alirobe)
View style library-v5-script-v5.js
//'s Responsive SP2010 (sans HTML5, via @alirobe)
// add me to the bottom of v5.js
// via gist @
window.onresize = function(){
var w=800, t=" lt-800 ", cw, h;
h = document.getElementsByTagName("html")[0];
cw = window.outerWidth||h.clientWidth;
if (cw<=w) {if(h.className.indexOf(t)==-1) {h.className+=t}}
else {h.className=h.className.replace(/lt-800/g,'').replace(/[\s]{2,}/g,' ');}
alirobe / html5.master.part
Created Feb 1, 2012
On-demand IE9 rendering for SharePoint 2010 Master Pages.
View html5.master.part
<asp:ContentPlaceHolder runat="server" id="html5">
<-- In your .aspx page, use a override this ContentPlaceHolder using "IE=9" to enable HTML5 features - on pages where it's required... -->
<meta http-equiv="X-UA-Compatible" content="IE=8"/>
alirobe / SP2010-chromeScrollingFix
Last active Jan 13, 2017
Fix an issue where occasionally the JavaScript that runs a SharePoint 2010 page's dynamic elements (ribbon, scrolling, etc) fails to initialise in Webkit browsers.
View SP2010-chromeScrollingFix
//via or
if (jQuery.browser.webkit) {
jQuery(document).ready(function () {
var interval;
function loopCheck() {
if (typeof (_spBodyOnLoadWrapper) !== "undefined" && _spBodyOnLoadCalled == false)
alirobe / masterfile-snippet.html
Last active Oct 13, 2015
Enable Chrome 'quick-search' for SharePoint Intranets
View masterfile-snippet.html
add inside the 'head' element of master page.
replace title="Intranet" with the name of your intranet (if branded)
<link rel="search" title="Intranet" type="application/opensearchdescription+xml" href="/Style%20Library/opensearch.xml" />
alirobe / stickyfooter-2010.js
Last active Dec 15, 2015
A modification of Randy Drisgill's "Sticky footers in SharePoint" for SP2010. Works for me...
View stickyfooter-2010.js
// Place the #custom-footer directly after the close of #s4-bodyContainer, and apply float:left to it.
// What needed changing:
// - consistent use of the jQueryFooter variable (rather than re-selecting the footer to apply the margin-top)
// - changed/simplified the math to calculate the difference, adding s4-mainarea (which floats:left and is not included in bodyContainer)
// - did not force footer to show in dialog boxes (use .ms-dialog #custom-footer {display:none} in CSS to hide)
// jQuery.noConflict();
alirobe / gist:d5ad4cd9f3c0eed1dc27
Created Jul 2, 2015
SharePoint 2013 Related Pages
View gist:d5ad4cd9f3c0eed1dc27
// shows related pages in SharePoint 2013 or Office 365
// via
// requires (minified under 10k): underscorejs, es6-promise (ES6 polyfill), fetch (ES6 polyfill)
function(element, title, count) {
var header = '<b>'+title+'</b><br/>';
var _linkTmpl = _.template('<a href="<%=Cells.results[6].Value%>"><%=Cells.results[3].Value%></a>');
var linkJoin = '<br/>';
var linkCount = count;
alirobe / umbraco-filebrowser.cshtml
Last active Nov 20, 2019
A simple recursive media folder/file viewer macro for directory browsing in #Umbraco 7+, using Bootstrap 3 for display. Not suitable for >100 files (use a surfacecontroller)
View umbraco-filebrowser.cshtml
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{ var mediaId = Model.MacroParameters["mediaId"]; }
@helper DisplayFolder(dynamic folder, bool collapsed) {
var items = folder.Children().OrderBy("DocumentTypeAlias Desc,Name");
if (items.Any()) {
<a class="list-group-item" role="button" aria-expanded="false" data-toggle="collapse" href="#macro-mediaList-folder-@folder.Id">
<i class="glyphicon glyphicon-folder-open"></i> &nbsp; @folder.Name
<div class="list-group @(collapsed?"collapse":"collapse in") well well-sm" id="macro-mediaList-folder-@folder.Id">
@foreach(var item in items) {