Skip to content

Instantly share code, notes, and snippets.

View OllyHodgson's full-sized avatar

Olly Hodgson OllyHodgson

View GitHub Profile
@OllyHodgson
OllyHodgson / sparkline.svg
Created January 7, 2013 09:50
Stuart Langridge's Simple SVG sparklines — http://kryogenix.org/days/2012/12/30/simple-svg-sparklines — but using an object element instead of an embed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@OllyHodgson
OllyHodgson / detectIEfiltersupport.js
Last active December 16, 2015 02:19
Test for IE legacy Filters and Transitions support
/*
Test if this install of IE supports legacy Filters and Transitions
Needed because Filters and Transitions can be disabled under IE's security
settings ("Binary and Script Behaviors" under the "ActiveX controls and
plug-ins" category). This is often done on corporate windows installations
"for security reasons". They'll fail silently (or error if you try to access
the element's filter collection in js). This setting also disables VML.
See:
@OllyHodgson
OllyHodgson / modernizr-ielegacyfilters.js
Last active December 16, 2015 02:19
Modernizr test for legacy IE Filters and Transitions (COMPLETELY UNTESTED!)
/*
Modernizr test for legacy IE Filters and Transitions
I haven't tested this with Modernizr! Just adapted my solution to look like
https://gist.github.com/farmdawgnation/2636061
Needed because Filters and Transitions can be disabled under IE's security
settings ("Binary and Script Behaviors" under the "ActiveX controls and
plug-ins" category). This is often done on corporate windows installations
"for security reasons". They'll fail silently (or error if you try to access
@OllyHodgson
OllyHodgson / SP2010-Bootstrap3-Fixes.less
Created October 10, 2013 14:08
Some CSS fixes to make SharePoint 2010 Publishing sites get along better with Bootstrap 3. For the most part, it sets SP2010's own UI elements to use `box-sizing: content-box;` instead of `box-sizing: border-box;` as used by BS3. Either import this at the end of bootstrap.less, or after importing bootstrap.less into your own .less files.
/****************************************************************************
*
* This LESS file contains fixes to make Bootstrap 3 play nicely with
* SharePoint 2010 Publishing pages. It mainly switches SP2010's UI
* elements back to the "content-box" box-model.
*
* It also incorporates the CSS portions of Kyle Schaeffer's fixes for
* scrolling on SP2010. The JS part is called from the master page.
*
****************************************************************************/
@OllyHodgson
OllyHodgson / jQuery.stripZWSP-1.0.js
Last active November 2, 2016 19:35
The Sharepoint Rich HTML editor leaves ZERO WIDTH SPACE chracters (​ or \u200B) all over the place. This trawls through the HTML you pass in and strips out zero width space characters from text nodes within. Potentially a sledgehammer/nut solution...
/*
* The Sharepoint Rich HTML editor leaves ZERO WIDTH SPACE chracters (​
* or \u200B) all over the place. This trawls through the HTML you pass in and
* strips out zero width space characters from text nodes within.
*
* http://blog.bugrapostaci.com/2014/02/02/publishing-field-encoding-extra-questionmark-charecters-actually-acsii-8203-zero-width-space/
*
* This trawls through the HTML you pass in and strips out zero width space
* characters from text nodes within.
*
@OllyHodgson
OllyHodgson / devtools.responsiveUI.presets
Last active August 29, 2015 14:17
Presets for the Firefox devtools Responsive Design View. Includes presets for default Bootstrap 3 grid sizes and some iPhones. To use, navigate to about:config and then add or edit the devtools.responsiveUI.presets key.
[{"key":"300x400","name":"Very small screen","width":300,"height":400},{"key":"320x480","name":"iPhone 4","width":320,"height":480},{"key":"320x568","name":"iPhone 5","width":320,"height":568},{"key":"360x640","name":"Nexus 4","width":360,"height":640},{"key":"375x667","name":"iPhone 6","width":375,"height":667},{"key":"414x736","name":"iPhone 6 Plus","width":414,"height":736},{"key":"767x1024","name":"@screen-xs-max","width":767,"height":1024},{"key":"768x1024","name":"@screen-sm-min","width":768,"height":1024},{"key":"991x1280","name":"@screen-sm-max","width":991,"height":1280},{"key":"992x1280","name":"@screen-md-min","width":992,"height":1280},{"key":"1199x801","name":"@screen-md-max","width":1199,"height":801},{"key":"1200x801","name":"@screen-lg-min","width":1200,"height":801},{"key":"1280x600","name":"Netbook","width":1280,"height":600}]
@OllyHodgson
OllyHodgson / countCSSRules.js
Created April 9, 2015 14:44 — forked from krisbulman/countCSSRules.js
Run this in the dev tools console to ensure none of your stylesheets have too many rules / selectors for legacy IE (IE9 and below).
function countCSSRules() {
var results = '',
log = '',
slen = document.styleSheets.length;
if (!document.styleSheets) {
return;
}
for (var i = 0; i < slen; i++) {
countSheet(document.styleSheets[i]);
}
@OllyHodgson
OllyHodgson / Strip out spurious HTML.js
Last active March 14, 2016 14:02
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out quite a lot of spurious crap from the HTML.
/*
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out quite a lot of spurious crap from the HTML.
*/
(function($, window, document) {
var $editables = $("[contenteditable], input[type='hidden'][id*='hiddenStorage'], input[type='hidden'][id*='hiddenDisplay'], input[type='hidden'][id^='ctl00'][id$='content']"),
originalHTML,
filterHTML,
$el,
$filterHTML,
@OllyHodgson
OllyHodgson / Strip out some spurious HTML.js
Last active March 14, 2016 14:02
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out some spurious crap from the HTML.
/*
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out some spurious crap from the HTML.
*/
(function($, window, document) {
var $editables = $("[contenteditable], input[type='hidden'][id*='hiddenStorage'], input[type='hidden'][id*='hiddenDisplay'], input[type='hidden'][id^='ctl00'][id$='content']", ".edit-mode"),
originalHTML,
filterHTML,
$el,
$filterHTML,
@OllyHodgson
OllyHodgson / SP2010 ASP:Repeater-based navigation with current item selection.aspx
Last active March 8, 2019 18:40
SharePoint 2010 top level navigation code. Built with a nested ASP:Repeater control. Easier to style with Bootstrap or Flexbox than the ASP:Menu control. Includes highlighting of the current section.
<!-- top navigation publishing data source -->
<PublishingNavigation:PortalSiteMapDataSource
id="topSiteMap"
runat="server"
EnableViewState="false"
SiteMapProvider="GlobalNavigation"
StartFromCurrentNode="false"
StartingNodeOffset="0"
ShowStartingNode="true"
TrimNonCurrentTypes="Heading"/>