staple 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/Gemfile +13 -0
- data/LICENSE.md +23 -0
- data/README.md +51 -0
- data/Rakefile +0 -0
- data/config.rb +24 -0
- data/lib/snippet_helpers.rb +69 -0
- data/lib/staple/import_generator.rb +50 -0
- data/lib/staple/list_generator.rb +22 -0
- data/lib/staple.rb +2 -0
- data/source/CNAME +1 -0
- data/source/_accordion.html.erb +24 -0
- data/source/_accordion_tabs.html.erb +26 -0
- data/source/_accordion_tabs_minimal.html.erb +26 -0
- data/source/_badges.html.erb +7 -0
- data/source/_breadcrumbs.html.erb +7 -0
- data/source/_browser.html.erb +29 -0
- data/source/_button_group.html.erb +18 -0
- data/source/_cards.html.erb +59 -0
- data/source/_centered_navigation.html.erb +38 -0
- data/source/_code.html.erb +10 -0
- data/source/_comment.html.erb +21 -0
- data/source/_device.html.erb +10 -0
- data/source/_dropdown.html.erb +12 -0
- data/source/_expander.html.erb +6 -0
- data/source/_flashes.html.erb +15 -0
- data/source/_footer.html.erb +28 -0
- data/source/_footer_2.html.erb +33 -0
- data/source/_grid_items.html.erb +37 -0
- data/source/_grid_items_lines.html.erb +44 -0
- data/source/_hero.html.erb +11 -0
- data/source/_hover_tile_animation.html.erb +11 -0
- data/source/_icon_bullet_points.html.erb +30 -0
- data/source/_image_gradient_dynamic.html.erb +7 -0
- data/source/_intro_text.html.erb +6 -0
- data/source/_label_alerts.html.erb +5 -0
- data/source/_modal.html.erb +14 -0
- data/source/_navigation.html.erb +44 -0
- data/source/_pagination.html.erb +17 -0
- data/source/_progress_bar.html.erb +3 -0
- data/source/_progress_bar_indication.html.erb +5 -0
- data/source/_search_bar.html.erb +8 -0
- data/source/_search_tools.html.erb +58 -0
- data/source/_side_image.html.erb +10 -0
- data/source/_sliding_menu.html.erb +13 -0
- data/source/_snippet.html.erb +4 -0
- data/source/_switch.html.erb +4 -0
- data/source/_tables.html.erb +31 -0
- data/source/_tables_minimal.html.erb +31 -0
- data/source/_texture-legend.html.erb +24 -0
- data/source/_textures.html.erb +4 -0
- data/source/_tooltip.html.erb +6 -0
- data/source/_type_system_geometric.html.erb +18 -0
- data/source/_type_system_rounded.html.erb +18 -0
- data/source/_type_system_sans.html.erb +18 -0
- data/source/_type_system_serif.html.erb +19 -0
- data/source/_type_system_slab.html.erb +18 -0
- data/source/_type_system_traditional.html.erb +18 -0
- data/source/_vertical_tabs.html.erb +30 -0
- data/source/_video.html.erb +5 -0
- data/source/components.html.erb +174 -0
- data/source/index.html.erb +162 -0
- data/source/javascripts/all.js +11 -0
- data/source/javascripts/jquery.erToc.js +477 -0
- data/source/javascripts/jquery.glide.js +941 -0
- data/source/javascripts/staple/accordion.js +5 -0
- data/source/javascripts/staple/accordion_tabs.js +19 -0
- data/source/javascripts/staple/accordion_tabs_minimal.js +19 -0
- data/source/javascripts/staple/centered_navigation.js +14 -0
- data/source/javascripts/staple/dropdown.js +9 -0
- data/source/javascripts/staple/expander.js +53 -0
- data/source/javascripts/staple/navigation.js +23 -0
- data/source/javascripts/staple/search_tools.js +110 -0
- data/source/javascripts/staple/sliding_menu.js +13 -0
- data/source/javascripts/staple/vertical_tabs.js +32 -0
- data/source/layouts/layout.erb +1 -0
- data/source/refills-hero.html.erb +7 -0
- data/source/refills-menu.html.erb +5 -0
- data/source/refills-page-scripts.html.erb +66 -0
- data/source/stylesheets/_bourbon-nav.scss +86 -0
- data/source/stylesheets/_normalize.scss +425 -0
- data/source/stylesheets/_refills-nav.scss +102 -0
- data/source/stylesheets/_refills-styles.scss +543 -0
- data/source/stylesheets/all.scss +61 -0
- data/source/stylesheets/staple/_accordion-tabs-minimal.scss +60 -0
- data/source/stylesheets/staple/_accordion-tabs.scss +88 -0
- data/source/stylesheets/staple/_accordion.scss +55 -0
- data/source/stylesheets/staple/_badges.scss +44 -0
- data/source/stylesheets/staple/_breadcrumbs.scss +84 -0
- data/source/stylesheets/staple/_browser.scss +141 -0
- data/source/stylesheets/staple/_button-group.scss +81 -0
- data/source/stylesheets/staple/_cards.scss +132 -0
- data/source/stylesheets/staple/_centered-navigation.scss +251 -0
- data/source/stylesheets/staple/_comment.scss +60 -0
- data/source/stylesheets/staple/_device.scss +83 -0
- data/source/stylesheets/staple/_dropdown.scss +127 -0
- data/source/stylesheets/staple/_expander.scss +30 -0
- data/source/stylesheets/staple/_flashes.scss +29 -0
- data/source/stylesheets/staple/_footer-2.scss +117 -0
- data/source/stylesheets/staple/_footer.scss +76 -0
- data/source/stylesheets/staple/_grid-items-lines.scss +86 -0
- data/source/stylesheets/staple/_grid-items.scss +97 -0
- data/source/stylesheets/staple/_hero.scss +54 -0
- data/source/stylesheets/staple/_hover-tile-animation.scss +52 -0
- data/source/stylesheets/staple/_icon-bullet-points.scss +63 -0
- data/source/stylesheets/staple/_image-gradient-dynamic.scss +59 -0
- data/source/stylesheets/staple/_intro-text.scss +67 -0
- data/source/stylesheets/staple/_label-alerts.scss +11 -0
- data/source/stylesheets/staple/_modal.scss +147 -0
- data/source/stylesheets/staple/_navigation.scss +329 -0
- data/source/stylesheets/staple/_pagination.scss +51 -0
- data/source/stylesheets/staple/_progress-bar-indication.scss +39 -0
- data/source/stylesheets/staple/_progress-bar.scss +83 -0
- data/source/stylesheets/staple/_search-bar.scss +40 -0
- data/source/stylesheets/staple/_search-tools.scss +67 -0
- data/source/stylesheets/staple/_side-image.scss +59 -0
- data/source/stylesheets/staple/_sliding-menu.scss +63 -0
- data/source/stylesheets/staple/_switch.scss +77 -0
- data/source/stylesheets/staple/_tables-minimal.scss +60 -0
- data/source/stylesheets/staple/_tables.scss +88 -0
- data/source/stylesheets/staple/_texture-legend.scss +182 -0
- data/source/stylesheets/staple/_textures.scss +119 -0
- data/source/stylesheets/staple/_tooltip.scss +57 -0
- data/source/stylesheets/staple/_type-system-geometric.scss +103 -0
- data/source/stylesheets/staple/_type-system-rounded.scss +107 -0
- data/source/stylesheets/staple/_type-system-sans.scss +110 -0
- data/source/stylesheets/staple/_type-system-serif.scss +111 -0
- data/source/stylesheets/staple/_type-system-slab.scss +107 -0
- data/source/stylesheets/staple/_type-system-traditional.scss +114 -0
- data/source/stylesheets/staple/_vertical-tabs.scss +105 -0
- data/source/stylesheets/staple/_video.scss +21 -0
- data/source/type-systems.html.erb +67 -0
- data/source/vendor/javascripts/ZeroClipboard.min.js +9 -0
- data/source/vendor/javascripts/fixedsticky.js +185 -0
- data/source/vendor/javascripts/prism.js +13 -0
- data/source/vendor/javascripts/smooth-scroll.js +125 -0
- data/source/vendor/stylesheets/fixedsticky.css +22 -0
- data/source/vendor/stylesheets/prism.css +126 -0
- data/staple.gemspec +19 -0
- metadata +184 -0
@@ -0,0 +1,105 @@
|
|
1
|
+
.vertical-tabs-container { // small screens: accordion
|
2
|
+
$tab-border-color: $base-border-color;
|
3
|
+
$tab-border: 1px solid $tab-border-color;
|
4
|
+
$tab-border-radius: $base-border-radius;
|
5
|
+
$tab-content-background: lighten($tab-border-color, 10);
|
6
|
+
$tab-active-color: $tab-content-background;
|
7
|
+
$tab-inactive-color: $base-background-color;
|
8
|
+
$vertical-tabs-height: em(300);
|
9
|
+
$vertical-tab-mode: $medium-screen;
|
10
|
+
|
11
|
+
@include clearfix;
|
12
|
+
border-radius: $tab-border-radius;
|
13
|
+
border: $tab-border;
|
14
|
+
margin-bottom: $base-spacing;
|
15
|
+
overflow: hidden;
|
16
|
+
|
17
|
+
.vertical-tabs {
|
18
|
+
display: none;
|
19
|
+
|
20
|
+
@include media($vertical-tab-mode) {
|
21
|
+
background-color: $tab-inactive-color;
|
22
|
+
display: inline;
|
23
|
+
float: left;
|
24
|
+
height: $vertical-tabs-height;
|
25
|
+
width: 20%;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
.vertical-tab {
|
30
|
+
@include media($vertical-tab-mode) {
|
31
|
+
border-bottom: $tab-border;
|
32
|
+
display: block;
|
33
|
+
font-weight: bold;
|
34
|
+
margin-right: -1px;
|
35
|
+
padding: $base-spacing/2 $gutter/2;
|
36
|
+
|
37
|
+
&.is-active {
|
38
|
+
background-color: $tab-content-background;
|
39
|
+
margin-right: -1px;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
a.vertical-tab-accordion-heading,
|
45
|
+
a.vertical-tab {
|
46
|
+
color: $dark-gray;
|
47
|
+
}
|
48
|
+
|
49
|
+
.vertical-tab:focus {
|
50
|
+
outline: none;
|
51
|
+
}
|
52
|
+
|
53
|
+
.vertical-tab-content-container {
|
54
|
+
display: block;
|
55
|
+
margin: 0 auto;
|
56
|
+
|
57
|
+
& a:focus {
|
58
|
+
outline: none;
|
59
|
+
}
|
60
|
+
|
61
|
+
@include media($vertical-tab-mode) {
|
62
|
+
@include inline-block;
|
63
|
+
@include size(80% $vertical-tabs-height);
|
64
|
+
background-color: $tab-content-background;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
.vertical-tab-content {
|
69
|
+
background-color: $tab-content-background;
|
70
|
+
padding: $base-spacing $gutter;
|
71
|
+
|
72
|
+
@include media($vertical-tab-mode) {
|
73
|
+
border: none;
|
74
|
+
display: none;
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
.vertical-tab-accordion-heading {
|
79
|
+
background-color: $tab-inactive-color;
|
80
|
+
border-top: $tab-border;
|
81
|
+
cursor: pointer;
|
82
|
+
display: block;
|
83
|
+
font-weight: bold;
|
84
|
+
padding: $base-spacing/2 $gutter/2;
|
85
|
+
|
86
|
+
&:hover {
|
87
|
+
color: $base-accent-color;
|
88
|
+
}
|
89
|
+
|
90
|
+
&:first-child {
|
91
|
+
border-top: none;
|
92
|
+
}
|
93
|
+
|
94
|
+
&.is-active {
|
95
|
+
background: $tab-active-color;
|
96
|
+
border-bottom: none;
|
97
|
+
}
|
98
|
+
|
99
|
+
@include media($vertical-tab-mode) {
|
100
|
+
display: none;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
// Based on code by Jett Miller jettmiller.net
|
@@ -0,0 +1,21 @@
|
|
1
|
+
.video {
|
2
|
+
margin: auto;
|
3
|
+
|
4
|
+
@include media($large-screen) {
|
5
|
+
width: 50%;
|
6
|
+
}
|
7
|
+
}
|
8
|
+
|
9
|
+
.video-wrapper {
|
10
|
+
position: relative;
|
11
|
+
padding-bottom: 56.25%; // For ratio 16:9. 75% if ratio is 4:3
|
12
|
+
height: 0;
|
13
|
+
}
|
14
|
+
|
15
|
+
iframe {
|
16
|
+
position: absolute;
|
17
|
+
top: 0;
|
18
|
+
left: 0;
|
19
|
+
width: 100%;
|
20
|
+
height: 100%;
|
21
|
+
}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
<div class="refills-type-systems">
|
2
|
+
|
3
|
+
<a class="js-menu-trigger-refills refills-menu-anchor fixedsticky">
|
4
|
+
<img src="/images/menu.png" alt="Menu icon">
|
5
|
+
</a>
|
6
|
+
<div class="js-menu-screen-refills refills-menu-screen"></div>
|
7
|
+
|
8
|
+
<%= partial "refills-hero" %>
|
9
|
+
<%= partial "refills-menu" %>
|
10
|
+
|
11
|
+
<div id="example">
|
12
|
+
|
13
|
+
<div id="type-systems" class="refill">
|
14
|
+
|
15
|
+
<div class="refills-wrapper">
|
16
|
+
<div class="line-behind-text"><h6>Geometric</h6></div>
|
17
|
+
<div class="refill-smaller">
|
18
|
+
<div class="refill-centering"><%= partial "type_system_geometric" %></div>
|
19
|
+
</div>
|
20
|
+
<div class="refill-snippet"><%= code_for('type_system_geometric') %></div>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div class="refills-wrapper">
|
24
|
+
<div class="line-behind-text"><h6>Rounded Sans Serif</h6></div>
|
25
|
+
<div class="refill-smaller">
|
26
|
+
<div class="refill-centering"><%= partial "type_system_rounded" %></div>
|
27
|
+
</div>
|
28
|
+
<div class="refill-snippet"><%= code_for('type_system_rounded') %></div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div class="refills-wrapper">
|
32
|
+
<div class="line-behind-text"><h6>Sans Serif</h6></div>
|
33
|
+
<div class="refill-smaller">
|
34
|
+
<div class="refill-centering"><%= partial "type_system_sans" %></div>
|
35
|
+
</div>
|
36
|
+
<div class="refill-snippet"><%= code_for('type_system_sans') %></div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="refills-wrapper">
|
40
|
+
<div class="line-behind-text"><h6>Serif</h6></div>
|
41
|
+
<div class="refill-smaller">
|
42
|
+
<div class="refill-centering"><%= partial "type_system_serif" %></div>
|
43
|
+
</div>
|
44
|
+
<div class="refill-snippet"><%= code_for('type_system_serif') %></div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="refills-wrapper">
|
48
|
+
<div class="line-behind-text"><h6>Slab Serif</h6></div>
|
49
|
+
<div class="refill-smaller">
|
50
|
+
<div class="refill-centering"><%= partial "type_system_slab" %></div>
|
51
|
+
</div>
|
52
|
+
<div class="refill-snippet"><%= code_for('type_system_slab') %></div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<div class="refills-wrapper">
|
56
|
+
<div class="line-behind-text"><h6>Traditional</h6></div>
|
57
|
+
<div class="refill-smaller">
|
58
|
+
<div class="refill-centering"><%= partial "type_system_traditional" %></div>
|
59
|
+
</div>
|
60
|
+
<div class="refill-snippet"><%= code_for('type_system_traditional') %></div>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
|
67
|
+
<%= partial "refills-page-scripts" %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/*!
|
2
|
+
* ZeroClipboard
|
3
|
+
* The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
|
4
|
+
* Copyright (c) 2013 Jon Rohan, James M. Greene
|
5
|
+
* Licensed MIT
|
6
|
+
* http://zeroclipboard.org/
|
7
|
+
* v1.2.3
|
8
|
+
*/
|
9
|
+
!function(){"use strict";var a,b=function(){var a=/\-([a-z])/g,b=function(a,b){return b.toUpperCase()};return function(c){return c.replace(a,b)}}(),c=function(a,c){var d,e,f,g,h,i;if(window.getComputedStyle?d=window.getComputedStyle(a,null).getPropertyValue(c):(e=b(c),d=a.currentStyle?a.currentStyle[e]:a.style[e]),"cursor"===c&&(!d||"auto"===d))for(f=a.tagName.toLowerCase(),g=["a"],h=0,i=g.length;i>h;h++)if(f===g[h])return"pointer";return d},d=function(a){if(p.prototype._singleton){a||(a=window.event);var b;this!==window?b=this:a.target?b=a.target:a.srcElement&&(b=a.srcElement),p.prototype._singleton.setCurrent(b)}},e=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},f=function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent&&a.detachEvent("on"+b,c)},g=function(a,b){if(a.addClass)return a.addClass(b),a;if(b&&"string"==typeof b){var c=(b||"").split(/\s+/);if(1===a.nodeType)if(a.className){for(var d=" "+a.className+" ",e=a.className,f=0,g=c.length;g>f;f++)d.indexOf(" "+c[f]+" ")<0&&(e+=" "+c[f]);a.className=e.replace(/^\s+|\s+$/g,"")}else a.className=b}return a},h=function(a,b){if(a.removeClass)return a.removeClass(b),a;if(b&&"string"==typeof b||void 0===b){var c=(b||"").split(/\s+/);if(1===a.nodeType&&a.className)if(b){for(var d=(" "+a.className+" ").replace(/[\n\t]/g," "),e=0,f=c.length;f>e;e++)d=d.replace(" "+c[e]+" "," ");a.className=d.replace(/^\s+|\s+$/g,"")}else a.className=""}return a},i=function(){var a,b,c,d=1;return"function"==typeof document.body.getBoundingClientRect&&(a=document.body.getBoundingClientRect(),b=a.right-a.left,c=document.body.offsetWidth,d=Math.round(100*(b/c))/100),d},j=function(a){var b={left:0,top:0,width:0,height:0,zIndex:999999999},d=c(a,"z-index");if(d&&"auto"!==d&&(b.zIndex=parseInt(d,10)),a.getBoundingClientRect){var e,f,g,h=a.getBoundingClientRect();"pageXOffset"in window&&"pageYOffset"in window?(e=window.pageXOffset,f=window.pageYOffset):(g=i(),e=Math.round(document.documentElement.scrollLeft/g),f=Math.round(document.documentElement.scrollTop/g));var j=document.documentElement.clientLeft||0,k=document.documentElement.clientTop||0;b.left=h.left+e-j,b.top=h.top+f-k,b.width="width"in h?h.width:h.right-h.left,b.height="height"in h?h.height:h.bottom-h.top}return b},k=function(a,b){var c=!(b&&b.useNoCache===!1);return c?(-1===a.indexOf("?")?"?":"&")+"nocache="+(new Date).getTime():""},l=function(a){var b=[],c=[];return a.trustedOrigins&&("string"==typeof a.trustedOrigins?c.push(a.trustedOrigins):"object"==typeof a.trustedOrigins&&"length"in a.trustedOrigins&&(c=c.concat(a.trustedOrigins))),a.trustedDomains&&("string"==typeof a.trustedDomains?c.push(a.trustedDomains):"object"==typeof a.trustedDomains&&"length"in a.trustedDomains&&(c=c.concat(a.trustedDomains))),c.length&&b.push("trustedOrigins="+encodeURIComponent(c.join(","))),"string"==typeof a.amdModuleId&&a.amdModuleId&&b.push("amdModuleId="+encodeURIComponent(a.amdModuleId)),"string"==typeof a.cjsModuleId&&a.cjsModuleId&&b.push("cjsModuleId="+encodeURIComponent(a.cjsModuleId)),b.join("&")},m=function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;d>c;c++)if(b[c]===a)return c;return-1},n=function(a){if("string"==typeof a)throw new TypeError("ZeroClipboard doesn't accept query strings.");return a.length?a:[a]},o=function(a,b,c,d,e){e?window.setTimeout(function(){a.call(b,c,d)},0):a.call(b,c,d)},p=function(a,b){if(a&&(p.prototype._singleton||this).glue(a),p.prototype._singleton)return p.prototype._singleton;p.prototype._singleton=this,this.options={};for(var c in s)this.options[c]=s[c];for(var d in b)this.options[d]=b[d];this.handlers={},p.detectFlashSupport()&&v()},q=[];p.prototype.setCurrent=function(b){a=b,this.reposition();var d=b.getAttribute("title");d&&this.setTitle(d);var e=this.options.forceHandCursor===!0||"pointer"===c(b,"cursor");return r.call(this,e),this},p.prototype.setText=function(a){return a&&""!==a&&(this.options.text=a,this.ready()&&this.flashBridge.setText(a)),this},p.prototype.setTitle=function(a){return a&&""!==a&&this.htmlBridge.setAttribute("title",a),this},p.prototype.setSize=function(a,b){return this.ready()&&this.flashBridge.setSize(a,b),this},p.prototype.setHandCursor=function(a){return a="boolean"==typeof a?a:!!a,r.call(this,a),this.options.forceHandCursor=a,this};var r=function(a){this.ready()&&this.flashBridge.setHandCursor(a)};p.version="1.2.3";var s={moviePath:"ZeroClipboard.swf",trustedOrigins:null,text:null,hoverClass:"zeroclipboard-is-hover",activeClass:"zeroclipboard-is-active",allowScriptAccess:"sameDomain",useNoCache:!0,forceHandCursor:!1};p.setDefaults=function(a){for(var b in a)s[b]=a[b]},p.destroy=function(){p.prototype._singleton.unglue(q);var a=p.prototype._singleton.htmlBridge;a.parentNode.removeChild(a),delete p.prototype._singleton},p.detectFlashSupport=function(){var a=!1;if("function"==typeof ActiveXObject)try{new ActiveXObject("ShockwaveFlash.ShockwaveFlash")&&(a=!0)}catch(b){}return!a&&navigator.mimeTypes["application/x-shockwave-flash"]&&(a=!0),a};var t=null,u=null,v=function(){var a,b,c=p.prototype._singleton,d=document.getElementById("global-zeroclipboard-html-bridge");if(!d){var e={};for(var f in c.options)e[f]=c.options[f];e.amdModuleId=t,e.cjsModuleId=u;var g=l(e),h=' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="global-zeroclipboard-flash-bridge" width="100%" height="100%"> <param name="movie" value="'+c.options.moviePath+k(c.options.moviePath,c.options)+'"/> <param name="allowScriptAccess" value="'+c.options.allowScriptAccess+'"/> <param name="scale" value="exactfit"/> <param name="loop" value="false"/> <param name="menu" value="false"/> <param name="quality" value="best" /> <param name="bgcolor" value="#ffffff"/> <param name="wmode" value="transparent"/> <param name="flashvars" value="'+g+'"/> <embed src="'+c.options.moviePath+k(c.options.moviePath,c.options)+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="100%" height="100%" name="global-zeroclipboard-flash-bridge" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+g+'" scale="exactfit"> </embed> </object>';d=document.createElement("div"),d.id="global-zeroclipboard-html-bridge",d.setAttribute("class","global-zeroclipboard-container"),d.setAttribute("data-clipboard-ready",!1),d.style.position="absolute",d.style.left="-9999px",d.style.top="-9999px",d.style.width="15px",d.style.height="15px",d.style.zIndex="9999",d.innerHTML=h,document.body.appendChild(d)}c.htmlBridge=d,a=document["global-zeroclipboard-flash-bridge"],a&&(b=a.length)&&(a=a[b-1]),c.flashBridge=a||d.children[0].lastElementChild};p.prototype.resetBridge=function(){return this.htmlBridge.style.left="-9999px",this.htmlBridge.style.top="-9999px",this.htmlBridge.removeAttribute("title"),this.htmlBridge.removeAttribute("data-clipboard-text"),h(a,this.options.activeClass),a=null,this.options.text=null,this},p.prototype.ready=function(){var a=this.htmlBridge.getAttribute("data-clipboard-ready");return"true"===a||a===!0},p.prototype.reposition=function(){if(!a)return!1;var b=j(a);return this.htmlBridge.style.top=b.top+"px",this.htmlBridge.style.left=b.left+"px",this.htmlBridge.style.width=b.width+"px",this.htmlBridge.style.height=b.height+"px",this.htmlBridge.style.zIndex=b.zIndex+1,this.setSize(b.width,b.height),this},p.dispatch=function(a,b){p.prototype._singleton.receiveEvent(a,b)},p.prototype.on=function(a,b){for(var c=a.toString().split(/\s/g),d=0;d<c.length;d++)a=c[d].toLowerCase().replace(/^on/,""),this.handlers[a]||(this.handlers[a]=b);return this.handlers.noflash&&!p.detectFlashSupport()&&this.receiveEvent("onNoFlash",null),this},p.prototype.addEventListener=p.prototype.on,p.prototype.off=function(a,b){for(var c=a.toString().split(/\s/g),d=0;d<c.length;d++){a=c[d].toLowerCase().replace(/^on/,"");for(var e in this.handlers)e===a&&this.handlers[e]===b&&delete this.handlers[e]}return this},p.prototype.removeEventListener=p.prototype.off,p.prototype.receiveEvent=function(b,c){b=b.toString().toLowerCase().replace(/^on/,"");var d=a,e=!0;switch(b){case"load":if(c&&parseFloat(c.flashVersion.replace(",",".").replace(/[^0-9\.]/gi,""))<10)return this.receiveEvent("onWrongFlash",{flashVersion:c.flashVersion}),void 0;this.htmlBridge.setAttribute("data-clipboard-ready",!0);break;case"mouseover":g(d,this.options.hoverClass);break;case"mouseout":h(d,this.options.hoverClass),this.resetBridge();break;case"mousedown":g(d,this.options.activeClass);break;case"mouseup":h(d,this.options.activeClass);break;case"datarequested":var f=d.getAttribute("data-clipboard-target"),i=f?document.getElementById(f):null;if(i){var j=i.value||i.textContent||i.innerText;j&&this.setText(j)}else{var k=d.getAttribute("data-clipboard-text");k&&this.setText(k)}e=!1;break;case"complete":this.options.text=null}if(this.handlers[b]){var l=this.handlers[b];"string"==typeof l&&"function"==typeof window[l]&&(l=window[l]),"function"==typeof l&&o(l,d,this,c,e)}},p.prototype.glue=function(a){a=n(a);for(var b=0;b<a.length;b++)-1==m(a[b],q)&&(q.push(a[b]),e(a[b],"mouseover",d));return this},p.prototype.unglue=function(a){a=n(a);for(var b=0;b<a.length;b++){f(a[b],"mouseover",d);var c=m(a[b],q);-1!=c&&q.splice(c,1)}return this},"function"==typeof define&&define.amd?define(["require","exports","module"],function(a,b,c){return t=c&&c.id||null,p}):"object"==typeof module&&module&&"object"==typeof module.exports&&module.exports?(u=module.id||null,module.exports=p):window.ZeroClipboard=p}();
|
@@ -0,0 +1,185 @@
|
|
1
|
+
;(function( win, $ ) {
|
2
|
+
|
3
|
+
function featureTest( property, value, noPrefixes ) {
|
4
|
+
// Thanks Modernizr! https://github.com/phistuck/Modernizr/commit/3fb7217f5f8274e2f11fe6cfeda7cfaf9948a1f5
|
5
|
+
var prop = property + ':',
|
6
|
+
el = document.createElement( 'test' ),
|
7
|
+
mStyle = el.style;
|
8
|
+
|
9
|
+
if( !noPrefixes ) {
|
10
|
+
mStyle.cssText = prop + [ '-webkit-', '-moz-', '-ms-', '-o-', '' ].join( value + ';' + prop ) + value + ';';
|
11
|
+
} else {
|
12
|
+
mStyle.cssText = prop + value;
|
13
|
+
}
|
14
|
+
return mStyle[ property ].indexOf( value ) !== -1;
|
15
|
+
}
|
16
|
+
|
17
|
+
function getPx( unit ) {
|
18
|
+
return parseInt( unit, 10 ) || 0;
|
19
|
+
}
|
20
|
+
|
21
|
+
var S = {
|
22
|
+
classes: {
|
23
|
+
plugin: 'fixedsticky',
|
24
|
+
active: 'fixedsticky-on',
|
25
|
+
inactive: 'fixedsticky-off',
|
26
|
+
clone: 'fixedsticky-dummy',
|
27
|
+
withoutFixedFixed: 'fixedsticky-withoutfixedfixed'
|
28
|
+
},
|
29
|
+
keys: {
|
30
|
+
offset: 'fixedStickyOffset',
|
31
|
+
position: 'fixedStickyPosition'
|
32
|
+
},
|
33
|
+
tests: {
|
34
|
+
sticky: featureTest( 'position', 'sticky' ),
|
35
|
+
fixed: featureTest( 'position', 'fixed', true )
|
36
|
+
},
|
37
|
+
// Thanks jQuery!
|
38
|
+
getScrollTop: function() {
|
39
|
+
var prop = 'pageYOffset',
|
40
|
+
method = 'scrollTop';
|
41
|
+
return win ? (prop in win) ? win[ prop ] :
|
42
|
+
win.document.documentElement[ method ] :
|
43
|
+
win.document.body[ method ];
|
44
|
+
},
|
45
|
+
bypass: function() {
|
46
|
+
// Check native sticky, check fixed and if fixed-fixed is also included on the page and is supported
|
47
|
+
return ( S.tests.sticky && !S.optOut ) ||
|
48
|
+
!S.tests.fixed ||
|
49
|
+
win.FixedFixed && !$( win.document.documentElement ).hasClass( 'fixed-supported' );
|
50
|
+
},
|
51
|
+
update: function( el ) {
|
52
|
+
if( !el.offsetWidth ) { return; }
|
53
|
+
|
54
|
+
var $el = $( el ),
|
55
|
+
height = $el.outerHeight(),
|
56
|
+
initialOffset = $el.data( S.keys.offset ),
|
57
|
+
scroll = S.getScrollTop(),
|
58
|
+
isAlreadyOn = $el.is( '.' + S.classes.active ),
|
59
|
+
toggle = function( turnOn ) {
|
60
|
+
$el[ turnOn ? 'addClass' : 'removeClass' ]( S.classes.active )
|
61
|
+
[ !turnOn ? 'addClass' : 'removeClass' ]( S.classes.inactive );
|
62
|
+
},
|
63
|
+
viewportHeight = $( window ).height(),
|
64
|
+
position = $el.data( S.keys.position ),
|
65
|
+
skipSettingToFixed,
|
66
|
+
elTop,
|
67
|
+
elBottom,
|
68
|
+
$parent = $el.parent(),
|
69
|
+
parentOffset = $parent.offset().top,
|
70
|
+
parentHeight = $parent.outerHeight();
|
71
|
+
|
72
|
+
if( initialOffset === undefined ) {
|
73
|
+
initialOffset = $el.offset().top;
|
74
|
+
$el.data( S.keys.offset, initialOffset );
|
75
|
+
$el.after( $( '<div>' ).addClass( S.classes.clone ).height( height ) );
|
76
|
+
}
|
77
|
+
|
78
|
+
if( !position ) {
|
79
|
+
// Some browsers require fixed/absolute to report accurate top/left values.
|
80
|
+
skipSettingToFixed = $el.css( 'top' ) !== 'auto' || $el.css( 'bottom' ) !== 'auto';
|
81
|
+
|
82
|
+
if( !skipSettingToFixed ) {
|
83
|
+
$el.css( 'position', 'fixed' );
|
84
|
+
}
|
85
|
+
|
86
|
+
position = {
|
87
|
+
top: $el.css( 'top' ) !== 'auto',
|
88
|
+
bottom: $el.css( 'bottom' ) !== 'auto'
|
89
|
+
};
|
90
|
+
|
91
|
+
if( !skipSettingToFixed ) {
|
92
|
+
$el.css( 'position', '' );
|
93
|
+
}
|
94
|
+
|
95
|
+
$el.data( S.keys.position, position );
|
96
|
+
}
|
97
|
+
|
98
|
+
function isFixedToTop() {
|
99
|
+
var offsetTop = scroll + elTop;
|
100
|
+
|
101
|
+
// Initial Offset Top
|
102
|
+
return initialOffset < offsetTop &&
|
103
|
+
// Container Bottom
|
104
|
+
offsetTop + height <= parentOffset + parentHeight;
|
105
|
+
}
|
106
|
+
|
107
|
+
function isFixedToBottom() {
|
108
|
+
// Initial Offset Top + Height
|
109
|
+
return initialOffset + ( height || 0 ) > scroll + viewportHeight - elBottom &&
|
110
|
+
// Container Top
|
111
|
+
scroll + viewportHeight - elBottom >= parentOffset + ( height || 0 );
|
112
|
+
}
|
113
|
+
|
114
|
+
elTop = getPx( $el.css( 'top' ) );
|
115
|
+
elBottom = getPx( $el.css( 'bottom' ) );
|
116
|
+
|
117
|
+
if( position.top && isFixedToTop() || position.bottom && isFixedToBottom() ) {
|
118
|
+
if( !isAlreadyOn ) {
|
119
|
+
toggle( true );
|
120
|
+
}
|
121
|
+
} else {
|
122
|
+
if( isAlreadyOn ) {
|
123
|
+
toggle( false );
|
124
|
+
}
|
125
|
+
}
|
126
|
+
},
|
127
|
+
destroy: function( el ) {
|
128
|
+
var $el = $( el );
|
129
|
+
if (S.bypass()) {
|
130
|
+
return;
|
131
|
+
}
|
132
|
+
|
133
|
+
$( win ).unbind( '.fixedsticky' );
|
134
|
+
|
135
|
+
return $el.each(function() {
|
136
|
+
$( this )
|
137
|
+
.removeData( [ S.keys.offset, S.keys.position ] )
|
138
|
+
.removeClass( S.classes.active )
|
139
|
+
.removeClass( S.classes.inactive )
|
140
|
+
.next( '.' + S.classes.clone ).remove();
|
141
|
+
});
|
142
|
+
},
|
143
|
+
init: function( el ) {
|
144
|
+
var $el = $( el );
|
145
|
+
|
146
|
+
if( S.bypass() ) {
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
|
150
|
+
return $el.each(function() {
|
151
|
+
var _this = this;
|
152
|
+
$( win ).bind( 'scroll.fixedsticky', function() {
|
153
|
+
S.update( _this );
|
154
|
+
});
|
155
|
+
|
156
|
+
S.update( this );
|
157
|
+
|
158
|
+
$( win ).bind( 'resize.fixedsticky', function() {
|
159
|
+
if( $el.is( '.' + S.classes.active ) ) {
|
160
|
+
S.update( _this );
|
161
|
+
}
|
162
|
+
});
|
163
|
+
});
|
164
|
+
}
|
165
|
+
};
|
166
|
+
|
167
|
+
win.FixedSticky = S;
|
168
|
+
|
169
|
+
// Plugin
|
170
|
+
$.fn.fixedsticky = function( method ) {
|
171
|
+
if ( typeof S[ method ] === 'function') {
|
172
|
+
return S[ method ].call( S, this);
|
173
|
+
} else if ( typeof method === 'object' || ! method ) {
|
174
|
+
return S.init.call( S, this );
|
175
|
+
} else {
|
176
|
+
throw new Error( 'Method `' + method + '` does not exist on jQuery.fixedsticky' );
|
177
|
+
}
|
178
|
+
};
|
179
|
+
|
180
|
+
// Add fallback when fixed-fixed is not available.
|
181
|
+
if( !win.FixedFixed ) {
|
182
|
+
$( win.document.documentElement ).addClass( S.classes.withoutFixedFixed );
|
183
|
+
}
|
184
|
+
|
185
|
+
})( this, jQuery );
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* Prism: Lightweight, robust, elegant syntax highlighting
|
3
|
+
* MIT license http://www.opensource.org/licenses/mit-license.php/
|
4
|
+
* @author Lea Verou http://lea.verou.me
|
5
|
+
*/(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ");var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data),o);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar,l.language);t.hooks.run("before-insert",l);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r,i){return n.stringify(t.tokenize(e,r),i)},tokenize:function(e,n,r){var i=t.Token,s=[e],o=n.rest;if(o){for(var u in o)n[u]=o[u];delete n.rest}e:for(var u in n){if(!n.hasOwnProperty(u)||!n[u])continue;var a=n[u],f=a.inside,l=!!a.lookbehind,c=0;a=a.pattern||a;for(var h=0;h<s.length;h++){var p=s[h];if(s.length>e.length)break e;if(p instanceof i)continue;a.lastIndex=0;var d=a.exec(p);if(d){l&&(c=d[1].length);var v=d.index-1+c,d=d[0].slice(c),m=d.length,g=v+m,y=p.slice(0,v+1),b=p.slice(g+1),w=[h,1];y&&w.push(y);var E=new i(u,f?t.tokenize(d,f):d);w.push(E);b&&w.push(b);Array.prototype.splice.apply(s,w)}}}return s},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e,r,i){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]")return e.map(function(t){return n.stringify(t,r,e)}).join("");var s={type:e.type,content:n.stringify(e.content,r,i),tag:"span",classes:["token",e.type],attributes:{},language:r,parent:i};s.type=="comment"&&(s.attributes.spellcheck="true");t.hooks.run("wrap",s);var o="";for(var u in s.attributes)o+=u+'="'+(s.attributes[u]||"")+'"';return"<"+s.tag+' class="'+s.classes.join(" ")+'" '+o+">"+s.content+"</"+s.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();;
|
6
|
+
Prism.languages.markup={comment:/<!--[\w\W]*?-->/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});;
|
7
|
+
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*{))/gi,inside:{punctuation:/[;:]/g}},url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\};]*(?=\s*\{)/g,property:/(\b|\B)[\w-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
|
8
|
+
Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|(^|[^:])\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,"class-name":{pattern:/((?:(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/ig,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,"function":{pattern:/[a-z0-9_]+\(/ig,inside:{punctuation:/\(/}}, number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?)\b/g,operator:/[-+]{1,2}|!|<=?|>=?|={1,3}|(&){1,2}|\|?\||\?|\*|\/|\~|\^|\%/g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};
|
9
|
+
;
|
10
|
+
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|throw|catch|finally|null|break|continue)\b/g,number:/\b-?(0x[\dA-Fa-f]+|\d*\.?\d+([Ee]-?\d+)?|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});
|
11
|
+
;
|
12
|
+
Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},atrule:/@[\w-]+(?=\s+(\(|\{|;))/gi,url:/([-a-z]+-)*url(?=\()/gi,selector:/([^@;\{\}\(\)]?([^@;\{\}\(\)]|&|\#\{\$[-_\w]+\})+)(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/gm});Prism.languages.insertBefore("scss","atrule",{keyword:/@(if|else if|else|for|each|while|import|extend|debug|warn|mixin|include|function|return)|(?=@for\s+\$[-_\w]+\s)+from/i});Prism.languages.insertBefore("scss","property",{variable:/((\$[-_\w]+)|(#\{\$[-_\w]+\}))/i});Prism.languages.insertBefore("scss","ignore",{placeholder:/%[-_\w]+/i,statement:/\B!(default|optional)\b/gi,"boolean":/\b(true|false)\b/g,"null":/\b(null)\b/g,operator:/\s+([-+]{1,2}|={1,2}|!=|\|?\||\?|\*|\/|\%)\s+/g});
|
13
|
+
;
|
@@ -0,0 +1,125 @@
|
|
1
|
+
/* =============================================================
|
2
|
+
|
3
|
+
Smooth Scroll 2.9
|
4
|
+
Animate scrolling to anchor links, by Chris Ferdinandi.
|
5
|
+
http://gomakethings.com
|
6
|
+
|
7
|
+
Easing support contributed by Willem Liu.
|
8
|
+
https://github.com/willemliu
|
9
|
+
|
10
|
+
Easing functions forked from Gaëtan Renaudeau.
|
11
|
+
https://gist.github.com/gre/1650294
|
12
|
+
|
13
|
+
Free to use under the MIT License.
|
14
|
+
http://gomakethings.com/mit/
|
15
|
+
|
16
|
+
* ============================================================= */
|
17
|
+
|
18
|
+
(function() {
|
19
|
+
|
20
|
+
'use strict';
|
21
|
+
|
22
|
+
// Feature Test
|
23
|
+
if ( 'querySelector' in document && 'addEventListener' in window && Array.prototype.forEach ) {
|
24
|
+
|
25
|
+
// Function to animate the scroll
|
26
|
+
var smoothScroll = function (anchor, duration, easing) {
|
27
|
+
|
28
|
+
// Functions to control easing
|
29
|
+
var easingPattern = function (type, time) {
|
30
|
+
if ( type == 'easeInQuad' ) return time * time; // accelerating from zero velocity
|
31
|
+
if ( type == 'easeOutQuad' ) return time * (2 - time); // decelerating to zero velocity
|
32
|
+
if ( type == 'easeInOutQuad' ) return time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration
|
33
|
+
if ( type == 'easeInCubic' ) return time * time * time; // accelerating from zero velocity
|
34
|
+
if ( type == 'easeOutCubic' ) return (--time) * time * time + 1; // decelerating to zero velocity
|
35
|
+
if ( type == 'easeInOutCubic' ) return time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration
|
36
|
+
if ( type == 'easeInQuart' ) return time * time * time * time; // accelerating from zero velocity
|
37
|
+
if ( type == 'easeOutQuart' ) return 1 - (--time) * time * time * time; // decelerating to zero velocity
|
38
|
+
if ( type == 'easeInOutQuart' ) return time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration
|
39
|
+
if ( type == 'easeInQuint' ) return time * time * time * time * time; // accelerating from zero velocity
|
40
|
+
if ( type == 'easeOutQuint' ) return 1 + (--time) * time * time * time * time; // decelerating to zero velocity
|
41
|
+
if ( type == 'easeInOutQuint' ) return time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration
|
42
|
+
return time; // no easing, no acceleration
|
43
|
+
};
|
44
|
+
|
45
|
+
// Calculate how far and how fast to scroll
|
46
|
+
// http://www.quirksmode.org/blog/archives/2008/01/using_the_assig.html
|
47
|
+
var startLocation = window.pageYOffset;
|
48
|
+
var endLocation = function (anchor) {
|
49
|
+
var distance = 0;
|
50
|
+
if (anchor.offsetParent) {
|
51
|
+
do {
|
52
|
+
distance += anchor.offsetTop;
|
53
|
+
anchor = anchor.offsetParent;
|
54
|
+
} while (anchor);
|
55
|
+
}
|
56
|
+
return distance;
|
57
|
+
};
|
58
|
+
var distance = endLocation(anchor) - startLocation;
|
59
|
+
var increments = distance / (duration / 16);
|
60
|
+
var timeLapsed = 0;
|
61
|
+
var percentage, position, stopAnimation;
|
62
|
+
|
63
|
+
// Scroll the page by an increment, and check if it's time to stop
|
64
|
+
var animateScroll = function () {
|
65
|
+
timeLapsed += 16;
|
66
|
+
percentage = ( timeLapsed / duration );
|
67
|
+
percentage = ( percentage > 1 ) ? 1 : percentage;
|
68
|
+
position = startLocation + ( distance * easingPattern(easing, percentage) );
|
69
|
+
window.scrollTo(0, position);
|
70
|
+
stopAnimation();
|
71
|
+
};
|
72
|
+
|
73
|
+
// Stop the animation
|
74
|
+
if ( increments >= 0 ) { // If scrolling down
|
75
|
+
// Stop animation when you reach the anchor OR the bottom of the page
|
76
|
+
stopAnimation = function () {
|
77
|
+
var travelled = window.pageYOffset;
|
78
|
+
if ( (travelled >= (endLocation(anchor) - increments)) || ((window.innerHeight + travelled) >= document.body.offsetHeight) ) {
|
79
|
+
clearInterval(runAnimation);
|
80
|
+
}
|
81
|
+
};
|
82
|
+
} else { // If scrolling up
|
83
|
+
// Stop animation when you reach the anchor OR the top of the page
|
84
|
+
stopAnimation = function () {
|
85
|
+
var travelled = window.pageYOffset;
|
86
|
+
if ( travelled <= endLocation(anchor) || travelled <= 0 ) {
|
87
|
+
clearInterval(runAnimation);
|
88
|
+
}
|
89
|
+
};
|
90
|
+
}
|
91
|
+
|
92
|
+
// Loop the animation function
|
93
|
+
var runAnimation = setInterval(animateScroll, 16);
|
94
|
+
|
95
|
+
};
|
96
|
+
|
97
|
+
// For each smooth scroll link
|
98
|
+
var scrollToggle = document.querySelectorAll('.scroll');
|
99
|
+
[].forEach.call(scrollToggle, function (toggle) {
|
100
|
+
|
101
|
+
// When the smooth scroll link is clicked
|
102
|
+
toggle.addEventListener('click', function(e) {
|
103
|
+
|
104
|
+
// Prevent the default link behavior
|
105
|
+
e.preventDefault();
|
106
|
+
|
107
|
+
// Get anchor link and calculate distance from the top
|
108
|
+
var dataID = toggle.getAttribute('href');
|
109
|
+
var dataTarget = document.querySelector(dataID);
|
110
|
+
var dataSpeed = toggle.getAttribute('data-speed');
|
111
|
+
var dataEasing = toggle.getAttribute('data-easing'); // WL: Added easing attribute support.
|
112
|
+
|
113
|
+
// If the anchor exists
|
114
|
+
if (dataTarget) {
|
115
|
+
// Scroll to the anchor
|
116
|
+
smoothScroll(dataTarget, dataSpeed || 500, dataEasing || 'easeInOutCubic');
|
117
|
+
}
|
118
|
+
|
119
|
+
}, false);
|
120
|
+
|
121
|
+
});
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
})();
|
@@ -0,0 +1,22 @@
|
|
1
|
+
.fixedsticky {
|
2
|
+
position: -webkit-sticky;
|
3
|
+
position: -moz-sticky;
|
4
|
+
position: -ms-sticky;
|
5
|
+
position: -o-sticky;
|
6
|
+
position: sticky;
|
7
|
+
}
|
8
|
+
/* When position: sticky is supported but native behavior is ignored */
|
9
|
+
.fixedsticky-withoutfixedfixed .fixedsticky-off,
|
10
|
+
.fixed-supported .fixedsticky-off {
|
11
|
+
position: static;
|
12
|
+
}
|
13
|
+
.fixedsticky-withoutfixedfixed .fixedsticky-on,
|
14
|
+
.fixed-supported .fixedsticky-on {
|
15
|
+
position: fixed;
|
16
|
+
}
|
17
|
+
.fixedsticky-dummy {
|
18
|
+
display: none;
|
19
|
+
}
|
20
|
+
.fixedsticky-on + .fixedsticky-dummy {
|
21
|
+
display: block;
|
22
|
+
}
|