Skip to content

Instantly share code, notes, and snippets.

Olly Hodgson OllyHodgson

Block or report user

Report or block OllyHodgson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@OllyHodgson
OllyHodgson / SP2010 ASP:Repeater-based navigation with current item selection.aspx
Last active Mar 8, 2019
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.
View SP2010 ASP:Repeater-based navigation with current item selection.aspx
<!-- top navigation publishing data source -->
<PublishingNavigation:PortalSiteMapDataSource
id="topSiteMap"
runat="server"
EnableViewState="false"
SiteMapProvider="GlobalNavigation"
StartFromCurrentNode="false"
StartingNodeOffset="0"
ShowStartingNode="true"
TrimNonCurrentTypes="Heading"/>
@OllyHodgson
OllyHodgson / _LoadFromLiquidContentAPI.cshtml
Last active Nov 27, 2018
Load data from the DNN Evoq Liquid Content API using the DNN Razor Host module. Razor gives you a bit more control and flexibility than the built-in visualizers.
View _LoadFromLiquidContentAPI.cshtml
@using System
@using System.Net
@using System.Text
@using Newtonsoft.Json
@using Newtonsoft.Json.Linq
@{
// The API URL and your API Key
string url = "https://dnnapi.com/content/api/ContentItems?contentTypeId=7f0d48be-a6bf-4f3c-9fdf-ba895727e818";
string apikey = "**** INSERT YOUR API KEY HERE ****";
@OllyHodgson
OllyHodgson / jquery.offscreen.js
Created Nov 22, 2018
Simple jquery plugin to transition elements onto the page using CSS animations
View jquery.offscreen.js
// Custom selector to find if something is in the viewport
// Adapted from https://stackoverflow.com/a/8897628/13019
jQuery.expr.pseudos.offscreen = function (el) {
var rect = el.getBoundingClientRect();
return (
(rect.x + rect.width) < 0 || (rect.y + rect.height) < 0 || (rect.x > window.innerWidth || rect.y > window.innerHeight)
);
};
@OllyHodgson
OllyHodgson / index.html
Created Mar 20, 2018
CSS flexbox layout experiment - boxes breaking out of boxes. It later occurred to me that CSS Grid might have been the better tool. Hey ho.
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title></title>
<style>
html,
body {
@OllyHodgson
OllyHodgson / SP2010-Bootstrap3-Fixes.less
Created Oct 10, 2013
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.
View SP2010-Bootstrap3-Fixes.less
/****************************************************************************
*
* 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 Nov 2, 2016
The Sharepoint Rich HTML editor leaves ZERO WIDTH SPACE chracters (&#8203; 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...
View jQuery.stripZWSP-1.0.js
/*
* The Sharepoint Rich HTML editor leaves ZERO WIDTH SPACE chracters (&#8203;
* 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 / Strip out spurious HTML.js
Last active Mar 14, 2016
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.
View Strip out spurious HTML.js
/*
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 Mar 14, 2016
Run this in the devtools console on a SharePoint 2010 page when in edit mode, to strip out some spurious crap from the HTML.
View Strip out some spurious HTML.js
/*
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 / modernizr-ielegacyfilters.js
Last active Dec 16, 2015
Modernizr test for legacy IE Filters and Transitions (COMPLETELY UNTESTED!)
View modernizr-ielegacyfilters.js
/*
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 / detectIEfiltersupport.js
Last active Dec 16, 2015
Test for IE legacy Filters and Transitions support
View detectIEfiltersupport.js
/*
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:
You can’t perform that action at this time.