Skip to content

Instantly share code, notes, and snippets.

@alirobe
alirobe / twoLevelDynamicSharePointMenu.css
Created September 5, 2011 05:17
SharePoint 2010 two-level dynamic submenus (jQuery)
.s4-tn li.dynamic {
position:relative;
}
.s4-tn ul.pa-extradynamic{
position:absolute;
top:0; left:100%;
margin-left:0px;
display:none;
}
.lt-ie9 .s4-tn ul.pa-extradynamic{
@alirobe
alirobe / sp2010 full breadcrumb.aspx
Created October 14, 2011 00:51
Full SP2010 Breadcrumb (for master page)
<!--
Preview - http://i.snag.gy/Dd4S4.jpg
-->
<div id="new-breadcrumb" class="s4-notdlg">
<div class="s4-titletext">
<h1 name="onetidProjectPropertyTitle">
<asp:SiteMapPath runat="server" SiteMapProvider="SPContentMapProvider">
<PathSeparatorTemplate>
<span class="s4-nothome s4-bcsep s4-titlesep">
<SharePoint:ClusteredDirectionalSeparatorArrow runat="server"/>
@alirobe
alirobe / spf-dropdown.js
Last active September 27, 2015 18:18
SharePoint Foundation Drop-down Navigation
/*
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
alirobe / loadfont.js
Created November 4, 2011 03:31
SharePoint 2010 Font Loader
// 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
alirobe / style library-v5-script-v5.js
Last active September 29, 2015 17:47
kyleschaeffer.com's Responsive SP2010 (sans HTML5, via @alirobe)
// kyleschaeffer.com's Responsive SP2010 (sans HTML5, via @alirobe)
// add me to the bottom of v5.js
// via gist @ http://github.com/alirobe
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
alirobe / gist:590b3e1f0092333fb95e
Created January 23, 2012 01:27
sharepoint form checkbox show/hide
//<script src="/hosted/Style%20Library/jquery-1.7.1.min.js" type="text/javascript"></script><script type="text/javascript">
//jQuery.noConflict();
jQuery(function(){
var cfg= {
'CRM':['CRM Access'],
'SharePoint':['SharePoint Access'],
'GP':['GP Security Role','GP Access Level','GP Company Name'],
'Replace Existing User':['Existing user email address']
}
for(var i in cfg) {
@alirobe
alirobe / html5.master.part
Created February 1, 2012 06:03
On-demand IE9 rendering for SharePoint 2010 Master Pages.
<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"/>
</asp:ContentPlaceHolder>
@alirobe
alirobe / SP2010-chromeScrollingFix
Last active January 13, 2017 18:54
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.
//via http://withinsharepoint.com/archives/256 or http://withinsharepoint.com/archives/210
if (jQuery.browser.webkit) {
jQuery(document).ready(function () {
var interval;
function loopCheck() {
if (typeof (_spBodyOnLoadWrapper) !== "undefined" && _spBodyOnLoadCalled == false)
_spBodyOnLoadWrapper();
else
window.clearInterval(interval);
@alirobe
alirobe / masterfile-snippet.html
Last active August 19, 2022 21:50
Enable Chrome 'quick-search' for SharePoint Intranets
<!--
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
alirobe / stickyfooter-2010.js
Last active December 15, 2015 06:39
A modification of Randy Drisgill's "Sticky footers in SharePoint" for SP2010. Works for me...
// 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)
// http://blog.drisgill.com/2013/01/sticky-footers-in-sharepoint.html
// jQuery.noConflict();