| @@ -0,0 +1,389 @@ | ||
| <!doctype html> | ||
| <html class="theme-next use-motion "> | ||
| <head> | ||
|
|
||
|
|
||
| <meta charset="UTF-8"/> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/> | ||
|
|
||
|
|
||
| <meta http-equiv="Cache-Control" content="no-transform" /> | ||
| <meta http-equiv="Cache-Control" content="no-siteapp" /> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| <link rel="stylesheet" type="text/css" href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5"/> | ||
|
|
||
|
|
||
|
|
||
| <link href='//fonts.googleapis.com/css?family=Lato:300,400,700,400italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'> | ||
|
|
||
|
|
||
| <link rel="stylesheet" type="text/css" href="/css/main.css?v=0.4.5.1"/> | ||
|
|
||
|
|
||
| <meta name="description" content="海月の虚空に秋凉し时鸟" /> | ||
|
|
||
|
|
||
|
|
||
| <meta name="keywords" content="Hexo,next" /> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| <link rel="shorticon icon" type="image/x-icon" href="/favicon.ico?v=0.4.5.1" /> | ||
|
|
||
|
|
||
| <meta name="description" content="海月の虚空に秋凉し时鸟"> | ||
| <meta property="og:type" content="website"> | ||
| <meta property="og:title" content="夏影"> | ||
| <meta property="og:url" content="http://dangger.github.io/index.html"> | ||
| <meta property="og:site_name" content="夏影"> | ||
| <meta property="og:description" content="海月の虚空に秋凉し时鸟"> | ||
| <meta name="twitter:card" content="summary"> | ||
| <meta name="twitter:title" content="夏影"> | ||
| <meta name="twitter:description" content="海月の虚空に秋凉し时鸟"> | ||
|
|
||
|
|
||
| <script type="text/javascript" id="hexo.configuration"> | ||
| var CONFIG = { | ||
| scheme: '', | ||
| sidebar: 'post' | ||
| }; | ||
| </script> | ||
|
|
||
| <title> 夏影 </title> | ||
| </head> | ||
|
|
||
| <body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN"> | ||
|
|
||
| <!--[if lte IE 8]> | ||
| <div style=' clear: both; height: 59px; padding:0 0 0 15px; position: relative;margin:0 auto;'> | ||
| <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode"> | ||
| <img src="http://7u2nvr.com1.z0.glb.clouddn.com/picouterie.jpg" border="0" height="42" width="820" | ||
| alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today or use other browser ,like chrome firefox safari." | ||
| style='margin-left:auto;margin-right:auto;display: block;'/> | ||
| </a> | ||
| </div> | ||
| <![endif]--> | ||
|
|
||
|
|
||
|
|
||
|
|
||
| <div class="container one-column | ||
| page-home | ||
| "> | ||
| <div class="headband"></div> | ||
|
|
||
| <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader"> | ||
| <div class="header-inner"><h1 class="site-meta"> | ||
| <span class="logo-line-before"><i></i></span> | ||
| <a href="/" class="brand" rel="start"> | ||
| <span class="logo"> | ||
| <i class="icon-next-logo"></i> | ||
| </span> | ||
| <span class="site-title">夏影</span> | ||
| </a> | ||
| <span class="logo-line-after"><i></i></span> | ||
| </h1> | ||
|
|
||
| <div class="site-nav-toggle"> | ||
| <button> | ||
| <span class="btn-bar"></span> | ||
| <span class="btn-bar"></span> | ||
| <span class="btn-bar"></span> | ||
| </button> | ||
| </div> | ||
|
|
||
| <nav class="site-nav"> | ||
|
|
||
|
|
||
|
|
||
| <ul id="menu" class="menu "> | ||
|
|
||
|
|
||
| <li class="menu-item menu-item-home"> | ||
| <a href="/" rel="section"> | ||
| <i class="menu-item-icon icon-next-home"></i> <br /> | ||
| 首頁 | ||
| </a> | ||
| </li> | ||
|
|
||
|
|
||
| <li class="menu-item menu-item-archives"> | ||
| <a href="/archives" rel="section"> | ||
| <i class="menu-item-icon icon-next-archives"></i> <br /> | ||
| 歸檔 | ||
| </a> | ||
| </li> | ||
|
|
||
|
|
||
| <li class="menu-item menu-item-tags"> | ||
| <a href="/tags" rel="section"> | ||
| <i class="menu-item-icon icon-next-tags"></i> <br /> | ||
| 標籤 | ||
| </a> | ||
| </li> | ||
|
|
||
|
|
||
|
|
||
|
|
||
| </ul> | ||
|
|
||
|
|
||
|
|
||
| </nav> | ||
|
|
||
| </div> | ||
| </header> | ||
|
|
||
| <main id="main" class="main"> | ||
| <div class="main-inner"> | ||
| <div id="content" class="content"> | ||
| <section id="posts" class="posts-expand"> | ||
|
|
||
|
|
||
|
|
||
| <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article"> | ||
| <header class="post-header"> | ||
|
|
||
|
|
||
|
|
||
| <h1 class="post-title" itemprop="name headline"> | ||
|
|
||
|
|
||
|
|
||
| <a class="post-title-link" href="/2015/09/11/hello-world/" itemprop="url"> | ||
| Hello World | ||
| </a> | ||
|
|
||
|
|
||
| </h1> | ||
|
|
||
|
|
||
| <div class="post-meta"> | ||
| <span class="post-time"> | ||
| 發表於 | ||
| <time itemprop="dateCreated" datetime="2015-09-11T19:27:39+08:00" content="2015-09-11"> | ||
| 2015-09-11 | ||
| </time> | ||
| </span> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| </div> | ||
| </header> | ||
|
|
||
| <div class="post-body"> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| <span itemprop="articleBody"><p>Welcome to <a href="http://hexo.io/" target="_blank" rel="external">Hexo</a>! This is your very first post. Check <a href="http://hexo.io/docs/" target="_blank" rel="external">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="http://hexo.io/docs/troubleshooting.html" target="_blank" rel="external">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues" target="_blank" rel="external">GitHub</a>.</p> | ||
| <h2 id="Quick_Start">Quick Start</h2><h3 id="Create_a_new_post">Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo new <span class="string">"My New Post"</span></span><br></pre></td></tr></table></figure> | ||
| <p>More info: <a href="http://hexo.io/docs/writing.html" target="_blank" rel="external">Writing</a></p> | ||
| <h3 id="Run_server">Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure> | ||
| <p>More info: <a href="http://hexo.io/docs/server.html" target="_blank" rel="external">Server</a></p> | ||
| <h3 id="Generate_static_files">Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure> | ||
| <p>More info: <a href="http://hexo.io/docs/generating.html" target="_blank" rel="external">Generating</a></p> | ||
| <h3 id="Deploy_to_remote_sites">Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure> | ||
| <p>More info: <a href="http://hexo.io/docs/deployment.html" target="_blank" rel="external">Deployment</a></p> | ||
| </span> | ||
|
|
||
|
|
||
| </div> | ||
|
|
||
| <footer class="post-footer"> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| <div class="post-eof"></div> | ||
|
|
||
| </footer> | ||
| </article> | ||
|
|
||
|
|
||
|
|
||
| </section> | ||
|
|
||
|
|
||
| </div> | ||
|
|
||
|
|
||
|
|
||
|
|
||
| </div> | ||
|
|
||
|
|
||
|
|
||
| <div class="sidebar-toggle"> | ||
| <div class="sidebar-toggle-line-wrap"> | ||
| <span class="sidebar-toggle-line sidebar-toggle-line-first"></span> | ||
| <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span> | ||
| <span class="sidebar-toggle-line sidebar-toggle-line-last"></span> | ||
| </div> | ||
| </div> | ||
|
|
||
| <aside id="sidebar" class="sidebar"> | ||
| <div class="sidebar-inner"> | ||
|
|
||
|
|
||
|
|
||
| <section class="site-overview"> | ||
| <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person"> | ||
| <img class="site-author-image" src="/images/default_avatar.jpg" alt="dangge" itemprop="image"/> | ||
| <p class="site-author-name" itemprop="name">dangge</p> | ||
| </div> | ||
| <p class="site-description motion-element" itemprop="description">海月の虚空に秋凉し时鸟</p> | ||
| <nav class="site-state motion-element"> | ||
| <div class="site-state-item site-state-posts"> | ||
| <a href="/archives"> | ||
| <span class="site-state-item-count">1</span> | ||
| <span class="site-state-item-name">文章</span> | ||
| </a> | ||
| </div> | ||
|
|
||
| <div class="site-state-item site-state-categories"> | ||
|
|
||
| <span class="site-state-item-count">0</span> | ||
| <span class="site-state-item-name">分類</span> | ||
|
|
||
| </div> | ||
|
|
||
| <div class="site-state-item site-state-tags"> | ||
| <a href="/tags"> | ||
| <span class="site-state-item-count">0</span> | ||
| <span class="site-state-item-name">標籤</span> | ||
| </a> | ||
| </div> | ||
|
|
||
| </nav> | ||
|
|
||
|
|
||
|
|
||
| <div class="links-of-author motion-element"> | ||
|
|
||
| </div> | ||
|
|
||
|
|
||
|
|
||
|
|
||
| <div class="links-of-author motion-element"> | ||
|
|
||
| </div> | ||
|
|
||
| </section> | ||
|
|
||
|
|
||
|
|
||
| </div> | ||
| </aside> | ||
|
|
||
|
|
||
| </main> | ||
|
|
||
| <footer id="footer" class="footer"> | ||
| <div class="footer-inner"> <div class="copyright" > | ||
|
|
||
| © | ||
| <span itemprop="copyrightYear">2015</span> | ||
| <span class="with-love"> | ||
| <i class="icon-next-heart"></i> | ||
| </span> | ||
| <span class="author" itemprop="copyrightHolder">dangge</span> | ||
| </div> | ||
|
|
||
| <div class="powered-by"> | ||
| 由 <a class="theme-link" href="http://hexo.io">Hexo</a> 強力驅動 | ||
| </div> | ||
|
|
||
| <div class="theme-info"> | ||
| 主題 - | ||
| <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next"> | ||
| NexT | ||
| </a> | ||
| </div> | ||
|
|
||
|
|
||
| </div> | ||
| </footer> | ||
|
|
||
| <div class="back-to-top"></div> | ||
| </div> | ||
|
|
||
| <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js"></script> | ||
| <script type="text/javascript" src="/js/fancy-box.js?v=0.4.5.1"></script> | ||
|
|
||
|
|
||
| <script type="text/javascript" src="/js/helpers.js?v=0.4.5.1"></script> | ||
|
|
||
|
|
||
| <script type="text/javascript" src="/vendors/velocity/velocity.min.js"></script> | ||
| <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js"></script> | ||
|
|
||
| <script type="text/javascript" src="/js/motion_global.js?v=0.4.5.1" id="motion.global"></script> | ||
|
|
||
|
|
||
|
|
||
|
|
||
| <script type="text/javascript" src="/js/nav-toggle.js?v=0.4.5.1"></script> | ||
| <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script> | ||
|
|
||
|
|
||
|
|
||
| <script type="text/javascript"> | ||
| $(document).ready(function () { | ||
| if (CONFIG.sidebar === 'always') { | ||
| displaySidebar(); | ||
| } | ||
| if (isMobile()) { | ||
| FastClick.attach(document.body); | ||
| } | ||
| }); | ||
| </script> | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| <script type="text/javascript" src="/js/lazyload.js"></script> | ||
| <script type="text/javascript"> | ||
| $(function () { | ||
| $("#posts").find('img').lazyload({ | ||
| placeholder: "/images/loading.gif", | ||
| effect: "fadeIn" | ||
| }); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> |
| @@ -0,0 +1,182 @@ | ||
| /* ======================================================================== | ||
| * Bootstrap: scrollspy.js v3.3.2 | ||
| * http://getbootstrap.com/javascript/#scrollspy | ||
| * ======================================================================== | ||
| * Copyright 2011-2015 Twitter, Inc. | ||
| * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) | ||
| * ======================================================================== */ | ||
|
|
||
| /** | ||
| * Custom by iissnan | ||
| * | ||
| * - Add a `clear.bs.scrollspy` event. | ||
| * - Esacpe targets selector. | ||
| */ | ||
|
|
||
|
|
||
| +function ($) { | ||
| 'use strict'; | ||
|
|
||
| // SCROLLSPY CLASS DEFINITION | ||
| // ========================== | ||
|
|
||
| function ScrollSpy(element, options) { | ||
| this.$body = $(document.body) | ||
| this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) | ||
| this.options = $.extend({}, ScrollSpy.DEFAULTS, options) | ||
| this.selector = (this.options.target || '') + ' .nav li > a' | ||
| this.offsets = [] | ||
| this.targets = [] | ||
| this.activeTarget = null | ||
| this.scrollHeight = 0 | ||
|
|
||
| this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) | ||
| this.refresh() | ||
| this.process() | ||
| } | ||
|
|
||
| ScrollSpy.VERSION = '3.3.2' | ||
|
|
||
| ScrollSpy.DEFAULTS = { | ||
| offset: 10 | ||
| } | ||
|
|
||
| ScrollSpy.prototype.getScrollHeight = function () { | ||
| return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) | ||
| } | ||
|
|
||
| ScrollSpy.prototype.refresh = function () { | ||
| var that = this | ||
| var offsetMethod = 'offset' | ||
| var offsetBase = 0 | ||
|
|
||
| this.offsets = [] | ||
| this.targets = [] | ||
| this.scrollHeight = this.getScrollHeight() | ||
|
|
||
| if (!$.isWindow(this.$scrollElement[0])) { | ||
| offsetMethod = 'position' | ||
| offsetBase = this.$scrollElement.scrollTop() | ||
| } | ||
|
|
||
| this.$body | ||
| .find(this.selector) | ||
| .map(function () { | ||
| var $el = $(this) | ||
| var href = $el.data('target') || $el.attr('href') | ||
| var $href = /^#./.test(href) && $(escapeSelector(href)) // Need to escape selector. | ||
|
|
||
| return ($href | ||
| && $href.length | ||
| && $href.is(':visible') | ||
| && [[$href[offsetMethod]().top + offsetBase, href]]) || null | ||
| }) | ||
| .sort(function (a, b) { return a[0] - b[0] }) | ||
| .each(function () { | ||
| that.offsets.push(this[0]) | ||
| that.targets.push(this[1]) | ||
| }) | ||
|
|
||
|
|
||
| } | ||
|
|
||
| ScrollSpy.prototype.process = function () { | ||
| var scrollTop = this.$scrollElement.scrollTop() + this.options.offset | ||
| var scrollHeight = this.getScrollHeight() | ||
| var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() | ||
| var offsets = this.offsets | ||
| var targets = this.targets | ||
| var activeTarget = this.activeTarget | ||
| var i | ||
|
|
||
| if (this.scrollHeight != scrollHeight) { | ||
| this.refresh() | ||
| } | ||
|
|
||
| if (scrollTop >= maxScroll) { | ||
| return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) | ||
| } | ||
|
|
||
| if (activeTarget && scrollTop < offsets[0]) { | ||
| $(this.selector).trigger('clear.bs.scrollspy') // Add a custom event. | ||
| this.activeTarget = null | ||
| return this.clear() | ||
| } | ||
|
|
||
| for (i = offsets.length; i--;) { | ||
| activeTarget != targets[i] | ||
| && scrollTop >= offsets[i] | ||
| && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) | ||
| && this.activate(targets[i]) | ||
| } | ||
| } | ||
|
|
||
| ScrollSpy.prototype.activate = function (target) { | ||
| this.activeTarget = target | ||
|
|
||
| this.clear() | ||
|
|
||
| var selector = this.selector + | ||
| '[data-target="' + target + '"],' + | ||
| this.selector + '[href="' + target + '"]' | ||
|
|
||
| var active = $(selector) | ||
| .parents('li') | ||
| .addClass('active') | ||
|
|
||
| if (active.parent('.dropdown-menu').length) { | ||
| active = active | ||
| .closest('li.dropdown') | ||
| .addClass('active') | ||
| } | ||
|
|
||
| active.trigger('activate.bs.scrollspy') | ||
| } | ||
|
|
||
| ScrollSpy.prototype.clear = function () { | ||
| $(this.selector) | ||
| .parentsUntil(this.options.target, '.active') | ||
| .removeClass('active') | ||
| } | ||
|
|
||
|
|
||
| // SCROLLSPY PLUGIN DEFINITION | ||
| // =========================== | ||
|
|
||
| function Plugin(option) { | ||
| return this.each(function () { | ||
| var $this = $(this) | ||
| var data = $this.data('bs.scrollspy') | ||
| var options = typeof option == 'object' && option | ||
|
|
||
| if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) | ||
| if (typeof option == 'string') data[option]() | ||
| }) | ||
| } | ||
|
|
||
| var old = $.fn.scrollspy | ||
|
|
||
| $.fn.scrollspy = Plugin | ||
| $.fn.scrollspy.Constructor = ScrollSpy | ||
|
|
||
|
|
||
| // SCROLLSPY NO CONFLICT | ||
| // ===================== | ||
|
|
||
| $.fn.scrollspy.noConflict = function () { | ||
| $.fn.scrollspy = old | ||
| return this | ||
| } | ||
|
|
||
|
|
||
| // SCROLLSPY DATA-API | ||
| // ================== | ||
|
|
||
| $(window).on('load.bs.scrollspy.data-api', function () { | ||
| $('[data-spy="scroll"]').each(function () { | ||
| var $spy = $(this) | ||
| Plugin.call($spy, $spy.data()) | ||
| }) | ||
| }) | ||
|
|
||
| }(jQuery); |
| @@ -0,0 +1,21 @@ | ||
| $(document).ready(function() { | ||
| $('.content img').each(function () { | ||
| var $image = $(this); | ||
| var $imageWrapLink = $image.parent('a'); | ||
|
|
||
| if ($imageWrapLink.size() < 1) { | ||
| $imageWrapLink = $image.wrap('<a href="' + this.getAttribute('src') + '"></a>').parent('a'); | ||
| } | ||
| $imageWrapLink.addClass('fancybox'); | ||
| if(this.title){ | ||
| $imageWrapLink.attr("title",this.title); //make sure img title tag will show correctly in fancybox | ||
| } | ||
| }); | ||
| }); | ||
| $('.fancybox').fancybox({ | ||
| helpers: { | ||
| overlay: { | ||
| locked: false | ||
| } | ||
| } | ||
| }); |
| @@ -0,0 +1,33 @@ | ||
| function hasMobileUA () { | ||
| var nav = window.navigator; | ||
| var ua = nav.userAgent; | ||
| var pa = /iPad|iPhone|Android|Opera Mini|BlackBerry|webOS|UCWEB|Blazer|PSP|IEMobile|Symbian/g; | ||
|
|
||
| return pa.test(ua); | ||
| } | ||
|
|
||
| function isDesktop () { | ||
| return screen.width > 991 && !hasMobileUA(); | ||
| } | ||
|
|
||
| function isTablet () { | ||
| return screen.width < 992 && screen.width > 767 && hasMobileUA(); | ||
| } | ||
|
|
||
| function isMobile () { | ||
| return screen.width < 767 && hasMobileUA(); | ||
| } | ||
|
|
||
| function escapeSelector (selector) { | ||
| return selector.replace(/[!"$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, "\\$&") | ||
| } | ||
|
|
||
| function displaySidebar () { | ||
| setTimeout(function () { | ||
| $('.sidebar-toggle').trigger('click'); | ||
| }, 800); | ||
| } | ||
|
|
||
| function isMist () { | ||
| return CONFIG.scheme === 'Mist'; | ||
| } |
| @@ -0,0 +1,46 @@ | ||
| if (typeof DUOSHUO !== 'undefined') { | ||
| hook_duoshuo_templates(); | ||
| } else { | ||
| $('[src="http://static.duoshuo.com/embed.js"]')[0].onload = hook_duoshuo_templates; | ||
| } | ||
| var is_hook_duoshuo = false; | ||
|
|
||
| function hook_duoshuo_templates() { | ||
| if (is_hook_duoshuo) { | ||
| return; | ||
| } else { | ||
| is_hook_duoshuo = true; | ||
| } | ||
| var _D_post = DUOSHUO.templates.post; | ||
| DUOSHUO.templates.post = function(e, t) { | ||
| var rs = _D_post(e, t); | ||
| var is_admin; | ||
| if (typeof duoshuo_user_ID !== 'undefined') { | ||
| if (e.post.author.user_id && (e.post.author.user_id == duoshuo_user_ID)) { | ||
| if(duoshuo_admin_nickname){ | ||
| is_admin = '<span class="this_ua admin">'+duoshuo_admin_nickname+'</span>' | ||
| }else{ | ||
| is_admin = '<span class="this_ua admin">博主</span>' | ||
| } | ||
| } else { | ||
| is_admin = ''; | ||
| } | ||
| } else { | ||
| is_admin = ''; | ||
| } | ||
| var agent = e.post.agent; | ||
| if (agent && /^Mozilla/.test(agent)) { | ||
| rs = rs.replace(/<\/div><p>/, is_admin + show_ua(agent) + '</div><p>') | ||
| }; | ||
| return rs; | ||
| } | ||
| } | ||
|
|
||
| function show_ua(string) { | ||
| $.ua.set(string); | ||
| var sua = $.ua; | ||
| if (sua.os.version == 'x86_64') { | ||
| sua.os.version = 'x64'; | ||
| } | ||
| return '<span class="this_ua platform ' + sua.os.name + '">' + sua.os.name + ' ' + sua.os.version + '</span><span class="this_ua browser ' + sua.browser.name + '">' + sua.browser.name + ' | ' + sua.browser.version + '</span>'; | ||
| } |
| @@ -0,0 +1,27 @@ | ||
| $(document).ready(function () { | ||
| var isSidebarVisible; | ||
| var DURATION = 300; | ||
| var SIDEBAR_WIDTH = 320; | ||
|
|
||
| sidebar(); | ||
| backToTop(); | ||
|
|
||
| function sidebar() { | ||
| $('.sidebar-toggle').on('click', function () { | ||
| var sidebarWidth = isSidebarVisible ? 0 : SIDEBAR_WIDTH; | ||
| $('.sidebar').animate({ | ||
| width: sidebarWidth | ||
| }, DURATION); | ||
| isSidebarVisible = !isSidebarVisible; | ||
| }); | ||
| } | ||
|
|
||
| function backToTop() { | ||
| $('.back-to-top').on('click', function () { | ||
| $('html, body').animate({ | ||
| scrollTop: 0 | ||
| }, DURATION); | ||
| }); | ||
| } | ||
|
|
||
| }); |
| @@ -0,0 +1,170 @@ | ||
| $(document).ready(function () { | ||
| var body = $('body'); | ||
| var isSidebarVisible = false; | ||
| var sidebarToggle = $('.sidebar-toggle'); | ||
| var sidebarToggleLine1st = $('.sidebar-toggle-line-first'); | ||
| var sidebarToggleLine2nd = $('.sidebar-toggle-line-middle'); | ||
| var sidebarToggleLine3rd = $('.sidebar-toggle-line-last'); | ||
| var sidebar = $('.sidebar'); | ||
|
|
||
| var SIDEBAR_WIDTH = '320px'; | ||
| var SIDEBAR_DISPLAY_DURATION = 300; | ||
|
|
||
| var sidebarToggleLineStatusInit = {width: '100%', opacity: 1, left: 0, rotateZ: 0, top: 0}; | ||
|
|
||
| var sidebarToggleLine1stStatusInit = sidebarToggleLineStatusInit; | ||
| var sidebarToggleLine1stStatusArrow = {width: '50%', rotateZ: '-45deg', top: '2px'}; | ||
| var sidebarToggleLine1stStatusClose = {width: '100%', rotateZ: '-45deg', top: '5px'}; | ||
|
|
||
| var sidebarToggleLine2ndStatusInit = sidebarToggleLineStatusInit; | ||
| var sidebarToggleLine2ndStatusArrow = {width: '90%'}; | ||
| var sidebarToggleLine2ndStatusClose = {opacity: 0}; | ||
|
|
||
| var sidebarToggleLine3rdStatusInit = sidebarToggleLineStatusInit; | ||
| var sidebarToggleLine3rdStatusArrow = {width: '50%', rotateZ: '45deg', top: '-2px'}; | ||
| var sidebarToggleLine3rdStatusClose = {width: '100%', rotateZ: '45deg', top: '-5px'}; | ||
|
|
||
| LogoAndMenuMotion(); | ||
| sidebarToggleMotion(); | ||
| postsListMotion(); | ||
| backToTopMotion(); | ||
|
|
||
| //add motion effect to toc | ||
| $('.sidebar-nav-toc') && $('.post-toc-wrap').addClass('motion-element'); | ||
|
|
||
|
|
||
| //当前选择的是目录列表时添加 class 'motion-element' | ||
| sidebar.bind('click', function(e){ | ||
| if(!!$('.sidebar-nav-toc') && e.target == $('.sidebar-nav-toc')[0]){ | ||
| $('.post-toc-wrap').addClass('motion-element'); | ||
| }}); | ||
|
|
||
| //防止 humberger 被选择导致 sidebar 上方出现高亮 | ||
| document.onselectstart = function(e) { | ||
| if((e.target == sidebarToggle[0]) || (e.target == $('.sidebar-toggle-line-wrap')[0]) || (e.target == sidebarToggleLine1st[0]) || (e.target == sidebarToggleLine2nd[0]) || (e.target == sidebarToggleLine3rd[0])){ | ||
| e.preventDefault(); | ||
| } | ||
| }; | ||
|
|
||
| $(document) | ||
| .on('sidebar.isShowing', function () { | ||
| //添加 “.velocity('stop')” 用以中止动画 | ||
| isDesktop() && body.velocity('stop').velocity( | ||
| {paddingRight: SIDEBAR_WIDTH}, | ||
| SIDEBAR_DISPLAY_DURATION | ||
| ); | ||
| // sidebar 内容的效果应该在sidebarsidebarShowMotion内触发 | ||
| // sidebarContentMotion(); | ||
| }) | ||
| .on('sidebar.isHiding', function () {}); | ||
|
|
||
| function LogoAndMenuMotion() { | ||
| var sequence = [ | ||
| { e: $('.brand'), p: { opacity: 1 }, o: { duration: 100 } }, | ||
| { e: $('.logo'), p: { opacity: 1, top: 0 }, o: { duration: 50} } | ||
| ]; | ||
|
|
||
| isMist() && sequence.push( | ||
| { e: $('.logo-line-before i'), p: { translateX: "100%" }, o: { duration: 500, sequenceQueue: false } }, | ||
| { e: $('.logo-line-after i'), p: { translateX: "-100%" }, o: { duration: 500, sequenceQueue: false } } | ||
| ); | ||
|
|
||
| sequence.push({ e: $('.site-title'), p: { opacity: 1, top: 0 }, o: { duration: 200 } }); | ||
|
|
||
| $.Velocity.RunSequence(sequence); | ||
| $('.menu-item').velocity('transition.slideDownIn', {display: null}); | ||
| } | ||
|
|
||
|
|
||
| function backToTopMotion () { | ||
| var b2top = $('.back-to-top'); | ||
| b2top.on('click', function () { | ||
| body.velocity('scroll'); | ||
| }); | ||
| } | ||
|
|
||
| function sidebarShowMotion () { | ||
|
|
||
| sidebarToggleLine1st.velocity('stop').velocity(sidebarToggleLine1stStatusClose); | ||
| sidebarToggleLine2nd.velocity('stop').velocity(sidebarToggleLine2ndStatusClose); | ||
| sidebarToggleLine3rd.velocity('stop').velocity(sidebarToggleLine3rdStatusClose); | ||
|
|
||
| //添加 “.velocity('stop')” 用以中止动画 | ||
| sidebar.velocity('stop').velocity({width: SIDEBAR_WIDTH}, { | ||
| display: 'block', | ||
| duration: SIDEBAR_DISPLAY_DURATION, | ||
| //将 sidebar 内容动画效果函数移动到这里 | ||
| begin: function(e) { | ||
| sidebarContentMotion(); | ||
| }, | ||
| complete: function () { | ||
| sidebar.addClass('sidebar-active'); | ||
| sidebar.trigger('sidebar.didShow'); | ||
| } | ||
| }); | ||
| sidebar.trigger('sidebar.isShowing'); | ||
| } | ||
|
|
||
| function sidebarHideMotion () { | ||
| //添加 “.velocity('stop')” 用以中止动画 | ||
| isDesktop() && body.velocity('stop').velocity({paddingRight: 0}); | ||
| // sidebar 内容动画中止和隐藏 | ||
| $('.sidebar .motion-element').velocity('stop').css('display','none');; | ||
| // sidebar 动画中止和隐藏 | ||
| sidebar.velocity('stop').velocity({width: 0}, {display: 'none'}); | ||
|
|
||
| sidebarToggleLine1st.velocity('stop').velocity(sidebarToggleLine1stStatusInit); | ||
| sidebarToggleLine2nd.velocity('stop').velocity(sidebarToggleLine2ndStatusInit); | ||
| sidebarToggleLine3rd.velocity('stop').velocity(sidebarToggleLine3rdStatusInit); | ||
|
|
||
| sidebar.removeClass('sidebar-active'); | ||
| sidebar.trigger('sidebar.isHiding'); | ||
|
|
||
| //在 post 页面下按下隐藏 sidebar 时如果当前选中的是“站点概览”,将 toc 去除 motion 效果 | ||
| //防止再次打开时会出现在“站点概览”下的 bug | ||
| if(!!$('.post-toc-wrap')){ | ||
| if($('.site-overview').css('display') == 'block'){ | ||
| $('.post-toc-wrap').removeClass('motion-element'); | ||
| } | ||
| // else { | ||
| // $('.post-toc-wrap').addClass('motion-element'); | ||
| // } | ||
| } | ||
| } | ||
|
|
||
| function sidebarContentMotion () { | ||
| $('.sidebar .motion-element') | ||
| .velocity('transition.slideRightIn',{ | ||
| stagger: 50, | ||
| drag: true, | ||
| complete: function () { | ||
| sidebar.trigger('sidebar.motion.complete'); | ||
| } | ||
| } | ||
| ); | ||
| } | ||
|
|
||
| function postsListMotion () { | ||
| var postMotionOptions = window.postMotionOptions || {stagger: 300, drag: true}; | ||
| $('.post').velocity('transition.slideDownIn', postMotionOptions); | ||
| } | ||
|
|
||
| function sidebarToggleMotion () { | ||
| sidebarToggle.on('click', function () { | ||
| isSidebarVisible ? sidebarHideMotion() : sidebarShowMotion(); | ||
| isSidebarVisible = !isSidebarVisible; | ||
| }); | ||
|
|
||
| sidebarToggle.hover(function () { | ||
| if (isSidebarVisible) {return} | ||
| sidebarToggleLine1st.velocity('stop').velocity(sidebarToggleLine1stStatusArrow); | ||
| sidebarToggleLine2nd.velocity('stop').velocity(sidebarToggleLine2ndStatusArrow); | ||
| sidebarToggleLine3rd.velocity('stop').velocity(sidebarToggleLine3rdStatusArrow); | ||
| }, function () { | ||
| if (isSidebarVisible) {return} | ||
| sidebarToggleLine1st.velocity('stop').velocity(sidebarToggleLine1stStatusInit); | ||
| sidebarToggleLine2nd.velocity('stop').velocity(sidebarToggleLine2ndStatusInit); | ||
| sidebarToggleLine3rd.velocity('stop').velocity(sidebarToggleLine3rdStatusInit); | ||
| }); | ||
| } | ||
| }); |
| @@ -0,0 +1,13 @@ | ||
| $(document).ready(function () { | ||
| $('.site-nav-toggle button').on('click', function () { | ||
| var $siteNav = $('.site-nav'); | ||
| var ON_CLASS_NAME = 'site-nav-on'; | ||
| var isSiteNavOn = $siteNav.hasClass(ON_CLASS_NAME); | ||
| var animateAction = isSiteNavOn ? 'slideUp' : 'slideDown'; | ||
| var animateCallback = isSiteNavOn ? 'removeClass' : 'addClass'; | ||
|
|
||
| $siteNav.stop()[animateAction]('fast', function () { | ||
| $siteNav[animateCallback](ON_CLASS_NAME); | ||
| }); | ||
| }); | ||
| }); |
| @@ -0,0 +1,137 @@ | ||
| (function($){ | ||
| // Search | ||
| var $searchWrap = $('#search-form-wrap'), | ||
| isSearchAnim = false, | ||
| searchAnimDuration = 200; | ||
|
|
||
| var startSearchAnim = function(){ | ||
| isSearchAnim = true; | ||
| }; | ||
|
|
||
| var stopSearchAnim = function(callback){ | ||
| setTimeout(function(){ | ||
| isSearchAnim = false; | ||
| callback && callback(); | ||
| }, searchAnimDuration); | ||
| }; | ||
|
|
||
| $('#nav-search-btn').on('click', function(){ | ||
| if (isSearchAnim) return; | ||
|
|
||
| startSearchAnim(); | ||
| $searchWrap.addClass('on'); | ||
| stopSearchAnim(function(){ | ||
| $('.search-form-input').focus(); | ||
| }); | ||
| }); | ||
|
|
||
| $('.search-form-input').on('blur', function(){ | ||
| startSearchAnim(); | ||
| $searchWrap.removeClass('on'); | ||
| stopSearchAnim(); | ||
| }); | ||
|
|
||
| // Share | ||
| $('body').on('click', function(){ | ||
| $('.article-share-box.on').removeClass('on'); | ||
| }).on('click', '.article-share-link', function(e){ | ||
| e.stopPropagation(); | ||
|
|
||
| var $this = $(this), | ||
| url = $this.attr('data-url'), | ||
| encodedUrl = encodeURIComponent(url), | ||
| id = 'article-share-box-' + $this.attr('data-id'), | ||
| offset = $this.offset(); | ||
|
|
||
| if ($('#' + id).length){ | ||
| var box = $('#' + id); | ||
|
|
||
| if (box.hasClass('on')){ | ||
| box.removeClass('on'); | ||
| return; | ||
| } | ||
| } else { | ||
| var html = [ | ||
| '<div id="' + id + '" class="article-share-box">', | ||
| '<input class="article-share-input" value="' + url + '">', | ||
| '<div class="article-share-links">', | ||
| '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>', | ||
| '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>', | ||
| '<a href="http://pinterest.com/pin/create/button/?url=' + encodedUrl + '" class="article-share-pinterest" target="_blank" title="Pinterest"></a>', | ||
| '<a href="https://plus.google.com/share?url=' + encodedUrl + '" class="article-share-google" target="_blank" title="Google+"></a>', | ||
| '</div>', | ||
| '</div>' | ||
| ].join(''); | ||
|
|
||
| var box = $(html); | ||
|
|
||
| $('body').append(box); | ||
| } | ||
|
|
||
| $('.article-share-box.on').hide(); | ||
|
|
||
| box.css({ | ||
| top: offset.top + 25, | ||
| left: offset.left | ||
| }).addClass('on'); | ||
| }).on('click', '.article-share-box', function(e){ | ||
| e.stopPropagation(); | ||
| }).on('click', '.article-share-box-input', function(){ | ||
| $(this).select(); | ||
| }).on('click', '.article-share-box-link', function(e){ | ||
| e.preventDefault(); | ||
| e.stopPropagation(); | ||
|
|
||
| window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450'); | ||
| }); | ||
|
|
||
| // Caption | ||
| $('.article-entry').each(function(i){ | ||
| $(this).find('img').each(function(){ | ||
| if ($(this).parent().hasClass('fancybox')) return; | ||
|
|
||
| var alt = this.alt; | ||
|
|
||
| if (alt) $(this).after('<span class="caption">' + alt + '</span>'); | ||
|
|
||
| $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>'); | ||
| }); | ||
|
|
||
| $(this).find('.fancybox').each(function(){ | ||
| $(this).attr('rel', 'article' + i); | ||
| }); | ||
| }); | ||
|
|
||
| if ($.fancybox){ | ||
| $('.fancybox').fancybox(); | ||
| } | ||
|
|
||
| // Mobile nav | ||
| var $container = $('#container'), | ||
| isMobileNavAnim = false, | ||
| mobileNavAnimDuration = 200; | ||
|
|
||
| var startMobileNavAnim = function(){ | ||
| isMobileNavAnim = true; | ||
| }; | ||
|
|
||
| var stopMobileNavAnim = function(){ | ||
| setTimeout(function(){ | ||
| isMobileNavAnim = false; | ||
| }, mobileNavAnimDuration); | ||
| } | ||
|
|
||
| $('#main-nav-toggle').on('click', function(){ | ||
| if (isMobileNavAnim) return; | ||
|
|
||
| startMobileNavAnim(); | ||
| $container.toggleClass('mobile-nav-on'); | ||
| stopMobileNavAnim(); | ||
| }); | ||
|
|
||
| $('#wrap').on('click', function(){ | ||
| if (isMobileNavAnim || !$container.hasClass('mobile-nav-on')) return; | ||
|
|
||
| $container.removeClass('mobile-nav-on'); | ||
| }); | ||
| })(jQuery); |
| @@ -0,0 +1,97 @@ | ||
| #fancybox-buttons { | ||
| position: fixed; | ||
| left: 0; | ||
| width: 100%; | ||
| z-index: 8050; | ||
| } | ||
|
|
||
| #fancybox-buttons.top { | ||
| top: 10px; | ||
| } | ||
|
|
||
| #fancybox-buttons.bottom { | ||
| bottom: 10px; | ||
| } | ||
|
|
||
| #fancybox-buttons ul { | ||
| display: block; | ||
| width: 166px; | ||
| height: 30px; | ||
| margin: 0 auto; | ||
| padding: 0; | ||
| list-style: none; | ||
| border: 1px solid #111; | ||
| border-radius: 3px; | ||
| -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); | ||
| -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); | ||
| box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); | ||
| background: rgb(50,50,50); | ||
| background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%); | ||
| background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51))); | ||
| background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); | ||
| background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); | ||
| background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); | ||
| background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); | ||
| filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 ); | ||
| } | ||
|
|
||
| #fancybox-buttons ul li { | ||
| float: left; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| #fancybox-buttons a { | ||
| display: block; | ||
| width: 30px; | ||
| height: 30px; | ||
| text-indent: -9999px; | ||
| background-color: transparent; | ||
| background-image: url('fancybox_buttons.png'); | ||
| background-repeat: no-repeat; | ||
| outline: none; | ||
| opacity: 0.8; | ||
| } | ||
|
|
||
| #fancybox-buttons a:hover { | ||
| opacity: 1; | ||
| } | ||
|
|
||
| #fancybox-buttons a.btnPrev { | ||
| background-position: 5px 0; | ||
| } | ||
|
|
||
| #fancybox-buttons a.btnNext { | ||
| background-position: -33px 0; | ||
| border-right: 1px solid #3e3e3e; | ||
| } | ||
|
|
||
| #fancybox-buttons a.btnPlay { | ||
| background-position: 0 -30px; | ||
| } | ||
|
|
||
| #fancybox-buttons a.btnPlayOn { | ||
| background-position: -30px -30px; | ||
| } | ||
|
|
||
| #fancybox-buttons a.btnToggle { | ||
| background-position: 3px -60px; | ||
| border-left: 1px solid #111; | ||
| border-right: 1px solid #3e3e3e; | ||
| width: 35px | ||
| } | ||
|
|
||
| #fancybox-buttons a.btnToggleOn { | ||
| background-position: -27px -60px; | ||
| } | ||
|
|
||
| #fancybox-buttons a.btnClose { | ||
| border-left: 1px solid #111; | ||
| width: 35px; | ||
| background-position: -56px 0px; | ||
| } | ||
|
|
||
| #fancybox-buttons a.btnDisabled { | ||
| opacity : 0.4; | ||
| cursor: default; | ||
| } |
| @@ -0,0 +1,122 @@ | ||
| /*! | ||
| * Buttons helper for fancyBox | ||
| * version: 1.0.5 (Mon, 15 Oct 2012) | ||
| * @requires fancyBox v2.0 or later | ||
| * | ||
| * Usage: | ||
| * $(".fancybox").fancybox({ | ||
| * helpers : { | ||
| * buttons: { | ||
| * position : 'top' | ||
| * } | ||
| * } | ||
| * }); | ||
| * | ||
| */ | ||
| (function ($) { | ||
| //Shortcut for fancyBox object | ||
| var F = $.fancybox; | ||
|
|
||
| //Add helper object | ||
| F.helpers.buttons = { | ||
| defaults : { | ||
| skipSingle : false, // disables if gallery contains single image | ||
| position : 'top', // 'top' or 'bottom' | ||
| tpl : '<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:;"></a></li></ul></div>' | ||
| }, | ||
|
|
||
| list : null, | ||
| buttons: null, | ||
|
|
||
| beforeLoad: function (opts, obj) { | ||
| //Remove self if gallery do not have at least two items | ||
|
|
||
| if (opts.skipSingle && obj.group.length < 2) { | ||
| obj.helpers.buttons = false; | ||
| obj.closeBtn = true; | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| //Increase top margin to give space for buttons | ||
| obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30; | ||
| }, | ||
|
|
||
| onPlayStart: function () { | ||
| if (this.buttons) { | ||
| this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn'); | ||
| } | ||
| }, | ||
|
|
||
| onPlayEnd: function () { | ||
| if (this.buttons) { | ||
| this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn'); | ||
| } | ||
| }, | ||
|
|
||
| afterShow: function (opts, obj) { | ||
| var buttons = this.buttons; | ||
|
|
||
| if (!buttons) { | ||
| this.list = $(opts.tpl).addClass(opts.position).appendTo('body'); | ||
|
|
||
| buttons = { | ||
| prev : this.list.find('.btnPrev').click( F.prev ), | ||
| next : this.list.find('.btnNext').click( F.next ), | ||
| play : this.list.find('.btnPlay').click( F.play ), | ||
| toggle : this.list.find('.btnToggle').click( F.toggle ), | ||
| close : this.list.find('.btnClose').click( F.close ) | ||
| } | ||
| } | ||
|
|
||
| //Prev | ||
| if (obj.index > 0 || obj.loop) { | ||
| buttons.prev.removeClass('btnDisabled'); | ||
| } else { | ||
| buttons.prev.addClass('btnDisabled'); | ||
| } | ||
|
|
||
| //Next / Play | ||
| if (obj.loop || obj.index < obj.group.length - 1) { | ||
| buttons.next.removeClass('btnDisabled'); | ||
| buttons.play.removeClass('btnDisabled'); | ||
|
|
||
| } else { | ||
| buttons.next.addClass('btnDisabled'); | ||
| buttons.play.addClass('btnDisabled'); | ||
| } | ||
|
|
||
| this.buttons = buttons; | ||
|
|
||
| this.onUpdate(opts, obj); | ||
| }, | ||
|
|
||
| onUpdate: function (opts, obj) { | ||
| var toggle; | ||
|
|
||
| if (!this.buttons) { | ||
| return; | ||
| } | ||
|
|
||
| toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn'); | ||
|
|
||
| //Size toggle button | ||
| if (obj.canShrink) { | ||
| toggle.addClass('btnToggleOn'); | ||
|
|
||
| } else if (!obj.canExpand) { | ||
| toggle.addClass('btnDisabled'); | ||
| } | ||
| }, | ||
|
|
||
| beforeClose: function () { | ||
| if (this.list) { | ||
| this.list.remove(); | ||
| } | ||
|
|
||
| this.list = null; | ||
| this.buttons = null; | ||
| } | ||
| }; | ||
|
|
||
| }(jQuery)); |
| @@ -0,0 +1,199 @@ | ||
| /*! | ||
| * Media helper for fancyBox | ||
| * version: 1.0.6 (Fri, 14 Jun 2013) | ||
| * @requires fancyBox v2.0 or later | ||
| * | ||
| * Usage: | ||
| * $(".fancybox").fancybox({ | ||
| * helpers : { | ||
| * media: true | ||
| * } | ||
| * }); | ||
| * | ||
| * Set custom URL parameters: | ||
| * $(".fancybox").fancybox({ | ||
| * helpers : { | ||
| * media: { | ||
| * youtube : { | ||
| * params : { | ||
| * autoplay : 0 | ||
| * } | ||
| * } | ||
| * } | ||
| * } | ||
| * }); | ||
| * | ||
| * Or: | ||
| * $(".fancybox").fancybox({, | ||
| * helpers : { | ||
| * media: true | ||
| * }, | ||
| * youtube : { | ||
| * autoplay: 0 | ||
| * } | ||
| * }); | ||
| * | ||
| * Supports: | ||
| * | ||
| * Youtube | ||
| * http://www.youtube.com/watch?v=opj24KnzrWo | ||
| * http://www.youtube.com/embed/opj24KnzrWo | ||
| * http://youtu.be/opj24KnzrWo | ||
| * http://www.youtube-nocookie.com/embed/opj24KnzrWo | ||
| * Vimeo | ||
| * http://vimeo.com/40648169 | ||
| * http://vimeo.com/channels/staffpicks/38843628 | ||
| * http://vimeo.com/groups/surrealism/videos/36516384 | ||
| * http://player.vimeo.com/video/45074303 | ||
| * Metacafe | ||
| * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ | ||
| * http://www.metacafe.com/watch/7635964/ | ||
| * Dailymotion | ||
| * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people | ||
| * Twitvid | ||
| * http://twitvid.com/QY7MD | ||
| * Twitpic | ||
| * http://twitpic.com/7p93st | ||
| * http://instagr.am/p/IejkuUGxQn/ | ||
| * http://instagram.com/p/IejkuUGxQn/ | ||
| * Google maps | ||
| * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 | ||
| * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 | ||
| * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 | ||
| */ | ||
| (function ($) { | ||
| "use strict"; | ||
|
|
||
| //Shortcut for fancyBox object | ||
| var F = $.fancybox, | ||
| format = function( url, rez, params ) { | ||
| params = params || ''; | ||
|
|
||
| if ( $.type( params ) === "object" ) { | ||
| params = $.param(params, true); | ||
| } | ||
|
|
||
| $.each(rez, function(key, value) { | ||
| url = url.replace( '$' + key, value || '' ); | ||
| }); | ||
|
|
||
| if (params.length) { | ||
| url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; | ||
| } | ||
|
|
||
| return url; | ||
| }; | ||
|
|
||
| //Add helper object | ||
| F.helpers.media = { | ||
| defaults : { | ||
| youtube : { | ||
| matcher : /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, | ||
| params : { | ||
| autoplay : 1, | ||
| autohide : 1, | ||
| fs : 1, | ||
| rel : 0, | ||
| hd : 1, | ||
| wmode : 'opaque', | ||
| enablejsapi : 1 | ||
| }, | ||
| type : 'iframe', | ||
| url : '//www.youtube.com/embed/$3' | ||
| }, | ||
| vimeo : { | ||
| matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, | ||
| params : { | ||
| autoplay : 1, | ||
| hd : 1, | ||
| show_title : 1, | ||
| show_byline : 1, | ||
| show_portrait : 0, | ||
| fullscreen : 1 | ||
| }, | ||
| type : 'iframe', | ||
| url : '//player.vimeo.com/video/$1' | ||
| }, | ||
| metacafe : { | ||
| matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, | ||
| params : { | ||
| autoPlay : 'yes' | ||
| }, | ||
| type : 'swf', | ||
| url : function( rez, params, obj ) { | ||
| obj.swf.flashVars = 'playerVars=' + $.param( params, true ); | ||
|
|
||
| return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; | ||
| } | ||
| }, | ||
| dailymotion : { | ||
| matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, | ||
| params : { | ||
| additionalInfos : 0, | ||
| autoStart : 1 | ||
| }, | ||
| type : 'swf', | ||
| url : '//www.dailymotion.com/swf/video/$1' | ||
| }, | ||
| twitvid : { | ||
| matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, | ||
| params : { | ||
| autoplay : 0 | ||
| }, | ||
| type : 'iframe', | ||
| url : '//www.twitvid.com/embed.php?guid=$1' | ||
| }, | ||
| twitpic : { | ||
| matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, | ||
| type : 'image', | ||
| url : '//twitpic.com/show/full/$1/' | ||
| }, | ||
| instagram : { | ||
| matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, | ||
| type : 'image', | ||
| url : '//$1/p/$2/media/?size=l' | ||
| }, | ||
| google_maps : { | ||
| matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, | ||
| type : 'iframe', | ||
| url : function( rez ) { | ||
| return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); | ||
| } | ||
| } | ||
| }, | ||
|
|
||
| beforeLoad : function(opts, obj) { | ||
| var url = obj.href || '', | ||
| type = false, | ||
| what, | ||
| item, | ||
| rez, | ||
| params; | ||
|
|
||
| for (what in opts) { | ||
| if (opts.hasOwnProperty(what)) { | ||
| item = opts[ what ]; | ||
| rez = url.match( item.matcher ); | ||
|
|
||
| if (rez) { | ||
| type = item.type; | ||
| params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); | ||
|
|
||
| url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); | ||
|
|
||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (type) { | ||
| obj.href = url; | ||
| obj.type = type; | ||
|
|
||
| obj.autoHeight = false; | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| }(jQuery)); |
| @@ -0,0 +1,55 @@ | ||
| #fancybox-thumbs { | ||
| position: fixed; | ||
| left: 0; | ||
| width: 100%; | ||
| overflow: hidden; | ||
| z-index: 8050; | ||
| } | ||
|
|
||
| #fancybox-thumbs.bottom { | ||
| bottom: 2px; | ||
| } | ||
|
|
||
| #fancybox-thumbs.top { | ||
| top: 2px; | ||
| } | ||
|
|
||
| #fancybox-thumbs ul { | ||
| position: relative; | ||
| list-style: none; | ||
| margin: 0; | ||
| padding: 0; | ||
| } | ||
|
|
||
| #fancybox-thumbs ul li { | ||
| float: left; | ||
| padding: 1px; | ||
| opacity: 0.5; | ||
| } | ||
|
|
||
| #fancybox-thumbs ul li.active { | ||
| opacity: 0.75; | ||
| padding: 0; | ||
| border: 1px solid #fff; | ||
| } | ||
|
|
||
| #fancybox-thumbs ul li:hover { | ||
| opacity: 1; | ||
| } | ||
|
|
||
| #fancybox-thumbs ul li a { | ||
| display: block; | ||
| position: relative; | ||
| overflow: hidden; | ||
| border: 1px solid #222; | ||
| background: #111; | ||
| outline: none; | ||
| } | ||
|
|
||
| #fancybox-thumbs ul li img { | ||
| display: block; | ||
| position: relative; | ||
| border: 0; | ||
| padding: 0; | ||
| max-width: none; | ||
| } |
| @@ -0,0 +1,162 @@ | ||
| /*! | ||
| * Thumbnail helper for fancyBox | ||
| * version: 1.0.7 (Mon, 01 Oct 2012) | ||
| * @requires fancyBox v2.0 or later | ||
| * | ||
| * Usage: | ||
| * $(".fancybox").fancybox({ | ||
| * helpers : { | ||
| * thumbs: { | ||
| * width : 50, | ||
| * height : 50 | ||
| * } | ||
| * } | ||
| * }); | ||
| * | ||
| */ | ||
| (function ($) { | ||
| //Shortcut for fancyBox object | ||
| var F = $.fancybox; | ||
|
|
||
| //Add helper object | ||
| F.helpers.thumbs = { | ||
| defaults : { | ||
| width : 50, // thumbnail width | ||
| height : 50, // thumbnail height | ||
| position : 'bottom', // 'top' or 'bottom' | ||
| source : function ( item ) { // function to obtain the URL of the thumbnail image | ||
| var href; | ||
|
|
||
| if (item.element) { | ||
| href = $(item.element).find('img').attr('src'); | ||
| } | ||
|
|
||
| if (!href && item.type === 'image' && item.href) { | ||
| href = item.href; | ||
| } | ||
|
|
||
| return href; | ||
| } | ||
| }, | ||
|
|
||
| wrap : null, | ||
| list : null, | ||
| width : 0, | ||
|
|
||
| init: function (opts, obj) { | ||
| var that = this, | ||
| list, | ||
| thumbWidth = opts.width, | ||
| thumbHeight = opts.height, | ||
| thumbSource = opts.source; | ||
|
|
||
| //Build list structure | ||
| list = ''; | ||
|
|
||
| for (var n = 0; n < obj.group.length; n++) { | ||
| list += '<li><a style="width:' + thumbWidth + 'px;height:' + thumbHeight + 'px;" href="javascript:jQuery.fancybox.jumpto(' + n + ');"></a></li>'; | ||
| } | ||
|
|
||
| this.wrap = $('<div id="fancybox-thumbs"></div>').addClass(opts.position).appendTo('body'); | ||
| this.list = $('<ul>' + list + '</ul>').appendTo(this.wrap); | ||
|
|
||
| //Load each thumbnail | ||
| $.each(obj.group, function (i) { | ||
| var href = thumbSource( obj.group[ i ] ); | ||
|
|
||
| if (!href) { | ||
| return; | ||
| } | ||
|
|
||
| $("<img />").load(function () { | ||
| var width = this.width, | ||
| height = this.height, | ||
| widthRatio, heightRatio, parent; | ||
|
|
||
| if (!that.list || !width || !height) { | ||
| return; | ||
| } | ||
|
|
||
| //Calculate thumbnail width/height and center it | ||
| widthRatio = width / thumbWidth; | ||
| heightRatio = height / thumbHeight; | ||
|
|
||
| parent = that.list.children().eq(i).find('a'); | ||
|
|
||
| if (widthRatio >= 1 && heightRatio >= 1) { | ||
| if (widthRatio > heightRatio) { | ||
| width = Math.floor(width / heightRatio); | ||
| height = thumbHeight; | ||
|
|
||
| } else { | ||
| width = thumbWidth; | ||
| height = Math.floor(height / widthRatio); | ||
| } | ||
| } | ||
|
|
||
| $(this).css({ | ||
| width : width, | ||
| height : height, | ||
| top : Math.floor(thumbHeight / 2 - height / 2), | ||
| left : Math.floor(thumbWidth / 2 - width / 2) | ||
| }); | ||
|
|
||
| parent.width(thumbWidth).height(thumbHeight); | ||
|
|
||
| $(this).hide().appendTo(parent).fadeIn(300); | ||
|
|
||
| }).attr('src', href); | ||
| }); | ||
|
|
||
| //Set initial width | ||
| this.width = this.list.children().eq(0).outerWidth(true); | ||
|
|
||
| this.list.width(this.width * (obj.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))); | ||
| }, | ||
|
|
||
| beforeLoad: function (opts, obj) { | ||
| //Remove self if gallery do not have at least two items | ||
| if (obj.group.length < 2) { | ||
| obj.helpers.thumbs = false; | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| //Increase bottom margin to give space for thumbs | ||
| obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15); | ||
| }, | ||
|
|
||
| afterShow: function (opts, obj) { | ||
| //Check if exists and create or update list | ||
| if (this.list) { | ||
| this.onUpdate(opts, obj); | ||
|
|
||
| } else { | ||
| this.init(opts, obj); | ||
| } | ||
|
|
||
| //Set active element | ||
| this.list.children().removeClass('active').eq(obj.index).addClass('active'); | ||
| }, | ||
|
|
||
| //Center list | ||
| onUpdate: function (opts, obj) { | ||
| if (this.list) { | ||
| this.list.stop(true).animate({ | ||
| 'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)) | ||
| }, 150); | ||
| } | ||
| }, | ||
|
|
||
| beforeClose: function () { | ||
| if (this.wrap) { | ||
| this.wrap.remove(); | ||
| } | ||
|
|
||
| this.wrap = null; | ||
| this.list = null; | ||
| this.width = 0; | ||
| } | ||
| } | ||
|
|
||
| }(jQuery)); |
| @@ -0,0 +1,274 @@ | ||
| /*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ | ||
| .fancybox-wrap, | ||
| .fancybox-skin, | ||
| .fancybox-outer, | ||
| .fancybox-inner, | ||
| .fancybox-image, | ||
| .fancybox-wrap iframe, | ||
| .fancybox-wrap object, | ||
| .fancybox-nav, | ||
| .fancybox-nav span, | ||
| .fancybox-tmp | ||
| { | ||
| padding: 0; | ||
| margin: 0; | ||
| border: 0; | ||
| outline: none; | ||
| vertical-align: top; | ||
| } | ||
|
|
||
| .fancybox-wrap { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| z-index: 8020; | ||
| } | ||
|
|
||
| .fancybox-skin { | ||
| position: relative; | ||
| background: #f9f9f9; | ||
| color: #444; | ||
| text-shadow: none; | ||
| -webkit-border-radius: 4px; | ||
| -moz-border-radius: 4px; | ||
| border-radius: 4px; | ||
| } | ||
|
|
||
| .fancybox-opened { | ||
| z-index: 8030; | ||
| } | ||
|
|
||
| .fancybox-opened .fancybox-skin { | ||
| -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); | ||
| -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); | ||
| box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); | ||
| } | ||
|
|
||
| .fancybox-outer, .fancybox-inner { | ||
| position: relative; | ||
| } | ||
|
|
||
| .fancybox-inner { | ||
| overflow: hidden; | ||
| } | ||
|
|
||
| .fancybox-type-iframe .fancybox-inner { | ||
| -webkit-overflow-scrolling: touch; | ||
| } | ||
|
|
||
| .fancybox-error { | ||
| color: #444; | ||
| font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; | ||
| margin: 0; | ||
| padding: 15px; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .fancybox-image, .fancybox-iframe { | ||
| display: block; | ||
| width: 100%; | ||
| height: 100%; | ||
| } | ||
|
|
||
| .fancybox-image { | ||
| max-width: 100%; | ||
| max-height: 100%; | ||
| } | ||
|
|
||
| #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { | ||
| background-image: url('fancybox_sprite.png'); | ||
| } | ||
|
|
||
| #fancybox-loading { | ||
| position: fixed; | ||
| top: 50%; | ||
| left: 50%; | ||
| margin-top: -22px; | ||
| margin-left: -22px; | ||
| background-position: 0 -108px; | ||
| opacity: 0.8; | ||
| cursor: pointer; | ||
| z-index: 8060; | ||
| } | ||
|
|
||
| #fancybox-loading div { | ||
| width: 44px; | ||
| height: 44px; | ||
| background: url('fancybox_loading.gif') center center no-repeat; | ||
| } | ||
|
|
||
| .fancybox-close { | ||
| position: absolute; | ||
| top: -18px; | ||
| right: -18px; | ||
| width: 36px; | ||
| height: 36px; | ||
| cursor: pointer; | ||
| z-index: 8040; | ||
| } | ||
|
|
||
| .fancybox-nav { | ||
| position: absolute; | ||
| top: 0; | ||
| width: 40%; | ||
| height: 100%; | ||
| cursor: pointer; | ||
| text-decoration: none; | ||
| background: transparent url('blank.gif'); /* helps IE */ | ||
| -webkit-tap-highlight-color: rgba(0,0,0,0); | ||
| z-index: 8040; | ||
| } | ||
|
|
||
| .fancybox-prev { | ||
| left: 0; | ||
| } | ||
|
|
||
| .fancybox-next { | ||
| right: 0; | ||
| } | ||
|
|
||
| .fancybox-nav span { | ||
| position: absolute; | ||
| top: 50%; | ||
| width: 36px; | ||
| height: 34px; | ||
| margin-top: -18px; | ||
| cursor: pointer; | ||
| z-index: 8040; | ||
| visibility: hidden; | ||
| } | ||
|
|
||
| .fancybox-prev span { | ||
| left: 10px; | ||
| background-position: 0 -36px; | ||
| } | ||
|
|
||
| .fancybox-next span { | ||
| right: 10px; | ||
| background-position: 0 -72px; | ||
| } | ||
|
|
||
| .fancybox-nav:hover span { | ||
| visibility: visible; | ||
| } | ||
|
|
||
| .fancybox-tmp { | ||
| position: absolute; | ||
| top: -99999px; | ||
| left: -99999px; | ||
| visibility: hidden; | ||
| max-width: 99999px; | ||
| max-height: 99999px; | ||
| overflow: visible !important; | ||
| } | ||
|
|
||
| /* Overlay helper */ | ||
|
|
||
| .fancybox-lock { | ||
| overflow: hidden !important; | ||
| width: auto; | ||
| } | ||
|
|
||
| .fancybox-lock body { | ||
| overflow: hidden !important; | ||
| } | ||
|
|
||
| .fancybox-lock-test { | ||
| overflow-y: hidden !important; | ||
| } | ||
|
|
||
| .fancybox-overlay { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| overflow: hidden; | ||
| display: none; | ||
| z-index: 8010; | ||
| background: url('fancybox_overlay.png'); | ||
| } | ||
|
|
||
| .fancybox-overlay-fixed { | ||
| position: fixed; | ||
| bottom: 0; | ||
| right: 0; | ||
| } | ||
|
|
||
| .fancybox-lock .fancybox-overlay { | ||
| overflow: auto; | ||
| overflow-y: scroll; | ||
| } | ||
|
|
||
| /* Title helper */ | ||
|
|
||
| .fancybox-title { | ||
| visibility: hidden; | ||
| font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; | ||
| position: relative; | ||
| text-shadow: none; | ||
| z-index: 8050; | ||
| } | ||
|
|
||
| .fancybox-opened .fancybox-title { | ||
| visibility: visible; | ||
| } | ||
|
|
||
| .fancybox-title-float-wrap { | ||
| position: absolute; | ||
| bottom: 0; | ||
| right: 50%; | ||
| margin-bottom: -35px; | ||
| z-index: 8050; | ||
| text-align: center; | ||
| } | ||
|
|
||
| .fancybox-title-float-wrap .child { | ||
| display: inline-block; | ||
| margin-right: -100%; | ||
| padding: 2px 20px; | ||
| background: transparent; /* Fallback for web browsers that doesn't support RGBa */ | ||
| background: rgba(0, 0, 0, 0.8); | ||
| -webkit-border-radius: 15px; | ||
| -moz-border-radius: 15px; | ||
| border-radius: 15px; | ||
| text-shadow: 0 1px 2px #222; | ||
| color: #FFF; | ||
| font-weight: bold; | ||
| line-height: 24px; | ||
| white-space: nowrap; | ||
| } | ||
|
|
||
| .fancybox-title-outside-wrap { | ||
| position: relative; | ||
| margin-top: 10px; | ||
| color: #fff; | ||
| } | ||
|
|
||
| .fancybox-title-inside-wrap { | ||
| padding-top: 10px; | ||
| } | ||
|
|
||
| .fancybox-title-over-wrap { | ||
| position: absolute; | ||
| bottom: 0; | ||
| left: 0; | ||
| color: #fff; | ||
| padding: 10px; | ||
| background: #000; | ||
| background: rgba(0, 0, 0, .8); | ||
| } | ||
|
|
||
| /*Retina graphics!*/ | ||
| @media only screen and (-webkit-min-device-pixel-ratio: 1.5), | ||
| only screen and (min--moz-device-pixel-ratio: 1.5), | ||
| only screen and (min-device-pixel-ratio: 1.5){ | ||
|
|
||
| #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { | ||
| background-image: url('fancybox_sprite@2x.png'); | ||
| background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/ | ||
| } | ||
|
|
||
| #fancybox-loading div { | ||
| background-image: url('fancybox_loading@2x.gif'); | ||
| background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/ | ||
| } | ||
| } |
| @@ -0,0 +1,22 @@ | ||
| Copyright (c) 2014 The Financial Times Ltd. | ||
|
|
||
| Permission is hereby granted, free of charge, to any person | ||
| obtaining a copy of this software and associated documentation | ||
| files (the "Software"), to deal in the Software without | ||
| restriction, including without limitation the rights to use, | ||
| copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the | ||
| Software is furnished to do so, subject to the following | ||
| conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be | ||
| included in all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
| OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
| HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
| WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| OTHER DEALINGS IN THE SOFTWARE. |
| @@ -0,0 +1,70 @@ | ||
| <h1 id="FastClick">FastClick</h1><p>FastClick is a simple, easy-to-use library for eliminating the 300ms delay between a physical tap and the firing of a <code>click</code> event on mobile browsers. The aim is to make your application feel less laggy and more responsive while avoiding any interference with your current logic.</p> | ||
| <p>FastClick is developed by <a href="http://labs.ft.com/">FT Labs</a>, part of the Financial Times.</p> | ||
| <p><a href="http://maxime.sh/2013/02/supprimer-le-lag-des-clics-sur-mobile-avec-fastclick/">Explication en français</a>.</p> | ||
| <p><a href="https://developer.mozilla.org/ja/docs/Mozilla/Firefox_OS/Apps/Tips_and_techniques#Make_events_immediate">日本語で説明</a>。</p> | ||
| <h2 id="Why_does_the_delay_exist?">Why does the delay exist?</h2><p>According to <a href="https://developers.google.com/mobile/articles/fast_buttons">Google</a>:</p> | ||
| <blockquote> | ||
| <p>…mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.</p> | ||
| </blockquote> | ||
| <h2 id="Compatibility">Compatibility</h2><p>The library has been deployed as part of the <a href="http://app.ft.com/">FT Web App</a> and is tried and tested on the following mobile browsers:</p> | ||
| <ul> | ||
| <li>Mobile Safari on iOS 3 and upwards</li> | ||
| <li>Chrome on iOS 5 and upwards</li> | ||
| <li>Chrome on Android (ICS)</li> | ||
| <li>Opera Mobile 11.5 and upwards</li> | ||
| <li>Android Browser since Android 2</li> | ||
| <li>PlayBook OS 1 and upwards</li> | ||
| </ul> | ||
| <h2 id="When_it_isn’t_needed">When it isn’t needed</h2><p>FastClick doesn’t attach any listeners on desktop browsers.</p> | ||
| <p>Chrome 32+ on Android with <code>width=device-width</code> in the <a href="https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag">viewport meta tag</a> doesn’t have a 300ms delay, therefore listeners aren’t attached.</p> | ||
| <pre><code class="html"><span class="tag"><<span class="title">meta</span> <span class="attribute">name</span>=<span class="value">"viewport"</span> <span class="attribute">content</span>=<span class="value">"width=device-width, initial-scale=1"</span>></span> | ||
| </code></pre> | ||
| <p>Same goes for Chrome on Android (all versions) with <code>user-scalable=no</code> in the viewport meta tag. But be aware that <code>user-scalable=no</code> also disables pinch zooming, which may be an accessibility concern.</p> | ||
| <p>For IE11+, you can use <code>touch-action: manipulation;</code> to disable double-tap-to-zoom on certain elements (like links and buttons). For IE10 use <code>-ms-touch-action: manipulation</code>.</p> | ||
| <h2 id="Usage">Usage</h2><p>Include fastclick.js in your JavaScript bundle or add it to your HTML page like this:</p> | ||
| <pre><code class="html"><span class="tag"><<span class="title">script</span> <span class="attribute">type</span>=<span class="value">'application/javascript'</span> <span class="attribute">src</span>=<span class="value">'/path/to/fastclick.js'</span>></span><span class="undefined"></span><span class="tag"></<span class="title">script</span>></span> | ||
| </code></pre> | ||
| <p>The script must be loaded prior to instantiating FastClick on any element of the page.</p> | ||
| <p>To instantiate FastClick on the <code>body</code>, which is the recommended method of use:</p> | ||
| <pre><code class="js"><span class="keyword">if</span> (<span class="string">'addEventListener'</span> <span class="keyword">in</span> <span class="built_in">document</span>) { | ||
| <span class="built_in">document</span>.addEventListener(<span class="string">'DOMContentLoaded'</span>, <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{ | ||
| FastClick.attach(<span class="built_in">document</span>.body); | ||
| }, <span class="literal">false</span>); | ||
| } | ||
| </code></pre> | ||
| <p>Or, if you’re using jQuery:</p> | ||
| <pre><code class="js">$(<span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>{ | ||
| FastClick.attach(<span class="built_in">document</span>.body); | ||
| }); | ||
| </code></pre> | ||
| <p>If you’re using Browserify or another CommonJS-style module system, the <code>FastClick.attach</code> function will be returned when you call <code>require('fastclick')</code>. As a result, the easiest way to use FastClick with these loaders is as follows:</p> | ||
| <pre><code class="js"><span class="keyword">var</span> attachFastClick = <span class="built_in">require</span>(<span class="string">'fastclick'</span>); | ||
| attachFastClick(<span class="built_in">document</span>.body); | ||
| </code></pre> | ||
| <h3 id="Minified">Minified</h3><p>Run <code>make</code> to build a minified version of FastClick using the Closure Compiler REST API. The minified file is saved to <code>build/fastclick.min.js</code> or you can <a href="http://build.origami.ft.com/bundles/js?modules=fastclick">download a pre-minified version</a>.</p> | ||
| <p>Note: the pre-minified version is built using <a href="http://origami.ft.com/docs/developer-guide/build-service/">our build service</a> which exposes the <code>FastClick</code> object through <code>Origami.fastclick</code> and will have the Browserify/CommonJS API (see above).</p> | ||
| <pre><code class="js"><span class="keyword">var</span> attachFastClick = Origami.fastclick; | ||
| attachFastClick(<span class="built_in">document</span>.body); | ||
| </code></pre> | ||
| <h3 id="AMD">AMD</h3><p>FastClick has AMD (Asynchronous Module Definition) support. This allows it to be lazy-loaded with an AMD loader, such as <a href="http://requirejs.org/">RequireJS</a>. Note that when using the AMD style require, the full <code>FastClick</code> object will be returned, <em>not</em> <code>FastClick.attach</code></p> | ||
| <pre><code class="js"><span class="keyword">var</span> FastClick = <span class="built_in">require</span>(<span class="string">'fastclick'</span>); | ||
| FastClick.attach(<span class="built_in">document</span>.body, options); | ||
| </code></pre> | ||
| <h3 id="Package_managers">Package managers</h3><p>You can install FastClick using <a href="https://github.com/component/component">Component</a>, <a href="https://npmjs.org/package/fastclick">npm</a> or <a href="http://bower.io/">Bower</a>.</p> | ||
| <p>For Ruby, there’s a third-party gem called <a href="http://rubygems.org/gems/fastclick-rails">fastclick-rails</a>. For .NET there’s a <a href="http://nuget.org/packages/FastClick">NuGet package</a>.</p> | ||
| <h2 id="Advanced">Advanced</h2><h3 id="Ignore_certain_elements_with_needsclick">Ignore certain elements with <code>needsclick</code></h3><p>Sometimes you need FastClick to ignore certain elements. You can do this easily by adding the <code>needsclick</code> class.</p> | ||
| <pre><code class="html"><span class="tag"><<span class="title">a</span> <span class="attribute">class</span>=<span class="value">"needsclick"</span>></span>Ignored by FastClick<span class="tag"></<span class="title">a</span>></span> | ||
| </code></pre> | ||
| <h4 id="Use_case_1:_non-synthetic_click_required">Use case 1: non-synthetic click required</h4><p>Internally, FastClick uses <code>document.createEvent</code> to fire a synthetic <code>click</code> event as soon as <code>touchend</code> is fired by the browser. It then suppresses the additional <code>click</code> event created by the browser after that. In some cases, the non-synthetic <code>click</code> event created by the browser is required, as described in the <a href="http://ftlabs.github.com/fastclick/examples/focus.html">triggering focus example</a>.</p> | ||
| <p>This is where the <code>needsclick</code> class comes in. Add the class to any element that requires a non-synthetic click.</p> | ||
| <h4 id="Use_case_2:_Twitter_Bootstrap_2-2-2_dropdowns">Use case 2: Twitter Bootstrap 2.2.2 dropdowns</h4><p>Another example of when to use the <code>needsclick</code> class is with dropdowns in Twitter Bootstrap 2.2.2. Bootstrap add its own <code>touchstart</code> listener for dropdowns, so you want to tell FastClick to ignore those. If you don’t, touch devices will automatically close the dropdown as soon as it is clicked, because both FastClick and Bootstrap execute the synthetic click, one opens the dropdown, the second closes it immediately after.</p> | ||
| <pre><code class="html"><span class="tag"><<span class="title">a</span> <span class="attribute">class</span>=<span class="value">"dropdown-toggle needsclick"</span> <span class="attribute">data-toggle</span>=<span class="value">"dropdown"</span>></span>Dropdown<span class="tag"></<span class="title">a</span>></span> | ||
| </code></pre> | ||
| <h2 id="Examples">Examples</h2><p>FastClick is designed to cope with many different browser oddities. Here are some examples to illustrate this:</p> | ||
| <ul> | ||
| <li><a href="http://ftlabs.github.com/fastclick/examples/layer.html">basic use</a> showing the increase in perceived responsiveness</li> | ||
| <li><a href="http://ftlabs.github.com/fastclick/examples/focus.html">triggering focus</a> on an input element from a <code>click</code> handler</li> | ||
| <li><a href="http://ftlabs.github.com/fastclick/examples/input.html">input element</a> which never receives clicks but gets fast focus</li> | ||
| </ul> | ||
| <h2 id="Tests">Tests</h2><p>There are no automated tests. The files in <code>tests/</code> are manual reduced test cases. We’ve had a think about how best to test these cases, but they tend to be very browser/device specific and sometimes subjective which means it’s not so trivial to test.</p> | ||
| <h2 id="Credits_and_collaboration">Credits and collaboration</h2><p>FastClick is maintained by <a href="http://twitter.com/rowanbeentje">Rowan Beentje</a>, <a href="http://twitter.com/mcaruanagalizia">Matthew Caruana Galizia</a> and <a href="http://twitter.com/andrewsmatt">Matthew Andrews</a> at <a href="http://labs.ft.com">FT Labs</a>. All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.</p> |
| @@ -0,0 +1 @@ | ||
| {"name":"fastclick","main":"lib/fastclick.js","ignore":["**/.*","component.json","package.json","Makefile","tests","examples"]} |
| @@ -0,0 +1 @@ | ||
| {"name":"velocity","version":"1.2.2","homepage":"http://velocityjs.org","authors":[{"name":"Julian Shapiro","homepage":"http://julian.com/"}],"description":"Accelerated JavaScript animation.","main":["./velocity.js","./velocity.ui.js"],"keywords":["animation","jquery","animate","lightweight","smooth","ui","velocity.js","velocityjs","javascript"],"license":"MIT","ignore":["*.json","!/bower.json","LICENSE","*.md"],"dependencies":{"jquery":"*"},"repository":{"type":"git","url":"http://github.com/julianshapiro/velocity.git"}} |