diff options
| author | root <root@ip-172-31-11-209.us-west-2.compute.internal> | 2019-01-07 21:07:57 +0000 |
|---|---|---|
| committer | root <root@ip-172-31-11-209.us-west-2.compute.internal> | 2019-01-07 21:07:57 +0000 |
| commit | c51c4991e6737e17a1530e9b061d3da22e15ef45 (patch) | |
| tree | 8f53fcb864b16939c354dd72c64f775c13c6fd40 /docs/js | |
| parent | 2c88ea5ef1495128d2b2f9cf12b2860ba663ba83 (diff) | |
Diffstat (limited to 'docs/js')
| -rw-r--r-- | docs/js/lorem.js | 134 | ||||
| -rw-r--r-- | docs/js/okgallery-1.3b.js | 489 | ||||
| -rw-r--r-- | docs/js/wow.js | 184 |
3 files changed, 807 insertions, 0 deletions
diff --git a/docs/js/lorem.js b/docs/js/lorem.js new file mode 100644 index 0000000..b7cb905 --- /dev/null +++ b/docs/js/lorem.js @@ -0,0 +1,134 @@ +var Lorem; +(function() { + + //Create a class named Lorem and constructor + Lorem = function() { + //Default values. + this.type = null; + this.query = null; + this.data = null; + }; + //Static variables + Lorem.IMAGE = 1; + Lorem.TEXT = 2; + Lorem.TYPE = { + PARAGRAPH: 1, + SENTENCE: 2, + WORD: 3 + }; + //Words to create lorem ipsum text. + Lorem.WORDS = [ + "lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit", "ut", "aliquam,", "purus", "sit", "amet", "luctus", "venenatis,", "lectus", "magna", "fringilla", "urna,", "porttitor", "rhoncus", "dolor", "purus", "non", "enim", "praesent", "elementum", "facilisis", "leo,", "vel", "fringilla", "est", "ullamcorper", "eget", "nulla", "facilisi", "etiam", "dignissim", "diam", "quis", "enim", "lobortis", "scelerisque", "fermentum", "dui", "faucibus", "in", "ornare", "quam", "viverra", "orci", "sagittis", "eu", "volutpat", "odio", "facilisis", "mauris", "sit", "amet", "massa", "vitae", "tortor", "condimentum", "lacinia", "quis", "vel", "eros", "donec", "ac", "odio", "tempor", "orci", "dapibus", "ultrices", "in", "iaculis", "nunc", "sed", "augue", "lacus,", "viverra", "vitae", "congue", "eu,", "consequat", "ac", "felis", "donec", "et", "odio", "pellentesque", "diam", "volutpat", "commodo", "sed", "egestas", "egestas", "fringilla", "phasellus", "faucibus", "scelerisque", "eleifend", "donec", "pretium", "vulputate", "sapien", "nec", "sagittis", "aliquam", "malesuada", "bibendum", "arcu", "vitae", "elementum", + "curabitur", "vitae", "nunc", "sed", "velit", "dignissim", "sodales", "ut", "eu", "sem", "integer", "vitae", "justo", "eget", "magna", "fermentum", "iaculis", "eu", "non", "diam", "phasellus", "vestibulum", "lorem", "sed", "risus", "ultricies", "tristique", "nulla", "aliquet", "enim", "tortor,", "at", "auctor", "urna", "nunc", "id", "cursus", "metus", "aliquam", "eleifend", "mi", "in", "nulla", "posuere", "sollicitudin", "aliquam", "ultrices", "sagittis", "orci,", "a", "scelerisque", "purus", "semper", "eget", "duis", "at", "tellus", "at", "urna", "condimentum", "mattis", "pellentesque", "id", "nibh", "tortor,", "id", "aliquet", "lectus", "proin", "nibh", "nisl,", "condimentum", "id", "venenatis", "a,", "condimentum", "vitae", "sapien", "pellentesque", "habitant", "morbi", "tristique", "senectus", "et", "netus", "et", "malesuada", "fames", "ac", "turpis", "egestas", "sed", "tempus,", "urna", "et", "pharetra", "pharetra,", "massa", "massa", "ultricies", "mi,", "quis", "hendrerit", "dolor", "magna", "eget", "est", "lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit", "pellentesque", "habitant", "morbi", "tristique", "senectus", "et", "netus", "et", "malesuada", "fames", "ac", "turpis", "egestas", "integer", "eget", "aliquet", "nibh", "praesent", "tristique", "magna", "sit", "amet", "purus", "gravida", "quis", "blandit", "turpis", "cursus", "in", "hac", "habitasse", "platea", "dictumst", "quisque", "sagittis,", "purus", "sit", "amet", "volutpat", "consequat,", "mauris", "nunc", "congue", "nisi,", "vitae", "suscipit", "tellus", "mauris", "a", "diam", + "maecenas", "sed", "enim", "ut", "sem", "viverra", "aliquet", "eget", "sit", "amet", "tellus", "cras", "adipiscing", "enim", "eu", "turpis", "egestas", "pretium", "aenean", "pharetra,", "magna", "ac", "placerat", "vestibulum,", "lectus", "mauris", "ultrices", "eros,", "in", "cursus", "turpis", "massa", "tincidunt", "dui", "ut", "ornare", "lectus", "sit", "amet", "est", "placerat", "in", "egestas", "erat", "imperdiet", "sed", "euismod", "nisi", "porta", "lorem", "mollis", "aliquam", "ut", "porttitor", "leo", "a", "diam", "sollicitudin", "tempor", "id", "eu", "nisl", "nunc", "mi", "ipsum,", "faucibus", "vitae", "aliquet", "nec,", "ullamcorper", "sit", "amet", "risus", "nullam", "eget", "felis", "eget", "nunc", "lobortis", "mattis", "aliquam", "faucibus", "purus", "in", "massa", "tempor", "nec", "feugiat", "nisl", "pretium", "fusce", "id", "velit", "ut", "tortor", "pretium", "viverra", "suspendisse", "potenti", "nullam", "ac", "tortor", "vitae", "purus", "faucibus", "ornare", "suspendisse", "sed", "nisi", "lacus,", "sed", "viverra", "tellus", "in", "hac", "habitasse", "platea", "dictumst", "vestibulum", "rhoncus", "est", "pellentesque", "elit", "ullamcorper", "dignissim", "cras", "tincidunt", "lobortis", "feugiat", "vivamus", "at", "augue", "eget", "arcu", "dictum", "varius", "duis", "at", "consectetur", "lorem", + "donec", "massa", "sapien,", "faucibus", "et", "molestie", "ac,", "feugiat", "sed", "lectus", "vestibulum", "mattis", "ullamcorper", "velit", "sed", "ullamcorper", "morbi", "tincidunt", "ornare", "massa,", "eget", "egestas", "purus", "viverra", "accumsan", "in", "nisl", "nisi,", "scelerisque", "eu", "ultrices", "vitae,", "auctor", "eu", "augue", "ut", "lectus", "arcu,", "bibendum", "at", "varius", "vel,", "pharetra", "vel", "turpis", "nunc", "eget", "lorem", "dolor,", "sed", "viverra", "ipsum", "nunc", "aliquet", "bibendum", "enim,", "facilisis", "gravida", "neque", "convallis", "a", "cras", "semper", "auctor", "neque,", "vitae", "tempus", "quam", "pellentesque", "nec", "nam", "aliquam", "sem", "et", "tortor", "consequat", "id", "porta", "nibh", "venenatis", "cras", "sed", "felis", "eget", "velit", "aliquet", "sagittis", "id", "consectetur", "purus", "ut", "faucibus", "pulvinar", "elementum", "integer", "enim", "neque,", "volutpat", "ac", "tincidunt", "vitae,", "semper", "quis", "lectus", "nulla", "at", "volutpat", "diam", "ut", "venenatis", "tellus", "in", "metus", "vulputate", "eu", "scelerisque", "felis", "imperdiet", "proin", "fermentum", "leo", "vel", "orci", "porta", "non", "pulvinar", "neque", "laoreet", "suspendisse", "interdum", "consectetur", "libero,", "id", "faucibus", "nisl", "tincidunt", "eget", "nullam", "non", "nisi", "est,", "sit", "amet", "facilisis", "magna", + "etiam", "tempor,", "orci", "eu", "lobortis", "elementum,", "nibh", "tellus", "molestie", "nunc,", "non", "blandit", "massa", "enim", "nec", "dui", "nunc", "mattis", "enim", "ut", "tellus", "elementum", "sagittis", "vitae", "et", "leo", "duis", "ut", "diam", "quam", "nulla", "porttitor", "massa", "id", "neque", "aliquam", "vestibulum", "morbi", "blandit", "cursus", "risus,", "at", "ultrices", "mi", "tempus", "imperdiet", "nulla", "malesuada", "pellentesque", "elit", "eget", "gravida", "cum", "sociis", "natoque", "penatibus", "et", "magnis", "dis", "parturient", "montes,", "nascetur", "ridiculus", "mus", "mauris", "vitae", "ultricies", "leo", "integer", "malesuada", "nunc", "vel", "risus", "commodo", "viverra", "maecenas", "accumsan,", "lacus", "vel", "facilisis", "volutpat,", "est", "velit", "egestas", "dui,", "id", "ornare", "arcu", "odio", "ut", "sem", "nulla", "pharetra", "diam", "sit", "amet", "nisl", "suscipit", "adipiscing", "bibendum", "est", "ultricies", "integer", "quis", "auctor", "elit", + "sed", "vulputate", "mi", "sit", "amet", "mauris", "commodo", "quis", "imperdiet", "massa", "tincidunt", "nunc", "pulvinar", "sapien", "et", "ligula", "ullamcorper", "malesuada", "proin", "libero", "nunc,", "consequat", "interdum", "varius", "sit", "amet,", "mattis", "vulputate", "enim", "nulla", "aliquet", "porttitor", "lacus,", "luctus", "accumsan", "tortor", "posuere", "ac", "ut", "consequat", "semper", "viverra", "nam", "libero", "justo,", "laoreet", "sit", "amet", "cursus", "sit", "amet,", "dictum", "sit", "amet", "justo", "donec", "enim", "diam,", "vulputate", "ut", "pharetra", "sit", "amet,", "aliquam", "id", "diam", "maecenas", "ultricies", "mi", "eget", "mauris", "pharetra", "et", "ultrices", "neque", "ornare", "aenean", "euismod", "elementum", "nisi,", "quis", "eleifend", "quam", "adipiscing", "vitae", "proin", "sagittis,", "nisl", "rhoncus", "mattis", "rhoncus,", "urna", "neque", "viverra", "justo,", "nec", "ultrices", "dui", "sapien", "eget", "mi", "proin", "sed", "libero", "enim,", "sed", "faucibus", "turpis", "in", "eu", "mi", "bibendum", "neque", "egestas", "congue", "quisque", "egestas", "diam", "in", "arcu", "cursus", "euismod", "quis", "viverra", "nibh", "cras", "pulvinar", "mattis", "nunc,", "sed", "blandit", "libero", "volutpat", "sed", "cras", "ornare", "arcu", "dui", "vivamus", "arcu", "felis,", "bibendum", "ut", "tristique", "et,", "egestas", "quis", "ipsum", "suspendisse", "ultrices", "gravida", "dictum", + "fusce", "ut", "placerat", "orci", "nulla", "pellentesque", "dignissim", "enim,", "sit", "amet", "venenatis", "urna", "cursus", "eget", "nunc", "scelerisque", "viverra", "mauris,", "in", "aliquam", "sem", "fringilla", "ut", "morbi", "tincidunt", "augue", "interdum", "velit", "euismod", "in", "pellentesque", "massa", "placerat", "duis", "ultricies", "lacus", "sed", "turpis", "tincidunt", "id", "aliquet", "risus", "feugiat", "in", "ante", "metus,", "dictum", "at", "tempor", "commodo,", "ullamcorper", "a", "lacus", "vestibulum", "sed", "arcu", "non", "odio", "euismod", "lacinia", "at", "quis", "risus", "sed", "vulputate", "odio", "ut", "enim", "blandit", "volutpat", "maecenas", "volutpat", "blandit", "aliquam", "etiam", "erat", "velit,", "scelerisque", "in", "dictum", "non,", "consectetur", "a", "erat", "nam", "at", "lectus", "urna", "duis", "convallis", "convallis", "tellus,", "id", "interdum", "velit", "laoreet", "id", "donec", "ultrices", "tincidunt", "arcu,", "non", "sodales", "neque", "sodales", "ut", "etiam", "sit", "amet", "nisl", "purus,", "in", "mollis", "nunc", + "sed", "id", "semper", "risus", "in", "hendrerit", "gravida", "rutrum", "quisque", "non", "tellus", "orci,", "ac", "auctor", "augue", "mauris", "augue", "neque,", "gravida", "in", "fermentum", "et,", "sollicitudin", "ac", "orci", "phasellus", "egestas", "tellus", "rutrum", "tellus", "pellentesque", "eu", "tincidunt", "tortor", "aliquam", "nulla", "facilisi", "cras", "fermentum,", "odio", "eu", "feugiat", "pretium,", "nibh", "ipsum", "consequat", "nisl,", "vel", "pretium", "lectus", "quam", "id", "leo", "in", "vitae", "turpis", "massa", "sed", "elementum", "tempus", "egestas", "sed", "sed", "risus", "pretium", "quam", "vulputate", "dignissim", "suspendisse", "in", "est", "ante", "in", "nibh", "mauris,", "cursus", "mattis", "molestie", "a,", "iaculis", "at", "erat", + "pellentesque", "adipiscing", "commodo", "elit,", "at", "imperdiet", "dui", "accumsan", "sit", "amet", "nulla", "facilisi", "morbi", "tempus", "iaculis", "urna,", "id", "volutpat", "lacus", "laoreet", "non", "curabitur", "gravida", "arcu", "ac", "tortor", "dignissim", "convallis", "aenean", "et", "tortor", "at", "risus", "viverra", "adipiscing", "at", "in", "tellus", "integer", "feugiat", "scelerisque", "varius", "morbi", "enim", "nunc,", "faucibus", "a", "pellentesque", "sit", "amet,", "porttitor", "eget", "dolor", "morbi", "non", "arcu", "risus,", "quis", "varius", "quam", "quisque", "id", "diam", "vel", "quam", "elementum", "pulvinar", "etiam", "non", "quam", "lacus", "suspendisse", "faucibus", "interdum", "posuere", "lorem", "ipsum", "dolor", "sit", "amet,", "consectetur", "adipiscing", "elit", "duis", "tristique", "sollicitudin", "nibh", "sit", "amet", "commodo", "nulla", "facilisi", + "nullam", "vehicula", "ipsum", "a", "arcu", "cursus", "vitae", "congue", "mauris", "rhoncus", "aenean", "vel", "elit", "scelerisque", "mauris", "pellentesque", "pulvinar", "pellentesque", "habitant", "morbi", "tristique", "senectus", "et", "netus", "et", "malesuada", "fames", "ac", "turpis", "egestas", "maecenas", "pharetra", "convallis", "posuere", "morbi", "leo", "urna,", "molestie", "at", "elementum", "eu,", "facilisis", "sed", "odio", "morbi", "quis", "commodo", "odio", "aenean", "sed", "adipiscing", "diam", "donec", "adipiscing", "tristique", "risus", "nec", "feugiat", "in", "fermentum", "posuere", "urna", "nec", "tincidunt", "praesent", "semper", "feugiat", "nibh", "sed", "pulvinar", "proin", "gravida", "hendrerit", "lectus", "a", "molestie" + ]; + //random integer method. + Lorem.prototype.randomInt = function (min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; + }; + //text creator method with parameters: how many, what + Lorem.prototype.createText = function(count, type) { + switch (type) { + //paragraphs are loads of sentences. + case Lorem.TYPE.PARAGRAPH: + var paragraphs = new Array; + for (var i = 0; i < count; i++) { + var paragraphLength = this.randomInt(10, 20); + var paragraph = this.createText(paragraphLength, Lorem.TYPE.SENTENCE); + paragraphs.push(paragraph); + } + return paragraphs.join('\n'); + break; + //sentences are loads of words. + case Lorem.TYPE.SENTENCE: + var sentences = new Array; + for (var i = 0; i < count; i++) { + var sentenceLength = this.randomInt(5, 10); + var words = this.createText(sentenceLength, Lorem.TYPE.WORD).split(' '); + words[0] = words[0].substr(0, 1).toUpperCase() + words[0].substr(1); + var sentence = words.join(' '); + + sentences.push(sentence); + } + return (sentences.join('. ') + '.').replace(/(\.\,|\,\.)/g, '.'); + break; + //words are words + case Lorem.TYPE.WORD: + var wordIndex = this.randomInt(0, Lorem.WORDS.length - count - 1); + + return Lorem.WORDS.slice(wordIndex, wordIndex + count).join(' ').replace(/\.|\,/g, ''); + break; + } + }; + Lorem.prototype.createLorem = function(element) { + + var lorem = new Array; + var count = parseInt(this.query); + + if (/\d+p/.test(this.query)) { + var type = Lorem.TYPE.PARAGRAPH; + } + else if (/\d+s/.test(this.query)) { + var type = Lorem.TYPE.SENTENCE; + } + else if (/\d+w/.test(this.query)) { + var type = Lorem.TYPE.WORD; + } + + lorem.push(this.createText(count, type)); + lorem = lorem.join(' '); + + if (element) { + if (this.type == Lorem.TEXT) + element.innerHTML += lorem; + else if (this.type == Lorem.IMAGE) { + //TODO: for now, using lorempixum. + var path = ''; + var options = this.query.split(' '); + if (options[0] == 'gray') { + path += '/g'; + options[0] = ''; + } + if (element.getAttribute('width')) + path += '/' + element.getAttribute('width'); + + if (element.getAttribute('height')) + path += '/' + element.getAttribute('height'); + + path += '/' + options.join(' ').replace(/(^\s+|\s+$)/, ''); + element.src = 'http://lorempixum.com'+path.replace(/\/\//, '/'); + } + } + + if (element == null) + return lorem; + }; + + //Register as jQuery + if (typeof jQuery != 'undefined') { + (function($) { + $.fn.lorem = function() { + $(this).each(function() { + var lorem = new Lorem; + lorem.type = $(this).is('img') ? Lorem.IMAGE : Lorem.TEXT; + //data-lorem can be taken with data function (thanks to http://forrst.com/people/webking) + lorem.query = $(this).data('lorem'); + lorem.createLorem(this); + }) + }; + + //If developer run this javascript, then we can run the lorem.js + $(document).ready(function() { + $('[data-lorem]').lorem(); + }); + })(jQuery); + } + +})();
\ No newline at end of file diff --git a/docs/js/okgallery-1.3b.js b/docs/js/okgallery-1.3b.js new file mode 100644 index 0000000..700f6a3 --- /dev/null +++ b/docs/js/okgallery-1.3b.js @@ -0,0 +1,489 @@ +/* + * OKGallery by OKFocus - http://okfoc.us - @okfocus + * Version 1.2 + * Licensed under MIT. + * + */ + +(function($){ + "use strict"; + var hasCssTransitions; + + $.okgallery = function(el, options){ + var base = this; + base.$el = $(el); + base.el = el; + // Don't load OKGallery twice on an element + if (base.$el.data("okgallery")) { + return; + } + base.$el.data("okgallery", base); + base.$children = base.$el.children("div"); + + var current = -1; + + base.init = function(){ + base.options = $.extend({}, $.okgallery.options, options); + base.build(); + }; + + base.build = function(){ + if (base.options.width != null && + base.options.height != null && + base.options.height > 0) { + base.options.aspect = base.options.width / base.options.height; + } + if (base.options.useTransitions) { + base.$children.css("opacity", 0); + } + else { + base.$children.first().addClass('present'); + base.$children.not(':first-child').addClass('future'); + } + + base.resize(); + + base.buildCss(); + base.buildDots(); + base.bindArrows(); + + // defer this so the wrapper does not slide open + setTimeout(base.buildTransitions); + if (base.options.autoplayOnHover) { + base.$el.hover(function(){ + base.autoplayOn(); + base.autoplayTimeout = setTimeout(base.next, 750); + }, function(){ + base.autoplayOff(); + base.first(); + }); + } else { + base.$el.bind("click", base.clickNext); + } + $(window).resize(base.debounceResize); + base.start(); + }; + + base.bindArrows = function(){ + if (base.options.prevSelector != null) { + $(base.options.prevSelector).click(base.clickPrev); + } + if (base.options.nextSelector != null) { + $(base.options.nextSelector).click(base.clickNext); + } + if (base.options.useKeyboard) { + $(window).keydown(function(e){ + if (e.keyCode == 37) { + base.prev(); + } else if (e.keyCode == 39) { + base.next(); + } + }); + } + }; + + base.buildCss = function(){ + base.$el.css({ + 'width': "100%", + 'position': 'relative', + 'overflow': 'hidden', + 'cursor': 'pointer', + 'WebkitUserSelect': 'none', + 'MozUserSelect': 'none', + 'MsUserSelect': 'none', + 'OUserSelect': 'none', + 'userSelect': 'none' + }); + + base.$children.css({ + 'position': "absolute", + 'top': 0, + 'left': 0, + 'width': "100%", + 'height': "100%", + 'backgroundSize': base.options.backgroundSize, + 'backgroundPosition': base.options.backgroundPosition, + 'backgroundRepeat': base.options.backgroundRepeat, + 'WebkitUserSelect': 'none', + 'MozUserSelect': 'none', + 'MsUserSelect': 'none', + 'OUserSelect': 'none', + 'userSelect': 'none' + }); + if (base.options.aspect == "fullscreen") { + base.$el.css({ + 'height': "100%", + 'position': "fixed", + 'top': "0", + 'left': "0" + }); + $("html,body").css({ + 'width': '100%', + 'height': '100%', + 'margin': 0, + 'overflow-x': 'hidden' + }); + } + if (base.options.aspect == false) { + base.$el.css({ + width: '' + }); + } + if (base.options.center) { + + // must do this in two steps + base.$children.css({ + width: '', + height: '', + left: '50%', + top: '50%' + }); + + base.$children.each(function(){ + $(this).css({ + 'margin-left': $(this).width()/-2, + 'margin-top': $(this).height()/-2, + }); + }); + } + } + + base.buildTransitions = function(){ + if (! hasCssTransitions) return; + if (! base.options.useTransitions) return; + + var transition = {}; + transition[hasCssTransitions + "Property"] = "all"; // "width, height, top, left"; + transition[hasCssTransitions + "Duration"] = (base.options.resizeTime/1000) + "s"; + base.$el.css(transition); + + var fadeTransition = {}; + fadeTransition[hasCssTransitions + "Property"] = "opacity"; // or "all" + fadeTransition[hasCssTransitions + "Duration"] = (base.options.fadeTime/1000) + "s"; + fadeTransition[hasCssTransitions + "TimingFunction"] = base.options.fadeTimingFunction; + + base.$children.css(fadeTransition); + }; + + base.buildDots = function(){ + if (! base.options.dots) return; + var width = px(base.options.dotWidth); + var margin = px(base.options.dotMargin); + var shadow = "0 0 "; + shadow += px(base.options.dotShadowWidth); + shadow += " " + base.options.dotShadowColor; + + base.$dotParent = $("<div/>").addClass("dots").css({ + "width": "100%", + "paddingTop": base.options.dotContainerPadding, + "paddingBottom": base.options.dotContainerPadding, + "textAlign": "center", + 'WebkitUserSelect': 'none', + 'MozUserSelect': 'none', + 'MsUserSelect': 'none', + 'OUserSelect': 'none', + 'userSelect': 'none' + }); + + base.$children.each(function(index){ + var $dot = $("<a/>"); + $dot.data("index", index) + $dot.click(base.clickDot); + + if (base.options.dotClass) { + $dot.addClass(base.options.dotClass); + } else { + $dot.addClass("dot").css({ + "cursor": "pointer", + "display": "inline-block", + "margin": margin, + "backgroundColor": base.options.dotColor, + "width": width, + "height": width, + "borderRadius": width, + "WebkitBorderRadius": width, + "MozBorderRadius": width, + "MsBorderRadius": width, + "OBorderRadius": width, + "boxShadow": shadow, + "WebkitBoxShadow": shadow, + "MozBoxShadow": shadow, + "MsBoxShadow": shadow, + "OBoxShadow": shadow + }); + } + base.$dotParent.append($dot); + }); + + if (base.options.dotsInside) { + base.$el.append(base.$dotParent); + base.$dotParent.css({ + 'position': 'absolute', + 'bottom': 0, + 'left': 0, + 'zIndex': 1 + }); + } else { + base.$dotParent.insertAfter(base.$el); + } + + base.$dots = base.$dotParent.children(); + }; + + base.start = function(){ + base.next(); + }; + + base.rand = function(n,a) { + var m = n; + while (m == n) { + m = Math.floor(Math.random() * a); + } + return m; + }; + + base.clickDot = function(e){ + e.preventDefault(); + e.stopPropagation(); + var index = $(this).data("index"); + base.show(index, 1); + return false; + }; + + base.autoplayOn = function(){ + base.options.autoplay = true; + }; + base.autoplayOff = function(){ + if (base.autoplayTimeout) clearTimeout(base.autoplayTimeout); + base.options.autoplay = false; + }; + + base.clickPrev = function(){ + if (base.options.clickDisablesAutoplay) { + base.options.autoplay = false; + clearTimeout(base.autoplayTimeout); + } + if (base.options.clickDisablesRandom) { + base.options.random = false; + } + base.prev(); + }; + + base.clickNext = function(){ + if (base.options.clickDisablesAutoplay) { + base.options.autoplay = false; + clearTimeout(base.autoplayTimeout); + } + if (base.options.clickDisablesRandom) { + base.options.random = false; + } + base.next(); + }; + + base.first = function(){ + if (base.options.random) { + base.show( base.rand(current, base.$children.length), 1 ); + } else { + base.show( 0, 1 ); + } + }; + + base.next = function(){ + if (base.options.random) { + base.show( base.rand(current, base.$children.length), 1 ); + } else { + base.show( current + 1, 1 ); + } + }; + + base.prev = function(){ + base.show( current - 1, -1 ); + }; + + base.show = function(index, direction){ + index = (index + base.$children.length) % base.$children.length; + + if (index != current) { + if (base.options.useTransitions) { + base.showTransition(index, direction) + } + else { + base.showClass(index, direction) + } + } + + if (base.options.dots) { + if (base.options.dotActiveClass) { + base.$dots.removeClass(base.options.dotActiveClass); + base.$dots.eq(index).addClass(base.options.dotActiveClass); + } else { + base.$dots.css("background-color", base.options.dotColor); + base.$dots.eq(index).css("background-color", base.options.dotActiveColor); + } + } + current = index; + } + + base.showClass = function(index, direction) { + var $index = base.$children.eq(index); + var $current = base.$children.eq(current); + var $next = base.$children.eq( (index + base.$children.length + direction) % base.$children.length); + var $prev = base.$children.eq( (index + base.$children.length - direction) % base.$children.length); + var is_first = index == 0; + var is_last = base.$children.last().is($index); + + // next + if (direction == 1) { + // console.log(">>>>> NEXT") +// console.log("current = " + current) +// console.log("index = " + index) +// console.log("next = " + (index + base.$children.length + direction) % base.$children.length ) + $current.removeClass("present").css("z-index", "-1"); + $index.removeClass("future past").addClass("present").css("z-index", "auto"); + $next.hide().addClass("future").removeClass("past"); + setTimeout(function(){ + $next.show() + }, 100) + + setTimeout(function(){ + $current.hide().removeClass("future").addClass("past").css("z-index", "auto") + setTimeout(function(){ + $current.show() + }, 300) + }, 700) + } + + // prev + else { + // console.log(">>>>> PREV") +// console.log("current = " + current) +// console.log("index = " + index) +// console.log("next = " + (index + base.$children.length + direction) % base.$children.length ) + $current.removeClass("present").css("z-index", "-1"); + $index.removeClass("past future").addClass("present").css("z-index", "auto"); + $next.hide().addClass("past").removeClass("future"); + setTimeout(function(){ + $next.show() + }, 100) + + setTimeout(function(){ + $current.hide().removeClass("past").addClass("future").css("z-index", "auto") + setTimeout(function(){ + $current.show() + }, 300) + }, 700) + } + + setTimeout(function(){ + if (base.options.autoplay) { + if (base.autoplayTimeout) clearTimeout(base.autoplayTimeout); + base.autoplayTimeout = setTimeout(base.next, base.options.fadeTime + base.options.delayTime); + } + }, base.options.fadePauseTime); + + if (base.options.onchange) { + base.options.onchange(index) + } + } + + base.showTransition = function(index, direction) { + if (current > -1) { + var $current = base.$children.eq(current); + $current.css("z-index", 0).css("opacity", 0); + setTimeout(function(){ + $current.hide(); + }, base.options.fadeTime * 1.5); + } + + var $index = base.$children.eq(index); + $index.css("opacity", 0).show(); + $index.css("z-index", 1); + setTimeout(function(){ + $index.css("opacity", 1); + + if (base.options.autoplay) { + if (base.autoplayTimeout) clearTimeout(base.autoplayTimeout); + base.autoplayTimeout = setTimeout(base.next, base.options.fadeTime + base.options.delayTime); + } + + }, base.options.fadePauseTime); + }; + + base.autoplayTimeout = null; + base.debounceTimeout = null; + base.debounceResize = function(){ + if (base.debounceTimeout) clearTimeout(base.debounceTimeout); + base.debounceTimeout = setTimeout(base.resize, 100); + }; + + base.resize = function(){ + if (base.options.aspect == "fullscreen") return; + if (base.options.aspect == false) return; + base.el.style.height = Math.floor(base.$el.width() / base.options.aspect) + "px"; + }; + + base.init(); + }; + + hasCssTransitions = (function(){ + var div = document.createElement("div"); + var p, ext, pre = ["msTransition", "OTransition", "WebkitTransition", "MozTransition", "transition"]; + for (p in pre) { + if (div.style[ pre[p] ] !== undefined) { + ext = pre[p]; + break; + } + } + return ext; + })(); + + function px (n) { + if (n.toString().indexOf("px") == -1) + return n + "px"; + return n; + } + + $.okgallery.options = { + 'aspect': 16/9, + 'center': false, + 'width': null, + 'height': null, + 'random': false, + 'autoplay': false, + 'autoplayOnHover': false, + 'prevSelector': null, + 'nextSelector': null, + 'clickDisablesRandom': true, + 'clickDisablesAutoplay': true, + 'resizeTime': 200, + 'delayTime': 2000, + 'fadeTime': 700, + 'fadePauseTime': 0, + 'fadeTimingFunction': "ease", + 'backgroundSize': "cover", + 'backgroundPosition': "center center", + 'backgroundRepeat': "no-repeat", + 'dots': true, + 'dotsInside': false, + 'dotClass': null, + 'dotActiveClass': null, + 'dotWidth': 14, + 'dotMargin': 4, + 'dotContainerPadding': 10, + 'dotColor': "#eee", + 'dotShadowColor': "#888", + 'dotShadowWidth': 2, + 'dotActiveColor': "yellow", + 'useKeyboard': false, + 'useTransitions': true, + 'images': null, + 'onchange': function(index){} + }; + + $.fn.okgallery = function(options){ + return this.each(function(){ + (new $.okgallery(this, options)); + }); + }; + +})(jQuery);
\ No newline at end of file diff --git a/docs/js/wow.js b/docs/js/wow.js new file mode 100644 index 0000000..cc0b8bb --- /dev/null +++ b/docs/js/wow.js @@ -0,0 +1,184 @@ +(function() { + var Util, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + + Util = (function() { + function Util() {} + + Util.prototype.extend = function(custom, defaults) { + var key, value; + for (key in custom) { + value = custom[key]; + if (value != null) { + defaults[key] = value; + } + } + return defaults; + }; + + Util.prototype.isMobile = function(agent) { + return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent); + }; + + return Util; + + })(); + + this.WOW = (function() { + WOW.prototype.defaults = { + boxClass: 'wow', + animateClass: 'animated', + offset: 0, + mobile: true + }; + + function WOW(options) { + if (options == null) { + options = {}; + } + this.scrollCallback = __bind(this.scrollCallback, this); + this.scrollHandler = __bind(this.scrollHandler, this); + this.start = __bind(this.start, this); + this.scrolled = true; + this.config = this.util().extend(options, this.defaults); + } + + WOW.prototype.init = function() { + var _ref; + this.element = window.document.documentElement; + if ((_ref = document.readyState) === "interactive" || _ref === "complete") { + return this.start(); + } else { + return document.addEventListener('DOMContentLoaded', this.start); + } + }; + + WOW.prototype.start = function() { + var box, _i, _len, _ref; + this.boxes = this.element.getElementsByClassName(this.config.boxClass); + if (this.boxes.length) { + if (this.disabled()) { + return this.resetStyle(); + } else { + _ref = this.boxes; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + box = _ref[_i]; + this.applyStyle(box, true); + } + window.addEventListener('scroll', this.scrollHandler, false); + window.addEventListener('resize', this.scrollHandler, false); + return this.interval = setInterval(this.scrollCallback, 50); + } + } + }; + + WOW.prototype.stop = function() { + window.removeEventListener('scroll', this.scrollHandler, false); + window.removeEventListener('resize', this.scrollHandler, false); + if (this.interval != null) { + return clearInterval(this.interval); + } + }; + + WOW.prototype.show = function(box) { + this.applyStyle(box); + return box.className = "" + box.className + " " + this.config.animateClass; + }; + + WOW.prototype.applyStyle = function(box, hidden) { + var delay, duration, iteration; + duration = box.getAttribute('data-wow-duration'); + delay = box.getAttribute('data-wow-delay'); + iteration = box.getAttribute('data-wow-iteration'); + return box.setAttribute('style', this.customStyle(hidden, duration, delay, iteration)); + }; + + WOW.prototype.resetStyle = function() { + var box, _i, _len, _ref, _results; + _ref = this.boxes; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + box = _ref[_i]; + _results.push(box.setAttribute('style', 'visibility: visible;')); + } + return _results; + }; + + WOW.prototype.customStyle = function(hidden, duration, delay, iteration) { + var style; + style = hidden ? "visibility: hidden; -webkit-animation-name: none; -moz-animation-name: none; animation-name: none;" : "visibility: visible;"; + if (duration) { + style += "-webkit-animation-duration: " + duration + "; -moz-animation-duration: " + duration + "; animation-duration: " + duration + ";"; + } + if (delay) { + style += "-webkit-animation-delay: " + delay + "; -moz-animation-delay: " + delay + "; animation-delay: " + delay + ";"; + } + if (iteration) { + style += "-webkit-animation-iteration-count: " + iteration + "; -moz-animation-iteration-count: " + iteration + "; animation-iteration-count: " + iteration + ";"; + } + return style; + }; + + WOW.prototype.scrollHandler = function() { + return this.scrolled = true; + }; + + WOW.prototype.scrollCallback = function() { + var box; + if (this.scrolled) { + this.scrolled = false; + this.boxes = (function() { + var _i, _len, _ref, _results; + _ref = this.boxes; + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + box = _ref[_i]; + if (!(box)) { + continue; + } + if (this.isVisible(box)) { + this.show(box); + continue; + } + _results.push(box); + } + return _results; + }).call(this); + if (!this.boxes.length) { + return this.stop(); + } + } + }; + + WOW.prototype.offsetTop = function(element) { + var top; + top = element.offsetTop; + while (element = element.offsetParent) { + top += element.offsetTop; + } + return top; + }; + + WOW.prototype.isVisible = function(box) { + var bottom, offset, top, viewBottom, viewTop; + offset = box.getAttribute('data-wow-offset') || this.config.offset; + viewTop = window.pageYOffset; + viewBottom = viewTop + this.element.clientHeight - offset; + top = this.offsetTop(box); + bottom = top + box.clientHeight; + return top <= viewBottom && bottom >= viewTop; + }; + + WOW.prototype.util = function() { + return this._util || (this._util = new Util()); + }; + + WOW.prototype.disabled = function() { + return !this.config.mobile && this.util().isMobile(navigator.userAgent); + }; + + return WOW; + + })(); + +}).call(this); |
