├── index.js ├── public ├── add.html ├── form.html ├── add.scss └── form.scss ├── .gitignore ├── src ├── styler.js ├── jst.js └── main.js ├── .editorconfig ├── .jshintrc ├── bin ├── .hook_template └── hook.js ├── bower.json ├── package.json ├── README.md ├── index.html ├── Gulpfile.js └── dist ├── comments.min.js └── comments.js /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require("./src/main"); -------------------------------------------------------------------------------- /public/add.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | node_modules 3 | dist/assets 4 | dist/clappr.js 5 | dist/clappr.min.js -------------------------------------------------------------------------------- /src/styler.js: -------------------------------------------------------------------------------- 1 | var JST = require('./jst'); 2 | var $ = require('clappr-zepto'); 3 | 4 | var Styler = { 5 | getStyleFor: function(name) { 6 | return $('').html(JST.CSS[name].toString()); 7 | } 8 | }; 9 | 10 | module.exports = Styler; -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailing": true, 3 | "node": true, 4 | "quotmark": false, 5 | "asi": true, 6 | "expr": true, 7 | "esnext": true, 8 | "eqeqeq": true, 9 | "noempty": true, 10 | "unused": true, 11 | "unused": true, 12 | "trailing": true, 13 | "smarttabs": true, 14 | "white": true 15 | } 16 | 17 | -------------------------------------------------------------------------------- /bin/.hook_template: -------------------------------------------------------------------------------- 1 | //This file is generated by bin/hook.js 2 | var template = require('lodash.template'); 3 | module.exports = { 4 | <% templates.forEach(function(template) { %> 5 | '<%= template.name %>': template('<%= template.content %>'), 6 | <% }); %> 7 | CSS: { 8 | <% styles.forEach(function(style) { %> 9 | '<%= style.name %>': '<%= style.content %>', 10 | <% }); %> 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /public/form.html: -------------------------------------------------------------------------------- 1 |
2 | <%- addAt %> 0 <%- minutes %> 3 |
4 |
5 |
6 | 7 |
8 | 9 |
10 | 11 | 12 |
13 | 14 |
15 |
16 |
17 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "clappr-comment-plugin", 3 | "main": "dist/comments.min.js", 4 | "version": "0.0.1", 5 | "homepage": "https://github.com/Metrakit/clappr-comment-plugin", 6 | "description": "A Clappr plugin for make your videos more social", 7 | "keywords": [ 8 | "clappr", 9 | "comments", 10 | "plugin", 11 | "social" 12 | ], 13 | "authors": [ 14 | "Metrakit (http://jordane.net)" 15 | ], 16 | "license": "MIT", 17 | "ignore": [ 18 | "**/.*", 19 | "node_modules", 20 | "bower_components", 21 | "build", 22 | "dist/assets", 23 | "dist/clappr.js", 24 | "dist/clappr.min.js" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "comments", 3 | "version": "0.0.0", 4 | "dependencies": { 5 | "clappr": "latest", 6 | "clappr-zepto": "latest" 7 | }, 8 | "browserify-shim": { 9 | "Clappr": "Clappr" 10 | }, 11 | "devDependencies": { 12 | "browserify": "^6.2.0", 13 | "babelify": "5.0.3", 14 | "gulp": "^3.8.6", 15 | "gulp-minify-css": "^0.3.6", 16 | "lodash.template" : "3.5.1", 17 | "gulp-rename": "^1.2.0", 18 | "gulp-sass": "^0.7.2", 19 | "vinyl-source-stream": "^1.0.0", 20 | "yargs": "latest", 21 | "glob": "^4.0.4", 22 | "mkdirp": "^0.5.0", 23 | "express": "^4.6.1", 24 | "gulp-util": "latest", 25 | "gulp-uglify": "^1.0.1", 26 | "gulp-livereload": "^2.1.0", 27 | "gulp-streamify": "0.0.5" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bin/hook.js: -------------------------------------------------------------------------------- 1 | // Copyright 2014 Globo.com Clappr authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | var glob = require('glob').sync; 6 | var mkdirp = require('mkdirp').sync; 7 | var path = require('path'); 8 | var fs = require('fs'); 9 | var template = require('lodash.template'); 10 | 11 | 12 | var codeTemplate = template(fs.readFileSync('bin/.hook_template').toString()); 13 | 14 | var jstFile = './src/jst.js'; 15 | 16 | function format(filePath) { 17 | return fs.readFileSync(filePath).toString().replace(/\r?\n|\r/g, ''); 18 | } 19 | 20 | 21 | function copyFiles(asset) { 22 | var targetDir = path.extname(asset) === '.js' ? 'dist/' : 'dist/assets'; 23 | fs.createReadStream(asset) 24 | .pipe(fs.createWriteStream(path.join(targetDir, path.basename(asset)))); 25 | } 26 | 27 | 28 | 29 | var html = [ 30 | {name: 'add', content: glob('build/add.html').map(format)}, 31 | {name: 'form', content: glob('build/form.html').map(format)}, 32 | ]; 33 | 34 | var css = [ 35 | {name: 'add', content: glob('build/add.css').map(format)}, 36 | {name: 'form', content: glob('build/form.css').map(format)}, 37 | ]; 38 | 39 | 40 | fs.writeFileSync(jstFile, codeTemplate({templates: html, styles: css})); 41 | 42 | mkdirp('dist/assets/'); 43 | 44 | glob('./node_modules/clappr/dist/**/*.{png,jpeg,jpg,gif,swf,eot,ttf,svg}').map(copyFiles); 45 | glob('public/*.{png,jpeg,jpg,gif,swf,eot,ttf,svg}').map(copyFiles); 46 | glob('./node_modules/clappr/dist/*.js').map(copyFiles); -------------------------------------------------------------------------------- /public/add.scss: -------------------------------------------------------------------------------- 1 | $live-color: #ff0101; 2 | $dvr-color: #fff; 3 | $vod-color: #005aff; 4 | 5 | $disabled-opacity: 0.3; 6 | 7 | $control-height: 32px; 8 | $circle-radius: 3.5px; 9 | 10 | .comments-controls[data-comments-controls] { 11 | display: inline-block; 12 | float: left; 13 | color: $dvr-color; 14 | line-height: 32px; 15 | font-size: 10px; 16 | font-weight: bold; 17 | margin-right: 3px; 18 | 19 | .add-comment { 20 | cursor: pointer; 21 | opacity: .8; 22 | font-weight:lighter; 23 | &:before { 24 | font-size: 16px; 25 | } 26 | &:hover { 27 | text-shadow: rgba(255,255,255,.8) 0 0 5px; 28 | opacity: 1; 29 | } 30 | } 31 | 32 | } 33 | 34 | 35 | .comments-bar { 36 | display: inline-block; 37 | float: left; 38 | line-height: 32px; 39 | font-size: 10px; 40 | font-weight: bold; 41 | margin-left: 6px; 42 | } 43 | 44 | .comment-pointer { 45 | position: absolute; 46 | left: 20px; 47 | top: 8px; 48 | 49 | width: 2px; 50 | height:8px; 51 | background: lightgreen; 52 | 53 | color: lightgreen; 54 | transition: background 0.2s linear; 55 | 56 | &:hover { 57 | background: red; 58 | } 59 | } 60 | 61 | .video-comment { 62 | color: white; 63 | text-align: left; 64 | font-size: 12px !important; 65 | } 66 | 67 | .comment-actif { 68 | padding: 5px !important; 69 | } 70 | 71 | .img-comment { 72 | img { 73 | max-width: 200px; 74 | max-height: 200px; 75 | } 76 | min-width: 100px; 77 | min-height: 50px; 78 | .spinner-three-bounce { 79 | top: 25%; 80 | &> div { 81 | width: 10px; 82 | height: 10px; 83 | } 84 | } 85 | 86 | } 87 | 88 | 89 | // Modification du core 90 | 91 | .media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] { 92 | z-index: 99; 93 | } 94 | 95 | .seek-time[data-seek-time] { 96 | height: initial !important; 97 | } -------------------------------------------------------------------------------- /public/form.scss: -------------------------------------------------------------------------------- 1 | .form-comment { 2 | .form-comment-header { 3 | padding: 2px 5px 2px 5px; 4 | background: #888888; 5 | border-top-left-radius: 5px; 6 | border-top-right-radius: 5px; 7 | } 8 | 9 | form { 10 | padding: 5px !important; 11 | } 12 | 13 | img { 14 | max-height: 50px; 15 | max-width: 100px; 16 | } 17 | 18 | // RAZ (Bootstrap, ...) 19 | button, input, textarea { 20 | font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; 21 | font-size: initial; 22 | line-height: initial; 23 | color: initial; 24 | } 25 | p { 26 | color: initial; 27 | font-size: initial !important; 28 | } 29 | 30 | input[type="file"] { 31 | width: 0.1px; 32 | height: 0.1px; 33 | opacity: 0; 34 | overflow: hidden; 35 | position: absolute; 36 | z-index: -1; 37 | } 38 | 39 | input[type="file"] + label, button[type="button"] { 40 | display: inline-block; 41 | padding: 2px 5px 2px 5px; 42 | font-size: 1.25em; 43 | font-weight: 700; 44 | } 45 | 46 | input[type="file"] + label { 47 | color: white; 48 | background-color: black; 49 | cursor: pointer; 50 | } 51 | 52 | button[type="button"] { 53 | color: white; 54 | background-color: green; 55 | cursor: pointer; 56 | border: 0; 57 | line-height: 1.4; 58 | } 59 | 60 | input[type="file"]:focus + label, 61 | input[type="file"] + label:hover, 62 | button[type="button"]:focus, 63 | button[type="button"]:hover { 64 | background-color: red; 65 | } 66 | 67 | .text-center { 68 | text-align: center; 69 | } 70 | 71 | position: absolute; 72 | width: 50%; 73 | margin-left: auto; 74 | margin-right: auto; 75 | text-align: left; 76 | background: white; 77 | right:5px; 78 | bottom: 100px; 79 | z-index: 999999; 80 | visibility: hidden; 81 | opacity: 0; 82 | transition: hidden 0s 0.2s, opacity 0.2s linear; 83 | 84 | border-radius: 5px; 85 | 86 | // peut etre pas necessaire 87 | cursor: default; 88 | 89 | textarea { 90 | width: 100%; 91 | } 92 | 93 | .submit-comment { 94 | display: inline-block; 95 | //text-align:center; 96 | } 97 | 98 | } 99 | 100 | .show-form { 101 | visibility: visible; 102 | opacity: .9; 103 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Clappr Comment plugin 2 | ================== 3 | 4 | > A plugin for add comments and show comments on the seekbar of the Clappr HTML5 player 5 | 6 | ## Requirements 7 | 8 | Clappr player: https://github.com/clappr/clappr 9 | 10 | ## Install 11 | 12 | ### Bower 13 | 14 | ``` 15 | $ bower install clappr-comment-plugin 16 | ``` 17 | 18 | ### Git 19 | 20 | ``` 21 | $ git clone https://github.com/Metrakit/clappr-comment-plugin 22 | ``` 23 | 24 | ### CDN (jsDelivr) 25 | 26 | ``` 27 | https://cdn.jsdelivr.net/clappr.comment/latest/comments.min.js 28 | ``` 29 | 30 | ### Using the Plugin 31 | 32 | Add both Clappr and Comments plugin scripts to your HTML: 33 | 34 | ```html 35 | 36 | 37 | 38 | 39 | 40 | 41 | ``` 42 | Add the comments Plugin in the Clappr configuration 43 | ```javascript 44 | var player = new Clappr.Player({ 45 | ... 46 | plugins: { 47 | core: [Comments] 48 | }, 49 | ... 50 | ``` 51 | 52 | You can also add some options : 53 | ```javascript 54 | plugins: { 55 | core: [Comments] 56 | }, 57 | 58 | // Comment options 59 | videoId: 1, 60 | urlGetComments: "http://localhost/comments-video", 61 | urlAddComments: "http://localhost/submit-comment", 62 | iconComment: "fa fa-comment-o", 63 | iconFont: "FontAwesome", 64 | pointerColor: "orange", 65 | enablePicture: true, 66 | texts: { 67 | addComment: 'Add a comment at', 68 | addCommentLink: "Comment", 69 | minutes: "minutes", 70 | commentPlaceholder: "Put a comment here", 71 | sendComment: "Send" 72 | } 73 | ``` 74 | 75 | ### Options availables 76 | 77 | - videoId : (integer) Id of the video 78 | - urlGetComments : (string) the URL for get the comments 79 | - urlAddComments : (string) the URL for add the comments 80 | - iconComment : (string) the icon for add a comment 81 | - iconFont : (string) the font for the icons 82 | - pointerColor : the color of the cursors on the seekbar 83 | - enablePicture : (boolean) availability to add pictures in the comments 84 | - texts : multiple texts to translate 85 | 86 | ## Demo 87 | 88 | http://labs.jordane.net/clappr-comment 89 | 90 | 91 | ## Author 92 | 93 | - Metrakit (Jordane Jouffroy) : contact@jordane.net 94 | 95 | ## Credits 96 | 97 | The Clappr Team : https://github.com/clappr/clappr/graphs/contributors 98 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | Clappr comment plugin - Labs of Jordane 16 | 47 | 48 | 55 | 56 | 57 | 58 | 59 |
60 | 61 |

Clappr comment plugin

62 | 63 |
64 | 65 |

Repository: https://github.com/metrakit/clappr-comment-plugin

66 | 67 |

Options

68 | 69 |
70 |       urlGetComments: "http://localhost/comments-video",
71 |       urlAddComments: "http://localhost/submit-comment",
72 |       iconComment: "fa fa-comment-o",
73 |       iconFont: "FontAwesome",
74 |       pointerColor: "blue",
75 |       enablePicture: true
76 |     
77 | 78 |
79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /Gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'); 2 | var sass = require('gulp-sass'); 3 | var minifyCSS = require('gulp-minify-css'); 4 | var babelify = require('babelify'); 5 | var rename = require('gulp-rename'); 6 | var browserify = require('browserify'); 7 | var source = require('vinyl-source-stream'); 8 | var exec = require('child_process').exec; 9 | var args = require('yargs').argv; 10 | var express = require('express'); 11 | var util = require('gulp-util'); 12 | var livereload = require('gulp-livereload'); 13 | var uglify = require('gulp-uglify') 14 | var streamify = require('gulp-streamify') 15 | 16 | var files = { 17 | css: 'public/*.css', 18 | scss: 'public/*.scss', 19 | html: 'public/*.html' 20 | }; 21 | 22 | var watch_paths = { 23 | js: ['./*.js', './src/*.js'], 24 | assets: './public/*.{html,scss,css}' 25 | }; 26 | 27 | gulp.task('pre-build', ['sass', 'copy-html', 'copy-css'], function(done) { 28 | return exec('node bin/hook.js', done); 29 | }); 30 | 31 | gulp.task('build', ['pre-build'], function(b) { 32 | return browserify() 33 | .transform(babelify) 34 | .add('./index.js', {entry: true}) 35 | .external('underscore') 36 | .external('zepto') 37 | .bundle() 38 | .pipe(source('main.js')) 39 | .pipe(rename( 'comments.js')) 40 | .pipe(gulp.dest('./dist')); 41 | }); 42 | 43 | gulp.task('release', ['pre-build'], function() { 44 | return browserify() 45 | .transform(babelify) 46 | .add('./index.js', {entry: true}) 47 | .external('underscore') 48 | .external('zepto') 49 | .bundle() 50 | .pipe(source('main.js')) 51 | .pipe(rename( 'comments.min.js')) 52 | .pipe(streamify(uglify())) 53 | .pipe(gulp.dest('./dist')); 54 | }); 55 | 56 | gulp.task('sass', function () { 57 | return gulp.src(files.scss) 58 | .pipe(sass()) 59 | .pipe(minifyCSS()) 60 | .pipe(gulp.dest("build")); 61 | }); 62 | 63 | gulp.task("copy-css", function() { 64 | return gulp.src(files.css) 65 | .pipe(minifyCSS()) 66 | .pipe(gulp.dest('build')); 67 | }); 68 | 69 | gulp.task("copy-html", function() { 70 | return gulp.src(files.html) 71 | .pipe(gulp.dest('build')); 72 | }); 73 | 74 | gulp.task('serve', ['build', 'watch'], function() { 75 | express() 76 | .use(express.static('.')) 77 | .use(express.static('./dist')) 78 | .listen(3000); 79 | util.log(util.colors.bgGreen('Listening on port 3000')); 80 | }); 81 | 82 | 83 | gulp.task('watch', function() { 84 | var reloadServer = livereload(); 85 | 86 | var js = gulp.watch(watch_paths.js); 87 | js.on('change', function(event) { 88 | gulp.start('build', function() { 89 | reloadServer.changed(event.path); 90 | }); 91 | }); 92 | 93 | var assets = gulp.watch(watch_paths.assets); 94 | assets.on('change', function(event) { 95 | gulp.start(['build'], function() { 96 | reloadServer.changed(event.path); 97 | }); 98 | }); 99 | util.log(util.colors.bgGreen('Watching for changes...')); 100 | }); 101 | -------------------------------------------------------------------------------- /src/jst.js: -------------------------------------------------------------------------------- 1 | //This file is generated by bin/hook.js 2 | var template = require('lodash.template'); 3 | module.exports = { 4 | 5 | 'add': template(''), 6 | 7 | 'form': template('
<%- addAt %> 0 <%- minutes %>
'), 8 | 9 | CSS: { 10 | 11 | 'add': '.comments-controls[data-comments-controls]{display:inline-block;float:left;color:#fff;line-height:32px;font-size:10px;font-weight:700;margin-right:3px}.comments-controls[data-comments-controls] .add-comment{cursor:pointer;opacity:.8;font-weight:lighter}.comments-controls[data-comments-controls] .add-comment:before{font-size:16px}.comments-controls[data-comments-controls] .add-comment:hover{text-shadow:rgba(255,255,255,.8) 0 0 5px;opacity:1}.comments-bar{display:inline-block;float:left;line-height:32px;font-size:10px;font-weight:700;margin-left:6px}.comment-pointer{position:absolute;left:20px;top:8px;width:2px;height:8px;background:#90ee90;color:#90ee90;transition:background .2s linear}.comment-pointer:hover{background:red}.video-comment{color:#fff;text-align:left;font-size:12px!important}.comment-actif{padding:5px!important}.img-comment{min-width:100px;min-height:50px}.img-comment img{max-width:200px;max-height:200px}.img-comment .spinner-three-bounce{top:25%}.img-comment .spinner-three-bounce>div{width:10px;height:10px}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar]{z-index:99}.seek-time[data-seek-time]{height:initial!important}', 12 | 13 | 'form': '.form-comment{position:absolute;width:50%;margin-left:auto;margin-right:auto;text-align:left;background:#fff;right:5px;bottom:100px;z-index:999999;visibility:hidden;opacity:0;transition:hidden 0s .2s,opacity .2s linear;border-radius:5px;cursor:default}.form-comment .form-comment-header{padding:2px 5px;background:#888;border-top-left-radius:5px;border-top-right-radius:5px}.form-comment form{padding:5px!important}.form-comment img{max-height:50px;max-width:100px}.form-comment button,.form-comment input,.form-comment textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:initial;line-height:initial;color:initial}.form-comment p{color:initial;font-size:initial!important}.form-comment input[type=file]{width:.1px;height:.1px;opacity:0;overflow:hidden;position:absolute;z-index:-1}.form-comment button[type=button],.form-comment input[type=file]+label{display:inline-block;padding:2px 5px;font-size:1.25em;font-weight:700}.form-comment input[type=file]+label{color:#fff;background-color:#000;cursor:pointer}.form-comment button[type=button]{color:#fff;background-color:green;cursor:pointer;border:0;line-height:1.4}.form-comment button[type=button]:focus,.form-comment button[type=button]:hover,.form-comment input[type=file]+label:hover,.form-comment input[type=file]:focus+label{background-color:red}.form-comment .text-center{text-align:center}.form-comment textarea{width:100%}.form-comment .submit-comment{display:inline-block}.show-form{visibility:visible;opacity:.9}', 14 | 15 | } 16 | }; 17 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | var UICorePlugin = Clappr.UICorePlugin; 2 | var JST = require('./jst'); 3 | var Styler = require('./styler'); 4 | var Events = Clappr.Events; 5 | 6 | class Comments extends UICorePlugin { 7 | 8 | get name() { return 'comments'; } 9 | 10 | get events() { 11 | return { 12 | 'click .add-comment': 'clickOnContainer', 13 | } 14 | } 15 | 16 | get attributes() { 17 | return { 18 | 'class': 'comments-controls', 19 | 'data-comments-controls': '', 20 | } 21 | } 22 | 23 | constructor(core) { 24 | super(core) 25 | this.core = core 26 | this.actualTime = 0 27 | } 28 | 29 | 30 | /** 31 | * Bind events 32 | */ 33 | bindEvents() { 34 | this.listenTo(this.core.mediaControl, 'mediacontrol:rendered', this.make) 35 | this.listenTo(this.core.mediaControl.container, 'container:timeupdate', this.timeUpdate) 36 | this.listenTo(this.core.mediaControl.container, 'container:play', this.play) 37 | } 38 | 39 | 40 | /** 41 | * Render 42 | */ 43 | render() { 44 | this.core.options.commentImg = this.core.options.commentImg != undefined ? this.core.options.commentImg : true; 45 | this.videoId = this.core.$el.parent().attr('data-video-id') 46 | this.make() 47 | } 48 | 49 | 50 | /** 51 | * Event on play 52 | */ 53 | play() { 54 | this.dismissForm() 55 | } 56 | 57 | 58 | /** 59 | * Make the template and prepare the plugin 60 | */ 61 | make() { 62 | // Create new DOM element add a button 63 | var styleAddBtn = Styler.getStyleFor('add'); 64 | console.log(styleAddBtn[0]) 65 | 66 | this.$playButton = this.core.mediaControl.$el.find('.media-control-button'); 67 | this.$el.html(JST.add) 68 | .append(styleAddBtn[0]); 69 | 70 | this.core.mediaControl.$('.media-control-right-panel[data-media-control]').append(this.$el); 71 | 72 | 73 | 74 | // Create new DOM element for add the form 75 | var styleForm = Styler.getStyleFor('form'); 76 | 77 | /** 78 | * Style options 79 | */ 80 | 81 | var styleOptions = '"; 95 | 96 | this.$el.formComment = document.createElement("div") 97 | 98 | if (this.core.options.texts) { 99 | var formText = { 100 | addAt: this.core.options.texts.addComment ? this.core.options.texts.addComment : "Add a comment at", 101 | minutes: this.core.options.texts.minutes ? this.core.options.texts.minutes : "minutes", 102 | placeholder: this.core.options.texts.commentPlaceholder ? this.core.options.texts.commentPlaceholder : "Put a comment here", 103 | send: this.core.options.texts.sendComment ? this.core.options.texts.sendComment : "Send" 104 | } 105 | } else { 106 | var formText = { 107 | addAt: "Add a comment at", 108 | minutes: "minutes", 109 | placeholder: "Put a comment here", 110 | send: "Send" 111 | } 112 | 113 | } 114 | 115 | $(this.$el.formComment).html(JST.form(formText)) 116 | .addClass('form-comment') 117 | .append(styleForm[0]) 118 | .append(styleOptions) 119 | this.core.mediaControl.container.$el.append(this.$el.formComment) 120 | 121 | this.core.mediaControl.container.$el.find('.form-comment').click(function(e) { 122 | e.stopPropagation(); 123 | }); 124 | 125 | 126 | /** 127 | * Options 128 | */ 129 | 130 | // [OPTION] Icon for add a new comment or Text 131 | if (this.core.options.iconComment) { 132 | this.core.mediaControl.$el.find('.add-comment').addClass(this.core.options.iconComment); 133 | } else if (this.core.options.texts && this.core.options.texts.addCommentLink) { 134 | this.core.mediaControl.$el.find('.add-comment').text(this.core.options.texts.addCommentLink); 135 | } else { 136 | this.core.mediaControl.$el.find('.add-comment').text('Comment'); 137 | } 138 | 139 | // [OPTION] Display input file if picture is enabled 140 | if (this.core.options.enablePicture) { 141 | this.core.mediaControl.container.$el.find('input[type="file"]').show(); 142 | } 143 | 144 | 145 | // Generate comment (get the video Id in option) 146 | if (!isNaN(this.core.mediaControl.container.getDuration())) { 147 | this.getComments(this.core.options.videoId) 148 | } else { 149 | this.videoUnReady = true 150 | } 151 | 152 | this.core.mediaControl.container.$el.find('.submit-comment').click(() => this.submitComment(this)); 153 | 154 | this.core.mediaControl.$seekBarContainer.append(this.commentPointer) 155 | 156 | this.core.mediaControl.seekTime.$el.prepend('
') 157 | 158 | $('.form-comment input[type="file"]').change(function(){ 159 | if (this.files && this.files[0]) { 160 | var reader = new FileReader(); 161 | reader.onload = function (e) { 162 | $('.form-comment img').attr('src', e.target.result); 163 | } 164 | reader.readAsDataURL(this.files[0]); 165 | } 166 | }); 167 | 168 | } 169 | 170 | 171 | /** 172 | * Get the comments with API (GET) 173 | * @param Int videoId 174 | */ 175 | getComments(videoId) { 176 | 177 | if (!this.pointers) { 178 | this.pointers = new Array; 179 | // Alert if "urlGetComments" is missing 180 | if (!this.core.options.urlGetComments) { 181 | alert('An url is needed in the options for the API (POST). Option "urlGetComments"'); return; 182 | } 183 | 184 | $.get(this.core.options.urlGetComments + '/' + videoId, (function(data) { 185 | 186 | for(var i = 0; i < data.length; i++) { 187 | this.createCommentPointer(data[i]) 188 | } 189 | 190 | this.displayingComment(this) 191 | }).bind(this)) 192 | 193 | } 194 | } 195 | 196 | 197 | /** 198 | * Display comment when event with mouse 199 | * @param Object this 200 | */ 201 | displayingComment(elem) { 202 | this.core.mediaControl.$seekBarContainer.find('.comment-pointer').on('mouseover', (function(e) { 203 | elem.showComment(elem, this) 204 | })); 205 | this.core.mediaControl.$seekBarContainer.find('.comment-pointer').on('mouseout', () => this.hideComment(this)); 206 | } 207 | 208 | 209 | /** 210 | * Create a comment pointers 211 | * @param Json data[comment, time, imgUrl] 212 | */ 213 | createCommentPointer(data) { 214 | 215 | this.pointers[data.time] = document.createElement("span") 216 | $(this.pointers[data.time]).addClass("comment-pointer") 217 | .attr('data-comment', data.comment) 218 | 219 | if(data.imgUrl) { 220 | $(this.pointers[data.time]).attr('data-imgUrl', data.imgUrl) 221 | } 222 | 223 | this.timePercent = (data.time / this.core.mediaControl.container.getDuration()) * 100 224 | $(this.pointers[data.time]).css('left', this.timePercent + '%'); 225 | 226 | if (!isNaN(this.timePercent)) { 227 | this.core.mediaControl.$seekBarContainer.append(this.pointers[data.time]) 228 | } 229 | 230 | } 231 | 232 | 233 | /** 234 | * Show a comment when hover a pointer 235 | * @param this 236 | * @param DOM pointer 237 | */ 238 | showComment(elem, pointer) { 239 | elem.core.mediaControl.seekTime.$('.video-comment') 240 | .html($(pointer).attr('data-comment')) 241 | .addClass('comment-actif'); 242 | 243 | if (this.core.options.videoId && $(pointer).attr('data-imgUrl')) { 244 | elem.core.mediaControl.seekTime.$('.video-comment').prepend('
') 245 | var img = $("").attr('src', $(pointer).attr('data-imgUrl')); 246 | img.on('load', function(){ 247 | console.log("test") 248 | if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { 249 | // wrong image 250 | } else { 251 | console.log(this) 252 | elem.core.mediaControl.seekTime.$('.img-comment').html(this) 253 | } 254 | }); 255 | } 256 | } 257 | 258 | 259 | /** 260 | * Hide a comment 261 | * @param this 262 | */ 263 | hideComment(elem) { 264 | elem.core.mediaControl.seekTime.$('.video-comment').html('') 265 | .removeClass('comment-actif') 266 | } 267 | 268 | 269 | /** 270 | * Send a new comment to API (POST) 271 | * Data: 272 | * comment (string) 273 | * picture (file, optionnal) 274 | * time (int) 275 | * @param Object this 276 | */ 277 | submitComment(elem) { 278 | 279 | // Alert if "urlAddComments" is missing 280 | if (!this.core.options.urlAddComments) { 281 | alert('An url is needed in the options for the API (POST). Option "urlAddComments"'); return; 282 | } 283 | 284 | var form = elem.core.mediaControl.container.$el.find('form') 285 | var fd = new FormData(); 286 | 287 | // [OPTION] Add input file if enabled 288 | if (this.core.options.enablePicture) { 289 | 290 | var picture = $('input[type="file"]')[1].files; 291 | 292 | if (picture.length == 1) { 293 | fd.append('picture', picture[0]) 294 | } 295 | 296 | } 297 | 298 | // All inputs 299 | var inputs = $(form).serializeArray(); 300 | 301 | $.each(inputs, function(key, input) { 302 | fd.append(input.name, input.value); 303 | }) 304 | fd.append('time', Math.round(elem.actualTime)); 305 | 306 | // Ajax request for send the comment form 307 | $.ajax({ 308 | url: this.core.options.urlAddComments, 309 | type: 'POST', 310 | data: fd, 311 | async: false, 312 | success: function(data){ 313 | elem.createCommentPointer(data) 314 | elem.displayingComment(elem) 315 | elem.dismissForm() 316 | }, 317 | cache: false, 318 | contentType: false, 319 | processData: false 320 | }) 321 | } 322 | 323 | 324 | /** 325 | * Dismiss the form 326 | */ 327 | dismissForm() { 328 | if ($(this.$el.formComment).css('visibility') == "visible") { 329 | $(this.$el.formComment).removeClass('show-form') 330 | } 331 | } 332 | 333 | 334 | /** 335 | * Event when click on container 336 | */ 337 | clickOnContainer() { 338 | 339 | if ($(this.$el.formComment).css('visibility') == "visible") { 340 | $(this.$el.formComment).removeClass('show-form') 341 | } else { 342 | this.core.mediaControl.container.pause() 343 | this.$playButton.addClass('paused') 344 | var actualTime = Math.round(this.actualTime)/100 345 | $(this.$el.formComment).find('.comment-time').text(actualTime) 346 | $(this.$el.formComment).addClass('show-form') 347 | } 348 | 349 | } 350 | 351 | 352 | /** 353 | * Event when time change 354 | * @param Int position 355 | * @param Int duration 356 | */ 357 | timeUpdate(position, duration) { 358 | this.actualTime = position; 359 | 360 | if ($(this.$el.formComment).css('visibility') == "visible") { 361 | $(this.$el.formComment).find('.comment-time').text(Math.round(this.actualTime)/100) 362 | } 363 | 364 | if (this.videoUnReady && this.videoUnReady == true) { 365 | this.getComments(this.core.options.videoId) 366 | this.videoUnReady == false 367 | } 368 | } 369 | 370 | 371 | } 372 | 373 | 374 | module.exports = window.Comments = Comments; -------------------------------------------------------------------------------- /dist/comments.min.js: -------------------------------------------------------------------------------- 1 | !function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var c="function"==typeof require&&require;if(!s&&c)return c(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a0?$.fn.concat.apply([],t):t}function u(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(t){return t in F?F[t]:F[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||D[u(t)]?e:e+"px"}function p(t){var e,n;return N[t]||(e=A.createElement(t),A.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),N[t]=n),N[t]}function h(t){return"children"in t?k.call(t.children):$.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function m(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function d(t,e,n){for(j in e)n&&(i(e[j])||Q(e[j]))?(i(e[j])&&!i(t[j])&&(t[j]={}),Q(e[j])&&!Q(t[j])&&(t[j]=[]),d(t[j],e[j],n)):e[j]!==C&&(t[j]=e[j])}function g(t,e){return null==e?$(t):$(t).filter(e)}function v(t,n,r,o){return e(n)?n.call(t,r,o):n}function y(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function b(t,e){var n=t.className||"",r=n&&n.baseVal!==C;return e===C?r?n.baseVal:n:void(r?n.baseVal=e:t.className=e)}function x(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?$.parseJSON(t):t):t}catch(e){return t}}function w(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)w(t.childNodes[n],e)}var C,j,$,E,T,S,O=[],P=O.concat,_=O.filter,k=O.slice,A=window.document,N={},F={},D={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},M=/^\s*<(\w+|!)[^>]*>/,R=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,L=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,U=/^(?:body|html)$/i,z=/([A-Z])/g,q=["val","css","html","text","data","width","height","offset"],I=["after","prepend","before","append"],B=A.createElement("table"),W=A.createElement("tr"),Z={tr:A.createElement("tbody"),tbody:B,thead:B,tfoot:B,td:W,th:W,"*":A.createElement("div")},H=/complete|loaded|interactive/,X=/^[\w-]*$/,V={},G=V.toString,Y={},J=A.createElement("div"),K={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Q=Array.isArray||function(t){return t instanceof Array};return Y.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,o=t.parentNode,i=!o;return i&&(o=J).appendChild(t),r=~Y.qsa(o,e).indexOf(t),i&&J.removeChild(t),r},T=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},S=function(t){return _.call(t,function(e,n){return t.indexOf(e)==n})},Y.fragment=function(t,e,n){var r,o,a;return R.test(t)&&(r=$(A.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(L,"<$1>")),e===C&&(e=M.test(t)&&RegExp.$1),e in Z||(e="*"),a=Z[e],a.innerHTML=""+t,r=$.each(k.call(a.childNodes),function(){a.removeChild(this)})),i(n)&&(o=$(r),$.each(n,function(t,e){q.indexOf(t)>-1?o[t](e):o.attr(t,e)})),r},Y.Z=function(t,e){return new m(t,e)},Y.isZ=function(t){return t instanceof Y.Z},Y.init=function(t,n){var r;if(!t)return Y.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&M.test(t))r=Y.fragment(t,RegExp.$1,n),t=null;else{if(n!==C)return $(n).find(t);r=Y.qsa(A,t)}else{if(e(t))return $(A).ready(t);if(Y.isZ(t))return t;if(Q(t))r=s(t);else if(o(t))r=[t],t=null;else if(M.test(t))r=Y.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==C)return $(n).find(t);r=Y.qsa(A,t)}}return Y.Z(r,t)},$=function(t,e){return Y.init(t,e)},$.extend=function(t){var e,n=k.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){d(t,n,e)}),t},Y.qsa=function(t,e){var n,r="#"==e[0],o=!r&&"."==e[0],i=r||o?e.slice(1):e,a=X.test(i);return t.getElementById&&a&&r?(n=t.getElementById(i))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:k.call(a&&!r&&t.getElementsByClassName?o?t.getElementsByClassName(i):t.getElementsByTagName(e):t.querySelectorAll(e))},$.contains=A.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},$.type=t,$.isFunction=e,$.isWindow=n,$.isArray=Q,$.isPlainObject=i,$.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},$.inArray=function(t,e,n){return O.indexOf.call(e,t,n)},$.camelCase=T,$.trim=function(t){return null==t?"":String.prototype.trim.call(t)},$.uuid=0,$.support={},$.expr={},$.noop=function(){},$.map=function(t,e){var n,r,o,i=[];if(a(t))for(r=0;r=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return O.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):$(_.call(this,function(e){return Y.matches(e,t)}))},add:function(t,e){return $(S(this.concat($(t,e))))},is:function(t){return this.length>0&&Y.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==C)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):a(t)&&e(t.item)?k.call(t):$(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return $(n)},has:function(t){return this.filter(function(){return o(t)?$.contains(this,t):$(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!o(t)?t:$(t)},last:function(){var t=this[this.length-1];return t&&!o(t)?t:$(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?$(t).filter(function(){var t=this;return O.some.call(n,function(e){return $.contains(e,t)})}):1==this.length?$(Y.qsa(this[0],t)):this.map(function(){return Y.qsa(this,t)}):$()},closest:function(t,e){var n=this[0],o=!1;for("object"==typeof t&&(o=$(t));n&&!(o?o.indexOf(n)>=0:Y.matches(n,t));)n=n!==e&&!r(n)&&n.parentNode;return $(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=$.map(n,function(t){return(t=t.parentNode)&&!r(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return g(e,t)},parent:function(t){return g(S(this.pluck("parentNode")),t)},children:function(t){return g(this.map(function(){return h(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||k.call(this.childNodes)})},siblings:function(t){return g(this.map(function(t,e){return _.call(h(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return $.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=p(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=$(t).get(0),o=r.parentNode||this.length>1;return this.each(function(e){$(this).wrapAll(n?t.call(this,e):o?r.cloneNode(!0):r)})},wrapAll:function(t){if(this[0]){$(this[0]).before(t=$(t));for(var e;(e=t.children()).length;)t=e.first();$(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var r=$(this),o=r.contents(),i=n?t.call(this,e):t;o.length?o.wrapAll(i):r.append(i)})},unwrap:function(){return this.parent().each(function(){$(this).replaceWith($(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=$(this);(t===C?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return $(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return $(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;$(this).empty().append(v(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=v(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(o(t))for(j in t)y(this,j,t[j]);else y(this,t,v(this,e,n,this.getAttribute(t)))}):this.length&&1===this[0].nodeType?!(n=this[0].getAttribute(t))&&t in this[0]?this[0][t]:n:C},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){y(this,t)},this)})},prop:function(t,e){return t=K[t]||t,1 in arguments?this.each(function(n){this[t]=v(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(t,e){var n="data-"+t.replace(z,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?x(r):C},val:function(t){return 0 in arguments?this.each(function(e){this.value=v(this,t,e,this.value)}):this[0]&&(this[0].multiple?$(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=$(this),r=v(this,t,e,n.offset()),o=n.offsetParent().offset(),i={top:r.top-o.top,left:r.left-o.left};"static"==n.css("position")&&(i.position="relative"),n.css(i)});if(!this.length)return null;if(!$.contains(A.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r,o=this[0];if(!o)return;if(r=getComputedStyle(o,""),"string"==typeof e)return o.style[T(e)]||r.getPropertyValue(e);if(Q(e)){var i={};return $.each(e,function(t,e){i[e]=o.style[T(e)]||r.getPropertyValue(e)}),i}}var a="";if("string"==t(e))n||0===n?a=u(e)+":"+f(e,n):this.each(function(){this.style.removeProperty(u(e))});else for(j in e)e[j]||0===e[j]?a+=u(j)+":"+f(j,e[j])+";":this.each(function(){this.style.removeProperty(u(j))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf($(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?O.some.call(this,function(t){return this.test(b(t))},l(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){E=[];var n=b(this),r=v(this,t,e,n);r.split(/\s+/g).forEach(function(t){$(this).hasClass(t)||E.push(t)},this),E.length&&b(this,n+(n?" ":"")+E.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===C)return b(this,"");E=b(this),v(this,t,e,E).split(/\s+/g).forEach(function(t){E=E.replace(l(t)," ")}),b(this,E.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var r=$(this),o=v(this,t,n,b(this));o.split(/\s+/g).forEach(function(t){(e===C?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===C?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===C?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=U.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat($(t).css("margin-top"))||0,n.left-=parseFloat($(t).css("margin-left"))||0,r.top+=parseFloat($(e[0]).css("border-top-width"))||0,r.left+=parseFloat($(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||A.body;t&&!U.test(t.nodeName)&&"static"==$(t).css("position");)t=t.offsetParent;return t})}},$.fn.detach=$.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});$.fn[t]=function(o){var i,a=this[0];return o===C?n(a)?a["inner"+e]:r(a)?a.documentElement["scroll"+e]:(i=this.offset())&&i[t]:this.each(function(e){a=$(this),a.css(t,v(this,o,e,a[t]()))})}}),I.forEach(function(e,n){var r=n%2;$.fn[e]=function(){var e,o,i=$.map(arguments,function(n){return e=t(n),"object"==e||"array"==e||null==n?n:Y.fragment(n)}),a=this.length>1;return i.length<1?this:this.each(function(t,e){o=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=$.contains(A.documentElement,o);i.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!o)return $(t).remove();o.insertBefore(t,e),s&&w(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},$.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return $(t)[e](this),this}}),Y.Z.prototype=m.prototype=$.fn,Y.uniq=S,Y.deserializeValue=x,$.zepto=Y,$}();window.Zepto=r,void 0===window.$&&(window.$=r),function(t){function e(t){return t._zid||(t._zid=p++)}function n(t,n,i,a){if(n=r(n),n.ns)var s=o(n.ns);return(g[e(t)]||[]).filter(function(t){return!(!t||n.e&&t.e!=n.e||n.ns&&!s.test(t.ns)||i&&e(t.fn)!==e(i)||a&&t.sel!=a)})}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function o(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function i(t,e){return t.del&&!y&&t.e in b||!!e}function a(t){return x[t]||y&&b[t]||t}function s(n,o,s,c,l,p,h){var m=e(n),d=g[m]||(g[m]=[]);o.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var o=r(e);o.fn=s,o.sel=l,o.e in x&&(s=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?o.fn.apply(this,arguments):void 0}),o.del=p;var m=p||s;o.proxy=function(t){if(t=u(t),!t.isImmediatePropagationStopped()){t.data=c;var e=m.apply(n,t._args==f?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},o.i=d.length,d.push(o),"addEventListener"in n&&n.addEventListener(a(o.e),o.proxy,i(o,h))})}function c(t,r,o,s,c){var u=e(t);(r||"").split(/\s/).forEach(function(e){n(t,e,o,s).forEach(function(e){delete g[u][e.i],"removeEventListener"in t&&t.removeEventListener(a(e.e),e.proxy,i(e,c))})})}function u(e,n){return(n||!e.isDefaultPrevented)&&(n||(n=e),t.each($,function(t,r){var o=n[t];e[t]=function(){return this[r]=w,o&&o.apply(n,arguments)},e[r]=C}),(n.defaultPrevented!==f?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function l(t){var e,n={originalEvent:t};for(e in t)j.test(e)||t[e]===f||(n[e]=t[e]);return u(n,t)}var f,p=1,h=Array.prototype.slice,m=t.isFunction,d=function(t){return"string"==typeof t},g={},v={},y="onfocusin"in window,b={focus:"focusin",blur:"focusout"},x={mouseenter:"mouseover",mouseleave:"mouseout"};v.click=v.mousedown=v.mouseup=v.mousemove="MouseEvents",t.event={add:s,remove:c},t.proxy=function(n,r){var o=2 in arguments&&h.call(arguments,2);if(m(n)){var i=function(){return n.apply(r,o?o.concat(h.call(arguments)):arguments)};return i._zid=e(n),i}if(d(r))return o?(o.unshift(n[r],n),t.proxy.apply(null,o)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var w=function(){return!0},C=function(){return!1},j=/^([A-Z]|returnValue$|layer[XY]$)/,$={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,o,i){var a,u,p=this;return e&&!d(e)?(t.each(e,function(t,e){p.on(t,n,r,e,i)}),p):(d(n)||m(o)||o===!1||(o=r,r=n,n=f),(o===f||r===!1)&&(o=r,r=f),o===!1&&(o=C),p.each(function(f,p){i&&(a=function(t){return c(p,t.type,o),o.apply(this,arguments)}),n&&(u=function(e){var r,i=t(e.target).closest(n,p).get(0);return i&&i!==p?(r=t.extend(l(e),{currentTarget:i,liveFired:p}),(a||o).apply(i,[r].concat(h.call(arguments,1)))):void 0}),s(p,e,o,r,n,u||a)}))},t.fn.off=function(e,n,r){var o=this;return e&&!d(e)?(t.each(e,function(t,e){o.off(t,n,e)}),o):(d(n)||m(r)||r===!1||(r=n,n=f),r===!1&&(r=C),o.each(function(){c(this,e,r,n)}))},t.fn.trigger=function(e,n){return e=d(e)||t.isPlainObject(e)?t.Event(e):u(e),e._args=n,this.each(function(){e.type in b&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,r){var o,i;return this.each(function(a,s){o=l(d(e)?t.Event(e):e),o._args=r,o.target=s,t.each(n(s,e.type||e),function(t,e){return i=e.proxy(o),o.isImmediatePropagationStopped()?!1:void 0})}),i},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){d(t)||(e=t,t=e.type);var n=document.createEvent(v[t]||"Events"),r=!0;if(e)for(var o in e)"bubbles"==o?r=!!e[o]:n[o]=e[o];return n.initEvent(t,r,!0),u(n)}}(r),function(t){function e(e,n,r){var o=t.Event(n);return t(e).trigger(o,r),!o.isDefaultPrevented()}function n(t,n,r,o){return t.global?e(n||y,r,o):void 0}function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function o(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function i(t,e){var r=e.context;return e.beforeSend.call(r,t,e)===!1||n(e,r,"ajaxBeforeSend",[t,e])===!1?!1:void n(e,r,"ajaxSend",[t,e])}function a(t,e,r,o){var i=r.context,a="success";r.success.call(i,t,a,e),o&&o.resolveWith(i,[t,a,e]),n(r,i,"ajaxSuccess",[e,r,t]),c(a,e,r)}function s(t,e,r,o,i){var a=o.context;o.error.call(a,r,e,t),i&&i.rejectWith(a,[r,e,t]),n(o,a,"ajaxError",[r,o,t||e]),c(e,r,o)}function c(t,e,r){var i=r.context;r.complete.call(i,e,t),n(r,i,"ajaxComplete",[e,r]),o(r)}function u(){}function l(t){return t&&(t=t.split(";",2)[0]),t&&(t==j?"html":t==C?"json":x.test(t)?"script":w.test(t)&&"xml")||"text"}function f(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function p(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=f(e.url,e.data),e.data=void 0)}function h(e,n,r,o){return t.isFunction(n)&&(o=r,r=n,n=void 0),t.isFunction(r)||(o=r,r=void 0),{url:e,data:n,success:r,dataType:o}}function m(e,n,r,o){var i,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,c){i=t.type(c),o&&(n=r?o:o+"["+(s||"object"==i||"array"==i?n:"")+"]"),!o&&a?e.add(c.name,c.value):"array"==i||!r&&"object"==i?m(e,c,r,n):e.add(n,c)})}var d,g,v=0,y=window.document,b=/)<[^<]*)*<\/script>/gi,x=/^(?:text|application)\/javascript/i,w=/^(?:text|application)\/xml/i,C="application/json",j="text/html",$=/^\s*$/,E=y.createElement("a");E.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,o,c=e.jsonpCallback,u=(t.isFunction(c)?c():c)||"jsonp"+ ++v,l=y.createElement("script"),f=window[u],p=function(e){t(l).triggerHandler("error",e||"abort")},h={abort:p};return n&&n.promise(h),t(l).on("load error",function(i,c){clearTimeout(o),t(l).off().remove(),"error"!=i.type&&r?a(r[0],h,e,n):s(null,c||"error",h,e,n),window[u]=f,r&&t.isFunction(f)&&f(r[0]),f=r=void 0}),i(h,e)===!1?(p("abort"),h):(window[u]=function(){r=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+u),y.head.appendChild(l),e.timeout>0&&(o=setTimeout(function(){p("timeout")},e.timeout)),h)},t.ajaxSettings={type:"GET",beforeSend:u,success:u,error:u,complete:u,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:C,xml:"application/xml, text/xml",html:j,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n,o,c=t.extend({},e||{}),h=t.Deferred&&t.Deferred();for(d in t.ajaxSettings)void 0===c[d]&&(c[d]=t.ajaxSettings[d]);r(c),c.crossDomain||(n=y.createElement("a"),n.href=c.url,n.href=n.href,c.crossDomain=E.protocol+"//"+E.host!=n.protocol+"//"+n.host),c.url||(c.url=window.location.toString()),(o=c.url.indexOf("#"))>-1&&(c.url=c.url.slice(0,o)),p(c);var m=c.dataType,v=/\?.+=\?/.test(c.url);if(v&&(m="jsonp"),c.cache!==!1&&(e&&e.cache===!0||"script"!=m&&"jsonp"!=m)||(c.url=f(c.url,"_="+Date.now())),"jsonp"==m)return v||(c.url=f(c.url,c.jsonp?c.jsonp+"=?":c.jsonp===!1?"":"callback=?")),t.ajaxJSONP(c,h);var b,x=c.accepts[m],w={},C=function(t,e){w[t.toLowerCase()]=[t,e]},j=/^([\w-]+:)\/\//.test(c.url)?RegExp.$1:window.location.protocol,T=c.xhr(),S=T.setRequestHeader;if(h&&h.promise(T),c.crossDomain||C("X-Requested-With","XMLHttpRequest"),C("Accept",x||"*/*"),(x=c.mimeType||x)&&(x.indexOf(",")>-1&&(x=x.split(",",2)[0]),T.overrideMimeType&&T.overrideMimeType(x)),(c.contentType||c.contentType!==!1&&c.data&&"GET"!=c.type.toUpperCase())&&C("Content-Type",c.contentType||"application/x-www-form-urlencoded"),c.headers)for(g in c.headers)C(g,c.headers[g]);if(T.setRequestHeader=C,T.onreadystatechange=function(){if(4==T.readyState){T.onreadystatechange=u,clearTimeout(b);var e,n=!1;if(T.status>=200&&T.status<300||304==T.status||0==T.status&&"file:"==j){m=m||l(c.mimeType||T.getResponseHeader("content-type")),e=T.responseText;try{"script"==m?(1,eval)(e):"xml"==m?e=T.responseXML:"json"==m&&(e=$.test(e)?null:t.parseJSON(e))}catch(r){n=r}n?s(n,"parsererror",T,c,h):a(e,T,c,h)}else s(T.statusText||null,T.status?"error":"abort",T,c,h)}},i(T,c)===!1)return T.abort(),s(null,"abort",T,c,h),T;if(c.xhrFields)for(g in c.xhrFields)T[g]=c.xhrFields[g];var O="async"in c?c.async:!0;T.open(c.type,c.url,O,c.username,c.password);for(g in w)S.apply(T,w[g]);return c.timeout>0&&(b=setTimeout(function(){T.onreadystatechange=u,T.abort(),s(null,"timeout",T,c,h)},c.timeout)),T.send(c.data?c.data:null),T},t.get=function(){return t.ajax(h.apply(null,arguments))},t.post=function(){var e=h.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=h.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var o,i=this,a=e.split(/\s/),s=h(e,n,r),c=s.success;return a.length>1&&(s.url=a[0],o=a[1]),s.success=function(e){i.html(o?t("
").html(e.replace(b,"")).find(o):e),c&&c.apply(i,arguments)},t.ajax(s),this};var T=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(T(e)+"="+T(n))},m(r,e,n),r.join("&").replace(/%20/g,"+")}}(r),function(t){t.Callbacks=function(e){e=t.extend({},e);var n,r,o,i,a,s,c=[],u=!e.once&&[],l=function(t){for(n=e.memory&&t,r=!0,s=i||0,i=0,a=c.length,o=!0;c&&a>s;++s)if(c[s].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}o=!1,c&&(u?u.length&&l(u.shift()):n?c.length=0:f.disable())},f={add:function(){if(c){var r=c.length,s=function(n){t.each(n,function(t,n){"function"==typeof n?e.unique&&f.has(n)||c.push(n):n&&n.length&&"string"!=typeof n&&s(n)})};s(arguments),o?a=c.length:n&&(i=r,l(n))}return this},remove:function(){return c&&t.each(arguments,function(e,n){for(var r;(r=t.inArray(n,c,r))>-1;)c.splice(r,1),o&&(a>=r&&--a,s>=r&&--s)}),this},has:function(e){return!(!c||!(e?t.inArray(e,c)>-1:c.length))},empty:function(){return a=c.length=0,this},disable:function(){return c=u=n=void 0,this},disabled:function(){return!c},lock:function(){return u=void 0,n||f.disable(),this},locked:function(){return!u},fireWith:function(t,e){return!c||r&&!u||(e=e||[],e=[t,e.slice?e.slice():e],o?u.push(e):l(e)),this},fire:function(){return f.fireWith(this,arguments)},fired:function(){return!!r}};return f}}(r),function(t){function e(n){var r=[["resolve","done",t.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",t.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",t.Callbacks({memory:1})]],o="pending",i={state:function(){return o},always:function(){return a.done(arguments).fail(arguments),this},then:function(){var n=arguments;return e(function(e){t.each(r,function(r,o){var s=t.isFunction(n[r])&&n[r];a[o[1]](function(){var n=s&&s.apply(this,arguments);if(n&&t.isFunction(n.promise))n.promise().done(e.resolve).fail(e.reject).progress(e.notify);else{var r=this===i?e.promise():this,a=s?[n]:arguments;e[o[0]+"With"](r,a)}})}),n=null}).promise()},promise:function(e){return null!=e?t.extend(e,i):i}},a={};return t.each(r,function(t,e){var n=e[2],s=e[3];i[e[1]]=n.add,s&&n.add(function(){o=s},r[1^t][2].disable,r[2][2].lock),a[e[0]]=function(){return a[e[0]+"With"](this===a?i:this,arguments),this},a[e[0]+"With"]=n.fireWith}),i.promise(a),n&&n.call(a,a),a}var n=Array.prototype.slice;t.when=function(r){var o,i,a,s=n.call(arguments),c=s.length,u=0,l=1!==c||r&&t.isFunction(r.promise)?c:0,f=1===l?r:e(),p=function(t,e,r){return function(i){e[t]=this,r[t]=arguments.length>1?n.call(arguments):i,r===o?f.notifyWith(e,r):--l||f.resolveWith(e,r)}};if(c>1)for(o=new Array(c),i=new Array(c),a=new Array(c);c>u;++u)s[u]&&t.isFunction(s[u].promise)?s[u].promise().done(p(u,a,s)).fail(f.reject).progress(p(u,i,o)):--l;return l||f.resolveWith(a,s),f.promise()},t.Deferred=e}(r),function(t){function e(t,e,n,r){return Math.abs(t-e)>=Math.abs(n-r)?t-e>0?"Left":"Right":n-r>0?"Up":"Down"}function n(){l=null,p.last&&(p.el.trigger("longTap"),p={})}function r(){l&&clearTimeout(l),l=null}function o(){s&&clearTimeout(s),c&&clearTimeout(c),u&&clearTimeout(u),l&&clearTimeout(l),s=c=u=l=null,p={}}function i(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function a(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}var s,c,u,l,f,p={},h=750;t(document).ready(function(){var m,d,g,v,y=0,b=0;"MSGesture"in window&&(f=new MSGesture,f.target=document.body),t(document).bind("MSGestureEnd",function(t){var e=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;e&&(p.el.trigger("swipe"),p.el.trigger("swipe"+e))}).on("touchstart MSPointerDown pointerdown",function(e){(!(v=a(e,"down"))||i(e))&&(g=v?e:e.touches[0],e.touches&&1===e.touches.length&&p.x2&&(p.x2=void 0,p.y2=void 0),m=Date.now(),d=m-(p.last||m),p.el=t("tagName"in g.target?g.target:g.target.parentNode),s&&clearTimeout(s),p.x1=g.pageX,p.y1=g.pageY,d>0&&250>=d&&(p.isDoubleTap=!0),p.last=m,l=setTimeout(n,h),f&&v&&f.addPointer(e.pointerId))}).on("touchmove MSPointerMove pointermove",function(t){(!(v=a(t,"move"))||i(t))&&(g=v?t:t.touches[0],r(),p.x2=g.pageX,p.y2=g.pageY,y+=Math.abs(p.x1-p.x2),b+=Math.abs(p.y1-p.y2))}).on("touchend MSPointerUp pointerup",function(n){(!(v=a(n,"up"))||i(n))&&(r(),p.x2&&Math.abs(p.x1-p.x2)>30||p.y2&&Math.abs(p.y1-p.y2)>30?u=setTimeout(function(){p.el.trigger("swipe"),p.el.trigger("swipe"+e(p.x1,p.x2,p.y1,p.y2)),p={}},0):"last"in p&&(30>y&&30>b?c=setTimeout(function(){var e=t.Event("tap");e.cancelTouch=o,p.el.trigger(e),p.isDoubleTap?(p.el&&p.el.trigger("doubleTap"),p={}):s=setTimeout(function(){s=null,p.el&&p.el.trigger("singleTap"),p={}},250)},0):p={}),y=b=0)}).on("touchcancel MSPointerCancel pointercancel",o),t(window).on("scroll",o)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(e){t.fn[e]=function(t){return this.on(e,t)}})}(r),function(t){function e(e){return e=t(e),!(!e.width()&&!e.height())&&"none"!==e.css("display")}function n(t,e){t=t.replace(/=#\]/g,'="#"]');var n,r,o=s.exec(t);if(o&&o[2]in a&&(n=a[o[2]],r=o[3],t=o[1],r)){var i=Number(r);r=isNaN(i)?r.replace(/^["']|["']$/g,""):i}return e(t,n,r)}var r=t.zepto,o=r.qsa,i=r.matches,a=t.expr[":"]={visible:function(){return e(this)?this:void 0},hidden:function(){return e(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,e){return t===e.length-1?this:void 0},eq:function(t,e,n){return t===n?this:void 0},contains:function(e,n,r){return t(this).text().indexOf(r)>-1?this:void 0},has:function(t,e,n){return r.qsa(this,n).length?this:void 0}},s=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),c=/^\s*>/,u="Zepto"+ +new Date;r.qsa=function(e,i){return n(i,function(n,a,s){try{var l;!n&&a?n="*":c.test(n)&&(l=t(e).addClass(u),n="."+u+" "+n);var f=o(e,n)}catch(p){throw console.error("error performing selector: %o",i),p}finally{l&&l.removeClass(u)}return a?r.uniq(t.map(f,function(t,e){return a.call(t,e,f,s)})):f})},r.matches=function(t,e){return n(e,function(e,n,r){return!(e&&!i(t,e)||n&&n.call(t,null,r)!==t)})}}(r),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t){try{return e(t)}catch(n){return null}}}}(),e.exports=r},{}],3:[function(t,e,n){function r(t){return"\\"+O[t]}function o(t){return!!t&&"object"==typeof t}function i(t,e,n,r){return void 0!==t&&k.call(r,n)?t:e}function a(t,e,n){var r=y(e);F.apply(r,M(e));for(var o=-1,i=r.length;++o-1&&t%1==0&&e>t}function a(t,e,n){if(!c(n))return!1;var r=typeof e;if("number"==r?o(n)&&i(e,n.length):"string"==r&&e in n){var a=n[e];return t===t?t===a:a!==a}return!1}function s(t){return"number"==typeof t&&t>-1&&t%1==0&&l>=t}function c(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var u=/^\d+$/,l=9007199254740991,f=r("length");e.exports=a},{}],8:[function(t,e,n){var r=/<%=([\s\S]+?)%>/g;e.exports=r},{}],9:[function(t,e,n){function r(t){return c[t]}function o(t){return t=i(t),t&&s.test(t)?t.replace(a,r):t}var i=t("lodash._basetostring"),a=/[&<>"'`]/g,s=RegExp(a.source),c={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};e.exports=o},{"lodash._basetostring":5}],10:[function(t,e,n){function r(t){return!!t&&"object"==typeof t}function o(t){return null==t?!1:i(t)?l.test(c.call(t)):r(t)&&a.test(t)}var i=t("lodash.isfunction"),a=/^\[object .+?Constructor\]$/,s=Object.prototype,c=Function.prototype.toString,u=s.hasOwnProperty,l=RegExp("^"+c.call(u).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=o},{"lodash.isfunction":11}],11:[function(t,e,n){function r(t){return o(t)&&s.call(t)==i}function o(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var i="[object Function]",a=Object.prototype,s=a.toString;e.exports=r},{}],12:[function(t,e,n){function r(t){return function(e){return null==e?void 0:e[t]}}function o(t){return null!=t&&a(y(t))}function i(t,e){return t="number"==typeof t||h.test(t)?+t:-1,e=null==e?v:e,t>-1&&t%1==0&&e>t}function a(t){return"number"==typeof t&&t>-1&&t%1==0&&v>=t}function s(t){for(var e=u(t),n=e.length,r=n&&t.length,o=!!r&&a(r)&&(p(t)||f(t)),s=-1,c=[];++s0;++r-1&&t%1==0&&f>=t}function s(t){return r(t)&&i(t)&&u.call(t,"callee")&&!l.call(t,"callee")}var c=Object.prototype,u=c.hasOwnProperty,l=c.propertyIsEnumerable,f=9007199254740991,p=o("length");e.exports=s},{}],15:[function(t,e,n){function r(t){return!!t&&"object"==typeof t}function o(t,e){var n=null==t?void 0:t[e];return c(n)?n:void 0}function i(t){return"number"==typeof t&&t>-1&&t%1==0&&y>=t}function a(t){return s(t)&&d.call(t)==l}function s(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function c(t){return null==t?!1:a(t)?g.test(h.call(t)):r(t)&&f.test(t)}var u="[object Array]",l="[object Function]",f=/^\[object .+?Constructor\]$/,p=Object.prototype,h=Function.prototype.toString,m=p.hasOwnProperty,d=p.toString,g=RegExp("^"+h.call(m).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),v=o(Array,"isArray"),y=9007199254740991,b=v||function(t){return r(t)&&i(t.length)&&d.call(t)==u};e.exports=b},{}],16:[function(t,e,n){function r(t,e){if("function"!=typeof t)throw new TypeError(o);return e=i(void 0===e?t.length-1:+e||0,0),function(){for(var n=arguments,r=-1,o=i(n.length-e,0),a=Array(o);++r/g,a=/<%([\s\S]+?)%>/g,s={escape:i,evaluate:a,interpolate:r,variable:"",imports:{_:{escape:o}}};e.exports=s},{"lodash._reinterpolate":8,"lodash.escape":9}],18:[function(t,e,n){"use strict";var r=t("lodash.template");e.exports={add:r(''),form:r('
<%- addAt %> 0 <%- minutes %>
'),CSS:{add:".comments-controls[data-comments-controls]{display:inline-block;float:left;color:#fff;line-height:32px;font-size:10px;font-weight:700;margin-right:3px}.comments-controls[data-comments-controls] .add-comment{cursor:pointer;opacity:.8;font-weight:lighter}.comments-controls[data-comments-controls] .add-comment:before{font-size:16px}.comments-controls[data-comments-controls] .add-comment:hover{text-shadow:rgba(255,255,255,.8) 0 0 5px;opacity:1}.comments-bar{display:inline-block;float:left;line-height:32px;font-size:10px;font-weight:700;margin-left:6px}.comment-pointer{position:absolute;left:20px;top:8px;width:2px;height:8px;background:#90ee90;color:#90ee90;transition:background .2s linear}.comment-pointer:hover{background:red}.video-comment{color:#fff;text-align:left;font-size:12px!important}.comment-actif{padding:5px!important}.img-comment{min-width:100px;min-height:50px}.img-comment img{max-width:200px;max-height:200px}.img-comment .spinner-three-bounce{top:25%}.img-comment .spinner-three-bounce>div{width:10px;height:10px}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar]{z-index:99}.seek-time[data-seek-time]{height:initial!important}",form:'.form-comment{position:absolute;width:50%;margin-left:auto;margin-right:auto;text-align:left;background:#fff;right:5px;bottom:100px;z-index:999999;visibility:hidden;opacity:0;transition:hidden 0s .2s,opacity .2s linear;border-radius:5px;cursor:default}.form-comment .form-comment-header{padding:2px 5px;background:#888;border-top-left-radius:5px;border-top-right-radius:5px}.form-comment form{padding:5px!important}.form-comment img{max-height:50px;max-width:100px}.form-comment button,.form-comment input,.form-comment textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:initial;line-height:initial;color:initial}.form-comment p{color:initial;font-size:initial!important}.form-comment input[type=file]{width:.1px;height:.1px;opacity:0;overflow:hidden;position:absolute;z-index:-1}.form-comment button[type=button],.form-comment input[type=file]+label{display:inline-block;padding:2px 5px;font-size:1.25em;font-weight:700}.form-comment input[type=file]+label{color:#fff;background-color:#000;cursor:pointer}.form-comment button[type=button]{color:#fff;background-color:green;cursor:pointer;border:0;line-height:1.4}.form-comment button[type=button]:focus,.form-comment button[type=button]:hover,.form-comment input[type=file]+label:hover,.form-comment input[type=file]:focus+label{background-color:red}.form-comment .text-center{text-align:center}.form-comment textarea{width:100%}.form-comment .submit-comment{display:inline-block}.show-form{visibility:visible;opacity:.9}'}}},{"lodash.template":3}],19:[function(t,e,n){"use strict";var r=function(){function t(t,e){for(var n in e){var r=e[n];r.configurable=!0,r.value&&(r.writable=!0)}Object.defineProperties(t,e)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function f(t,e,n){var r=Object.getOwnPropertyDescriptor(t,e);if(void 0===r){var o=Object.getPrototypeOf(t);return null===o?void 0:f(o,e,n)}if("value"in r&&r.writable)return r.value;var i=r.get;return void 0===i?void 0:i.call(n)},i=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)},a=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},s=Clappr.UICorePlugin,c=t("./jst"),u=t("./styler"),l=(Clappr.Events,function(t){function e(t){a(this,e),o(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,t),this.core=t,this.actualTime=0}return i(e,t),r(e,{name:{get:function(){return"comments"}},events:{get:function(){return{"click .add-comment":"clickOnContainer"}}},attributes:{get:function(){return{"class":"comments-controls","data-comments-controls":""}}},bindEvents:{value:function(){this.listenTo(this.core.mediaControl,"mediacontrol:rendered",this.make),this.listenTo(this.core.mediaControl.container,"container:timeupdate",this.timeUpdate),this.listenTo(this.core.mediaControl.container,"container:play",this.play)}},render:{value:function(){this.core.options.commentImg=void 0!=this.core.options.commentImg?this.core.options.commentImg:!0,this.videoId=this.core.$el.parent().attr("data-video-id"),this.make()}},play:{value:function(){this.dismissForm()}},make:{value:function(){var t=this,e=u.getStyleFor("add");console.log(e[0]),this.$playButton=this.core.mediaControl.$el.find(".media-control-button"),this.$el.html(c.add).append(e[0]),this.core.mediaControl.$(".media-control-right-panel[data-media-control]").append(this.$el);var n=u.getStyleFor("form"),r='",this.$el.formComment=document.createElement("div"),this.core.options.texts)var o={addAt:this.core.options.texts.addComment?this.core.options.texts.addComment:"Add a comment at",minutes:this.core.options.texts.minutes?this.core.options.texts.minutes:"minutes",placeholder:this.core.options.texts.commentPlaceholder?this.core.options.texts.commentPlaceholder:"Put a comment here",send:this.core.options.texts.sendComment?this.core.options.texts.sendComment:"Send"};else var o={addAt:"Add a comment at",minutes:"minutes",placeholder:"Put a comment here",send:"Send"};$(this.$el.formComment).html(c.form(o)).addClass("form-comment").append(n[0]).append(r),this.core.mediaControl.container.$el.append(this.$el.formComment),this.core.mediaControl.container.$el.find(".form-comment").click(function(t){t.stopPropagation()}),this.core.options.iconComment?this.core.mediaControl.$el.find(".add-comment").addClass(this.core.options.iconComment):this.core.options.texts&&this.core.options.texts.addCommentLink?this.core.mediaControl.$el.find(".add-comment").text(this.core.options.texts.addCommentLink):this.core.mediaControl.$el.find(".add-comment").text("Comment"),this.core.options.enablePicture&&this.core.mediaControl.container.$el.find('input[type="file"]').show(),isNaN(this.core.mediaControl.container.getDuration())?this.videoUnReady=!0:this.getComments(this.core.options.videoId),this.core.mediaControl.container.$el.find(".submit-comment").click(function(){return t.submitComment(t)}),this.core.mediaControl.$seekBarContainer.append(this.commentPointer),this.core.mediaControl.seekTime.$el.prepend('
'),$('.form-comment input[type="file"]').change(function(){if(this.files&&this.files[0]){var t=new FileReader;t.onload=function(t){$(".form-comment img").attr("src",t.target.result)},t.readAsDataURL(this.files[0])}})}},getComments:{value:function(t){if(!this.pointers){if(this.pointers=new Array,!this.core.options.urlGetComments)return void alert('An url is needed in the options for the API (POST). Option "urlGetComments"');$.get(this.core.options.urlGetComments+"/"+t,function(t){for(var e=0;e
');var n=$("").attr("src",$(e).attr("data-imgUrl"));n.on("load",function(){console.log("test"),this.complete&&"undefined"!=typeof this.naturalWidth&&0!=this.naturalWidth&&(console.log(this),t.core.mediaControl.seekTime.$(".img-comment").html(this))})}}},hideComment:{value:function(t){t.core.mediaControl.seekTime.$(".video-comment").html("").removeClass("comment-actif")}},submitComment:{value:function(t){if(!this.core.options.urlAddComments)return void alert('An url is needed in the options for the API (POST). Option "urlAddComments"');var e=t.core.mediaControl.container.$el.find("form"),n=new FormData;if(this.core.options.enablePicture){var r=$('input[type="file"]')[1].files;1==r.length&&n.append("picture",r[0])}var o=$(e).serializeArray();$.each(o,function(t,e){n.append(e.name,e.value)}),n.append("time",Math.round(t.actualTime)),$.ajax({url:this.core.options.urlAddComments,type:"POST",data:n,async:!1,success:function(e){t.createCommentPointer(e),t.displayingComment(t),t.dismissForm()},cache:!1,contentType:!1,processData:!1})}},dismissForm:{value:function(){"visible"==$(this.$el.formComment).css("visibility")&&$(this.$el.formComment).removeClass("show-form")}},clickOnContainer:{value:function(){if("visible"==$(this.$el.formComment).css("visibility"))$(this.$el.formComment).removeClass("show-form");else{this.core.mediaControl.container.pause(),this.$playButton.addClass("paused");var t=Math.round(this.actualTime)/100;$(this.$el.formComment).find(".comment-time").text(t),$(this.$el.formComment).addClass("show-form")}}},timeUpdate:{value:function(t,e){this.actualTime=t,"visible"==$(this.$el.formComment).css("visibility")&&$(this.$el.formComment).find(".comment-time").text(Math.round(this.actualTime)/100),this.videoUnReady&&1==this.videoUnReady&&(this.getComments(this.core.options.videoId),0==this.videoUnReady)}}}),e}(s));e.exports=window.Comments=l},{"./jst":18,"./styler":20}],20:[function(t,e,n){"use strict";var r=t("./jst"),o=t("clappr-zepto"),i={getStyleFor:function(t){return o("").html(r.CSS[t].toString())}};e.exports=i},{"./jst":18,"clappr-zepto":2}]},{},[1]); -------------------------------------------------------------------------------- /dist/comments.js: -------------------------------------------------------------------------------- 1 | (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0?n.fn.concat.apply([],t):t}function z(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function H(t){return t in c?c[t]:c[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function _(t,e){return"number"!=typeof e||l[z(t)]?e:e+"px"}function I(t){var e,n;return f[t]||(e=u.createElement(t),u.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),f[t]=n),f[t]}function U(t){return"children"in t?a.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function X(t,e){var n,i=t?t.length:0;for(n=0;i>n;n++)this[n]=t[n];this.length=i,this.selector=e||""}function B(n,i,r){for(e in i)r&&(F(i[e])||A(i[e]))?(F(i[e])&&!F(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),B(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function V(t,e){return null==e?n(t):n(t).filter(e)}function Y(t,e,n,i){return L(e)?e.call(t,n,i):e}function J(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function G(e,n){var i=e.className||"",r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function K(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?n.parseJSON(t):t):t}catch(e){return t}}function Q(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)Q(t.childNodes[n],e)}var t,e,n,i,N,P,r=[],o=r.concat,s=r.filter,a=r.slice,u=window.document,f={},c={},l={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},h=/^\s*<(\w+|!)[^>]*>/,p=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,d=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,m=/^(?:body|html)$/i,g=/([A-Z])/g,v=["val","css","html","text","data","width","height","offset"],y=["after","prepend","before","append"],w=u.createElement("table"),x=u.createElement("tr"),b={tr:u.createElement("tbody"),tbody:w,thead:w,tfoot:w,td:x,th:x,"*":u.createElement("div")},E=/complete|loaded|interactive/,T=/^[\w-]*$/,j={},S=j.toString,C={},O=u.createElement("div"),M={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return C.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~C.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},N=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},P=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},C.fragment=function(e,i,r){var o,s,f;return p.test(e)&&(o=n(u.createElement(RegExp.$1))),o||(e.replace&&(e=e.replace(d,"<$1>")),i===t&&(i=h.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,o=n.each(a.call(f.childNodes),function(){f.removeChild(this)})),F(r)&&(s=n(o),n.each(r,function(t,e){v.indexOf(t)>-1?s[t](e):s.attr(t,e)})),o},C.Z=function(t,e){return new X(t,e)},C.isZ=function(t){return t instanceof C.Z},C.init=function(e,i){var r;if(!e)return C.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&h.test(e))r=C.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(u,e)}else{if(L(e))return n(u).ready(e);if(C.isZ(e))return e;if(A(e))r=q(e);else if($(e))r=[e],e=null;else if(h.test(e))r=C.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=C.qsa(u,e)}}return C.Z(r,e)},n=function(t,e){return C.init(t,e)},n.extend=function(t){var e,n=a.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){B(t,n,e)}),t},C.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],o=i||r?e.slice(1):e,s=T.test(o);return t.getElementById&&s&&i?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:a.call(s&&!i&&t.getElementsByClassName?r?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=u.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},n.type=D,n.isFunction=L,n.isWindow=k,n.isArray=A,n.isPlainObject=F,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=N,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.noop=function(){},n.map=function(t,e){var n,r,o,i=[];if(R(t))for(r=0;r=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return L(t)?this.not(this.not(t)):n(s.call(this,function(e){return C.matches(e,t)}))},add:function(t,e){return n(P(this.concat(n(t,e))))},is:function(t){return this.length>0&&C.matches(this[0],t)},not:function(e){var i=[];if(L(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):R(e)&&L(e.item)?a.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return $(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!$(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!$(t)?t:n(t)},find:function(t){var e,i=this;return e=t?"object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(C.qsa(this[0],t)):this.map(function(){return C.qsa(this,t)}):n()},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:C.matches(i,t));)i=i!==e&&!Z(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!Z(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return V(e,t)},parent:function(t){return V(P(this.pluck("parentNode")),t)},children:function(t){return V(this.map(function(){return U(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||a.call(this.childNodes)})},siblings:function(t){return V(this.map(function(t,e){return s.call(U(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=L(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=L(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var i=this.innerHTML;n(this).empty().append(Y(this,t,e,i))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=Y(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(n,i){var r;return"string"!=typeof n||1 in arguments?this.each(function(t){if(1===this.nodeType)if($(n))for(e in n)J(this,e,n[e]);else J(this,n,Y(this,i,t,this.getAttribute(n)))}):this.length&&1===this[0].nodeType?!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:t},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){J(this,t)},this)})},prop:function(t,e){return t=M[t]||t,1 in arguments?this.each(function(n){this[t]=Y(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(e,n){var i="data-"+e.replace(g,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?K(r):t},val:function(t){return 0 in arguments?this.each(function(e){this.value=Y(this,t,e,this.value)}):this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=Y(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(!this.length)return null;if(!n.contains(u.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r,o=this[0];if(!o)return;if(r=getComputedStyle(o,""),"string"==typeof t)return o.style[N(t)]||r.getPropertyValue(t);if(A(t)){var s={};return n.each(t,function(t,e){s[e]=o.style[N(e)]||r.getPropertyValue(e)}),s}}var a="";if("string"==D(t))i||0===i?a=z(t)+":"+_(t,i):this.each(function(){this.style.removeProperty(z(t))});else for(e in t)t[e]||0===t[e]?a+=z(e)+":"+_(e,t[e])+";":this.each(function(){this.style.removeProperty(z(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(G(t))},H(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var r=G(this),o=Y(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&G(this,r+(r?" ":"")+i.join(" "))}}):this},removeClass:function(e){return this.each(function(n){if("className"in this){if(e===t)return G(this,"");i=G(this),Y(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(H(t)," ")}),G(this,i.trim())}})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=Y(this,e,r,G(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=m.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||u.body;t&&!m.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?k(s)?s["inner"+i]:Z(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,Y(this,r,t,s[e]()))})}}),y.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=D(e),"object"==t||"array"==t||null==e?e:C.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null;var f=n.contains(u.documentElement,o);r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();o.insertBefore(t,a),f&&Q(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),C.Z.prototype=X.prototype=n.fn,C.uniq=P,C.deserializeValue=K,n.zepto=C,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=T(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function T(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=w,r&&r.apply(i,arguments)},e[n]=x}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=w)),e}function j(t){var e,i={originalEvent:t};for(e in t)b.test(e)||t[e]===n||(i[e]=t[e]);return T(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){var s=2 in arguments&&i.call(arguments,2);if(r(e)){var a=function(){return e.apply(n,s?s.concat(i.call(arguments)):arguments)};return a._zid=l(e),a}if(o(n))return s?(s.unshift(e[n],e),t.proxy.apply(null,s)):t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var w=function(){return!0},x=function(){return!1},b=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(u===n||a===!1)&&(u=a,a=n),u===!1&&(u=x),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(j(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=x),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):T(e),e._args=n,this.each(function(){e.type in f&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=j(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),T(n)}}(Zepto),function(t){function h(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function p(t,e,i,r){return t.global?h(e||n,i,r):void 0}function d(e){e.global&&0===t.active++&&p(e,null,"ajaxStart")}function m(e){e.global&&!--t.active&&p(e,null,"ajaxStop")}function g(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||p(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void p(e,n,"ajaxSend",[t,e])}function v(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),p(n,r,"ajaxSuccess",[e,n,t]),w(o,e,n)}function y(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),p(i,o,"ajaxError",[n,i,t||e]),w(e,n,i)}function w(t,e,n){var i=n.context;n.complete.call(i,e,t),p(n,i,"ajaxComplete",[e,n]),m(n)}function x(){}function b(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function E(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function T(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=E(e.url,e.data),e.data=void 0)}function j(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function C(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?C(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/,l=n.createElement("a");l.href=window.location.href,t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?v(f[0],l,i,r):y(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),g(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:x,success:x,error:x,complete:x,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var a,u,o=t.extend({},e||{}),s=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===o[i]&&(o[i]=t.ajaxSettings[i]);d(o),o.crossDomain||(a=n.createElement("a"),a.href=o.url,a.href=a.href,o.crossDomain=l.protocol+"//"+l.host!=a.protocol+"//"+a.host),o.url||(o.url=window.location.toString()),(u=o.url.indexOf("#"))>-1&&(o.url=o.url.slice(0,u)),T(o);var f=o.dataType,h=/\?.+=\?/.test(o.url);if(h&&(f="jsonp"),o.cache!==!1&&(e&&e.cache===!0||"script"!=f&&"jsonp"!=f)||(o.url=E(o.url,"_="+Date.now())),"jsonp"==f)return h||(o.url=E(o.url,o.jsonp?o.jsonp+"=?":o.jsonp===!1?"":"callback=?")),t.ajaxJSONP(o,s);var N,p=o.accepts[f],m={},w=function(t,e){m[t.toLowerCase()]=[t,e]},j=/^([\w-]+:)\/\//.test(o.url)?RegExp.$1:window.location.protocol,S=o.xhr(),C=S.setRequestHeader;if(s&&s.promise(S),o.crossDomain||w("X-Requested-With","XMLHttpRequest"),w("Accept",p||"*/*"),(p=o.mimeType||p)&&(p.indexOf(",")>-1&&(p=p.split(",",2)[0]),S.overrideMimeType&&S.overrideMimeType(p)),(o.contentType||o.contentType!==!1&&o.data&&"GET"!=o.type.toUpperCase())&&w("Content-Type",o.contentType||"application/x-www-form-urlencoded"),o.headers)for(r in o.headers)w(r,o.headers[r]);if(S.setRequestHeader=w,S.onreadystatechange=function(){if(4==S.readyState){S.onreadystatechange=x,clearTimeout(N);var e,n=!1;if(S.status>=200&&S.status<300||304==S.status||0==S.status&&"file:"==j){f=f||b(o.mimeType||S.getResponseHeader("content-type")),e=S.responseText;try{"script"==f?(1,eval)(e):"xml"==f?e=S.responseXML:"json"==f&&(e=c.test(e)?null:t.parseJSON(e))}catch(i){n=i}n?y(n,"parsererror",S,o,s):v(e,S,o,s)}else y(S.statusText||null,S.status?"error":"abort",S,o,s)}},g(S,o)===!1)return S.abort(),y(null,"abort",S,o,s),S;if(o.xhrFields)for(r in o.xhrFields)S[r]=o.xhrFields[r];var P="async"in o?o.async:!0;S.open(o.type,o.url,P,o.username,o.password);for(r in m)C.apply(S,m[r]);return o.timeout>0&&(N=setTimeout(function(){S.onreadystatechange=x,S.abort(),y(null,"timeout",S,o,s)},o.timeout)),S.send(o.data?o.data:null),S},t.get=function(){return t.ajax(j.apply(null,arguments))},t.post=function(){var e=j.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=j.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=j(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("
").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var S=encodeURIComponent;t.param=function(e,n){var i=[];return i.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(S(e)+"="+S(n))},C(i,e,n),i.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.Callbacks=function(e){e=t.extend({},e);var n,i,r,o,s,a,u=[],f=!e.once&&[],c=function(t){for(n=e.memory&&t,i=!0,a=o||0,o=0,s=u.length,r=!0;u&&s>a;++a)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}r=!1,u&&(f?f.length&&c(f.shift()):n?u.length=0:l.disable())},l={add:function(){if(u){var i=u.length,a=function(n){t.each(n,function(t,n){"function"==typeof n?e.unique&&l.has(n)||u.push(n):n&&n.length&&"string"!=typeof n&&a(n)})};a(arguments),r?s=u.length:n&&(o=i,c(n))}return this},remove:function(){return u&&t.each(arguments,function(e,n){for(var i;(i=t.inArray(n,u,i))>-1;)u.splice(i,1),r&&(s>=i&&--s,a>=i&&--a)}),this},has:function(e){return!(!u||!(e?t.inArray(e,u)>-1:u.length))},empty:function(){return s=u.length=0,this},disable:function(){return u=f=n=void 0,this},disabled:function(){return!u},lock:function(){return f=void 0,n||l.disable(),this},locked:function(){return!f},fireWith:function(t,e){return!u||i&&!f||(e=e||[],e=[t,e.slice?e.slice():e],r?f.push(e):c(e)),this},fire:function(){return l.fireWith(this,arguments)},fired:function(){return!!i}};return l}}(Zepto),function(t){function n(e){var i=[["resolve","done",t.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",t.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",t.Callbacks({memory:1})]],r="pending",o={state:function(){return r},always:function(){return s.done(arguments).fail(arguments),this},then:function(){var e=arguments;return n(function(n){t.each(i,function(i,r){var a=t.isFunction(e[i])&&e[i];s[r[1]](function(){var e=a&&a.apply(this,arguments);if(e&&t.isFunction(e.promise))e.promise().done(n.resolve).fail(n.reject).progress(n.notify);else{var i=this===o?n.promise():this,s=a?[e]:arguments;n[r[0]+"With"](i,s)}})}),e=null}).promise()},promise:function(e){return null!=e?t.extend(e,o):o}},s={};return t.each(i,function(t,e){var n=e[2],a=e[3];o[e[1]]=n.add,a&&n.add(function(){r=a},i[1^t][2].disable,i[2][2].lock),s[e[0]]=function(){return s[e[0]+"With"](this===s?o:this,arguments),this},s[e[0]+"With"]=n.fireWith}),o.promise(s),e&&e.call(s,s),s}var e=Array.prototype.slice;t.when=function(i){var f,c,l,r=e.call(arguments),o=r.length,s=0,a=1!==o||i&&t.isFunction(i.promise)?o:0,u=1===a?i:n(),h=function(t,n,i){return function(r){n[t]=this,i[t]=arguments.length>1?e.call(arguments):r,i===f?u.notifyWith(n,i):--a||u.resolveWith(n,i)}};if(o>1)for(f=new Array(o),c=new Array(o),l=new Array(o);o>s;++s)r[s]&&t.isFunction(r[s].promise)?r[s].promise().done(h(s,l,r)).fail(u.reject).progress(h(s,c,f)):--a;return a||u.resolveWith(l,r),u.promise()},t.Deferred=n}(Zepto),function(t){function u(t,e,n,i){return Math.abs(t-e)>=Math.abs(n-i)?t-e>0?"Left":"Right":n-i>0?"Up":"Down"}function f(){o=null,e.last&&(e.el.trigger("longTap"),e={})}function c(){o&&clearTimeout(o),o=null}function l(){n&&clearTimeout(n),i&&clearTimeout(i),r&&clearTimeout(r),o&&clearTimeout(o),n=i=r=o=null,e={}}function h(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function p(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}var n,i,r,o,a,e={},s=750;t(document).ready(function(){var d,m,y,w,g=0,v=0;"MSGesture"in window&&(a=new MSGesture,a.target=document.body),t(document).bind("MSGestureEnd",function(t){var n=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;n&&(e.el.trigger("swipe"),e.el.trigger("swipe"+n))}).on("touchstart MSPointerDown pointerdown",function(i){(!(w=p(i,"down"))||h(i))&&(y=w?i:i.touches[0],i.touches&&1===i.touches.length&&e.x2&&(e.x2=void 0,e.y2=void 0),d=Date.now(),m=d-(e.last||d),e.el=t("tagName"in y.target?y.target:y.target.parentNode),n&&clearTimeout(n),e.x1=y.pageX,e.y1=y.pageY,m>0&&250>=m&&(e.isDoubleTap=!0),e.last=d,o=setTimeout(f,s),a&&w&&a.addPointer(i.pointerId))}).on("touchmove MSPointerMove pointermove",function(t){(!(w=p(t,"move"))||h(t))&&(y=w?t:t.touches[0],c(),e.x2=y.pageX,e.y2=y.pageY,g+=Math.abs(e.x1-e.x2),v+=Math.abs(e.y1-e.y2))}).on("touchend MSPointerUp pointerup",function(o){(!(w=p(o,"up"))||h(o))&&(c(),e.x2&&Math.abs(e.x1-e.x2)>30||e.y2&&Math.abs(e.y1-e.y2)>30?r=setTimeout(function(){e.el.trigger("swipe"),e.el.trigger("swipe"+u(e.x1,e.x2,e.y1,e.y2)),e={}},0):"last"in e&&(30>g&&30>v?i=setTimeout(function(){var i=t.Event("tap");i.cancelTouch=l,e.el.trigger(i),e.isDoubleTap?(e.el&&e.el.trigger("doubleTap"),e={}):n=setTimeout(function(){n=null,e.el&&e.el.trigger("singleTap"),e={}},250)},0):e={}),g=v=0)}).on("touchcancel MSPointerCancel pointercancel",l),t(window).on("scroll",l)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(e){t.fn[e]=function(t){return this.on(e,t)}})}(Zepto),function(t){function r(e){return e=t(e),!(!e.width()&&!e.height())&&"none"!==e.css("display")}function f(t,e){t=t.replace(/=#\]/g,'="#"]');var n,i,r=s.exec(t);if(r&&r[2]in o&&(n=o[r[2]],i=r[3],t=r[1],i)){var a=Number(i);i=isNaN(a)?i.replace(/^["']|["']$/g,""):a}return e(t,n,i)}var e=t.zepto,n=e.qsa,i=e.matches,o=t.expr[":"]={visible:function(){return r(this)?this:void 0},hidden:function(){return r(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,e){return t===e.length-1?this:void 0},eq:function(t,e,n){return t===n?this:void 0},contains:function(e,n,i){return t(this).text().indexOf(i)>-1?this:void 0},has:function(t,n,i){return e.qsa(this,i).length?this:void 0}},s=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),a=/^\s*>/,u="Zepto"+ +new Date;e.qsa=function(i,r){return f(r,function(o,s,f){try{var c;!o&&s?o="*":a.test(o)&&(c=t(i).addClass(u),o="."+u+" "+o);var l=n(i,o)}catch(h){throw console.error("error performing selector: %o",r),h}finally{c&&c.removeClass(u)}return s?e.uniq(t.map(l,function(t,e){return s.call(t,e,l,f)})):l})},e.matches=function(t,e){return f(e,function(e,n,r){return!(e&&!i(t,e)||n&&n.call(t,null,r)!==t)})}}(Zepto),function(){try{getComputedStyle(void 0)}catch(t){var e=getComputedStyle;window.getComputedStyle=function(t){try{return e(t)}catch(n){return null}}}}(); 9 | module.exports = Zepto; 10 | 11 | },{}],3:[function(require,module,exports){ 12 | /** 13 | * lodash 3.5.1 (Custom Build) 14 | * Build: `lodash modern modularize exports="npm" -o ./` 15 | * Copyright 2012-2015 The Dojo Foundation 16 | * Based on Underscore.js 1.8.3 17 | * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 18 | * Available under MIT license 19 | */ 20 | var baseCopy = require('lodash._basecopy'), 21 | baseToString = require('lodash._basetostring'), 22 | baseValues = require('lodash._basevalues'), 23 | isIterateeCall = require('lodash._isiterateecall'), 24 | reInterpolate = require('lodash._reinterpolate'), 25 | escape = require('lodash.escape'), 26 | isNative = require('lodash.isnative'), 27 | keys = require('lodash.keys'), 28 | restParam = require('lodash.restparam'), 29 | templateSettings = require('lodash.templatesettings'); 30 | 31 | /** `Object#toString` result references. */ 32 | var errorTag = '[object Error]'; 33 | 34 | /** Used to match empty string literals in compiled template source. */ 35 | var reEmptyStringLeading = /\b__p \+= '';/g, 36 | reEmptyStringMiddle = /\b(__p \+=) '' \+/g, 37 | reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; 38 | 39 | /** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */ 40 | var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; 41 | 42 | /** Used to ensure capturing order of template delimiters. */ 43 | var reNoMatch = /($^)/; 44 | 45 | /** Used to match unescaped characters in compiled string literals. */ 46 | var reUnescapedString = /['\n\r\u2028\u2029\\]/g; 47 | 48 | /** Used to escape characters for inclusion in compiled string literals. */ 49 | var stringEscapes = { 50 | '\\': '\\', 51 | "'": "'", 52 | '\n': 'n', 53 | '\r': 'r', 54 | '\u2028': 'u2028', 55 | '\u2029': 'u2029' 56 | }; 57 | 58 | /** 59 | * Used by `_.template` to escape characters for inclusion in compiled 60 | * string literals. 61 | * 62 | * @private 63 | * @param {string} chr The matched character to escape. 64 | * @returns {string} Returns the escaped character. 65 | */ 66 | function escapeStringChar(chr) { 67 | return '\\' + stringEscapes[chr]; 68 | } 69 | 70 | /** 71 | * Checks if `value` is object-like. 72 | * 73 | * @private 74 | * @param {*} value The value to check. 75 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 76 | */ 77 | function isObjectLike(value) { 78 | return !!value && typeof value == 'object'; 79 | } 80 | 81 | /** Used for native method references. */ 82 | var arrayProto = Array.prototype, 83 | objectProto = Object.prototype; 84 | 85 | /** Used to check objects for own properties. */ 86 | var hasOwnProperty = objectProto.hasOwnProperty; 87 | 88 | /** 89 | * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) 90 | * of values. 91 | */ 92 | var objToString = objectProto.toString; 93 | 94 | /** Native method references. */ 95 | var getOwnPropertySymbols = isNative(getOwnPropertySymbols = Object.getOwnPropertySymbols) && getOwnPropertySymbols, 96 | push = arrayProto.push; 97 | 98 | /** 99 | * Used by `_.template` to customize its `_.assign` use. 100 | * 101 | * **Note:** This function is like `assignDefaults` except that it ignores 102 | * inherited property values when checking if a property is `undefined`. 103 | * 104 | * @private 105 | * @param {*} objectValue The destination object property value. 106 | * @param {*} sourceValue The source object property value. 107 | * @param {string} key The key associated with the object and source values. 108 | * @param {Object} object The destination object. 109 | * @returns {*} Returns the value to assign to the destination object. 110 | */ 111 | function assignOwnDefaults(objectValue, sourceValue, key, object) { 112 | return (objectValue === undefined || !hasOwnProperty.call(object, key)) 113 | ? sourceValue 114 | : objectValue; 115 | } 116 | 117 | /** 118 | * A specialized version of `_.assign` for customizing assigned values without 119 | * support for argument juggling, multiple sources, and `this` binding `customizer` 120 | * functions. 121 | * 122 | * @private 123 | * @param {Object} object The destination object. 124 | * @param {Object} source The source object. 125 | * @param {Function} customizer The function to customize assigned values. 126 | * @returns {Object} Returns `object`. 127 | */ 128 | function assignWith(object, source, customizer) { 129 | var props = keys(source); 130 | push.apply(props, getSymbols(source)); 131 | 132 | var index = -1, 133 | length = props.length; 134 | 135 | while (++index < length) { 136 | var key = props[index], 137 | value = object[key], 138 | result = customizer(value, source[key], key, object, source); 139 | 140 | if ((result === result ? (result !== value) : (value === value)) || 141 | (value === undefined && !(key in object))) { 142 | object[key] = result; 143 | } 144 | } 145 | return object; 146 | } 147 | 148 | /** 149 | * The base implementation of `_.assign` without support for argument juggling, 150 | * multiple sources, and `customizer` functions. 151 | * 152 | * @private 153 | * @param {Object} object The destination object. 154 | * @param {Object} source The source object. 155 | * @returns {Object} Returns `object`. 156 | */ 157 | var baseAssign = function(object, source) { 158 | return source == null 159 | ? object 160 | : baseCopy(source, getSymbols(source), baseCopy(source, keys(source), object)); 161 | }; 162 | 163 | /** 164 | * Creates an array of the own symbols of `object`. 165 | * 166 | * @private 167 | * @param {Object} object The object to query. 168 | * @returns {Array} Returns the array of symbols. 169 | */ 170 | var getSymbols = !getOwnPropertySymbols ? constant([]) : function(object) { 171 | return getOwnPropertySymbols(toObject(object)); 172 | }; 173 | 174 | /** 175 | * Converts `value` to an object if it is not one. 176 | * 177 | * @private 178 | * @param {*} value The value to process. 179 | * @returns {Object} Returns the object. 180 | */ 181 | function toObject(value) { 182 | return isObject(value) ? value : Object(value); 183 | } 184 | 185 | /** 186 | * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, 187 | * `SyntaxError`, `TypeError`, or `URIError` object. 188 | * 189 | * @static 190 | * @memberOf _ 191 | * @category Lang 192 | * @param {*} value The value to check. 193 | * @returns {boolean} Returns `true` if `value` is an error object, else `false`. 194 | * @example 195 | * 196 | * _.isError(new Error); 197 | * // => true 198 | * 199 | * _.isError(Error); 200 | * // => false 201 | */ 202 | function isError(value) { 203 | return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag; 204 | } 205 | 206 | /** 207 | * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. 208 | * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 209 | * 210 | * @static 211 | * @memberOf _ 212 | * @category Lang 213 | * @param {*} value The value to check. 214 | * @returns {boolean} Returns `true` if `value` is an object, else `false`. 215 | * @example 216 | * 217 | * _.isObject({}); 218 | * // => true 219 | * 220 | * _.isObject([1, 2, 3]); 221 | * // => true 222 | * 223 | * _.isObject(1); 224 | * // => false 225 | */ 226 | function isObject(value) { 227 | // Avoid a V8 JIT bug in Chrome 19-20. 228 | // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. 229 | var type = typeof value; 230 | return type == 'function' || (!!value && type == 'object'); 231 | } 232 | 233 | /** 234 | * Creates a compiled template function that can interpolate data properties 235 | * in "interpolate" delimiters, HTML-escape interpolated data properties in 236 | * "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data 237 | * properties may be accessed as free variables in the template. If a setting 238 | * object is provided it takes precedence over `_.templateSettings` values. 239 | * 240 | * **Note:** In the development build `_.template` utilizes 241 | * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) 242 | * for easier debugging. 243 | * 244 | * For more information on precompiling templates see 245 | * [lodash's custom builds documentation](https://lodash.com/custom-builds). 246 | * 247 | * For more information on Chrome extension sandboxes see 248 | * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval). 249 | * 250 | * @static 251 | * @memberOf _ 252 | * @category String 253 | * @param {string} [string=''] The template string. 254 | * @param {Object} [options] The options object. 255 | * @param {RegExp} [options.escape] The HTML "escape" delimiter. 256 | * @param {RegExp} [options.evaluate] The "evaluate" delimiter. 257 | * @param {Object} [options.imports] An object to import into the template as free variables. 258 | * @param {RegExp} [options.interpolate] The "interpolate" delimiter. 259 | * @param {string} [options.sourceURL] The sourceURL of the template's compiled source. 260 | * @param {string} [options.variable] The data object variable name. 261 | * @param- {Object} [otherOptions] Enables the legacy `options` param signature. 262 | * @returns {Function} Returns the compiled template function. 263 | * @example 264 | * 265 | * // using the "interpolate" delimiter to create a compiled template 266 | * var compiled = _.template('hello <%= user %>!'); 267 | * compiled({ 'user': 'fred' }); 268 | * // => 'hello fred!' 269 | * 270 | * // using the HTML "escape" delimiter to escape data property values 271 | * var compiled = _.template('<%- value %>'); 272 | * compiled({ 'value': '