Skip to content

Instantly share code, notes, and snippets.

@spdustin
spdustin / faqs.js
Created July 18, 2012 16:38
FAQs toggler final
$('dl.faq > dt')
.on(
'click',
function() {
$(this)
.toggleClass('closed opened')
.next()
.toggle();
}
)
@spdustin
spdustin / ql.js
Created July 18, 2012 19:38
QL Toggle
$('div.s4-ql ul.root > li > a')
.on(
'click',
function(e) {
e.preventDefault();
$(this).next().toggle();
}
)
;
@spdustin
spdustin / ribbonhack5.js
Created September 11, 2012 20:54
Ribbon Hack 5
function spe_emf_FixWorkspace() {
var elWorkspace = document.getElementById('s4-workspace');
elWorkspace.style.height = (GetViewportHeight() - (AbsTop(elWorkspace))) + "px";
}
ExecuteOrDelayUntilScriptLoaded(function () { SP.UI.Workspace.add_resized(spe_emf_FixWorkspace); }, "init.js");
@spdustin
spdustin / spe-decorate-wptitle.js
Created October 16, 2012 18:03
Decorate SharePoint Web Part containers with Web Part Title as a class
$(".ms-WPHeaderTd").each(
function() {
var webPartClass = "wptitle-" + $(this).attr("title").replace(/[^a-z]/ig,'').toLowerCase();
console.log(webPartClass);
$(this).closest(".s4-wpcell").addClass(webPartClass);
}
);
@spdustin
spdustin / snippet.xml
Created October 29, 2012 15:50
XML Sample
<cars>
<car make="Ford" model="Pinto">
<passenger name="Dustin" />
<passenger name="Graham" />
</car>
<car make="Toyota" model="Prius" />
<car make="Nissan" model="Sentra" />
</cars>
@spdustin
spdustin / xsl-step-1.xsl
Created October 29, 2012 16:05
XSL Step 1
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="/">
<table>
<thead>
<tr>
<th>Make</th>
@spdustin
spdustin / xsl-step-2.xsl
Created October 29, 2012 16:25
XSL Step 2
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="/">
<table>
<thead>
<tr>
<th>Make</th>
<th>Model</th>
@spdustin
spdustin / xsl-step-3.xsl
Created October 29, 2012 16:36
XSL Step 3
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="/">
<table>
<thead>
<tr>
<th>Make</th>
<th>Model</th>
@spdustin
spdustin / xsl-test-empty-emit-ul.xsl
Created October 29, 2012 19:18
XSL - test for empty and create UL
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<table>
<thead>
<tr>
<th>Make</th>
<th>Model</th>
@spdustin
spdustin / tasks-sample.xml
Created October 29, 2012 19:52
XML Sample Tasks
<dsQueryResponse BaseViewID="1" RowLimit="30" TemplateType="107" ViewStyleID="">
<Rows>
<Row AssignedTo="&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; &gt;
&lt;tr&gt;
&lt;td style=&quot;padding-right: 3px;&quot;&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;" AssignedTo.id="" AssignedTo.span="&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; &gt;
&lt;tr&gt;
&lt;td style=&quot;padding-right: 3px;&quot;&gt;