frontend-helpers 0.0.1.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +18 -0
- data/Gemfile.lock +108 -0
- data/LICENSE.txt +20 -0
- data/MIT-LICENSE +20 -0
- data/README.md +97 -0
- data/Rakefile +53 -0
- data/config/services.yml +95 -0
- data/config/settings.yml +24 -0
- data/frontend-helpers.gemspec +117 -0
- data/lib/.DS_Store +0 -0
- data/lib/asset-helpers/rails.rb +4 -0
- data/lib/frontend-helpers/html5_helper.rb +19 -0
- data/lib/frontend-helpers/metatag_helper.rb +58 -0
- data/lib/frontend-helpers/services_helper.rb +89 -0
- data/lib/frontend-helpers.rb +16 -0
- data/lib/generators/frontend/install/install_generator.rb +27 -0
- data/lib/tasks/frontend-helpers_tasks.rake +4 -0
- data/script/rails +6 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +9 -0
- data/test/dummy/app/assets/stylesheets/application.css +7 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config/application.rb +42 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +27 -0
- data/test/dummy/config/environments/production.rb +54 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +10 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +12 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +26 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/frontend-helpers_test.rb +11 -0
- data/test/test_helper.rb +10 -0
- data/vendor/assets/javascripts/backbone/backbone.js +1149 -0
- data/vendor/assets/javascripts/backbone/index.js +2 -0
- data/vendor/assets/javascripts/backbone/underscore.js +807 -0
- data/vendor/assets/javascripts/ie/dd_belatedpng.js +13 -0
- data/vendor/assets/javascripts/ie/index.js +2 -0
- data/vendor/assets/javascripts/ie/reverse_zindex.js +1 -0
- data/vendor/assets/javascripts/jquery.async.js +77 -0
- data/vendor/assets/javascripts/jquery.cookie.js +89 -0
- data/vendor/assets/javascripts/jquery.lifestream.js +1516 -0
- data/vendor/assets/javascripts/jquery.validate.js +1166 -0
- data/vendor/assets/javascripts/log.js +8 -0
- data/vendor/assets/javascripts/modernizr.js +1116 -0
- data/vendor/assets/javascripts/shortcut.js +223 -0
- data/vendor/assets/javascripts/swfobject.js +4 -0
- data/vendor/assets/stylesheets/reset.css.sass +183 -0
- data/vendor/assets/stylesheets/variables.css.sass +21 -0
- metadata +175 -0
@@ -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 @@
|
|
1
|
+
(function($){$(function(){var zIndexNumber=1000;$("div").each(function(){$(this).css("zIndex",zIndexNumber);zIndexNumber-=10})})})(jQuery);
|
@@ -0,0 +1,77 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery Asynchronous Plugin 1.0 RC1
|
3
|
+
*
|
4
|
+
* Copyright (c) 2008 Vincent Robert (genezys.net)
|
5
|
+
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
6
|
+
* and GPL (GPL-LICENSE.txt) licenses.
|
7
|
+
*
|
8
|
+
*/
|
9
|
+
(function($){
|
10
|
+
|
11
|
+
// opts.delay : (default 10) delay between async call in ms
|
12
|
+
// opts.bulk : (default 500) delay during which the loop can continue synchronously without yielding the CPU
|
13
|
+
// opts.test : (default true) function to test in the while test part
|
14
|
+
// opts.loop : (default empty) function to call in the while loop part
|
15
|
+
// opts.end : (default empty) function to call at the end of the while loop
|
16
|
+
$.whileAsync = function(opts)
|
17
|
+
{
|
18
|
+
var delay = Math.abs(opts.delay) || 10,
|
19
|
+
bulk = isNaN(opts.bulk) ? 500 : Math.abs(opts.bulk),
|
20
|
+
test = opts.test || function(){ return true; },
|
21
|
+
loop = opts.loop || function(){},
|
22
|
+
end = opts.end || function(){};
|
23
|
+
|
24
|
+
(function(){
|
25
|
+
|
26
|
+
var t = false,
|
27
|
+
begin = new Date();
|
28
|
+
|
29
|
+
while( t = test() )
|
30
|
+
{
|
31
|
+
loop();
|
32
|
+
if( bulk === 0 || (new Date() - begin) > bulk )
|
33
|
+
{
|
34
|
+
break;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
if( t )
|
38
|
+
{
|
39
|
+
setTimeout(arguments.callee, delay);
|
40
|
+
}
|
41
|
+
else
|
42
|
+
{
|
43
|
+
end();
|
44
|
+
}
|
45
|
+
|
46
|
+
})();
|
47
|
+
}
|
48
|
+
|
49
|
+
// opts.delay : (default 10) delay between async call in ms
|
50
|
+
// opts.bulk : (default 500) delay during which the loop can continue synchronously without yielding the CPU
|
51
|
+
// opts.loop : (default empty) function to call in the each loop part, signature: function(index, value) this = value
|
52
|
+
// opts.end : (default empty) function to call at the end of the each loop
|
53
|
+
$.eachAsync = function(array, opts)
|
54
|
+
{
|
55
|
+
var i = 0,
|
56
|
+
l = array.length,
|
57
|
+
loop = opts.loop || function(){};
|
58
|
+
|
59
|
+
$.whileAsync(
|
60
|
+
$.extend(opts, {
|
61
|
+
test: function(){ return i < l; },
|
62
|
+
loop: function()
|
63
|
+
{
|
64
|
+
var val = array[i];
|
65
|
+
return loop.call(val, i++, val);
|
66
|
+
}
|
67
|
+
})
|
68
|
+
);
|
69
|
+
}
|
70
|
+
|
71
|
+
$.fn.eachAsync = function(opts)
|
72
|
+
{
|
73
|
+
$.eachAsync(this, opts);
|
74
|
+
return this;
|
75
|
+
}
|
76
|
+
|
77
|
+
})(jQuery)
|
@@ -0,0 +1,89 @@
|
|
1
|
+
/*jslint browser: true */ /*global jQuery: true */
|
2
|
+
|
3
|
+
/**
|
4
|
+
* jQuery Cookie plugin
|
5
|
+
*
|
6
|
+
* Copyright (c) 2010 Klaus Hartl (stilbuero.de)
|
7
|
+
* Dual licensed under the MIT and GPL licenses:
|
8
|
+
* http://www.opensource.org/licenses/mit-license.php
|
9
|
+
* http://www.gnu.org/licenses/gpl.html
|
10
|
+
*
|
11
|
+
*/
|
12
|
+
|
13
|
+
// JsDoc
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Create a cookie with the given key and value and other optional parameters.
|
17
|
+
*
|
18
|
+
* @example $.cookie('the_cookie', 'the_value');
|
19
|
+
* @desc Set the value of a cookie.
|
20
|
+
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
|
21
|
+
* @desc Create a cookie with all available options.
|
22
|
+
* @example $.cookie('the_cookie', 'the_value');
|
23
|
+
* @desc Create a session cookie.
|
24
|
+
* @example $.cookie('the_cookie', null);
|
25
|
+
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
|
26
|
+
* used when the cookie was set.
|
27
|
+
*
|
28
|
+
* @param String key The key of the cookie.
|
29
|
+
* @param String value The value of the cookie.
|
30
|
+
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
|
31
|
+
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
|
32
|
+
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
|
33
|
+
* If set to null or omitted, the cookie will be a session cookie and will not be retained
|
34
|
+
* when the the browser exits.
|
35
|
+
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
|
36
|
+
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
|
37
|
+
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
|
38
|
+
* require a secure protocol (like HTTPS).
|
39
|
+
* @type undefined
|
40
|
+
*
|
41
|
+
* @name $.cookie
|
42
|
+
* @cat Plugins/Cookie
|
43
|
+
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
44
|
+
*/
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Get the value of a cookie with the given key.
|
48
|
+
*
|
49
|
+
* @example $.cookie('the_cookie');
|
50
|
+
* @desc Get the value of a cookie.
|
51
|
+
*
|
52
|
+
* @param String key The key of the cookie.
|
53
|
+
* @return The value of the cookie.
|
54
|
+
* @type String
|
55
|
+
*
|
56
|
+
* @name $.cookie
|
57
|
+
* @cat Plugins/Cookie
|
58
|
+
* @author Klaus Hartl/klaus.hartl@stilbuero.de
|
59
|
+
*/
|
60
|
+
jQuery.cookie = function (key, value, options) {
|
61
|
+
|
62
|
+
// key and value given, set cookie...
|
63
|
+
if (arguments.length > 1 && (value === null || typeof value !== "object")) {
|
64
|
+
options = jQuery.extend({}, options);
|
65
|
+
|
66
|
+
if (value === null) {
|
67
|
+
options.expires = -1;
|
68
|
+
}
|
69
|
+
|
70
|
+
if (typeof options.expires === 'number') {
|
71
|
+
var days = options.expires, t = options.expires = new Date();
|
72
|
+
t.setDate(t.getDate() + days);
|
73
|
+
}
|
74
|
+
|
75
|
+
return (document.cookie = [
|
76
|
+
encodeURIComponent(key), '=',
|
77
|
+
options.raw ? String(value) : encodeURIComponent(String(value)),
|
78
|
+
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
79
|
+
options.path ? '; path=' + options.path : '',
|
80
|
+
options.domain ? '; domain=' + options.domain : '',
|
81
|
+
options.secure ? '; secure' : ''
|
82
|
+
].join(''));
|
83
|
+
}
|
84
|
+
|
85
|
+
// key and possibly options given, get cookie...
|
86
|
+
options = value || {};
|
87
|
+
var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
|
88
|
+
return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
|
89
|
+
};
|