Skip to content

Commit a0117ad

Browse files
author
Jordan McCullough
committed
Revert "Slide-like cover + all curriculum resources layout beta"
1 parent 3041549 commit a0117ad

32 files changed

+7801
-6428
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,3 @@
1313
[submodule "slides/dependencies/snap-svg"]
1414
path = slides/dependencies/snap-svg
1515
url = https://github.com/adobe-webplatform/Snap.svg.git
16-
[submodule "_javascript/jquery-scrollsnap-plugin"]
17-
path = _javascript/jquery-scrollsnap-plugin
18-
url = https://github.com/benoitpointet/jquery-scrollsnap-plugin.git

_includes/dependencies

Lines changed: 0 additions & 14 deletions
This file was deleted.

_includes/slide-section

Lines changed: 0 additions & 6 deletions
This file was deleted.

_javascript/curriculum.js

Lines changed: 78 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ $(function(){
22

33
buildToc();
44

5-
$(document).scrollsnap({
6-
snaps: 'section',
7-
proximity: 250
8-
});
5+
// SnapSVG
6+
// Run once at startup to inject all SVGs
7+
loadAllSvg();
98

109
function buildToc(){
1110
var headings = $("h3"),
@@ -27,17 +26,85 @@ $(function(){
2726

2827
item = $('<li><a href="#' + headingSep + '">' + headings[h].innerHTML + '</a></li>');
2928
toc.append(item);
30-
// console.log(headings[h].parentElement);
29+
headings[h].setAttribute("id", headingSep);
30+
$('.curriculum').scrollspy({ target: '#toc' });
31+
}
32+
}
33+
34+
function loadAllSvg(){
35+
var els = document.getElementsByTagName("svg"),
36+
elCount = 0;
3137

32-
// var hiddenTitle = document.createElement("h3");
33-
// hiddenTitle.setAttribute("id", headingSep);
34-
// console.log(hiddenTitle);
38+
for(elCount = 0; elCount < els.length; elCount++){
39+
injectSvg(els[elCount]);
40+
}
41+
}
3542

36-
// $(headings[h].parentElement).prepend(hiddenTitle);
43+
function injectSvg(canvasTarget){
44+
if(canvasTarget){
45+
Snap.load(
46+
canvasTarget.getAttribute("data-path"),
47+
function (frag) {
48+
sCanvas = Snap("#" + canvasTarget.getAttribute("id"));
49+
fCanvas = Snap();
50+
sCanvas.clear();
3751

38-
headings[h].parentElement.setAttribute("id", headingSep);
52+
//Determine if grouped build-steps present
53+
var buildStepBase = frag.select("#base");
54+
buildStepGroups = frag.selectAll("[id^=step-]"),
55+
buildStepCount = buildStepGroups.length,
56+
buildStep = 0;
3957

40-
$('.curriculum').scrollspy({ target: '#toc' });
58+
//Setup the container canvas boundary sizing
59+
setCanvasBBox(frag, canvasTarget);
60+
61+
// Show the first build step when available
62+
// Otherwise just show entire graphic
63+
if(buildStepCount > 0){
64+
// Include the non-fragment base layout/visuals
65+
fCanvas.append(buildStepBase);
66+
// fCanvas.append(buildStepGroups[buildStep]);
67+
68+
for(; buildStep < buildStepCount; buildStep++){
69+
70+
// Supports fragment in-out transitions by
71+
// wrapping in a group and applying a second
72+
// fragment class
73+
if(buildStepGroups[buildStep].node.id.match(/in-out/)){
74+
var tG = fCanvas.g(buildStepGroups[buildStep]);
75+
buildStepGroups[buildStep].attr("class", "fragment fade-out");
76+
tG.attr("class", "fragment");
77+
fCanvas.append(tG);
78+
}
79+
else{
80+
buildStepGroups[buildStep].attr("class", "fragment");
81+
fCanvas.append(buildStepGroups[buildStep]);
82+
}
83+
}
84+
} else{
85+
//No "steps" to build out, ensure boundary guide
86+
//is not rendered
87+
frag.select("#boundary").remove();
88+
fCanvas.append(frag);
89+
}
90+
91+
sCanvas.append(fCanvas);
92+
}
93+
);
4194
}
4295
}
96+
97+
function setCanvasBBox(canvas, target){
98+
var boundary,
99+
maxWidth,
100+
maxHeight;
101+
102+
boundary = canvas.select("#boundary").select(":first-child").getBBox();
103+
maxWidth = Math.ceil(boundary.width);
104+
maxHeight = Math.ceil(boundary.height);
105+
106+
target.setAttribute("height", (((maxHeight/maxWidth)*100)+"%"));
107+
target.setAttribute("viewBox", "0 0 " + maxWidth + " " + maxHeight);
108+
return canvas;
109+
}
43110
});

_javascript/jquery-scrollsnap-plugin

Lines changed: 0 additions & 1 deletion
This file was deleted.

_layouts/bare.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,20 @@
1717
{% endif %}
1818
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
1919

20-
{% include dependencies %}
20+
<link rel="stylesheet" media="all" href="{{ leadingpath }}/_stylesheets/page.css" />
21+
22+
<link rel="stylesheet" media="screen" href="{{ leadingpath }}/_stylesheets/page.css" type="text/css" />
23+
24+
{% include analytics.html %}
25+
26+
<script src="{{ leadingpath }}/_javascript/jquery-1.11.0.min.js"></script>
27+
<script src="{{ leadingpath }}/_javascript/page.js"></script>
28+
29+
<!-- Latest compiled and minified CSS -->
30+
<link rel="stylesheet" href="{{ leadingpath }}/_javascript/bootstrap/css/bootstrap.min.css">
31+
32+
<!-- Latest compiled and minified JavaScript -->
33+
<script src="{{ leadingpath }}/_javascript/bootstrap/js/bootstrap.min.js"></script>
2134
</head>
2235
<body data-spy="scroll" data-target="#toc">
2336
{% include navigation.html %}

_layouts/curriculum-beta.html

Lines changed: 0 additions & 37 deletions
This file was deleted.

_layouts/curriculum.html

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,31 @@
11
---
2-
2+
layout: bare
33
---
44

5+
<script src="../_javascript/snap-svg/dist/snap.svg-min.js"></script>
6+
<script src="../_javascript/curriculum.js"></script>
57

6-
<!DOCTYPE html>
7-
<html lang="{% if page.lang %}{{ page.lang }}{% else %}{{ site.lang }}{% endif %}">
8-
<head>
9-
<title>{% if page.title %}{{ page.title }} · {% endif %}{{ site.title }}</title>
10-
{% if page.description %}
11-
<meta name="description" content="{{ page.description }}" />
12-
{% endif %}
13-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
14-
15-
{% include dependencies %}
16-
8+
<section class="hero overview">
9+
<div class="container">
10+
<div class="content">
11+
<h2>{{ page.title }}</h2>
12+
<p>{{ page.description }}</p>
13+
</div>
14+
</div>
15+
</section>
1716

18-
<script src="../_javascript/snap-svg/dist/snap.svg-min.js"></script>
19-
<script src="../_javascript/curriculum.js"></script>
20-
</head>
21-
<body data-spy="scroll" data-target="#toc">
22-
{% include navigation.html %}
23-
<section class="hero overview">
24-
<div class="container">
25-
<div class="content">
26-
<h2>{{ page.title }}</h2>
27-
<p>{{ page.description }}</p>
28-
</div>
29-
</div>
30-
</section>
17+
<div class="container curriculum">
18+
<div class="two-thirds markdown-content">
19+
{{ content }}
20+
</div>
3121

22+
<div class="third">
3223
<div id="toc-wrapper">
3324
<div id="toc" data-spy="affix" data-offset-top="165">
3425
<ul id="toc-list" class="nav" role="tablist"></ul>
3526
</div>
3627
</div>
37-
38-
<div class="curriculum">
39-
<!-- <div class="two-thirds"> -->
40-
{{ content }}
41-
<!-- </div> -->
42-
</div>
43-
44-
<!-- {% include footer.html %} -->
45-
46-
47-
</body>
48-
</html>
49-
50-
51-
52-
28+
</div>
29+
</div>
5330

31+
{% include footer.html %}

0 commit comments

Comments
 (0)