furatto 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/furatto.gemspec +21 -0
- data/lib/furatto.rb +16 -0
- data/lib/furatto/engine.rb +6 -0
- data/lib/furatto/version.rb +3 -0
- data/vendor/assets/fonts/fontawesome/FontAwesome.otf +0 -0
- data/vendor/assets/fonts/fontawesome/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome/fontawesome-webfont.svg +399 -0
- data/vendor/assets/fonts/fontawesome/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/meteocons-webfont.eot +0 -0
- data/vendor/assets/fonts/meteocons-webfont.svg +81 -0
- data/vendor/assets/fonts/meteocons-webfont.ttf +0 -0
- data/vendor/assets/fonts/meteocons-webfont.woff +0 -0
- data/vendor/assets/images/icheck/aero.png +0 -0
- data/vendor/assets/images/icheck/aero@2x.png +0 -0
- data/vendor/assets/images/icheck/blue.png +0 -0
- data/vendor/assets/images/icheck/blue@2x.png +0 -0
- data/vendor/assets/images/icheck/flat.png +0 -0
- data/vendor/assets/images/icheck/flat@2x.png +0 -0
- data/vendor/assets/images/icheck/green.png +0 -0
- data/vendor/assets/images/icheck/green@2x.png +0 -0
- data/vendor/assets/images/icheck/grey.png +0 -0
- data/vendor/assets/images/icheck/grey@2x.png +0 -0
- data/vendor/assets/images/icheck/orange.png +0 -0
- data/vendor/assets/images/icheck/orange@2x.png +0 -0
- data/vendor/assets/images/icheck/pink.png +0 -0
- data/vendor/assets/images/icheck/pink@2x.png +0 -0
- data/vendor/assets/images/icheck/purple.png +0 -0
- data/vendor/assets/images/icheck/purple@2x.png +0 -0
- data/vendor/assets/images/icheck/red.png +0 -0
- data/vendor/assets/images/icheck/red@2x.png +0 -0
- data/vendor/assets/images/icheck/yellow.png +0 -0
- data/vendor/assets/images/icheck/yellow@2x.png +0 -0
- data/vendor/assets/images/icons/customize-icon150.png +0 -0
- data/vendor/assets/images/icons/flexible-icon.png +0 -0
- data/vendor/assets/images/icons/github-128-black.png +0 -0
- data/vendor/assets/images/icons/iphone-icon150.png +0 -0
- data/vendor/assets/images/icons/lock-icon128.png +0 -0
- data/vendor/assets/images/icons/rocket-icon128.png +0 -0
- data/vendor/assets/images/icons/rocket-icon150.png +0 -0
- data/vendor/assets/images/icons/screen-icon.png +0 -0
- data/vendor/assets/images/icons/screens-icon.png +0 -0
- data/vendor/assets/images/icons/screens2-icon.png +0 -0
- data/vendor/assets/images/next.png +0 -0
- data/vendor/assets/images/previous.png +0 -0
- data/vendor/assets/images/themes.gif +0 -0
- data/vendor/assets/images/toggle.png +0 -0
- data/vendor/assets/javascripts/dropdown.js +169 -0
- data/vendor/assets/javascripts/furatto.js +15 -0
- data/vendor/assets/javascripts/jpanel.js +547 -0
- data/vendor/assets/javascripts/jquery.avgrund.js +127 -0
- data/vendor/assets/javascripts/jquery.dropkick-1.0.0.js +400 -0
- data/vendor/assets/javascripts/jquery.icheck.js +462 -0
- data/vendor/assets/javascripts/jquery.tagsinput.js +354 -0
- data/vendor/assets/javascripts/jquery.toolbar.js +242 -0
- data/vendor/assets/javascripts/legacy.js +140 -0
- data/vendor/assets/javascripts/picker.date.js +957 -0
- data/vendor/assets/javascripts/picker.js +785 -0
- data/vendor/assets/javascripts/picker.time.js +651 -0
- data/vendor/assets/javascripts/rainbow-custom.min.js +13 -0
- data/vendor/assets/javascripts/responsive-tables.js +67 -0
- data/vendor/assets/javascripts/responsiveslides.js +391 -0
- data/vendor/assets/javascripts/tooltip.js +353 -0
- data/vendor/assets/stylesheets/furatto.scss +101 -0
- data/vendor/assets/stylesheets/furatto/_alerts.scss +81 -0
- data/vendor/assets/stylesheets/furatto/_base.scss +187 -0
- data/vendor/assets/stylesheets/furatto/_buttons.scss +100 -0
- data/vendor/assets/stylesheets/furatto/_code.scss +66 -0
- data/vendor/assets/stylesheets/furatto/_date_picker.date.scss +266 -0
- data/vendor/assets/stylesheets/furatto/_date_picker.scss +158 -0
- data/vendor/assets/stylesheets/furatto/_date_picker.time.scss +122 -0
- data/vendor/assets/stylesheets/furatto/_dropdown.scss +261 -0
- data/vendor/assets/stylesheets/furatto/_font-awesome-ie7.scss +1953 -0
- data/vendor/assets/stylesheets/furatto/_fonts.scss +614 -0
- data/vendor/assets/stylesheets/furatto/_footer.scss +44 -0
- data/vendor/assets/stylesheets/furatto/_forms.scss +290 -0
- data/vendor/assets/stylesheets/furatto/_grid.scss +56 -0
- data/vendor/assets/stylesheets/furatto/_images.scss +44 -0
- data/vendor/assets/stylesheets/furatto/_labels.scss +43 -0
- data/vendor/assets/stylesheets/furatto/_layout.scss +0 -0
- data/vendor/assets/stylesheets/furatto/_left_navbar.scss +100 -0
- data/vendor/assets/stylesheets/furatto/_mixins.scss +283 -0
- data/vendor/assets/stylesheets/furatto/_modal.scss +103 -0
- data/vendor/assets/stylesheets/furatto/_nav.scss +106 -0
- data/vendor/assets/stylesheets/furatto/_navbar.scss +187 -0
- data/vendor/assets/stylesheets/furatto/_pagination.scss +158 -0
- data/vendor/assets/stylesheets/furatto/_responsive-1200px-min.scss +21 -0
- data/vendor/assets/stylesheets/furatto/_responsive-767px-max.scss +82 -0
- data/vendor/assets/stylesheets/furatto/_responsive-768px-979px.scss +23 -0
- data/vendor/assets/stylesheets/furatto/_responsive_navbar.scss +184 -0
- data/vendor/assets/stylesheets/furatto/_responsive_tables.scss +28 -0
- data/vendor/assets/stylesheets/furatto/_responsiveslides.scss +202 -0
- data/vendor/assets/stylesheets/furatto/_select.scss +191 -0
- data/vendor/assets/stylesheets/furatto/_tables.scss +90 -0
- data/vendor/assets/stylesheets/furatto/_tags.scss +107 -0
- data/vendor/assets/stylesheets/furatto/_toolbars.scss +116 -0
- data/vendor/assets/stylesheets/furatto/_tooltips.scss +143 -0
- data/vendor/assets/stylesheets/furatto/_typography.scss +266 -0
- data/vendor/assets/stylesheets/furatto/_variables.scss +628 -0
- data/vendor/assets/stylesheets/furatto/_vrt_navbar.scss +61 -0
- data/vendor/assets/stylesheets/furatto/icheck/_aero.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_all.scss +20 -0
- data/vendor/assets/stylesheets/furatto/icheck/_blue.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_flat.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_green.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_grey.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_orange.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_pink.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_purple.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_red.scss +64 -0
- data/vendor/assets/stylesheets/furatto/icheck/_yellow.scss +64 -0
- data/vendor/assets/stylesheets/normalize.scss +403 -0
- metadata +162 -0
@@ -0,0 +1,13 @@
|
|
1
|
+
/* Rainbow v1.2 rainbowco.de | included languages: generic, javascript, html, css */
|
2
|
+
window.Rainbow=function(){function q(a){var b,c=a.getAttribute&&a.getAttribute("data-language")||0;if(!c){a=a.attributes;for(b=0;b<a.length;++b)if("data-language"===a[b].nodeName)return a[b].nodeValue}return c}function B(a){var b=q(a)||q(a.parentNode);if(!b){var c=/\blang(?:uage)?-(\w+)/;(a=a.className.match(c)||a.parentNode.className.match(c))&&(b=a[1])}return b}function C(a,b){for(var c in f[d]){c=parseInt(c,10);if(a==c&&b==f[d][c]?0:a<=c&&b>=f[d][c])delete f[d][c],delete j[d][c];if(a>=c&&a<f[d][c]||
|
3
|
+
b>c&&b<f[d][c])return!0}return!1}function r(a,b){return'<span class="'+a.replace(/\./g," ")+(l?" "+l:"")+'">'+b+"</span>"}function s(a,b,c,i){var e=a.exec(c);if(e){++t;!b.name&&"string"==typeof b.matches[0]&&(b.name=b.matches[0],delete b.matches[0]);var k=e[0],g=e.index,u=e[0].length+g,h=function(){function e(){s(a,b,c,i)}t%100>0?e():setTimeout(e,0)};if(C(g,u))h();else{var m=v(b.matches),l=function(a,c,i){if(a>=c.length)i(k);else{var d=e[c[a]];if(d){var g=b.matches[c[a]],f=g.language,h=g.name&&g.matches?
|
4
|
+
g.matches:g,j=function(b,d,g){var f;f=0;var h;for(h=1;h<c[a];++h)e[h]&&(f=f+e[h].length);d=g?r(g,d):d;k=k.substr(0,f)+k.substr(f).replace(b,d);l(++a,c,i)};f?n(d,f,function(a){j(d,a)}):typeof g==="string"?j(d,d,g):w(d,h.length?h:[h],function(a){j(d,a,g.matches?g.name:0)})}else l(++a,c,i)}};l(0,m,function(a){b.name&&(a=r(b.name,a));if(!j[d]){j[d]={};f[d]={}}j[d][g]={replace:e[0],"with":a};f[d][g]=u;h()})}}else i()}function v(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(c);return b.sort(function(a,
|
5
|
+
b){return b-a})}function w(a,b,c){function i(b,k){k<b.length?s(b[k].pattern,b[k],a,function(){i(b,++k)}):D(a,function(a){delete j[d];delete f[d];--d;c(a)})}++d;i(b,0)}function D(a,b){function c(a,b,i,f){if(i<b.length){++x;var h=b[i],l=j[d][h],a=a.substr(0,h)+a.substr(h).replace(l.replace,l["with"]),h=function(){c(a,b,++i,f)};0<x%250?h():setTimeout(h,0)}else f(a)}var i=v(j[d]);c(a,i,0,b)}function n(a,b,c){var d=m[b]||[],e=m[y]||[],b=z[b]?d:d.concat(e);w(a.replace(/</g,"<").replace(/>/g,">").replace(/&(?![\w\#]+;)/g,
|
6
|
+
"&"),b,c)}function o(a,b,c){if(b<a.length){var d=a[b],e=B(d);return!(-1<(" "+d.className+" ").indexOf(" rainbow "))&&e?(e=e.toLowerCase(),d.className+=d.className?" rainbow":"rainbow",n(d.innerHTML,e,function(k){d.innerHTML=k;j={};f={};p&&p(d,e);setTimeout(function(){o(a,++b,c)},0)})):o(a,++b,c)}c&&c()}function A(a,b){var a=a&&"function"==typeof a.getElementsByTagName?a:document,c=a.getElementsByTagName("pre"),d=a.getElementsByTagName("code"),e,f=[],g=[];for(e=0;e<c.length;++e)c[e].getElementsByTagName("code").length?
|
7
|
+
c[e].innerHTML=c[e].innerHTML.replace(/^\s+/,"").replace(/\s+$/,""):f.push(c[e]);for(e=0;e<d.length;++e)g.push(d[e]);o(g.concat(f),0,b)}var j={},f={},m={},z={},d=0,y=0,t=0,x=0,l,p;return{extend:function(a,b,c){1==arguments.length&&(b=a,a=y);z[a]=c;m[a]=b.concat(m[a]||[])},b:function(a){p=a},a:function(a){l=a},color:function(a,b,c){if("string"==typeof a)return n(a,b,c);if("function"==typeof a)return A(0,a);A(a,b)}}}();
|
8
|
+
document.addEventListener?document.addEventListener("DOMContentLoaded",Rainbow.color,!1):window.attachEvent("onload",Rainbow.color);Rainbow.onHighlight=Rainbow.b;Rainbow.addClass=Rainbow.a;Rainbow.extend([{matches:{1:{name:"keyword.operator",pattern:/\=/g},2:{name:"string",matches:{name:"constant.character.escape",pattern:/\\('|"){1}/g}}},pattern:/(\(|\s|\[|\=|:)(('|")([^\\\1]|\\.)*?(\3))/gm},{name:"comment",pattern:/\/\*[\s\S]*?\*\/|(\/\/|\#)[\s\S]*?$/gm},{name:"constant.numeric",pattern:/\b(\d+(\.\d+)?(e(\+|\-)?\d+)?(f|d)?|0x[\da-f]+)\b/gi},{matches:{1:"keyword"},pattern:/\b(and|array|as|b(ool(ean)?|reak)|c(ase|atch|har|lass|on(st|tinue))|d(ef|elete|o(uble)?)|e(cho|lse(if)?|xit|xtends|xcept)|f(inally|loat|or(each)?|unction)|global|if|import|int(eger)?|long|new|object|or|pr(int|ivate|otected)|public|return|self|st(ring|ruct|atic)|switch|th(en|is|row)|try|(un)?signed|var|void|while)(?=\(|\b)/gi},
|
9
|
+
{name:"constant.language",pattern:/true|false|null/g},{name:"keyword.operator",pattern:/\+|\!|\-|&(gt|lt|amp);|\||\*|\=/g},{matches:{1:"function.call"},pattern:/(\w+?)(?=\()/g},{matches:{1:"storage.function",2:"entity.name.function"},pattern:/(function)\s(.*?)(?=\()/g}]);Rainbow.extend("javascript",[{name:"selector",pattern:/(\s|^)\$(?=\.|\()/g},{name:"support",pattern:/\b(window|document)\b/g},{matches:{1:"support.property"},pattern:/\.(length|node(Name|Value))\b/g},{matches:{1:"support.function"},pattern:/(setTimeout|setInterval)(?=\()/g},{matches:{1:"support.method"},pattern:/\.(getAttribute|push|getElementById|getElementsByClassName|log|setTimeout|setInterval)(?=\()/g},{matches:{1:"support.tag.script",2:[{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.script",
|
10
|
+
pattern:/(\w+)/g}],3:"support.tag.script"},pattern:/(<\/?)(script.*?)(>)/g},{name:"string.regexp",matches:{1:"string.regexp.open",2:{name:"constant.regexp.escape",pattern:/\\(.){1}/g},3:"string.regexp.close",4:"string.regexp.modifier"},pattern:/(\/)(?!\*)(.+)(\/)([igm]{0,3})/g},{matches:{1:"storage",3:"entity.function"},pattern:/(var)?(\s|^)(\S*)(?=\s?=\s?function\()/g},{matches:{1:"keyword",2:"entity.function"},pattern:/(new)\s+(.*)(?=\()/g},{name:"entity.function",pattern:/(\w+)(?=:\s{0,}function)/g}]);Rainbow.extend("html",[{name:"source.php.embedded",matches:{2:{language:"php"}},pattern:/<\?=?(?!xml)(php)?([\s\S]*?)(\?>)/gm},{name:"source.css.embedded",matches:{"0":{language:"css"}},pattern:/<style(.*?)>([\s\S]*?)<\/style>/gm},{name:"source.js.embedded",matches:{"0":{language:"javascript"}},pattern:/<script(?! src)(.*?)>([\s\S]*?)<\/script>/gm},{name:"comment.html",pattern:/<\!--[\S\s]*?-->/g},{matches:{1:"support.tag.open",2:"support.tag.close"},pattern:/(<)|(\/?\??>)/g},
|
11
|
+
{name:"support.tag",matches:{1:"support.tag",2:"support.tag.special",3:"support.tag-name"},pattern:/(<\??)(\/|\!?)(\w+)/g},{matches:{1:"support.attribute"},pattern:/([a-z-]+)(?=\=)/gi},{matches:{1:"support.operator",2:"string.quote",3:"string.value",4:"string.quote"},pattern:/(=)('|")(.*?)(\2)/g},{matches:{1:"support.operator",2:"support.value"},pattern:/(=)([a-zA-Z\-0-9]*)\b/g},{matches:{1:"support.attribute"},pattern:/\s(\w+)(?=\s|>)(?![\s\S]*<)/g}],!0);Rainbow.extend("css",[{name:"comment",pattern:/\/\*[\s\S]*?\*\//gm},{name:"constant.hex-color",pattern:/#([a-f0-9]{3}|[a-f0-9]{6})(?=;|\s|,|\))/gi},{matches:{1:"constant.numeric",2:"keyword.unit"},pattern:/(\d+)(px|em|cm|s|%)?/g},{name:"string",pattern:/('|")(.*?)\1/g},{name:"support.css-property",matches:{1:"support.vendor-prefix"},pattern:/(-o-|-moz-|-webkit-|-ms-)?[\w-]+(?=\s?:)(?!.*\{)/g},{matches:{1:[{name:"entity.name.sass",pattern:/&/g},{name:"direct-descendant",pattern:/>/g},{name:"entity.name.class",
|
12
|
+
pattern:/\.[\w\-_]+/g},{name:"entity.name.id",pattern:/\#[\w\-_]+/g},{name:"entity.name.pseudo",pattern:/:[\w\-_]+/g},{name:"entity.name.tag",pattern:/\w+/g}]},pattern:/([\w\ ,:\.\#\&\;\-_]+)(?=.*\{)/g},{matches:{2:"support.vendor-prefix",3:"support.css-value"},pattern:/(:|,)\s*(-o-|-moz-|-webkit-|-ms-)?([a-zA-Z-]*)(?=\b)(?!.*\{)/g},{matches:{1:"support.tag.style",2:[{name:"string",pattern:/('|")(.*?)(\1)/g},{name:"entity.tag.style",pattern:/(\w+)/g}],3:"support.tag.style"},pattern:/(<\/?)(style.*?)(>)/g}],
|
13
|
+
!0);
|
@@ -0,0 +1,67 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
var switched = false;
|
3
|
+
var updateTables = function() {
|
4
|
+
if (($(window).width() < 767) && !switched ){
|
5
|
+
switched = true;
|
6
|
+
$("table.responsive").each(function(i, element) {
|
7
|
+
splitTable($(element));
|
8
|
+
});
|
9
|
+
return true;
|
10
|
+
}
|
11
|
+
else if (switched && ($(window).width() > 767)) {
|
12
|
+
switched = false;
|
13
|
+
$("table.responsive").each(function(i, element) {
|
14
|
+
unsplitTable($(element));
|
15
|
+
});
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
$(window).load(updateTables);
|
20
|
+
$(window).on("redraw",function(){switched=false;updateTables();}); // An event to listen for
|
21
|
+
$(window).on("resize", updateTables);
|
22
|
+
|
23
|
+
|
24
|
+
function splitTable(original)
|
25
|
+
{
|
26
|
+
original.wrap("<div class='table-wrapper' />");
|
27
|
+
|
28
|
+
var copy = original.clone();
|
29
|
+
copy.find("td:not(:first-child), th:not(:first-child)").css("display", "none");
|
30
|
+
copy.removeClass("responsive");
|
31
|
+
|
32
|
+
original.closest(".table-wrapper").append(copy);
|
33
|
+
copy.wrap("<div class='pinned' />");
|
34
|
+
original.wrap("<div class='scrollable' />");
|
35
|
+
|
36
|
+
setCellHeights(original, copy);
|
37
|
+
}
|
38
|
+
|
39
|
+
function unsplitTable(original) {
|
40
|
+
original.closest(".table-wrapper").find(".pinned").remove();
|
41
|
+
original.unwrap();
|
42
|
+
original.unwrap();
|
43
|
+
}
|
44
|
+
|
45
|
+
function setCellHeights(original, copy) {
|
46
|
+
var tr = original.find('tr'),
|
47
|
+
tr_copy = copy.find('tr'),
|
48
|
+
heights = [];
|
49
|
+
|
50
|
+
tr.each(function (index) {
|
51
|
+
var self = $(this),
|
52
|
+
tx = self.find('th, td');
|
53
|
+
|
54
|
+
tx.each(function () {
|
55
|
+
var height = $(this).outerHeight(true);
|
56
|
+
heights[index] = heights[index] || 0;
|
57
|
+
if (height > heights[index]) heights[index] = height;
|
58
|
+
});
|
59
|
+
|
60
|
+
});
|
61
|
+
|
62
|
+
tr_copy.each(function (index) {
|
63
|
+
$(this).height(heights[index]);
|
64
|
+
});
|
65
|
+
}
|
66
|
+
|
67
|
+
});
|
@@ -0,0 +1,391 @@
|
|
1
|
+
/*! ResponsiveSlides.js v1.54
|
2
|
+
* http://responsiveslides.com
|
3
|
+
* http://viljamis.com
|
4
|
+
*
|
5
|
+
* Copyright (c) 2011-2012 @viljamis
|
6
|
+
* Available under the MIT license
|
7
|
+
*/
|
8
|
+
|
9
|
+
/*jslint browser: true, sloppy: true, vars: true, plusplus: true, indent: 2 */
|
10
|
+
|
11
|
+
(function ($, window, i) {
|
12
|
+
$.fn.responsiveSlides = function (options) {
|
13
|
+
|
14
|
+
// Default settings
|
15
|
+
var settings = $.extend({
|
16
|
+
"auto": true, // Boolean: Animate automatically, true or false
|
17
|
+
"speed": 500, // Integer: Speed of the transition, in milliseconds
|
18
|
+
"timeout": 4000, // Integer: Time between slide transitions, in milliseconds
|
19
|
+
"pager": false, // Boolean: Show pager, true or false
|
20
|
+
"nav": false, // Boolean: Show navigation, true or false
|
21
|
+
"random": false, // Boolean: Randomize the order of the slides, true or false
|
22
|
+
"pause": false, // Boolean: Pause on hover, true or false
|
23
|
+
"pauseControls": true, // Boolean: Pause when hovering controls, true or false
|
24
|
+
"prevText": "Previous", // String: Text for the "previous" button
|
25
|
+
"nextText": "Next", // String: Text for the "next" button
|
26
|
+
"maxwidth": "", // Integer: Max-width of the slideshow, in pixels
|
27
|
+
"navContainer": "", // Selector: Where auto generated controls should be appended to, default is after the <ul>
|
28
|
+
"manualControls": "", // Selector: Declare custom pager navigation
|
29
|
+
"namespace": "rslides", // String: change the default namespace used
|
30
|
+
"before": $.noop, // Function: Before callback
|
31
|
+
"after": $.noop // Function: After callback
|
32
|
+
}, options);
|
33
|
+
|
34
|
+
return this.each(function () {
|
35
|
+
|
36
|
+
// Index for namespacing
|
37
|
+
i++;
|
38
|
+
|
39
|
+
var $this = $(this),
|
40
|
+
|
41
|
+
// Local variables
|
42
|
+
vendor,
|
43
|
+
selectTab,
|
44
|
+
startCycle,
|
45
|
+
restartCycle,
|
46
|
+
rotate,
|
47
|
+
$tabs,
|
48
|
+
|
49
|
+
// Helpers
|
50
|
+
index = 0,
|
51
|
+
$slide = $this.children(),
|
52
|
+
length = $slide.size(),
|
53
|
+
fadeTime = parseFloat(settings.speed),
|
54
|
+
waitTime = parseFloat(settings.timeout),
|
55
|
+
maxw = parseFloat(settings.maxwidth),
|
56
|
+
|
57
|
+
// Namespacing
|
58
|
+
namespace = settings.namespace,
|
59
|
+
namespaceIdx = namespace + i,
|
60
|
+
|
61
|
+
// Classes
|
62
|
+
navClass = namespace + "_nav " + namespaceIdx + "_nav",
|
63
|
+
activeClass = namespace + "_here",
|
64
|
+
visibleClass = namespaceIdx + "_on",
|
65
|
+
slideClassPrefix = namespaceIdx + "_s",
|
66
|
+
|
67
|
+
// Pager
|
68
|
+
$pager = $("<ul class='" + namespace + "_tabs " + namespaceIdx + "_tabs' />"),
|
69
|
+
|
70
|
+
// Styles for visible and hidden slides
|
71
|
+
visible = {"float": "left", "position": "relative", "opacity": 1, "zIndex": 2},
|
72
|
+
hidden = {"float": "none", "position": "absolute", "opacity": 0, "zIndex": 1},
|
73
|
+
|
74
|
+
// Detect transition support
|
75
|
+
supportsTransitions = (function () {
|
76
|
+
var docBody = document.body || document.documentElement;
|
77
|
+
var styles = docBody.style;
|
78
|
+
var prop = "transition";
|
79
|
+
if (typeof styles[prop] === "string") {
|
80
|
+
return true;
|
81
|
+
}
|
82
|
+
// Tests for vendor specific prop
|
83
|
+
vendor = ["Moz", "Webkit", "Khtml", "O", "ms"];
|
84
|
+
prop = prop.charAt(0).toUpperCase() + prop.substr(1);
|
85
|
+
var i;
|
86
|
+
for (i = 0; i < vendor.length; i++) {
|
87
|
+
if (typeof styles[vendor[i] + prop] === "string") {
|
88
|
+
return true;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
return false;
|
92
|
+
})(),
|
93
|
+
|
94
|
+
// Fading animation
|
95
|
+
slideTo = function (idx) {
|
96
|
+
settings.before(idx);
|
97
|
+
// If CSS3 transitions are supported
|
98
|
+
if (supportsTransitions) {
|
99
|
+
$slide
|
100
|
+
.removeClass(visibleClass)
|
101
|
+
.css(hidden)
|
102
|
+
.eq(idx)
|
103
|
+
.addClass(visibleClass)
|
104
|
+
.css(visible);
|
105
|
+
index = idx;
|
106
|
+
setTimeout(function () {
|
107
|
+
settings.after(idx);
|
108
|
+
}, fadeTime);
|
109
|
+
// If not, use jQuery fallback
|
110
|
+
} else {
|
111
|
+
$slide
|
112
|
+
.stop()
|
113
|
+
.fadeOut(fadeTime, function () {
|
114
|
+
$(this)
|
115
|
+
.removeClass(visibleClass)
|
116
|
+
.css(hidden)
|
117
|
+
.css("opacity", 1);
|
118
|
+
})
|
119
|
+
.eq(idx)
|
120
|
+
.fadeIn(fadeTime, function () {
|
121
|
+
$(this)
|
122
|
+
.addClass(visibleClass)
|
123
|
+
.css(visible);
|
124
|
+
settings.after(idx);
|
125
|
+
index = idx;
|
126
|
+
});
|
127
|
+
}
|
128
|
+
};
|
129
|
+
|
130
|
+
// Random order
|
131
|
+
if (settings.random) {
|
132
|
+
$slide.sort(function () {
|
133
|
+
return (Math.round(Math.random()) - 0.5);
|
134
|
+
});
|
135
|
+
$this
|
136
|
+
.empty()
|
137
|
+
.append($slide);
|
138
|
+
}
|
139
|
+
|
140
|
+
// Add ID's to each slide
|
141
|
+
$slide.each(function (i) {
|
142
|
+
this.id = slideClassPrefix + i;
|
143
|
+
});
|
144
|
+
|
145
|
+
// Add max-width and classes
|
146
|
+
$this.addClass(namespace + " " + namespaceIdx);
|
147
|
+
if (options && options.maxwidth) {
|
148
|
+
$this.css("max-width", maxw);
|
149
|
+
}
|
150
|
+
|
151
|
+
// Hide all slides, then show first one
|
152
|
+
$slide
|
153
|
+
.hide()
|
154
|
+
.css(hidden)
|
155
|
+
.eq(0)
|
156
|
+
.addClass(visibleClass)
|
157
|
+
.css(visible)
|
158
|
+
.show();
|
159
|
+
|
160
|
+
// CSS transitions
|
161
|
+
if (supportsTransitions) {
|
162
|
+
$slide
|
163
|
+
.show()
|
164
|
+
.css({
|
165
|
+
// -ms prefix isn't needed as IE10 uses prefix free version
|
166
|
+
"-webkit-transition": "opacity " + fadeTime + "ms ease-in-out",
|
167
|
+
"-moz-transition": "opacity " + fadeTime + "ms ease-in-out",
|
168
|
+
"-o-transition": "opacity " + fadeTime + "ms ease-in-out",
|
169
|
+
"transition": "opacity " + fadeTime + "ms ease-in-out"
|
170
|
+
});
|
171
|
+
}
|
172
|
+
|
173
|
+
// Only run if there's more than one slide
|
174
|
+
if ($slide.size() > 1) {
|
175
|
+
|
176
|
+
// Make sure the timeout is at least 100ms longer than the fade
|
177
|
+
if (waitTime < fadeTime + 100) {
|
178
|
+
return;
|
179
|
+
}
|
180
|
+
|
181
|
+
// Pager
|
182
|
+
if (settings.pager && !settings.manualControls) {
|
183
|
+
var tabMarkup = [];
|
184
|
+
$slide.each(function (i) {
|
185
|
+
var n = i + 1;
|
186
|
+
tabMarkup +=
|
187
|
+
"<li>" +
|
188
|
+
"<a href='#' class='" + slideClassPrefix + n + "'>" + n + "</a>" +
|
189
|
+
"</li>";
|
190
|
+
});
|
191
|
+
$pager.append(tabMarkup);
|
192
|
+
|
193
|
+
// Inject pager
|
194
|
+
if (options.navContainer) {
|
195
|
+
$(settings.navContainer).append($pager);
|
196
|
+
} else {
|
197
|
+
$this.after($pager);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
// Manual pager controls
|
202
|
+
if (settings.manualControls) {
|
203
|
+
$pager = $(settings.manualControls);
|
204
|
+
$pager.addClass(namespace + "_tabs " + namespaceIdx + "_tabs");
|
205
|
+
}
|
206
|
+
|
207
|
+
// Add pager slide class prefixes
|
208
|
+
if (settings.pager || settings.manualControls) {
|
209
|
+
$pager.find('li').each(function (i) {
|
210
|
+
$(this).addClass(slideClassPrefix + (i + 1));
|
211
|
+
});
|
212
|
+
}
|
213
|
+
|
214
|
+
// If we have a pager, we need to set up the selectTab function
|
215
|
+
if (settings.pager || settings.manualControls) {
|
216
|
+
$tabs = $pager.find('a');
|
217
|
+
|
218
|
+
// Select pager item
|
219
|
+
selectTab = function (idx) {
|
220
|
+
$tabs
|
221
|
+
.closest("li")
|
222
|
+
.removeClass(activeClass)
|
223
|
+
.eq(idx)
|
224
|
+
.addClass(activeClass);
|
225
|
+
};
|
226
|
+
}
|
227
|
+
|
228
|
+
// Auto cycle
|
229
|
+
if (settings.auto) {
|
230
|
+
|
231
|
+
startCycle = function () {
|
232
|
+
rotate = setInterval(function () {
|
233
|
+
|
234
|
+
// Clear the event queue
|
235
|
+
$slide.stop(true, true);
|
236
|
+
|
237
|
+
var idx = index + 1 < length ? index + 1 : 0;
|
238
|
+
|
239
|
+
// Remove active state and set new if pager is set
|
240
|
+
if (settings.pager || settings.manualControls) {
|
241
|
+
selectTab(idx);
|
242
|
+
}
|
243
|
+
|
244
|
+
slideTo(idx);
|
245
|
+
}, waitTime);
|
246
|
+
};
|
247
|
+
|
248
|
+
// Init cycle
|
249
|
+
startCycle();
|
250
|
+
}
|
251
|
+
|
252
|
+
// Restarting cycle
|
253
|
+
restartCycle = function () {
|
254
|
+
if (settings.auto) {
|
255
|
+
// Stop
|
256
|
+
clearInterval(rotate);
|
257
|
+
// Restart
|
258
|
+
startCycle();
|
259
|
+
}
|
260
|
+
};
|
261
|
+
|
262
|
+
// Pause on hover
|
263
|
+
if (settings.pause) {
|
264
|
+
$this.hover(function () {
|
265
|
+
clearInterval(rotate);
|
266
|
+
}, function () {
|
267
|
+
restartCycle();
|
268
|
+
});
|
269
|
+
}
|
270
|
+
|
271
|
+
// Pager click event handler
|
272
|
+
if (settings.pager || settings.manualControls) {
|
273
|
+
$tabs.bind("click", function (e) {
|
274
|
+
e.preventDefault();
|
275
|
+
|
276
|
+
if (!settings.pauseControls) {
|
277
|
+
restartCycle();
|
278
|
+
}
|
279
|
+
|
280
|
+
// Get index of clicked tab
|
281
|
+
var idx = $tabs.index(this);
|
282
|
+
|
283
|
+
// Break if element is already active or currently animated
|
284
|
+
if (index === idx || $("." + visibleClass).queue('fx').length) {
|
285
|
+
return;
|
286
|
+
}
|
287
|
+
|
288
|
+
// Remove active state from old tab and set new one
|
289
|
+
selectTab(idx);
|
290
|
+
|
291
|
+
// Do the animation
|
292
|
+
slideTo(idx);
|
293
|
+
})
|
294
|
+
.eq(0)
|
295
|
+
.closest("li")
|
296
|
+
.addClass(activeClass);
|
297
|
+
|
298
|
+
// Pause when hovering pager
|
299
|
+
if (settings.pauseControls) {
|
300
|
+
$tabs.hover(function () {
|
301
|
+
clearInterval(rotate);
|
302
|
+
}, function () {
|
303
|
+
restartCycle();
|
304
|
+
});
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
// Navigation
|
309
|
+
if (settings.nav) {
|
310
|
+
var navMarkup =
|
311
|
+
"<a href='#' class='" + navClass + " prev'>" + settings.prevText + "</a>" +
|
312
|
+
"<a href='#' class='" + navClass + " next'>" + settings.nextText + "</a>";
|
313
|
+
|
314
|
+
// Inject navigation
|
315
|
+
if (options.navContainer) {
|
316
|
+
$(settings.navContainer).append(navMarkup);
|
317
|
+
} else {
|
318
|
+
$this.after(navMarkup);
|
319
|
+
}
|
320
|
+
|
321
|
+
var $trigger = $("." + namespaceIdx + "_nav"),
|
322
|
+
$prev = $trigger.filter(".prev");
|
323
|
+
|
324
|
+
// Click event handler
|
325
|
+
$trigger.bind("click", function (e) {
|
326
|
+
e.preventDefault();
|
327
|
+
|
328
|
+
var $visibleClass = $("." + visibleClass);
|
329
|
+
|
330
|
+
// Prevent clicking if currently animated
|
331
|
+
if ($visibleClass.queue('fx').length) {
|
332
|
+
return;
|
333
|
+
}
|
334
|
+
|
335
|
+
// Adds active class during slide animation
|
336
|
+
// $(this)
|
337
|
+
// .addClass(namespace + "_active")
|
338
|
+
// .delay(fadeTime)
|
339
|
+
// .queue(function (next) {
|
340
|
+
// $(this).removeClass(namespace + "_active");
|
341
|
+
// next();
|
342
|
+
// });
|
343
|
+
|
344
|
+
// Determine where to slide
|
345
|
+
var idx = $slide.index($visibleClass),
|
346
|
+
prevIdx = idx - 1,
|
347
|
+
nextIdx = idx + 1 < length ? index + 1 : 0;
|
348
|
+
|
349
|
+
// Go to slide
|
350
|
+
slideTo($(this)[0] === $prev[0] ? prevIdx : nextIdx);
|
351
|
+
if (settings.pager || settings.manualControls) {
|
352
|
+
selectTab($(this)[0] === $prev[0] ? prevIdx : nextIdx);
|
353
|
+
}
|
354
|
+
|
355
|
+
if (!settings.pauseControls) {
|
356
|
+
restartCycle();
|
357
|
+
}
|
358
|
+
});
|
359
|
+
|
360
|
+
// Pause when hovering navigation
|
361
|
+
if (settings.pauseControls) {
|
362
|
+
$trigger.hover(function () {
|
363
|
+
clearInterval(rotate);
|
364
|
+
}, function () {
|
365
|
+
restartCycle();
|
366
|
+
});
|
367
|
+
}
|
368
|
+
}
|
369
|
+
|
370
|
+
}
|
371
|
+
|
372
|
+
// Max-width fallback
|
373
|
+
if (typeof document.body.style.maxWidth === "undefined" && options.maxwidth) {
|
374
|
+
var widthSupport = function () {
|
375
|
+
$this.css("width", "100%");
|
376
|
+
if ($this.width() > maxw) {
|
377
|
+
$this.css("width", maxw);
|
378
|
+
}
|
379
|
+
};
|
380
|
+
|
381
|
+
// Init fallback
|
382
|
+
widthSupport();
|
383
|
+
$(window).bind("resize", function () {
|
384
|
+
widthSupport();
|
385
|
+
});
|
386
|
+
}
|
387
|
+
|
388
|
+
});
|
389
|
+
|
390
|
+
};
|
391
|
+
})(jQuery, this, 0);
|