epyce 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/Gemfile +4 -0
  2. data/LICENSE +3 -0
  3. data/README.md +59 -0
  4. data/Rakefile +1 -0
  5. data/VERSION +1 -0
  6. data/app/assets/stylesheets/html5S-libs/_core.sass +40 -0
  7. data/app/assets/stylesheets/html5S-libs/_normal.sass +193 -0
  8. data/app/assets/stylesheets/html5S-libs/_reset.sass +217 -0
  9. data/epyce.gemspec +23 -0
  10. data/lib/epyce.rb +6 -0
  11. data/lib/epyce/railtie.rb +12 -0
  12. data/lib/epyce/version.rb +5 -0
  13. data/lib/generators/epyce/install/install_generator.rb +24 -0
  14. data/lib/generators/epyce/template/app/views/layouts/_flashes.html.haml +4 -0
  15. data/lib/generators/epyce/template/app/views/layouts/_footer.html.haml +2 -0
  16. data/lib/generators/epyce/template/app/views/layouts/_header.html.haml +1 -0
  17. data/lib/generators/epyce/template/app/views/layouts/application.html.haml +57 -0
  18. data/lib/generators/epyce/template/public/apple-touch-icon-114x114-precomposed.png +0 -0
  19. data/lib/generators/epyce/template/public/apple-touch-icon-57x57-precomposed.png +0 -0
  20. data/lib/generators/epyce/template/public/apple-touch-icon-72x72-precomposed.png +0 -0
  21. data/lib/generators/epyce/template/public/apple-touch-icon-precomposed.png +0 -0
  22. data/lib/generators/epyce/template/public/apple-touch-icon.png +0 -0
  23. data/lib/generators/epyce/template/public/crossdomain.xml +14 -0
  24. data/lib/generators/epyce/template/public/favicon.png +0 -0
  25. data/vendor/assets/javascripts/epyce-debug.js.coffee +4 -0
  26. data/vendor/assets/javascripts/epyce-debug/dd_belatedpng.min.js +13 -0
  27. data/vendor/assets/javascripts/epyce-debug/head.js +681 -0
  28. data/vendor/assets/javascripts/epyce-debug/knockout-1.2.1.debug.js +2219 -0
  29. data/vendor/assets/javascripts/epyce-debug/respond.min.js +7 -0
  30. data/vendor/assets/javascripts/epyce-debug/underscore.js +839 -0
  31. data/vendor/assets/javascripts/epyce.js.coffee +4 -0
  32. data/vendor/assets/javascripts/epyce/dd_belatedpng.min.js +13 -0
  33. data/vendor/assets/javascripts/epyce/head.min.js +8 -0
  34. data/vendor/assets/javascripts/epyce/knockout-1.2.1.js +76 -0
  35. data/vendor/assets/javascripts/epyce/respond.min.js +7 -0
  36. data/vendor/assets/javascripts/epyce/underscore-min.js +27 -0
  37. data/vendor/assets/stylesheets/epyce.css.sass +4 -0
  38. data/vendor/assets/stylesheets/epyce/.gitkeep +0 -0
  39. data/vendor/assets/stylesheets/skeleton/base.css +336 -0
  40. data/vendor/assets/stylesheets/skeleton/layout.css +64 -0
  41. data/vendor/assets/stylesheets/skeleton/skeleton.css +237 -0
  42. metadata +111 -0
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "epyce/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.version = Epyce::VERSION
7
+ s.date = "2011-07-22"
8
+ s.platform = Gem::Platform::RUBY
9
+
10
+ s.name = "epyce"
11
+ s.authors = ["Yann Armand"]
12
+ s.summary = %q{A rails layout including skeleton, HTML5S and knockout }
13
+ s.description = %q{define a new layout and change asset manager defaults to get advantage of skeleton (http://www.getskeleton.com/),Damian Le Nouaille HTML5S (https://github.com/damln/Html5S) and knockout (http://knockoutjs.com)}
14
+ s.email = "yann@harakys.com"
15
+ s.homepage = "http://github.com/yarmand/html5-epyce"
16
+ s.has_rdoc = false
17
+
18
+ s.add_dependency "railties", "~> 3.1.0.rc1"
19
+ s.add_dependency "haml"
20
+ s.files = `git ls-files`.split("\n")
21
+ s.require_paths = ["lib"]
22
+
23
+ end
@@ -0,0 +1,6 @@
1
+ require "epyce/version"
2
+ require 'epyce/railtie'
3
+
4
+ module Epyce
5
+ require 'epyce/railtie' if defined?(Rails)
6
+ end
@@ -0,0 +1,12 @@
1
+ require 'epyce'
2
+ require 'rails'
3
+
4
+ module Epyce
5
+ class Railtie < Rails::Railtie
6
+ railtie_name :epyce
7
+ end
8
+
9
+ class Engine < Rails::Engine
10
+ end
11
+
12
+ end
@@ -0,0 +1,5 @@
1
+ module Epyce
2
+ VERSION = "0.5.0"
3
+ SKELETON_VERSION = "1.0.3"
4
+ KNOCKOUT_VERSION = "1.2.1"
5
+ end
@@ -0,0 +1,24 @@
1
+ module Epyce
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+
5
+ desc "This generator install default haml application layout and several files in public"
6
+ source_root File.expand_path('../../template', __FILE__)
7
+
8
+ def copy_layout
9
+ say_status("Copying", "application layout files", :green)
10
+ ["application.html.haml", "_header.html.haml", "_footer.html.haml", "_flashes.html.haml"].each do |f|
11
+ copy_file "app/views/layouts/#{f}", "app/views/layouts/#{f}"
12
+ end
13
+ end
14
+
15
+ def copy_public
16
+ say_status("Copying", "application layout files", :green)
17
+ ["apple-touch-icon-114x114-precomposed.png", "apple-touch-icon-57x57-precomposed.png", "apple-touch-icon-72x72-precomposed.png", "apple-touch-icon-precomposed.png", "apple-touch-icon.png", "crossdomain.xml", "favicon.png" ].each do |f|
18
+ copy_file "public/#{f}", "public/#{f}"
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ #flash
2
+ - flash.each do |key, value|
3
+ .message{ :class => key }
4
+ %p= value
@@ -0,0 +1,2 @@
1
+ %small.copyright
2
+ Copyright &copy; #{Date.today.year}
@@ -0,0 +1,57 @@
1
+ !!! 5
2
+ -# http://paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither
3
+ <!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
4
+ <!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
5
+ <!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
6
+ <!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="fr"> <!--<![endif]-->
7
+ %html
8
+ %head
9
+ %meta{ :charset => "utf-8" }/
10
+
11
+ -# Always force latest IE rendering engine (even in intranet) & Chrome Frame
12
+ -# Remove this if you use the .htaccess
13
+ %meta{ "http-equiv" => "X-UA-Compatible", :content => "IE=edge,chrome=1" }/
14
+
15
+ %title
16
+ == #{ controller.controller_name.titleize } - #{ controller.action_name.titleize }
17
+
18
+ %meta{ :name => "description", :content => "" }/
19
+ %meta{ :name => "author", :content => "" }/
20
+
21
+ -# icons
22
+ = favicon_link_tag 'favicon.ico'
23
+ = favicon_link_tag 'apple-touch-icon.png', :rel => 'apple-touch-icon', :type => 'image/png'
24
+ -# for the ipad
25
+ = favicon_link_tag 'apple-touch-icon-72x72-precomposed', :rel => 'apple-touch-icon', :sizes => '72x72', :type => 'image/png'
26
+ -# for the iphone4
27
+ = favicon_link_tag 'apple-touch-icon-114x114-precomposed', :rel => 'apple-touch-icon', :sizes => '114x114', :type => 'image/png'
28
+
29
+ -# Mobile viewport optimized: j.mp/bplateviewport
30
+ %meta{ :name => "viewport", :content => "width=device-width, initial-scale=1.0" }/
31
+
32
+
33
+ - # standard asset manager inclusion
34
+ = stylesheet_link_tag 'application', :media => 'all'
35
+ = javascript_include_tag 'application'
36
+
37
+ - # use asset manager to include html-epyce. see vendor/assets
38
+ = stylesheet_link_tag 'epyce', :media => 'all'
39
+ - if Rails.env.development?
40
+ = javascript_include_tag 'epyce-debug'
41
+ - else
42
+ = javascript_include_tag 'epyce'
43
+
44
+ = csrf_meta_tag
45
+
46
+ %body{ :class => "#{controller.controller_name}" }
47
+ #container
48
+ %header#header
49
+ = render "layouts/header"
50
+
51
+ #main{ :role => 'main' }
52
+ = render "layouts/flashes"
53
+ = yield
54
+
55
+ %footer#footer
56
+ = render "layouts/footer"
57
+
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0"?>
2
+ <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
3
+ <cross-domain-policy>
4
+
5
+ <!-- Most restrictive policy: -->
6
+ <site-control permitted-cross-domain-policies="none"/>
7
+ <!-- Least restrictive policy: -->
8
+ <!--
9
+ <site-control permitted-cross-domain-policies="all"/>
10
+ <allow-access-from domain="*" to-ports="*" secure="false"/>
11
+ <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
12
+ -->
13
+
14
+ </cross-domain-policy>
@@ -0,0 +1,4 @@
1
+ # include all files in epyce folder
2
+ # = require_tree ./epyce-debug
3
+
4
+ # do some cool things with header.js
@@ -0,0 +1,13 @@
1
+ /**
2
+ * DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
3
+ * Author: Drew Diller
4
+ * Email: drew.diller@gmail.com
5
+ * URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
6
+ * Version: 0.0.8a
7
+ * Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
8
+ *
9
+ * Example usage:
10
+ * DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
11
+ * DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement
12
+ **/
13
+ var DD_belatedPNG={ns:"DD_belatedPNG",imgSize:{},delay:10,nodesFixed:0,createVmlNameSpace:function(){if(document.namespaces&&!document.namespaces[this.ns]){document.namespaces.add(this.ns,"urn:schemas-microsoft-com:vml")}},createVmlStyleSheet:function(){var b,a;b=document.createElement("style");b.setAttribute("media","screen");document.documentElement.firstChild.insertBefore(b,document.documentElement.firstChild.firstChild);if(b.styleSheet){b=b.styleSheet;b.addRule(this.ns+"\\:*","{behavior:url(#default#VML)}");b.addRule(this.ns+"\\:shape","position:absolute;");b.addRule("img."+this.ns+"_sizeFinder","behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;");this.screenStyleSheet=b;a=document.createElement("style");a.setAttribute("media","print");document.documentElement.firstChild.insertBefore(a,document.documentElement.firstChild.firstChild);a=a.styleSheet;a.addRule(this.ns+"\\:*","{display: none !important;}");a.addRule("img."+this.ns+"_sizeFinder","{display: none !important;}")}},readPropertyChange:function(){var b,c,a;b=event.srcElement;if(!b.vmlInitiated){return}if(event.propertyName.search("background")!=-1||event.propertyName.search("border")!=-1){DD_belatedPNG.applyVML(b)}if(event.propertyName=="style.display"){c=(b.currentStyle.display=="none")?"none":"block";for(a in b.vml){if(b.vml.hasOwnProperty(a)){b.vml[a].shape.style.display=c}}}if(event.propertyName.search("filter")!=-1){DD_belatedPNG.vmlOpacity(b)}},vmlOpacity:function(b){if(b.currentStyle.filter.search("lpha")!=-1){var a=b.currentStyle.filter;a=parseInt(a.substring(a.lastIndexOf("=")+1,a.lastIndexOf(")")),10)/100;b.vml.color.shape.style.filter=b.currentStyle.filter;b.vml.image.fill.opacity=a}},handlePseudoHover:function(a){setTimeout(function(){DD_belatedPNG.applyVML(a)},1)},fix:function(a){if(this.screenStyleSheet){var c,b;c=a.split(",");for(b=0;b<c.length;b++){this.screenStyleSheet.addRule(c[b],"behavior:expression(DD_belatedPNG.fixPng(this))")}}},applyVML:function(a){a.runtimeStyle.cssText="";this.vmlFill(a);this.vmlOffsets(a);this.vmlOpacity(a);if(a.isImg){this.copyImageBorders(a)}},attachHandlers:function(i){var d,c,g,e,b,f;d=this;c={resize:"vmlOffsets",move:"vmlOffsets"};if(i.nodeName=="A"){e={mouseleave:"handlePseudoHover",mouseenter:"handlePseudoHover",focus:"handlePseudoHover",blur:"handlePseudoHover"};for(b in e){if(e.hasOwnProperty(b)){c[b]=e[b]}}}for(f in c){if(c.hasOwnProperty(f)){g=function(){d[c[f]](i)};i.attachEvent("on"+f,g)}}i.attachEvent("onpropertychange",this.readPropertyChange)},giveLayout:function(a){a.style.zoom=1;if(a.currentStyle.position=="static"){a.style.position="relative"}},copyImageBorders:function(b){var c,a;c={borderStyle:true,borderWidth:true,borderColor:true};for(a in c){if(c.hasOwnProperty(a)){b.vml.color.shape.style[a]=b.currentStyle[a]}}},vmlFill:function(e){if(!e.currentStyle){return}else{var d,f,g,b,a,c;d=e.currentStyle}for(b in e.vml){if(e.vml.hasOwnProperty(b)){e.vml[b].shape.style.zIndex=d.zIndex}}e.runtimeStyle.backgroundColor="";e.runtimeStyle.backgroundImage="";f=true;if(d.backgroundImage!="none"||e.isImg){if(!e.isImg){e.vmlBg=d.backgroundImage;e.vmlBg=e.vmlBg.substr(5,e.vmlBg.lastIndexOf('")')-5)}else{e.vmlBg=e.src}g=this;if(!g.imgSize[e.vmlBg]){a=document.createElement("img");g.imgSize[e.vmlBg]=a;a.className=g.ns+"_sizeFinder";a.runtimeStyle.cssText="behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;";c=function(){this.width=this.offsetWidth;this.height=this.offsetHeight;g.vmlOffsets(e)};a.attachEvent("onload",c);a.src=e.vmlBg;a.removeAttribute("width");a.removeAttribute("height");document.body.insertBefore(a,document.body.firstChild)}e.vml.image.fill.src=e.vmlBg;f=false}e.vml.image.fill.on=!f;e.vml.image.fill.color="none";e.vml.color.shape.style.backgroundColor=d.backgroundColor;e.runtimeStyle.backgroundImage="none";e.runtimeStyle.backgroundColor="transparent"},vmlOffsets:function(d){var h,n,a,e,g,m,f,l,j,i,k;h=d.currentStyle;n={W:d.clientWidth+1,H:d.clientHeight+1,w:this.imgSize[d.vmlBg].width,h:this.imgSize[d.vmlBg].height,L:d.offsetLeft,T:d.offsetTop,bLW:d.clientLeft,bTW:d.clientTop};a=(n.L+n.bLW==1)?1:0;e=function(b,p,q,c,s,u){b.coordsize=c+","+s;b.coordorigin=u+","+u;b.path="m0,0l"+c+",0l"+c+","+s+"l0,"+s+" xe";b.style.width=c+"px";b.style.height=s+"px";b.style.left=p+"px";b.style.top=q+"px"};e(d.vml.color.shape,(n.L+(d.isImg?0:n.bLW)),(n.T+(d.isImg?0:n.bTW)),(n.W-1),(n.H-1),0);e(d.vml.image.shape,(n.L+n.bLW),(n.T+n.bTW),(n.W),(n.H),1);g={X:0,Y:0};if(d.isImg){g.X=parseInt(h.paddingLeft,10)+1;g.Y=parseInt(h.paddingTop,10)+1}else{for(j in g){if(g.hasOwnProperty(j)){this.figurePercentage(g,n,j,h["backgroundPosition"+j])}}}d.vml.image.fill.position=(g.X/n.W)+","+(g.Y/n.H);m=h.backgroundRepeat;f={T:1,R:n.W+a,B:n.H,L:1+a};l={X:{b1:"L",b2:"R",d:"W"},Y:{b1:"T",b2:"B",d:"H"}};if(m!="repeat"||d.isImg){i={T:(g.Y),R:(g.X+n.w),B:(g.Y+n.h),L:(g.X)};if(m.search("repeat-")!=-1){k=m.split("repeat-")[1].toUpperCase();i[l[k].b1]=1;i[l[k].b2]=n[l[k].d]}if(i.B>n.H){i.B=n.H}d.vml.image.shape.style.clip="rect("+i.T+"px "+(i.R+a)+"px "+i.B+"px "+(i.L+a)+"px)"}else{d.vml.image.shape.style.clip="rect("+f.T+"px "+f.R+"px "+f.B+"px "+f.L+"px)"}},figurePercentage:function(d,c,f,a){var b,e;e=true;b=(f=="X");switch(a){case"left":case"top":d[f]=0;break;case"center":d[f]=0.5;break;case"right":case"bottom":d[f]=1;break;default:if(a.search("%")!=-1){d[f]=parseInt(a,10)/100}else{e=false}}d[f]=Math.ceil(e?((c[b?"W":"H"]*d[f])-(c[b?"w":"h"]*d[f])):parseInt(a,10));if(d[f]%2===0){d[f]++}return d[f]},fixPng:function(c){c.style.behavior="none";var g,b,f,a,d;if(c.nodeName=="BODY"||c.nodeName=="TD"||c.nodeName=="TR"){return}c.isImg=false;if(c.nodeName=="IMG"){if(c.src.toLowerCase().search(/\.png$/)!=-1){c.isImg=true;c.style.visibility="hidden"}else{return}}else{if(c.currentStyle.backgroundImage.toLowerCase().search(".png")==-1){return}}g=DD_belatedPNG;c.vml={color:{},image:{}};b={shape:{},fill:{}};for(a in c.vml){if(c.vml.hasOwnProperty(a)){for(d in b){if(b.hasOwnProperty(d)){f=g.ns+":"+d;c.vml[a][d]=document.createElement(f)}}c.vml[a].shape.stroked=false;c.vml[a].shape.appendChild(c.vml[a].fill);c.parentNode.insertBefore(c.vml[a].shape,c)}}c.vml.image.shape.fillcolor="none";c.vml.image.fill.type="tile";c.vml.color.fill.on=false;g.attachHandlers(c);g.giveLayout(c);g.giveLayout(c.offsetParent);c.vmlInitiated=true;g.applyVML(c)}};try{document.execCommand("BackgroundImageCache",false,true)}catch(r){}DD_belatedPNG.createVmlNameSpace();DD_belatedPNG.createVmlStyleSheet();
@@ -0,0 +1,681 @@
1
+ /**
2
+ Head JS The only script in your <HEAD>
3
+ Copyright Tero Piirainen (tipiirai)
4
+ License MIT / http://bit.ly/mit-license
5
+ Version 0.96
6
+
7
+ http://headjs.com
8
+ */
9
+ (function(doc) {
10
+
11
+ var html = doc.documentElement,
12
+ conf = {
13
+ screens: [320, 480, 640, 768, 1024, 1280, 1440, 1680, 1920],
14
+ section: "-section",
15
+ page: "-page",
16
+ head: "head"
17
+ },
18
+ klass = [];
19
+
20
+
21
+ if (window.head_conf) {
22
+ for (var key in head_conf) {
23
+ if (head_conf[key] !== undefined) {
24
+ conf[key] = head_conf[key];
25
+ }
26
+ }
27
+ }
28
+
29
+ function pushClass(name) {
30
+ klass[klass.length] = name;
31
+ }
32
+
33
+ function removeClass(name) {
34
+ var re = new RegExp("\\b" + name + "\\b");
35
+ html.className = html.className.replace(re, '');
36
+ }
37
+
38
+ function each(arr, fn) {
39
+ for (var i = 0, arr_length = arr.length; i < arr_length; i++) {
40
+ fn.call(arr, arr[i], i);
41
+ }
42
+ }
43
+
44
+ // API
45
+ var api = window[conf.head] = function() {
46
+ api.ready.apply(null, arguments);
47
+ };
48
+
49
+ api.feature = function(key, enabled, queue) {
50
+
51
+ // internal: apply all classes
52
+ if (!key) {
53
+ html.className += ' ' + klass.join( ' ' );
54
+ klass = [];
55
+ return;
56
+ }
57
+
58
+ if (Object.prototype.toString.call(enabled) == '[object Function]') {
59
+ enabled = enabled.call();
60
+ }
61
+
62
+ pushClass((enabled ? '' : 'no-') + key);
63
+ api[key] = !!enabled;
64
+
65
+ // apply class to HTML element
66
+ if (!queue) {
67
+ removeClass('no-' + key);
68
+ removeClass(key);
69
+ api.feature();
70
+ }
71
+
72
+ return api;
73
+ };
74
+
75
+ // browser type & version
76
+ var ua = navigator.userAgent.toLowerCase();
77
+
78
+ ua = /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
79
+ /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) ||
80
+ /(msie) ([\w.]+)/.exec( ua ) ||
81
+ !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || [];
82
+
83
+
84
+ if (ua[1] == 'msie') {
85
+ ua[1] = 'ie';
86
+ ua[2] = document.documentMode || ua[2];
87
+ }
88
+
89
+ pushClass(ua[1]);
90
+
91
+ api.browser = { version: ua[2] };
92
+ api.browser[ua[1]] = true;
93
+
94
+ // IE specific
95
+ if (api.browser.ie) {
96
+
97
+ pushClass("ie" + parseFloat(ua[2]));
98
+
99
+ // IE versions
100
+ for (var ver = 3; ver < 11; ver++) {
101
+ if (parseFloat(ua[2]) < ver) { pushClass("lt-ie" + ver); }
102
+ }
103
+
104
+ // HTML5 support
105
+ each("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video".split("|"), function(el) {
106
+ doc.createElement(el);
107
+ });
108
+
109
+ }
110
+
111
+
112
+ // CSS "router"
113
+ each(location.pathname.split("/"), function(el, i) {
114
+
115
+ if (this.length > 2 && this[i + 1] !== undefined) {
116
+ if (i) { pushClass(this.slice(1, i+1).join("-") + conf.section); }
117
+
118
+ } else {
119
+
120
+ // pageId
121
+ var id = el || "index", index = id.indexOf(".");
122
+ if (index > 0) { id = id.substring(0, index); }
123
+ html.id = id + conf.page;
124
+
125
+ // on root?
126
+ if (!i) { pushClass("root" + conf.section); }
127
+ }
128
+ });
129
+
130
+
131
+ // screen resolution: w-100, lt-480, lt-1024 ...
132
+ function screenSize() {
133
+ var w = window.outerWidth || html.clientWidth;
134
+
135
+ // remove earlier widths
136
+ html.className = html.className.replace(/ (w|lt)-\d+/g, "");
137
+
138
+ // add new ones
139
+ pushClass("w-" + Math.round(w / 100) * 100);
140
+
141
+ each(conf.screens, function(width) {
142
+ if (w <= width) { pushClass("lt-" + width); }
143
+ });
144
+
145
+ api.feature();
146
+ }
147
+
148
+ screenSize();
149
+ window.onresize = screenSize;
150
+
151
+ api.feature("js", true).feature();
152
+
153
+ })(document);
154
+
155
+
156
+ /**
157
+ Head JS The only script in your <HEAD>
158
+ Copyright Tero Piirainen (tipiirai)
159
+ License MIT / http://bit.ly/mit-license
160
+ Version 0.96
161
+
162
+ http://headjs.com
163
+ */
164
+ (function() {
165
+ /*
166
+ To add a new test:
167
+
168
+ head.feature("video", function() {
169
+ var tag = document.createElement('video');
170
+ return !!tag.canPlayType;
171
+ });
172
+
173
+ Good place to grab more tests
174
+
175
+ https://github.com/Modernizr/Modernizr/blob/master/modernizr.js
176
+ */
177
+
178
+
179
+ /* CSS modernizer */
180
+ var el = document.createElement("i"),
181
+ style = el.style,
182
+ prefs = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
183
+ domPrefs = 'Webkit Moz O ms Khtml'.split(' '),
184
+
185
+ head_var = window.head_conf && head_conf.head || "head",
186
+ api = window[head_var];
187
+
188
+
189
+ // Thanks Paul Irish!
190
+ function testProps(props) {
191
+ for (var i in props) {
192
+ if (style[props[i]] !== undefined) {
193
+ return true;
194
+ }
195
+ }
196
+ }
197
+
198
+
199
+ function testAll(prop) {
200
+ var camel = prop.charAt(0).toUpperCase() + prop.substr(1),
201
+ props = (prop + ' ' + domPrefs.join(camel + ' ') + camel).split(' ');
202
+
203
+ return !!testProps(props);
204
+ }
205
+
206
+ var tests = {
207
+
208
+ gradient: function() {
209
+ var s1 = 'background-image:',
210
+ s2 = 'gradient(linear,left top,right bottom,from(#9f9),to(#fff));',
211
+ s3 = 'linear-gradient(left top,#eee,#fff);';
212
+
213
+ style.cssText = (s1 + prefs.join(s2 + s1) + prefs.join(s3 + s1)).slice(0,-s1.length);
214
+ return !!style.backgroundImage;
215
+ },
216
+
217
+ rgba: function() {
218
+ style.cssText = "background-color:rgba(0,0,0,0.5)";
219
+ return !!style.backgroundColor;
220
+ },
221
+
222
+ opacity: function() {
223
+ return el.style.opacity === "";
224
+ },
225
+
226
+ textshadow: function() {
227
+ return style.textShadow === '';
228
+ },
229
+
230
+ multiplebgs: function() {
231
+ style.cssText = "background:url(//:),url(//:),red url(//:)";
232
+ return new RegExp("(url\\s*\\(.*?){3}").test(style.background);
233
+ },
234
+
235
+ boxshadow: function() {
236
+ return testAll("boxShadow");
237
+ },
238
+
239
+ borderimage: function() {
240
+ return testAll("borderImage");
241
+ },
242
+
243
+ borderradius: function() {
244
+ return testAll("borderRadius");
245
+ },
246
+
247
+ cssreflections: function() {
248
+ return testAll("boxReflect");
249
+ },
250
+
251
+ csstransforms: function() {
252
+ return testAll("transform");
253
+ },
254
+
255
+ csstransitions: function() {
256
+ return testAll("transition");
257
+ },
258
+
259
+ /*
260
+ font-face support. Uses browser sniffing but is synchronous.
261
+
262
+ http://paulirish.com/2009/font-face-feature-detection/
263
+ */
264
+ fontface: function() {
265
+ var ua = navigator.userAgent, parsed;
266
+
267
+ if (/*@cc_on@if(@_jscript_version>=5)!@end@*/0)
268
+ return true;
269
+
270
+ if (parsed = ua.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/))
271
+ return parsed[1] >= '4.0.249.4' || 1 * parsed[1].split(".")[0] > 5;
272
+ if ((parsed = ua.match(/Safari\/(\d+\.\d+)/)) && !/iPhone/.test(ua))
273
+ return parsed[1] >= '525.13';
274
+ if (/Opera/.test({}.toString.call(window.opera)))
275
+ return opera.version() >= '10.00';
276
+ if (parsed = ua.match(/rv:(\d+\.\d+\.\d+)[^b].*Gecko\//))
277
+ return parsed[1] >= '1.9.1';
278
+
279
+ return false;
280
+ }
281
+ };
282
+
283
+ // queue features
284
+ for (var key in tests) {
285
+ if (tests[key]) {
286
+ api.feature(key, tests[key].call(), true);
287
+ }
288
+ }
289
+
290
+ // enable features at once
291
+ api.feature();
292
+
293
+ })();
294
+
295
+
296
+ /**
297
+ Head JS The only script in your <HEAD>
298
+ Copyright Tero Piirainen (tipiirai)
299
+ License MIT / http://bit.ly/mit-license
300
+ Version 0.96
301
+
302
+ http://headjs.com
303
+ */
304
+ (function(doc) {
305
+
306
+ var head = doc.documentElement,
307
+ isHeadReady,
308
+ isDomReady,
309
+ domWaiters = [],
310
+ queue = [], // waiters for the "head ready" event
311
+ handlers = {}, // user functions waiting for events
312
+ scripts = {}, // loadable scripts in different states
313
+ isAsync = doc.createElement("script").async === true || "MozAppearance" in doc.documentElement.style || window.opera;
314
+
315
+
316
+ /*** public API ***/
317
+ var head_var = window.head_conf && head_conf.head || "head",
318
+ api = window[head_var] = (window[head_var] || function() { api.ready.apply(null, arguments); });
319
+
320
+ // states
321
+ var PRELOADED = 1,
322
+ PRELOADING = 2,
323
+ LOADING = 3,
324
+ LOADED = 4;
325
+
326
+
327
+ // Method 1: simply load and let browser take care of ordering
328
+ if (isAsync) {
329
+
330
+ api.js = function() {
331
+
332
+ var args = arguments,
333
+ fn = args[args.length -1],
334
+ els = {};
335
+
336
+ if (!isFunc(fn)) { fn = null; }
337
+
338
+ each(args, function(el, i) {
339
+
340
+ if (el != fn) {
341
+ el = getScript(el);
342
+ els[el.name] = el;
343
+
344
+ load(el, fn && i == args.length -2 ? function() {
345
+ if (allLoaded(els)) { one(fn); }
346
+
347
+ } : null);
348
+ }
349
+ });
350
+
351
+ return api;
352
+ };
353
+
354
+
355
+ // Method 2: preload with text/cache hack
356
+ } else {
357
+
358
+ api.js = function() {
359
+
360
+ var args = arguments,
361
+ rest = [].slice.call(args, 1),
362
+ next = rest[0];
363
+
364
+ // wait for a while. immediate execution causes some browsers to ignore caching
365
+ if (!isHeadReady) {
366
+ queue.push(function() {
367
+ api.js.apply(null, args);
368
+ });
369
+ return api;
370
+ }
371
+
372
+ // multiple arguments
373
+ if (next) {
374
+
375
+ // load
376
+ each(rest, function(el) {
377
+ if (!isFunc(el)) {
378
+ preload(getScript(el));
379
+ }
380
+ });
381
+
382
+ // execute
383
+ load(getScript(args[0]), isFunc(next) ? next : function() {
384
+ api.js.apply(null, rest);
385
+ });
386
+
387
+
388
+ // single script
389
+ } else {
390
+ load(getScript(args[0]));
391
+ }
392
+
393
+ return api;
394
+ };
395
+ }
396
+
397
+ api.ready = function(key, fn) {
398
+
399
+ // DOM ready check: head.ready(document, function() { });
400
+ if (key == doc) {
401
+ if (isDomReady) { one(fn); }
402
+ else { domWaiters.push(fn); }
403
+ return api;
404
+ }
405
+
406
+ // shift arguments
407
+ if (isFunc(key)) {
408
+ fn = key;
409
+ key = "ALL";
410
+ }
411
+
412
+ // make sure arguments are sane
413
+ if (typeof key != 'string' || !isFunc(fn)) { return api; }
414
+
415
+ var script = scripts[key];
416
+
417
+ // script already loaded --> execute and return
418
+ if (script && script.state == LOADED || key == 'ALL' && allLoaded() && isDomReady) {
419
+ one(fn);
420
+ return api;
421
+ }
422
+
423
+ var arr = handlers[key];
424
+ if (!arr) { arr = handlers[key] = [fn]; }
425
+ else { arr.push(fn); }
426
+ return api;
427
+ };
428
+
429
+
430
+ // perform this when DOM is ready
431
+ api.ready(doc, function() {
432
+
433
+ if (allLoaded()) {
434
+ each(handlers.ALL, function(fn) {
435
+ one(fn);
436
+ });
437
+ }
438
+
439
+ if (api.feature) {
440
+ api.feature("domloaded", true);
441
+ }
442
+ });
443
+
444
+
445
+ /*** private functions ***/
446
+
447
+
448
+ // call function once
449
+ function one(fn) {
450
+ if (fn._done) { return; }
451
+ fn();
452
+ fn._done = 1;
453
+ }
454
+
455
+
456
+ function toLabel(url) {
457
+ var els = url.split("/"),
458
+ name = els[els.length -1],
459
+ i = name.indexOf("?");
460
+
461
+ return i != -1 ? name.substring(0, i) : name;
462
+ }
463
+
464
+
465
+ function getScript(url) {
466
+
467
+ var script;
468
+
469
+ if (typeof url == 'object') {
470
+ for (var key in url) {
471
+ if (url[key]) {
472
+ script = { name: key, url: url[key] };
473
+ }
474
+ }
475
+ } else {
476
+ script = { name: toLabel(url), url: url };
477
+ }
478
+
479
+ var existing = scripts[script.name];
480
+ if (existing && existing.url === script.url) { return existing; }
481
+
482
+ scripts[script.name] = script;
483
+ return script;
484
+ }
485
+
486
+
487
+ function each(arr, fn) {
488
+ if (!arr) { return; }
489
+
490
+ // arguments special type
491
+ if (typeof arr == 'object') { arr = [].slice.call(arr); }
492
+
493
+ // do the job
494
+ for (var i = 0; i < arr.length; i++) {
495
+ fn.call(arr, arr[i], i);
496
+ }
497
+ }
498
+
499
+ function isFunc(el) {
500
+ return Object.prototype.toString.call(el) == '[object Function]';
501
+ }
502
+
503
+ function allLoaded(els) {
504
+
505
+ els = els || scripts;
506
+
507
+ var loaded;
508
+
509
+ for (var name in els) {
510
+ if (els.hasOwnProperty(name) && els[name].state != LOADED) { return false; }
511
+ loaded = true;
512
+ }
513
+
514
+ return loaded;
515
+ }
516
+
517
+
518
+ function onPreload(script) {
519
+ script.state = PRELOADED;
520
+
521
+ each(script.onpreload, function(el) {
522
+ el.call();
523
+ });
524
+ }
525
+
526
+ function preload(script, callback) {
527
+
528
+ if (script.state === undefined) {
529
+
530
+ script.state = PRELOADING;
531
+ script.onpreload = [];
532
+
533
+ scriptTag({ src: script.url, type: 'cache'}, function() {
534
+ onPreload(script);
535
+ });
536
+ }
537
+ }
538
+
539
+ function load(script, callback) {
540
+
541
+ if (script.state == LOADED) {
542
+ return callback && callback();
543
+ }
544
+
545
+ if (script.state == LOADING) {
546
+ return api.ready(script.name, callback);
547
+ }
548
+
549
+ if (script.state == PRELOADING) {
550
+ return script.onpreload.push(function() {
551
+ load(script, callback);
552
+ });
553
+ }
554
+
555
+ script.state = LOADING;
556
+
557
+ scriptTag(script.url, function() {
558
+
559
+ script.state = LOADED;
560
+
561
+ if (callback) { callback(); }
562
+
563
+ // handlers for this script
564
+ each(handlers[script.name], function(fn) {
565
+ one(fn);
566
+ });
567
+
568
+ // everything ready
569
+ if (allLoaded() && isDomReady) {
570
+ each(handlers.ALL, function(fn) {
571
+ one(fn);
572
+ });
573
+ }
574
+ });
575
+ }
576
+
577
+
578
+ function scriptTag(src, callback) {
579
+
580
+ var s = doc.createElement('script');
581
+ s.type = 'text/' + (src.type || 'javascript');
582
+ s.src = src.src || src;
583
+ s.async = false;
584
+
585
+ s.onreadystatechange = s.onload = function() {
586
+
587
+ var state = s.readyState;
588
+
589
+ if (!callback.done && (!state || /loaded|complete/.test(state))) {
590
+ callback.done = true;
591
+ callback();
592
+ }
593
+ };
594
+
595
+ // use body if available. more safe in IE
596
+ (doc.body || head).appendChild(s);
597
+ }
598
+
599
+ /*
600
+ The much desired DOM ready check
601
+ Thanks to jQuery and http://javascript.nwbox.com/IEContentLoaded/
602
+ */
603
+
604
+ function fireReady() {
605
+ if (!isDomReady) {
606
+ isDomReady = true;
607
+ each(domWaiters, function(fn) {
608
+ one(fn);
609
+ });
610
+ }
611
+ }
612
+
613
+ // W3C
614
+ if (window.addEventListener) {
615
+ doc.addEventListener("DOMContentLoaded", fireReady, false);
616
+
617
+ // fallback. this is always called
618
+ window.addEventListener("load", fireReady, false);
619
+
620
+ // IE
621
+ } else if (window.attachEvent) {
622
+
623
+ // for iframes
624
+ doc.attachEvent("onreadystatechange", function() {
625
+ if (doc.readyState === "complete" ) {
626
+ fireReady();
627
+ }
628
+ });
629
+
630
+
631
+ // avoid frames with different domains issue
632
+ var frameElement = 1;
633
+
634
+ try {
635
+ frameElement = window.frameElement;
636
+
637
+ } catch(e) {}
638
+
639
+
640
+ if (!frameElement && head.doScroll) {
641
+
642
+ (function() {
643
+ try {
644
+ head.doScroll("left");
645
+ fireReady();
646
+
647
+ } catch(e) {
648
+ setTimeout(arguments.callee, 1);
649
+ return;
650
+ }
651
+ })();
652
+ }
653
+
654
+ // fallback
655
+ window.attachEvent("onload", fireReady);
656
+ }
657
+
658
+
659
+ // enable document.readyState for Firefox <= 3.5
660
+ if (!doc.readyState && doc.addEventListener) {
661
+ doc.readyState = "loading";
662
+ doc.addEventListener("DOMContentLoaded", handler = function () {
663
+ doc.removeEventListener("DOMContentLoaded", handler, false);
664
+ doc.readyState = "complete";
665
+ }, false);
666
+ }
667
+
668
+ /*
669
+ We wait for 300 ms before script loading starts. for some reason this is needed
670
+ to make sure scripts are cached. Not sure why this happens yet. A case study:
671
+
672
+ https://github.com/headjs/headjs/issues/closed#issue/83
673
+ */
674
+ setTimeout(function() {
675
+ isHeadReady = true;
676
+ each(queue, function(fn) { fn(); });
677
+
678
+ }, 300);
679
+
680
+ })(document);
681
+