hexo
BIN
themes/next/source/lib/Han/dist/font/han-space.otf
vendored
Normal file
BIN
themes/next/source/lib/Han/dist/font/han-space.woff
vendored
Normal file
BIN
themes/next/source/lib/Han/dist/font/han.otf
vendored
Normal file
BIN
themes/next/source/lib/Han/dist/font/han.woff
vendored
Normal file
BIN
themes/next/source/lib/Han/dist/font/han.woff2
vendored
Normal file
1168
themes/next/source/lib/Han/dist/han.css
vendored
Normal file
3005
themes/next/source/lib/Han/dist/han.js
vendored
Normal file
6
themes/next/source/lib/Han/dist/han.min.css
vendored
Normal file
5
themes/next/source/lib/Han/dist/han.min.js
vendored
Normal file
1
themes/next/source/lib/algolia-instant-search/instantsearch.min.css
vendored
Normal file
15
themes/next/source/lib/algolia-instant-search/instantsearch.min.js
vendored
Normal file
1
themes/next/source/lib/canvas-nest/canvas-nest.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
!function(){function o(w,v,i){return w.getAttribute(v)||i}function j(i){return document.getElementsByTagName(i)}function l(){var i=j("script"),w=i.length,v=i[w-1];return{l:w,z:o(v,"zIndex",-1),o:o(v,"opacity",0.5),c:o(v,"color","0,0,0"),n:o(v,"count",99)}}function k(){r=u.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,n=u.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function b(){e.clearRect(0,0,r,n);var w=[f].concat(t);var x,v,A,B,z,y;t.forEach(function(i){i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>r||i.x<0?-1:1,i.ya*=i.y>n||i.y<0?-1:1,e.fillRect(i.x-0.5,i.y-0.5,1,1);for(v=0;v<w.length;v++){x=w[v];if(i!==x&&null!==x.x&&null!==x.y){B=i.x-x.x,z=i.y-x.y,y=B*B+z*z;y<x.max&&(x===f&&y>=x.max/2&&(i.x-=0.03*B,i.y-=0.03*z),A=(x.max-y)/x.max,e.beginPath(),e.lineWidth=A/2,e.strokeStyle="rgba("+s.c+","+(A+0.2)+")",e.moveTo(i.x,i.y),e.lineTo(x.x,x.y),e.stroke())}}w.splice(w.indexOf(i),1)}),m(b)}var u=document.createElement("canvas"),s=l(),c="c_n"+s.l,e=u.getContext("2d"),r,n,m=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(i){window.setTimeout(i,1000/45)},a=Math.random,f={x:null,y:null,max:20000};u.id=c;u.style.cssText="position:fixed;top:0;left:0;z-index:"+s.z+";opacity:"+s.o;j("body")[0].appendChild(u);k(),window.onresize=k;window.onmousemove=function(i){i=i||window.event,f.x=i.clientX,f.y=i.clientY},window.onmouseout=function(){f.x=null,f.y=null};for(var t=[],p=0;s.n>p;p++){var h=a()*r,g=a()*n,q=2*a()-1,d=2*a()-1;t.push({x:h,y:g,xa:q,ya:d,max:6000})}setTimeout(function(){b()},100)}();
|
73
themes/next/source/lib/canvas-ribbon/canvas-ribbon.js
Normal file
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* Created by zproo on 2017/4/8.
|
||||
*/
|
||||
!function () {
|
||||
function getAttr(script, attr, default_val) {
|
||||
return Number(script.getAttribute(attr)) || default_val;
|
||||
}
|
||||
|
||||
// 获取自定义配置
|
||||
var ribbon = document.getElementById('ribbon'); // 当前加载的script
|
||||
config = {
|
||||
zIndex: getAttr(ribbon, "zIndex", -1), // z-index
|
||||
alpha: getAttr(ribbon, "alpha", 0.6), // alpha
|
||||
ribbon_width: getAttr(ribbon, "size", 90), // size
|
||||
};
|
||||
|
||||
var canvas = document.createElement("canvas");
|
||||
canvas.style.cssText = "position:fixed;top:0;left:0;z-index:"+config.zIndex;
|
||||
document.getElementsByTagName("body")[0].appendChild(canvas);
|
||||
|
||||
var canvasRibbon = canvas,
|
||||
ctx = canvasRibbon.getContext('2d'), // 获取canvas 2d上下文
|
||||
dpr = window.devicePixelRatio || 1, // the size of one CSS pixel to the size of one physical pixel.
|
||||
width = window.innerWidth, // 返回窗口的文档显示区的宽高
|
||||
height = window.innerHeight,
|
||||
RIBBON_WIDTH = config.ribbon_width,
|
||||
path,
|
||||
math = Math,
|
||||
r = 0,
|
||||
PI_2 = math.PI * 2, // 圆周率*2
|
||||
cos = math.cos, // cos函数返回一个数值的余弦值(-1~1)
|
||||
random = math.random; // 返回0-1随机数
|
||||
|
||||
canvasRibbon.width = width * dpr; // 返回实际宽高
|
||||
canvasRibbon.height = height * dpr;
|
||||
ctx.scale(dpr, dpr); // 水平、竖直方向缩放
|
||||
ctx.globalAlpha = config.alpha; // 图形透明度
|
||||
|
||||
function init() {
|
||||
ctx.clearRect(0, 0, width, height); // 擦除之前绘制内容
|
||||
path = [{x: 0, y: height * 0.7 + RIBBON_WIDTH}, {x: 0, y: height * 0.7 - RIBBON_WIDTH}];
|
||||
// 路径没有填满屏幕宽度时,绘制路径
|
||||
while (path[1].x < width + RIBBON_WIDTH) {
|
||||
draw(path[0], path[1])
|
||||
}
|
||||
}
|
||||
|
||||
function draw(start, end) {
|
||||
ctx.beginPath(); // 创建一个新的路径
|
||||
ctx.moveTo(start.x, start.y); // path起点
|
||||
ctx.lineTo(end.x, end.y); // path终点
|
||||
var nextX = end.x + (random() * 2 - 0.25) * RIBBON_WIDTH,
|
||||
nextY = geneY(end.y);
|
||||
ctx.lineTo(nextX, nextY);
|
||||
ctx.closePath();
|
||||
|
||||
r -= PI_2 / -50;
|
||||
// 随机生成并设置canvas路径16进制颜色
|
||||
ctx.fillStyle = '#' + (cos(r) * 127 + 128 << 16 | cos(r + PI_2 / 3) * 127 + 128 << 8 | cos(r + PI_2 / 3 * 2) * 127 + 128).toString(16);
|
||||
ctx.fill(); // 根据当前样式填充路径
|
||||
path[0] = path[1]; // 起点更新为当前终点
|
||||
path[1] = {x: nextX, y: nextY} // 更新终点
|
||||
}
|
||||
|
||||
function geneY(y) {
|
||||
var temp = y + (random() * 2 - 1.1) * RIBBON_WIDTH;
|
||||
return (temp > height || temp < 0) ? geneY(y) : temp;
|
||||
}
|
||||
|
||||
document.onclick = init;
|
||||
document.ontouchstart = init;
|
||||
init();
|
||||
}();
|
BIN
themes/next/source/lib/fancybox/source/blank.gif
Normal file
After Width: | Height: | Size: 43 B |
BIN
themes/next/source/lib/fancybox/source/fancybox_loading.gif
Normal file
After Width: | Height: | Size: 6.4 KiB |
BIN
themes/next/source/lib/fancybox/source/fancybox_loading@2x.gif
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
themes/next/source/lib/fancybox/source/fancybox_overlay.png
Normal file
After Width: | Height: | Size: 1003 B |
BIN
themes/next/source/lib/fancybox/source/fancybox_sprite.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
themes/next/source/lib/fancybox/source/fancybox_sprite@2x.png
Normal file
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,97 @@
|
||||
#fancybox-buttons {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
z-index: 8050;
|
||||
}
|
||||
|
||||
#fancybox-buttons.top {
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
#fancybox-buttons.bottom {
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#fancybox-buttons ul {
|
||||
display: block;
|
||||
width: 166px;
|
||||
height: 30px;
|
||||
margin: 0 auto;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
border: 1px solid #111;
|
||||
border-radius: 3px;
|
||||
-webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
|
||||
-moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
|
||||
box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
|
||||
background: rgb(50,50,50);
|
||||
background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51)));
|
||||
background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
|
||||
background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
|
||||
background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
|
||||
background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 );
|
||||
}
|
||||
|
||||
#fancybox-buttons ul li {
|
||||
float: left;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#fancybox-buttons a {
|
||||
display: block;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
text-indent: -9999px;
|
||||
background-color: transparent;
|
||||
background-image: url('fancybox_buttons.png');
|
||||
background-repeat: no-repeat;
|
||||
outline: none;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
#fancybox-buttons a:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#fancybox-buttons a.btnPrev {
|
||||
background-position: 5px 0;
|
||||
}
|
||||
|
||||
#fancybox-buttons a.btnNext {
|
||||
background-position: -33px 0;
|
||||
border-right: 1px solid #3e3e3e;
|
||||
}
|
||||
|
||||
#fancybox-buttons a.btnPlay {
|
||||
background-position: 0 -30px;
|
||||
}
|
||||
|
||||
#fancybox-buttons a.btnPlayOn {
|
||||
background-position: -30px -30px;
|
||||
}
|
||||
|
||||
#fancybox-buttons a.btnToggle {
|
||||
background-position: 3px -60px;
|
||||
border-left: 1px solid #111;
|
||||
border-right: 1px solid #3e3e3e;
|
||||
width: 35px
|
||||
}
|
||||
|
||||
#fancybox-buttons a.btnToggleOn {
|
||||
background-position: -27px -60px;
|
||||
}
|
||||
|
||||
#fancybox-buttons a.btnClose {
|
||||
border-left: 1px solid #111;
|
||||
width: 35px;
|
||||
background-position: -56px 0px;
|
||||
}
|
||||
|
||||
#fancybox-buttons a.btnDisabled {
|
||||
opacity : 0.4;
|
||||
cursor: default;
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
/*!
|
||||
* Buttons helper for fancyBox
|
||||
* version: 1.0.5 (Mon, 15 Oct 2012)
|
||||
* @requires fancyBox v2.0 or later
|
||||
*
|
||||
* Usage:
|
||||
* $(".fancybox").fancybox({
|
||||
* helpers : {
|
||||
* buttons: {
|
||||
* position : 'top'
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*/
|
||||
(function ($) {
|
||||
//Shortcut for fancyBox object
|
||||
var F = $.fancybox;
|
||||
|
||||
//Add helper object
|
||||
F.helpers.buttons = {
|
||||
defaults : {
|
||||
skipSingle : false, // disables if gallery contains single image
|
||||
position : 'top', // 'top' or 'bottom'
|
||||
tpl : '<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:;"></a></li></ul></div>'
|
||||
},
|
||||
|
||||
list : null,
|
||||
buttons: null,
|
||||
|
||||
beforeLoad: function (opts, obj) {
|
||||
//Remove self if gallery do not have at least two items
|
||||
|
||||
if (opts.skipSingle && obj.group.length < 2) {
|
||||
obj.helpers.buttons = false;
|
||||
obj.closeBtn = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Increase top margin to give space for buttons
|
||||
obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30;
|
||||
},
|
||||
|
||||
onPlayStart: function () {
|
||||
if (this.buttons) {
|
||||
this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn');
|
||||
}
|
||||
},
|
||||
|
||||
onPlayEnd: function () {
|
||||
if (this.buttons) {
|
||||
this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn');
|
||||
}
|
||||
},
|
||||
|
||||
afterShow: function (opts, obj) {
|
||||
var buttons = this.buttons;
|
||||
|
||||
if (!buttons) {
|
||||
this.list = $(opts.tpl).addClass(opts.position).appendTo('body');
|
||||
|
||||
buttons = {
|
||||
prev : this.list.find('.btnPrev').click( F.prev ),
|
||||
next : this.list.find('.btnNext').click( F.next ),
|
||||
play : this.list.find('.btnPlay').click( F.play ),
|
||||
toggle : this.list.find('.btnToggle').click( F.toggle ),
|
||||
close : this.list.find('.btnClose').click( F.close )
|
||||
}
|
||||
}
|
||||
|
||||
//Prev
|
||||
if (obj.index > 0 || obj.loop) {
|
||||
buttons.prev.removeClass('btnDisabled');
|
||||
} else {
|
||||
buttons.prev.addClass('btnDisabled');
|
||||
}
|
||||
|
||||
//Next / Play
|
||||
if (obj.loop || obj.index < obj.group.length - 1) {
|
||||
buttons.next.removeClass('btnDisabled');
|
||||
buttons.play.removeClass('btnDisabled');
|
||||
|
||||
} else {
|
||||
buttons.next.addClass('btnDisabled');
|
||||
buttons.play.addClass('btnDisabled');
|
||||
}
|
||||
|
||||
this.buttons = buttons;
|
||||
|
||||
this.onUpdate(opts, obj);
|
||||
},
|
||||
|
||||
onUpdate: function (opts, obj) {
|
||||
var toggle;
|
||||
|
||||
if (!this.buttons) {
|
||||
return;
|
||||
}
|
||||
|
||||
toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn');
|
||||
|
||||
//Size toggle button
|
||||
if (obj.canShrink) {
|
||||
toggle.addClass('btnToggleOn');
|
||||
|
||||
} else if (!obj.canExpand) {
|
||||
toggle.addClass('btnDisabled');
|
||||
}
|
||||
},
|
||||
|
||||
beforeClose: function () {
|
||||
if (this.list) {
|
||||
this.list.remove();
|
||||
}
|
||||
|
||||
this.list = null;
|
||||
this.buttons = null;
|
||||
}
|
||||
};
|
||||
|
||||
}(jQuery));
|
@ -0,0 +1,199 @@
|
||||
/*!
|
||||
* Media helper for fancyBox
|
||||
* version: 1.0.6 (Fri, 14 Jun 2013)
|
||||
* @requires fancyBox v2.0 or later
|
||||
*
|
||||
* Usage:
|
||||
* $(".fancybox").fancybox({
|
||||
* helpers : {
|
||||
* media: true
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Set custom URL parameters:
|
||||
* $(".fancybox").fancybox({
|
||||
* helpers : {
|
||||
* media: {
|
||||
* youtube : {
|
||||
* params : {
|
||||
* autoplay : 0
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Or:
|
||||
* $(".fancybox").fancybox({,
|
||||
* helpers : {
|
||||
* media: true
|
||||
* },
|
||||
* youtube : {
|
||||
* autoplay: 0
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Supports:
|
||||
*
|
||||
* Youtube
|
||||
* http://www.youtube.com/watch?v=opj24KnzrWo
|
||||
* http://www.youtube.com/embed/opj24KnzrWo
|
||||
* http://youtu.be/opj24KnzrWo
|
||||
* http://www.youtube-nocookie.com/embed/opj24KnzrWo
|
||||
* Vimeo
|
||||
* http://vimeo.com/40648169
|
||||
* http://vimeo.com/channels/staffpicks/38843628
|
||||
* http://vimeo.com/groups/surrealism/videos/36516384
|
||||
* http://player.vimeo.com/video/45074303
|
||||
* Metacafe
|
||||
* http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/
|
||||
* http://www.metacafe.com/watch/7635964/
|
||||
* Dailymotion
|
||||
* http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people
|
||||
* Twitvid
|
||||
* http://twitvid.com/QY7MD
|
||||
* Twitpic
|
||||
* http://twitpic.com/7p93st
|
||||
* Instagram
|
||||
* http://instagr.am/p/IejkuUGxQn/
|
||||
* http://instagram.com/p/IejkuUGxQn/
|
||||
* Google maps
|
||||
* http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17
|
||||
* http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
|
||||
* http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56
|
||||
*/
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
//Shortcut for fancyBox object
|
||||
var F = $.fancybox,
|
||||
format = function( url, rez, params ) {
|
||||
params = params || '';
|
||||
|
||||
if ( $.type( params ) === "object" ) {
|
||||
params = $.param(params, true);
|
||||
}
|
||||
|
||||
$.each(rez, function(key, value) {
|
||||
url = url.replace( '$' + key, value || '' );
|
||||
});
|
||||
|
||||
if (params.length) {
|
||||
url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params;
|
||||
}
|
||||
|
||||
return url;
|
||||
};
|
||||
|
||||
//Add helper object
|
||||
F.helpers.media = {
|
||||
defaults : {
|
||||
youtube : {
|
||||
matcher : /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
|
||||
params : {
|
||||
autoplay : 1,
|
||||
autohide : 1,
|
||||
fs : 1,
|
||||
rel : 0,
|
||||
hd : 1,
|
||||
wmode : 'opaque',
|
||||
enablejsapi : 1
|
||||
},
|
||||
type : 'iframe',
|
||||
url : '//www.youtube.com/embed/$3'
|
||||
},
|
||||
vimeo : {
|
||||
matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/,
|
||||
params : {
|
||||
autoplay : 1,
|
||||
hd : 1,
|
||||
show_title : 1,
|
||||
show_byline : 1,
|
||||
show_portrait : 0,
|
||||
fullscreen : 1
|
||||
},
|
||||
type : 'iframe',
|
||||
url : '//player.vimeo.com/video/$1'
|
||||
},
|
||||
metacafe : {
|
||||
matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/,
|
||||
params : {
|
||||
autoPlay : 'yes'
|
||||
},
|
||||
type : 'swf',
|
||||
url : function( rez, params, obj ) {
|
||||
obj.swf.flashVars = 'playerVars=' + $.param( params, true );
|
||||
|
||||
return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf';
|
||||
}
|
||||
},
|
||||
dailymotion : {
|
||||
matcher : /dailymotion.com\/video\/(.*)\/?(.*)/,
|
||||
params : {
|
||||
additionalInfos : 0,
|
||||
autoStart : 1
|
||||
},
|
||||
type : 'swf',
|
||||
url : '//www.dailymotion.com/swf/video/$1'
|
||||
},
|
||||
twitvid : {
|
||||
matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i,
|
||||
params : {
|
||||
autoplay : 0
|
||||
},
|
||||
type : 'iframe',
|
||||
url : '//www.twitvid.com/embed.php?guid=$1'
|
||||
},
|
||||
twitpic : {
|
||||
matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i,
|
||||
type : 'image',
|
||||
url : '//twitpic.com/show/full/$1/'
|
||||
},
|
||||
instagram : {
|
||||
matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
|
||||
type : 'image',
|
||||
url : '//$1/p/$2/media/?size=l'
|
||||
},
|
||||
google_maps : {
|
||||
matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i,
|
||||
type : 'iframe',
|
||||
url : function( rez ) {
|
||||
return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
beforeLoad : function(opts, obj) {
|
||||
var url = obj.href || '',
|
||||
type = false,
|
||||
what,
|
||||
item,
|
||||
rez,
|
||||
params;
|
||||
|
||||
for (what in opts) {
|
||||
if (opts.hasOwnProperty(what)) {
|
||||
item = opts[ what ];
|
||||
rez = url.match( item.matcher );
|
||||
|
||||
if (rez) {
|
||||
type = item.type;
|
||||
params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null));
|
||||
|
||||
url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type) {
|
||||
obj.href = url;
|
||||
obj.type = type;
|
||||
|
||||
obj.autoHeight = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}(jQuery));
|
@ -0,0 +1,55 @@
|
||||
#fancybox-thumbs {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
z-index: 8050;
|
||||
}
|
||||
|
||||
#fancybox-thumbs.bottom {
|
||||
bottom: 2px;
|
||||
}
|
||||
|
||||
#fancybox-thumbs.top {
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
#fancybox-thumbs ul {
|
||||
position: relative;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#fancybox-thumbs ul li {
|
||||
float: left;
|
||||
padding: 1px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
#fancybox-thumbs ul li.active {
|
||||
opacity: 0.75;
|
||||
padding: 0;
|
||||
border: 1px solid #fff;
|
||||
}
|
||||
|
||||
#fancybox-thumbs ul li:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#fancybox-thumbs ul li a {
|
||||
display: block;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border: 1px solid #222;
|
||||
background: #111;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#fancybox-thumbs ul li img {
|
||||
display: block;
|
||||
position: relative;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
max-width: none;
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
/*!
|
||||
* Thumbnail helper for fancyBox
|
||||
* version: 1.0.7 (Mon, 01 Oct 2012)
|
||||
* @requires fancyBox v2.0 or later
|
||||
*
|
||||
* Usage:
|
||||
* $(".fancybox").fancybox({
|
||||
* helpers : {
|
||||
* thumbs: {
|
||||
* width : 50,
|
||||
* height : 50
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
*/
|
||||
(function ($) {
|
||||
//Shortcut for fancyBox object
|
||||
var F = $.fancybox;
|
||||
|
||||
//Add helper object
|
||||
F.helpers.thumbs = {
|
||||
defaults : {
|
||||
width : 50, // thumbnail width
|
||||
height : 50, // thumbnail height
|
||||
position : 'bottom', // 'top' or 'bottom'
|
||||
source : function ( item ) { // function to obtain the URL of the thumbnail image
|
||||
var href;
|
||||
|
||||
if (item.element) {
|
||||
href = $(item.element).find('img').attr('src');
|
||||
}
|
||||
|
||||
if (!href && item.type === 'image' && item.href) {
|
||||
href = item.href;
|
||||
}
|
||||
|
||||
return href;
|
||||
}
|
||||
},
|
||||
|
||||
wrap : null,
|
||||
list : null,
|
||||
width : 0,
|
||||
|
||||
init: function (opts, obj) {
|
||||
var that = this,
|
||||
list,
|
||||
thumbWidth = opts.width,
|
||||
thumbHeight = opts.height,
|
||||
thumbSource = opts.source;
|
||||
|
||||
//Build list structure
|
||||
list = '';
|
||||
|
||||
for (var n = 0; n < obj.group.length; n++) {
|
||||
list += '<li><a style="width:' + thumbWidth + 'px;height:' + thumbHeight + 'px;" href="javascript:jQuery.fancybox.jumpto(' + n + ');"></a></li>';
|
||||
}
|
||||
|
||||
this.wrap = $('<div id="fancybox-thumbs"></div>').addClass(opts.position).appendTo('body');
|
||||
this.list = $('<ul>' + list + '</ul>').appendTo(this.wrap);
|
||||
|
||||
//Load each thumbnail
|
||||
$.each(obj.group, function (i) {
|
||||
var href = thumbSource( obj.group[ i ] );
|
||||
|
||||
if (!href) {
|
||||
return;
|
||||
}
|
||||
|
||||
$("<img />").load(function () {
|
||||
var width = this.width,
|
||||
height = this.height,
|
||||
widthRatio, heightRatio, parent;
|
||||
|
||||
if (!that.list || !width || !height) {
|
||||
return;
|
||||
}
|
||||
|
||||
//Calculate thumbnail width/height and center it
|
||||
widthRatio = width / thumbWidth;
|
||||
heightRatio = height / thumbHeight;
|
||||
|
||||
parent = that.list.children().eq(i).find('a');
|
||||
|
||||
if (widthRatio >= 1 && heightRatio >= 1) {
|
||||
if (widthRatio > heightRatio) {
|
||||
width = Math.floor(width / heightRatio);
|
||||
height = thumbHeight;
|
||||
|
||||
} else {
|
||||
width = thumbWidth;
|
||||
height = Math.floor(height / widthRatio);
|
||||
}
|
||||
}
|
||||
|
||||
$(this).css({
|
||||
width : width,
|
||||
height : height,
|
||||
top : Math.floor(thumbHeight / 2 - height / 2),
|
||||
left : Math.floor(thumbWidth / 2 - width / 2)
|
||||
});
|
||||
|
||||
parent.width(thumbWidth).height(thumbHeight);
|
||||
|
||||
$(this).hide().appendTo(parent).fadeIn(300);
|
||||
|
||||
}).attr('src', href);
|
||||
});
|
||||
|
||||
//Set initial width
|
||||
this.width = this.list.children().eq(0).outerWidth(true);
|
||||
|
||||
this.list.width(this.width * (obj.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)));
|
||||
},
|
||||
|
||||
beforeLoad: function (opts, obj) {
|
||||
//Remove self if gallery do not have at least two items
|
||||
if (obj.group.length < 2) {
|
||||
obj.helpers.thumbs = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Increase bottom margin to give space for thumbs
|
||||
obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15);
|
||||
},
|
||||
|
||||
afterShow: function (opts, obj) {
|
||||
//Check if exists and create or update list
|
||||
if (this.list) {
|
||||
this.onUpdate(opts, obj);
|
||||
|
||||
} else {
|
||||
this.init(opts, obj);
|
||||
}
|
||||
|
||||
//Set active element
|
||||
this.list.children().removeClass('active').eq(obj.index).addClass('active');
|
||||
},
|
||||
|
||||
//Center list
|
||||
onUpdate: function (opts, obj) {
|
||||
if (this.list) {
|
||||
this.list.stop(true).animate({
|
||||
'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))
|
||||
}, 150);
|
||||
}
|
||||
},
|
||||
|
||||
beforeClose: function () {
|
||||
if (this.wrap) {
|
||||
this.wrap.remove();
|
||||
}
|
||||
|
||||
this.wrap = null;
|
||||
this.list = null;
|
||||
this.width = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}(jQuery));
|
274
themes/next/source/lib/fancybox/source/jquery.fancybox.css
vendored
Normal file
@ -0,0 +1,274 @@
|
||||
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
.fancybox-wrap,
|
||||
.fancybox-skin,
|
||||
.fancybox-outer,
|
||||
.fancybox-inner,
|
||||
.fancybox-image,
|
||||
.fancybox-wrap iframe,
|
||||
.fancybox-wrap object,
|
||||
.fancybox-nav,
|
||||
.fancybox-nav span,
|
||||
.fancybox-tmp
|
||||
{
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: 0;
|
||||
outline: none;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.fancybox-wrap {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 8020;
|
||||
}
|
||||
|
||||
.fancybox-skin {
|
||||
position: relative;
|
||||
background: #f9f9f9;
|
||||
color: #444;
|
||||
text-shadow: none;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.fancybox-opened {
|
||||
z-index: 8030;
|
||||
}
|
||||
|
||||
.fancybox-opened .fancybox-skin {
|
||||
-webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.fancybox-outer, .fancybox-inner {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.fancybox-inner {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fancybox-type-iframe .fancybox-inner {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
|
||||
.fancybox-error {
|
||||
color: #444;
|
||||
font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
margin: 0;
|
||||
padding: 15px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fancybox-image, .fancybox-iframe {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fancybox-image {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
|
||||
background-image: url('fancybox_sprite.png');
|
||||
}
|
||||
|
||||
#fancybox-loading {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -22px;
|
||||
margin-left: -22px;
|
||||
background-position: 0 -108px;
|
||||
opacity: 0.8;
|
||||
cursor: pointer;
|
||||
z-index: 8060;
|
||||
}
|
||||
|
||||
#fancybox-loading div {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
background: url('fancybox_loading.gif') center center no-repeat;
|
||||
}
|
||||
|
||||
.fancybox-close {
|
||||
position: absolute;
|
||||
top: -18px;
|
||||
right: -18px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
cursor: pointer;
|
||||
z-index: 8040;
|
||||
}
|
||||
|
||||
.fancybox-nav {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 40%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
background: transparent url('blank.gif'); /* helps IE */
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
z-index: 8040;
|
||||
}
|
||||
|
||||
.fancybox-prev {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.fancybox-next {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.fancybox-nav span {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 36px;
|
||||
height: 34px;
|
||||
margin-top: -18px;
|
||||
cursor: pointer;
|
||||
z-index: 8040;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.fancybox-prev span {
|
||||
left: 10px;
|
||||
background-position: 0 -36px;
|
||||
}
|
||||
|
||||
.fancybox-next span {
|
||||
right: 10px;
|
||||
background-position: 0 -72px;
|
||||
}
|
||||
|
||||
.fancybox-nav:hover span {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.fancybox-tmp {
|
||||
position: absolute;
|
||||
top: -99999px;
|
||||
left: -99999px;
|
||||
visibility: hidden;
|
||||
max-width: 99999px;
|
||||
max-height: 99999px;
|
||||
overflow: visible !important;
|
||||
}
|
||||
|
||||
/* Overlay helper */
|
||||
|
||||
.fancybox-lock {
|
||||
overflow: hidden !important;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.fancybox-lock body {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.fancybox-lock-test {
|
||||
overflow-y: hidden !important;
|
||||
}
|
||||
|
||||
.fancybox-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
z-index: 8010;
|
||||
background: url('fancybox_overlay.png');
|
||||
}
|
||||
|
||||
.fancybox-overlay-fixed {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.fancybox-lock .fancybox-overlay {
|
||||
overflow: auto;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
/* Title helper */
|
||||
|
||||
.fancybox-title {
|
||||
visibility: hidden;
|
||||
font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
|
||||
position: relative;
|
||||
text-shadow: none;
|
||||
z-index: 8050;
|
||||
}
|
||||
|
||||
.fancybox-opened .fancybox-title {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.fancybox-title-float-wrap {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 50%;
|
||||
margin-bottom: -35px;
|
||||
z-index: 8050;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.fancybox-title-float-wrap .child {
|
||||
display: inline-block;
|
||||
margin-right: -100%;
|
||||
padding: 2px 20px;
|
||||
background: transparent; /* Fallback for web browsers that doesn't support RGBa */
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
-webkit-border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px;
|
||||
text-shadow: 0 1px 2px #222;
|
||||
color: #FFF;
|
||||
font-weight: bold;
|
||||
line-height: 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.fancybox-title-outside-wrap {
|
||||
position: relative;
|
||||
margin-top: 10px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.fancybox-title-inside-wrap {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.fancybox-title-over-wrap {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
color: #fff;
|
||||
padding: 10px;
|
||||
background: #000;
|
||||
background: rgba(0, 0, 0, .8);
|
||||
}
|
||||
|
||||
/*Retina graphics!*/
|
||||
@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
|
||||
only screen and (min--moz-device-pixel-ratio: 1.5),
|
||||
only screen and (min-device-pixel-ratio: 1.5){
|
||||
|
||||
#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
|
||||
background-image: url('fancybox_sprite@2x.png');
|
||||
background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/
|
||||
}
|
||||
|
||||
#fancybox-loading div {
|
||||
background-image: url('fancybox_loading@2x.gif');
|
||||
background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/
|
||||
}
|
||||
}
|
2020
themes/next/source/lib/fancybox/source/jquery.fancybox.js
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20,
|
||||
width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},
|
||||
keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+
|
||||
(I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,
|
||||
openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
|
||||
isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,
|
||||
c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&
|
||||
k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||
|
||||
b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=
|
||||
setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current;
|
||||
d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d=
|
||||
a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")),
|
||||
b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(),
|
||||
y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement;
|
||||
if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&&
|
||||
(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0,
|
||||
{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,
|
||||
mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=
|
||||
!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");
|
||||
"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload=
|
||||
this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);
|
||||
f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,
|
||||
e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,
|
||||
outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}",
|
||||
g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll":
|
||||
"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside?
|
||||
h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth||
|
||||
h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&&
|
||||
"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width();
|
||||
y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&&
|
||||
!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(),
|
||||
b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a=
|
||||
a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):
|
||||
(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"===
|
||||
f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c,
|
||||
{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=
|
||||
b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay=
|
||||
f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?
|
||||
b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth),
|
||||
p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"===
|
||||
f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=
|
||||
b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,
|
||||
e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+
|
||||
":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20===
|
||||
d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery);
|
24
themes/next/source/lib/fastclick/.bower.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "fastclick",
|
||||
"main": "lib/fastclick.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"component.json",
|
||||
"package.json",
|
||||
"Makefile",
|
||||
"tests",
|
||||
"examples"
|
||||
],
|
||||
"homepage": "https://github.com/ftlabs/fastclick",
|
||||
"version": "1.0.6",
|
||||
"_release": "1.0.6",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.6",
|
||||
"commit": "2ac7258407619398005ca720596f0d36ce66a6c8"
|
||||
},
|
||||
"_source": "git://github.com/ftlabs/fastclick.git",
|
||||
"_target": "~1.0.6",
|
||||
"_originalSource": "fastclick",
|
||||
"_direct": true
|
||||
}
|
22
themes/next/source/lib/fastclick/LICENSE
Normal file
@ -0,0 +1,22 @@
|
||||
Copyright (c) 2014 The Financial Times Ltd.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
140
themes/next/source/lib/fastclick/README.md
Normal file
@ -0,0 +1,140 @@
|
||||
# FastClick #
|
||||
|
||||
FastClick is a simple, easy-to-use library for eliminating the 300ms delay between a physical tap and the firing of a `click` event on mobile browsers. The aim is to make your application feel less laggy and more responsive while avoiding any interference with your current logic.
|
||||
|
||||
FastClick is developed by [FT Labs](http://labs.ft.com/), part of the Financial Times.
|
||||
|
||||
[Explication en français](http://maxime.sh/2013/02/supprimer-le-lag-des-clics-sur-mobile-avec-fastclick/).
|
||||
|
||||
[日本語で説明](https://developer.mozilla.org/ja/docs/Mozilla/Firefox_OS/Apps/Tips_and_techniques#Make_events_immediate)。
|
||||
|
||||
## Why does the delay exist? ##
|
||||
|
||||
According to [Google](https://developers.google.com/mobile/articles/fast_buttons):
|
||||
|
||||
> ...mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.
|
||||
|
||||
## Compatibility ##
|
||||
|
||||
The library has been deployed as part of the [FT Web App](http://app.ft.com/) and is tried and tested on the following mobile browsers:
|
||||
|
||||
* Mobile Safari on iOS 3 and upwards
|
||||
* Chrome on iOS 5 and upwards
|
||||
* Chrome on Android (ICS)
|
||||
* Opera Mobile 11.5 and upwards
|
||||
* Android Browser since Android 2
|
||||
* PlayBook OS 1 and upwards
|
||||
|
||||
## When it isn't needed ##
|
||||
|
||||
FastClick doesn't attach any listeners on desktop browsers.
|
||||
|
||||
Chrome 32+ on Android with `width=device-width` in the [viewport meta tag](https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag) doesn't have a 300ms delay, therefore listeners aren't attached.
|
||||
|
||||
```html
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
```
|
||||
|
||||
Same goes for Chrome on Android (all versions) with `user-scalable=no` in the viewport meta tag. But be aware that `user-scalable=no` also disables pinch zooming, which may be an accessibility concern.
|
||||
|
||||
For IE11+, you can use `touch-action: manipulation;` to disable double-tap-to-zoom on certain elements (like links and buttons). For IE10 use `-ms-touch-action: manipulation`.
|
||||
|
||||
## Usage ##
|
||||
|
||||
Include fastclick.js in your JavaScript bundle or add it to your HTML page like this:
|
||||
|
||||
```html
|
||||
<script type='application/javascript' src='/path/to/fastclick.js'></script>
|
||||
```
|
||||
|
||||
The script must be loaded prior to instantiating FastClick on any element of the page.
|
||||
|
||||
To instantiate FastClick on the `body`, which is the recommended method of use:
|
||||
|
||||
```js
|
||||
if ('addEventListener' in document) {
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
FastClick.attach(document.body);
|
||||
}, false);
|
||||
}
|
||||
```
|
||||
|
||||
Or, if you're using jQuery:
|
||||
|
||||
```js
|
||||
$(function() {
|
||||
FastClick.attach(document.body);
|
||||
});
|
||||
```
|
||||
|
||||
If you're using Browserify or another CommonJS-style module system, the `FastClick.attach` function will be returned when you call `require('fastclick')`. As a result, the easiest way to use FastClick with these loaders is as follows:
|
||||
|
||||
```js
|
||||
var attachFastClick = require('fastclick');
|
||||
attachFastClick(document.body);
|
||||
```
|
||||
|
||||
### Minified ###
|
||||
|
||||
Run `make` to build a minified version of FastClick using the Closure Compiler REST API. The minified file is saved to `build/fastclick.min.js` or you can [download a pre-minified version](http://build.origami.ft.com/bundles/js?modules=fastclick).
|
||||
|
||||
Note: the pre-minified version is built using [our build service](http://origami.ft.com/docs/developer-guide/build-service/) which exposes the `FastClick` object through `Origami.fastclick` and will have the Browserify/CommonJS API (see above).
|
||||
|
||||
```js
|
||||
var attachFastClick = Origami.fastclick;
|
||||
attachFastClick(document.body);
|
||||
```
|
||||
|
||||
### AMD ###
|
||||
|
||||
FastClick has AMD (Asynchronous Module Definition) support. This allows it to be lazy-loaded with an AMD loader, such as [RequireJS](http://requirejs.org/). Note that when using the AMD style require, the full `FastClick` object will be returned, _not_ `FastClick.attach`
|
||||
|
||||
```js
|
||||
var FastClick = require('fastclick');
|
||||
FastClick.attach(document.body, options);
|
||||
```
|
||||
|
||||
### Package managers ###
|
||||
|
||||
You can install FastClick using [Component](https://github.com/component/component), [npm](https://npmjs.org/package/fastclick) or [Bower](http://bower.io/).
|
||||
|
||||
For Ruby, there's a third-party gem called [fastclick-rails](http://rubygems.org/gems/fastclick-rails). For .NET there's a [NuGet package](http://nuget.org/packages/FastClick).
|
||||
|
||||
## Advanced ##
|
||||
|
||||
### Ignore certain elements with `needsclick` ###
|
||||
|
||||
Sometimes you need FastClick to ignore certain elements. You can do this easily by adding the `needsclick` class.
|
||||
```html
|
||||
<a class="needsclick">Ignored by FastClick</a>
|
||||
```
|
||||
|
||||
#### Use case 1: non-synthetic click required ####
|
||||
|
||||
Internally, FastClick uses `document.createEvent` to fire a synthetic `click` event as soon as `touchend` is fired by the browser. It then suppresses the additional `click` event created by the browser after that. In some cases, the non-synthetic `click` event created by the browser is required, as described in the [triggering focus example](http://ftlabs.github.com/fastclick/examples/focus.html).
|
||||
|
||||
This is where the `needsclick` class comes in. Add the class to any element that requires a non-synthetic click.
|
||||
|
||||
#### Use case 2: Twitter Bootstrap 2.2.2 dropdowns ####
|
||||
|
||||
Another example of when to use the `needsclick` class is with dropdowns in Twitter Bootstrap 2.2.2. Bootstrap add its own `touchstart` listener for dropdowns, so you want to tell FastClick to ignore those. If you don't, touch devices will automatically close the dropdown as soon as it is clicked, because both FastClick and Bootstrap execute the synthetic click, one opens the dropdown, the second closes it immediately after.
|
||||
|
||||
```html
|
||||
<a class="dropdown-toggle needsclick" data-toggle="dropdown">Dropdown</a>
|
||||
```
|
||||
|
||||
## Examples ##
|
||||
|
||||
FastClick is designed to cope with many different browser oddities. Here are some examples to illustrate this:
|
||||
|
||||
* [basic use](http://ftlabs.github.com/fastclick/examples/layer.html) showing the increase in perceived responsiveness
|
||||
* [triggering focus](http://ftlabs.github.com/fastclick/examples/focus.html) on an input element from a `click` handler
|
||||
* [input element](http://ftlabs.github.com/fastclick/examples/input.html) which never receives clicks but gets fast focus
|
||||
|
||||
## Tests ##
|
||||
|
||||
There are no automated tests. The files in `tests/` are manual reduced test cases. We've had a think about how best to test these cases, but they tend to be very browser/device specific and sometimes subjective which means it's not so trivial to test.
|
||||
|
||||
## Credits and collaboration ##
|
||||
|
||||
FastClick is maintained by [Rowan Beentje](http://twitter.com/rowanbeentje), [Matthew Caruana Galizia](http://twitter.com/mcaruanagalizia) and [Matthew Andrews](http://twitter.com/andrewsmatt) at [FT Labs](http://labs.ft.com). All open source code released by FT Labs is licenced under the MIT licence. We welcome comments, feedback and suggestions. Please feel free to raise an issue or pull request.
|
12
themes/next/source/lib/fastclick/bower.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "fastclick",
|
||||
"main": "lib/fastclick.js",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"component.json",
|
||||
"package.json",
|
||||
"Makefile",
|
||||
"tests",
|
||||
"examples"
|
||||
]
|
||||
}
|
841
themes/next/source/lib/fastclick/lib/fastclick.js
Normal file
@ -0,0 +1,841 @@
|
||||
;(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @preserve FastClick: polyfill to remove click delays on browsers with touch UIs.
|
||||
*
|
||||
* @codingstandard ftlabs-jsv2
|
||||
* @copyright The Financial Times Limited [All Rights Reserved]
|
||||
* @license MIT License (see LICENSE.txt)
|
||||
*/
|
||||
|
||||
/*jslint browser:true, node:true*/
|
||||
/*global define, Event, Node*/
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate fast-clicking listeners on the specified layer.
|
||||
*
|
||||
* @constructor
|
||||
* @param {Element} layer The layer to listen on
|
||||
* @param {Object} [options={}] The options to override the defaults
|
||||
*/
|
||||
function FastClick(layer, options) {
|
||||
var oldOnClick;
|
||||
|
||||
options = options || {};
|
||||
|
||||
/**
|
||||
* Whether a click is currently being tracked.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
this.trackingClick = false;
|
||||
|
||||
|
||||
/**
|
||||
* Timestamp for when click tracking started.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.trackingClickStart = 0;
|
||||
|
||||
|
||||
/**
|
||||
* The element being tracked for a click.
|
||||
*
|
||||
* @type EventTarget
|
||||
*/
|
||||
this.targetElement = null;
|
||||
|
||||
|
||||
/**
|
||||
* X-coordinate of touch start event.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.touchStartX = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Y-coordinate of touch start event.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.touchStartY = 0;
|
||||
|
||||
|
||||
/**
|
||||
* ID of the last touch, retrieved from Touch.identifier.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.lastTouchIdentifier = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Touchmove boundary, beyond which a click will be cancelled.
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.touchBoundary = options.touchBoundary || 10;
|
||||
|
||||
|
||||
/**
|
||||
* The FastClick layer.
|
||||
*
|
||||
* @type Element
|
||||
*/
|
||||
this.layer = layer;
|
||||
|
||||
/**
|
||||
* The minimum time between tap(touchstart and touchend) events
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.tapDelay = options.tapDelay || 200;
|
||||
|
||||
/**
|
||||
* The maximum time for a tap
|
||||
*
|
||||
* @type number
|
||||
*/
|
||||
this.tapTimeout = options.tapTimeout || 700;
|
||||
|
||||
if (FastClick.notNeeded(layer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Some old versions of Android don't have Function.prototype.bind
|
||||
function bind(method, context) {
|
||||
return function() { return method.apply(context, arguments); };
|
||||
}
|
||||
|
||||
|
||||
var methods = ['onMouse', 'onClick', 'onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'];
|
||||
var context = this;
|
||||
for (var i = 0, l = methods.length; i < l; i++) {
|
||||
context[methods[i]] = bind(context[methods[i]], context);
|
||||
}
|
||||
|
||||
// Set up event handlers as required
|
||||
if (deviceIsAndroid) {
|
||||
layer.addEventListener('mouseover', this.onMouse, true);
|
||||
layer.addEventListener('mousedown', this.onMouse, true);
|
||||
layer.addEventListener('mouseup', this.onMouse, true);
|
||||
}
|
||||
|
||||
layer.addEventListener('click', this.onClick, true);
|
||||
layer.addEventListener('touchstart', this.onTouchStart, false);
|
||||
layer.addEventListener('touchmove', this.onTouchMove, false);
|
||||
layer.addEventListener('touchend', this.onTouchEnd, false);
|
||||
layer.addEventListener('touchcancel', this.onTouchCancel, false);
|
||||
|
||||
// Hack is required for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
|
||||
// which is how FastClick normally stops click events bubbling to callbacks registered on the FastClick
|
||||
// layer when they are cancelled.
|
||||
if (!Event.prototype.stopImmediatePropagation) {
|
||||
layer.removeEventListener = function(type, callback, capture) {
|
||||
var rmv = Node.prototype.removeEventListener;
|
||||
if (type === 'click') {
|
||||
rmv.call(layer, type, callback.hijacked || callback, capture);
|
||||
} else {
|
||||
rmv.call(layer, type, callback, capture);
|
||||
}
|
||||
};
|
||||
|
||||
layer.addEventListener = function(type, callback, capture) {
|
||||
var adv = Node.prototype.addEventListener;
|
||||
if (type === 'click') {
|
||||
adv.call(layer, type, callback.hijacked || (callback.hijacked = function(event) {
|
||||
if (!event.propagationStopped) {
|
||||
callback(event);
|
||||
}
|
||||
}), capture);
|
||||
} else {
|
||||
adv.call(layer, type, callback, capture);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// If a handler is already declared in the element's onclick attribute, it will be fired before
|
||||
// FastClick's onClick handler. Fix this by pulling out the user-defined handler function and
|
||||
// adding it as listener.
|
||||
if (typeof layer.onclick === 'function') {
|
||||
|
||||
// Android browser on at least 3.2 requires a new reference to the function in layer.onclick
|
||||
// - the old one won't work if passed to addEventListener directly.
|
||||
oldOnClick = layer.onclick;
|
||||
layer.addEventListener('click', function(event) {
|
||||
oldOnClick(event);
|
||||
}, false);
|
||||
layer.onclick = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Windows Phone 8.1 fakes user agent string to look like Android and iPhone.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsWindowsPhone = navigator.userAgent.indexOf("Windows Phone") >= 0;
|
||||
|
||||
/**
|
||||
* Android requires exceptions.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsAndroid = navigator.userAgent.indexOf('Android') > 0 && !deviceIsWindowsPhone;
|
||||
|
||||
|
||||
/**
|
||||
* iOS requires exceptions.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsIOS = /iP(ad|hone|od)/.test(navigator.userAgent) && !deviceIsWindowsPhone;
|
||||
|
||||
|
||||
/**
|
||||
* iOS 4 requires an exception for select elements.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsIOS4 = deviceIsIOS && (/OS 4_\d(_\d)?/).test(navigator.userAgent);
|
||||
|
||||
|
||||
/**
|
||||
* iOS 6.0-7.* requires the target element to be manually derived
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsIOSWithBadTarget = deviceIsIOS && (/OS [6-7]_\d/).test(navigator.userAgent);
|
||||
|
||||
/**
|
||||
* BlackBerry requires exceptions.
|
||||
*
|
||||
* @type boolean
|
||||
*/
|
||||
var deviceIsBlackBerry10 = navigator.userAgent.indexOf('BB10') > 0;
|
||||
|
||||
/**
|
||||
* Determine whether a given element requires a native click.
|
||||
*
|
||||
* @param {EventTarget|Element} target Target DOM element
|
||||
* @returns {boolean} Returns true if the element needs a native click
|
||||
*/
|
||||
FastClick.prototype.needsClick = function(target) {
|
||||
switch (target.nodeName.toLowerCase()) {
|
||||
|
||||
// Don't send a synthetic click to disabled inputs (issue #62)
|
||||
case 'button':
|
||||
case 'select':
|
||||
case 'textarea':
|
||||
if (target.disabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'input':
|
||||
|
||||
// File inputs need real clicks on iOS 6 due to a browser bug (issue #68)
|
||||
if ((deviceIsIOS && target.type === 'file') || target.disabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'label':
|
||||
case 'iframe': // iOS8 homescreen apps can prevent events bubbling into frames
|
||||
case 'video':
|
||||
return true;
|
||||
}
|
||||
|
||||
return (/\bneedsclick\b/).test(target.className);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a given element requires a call to focus to simulate click into element.
|
||||
*
|
||||
* @param {EventTarget|Element} target Target DOM element
|
||||
* @returns {boolean} Returns true if the element requires a call to focus to simulate native click.
|
||||
*/
|
||||
FastClick.prototype.needsFocus = function(target) {
|
||||
switch (target.nodeName.toLowerCase()) {
|
||||
case 'textarea':
|
||||
return true;
|
||||
case 'select':
|
||||
return !deviceIsAndroid;
|
||||
case 'input':
|
||||
switch (target.type) {
|
||||
case 'button':
|
||||
case 'checkbox':
|
||||
case 'file':
|
||||
case 'image':
|
||||
case 'radio':
|
||||
case 'submit':
|
||||
return false;
|
||||
}
|
||||
|
||||
// No point in attempting to focus disabled inputs
|
||||
return !target.disabled && !target.readOnly;
|
||||
default:
|
||||
return (/\bneedsfocus\b/).test(target.className);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Send a click event to the specified element.
|
||||
*
|
||||
* @param {EventTarget|Element} targetElement
|
||||
* @param {Event} event
|
||||
*/
|
||||
FastClick.prototype.sendClick = function(targetElement, event) {
|
||||
var clickEvent, touch;
|
||||
|
||||
// On some Android devices activeElement needs to be blurred otherwise the synthetic click will have no effect (#24)
|
||||
if (document.activeElement && document.activeElement !== targetElement) {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
|
||||
touch = event.changedTouches[0];
|
||||
|
||||
// Synthesise a click event, with an extra attribute so it can be tracked
|
||||
clickEvent = document.createEvent('MouseEvents');
|
||||
clickEvent.initMouseEvent(this.determineEventType(targetElement), true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
|
||||
clickEvent.forwardedTouchEvent = true;
|
||||
targetElement.dispatchEvent(clickEvent);
|
||||
};
|
||||
|
||||
FastClick.prototype.determineEventType = function(targetElement) {
|
||||
|
||||
//Issue #159: Android Chrome Select Box does not open with a synthetic click event
|
||||
if (deviceIsAndroid && targetElement.tagName.toLowerCase() === 'select') {
|
||||
return 'mousedown';
|
||||
}
|
||||
|
||||
return 'click';
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {EventTarget|Element} targetElement
|
||||
*/
|
||||
FastClick.prototype.focus = function(targetElement) {
|
||||
var length;
|
||||
|
||||
// Issue #160: on iOS 7, some input elements (e.g. date datetime month) throw a vague TypeError on setSelectionRange. These elements don't have an integer value for the selectionStart and selectionEnd properties, but unfortunately that can't be used for detection because accessing the properties also throws a TypeError. Just check the type instead. Filed as Apple bug #15122724.
|
||||
if (deviceIsIOS && targetElement.setSelectionRange && targetElement.type.indexOf('date') !== 0 && targetElement.type !== 'time' && targetElement.type !== 'month') {
|
||||
length = targetElement.value.length;
|
||||
targetElement.setSelectionRange(length, length);
|
||||
} else {
|
||||
targetElement.focus();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check whether the given target element is a child of a scrollable layer and if so, set a flag on it.
|
||||
*
|
||||
* @param {EventTarget|Element} targetElement
|
||||
*/
|
||||
FastClick.prototype.updateScrollParent = function(targetElement) {
|
||||
var scrollParent, parentElement;
|
||||
|
||||
scrollParent = targetElement.fastClickScrollParent;
|
||||
|
||||
// Attempt to discover whether the target element is contained within a scrollable layer. Re-check if the
|
||||
// target element was moved to another parent.
|
||||
if (!scrollParent || !scrollParent.contains(targetElement)) {
|
||||
parentElement = targetElement;
|
||||
do {
|
||||
if (parentElement.scrollHeight > parentElement.offsetHeight) {
|
||||
scrollParent = parentElement;
|
||||
targetElement.fastClickScrollParent = parentElement;
|
||||
break;
|
||||
}
|
||||
|
||||
parentElement = parentElement.parentElement;
|
||||
} while (parentElement);
|
||||
}
|
||||
|
||||
// Always update the scroll top tracker if possible.
|
||||
if (scrollParent) {
|
||||
scrollParent.fastClickLastScrollTop = scrollParent.scrollTop;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {EventTarget} targetElement
|
||||
* @returns {Element|EventTarget}
|
||||
*/
|
||||
FastClick.prototype.getTargetElementFromEventTarget = function(eventTarget) {
|
||||
|
||||
// On some older browsers (notably Safari on iOS 4.1 - see issue #56) the event target may be a text node.
|
||||
if (eventTarget.nodeType === Node.TEXT_NODE) {
|
||||
return eventTarget.parentNode;
|
||||
}
|
||||
|
||||
return eventTarget;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On touch start, record the position and scroll offset.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onTouchStart = function(event) {
|
||||
var targetElement, touch, selection;
|
||||
|
||||
// Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
|
||||
if (event.targetTouches.length > 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
targetElement = this.getTargetElementFromEventTarget(event.target);
|
||||
touch = event.targetTouches[0];
|
||||
|
||||
if (deviceIsIOS) {
|
||||
|
||||
// Only trusted events will deselect text on iOS (issue #49)
|
||||
selection = window.getSelection();
|
||||
if (selection.rangeCount && !selection.isCollapsed) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!deviceIsIOS4) {
|
||||
|
||||
// Weird things happen on iOS when an alert or confirm dialog is opened from a click event callback (issue #23):
|
||||
// when the user next taps anywhere else on the page, new touchstart and touchend events are dispatched
|
||||
// with the same identifier as the touch event that previously triggered the click that triggered the alert.
|
||||
// Sadly, there is an issue on iOS 4 that causes some normal touch events to have the same identifier as an
|
||||
// immediately preceeding touch event (issue #52), so this fix is unavailable on that platform.
|
||||
// Issue 120: touch.identifier is 0 when Chrome dev tools 'Emulate touch events' is set with an iOS device UA string,
|
||||
// which causes all touch events to be ignored. As this block only applies to iOS, and iOS identifiers are always long,
|
||||
// random integers, it's safe to to continue if the identifier is 0 here.
|
||||
if (touch.identifier && touch.identifier === this.lastTouchIdentifier) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
this.lastTouchIdentifier = touch.identifier;
|
||||
|
||||
// If the target element is a child of a scrollable layer (using -webkit-overflow-scrolling: touch) and:
|
||||
// 1) the user does a fling scroll on the scrollable layer
|
||||
// 2) the user stops the fling scroll with another tap
|
||||
// then the event.target of the last 'touchend' event will be the element that was under the user's finger
|
||||
// when the fling scroll was started, causing FastClick to send a click event to that layer - unless a check
|
||||
// is made to ensure that a parent layer was not scrolled before sending a synthetic click (issue #42).
|
||||
this.updateScrollParent(targetElement);
|
||||
}
|
||||
}
|
||||
|
||||
this.trackingClick = true;
|
||||
this.trackingClickStart = event.timeStamp;
|
||||
this.targetElement = targetElement;
|
||||
|
||||
this.touchStartX = touch.pageX;
|
||||
this.touchStartY = touch.pageY;
|
||||
|
||||
// Prevent phantom clicks on fast double-tap (issue #36)
|
||||
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Based on a touchmove event object, check whether the touch has moved past a boundary since it started.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.touchHasMoved = function(event) {
|
||||
var touch = event.changedTouches[0], boundary = this.touchBoundary;
|
||||
|
||||
if (Math.abs(touch.pageX - this.touchStartX) > boundary || Math.abs(touch.pageY - this.touchStartY) > boundary) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Update the last position.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onTouchMove = function(event) {
|
||||
if (!this.trackingClick) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the touch has moved, cancel the click tracking
|
||||
if (this.targetElement !== this.getTargetElementFromEventTarget(event.target) || this.touchHasMoved(event)) {
|
||||
this.trackingClick = false;
|
||||
this.targetElement = null;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Attempt to find the labelled control for the given label element.
|
||||
*
|
||||
* @param {EventTarget|HTMLLabelElement} labelElement
|
||||
* @returns {Element|null}
|
||||
*/
|
||||
FastClick.prototype.findControl = function(labelElement) {
|
||||
|
||||
// Fast path for newer browsers supporting the HTML5 control attribute
|
||||
if (labelElement.control !== undefined) {
|
||||
return labelElement.control;
|
||||
}
|
||||
|
||||
// All browsers under test that support touch events also support the HTML5 htmlFor attribute
|
||||
if (labelElement.htmlFor) {
|
||||
return document.getElementById(labelElement.htmlFor);
|
||||
}
|
||||
|
||||
// If no for attribute exists, attempt to retrieve the first labellable descendant element
|
||||
// the list of which is defined here: http://www.w3.org/TR/html5/forms.html#category-label
|
||||
return labelElement.querySelector('button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea');
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On touch end, determine whether to send a click event at once.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onTouchEnd = function(event) {
|
||||
var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
|
||||
|
||||
if (!this.trackingClick) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Prevent phantom clicks on fast double-tap (issue #36)
|
||||
if ((event.timeStamp - this.lastClickTime) < this.tapDelay) {
|
||||
this.cancelNextClick = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((event.timeStamp - this.trackingClickStart) > this.tapTimeout) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Reset to prevent wrong click cancel on input (issue #156).
|
||||
this.cancelNextClick = false;
|
||||
|
||||
this.lastClickTime = event.timeStamp;
|
||||
|
||||
trackingClickStart = this.trackingClickStart;
|
||||
this.trackingClick = false;
|
||||
this.trackingClickStart = 0;
|
||||
|
||||
// On some iOS devices, the targetElement supplied with the event is invalid if the layer
|
||||
// is performing a transition or scroll, and has to be re-detected manually. Note that
|
||||
// for this to function correctly, it must be called *after* the event target is checked!
|
||||
// See issue #57; also filed as rdar://13048589 .
|
||||
if (deviceIsIOSWithBadTarget) {
|
||||
touch = event.changedTouches[0];
|
||||
|
||||
// In certain cases arguments of elementFromPoint can be negative, so prevent setting targetElement to null
|
||||
targetElement = document.elementFromPoint(touch.pageX - window.pageXOffset, touch.pageY - window.pageYOffset) || targetElement;
|
||||
targetElement.fastClickScrollParent = this.targetElement.fastClickScrollParent;
|
||||
}
|
||||
|
||||
targetTagName = targetElement.tagName.toLowerCase();
|
||||
if (targetTagName === 'label') {
|
||||
forElement = this.findControl(targetElement);
|
||||
if (forElement) {
|
||||
this.focus(targetElement);
|
||||
if (deviceIsAndroid) {
|
||||
return false;
|
||||
}
|
||||
|
||||
targetElement = forElement;
|
||||
}
|
||||
} else if (this.needsFocus(targetElement)) {
|
||||
|
||||
// Case 1: If the touch started a while ago (best guess is 100ms based on tests for issue #36) then focus will be triggered anyway. Return early and unset the target element reference so that the subsequent click will be allowed through.
|
||||
// Case 2: Without this exception for input elements tapped when the document is contained in an iframe, then any inputted text won't be visible even though the value attribute is updated as the user types (issue #37).
|
||||
if ((event.timeStamp - trackingClickStart) > 100 || (deviceIsIOS && window.top !== window && targetTagName === 'input')) {
|
||||
this.targetElement = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
this.focus(targetElement);
|
||||
this.sendClick(targetElement, event);
|
||||
|
||||
// Select elements need the event to go through on iOS 4, otherwise the selector menu won't open.
|
||||
// Also this breaks opening selects when VoiceOver is active on iOS6, iOS7 (and possibly others)
|
||||
if (!deviceIsIOS || targetTagName !== 'select') {
|
||||
this.targetElement = null;
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (deviceIsIOS && !deviceIsIOS4) {
|
||||
|
||||
// Don't send a synthetic click event if the target element is contained within a parent layer that was scrolled
|
||||
// and this tap is being used to stop the scrolling (usually initiated by a fling - issue #42).
|
||||
scrollParent = targetElement.fastClickScrollParent;
|
||||
if (scrollParent && scrollParent.fastClickLastScrollTop !== scrollParent.scrollTop) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent the actual click from going though - unless the target node is marked as requiring
|
||||
// real clicks or if it is in the whitelist in which case only non-programmatic clicks are permitted.
|
||||
if (!this.needsClick(targetElement)) {
|
||||
event.preventDefault();
|
||||
this.sendClick(targetElement, event);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On touch cancel, stop tracking the click.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
FastClick.prototype.onTouchCancel = function() {
|
||||
this.trackingClick = false;
|
||||
this.targetElement = null;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Determine mouse events which should be permitted.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onMouse = function(event) {
|
||||
|
||||
// If a target element was never set (because a touch event was never fired) allow the event
|
||||
if (!this.targetElement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.forwardedTouchEvent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Programmatically generated events targeting a specific element should be permitted
|
||||
if (!event.cancelable) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Derive and check the target element to see whether the mouse event needs to be permitted;
|
||||
// unless explicitly enabled, prevent non-touch click events from triggering actions,
|
||||
// to prevent ghost/doubleclicks.
|
||||
if (!this.needsClick(this.targetElement) || this.cancelNextClick) {
|
||||
|
||||
// Prevent any user-added listeners declared on FastClick element from being fired.
|
||||
if (event.stopImmediatePropagation) {
|
||||
event.stopImmediatePropagation();
|
||||
} else {
|
||||
|
||||
// Part of the hack for browsers that don't support Event#stopImmediatePropagation (e.g. Android 2)
|
||||
event.propagationStopped = true;
|
||||
}
|
||||
|
||||
// Cancel the event
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the mouse event is permitted, return true for the action to go through.
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* On actual clicks, determine whether this is a touch-generated click, a click action occurring
|
||||
* naturally after a delay after a touch (which needs to be cancelled to avoid duplication), or
|
||||
* an actual click which should be permitted.
|
||||
*
|
||||
* @param {Event} event
|
||||
* @returns {boolean}
|
||||
*/
|
||||
FastClick.prototype.onClick = function(event) {
|
||||
var permitted;
|
||||
|
||||
// It's possible for another FastClick-like library delivered with third-party code to fire a click event before FastClick does (issue #44). In that case, set the click-tracking flag back to false and return early. This will cause onTouchEnd to return early.
|
||||
if (this.trackingClick) {
|
||||
this.targetElement = null;
|
||||
this.trackingClick = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Very odd behaviour on iOS (issue #18): if a submit element is present inside a form and the user hits enter in the iOS simulator or clicks the Go button on the pop-up OS keyboard the a kind of 'fake' click event will be triggered with the submit-type input element as the target.
|
||||
if (event.target.type === 'submit' && event.detail === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
permitted = this.onMouse(event);
|
||||
|
||||
// Only unset targetElement if the click is not permitted. This will ensure that the check for !targetElement in onMouse fails and the browser's click doesn't go through.
|
||||
if (!permitted) {
|
||||
this.targetElement = null;
|
||||
}
|
||||
|
||||
// If clicks are permitted, return true for the action to go through.
|
||||
return permitted;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Remove all FastClick's event listeners.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
FastClick.prototype.destroy = function() {
|
||||
var layer = this.layer;
|
||||
|
||||
if (deviceIsAndroid) {
|
||||
layer.removeEventListener('mouseover', this.onMouse, true);
|
||||
layer.removeEventListener('mousedown', this.onMouse, true);
|
||||
layer.removeEventListener('mouseup', this.onMouse, true);
|
||||
}
|
||||
|
||||
layer.removeEventListener('click', this.onClick, true);
|
||||
layer.removeEventListener('touchstart', this.onTouchStart, false);
|
||||
layer.removeEventListener('touchmove', this.onTouchMove, false);
|
||||
layer.removeEventListener('touchend', this.onTouchEnd, false);
|
||||
layer.removeEventListener('touchcancel', this.onTouchCancel, false);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check whether FastClick is needed.
|
||||
*
|
||||
* @param {Element} layer The layer to listen on
|
||||
*/
|
||||
FastClick.notNeeded = function(layer) {
|
||||
var metaViewport;
|
||||
var chromeVersion;
|
||||
var blackberryVersion;
|
||||
var firefoxVersion;
|
||||
|
||||
// Devices that don't support touch don't need FastClick
|
||||
if (typeof window.ontouchstart === 'undefined') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Chrome version - zero for other browsers
|
||||
chromeVersion = +(/Chrome\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
|
||||
|
||||
if (chromeVersion) {
|
||||
|
||||
if (deviceIsAndroid) {
|
||||
metaViewport = document.querySelector('meta[name=viewport]');
|
||||
|
||||
if (metaViewport) {
|
||||
// Chrome on Android with user-scalable="no" doesn't need FastClick (issue #89)
|
||||
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
|
||||
return true;
|
||||
}
|
||||
// Chrome 32 and above with width=device-width or less don't need FastClick
|
||||
if (chromeVersion > 31 && document.documentElement.scrollWidth <= window.outerWidth) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Chrome desktop doesn't need FastClick (issue #15)
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (deviceIsBlackBerry10) {
|
||||
blackberryVersion = navigator.userAgent.match(/Version\/([0-9]*)\.([0-9]*)/);
|
||||
|
||||
// BlackBerry 10.3+ does not require Fastclick library.
|
||||
// https://github.com/ftlabs/fastclick/issues/251
|
||||
if (blackberryVersion[1] >= 10 && blackberryVersion[2] >= 3) {
|
||||
metaViewport = document.querySelector('meta[name=viewport]');
|
||||
|
||||
if (metaViewport) {
|
||||
// user-scalable=no eliminates click delay.
|
||||
if (metaViewport.content.indexOf('user-scalable=no') !== -1) {
|
||||
return true;
|
||||
}
|
||||
// width=device-width (or less than device-width) eliminates click delay.
|
||||
if (document.documentElement.scrollWidth <= window.outerWidth) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// IE10 with -ms-touch-action: none or manipulation, which disables double-tap-to-zoom (issue #97)
|
||||
if (layer.style.msTouchAction === 'none' || layer.style.touchAction === 'manipulation') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Firefox version - zero for other browsers
|
||||
firefoxVersion = +(/Firefox\/([0-9]+)/.exec(navigator.userAgent) || [,0])[1];
|
||||
|
||||
if (firefoxVersion >= 27) {
|
||||
// Firefox 27+ does not have tap delay if the content is not zoomable - https://bugzilla.mozilla.org/show_bug.cgi?id=922896
|
||||
|
||||
metaViewport = document.querySelector('meta[name=viewport]');
|
||||
if (metaViewport && (metaViewport.content.indexOf('user-scalable=no') !== -1 || document.documentElement.scrollWidth <= window.outerWidth)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// IE11: prefixed -ms-touch-action is no longer supported and it's recomended to use non-prefixed version
|
||||
// http://msdn.microsoft.com/en-us/library/windows/apps/Hh767313.aspx
|
||||
if (layer.style.touchAction === 'none' || layer.style.touchAction === 'manipulation') {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Factory method for creating a FastClick object
|
||||
*
|
||||
* @param {Element} layer The layer to listen on
|
||||
* @param {Object} [options={}] The options to override the defaults
|
||||
*/
|
||||
FastClick.attach = function(layer, options) {
|
||||
return new FastClick(layer, options);
|
||||
};
|
||||
|
||||
|
||||
if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
define(function() {
|
||||
return FastClick;
|
||||
});
|
||||
} else if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = FastClick.attach;
|
||||
module.exports.FastClick = FastClick;
|
||||
} else {
|
||||
window.FastClick = FastClick;
|
||||
}
|
||||
}());
|
1
themes/next/source/lib/fastclick/lib/fastclick.min.js
vendored
Normal file
36
themes/next/source/lib/font-awesome/.bower.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "font-awesome",
|
||||
"description": "Font Awesome",
|
||||
"keywords": [],
|
||||
"homepage": "http://fontawesome.io",
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"license": [
|
||||
"OFL-1.1",
|
||||
"MIT",
|
||||
"CC-BY-3.0"
|
||||
],
|
||||
"main": [
|
||||
"less/font-awesome.less",
|
||||
"scss/font-awesome.scss"
|
||||
],
|
||||
"ignore": [
|
||||
"*/.*",
|
||||
"*.json",
|
||||
"src",
|
||||
"*.yml",
|
||||
"Gemfile",
|
||||
"Gemfile.lock",
|
||||
"*.md"
|
||||
],
|
||||
"version": "4.7.0",
|
||||
"_release": "4.7.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v4.7.0",
|
||||
"commit": "a3fe90fa5f6fac55d197f9cbd18e3f57dafb716c"
|
||||
},
|
||||
"_source": "https://github.com/FortAwesome/Font-Awesome.git",
|
||||
"_target": "*",
|
||||
"_originalSource": "fontawesome"
|
||||
}
|
33
themes/next/source/lib/font-awesome/.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
*.pyc
|
||||
*.egg-info
|
||||
*.db
|
||||
*.db.old
|
||||
*.swp
|
||||
*.db-journal
|
||||
|
||||
.coverage
|
||||
.DS_Store
|
||||
.installed.cfg
|
||||
_gh_pages/*
|
||||
|
||||
.idea/*
|
||||
.svn/*
|
||||
src/website/static/*
|
||||
src/website/media/*
|
||||
|
||||
bin
|
||||
cfcache
|
||||
develop-eggs
|
||||
dist
|
||||
downloads
|
||||
eggs
|
||||
parts
|
||||
tmp
|
||||
.sass-cache
|
||||
node_modules
|
||||
|
||||
src/website/settingslocal.py
|
||||
stunnel.log
|
||||
|
||||
.ruby-version
|
||||
.bundle
|
42
themes/next/source/lib/font-awesome/.npmignore
Normal file
@ -0,0 +1,42 @@
|
||||
*.pyc
|
||||
*.egg-info
|
||||
*.db
|
||||
*.db.old
|
||||
*.swp
|
||||
*.db-journal
|
||||
|
||||
.coverage
|
||||
.DS_Store
|
||||
.installed.cfg
|
||||
_gh_pages/*
|
||||
|
||||
.idea/*
|
||||
.svn/*
|
||||
src/website/static/*
|
||||
src/website/media/*
|
||||
|
||||
bin
|
||||
cfcache
|
||||
develop-eggs
|
||||
dist
|
||||
downloads
|
||||
eggs
|
||||
parts
|
||||
tmp
|
||||
.sass-cache
|
||||
node_modules
|
||||
|
||||
src/website/settingslocal.py
|
||||
stunnel.log
|
||||
|
||||
.ruby-version
|
||||
|
||||
# don't need these in the npm package.
|
||||
src/
|
||||
_config.yml
|
||||
bower.json
|
||||
component.json
|
||||
composer.json
|
||||
CONTRIBUTING.md
|
||||
Gemfile
|
||||
Gemfile.lock
|
7
themes/next/source/lib/font-awesome/HELP-US-OUT.txt
Normal file
@ -0,0 +1,7 @@
|
||||
I hope you love Font Awesome. If you've found it useful, please do me a favor and check out my latest project,
|
||||
Fort Awesome (https://fortawesome.com). It makes it easy to put the perfect icons on your website. Choose from our awesome,
|
||||
comprehensive icon sets or copy and paste your own.
|
||||
|
||||
Please. Check it out.
|
||||
|
||||
-Dave Gandy
|
22
themes/next/source/lib/font-awesome/bower.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "font-awesome",
|
||||
"description": "Font Awesome",
|
||||
"keywords": [],
|
||||
"homepage": "http://fontawesome.io",
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"license": ["OFL-1.1", "MIT", "CC-BY-3.0"],
|
||||
"main": [
|
||||
"less/font-awesome.less",
|
||||
"scss/font-awesome.scss"
|
||||
],
|
||||
"ignore": [
|
||||
"*/.*",
|
||||
"*.json",
|
||||
"src",
|
||||
"*.yml",
|
||||
"Gemfile",
|
||||
"Gemfile.lock",
|
||||
"*.md"
|
||||
]
|
||||
}
|
2337
themes/next/source/lib/font-awesome/css/font-awesome.css
vendored
Normal file
4
themes/next/source/lib/font-awesome/css/font-awesome.min.css
vendored
Normal file
BIN
themes/next/source/lib/font-awesome/fonts/FontAwesome.otf
Normal file
2671
themes/next/source/lib/font-awesome/fonts/fontawesome-webfont.svg
Normal file
After Width: | Height: | Size: 434 KiB |
15
themes/next/source/lib/jquery/.bower.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "jquery",
|
||||
"_cacheHeaders": {
|
||||
"ETag": "\"5492efef-14960\"",
|
||||
"Last-Modified": "Thu, 18 Dec 2014 15:17:03 GMT",
|
||||
"Content-Length": "84320",
|
||||
"Content-Type": "application/x-javascript"
|
||||
},
|
||||
"_release": "e-tag:5492efef-",
|
||||
"main": "index.js",
|
||||
"_source": "http://code.jquery.com/jquery-2.1.3.min.js",
|
||||
"_target": "*",
|
||||
"_originalSource": "http://code.jquery.com/jquery-2.1.3.min.js",
|
||||
"_direct": true
|
||||
}
|
4
themes/next/source/lib/jquery/index.js
vendored
Normal file
37
themes/next/source/lib/jquery_lazyload/.bower.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "jquery_lazyload",
|
||||
"version": "1.9.7",
|
||||
"homepage": "http://www.appelsiini.net/projects/lazyload",
|
||||
"authors": [
|
||||
"Mika Tuupola <tuupola@appelsiini.net>"
|
||||
],
|
||||
"description": "jQuery plugin for lazy loading images",
|
||||
"main": [
|
||||
"jquery.lazyload.js",
|
||||
"jquery.scrollstop.js"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"**/*.min.js",
|
||||
"**/*.html",
|
||||
"**/*.textile",
|
||||
"Gruntfile.js",
|
||||
"lazyload.jquery.json",
|
||||
"package.json",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"img"
|
||||
],
|
||||
"_release": "1.9.7",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.9.7",
|
||||
"commit": "218e50eb4999fe59ac94b939a65c8c988d1d420b"
|
||||
},
|
||||
"_source": "git://github.com/tuupola/jquery_lazyload.git",
|
||||
"_target": "~1.9.7",
|
||||
"_originalSource": "jquery.lazyload",
|
||||
"_direct": true
|
||||
}
|
39
themes/next/source/lib/jquery_lazyload/CONTRIBUTING.md
Normal file
@ -0,0 +1,39 @@
|
||||
# Contributing to Lazy Load
|
||||
|
||||
## Only one feature or change per pull request
|
||||
|
||||
Make pull requests only one feature or change at the time. For example you have fixed a bug. You also have optimized some code. Optimization is not related to a bug. These should be submitted as separate pull requests. This way I can easily choose what to include. It is also easier to understand the code changes. Commit messages should be descriptive and full sentences.
|
||||
|
||||
Do not commit minified versions. Do not touch the version number. Make the pull requests against [1.9.x branch](https://github.com/tuupola/jquery_lazyload/commits/1.9.x).
|
||||
|
||||
## Write meaningful commit messages
|
||||
|
||||
Proper commit message is full sentence. It starts with capital letter but does not end with period. Headlines do not end with period. The GitHub default `Update filename.js` is not enough. When needed include also longer explanation what the commit does.
|
||||
|
||||
```
|
||||
Capitalized, short (50 chars or less) summary
|
||||
|
||||
More detailed explanatory text, if necessary. Wrap it to about 72
|
||||
characters or so. In some contexts, the first line is treated as the
|
||||
subject of an email and the rest of the text as the body. The blank
|
||||
line separating the summary from the body is critical (unless you omit
|
||||
the body entirely); tools like rebase can get confused if you run the
|
||||
two together.
|
||||
```
|
||||
|
||||
When in doubt see Tim Pope's blogpost [A Note About Git Commit Messages](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
||||
|
||||
## Follow the existing coding standards
|
||||
|
||||
When contributing to open source project it is polite to follow the original authors coding standars. They might be different than yours. It is not a holy war. Just follow then original.
|
||||
|
||||
```javascript
|
||||
var snake_case = "something";
|
||||
|
||||
function camelCase(options) {
|
||||
}
|
||||
|
||||
if (true !== false) {
|
||||
console.log("here be dragons");
|
||||
}
|
||||
```
|
48
themes/next/source/lib/jquery_lazyload/README.md
Normal file
@ -0,0 +1,48 @@
|
||||
# Lazy Load Plugin for jQuery
|
||||
|
||||
Lazy Load delays loading of images in long web pages. Images outside of viewport wont be loaded before user scrolls to them. This is opposite of image preloading.
|
||||
|
||||
Using Lazy Load on long web pages containing many large images makes the page load faster. Browser will be in ready state after loading visible images. In some cases it can also help to reduce server load.
|
||||
|
||||
Lazy Load is inspired by [YUI ImageLoader](http://developer.yahoo.com/yui/imageloader/) Utility by Matt Mlinac.
|
||||
|
||||
## How to Use?
|
||||
|
||||
Lazy Load depends on jQuery. Include them both in end of your HTML code:
|
||||
|
||||
```html
|
||||
<script src="jquery.js" type="text/javascript"></script>
|
||||
<script src="jquery.lazyload.js" type="text/javascript"></script>
|
||||
```
|
||||
|
||||
You must alter your HTML code. URL of the real image must be put into data-original attribute. It is good idea to give Lazy Loaded image a specific class. This way you can easily control which images plugin is binded to. Note that you should have width and height attributes in your image tag.
|
||||
|
||||
```html
|
||||
<img class="lazy" data-original="img/example.jpg" width="640" height="480">
|
||||
```
|
||||
|
||||
then in your code do:
|
||||
|
||||
```js
|
||||
$("img.lazy").lazyload();
|
||||
```
|
||||
|
||||
This causes all images of class lazy to be lazy loaded.
|
||||
|
||||
More information on [Lazy Load](http://www.appelsiini.net/projects/lazyload) project page.
|
||||
|
||||
## Install
|
||||
|
||||
You can install with [bower](http://bower.io/) or [npm](https://www.npmjs.com/).
|
||||
|
||||
|
||||
```sh
|
||||
$ bower install jquery.lazyload
|
||||
$ npm install jquery-lazyload
|
||||
```
|
||||
|
||||
|
||||
# License
|
||||
|
||||
All code licensed under the [MIT License](http://www.opensource.org/licenses/mit-license.php). All images licensed under [Creative Commons Attribution 3.0 Unported License](http://creativecommons.org/licenses/by/3.0/deed.en_US). In other words you are basically free to do whatever you want. Just don't remove my name from the source.
|
||||
|
27
themes/next/source/lib/jquery_lazyload/bower.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "jquery_lazyload",
|
||||
"version": "1.9.4",
|
||||
"homepage": "http://www.appelsiini.net/projects/lazyload",
|
||||
"authors": [
|
||||
"Mika Tuupola <tuupola@appelsiini.net>"
|
||||
],
|
||||
"description": "jQuery plugin for lazy loading images",
|
||||
"main": [
|
||||
"jquery.lazyload.js",
|
||||
"jquery.scrollstop.js"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"**/*.min.js",
|
||||
"**/*.html",
|
||||
"**/*.textile",
|
||||
"Gruntfile.js",
|
||||
"lazyload.jquery.json",
|
||||
"package.json",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"img"
|
||||
]
|
||||
}
|
242
themes/next/source/lib/jquery_lazyload/jquery.lazyload.js
Normal file
@ -0,0 +1,242 @@
|
||||
/*!
|
||||
* Lazy Load - jQuery plugin for lazy loading images
|
||||
*
|
||||
* Copyright (c) 2007-2015 Mika Tuupola
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Project home:
|
||||
* http://www.appelsiini.net/projects/lazyload
|
||||
*
|
||||
* Version: 1.9.7
|
||||
*
|
||||
*/
|
||||
|
||||
(function($, window, document, undefined) {
|
||||
var $window = $(window);
|
||||
|
||||
$.fn.lazyload = function(options) {
|
||||
var elements = this;
|
||||
var $container;
|
||||
var settings = {
|
||||
threshold : 0,
|
||||
failure_limit : 0,
|
||||
event : "scroll",
|
||||
effect : "show",
|
||||
container : window,
|
||||
data_attribute : "original",
|
||||
skip_invisible : false,
|
||||
appear : null,
|
||||
load : null,
|
||||
placeholder : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"
|
||||
};
|
||||
|
||||
function update() {
|
||||
var counter = 0;
|
||||
|
||||
elements.each(function() {
|
||||
var $this = $(this);
|
||||
if (settings.skip_invisible && !$this.is(":visible")) {
|
||||
return;
|
||||
}
|
||||
if ($.abovethetop(this, settings) ||
|
||||
$.leftofbegin(this, settings)) {
|
||||
/* Nothing. */
|
||||
} else if (!$.belowthefold(this, settings) &&
|
||||
!$.rightoffold(this, settings)) {
|
||||
$this.trigger("appear");
|
||||
/* if we found an image we'll load, reset the counter */
|
||||
counter = 0;
|
||||
} else {
|
||||
if (++counter > settings.failure_limit) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
if(options) {
|
||||
/* Maintain BC for a couple of versions. */
|
||||
if (undefined !== options.failurelimit) {
|
||||
options.failure_limit = options.failurelimit;
|
||||
delete options.failurelimit;
|
||||
}
|
||||
if (undefined !== options.effectspeed) {
|
||||
options.effect_speed = options.effectspeed;
|
||||
delete options.effectspeed;
|
||||
}
|
||||
|
||||
$.extend(settings, options);
|
||||
}
|
||||
|
||||
/* Cache container as jQuery as object. */
|
||||
$container = (settings.container === undefined ||
|
||||
settings.container === window) ? $window : $(settings.container);
|
||||
|
||||
/* Fire one scroll event per scroll. Not one scroll event per image. */
|
||||
if (0 === settings.event.indexOf("scroll")) {
|
||||
$container.bind(settings.event, function() {
|
||||
return update();
|
||||
});
|
||||
}
|
||||
|
||||
this.each(function() {
|
||||
var self = this;
|
||||
var $self = $(self);
|
||||
|
||||
self.loaded = false;
|
||||
|
||||
/* If no src attribute given use data:uri. */
|
||||
if ($self.attr("src") === undefined || $self.attr("src") === false) {
|
||||
if ($self.is("img")) {
|
||||
$self.attr("src", settings.placeholder);
|
||||
}
|
||||
}
|
||||
|
||||
/* When appear is triggered load original image. */
|
||||
$self.one("appear", function() {
|
||||
if (!this.loaded) {
|
||||
if (settings.appear) {
|
||||
var elements_left = elements.length;
|
||||
settings.appear.call(self, elements_left, settings);
|
||||
}
|
||||
$("<img />")
|
||||
.bind("load", function() {
|
||||
|
||||
var original = $self.attr("data-" + settings.data_attribute);
|
||||
$self.hide();
|
||||
if ($self.is("img")) {
|
||||
$self.attr("src", original);
|
||||
} else {
|
||||
$self.css("background-image", "url('" + original + "')");
|
||||
}
|
||||
$self[settings.effect](settings.effect_speed);
|
||||
|
||||
self.loaded = true;
|
||||
|
||||
/* Remove image from array so it is not looped next time. */
|
||||
var temp = $.grep(elements, function(element) {
|
||||
return !element.loaded;
|
||||
});
|
||||
elements = $(temp);
|
||||
|
||||
if (settings.load) {
|
||||
var elements_left = elements.length;
|
||||
settings.load.call(self, elements_left, settings);
|
||||
}
|
||||
})
|
||||
.attr("src", $self.attr("data-" + settings.data_attribute));
|
||||
}
|
||||
});
|
||||
|
||||
/* When wanted event is triggered load original image */
|
||||
/* by triggering appear. */
|
||||
if (0 !== settings.event.indexOf("scroll")) {
|
||||
$self.bind(settings.event, function() {
|
||||
if (!self.loaded) {
|
||||
$self.trigger("appear");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/* Check if something appears when window is resized. */
|
||||
$window.bind("resize", function() {
|
||||
update();
|
||||
});
|
||||
|
||||
/* With IOS5 force loading images when navigating with back button. */
|
||||
/* Non optimal workaround. */
|
||||
if ((/(?:iphone|ipod|ipad).*os 5/gi).test(navigator.appVersion)) {
|
||||
$window.bind("pageshow", function(event) {
|
||||
if (event.originalEvent && event.originalEvent.persisted) {
|
||||
elements.each(function() {
|
||||
$(this).trigger("appear");
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* Force initial check if images should appear. */
|
||||
$(document).ready(function() {
|
||||
update();
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/* Convenience methods in jQuery namespace. */
|
||||
/* Use as $.belowthefold(element, {threshold : 100, container : window}) */
|
||||
|
||||
$.belowthefold = function(element, settings) {
|
||||
var fold;
|
||||
|
||||
if (settings.container === undefined || settings.container === window) {
|
||||
fold = (window.innerHeight ? window.innerHeight : $window.height()) + $window.scrollTop();
|
||||
} else {
|
||||
fold = $(settings.container).offset().top + $(settings.container).height();
|
||||
}
|
||||
|
||||
return fold <= $(element).offset().top - settings.threshold;
|
||||
};
|
||||
|
||||
$.rightoffold = function(element, settings) {
|
||||
var fold;
|
||||
|
||||
if (settings.container === undefined || settings.container === window) {
|
||||
fold = $window.width() + $window.scrollLeft();
|
||||
} else {
|
||||
fold = $(settings.container).offset().left + $(settings.container).width();
|
||||
}
|
||||
|
||||
return fold <= $(element).offset().left - settings.threshold;
|
||||
};
|
||||
|
||||
$.abovethetop = function(element, settings) {
|
||||
var fold;
|
||||
|
||||
if (settings.container === undefined || settings.container === window) {
|
||||
fold = $window.scrollTop();
|
||||
} else {
|
||||
fold = $(settings.container).offset().top;
|
||||
}
|
||||
|
||||
return fold >= $(element).offset().top + settings.threshold + $(element).height();
|
||||
};
|
||||
|
||||
$.leftofbegin = function(element, settings) {
|
||||
var fold;
|
||||
|
||||
if (settings.container === undefined || settings.container === window) {
|
||||
fold = $window.scrollLeft();
|
||||
} else {
|
||||
fold = $(settings.container).offset().left;
|
||||
}
|
||||
|
||||
return fold >= $(element).offset().left + settings.threshold + $(element).width();
|
||||
};
|
||||
|
||||
$.inviewport = function(element, settings) {
|
||||
return !$.rightoffold(element, settings) && !$.leftofbegin(element, settings) &&
|
||||
!$.belowthefold(element, settings) && !$.abovethetop(element, settings);
|
||||
};
|
||||
|
||||
/* Custom selectors for your convenience. */
|
||||
/* Use as $("img:below-the-fold").something() or */
|
||||
/* $("img").filter(":below-the-fold").something() which is faster */
|
||||
|
||||
$.extend($.expr[":"], {
|
||||
"below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0}); },
|
||||
"above-the-top" : function(a) { return !$.belowthefold(a, {threshold : 0}); },
|
||||
"right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0}); },
|
||||
"left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0}); },
|
||||
"in-viewport" : function(a) { return $.inviewport(a, {threshold : 0}); },
|
||||
/* Maintain BC for couple of versions. */
|
||||
"above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0}); },
|
||||
"right-of-fold" : function(a) { return $.rightoffold(a, {threshold : 0}); },
|
||||
"left-of-fold" : function(a) { return !$.rightoffold(a, {threshold : 0}); }
|
||||
});
|
||||
|
||||
})(jQuery, window, document);
|
72
themes/next/source/lib/jquery_lazyload/jquery.scrollstop.js
Normal file
@ -0,0 +1,72 @@
|
||||
/* http://james.padolsey.com/javascript/special-scroll-events-for-jquery/ */
|
||||
|
||||
(function(){
|
||||
|
||||
var special = jQuery.event.special,
|
||||
uid1 = "D" + (+new Date()),
|
||||
uid2 = "D" + (+new Date() + 1);
|
||||
|
||||
special.scrollstart = {
|
||||
setup: function() {
|
||||
|
||||
var timer,
|
||||
handler = function(evt) {
|
||||
|
||||
var _self = this,
|
||||
_args = arguments;
|
||||
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
} else {
|
||||
evt.type = "scrollstart";
|
||||
jQuery.event.dispatch.apply(_self, _args);
|
||||
}
|
||||
|
||||
timer = setTimeout( function(){
|
||||
timer = null;
|
||||
}, special.scrollstop.latency);
|
||||
|
||||
};
|
||||
|
||||
jQuery(this).bind("scroll", handler).data(uid1, handler);
|
||||
|
||||
},
|
||||
teardown: function(){
|
||||
jQuery(this).unbind( "scroll", jQuery(this).data(uid1) );
|
||||
}
|
||||
};
|
||||
|
||||
special.scrollstop = {
|
||||
latency: 300,
|
||||
setup: function() {
|
||||
|
||||
var timer,
|
||||
handler = function(evt) {
|
||||
|
||||
var _self = this,
|
||||
_args = arguments;
|
||||
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
|
||||
timer = setTimeout( function(){
|
||||
|
||||
timer = null;
|
||||
evt.type = "scrollstop";
|
||||
jQuery.event.dispatch.apply(_self, _args);
|
||||
|
||||
|
||||
}, special.scrollstop.latency);
|
||||
|
||||
};
|
||||
|
||||
jQuery(this).bind("scroll", handler).data(uid2, handler);
|
||||
|
||||
},
|
||||
teardown: function() {
|
||||
jQuery(this).unbind( "scroll", jQuery(this).data(uid2) );
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
127
themes/next/source/lib/needsharebutton/font-embedded.css
Normal file
372
themes/next/source/lib/needsharebutton/needsharebutton.css
Normal file
@ -0,0 +1,372 @@
|
||||
/***********************************************
|
||||
needShareButton
|
||||
- Version 1.0.0
|
||||
- Copyright 2015 Dzmitry Vasileuski
|
||||
- Licensed under MIT (http://opensource.org/licenses/MIT)
|
||||
***********************************************/
|
||||
/* Social icons font
|
||||
***********************************************/
|
||||
@import url('font-embedded.css');
|
||||
.need-share-button {
|
||||
position: relative;
|
||||
}
|
||||
.need-share-button-opened {
|
||||
position: relative;
|
||||
}
|
||||
.need-share-button-opened img.need-share-wechat-code-image {
|
||||
display: block;
|
||||
|
||||
width: 100%;
|
||||
max-width: 200px;
|
||||
margin: auto;
|
||||
}
|
||||
.need-share-button_dropdown {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
|
||||
visibility: hidden;
|
||||
overflow: hidden;
|
||||
|
||||
width: 300px;
|
||||
|
||||
font-size: 16px;
|
||||
|
||||
-webkit-transition: .3s;
|
||||
transition: .3s;
|
||||
-webkit-transform: scale(.1);
|
||||
-ms-transform: scale(.1);
|
||||
transform: scale(.1);
|
||||
text-align: center;
|
||||
white-space: normal;
|
||||
|
||||
opacity: 0;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
-webkit-box-shadow: 0 0 2px rgba(0, 0, 0, .5);
|
||||
box-shadow: 0 0 2px rgba(0, 0, 0, .5);
|
||||
}
|
||||
.need-share-button-opened .need-share-button_dropdown {
|
||||
visibility: visible;
|
||||
|
||||
-webkit-transform: scale(1);
|
||||
-ms-transform: scale(1);
|
||||
transform: scale(1);
|
||||
|
||||
opacity: 1;
|
||||
}
|
||||
.need-share-button_dropdown-box-vertical,
|
||||
.need-share-button_dropdown-box-horizontal {
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
}
|
||||
.need-share-button_dropdown-box-vertical {
|
||||
width: 50px;
|
||||
}
|
||||
.need-share-button_dropdown-box-horizontal {
|
||||
width: auto;
|
||||
|
||||
white-space: nowrap;
|
||||
}
|
||||
.need-share-button_link {
|
||||
display: inline-block;
|
||||
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
|
||||
line-height: 50px;
|
||||
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
}
|
||||
.need-share-button_link:hover {
|
||||
-webkit-transition: .3s;
|
||||
transition: .3s;
|
||||
|
||||
opacity: .7;
|
||||
}
|
||||
/* Dropdown position
|
||||
***********************************************/
|
||||
.need-share-button_dropdown-top-left {
|
||||
right: 100%;
|
||||
bottom: 100%;
|
||||
|
||||
margin-right: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.need-share-button_dropdown-top-right {
|
||||
bottom: 100%;
|
||||
left: 100%;
|
||||
|
||||
margin-bottom: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.need-share-button_dropdown-top-center {
|
||||
bottom: 100%;
|
||||
left: 50%;
|
||||
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.need-share-button_dropdown-middle-left {
|
||||
top: 50%;
|
||||
right: 100%;
|
||||
|
||||
margin-right: 10px;
|
||||
}
|
||||
.need-share-button_dropdown-middle-right {
|
||||
top: 50%;
|
||||
left: 100%;
|
||||
|
||||
margin-left: 10px;
|
||||
}
|
||||
.need-share-button_dropdown-bottom-left {
|
||||
top: 100%;
|
||||
right: 100%;
|
||||
|
||||
margin-top: 10px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
.need-share-button_dropdown-bottom-right {
|
||||
top: 100%;
|
||||
left: 100%;
|
||||
|
||||
margin-top: 10px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.need-share-button_dropdown-bottom-center {
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
|
||||
margin-top: 10px;
|
||||
}
|
||||
/* Default theme
|
||||
***********************************************/
|
||||
.need-share-button-default {
|
||||
display: inline-block;
|
||||
|
||||
margin-bottom: 0;
|
||||
padding: 6px 12px;
|
||||
|
||||
font-size: 14px;
|
||||
line-height: 1.42857143;
|
||||
font-weight: 400;
|
||||
color: #333;
|
||||
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
|
||||
border: 1px solid #ccc;
|
||||
-webkit-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
}
|
||||
/* Network buttons
|
||||
***********************************************/
|
||||
.need-share-button_wechat {
|
||||
color: #a2dc30;
|
||||
}
|
||||
.need-share-button_wechat.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #a2dc30;
|
||||
}
|
||||
.need-share-button_weibo {
|
||||
color: #d52b2b;
|
||||
}
|
||||
.need-share-button_weibo.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #d52b2b;
|
||||
}
|
||||
.need-share-button_douban {
|
||||
color: #072;
|
||||
}
|
||||
.need-share-button_douban:before {
|
||||
content: '豆';
|
||||
}
|
||||
.need-share-button_douban.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #072;
|
||||
}
|
||||
.need-share-button_qqzone {
|
||||
color: #ffce00;
|
||||
}
|
||||
.need-share-button_qqzone.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #ffce00;
|
||||
}
|
||||
.need-share-button_renren {
|
||||
color: #207cc5;
|
||||
}
|
||||
.need-share-button_renren.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #207cc5;
|
||||
}
|
||||
.need-share-button_mailto {
|
||||
color: #efbe00;
|
||||
}
|
||||
.need-share-button_mailto.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #efbe00;
|
||||
}
|
||||
.need-share-button_twitter {
|
||||
color: #00acec;
|
||||
}
|
||||
.need-share-button_twitter.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #00acec;
|
||||
}
|
||||
.need-share-button_pinterest {
|
||||
color: #cd2027;
|
||||
}
|
||||
.need-share-button_pinterest.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #cd2027;
|
||||
}
|
||||
.need-share-button_facebook {
|
||||
color: #3b5998;
|
||||
}
|
||||
.need-share-button_facebook.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #3b5998;
|
||||
}
|
||||
.need-share-button_googleplus {
|
||||
color: #d44132;
|
||||
}
|
||||
.need-share-button_googleplus.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #d44132;
|
||||
}
|
||||
.need-share-button_reddit {
|
||||
color: #000;
|
||||
}
|
||||
.need-share-button_reddit.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #000;
|
||||
}
|
||||
.need-share-button_delicious {
|
||||
color: #000;
|
||||
}
|
||||
.need-share-button_delicious.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #000;
|
||||
}
|
||||
.need-share-button_stumbleupon {
|
||||
color: #f04e23;
|
||||
}
|
||||
.need-share-button_stumbleupon.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #f04e23;
|
||||
}
|
||||
.need-share-button_linkedin {
|
||||
color: #0085af;
|
||||
}
|
||||
.need-share-button_linkedin.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #0085af;
|
||||
}
|
||||
.need-share-button_slashdot {
|
||||
color: #026664;
|
||||
}
|
||||
.need-share-button_slashdot.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #026664;
|
||||
}
|
||||
.need-share-button_technorati {
|
||||
color: #49ae47;
|
||||
}
|
||||
.need-share-button_technorati.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #49ae47;
|
||||
}
|
||||
.need-share-button_posterous {
|
||||
color: #795d31;
|
||||
}
|
||||
.need-share-button_posterous.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #795d31;
|
||||
}
|
||||
.need-share-button_tumblr {
|
||||
color: #34465d;
|
||||
}
|
||||
.need-share-button_tumblr.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #34465d;
|
||||
}
|
||||
.need-share-button_googlebookmarks {
|
||||
color: #fde331;
|
||||
}
|
||||
.need-share-button_googlebookmarks.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #fde331;
|
||||
}
|
||||
.need-share-button_newsvine {
|
||||
color: #03652c;
|
||||
}
|
||||
.need-share-button_newsvine.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #03652c;
|
||||
}
|
||||
.need-share-button_evernote {
|
||||
color: #79d626;
|
||||
}
|
||||
.need-share-button_evernote.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #79d626;
|
||||
}
|
||||
.need-share-button_friendfeed {
|
||||
color: #b0cbe9;
|
||||
}
|
||||
.need-share-button_friendfeed.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #b0cbe9;
|
||||
}
|
||||
.need-share-button_vkontakte {
|
||||
color: #4c75a3;
|
||||
}
|
||||
.need-share-button_vkontakte.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #4c75a3;
|
||||
}
|
||||
.need-share-button_odnoklassniki {
|
||||
color: #ed812b;
|
||||
}
|
||||
.need-share-button_odnoklassniki.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #ed812b;
|
||||
}
|
||||
.need-share-button_mailru {
|
||||
color: #f89c0e;
|
||||
}
|
||||
.need-share-button_mailru.need-share-button_link-box {
|
||||
color: #fff;
|
||||
|
||||
background: #f89c0e;
|
||||
}
|
537
themes/next/source/lib/needsharebutton/needsharebutton.js
Normal file
@ -0,0 +1,537 @@
|
||||
/***********************************************
|
||||
needShareButton
|
||||
- Version 1.0.0
|
||||
- Copyright 2015 Dzmitry Vasileuski
|
||||
- Licensed under MIT (http://opensource.org/licenses/MIT)
|
||||
***********************************************/
|
||||
|
||||
(function () {
|
||||
|
||||
// find closest
|
||||
function closest(elem, parent) {
|
||||
if (typeof (parent) == "string") {
|
||||
var matchesSelector = elem.matches || elem.webkitMatchesSelector ||
|
||||
elem.mozMatchesSelector || elem.msMatchesSelector;
|
||||
|
||||
if (!!matchesSelector) {
|
||||
while (elem) {
|
||||
if (matchesSelector.bind(elem)(parent)) {
|
||||
return elem;
|
||||
} else {
|
||||
elem = elem.parentElement;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
while (elem) {
|
||||
if (elem == parent) {
|
||||
return elem;
|
||||
} else {
|
||||
elem = elem.parentElement;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// share button class
|
||||
window.needShareButton = function (elem, options) {
|
||||
// create element reference
|
||||
var root = this;
|
||||
root.elem = elem || "need-share-button";
|
||||
|
||||
/* Helpers
|
||||
***********************************************/
|
||||
|
||||
// get title from html
|
||||
root.getTitle = function () {
|
||||
var content;
|
||||
// check querySelector existance for old browsers
|
||||
if (document.querySelector) {
|
||||
content = document.querySelector("title");
|
||||
if (content) {
|
||||
return content.innerText;
|
||||
}
|
||||
}
|
||||
return document.title;
|
||||
};
|
||||
|
||||
// get image from html
|
||||
root.getImage = function () {
|
||||
var content;
|
||||
// check querySelector existance for old browsers
|
||||
if (document.querySelector) {
|
||||
content = document.querySelector("meta[property=\"og:image\"]") ||
|
||||
document.querySelector("meta[name=\"twitter:image\"]");
|
||||
if (content) {
|
||||
return content.getAttribute("content");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
// get description from html
|
||||
root.getDescription = function () {
|
||||
var content;
|
||||
// check querySelector existance for old browsers
|
||||
if (document.querySelector) {
|
||||
content = document.querySelector("meta[property=\"og:description\"]") ||
|
||||
document.querySelector("meta[name=\"twitter:description\"]") ||
|
||||
document.querySelector("meta[name=\"description\"]");
|
||||
if (content) {
|
||||
return content.getAttribute("content");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
content = document.getElementsByTagName("meta").namedItem("description");
|
||||
if (content) {
|
||||
return content.getAttribute("content");
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// share urls for all networks
|
||||
root.share = {
|
||||
"weibo": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = "http://v.t.sina.com.cn/share/share.php?title=" +
|
||||
encodeURIComponent(myoptions.title) +
|
||||
"&url=" + encodeURIComponent(myoptions.url) +
|
||||
"&pic=" + encodeURIComponent(myoptions.image);
|
||||
root.popup(url);
|
||||
},
|
||||
"wechat": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var imgSrc = "https://api.qinco.me/api/qr?size=400&content=" + encodeURIComponent(myoptions.url);
|
||||
var dropdownEl = el.querySelector(".need-share-button_dropdown");
|
||||
var img = dropdownEl.getElementsByClassName("need-share-wechat-code-image")[0];
|
||||
if (img) {
|
||||
img.remove();
|
||||
} else {
|
||||
img = document.createElement("img");
|
||||
img.src = imgSrc;
|
||||
img.alt = "loading wechat image...";
|
||||
img.setAttribute("class", "need-share-wechat-code-image");
|
||||
dropdownEl.appendChild(img);
|
||||
}
|
||||
},
|
||||
"douban": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = "https://www.douban.com/share/service?name=" +
|
||||
encodeURIComponent(myoptions.title) +
|
||||
"&href=" + encodeURIComponent(myoptions.url) +
|
||||
"&image=" + encodeURIComponent(myoptions.image);
|
||||
root.popup(url);
|
||||
},
|
||||
"qqzone": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=" +
|
||||
encodeURIComponent(myoptions.title) +
|
||||
"&url=" + encodeURIComponent(myoptions.url) +
|
||||
"&pics=" + encodeURIComponent(myoptions.image) +
|
||||
"&desc=" + encodeURIComponent(myoptions.description);
|
||||
root.popup(url);
|
||||
},
|
||||
"renren": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = "http://widget.renren.com/dialog/share?title=" +
|
||||
encodeURIComponent(myoptions.title) +
|
||||
"&resourceUrl=" + encodeURIComponent(myoptions.url) +
|
||||
"&pic=" + encodeURIComponent(myoptions.image) +
|
||||
"&description=" + encodeURIComponent(myoptions.description);
|
||||
root.popup(url);
|
||||
},
|
||||
"mailto": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = "mailto:?subject=" + encodeURIComponent(myoptions.title) +
|
||||
"&body=Thought you might enjoy reading this: " + encodeURIComponent(myoptions.url) +
|
||||
" - " + encodeURIComponent(myoptions.description);
|
||||
|
||||
window.location.href = url;
|
||||
},
|
||||
"twitter": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "twitter.com/intent/tweet?text=";
|
||||
url += encodeURIComponent(myoptions.title) + "&url=" + encodeURIComponent(myoptions.url);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"pinterest": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "pinterest.com/pin/create/bookmarklet/?is_video=false";
|
||||
url += "&media=" + encodeURIComponent(myoptions.image);
|
||||
url += "&url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&description=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"facebook": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.facebook.com/share.php?";
|
||||
url += "u=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"googleplus": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "plus.google.com/share?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"reddit": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.reddit.com/submit?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"delicious": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "del.icio.us/post?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
url += "¬es=" + encodeURIComponent(myoptions.description);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"stumbleupon": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.stumbleupon.com/submit?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"linkedin": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.linkedin.com/shareArticle?mini=true";
|
||||
url += "&url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
url += "&source=" + encodeURIComponent(myoptions.source);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"slashdot": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "slashdot.org/bookmark.pl?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"technorati": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "technorati.com/faves?";
|
||||
url += "add=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"posterous": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "posterous.com/share?";
|
||||
url += "linkto=" + encodeURIComponent(myoptions.url);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"tumblr": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.tumblr.com/share?v=3";
|
||||
url += "&u=" + encodeURIComponent(myoptions.url);
|
||||
url += "&t=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"googlebookmarks": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.google.com/bookmarks/mark?op=edit";
|
||||
url += "&bkmk=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
url += "&annotation=" + encodeURIComponent(myoptions.description);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"newsvine": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.newsvine.com/_tools/seed&save?";
|
||||
url += "u=" + encodeURIComponent(myoptions.url);
|
||||
url += "&h=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"evernote": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.evernote.com/clip.action?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"friendfeed": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.friendfeed.com/share?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"vkontakte": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "vkontakte.ru/share.php?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
url += "&description=" + encodeURIComponent(myoptions.description);
|
||||
url += "&image=" + encodeURIComponent(myoptions.image);
|
||||
url += "&noparse=true";
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"odnoklassniki": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1";
|
||||
url += "&st.comments=" + encodeURIComponent(myoptions.description);
|
||||
url += "&st._surl=" + encodeURIComponent(myoptions.url);
|
||||
|
||||
root.popup(url);
|
||||
},
|
||||
"mailru": function (el) {
|
||||
var myoptions = getOptions(el);
|
||||
var url = myoptions.protocol + "connect.mail.ru/share?";
|
||||
url += "url=" + encodeURIComponent(myoptions.url);
|
||||
url += "&title=" + encodeURIComponent(myoptions.title);
|
||||
url += "&description=" + encodeURIComponent(myoptions.description);
|
||||
url += "&imageurl=" + encodeURIComponent(myoptions.image);
|
||||
|
||||
root.popup(url);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// open share link in a popup
|
||||
root.popup = function (url) {
|
||||
// set left and top position
|
||||
var popupWidth = 600,
|
||||
popupHeight = 500,
|
||||
// fix dual screen mode
|
||||
dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left,
|
||||
dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top,
|
||||
width = window.innerWidth ?
|
||||
window.innerWidth :
|
||||
document.documentElement.clientWidth ?
|
||||
document.documentElement.clientWidth :
|
||||
screen.width,
|
||||
height = window.innerHeight ?
|
||||
window.innerHeight :
|
||||
document.documentElement.clientHeight ?
|
||||
document.documentElement.clientHeight :
|
||||
screen.height,
|
||||
// calculate top and left position
|
||||
left = ((width / 2) - (popupWidth / 2)) + dualScreenLeft,
|
||||
top = ((height / 2) - (popupHeight / 2)) + dualScreenTop,
|
||||
|
||||
// show popup
|
||||
shareWindow = window.open(url, "targetWindow",
|
||||
"toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + popupWidth +
|
||||
", height=" + popupHeight + ", top=" + top + ", left=" + left);
|
||||
|
||||
// Puts focus on the newWindow
|
||||
if (window.focus) {
|
||||
shareWindow.focus();
|
||||
}
|
||||
};
|
||||
|
||||
/* Set options
|
||||
***********************************************/
|
||||
|
||||
// create default options
|
||||
root.options = {
|
||||
iconStyle: "default", // default or box
|
||||
boxForm: "horizontal", // horizontal or vertical
|
||||
position: "bottomCenter", // top / middle / bottom + Left / Center / Right
|
||||
protocol: ["http", "https"].indexOf(window.location.href.split(":")[0]) === -1 ? "https://" : "//",
|
||||
networks: "Weibo,Wechat,Douban,QQZone,Twitter,Pinterest,Facebook,GooglePlus,Reddit,Linkedin,Tumblr,Evernote"
|
||||
};
|
||||
|
||||
// integrate custom options
|
||||
for (var i in options) {
|
||||
if (options.hasOwnProperty(i)) {
|
||||
root.options[i] = options[i];
|
||||
}
|
||||
}
|
||||
// convert networks string into array
|
||||
//root.options.networks = root.options.networks.toLowerCase().split(",");
|
||||
root.options.networks = root.options.networks.split(",");
|
||||
|
||||
function getOptions(el) {
|
||||
// integrate data attribute options
|
||||
var ret = {};
|
||||
for (var i in root.options) {
|
||||
if (root.options.hasOwnProperty(i)) {
|
||||
ret[i] = root.options[i];
|
||||
}
|
||||
}
|
||||
|
||||
// these attrs must get dynamically.
|
||||
ret.url = window.location.href;
|
||||
ret.title = root.getTitle();
|
||||
ret.image = root.getImage();
|
||||
ret.description = root.getDescription();
|
||||
|
||||
for (var option in el.dataset) {
|
||||
// replace only 'share-' prefixed data-attributes
|
||||
if (option.match(/share/)) {
|
||||
var newOption = option.replace(/share/, "");
|
||||
if (!newOption.length) {
|
||||
continue;
|
||||
}
|
||||
newOption = newOption.charAt(0).toLowerCase() + newOption.slice(1);
|
||||
var val = el.dataset[option];
|
||||
if (newOption === "networks") {
|
||||
//val = val.toLowerCase().split(",");
|
||||
val = val.split(",");
|
||||
} else if (newOption === "url" && val && val[0] === "/") {
|
||||
// fix relative url problem.
|
||||
val = location.origin + val;
|
||||
}
|
||||
ret[newOption] = val;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function createDropdown(el) {
|
||||
// create dropdown
|
||||
var dropdownEl = document.createElement("span");
|
||||
dropdownEl.className = "need-share-button_dropdown";
|
||||
if (el.querySelector(".need-share-button_dropdown")) {
|
||||
return;
|
||||
}
|
||||
var myoptions = getOptions(el);
|
||||
|
||||
// set dropdown row length
|
||||
if (myoptions.iconStyle == "box" && myoptions.boxForm == "horizontal") {
|
||||
dropdownEl.className += " need-share-button_dropdown-box-horizontal";
|
||||
} else if (myoptions.iconStyle == "box" && myoptions.boxForm == "vertical") {
|
||||
dropdownEl.className += " need-share-button_dropdown-box-vertical";
|
||||
}
|
||||
|
||||
// set dropdown position
|
||||
setTimeout(function () {
|
||||
switch (myoptions.position) {
|
||||
case "topLeft":
|
||||
dropdownEl.className += " need-share-button_dropdown-top-left";
|
||||
break;
|
||||
case "topRight":
|
||||
dropdownEl.className += " need-share-button_dropdown-top-right";
|
||||
break;
|
||||
case "topCenter":
|
||||
dropdownEl.className += " need-share-button_dropdown-top-center";
|
||||
dropdownEl.style.marginLeft = -dropdownEl.offsetWidth / 2 + "px";
|
||||
break;
|
||||
case "middleLeft":
|
||||
dropdownEl.className += " need-share-button_dropdown-middle-left";
|
||||
dropdownEl.style.marginTop = -dropdownEl.offsetHeight / 2 + "px";
|
||||
break;
|
||||
case "middleRight":
|
||||
dropdownEl.className += " need-share-button_dropdown-middle-right";
|
||||
dropdownEl.style.marginTop = -dropdownEl.offsetHeight / 2 + "px";
|
||||
break;
|
||||
case "bottomLeft":
|
||||
dropdownEl.className += " need-share-button_dropdown-bottom-left";
|
||||
break;
|
||||
case "bottomRight":
|
||||
dropdownEl.className += " need-share-button_dropdown-bottom-right";
|
||||
break;
|
||||
case "bottomCenter":
|
||||
dropdownEl.className += " need-share-button_dropdown-bottom-center";
|
||||
dropdownEl.style.marginLeft = -dropdownEl.offsetWidth / 2 + "px";
|
||||
break;
|
||||
default:
|
||||
dropdownEl.className += " need-share-button_dropdown-bottom-center";
|
||||
dropdownEl.style.marginLeft = -dropdownEl.offsetWidth / 2 + "px";
|
||||
break;
|
||||
}
|
||||
}, 1);
|
||||
|
||||
|
||||
// fill fropdown with buttons
|
||||
var iconClass = myoptions.iconStyle == "default" ?
|
||||
"need-share-button_link need-share-button_" :
|
||||
"need-share-button_link-" + myoptions.iconStyle + " need-share-button_link need-share-button_";
|
||||
for (var network in myoptions.networks) {
|
||||
if (myoptions.networks.hasOwnProperty(network)) {
|
||||
var link = document.createElement("span");
|
||||
network = myoptions.networks[network].trim();
|
||||
var networkLC = network.toLowerCase();
|
||||
link.className = iconClass + networkLC;
|
||||
var fontello = ["weibo", "wechat", "douban", "qqzone", "renren"];
|
||||
if (fontello.indexOf(networkLC) === -1) {
|
||||
link.className += " social-" + networkLC;
|
||||
} else {
|
||||
link.className += " icon-" + networkLC;
|
||||
}
|
||||
link.dataset.network = networkLC;
|
||||
link.title = network;
|
||||
dropdownEl.appendChild(link);
|
||||
}
|
||||
}
|
||||
|
||||
dropdownEl.addEventListener("click", function (event) {
|
||||
if (closest(event.target, ".need-share-button_link")) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
root.share[event.target.dataset.network](el);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
el.appendChild(dropdownEl);
|
||||
}
|
||||
|
||||
// close on click outside
|
||||
document.addEventListener("click", function (event) {
|
||||
var openedEl = document.querySelector(".need-share-button-opened");
|
||||
if (!closest(event.target, ".need-share-button-opened")) {
|
||||
if (openedEl) {
|
||||
openedEl.classList.remove("need-share-button-opened");
|
||||
|
||||
// hide wechat code image when close the dropdown.
|
||||
if (openedEl.querySelector(".need-share-wechat-code-image")) {
|
||||
openedEl.querySelector(".need-share-wechat-code-image").remove();
|
||||
}
|
||||
} else {
|
||||
var el = closest(event.target, root.elem);
|
||||
if (el) {
|
||||
if (!el.classList.contains("need-share-button-opened")) {
|
||||
createDropdown(el);
|
||||
setTimeout(function () {
|
||||
el.classList.add("need-share-button-opened");
|
||||
}, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setTimeout(function () {
|
||||
openedEl.classList.remove("need-share-button-opened");
|
||||
|
||||
// hide wechat code image when close the dropdown.
|
||||
if (openedEl.querySelector(".need-share-wechat-code-image")) {
|
||||
openedEl.querySelector(".need-share-wechat-code-image").remove();
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
})();
|
1
themes/next/source/lib/pace/pace-theme-barber-shop.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace,.pace .pace-progress{width:100%;overflow:hidden}.pace,.pace .pace-activity{position:fixed;top:0;left:0}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:2000;height:12px;background:#fff}.pace-inactive{display:none}.pace .pace-progress{background-color:#29d;position:fixed;top:0;bottom:0;right:100%}.pace .pace-activity{right:-32px;bottom:0;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0);background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(.25,rgba(255,255,255,.2)),color-stop(.25,transparent),color-stop(.5,transparent),color-stop(.5,rgba(255,255,255,.2)),color-stop(.75,rgba(255,255,255,.2)),color-stop(.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.2) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.2) 75%,transparent 75%,transparent);-webkit-background-size:32px 32px;-moz-background-size:32px 32px;-o-background-size:32px 32px;background-size:32px 32px;-webkit-animation:pace-theme-barber-shop-motion .5s linear infinite;-moz-animation:pace-theme-barber-shop-motion .5s linear infinite;-ms-animation:pace-theme-barber-shop-motion .5s linear infinite;-o-animation:pace-theme-barber-shop-motion .5s linear infinite;animation:pace-theme-barber-shop-motion .5s linear infinite}@-webkit-keyframes pace-theme-barber-shop-motion{0%{-webkit-transform:none;transform:none}100%{-webkit-transform:translate(-32px,0);transform:translate(-32px,0)}}@-moz-keyframes pace-theme-barber-shop-motion{0%{-moz-transform:none;transform:none}100%{-moz-transform:translate(-32px,0);transform:translate(-32px,0)}}@-o-keyframes pace-theme-barber-shop-motion{0%{-o-transform:none;transform:none}100%{-o-transform:translate(-32px,0);transform:translate(-32px,0)}}@-ms-keyframes pace-theme-barber-shop-motion{0%{-ms-transform:none;transform:none}100%{-ms-transform:translate(-32px,0);transform:translate(-32px,0)}}@keyframes pace-theme-barber-shop-motion{0%{transform:none}100%{transform:translate(-32px,0)}}
|
1
themes/next/source/lib/pace/pace-theme-big-counter.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace.pace-inactive .pace-progress{display:none}.pace .pace-progress{position:fixed;z-index:2000;top:0;right:0;height:5rem;width:5rem;-webkit-transform:translate3d(0,0,0)!important;-ms-transform:translate3d(0,0,0)!important;transform:translate3d(0,0,0)!important}.pace .pace-progress:after{display:block;position:absolute;top:0;right:.5rem;content:attr(data-progress-text);font-family:"Helvetica Neue",sans-serif;font-weight:100;font-size:5rem;line-height:1;text-align:right;color:rgba(34,153,221,.19999999999999996)}
|
1
themes/next/source/lib/pace/pace-theme-bounce.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace{width:140px;height:300px;position:fixed;top:-90px;right:-20px;z-index:2000;-webkit-transform:scale(0);-moz-transform:scale(0);-ms-transform:scale(0);-o-transform:scale(0);transform:scale(0);opacity:0;-webkit-transition:all 2s linear 0s;-moz-transition:all 2s linear 0s;transition:all 2s linear 0s}.pace.pace-active{-webkit-transform:scale(.25);-moz-transform:scale(.25);-ms-transform:scale(.25);-o-transform:scale(.25);transform:scale(.25);opacity:1}.pace .pace-activity{width:140px;height:140px;border-radius:70px;background:#29d;position:absolute;top:0;z-index:1911;-webkit-animation:pace-bounce 1s infinite;-moz-animation:pace-bounce 1s infinite;-o-animation:pace-bounce 1s infinite;-ms-animation:pace-bounce 1s infinite;animation:pace-bounce 1s infinite}.pace .pace-progress{position:absolute;display:block;left:50%;bottom:0;z-index:1910;margin-left:-30px;width:60px;height:75px;background:rgba(20,20,20,.1);box-shadow:0 0 20px 35px rgba(20,20,20,.1);border-radius:30px/40px;-webkit-transform:scaleY(.3)!important;-moz-transform:scaleY(.3)!important;-ms-transform:scaleY(.3)!important;-o-transform:scaleY(.3)!important;transform:scaleY(.3)!important;-webkit-animation:pace-compress .5s infinite alternate;-moz-animation:pace-compress .5s infinite alternate;-o-animation:pace-compress .5s infinite alternate;-ms-animation:pace-compress .5s infinite alternate;animation:pace-compress .5s infinite alternate}@-webkit-keyframes pace-bounce{0%,100%,95%{top:0;-webkit-animation-timing-function:ease-in}50%{top:140px;height:140px;-webkit-animation-timing-function:ease-out}55%{top:160px;height:120px;border-radius:70px/60px;-webkit-animation-timing-function:ease-in}65%{top:120px;height:140px;border-radius:70px;-webkit-animation-timing-function:ease-out}}@-moz-keyframes pace-bounce{0%,100%,95%{top:0;-moz-animation-timing-function:ease-in}50%{top:140px;height:140px;-moz-animation-timing-function:ease-out}55%{top:160px;height:120px;border-radius:70px/60px;-moz-animation-timing-function:ease-in}65%{top:120px;height:140px;border-radius:70px;-moz-animation-timing-function:ease-out}}@keyframes pace-bounce{0%,100%,95%{top:0;animation-timing-function:ease-in}50%{top:140px;height:140px;animation-timing-function:ease-out}55%{top:160px;height:120px;border-radius:70px/60px;animation-timing-function:ease-in}65%{top:120px;height:140px;border-radius:70px;animation-timing-function:ease-out}}@-webkit-keyframes pace-compress{0%{bottom:0;margin-left:-30px;width:60px;height:75px;background:rgba(20,20,20,.1);box-shadow:0 0 20px 35px rgba(20,20,20,.1);border-radius:30px/40px;-webkit-animation-timing-function:ease-in}100%{bottom:30px;margin-left:-10px;width:20px;height:5px;background:rgba(20,20,20,.3);box-shadow:0 0 20px 35px rgba(20,20,20,.3);border-radius:20px;-webkit-animation-timing-function:ease-out}}@-moz-keyframes pace-compress{0%{bottom:0;margin-left:-30px;width:60px;height:75px;background:rgba(20,20,20,.1);box-shadow:0 0 20px 35px rgba(20,20,20,.1);border-radius:30px/40px;-moz-animation-timing-function:ease-in}100%{bottom:30px;margin-left:-10px;width:20px;height:5px;background:rgba(20,20,20,.3);box-shadow:0 0 20px 35px rgba(20,20,20,.3);border-radius:20px;-moz-animation-timing-function:ease-out}}@keyframes pace-compress{0%{bottom:0;margin-left:-30px;width:60px;height:75px;background:rgba(20,20,20,.1);box-shadow:0 0 20px 35px rgba(20,20,20,.1);border-radius:30px/40px;animation-timing-function:ease-in}100%{bottom:30px;margin-left:-10px;width:20px;height:5px;background:rgba(20,20,20,.3);box-shadow:0 0 20px 35px rgba(20,20,20,.3);border-radius:20px;animation-timing-function:ease-out}}
|
1
themes/next/source/lib/pace/pace-theme-center-atom.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace,.pace .pace-progress{z-index:2000;height:60px;width:100px}.pace .pace-activity,.pace .pace-progress:before{border-radius:50%;display:block;position:absolute}.pace.pace-inactive{display:none}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:fixed;margin:auto;top:0;left:0;right:0;bottom:0}.pace .pace-progress{position:absolute;-webkit-transform:translate3d(0,0,0)!important;-ms-transform:translate3d(0,0,0)!important;transform:translate3d(0,0,0)!important}.pace .pace-progress:before{content:attr(data-progress-text);text-align:center;color:#fff;background:#29d;font-family:"Helvetica Neue",sans-serif;font-size:14px;font-weight:100;line-height:1;padding:20% 0 7px;width:50%;height:40%;margin:10px 0 0 30px;z-index:999}.pace .pace-activity{font-size:15px;line-height:1;z-index:2000;-webkit-animation:pace-theme-center-atom-spin 2s linear infinite;-moz-animation:pace-theme-center-atom-spin 2s linear infinite;-o-animation:pace-theme-center-atom-spin 2s linear infinite;animation:pace-theme-center-atom-spin 2s linear infinite;border:5px solid #29d;content:' ';top:0;left:0;height:60px;width:100px}.pace .pace-activity:after,.pace .pace-activity:before{content:' ';display:block;position:absolute;top:-5px;left:-5px;height:60px;width:100px}.pace .pace-activity:after{border-radius:50%;border:5px solid #29d;-webkit-transform:rotate(60deg);-moz-transform:rotate(60deg);-o-transform:rotate(60deg);transform:rotate(60deg)}.pace .pace-activity:before{border-radius:50%;border:5px solid #29d;-webkit-transform:rotate(120deg);-moz-transform:rotate(120deg);-o-transform:rotate(120deg);transform:rotate(120deg)}@-webkit-keyframes pace-theme-center-atom-spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(359deg)}}@-moz-keyframes pace-theme-center-atom-spin{0%{-moz-transform:rotate(0)}100%{-moz-transform:rotate(359deg)}}@-o-keyframes pace-theme-center-atom-spin{0%{-o-transform:rotate(0)}100%{-o-transform:rotate(359deg)}}@keyframes pace-theme-center-atom-spin{0%{transform:rotate(0)}100%{transform:rotate(359deg)}}
|
1
themes/next/source/lib/pace/pace-theme-center-circle.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace,.pace .pace-progress{z-index:2000;left:0;top:0;height:6rem}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-perspective:12rem;-moz-perspective:12rem;-ms-perspective:12rem;-o-perspective:12rem;perspective:12rem;position:fixed;width:6rem;margin:auto;right:0;bottom:0}.pace.pace-inactive .pace-progress{display:none}.pace .pace-progress{display:block;position:absolute;width:6rem!important;line-height:6rem;font-size:2rem;border-radius:50%;background:rgba(34,153,221,.8);color:#fff;font-family:"Helvetica Neue",sans-serif;font-weight:100;text-align:center;-webkit-animation:pace-theme-center-circle-spin linear infinite 2s;-moz-animation:pace-theme-center-circle-spin linear infinite 2s;-ms-animation:pace-theme-center-circle-spin linear infinite 2s;-o-animation:pace-theme-center-circle-spin linear infinite 2s;animation:pace-theme-center-circle-spin linear infinite 2s;-webkit-transform-style:preserve-3d;-moz-transform-style:preserve-3d;-ms-transform-style:preserve-3d;-o-transform-style:preserve-3d;transform-style:preserve-3d}.pace .pace-progress:after{content:attr(data-progress-text);display:block}@-webkit-keyframes pace-theme-center-circle-spin{from{-webkit-transform:rotateY(0)}to{-webkit-transform:rotateY(360deg)}}@-moz-keyframes pace-theme-center-circle-spin{from{-moz-transform:rotateY(0)}to{-moz-transform:rotateY(360deg)}}@-ms-keyframes pace-theme-center-circle-spin{from{-ms-transform:rotateY(0)}to{-ms-transform:rotateY(360deg)}}@-o-keyframes pace-theme-center-circle-spin{from{-o-transform:rotateY(0)}to{-o-transform:rotateY(360deg)}}@keyframes pace-theme-center-circle-spin{from{transform:rotateY(0)}to{transform:rotateY(360deg)}}
|
1
themes/next/source/lib/pace/pace-theme-center-radar.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace,.pace .pace-activity{z-index:2000;height:90px;width:90px}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;position:fixed;margin:auto;top:0;left:0;right:0;bottom:0}.pace.pace-inactive .pace-activity{display:none}.pace .pace-activity,.pace .pace-activity:before{position:absolute;display:block;border-color:#29d transparent transparent;border-radius:50%}.pace .pace-activity{left:-30px;top:-30px;border-width:30px;border-style:double;-webkit-animation:spin 1s linear infinite;-moz-animation:spin 1s linear infinite;-o-animation:spin 1s linear infinite;animation:spin 1s linear infinite}.pace .pace-activity:before{content:' ';top:10px;left:10px;height:50px;width:50px;border-width:10px;border-style:solid}@-webkit-keyframes spin{100%{-webkit-transform:rotate(359deg)}}@-moz-keyframes spin{100%{-moz-transform:rotate(359deg)}}@-o-keyframes spin{100%{-moz-transform:rotate(359deg)}}@keyframes spin{100%{transform:rotate(359deg)}}
|
1
themes/next/source/lib/pace/pace-theme-center-simple.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:2000;position:fixed;margin:auto;top:0;left:0;right:0;bottom:0;height:5px;width:200px;background:#fff;border:1px solid #29d;overflow:hidden}.pace .pace-progress{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;-webkit-transform:translate3d(0,0,0);-moz-transform:translate3d(0,0,0);-ms-transform:translate3d(0,0,0);-o-transform:translate3d(0,0,0);transform:translate3d(0,0,0);max-width:200px;z-index:2000;display:block;position:absolute;top:0;right:100%;height:100%;width:100%;background:#29d}.pace.pace-inactive{display:none}
|
1
themes/next/source/lib/pace/pace-theme-corner-indicator.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace .pace-activity{display:block;position:fixed;z-index:2000;top:0;right:0;width:300px;height:300px;background:#29d;-webkit-transition:-webkit-transform .3s;transition:transform .3s;-webkit-transform:translateX(100%) translateY(-100%) rotate(45deg);transform:translateX(100%) translateY(-100%) rotate(45deg);pointer-events:none}.pace.pace-active .pace-activity{-webkit-transform:translateX(50%) translateY(-50%) rotate(45deg);transform:translateX(50%) translateY(-50%) rotate(45deg)}.pace .pace-activity::after,.pace .pace-activity::before{-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;bottom:30px;left:50%;display:block;border:5px solid #fff;border-radius:50%;content:''}.pace .pace-activity::before{margin-left:-40px;width:80px;height:80px;border-right-color:rgba(0,0,0,.2);border-left-color:rgba(0,0,0,.2);-webkit-animation:pace-theme-corner-indicator-spin 3s linear infinite;animation:pace-theme-corner-indicator-spin 3s linear infinite}.pace .pace-activity::after{bottom:50px;margin-left:-20px;width:40px;height:40px;border-top-color:rgba(0,0,0,.2);border-bottom-color:rgba(0,0,0,.2);-webkit-animation:pace-theme-corner-indicator-spin 1s linear infinite;animation:pace-theme-corner-indicator-spin 1s linear infinite}@-webkit-keyframes pace-theme-corner-indicator-spin{0%{-webkit-transform:rotate(0)}100%{-webkit-transform:rotate(359deg)}}@keyframes pace-theme-corner-indicator-spin{0%{transform:rotate(0)}100%{transform:rotate(359deg)}}
|
1
themes/next/source/lib/pace/pace-theme-fill-left.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background-color:rgba(34,153,221,.19999999999999996);position:fixed;z-index:-1;top:0;right:100%;bottom:0;width:100%}
|
1
themes/next/source/lib/pace/pace-theme-flash.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#29d;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:2px}.pace .pace-progress-inner{display:block;position:absolute;right:0;width:100px;height:100%;box-shadow:0 0 10px #29d,0 0 5px #29d;opacity:1;-webkit-transform:rotate(3deg) translate(0,-4px);-moz-transform:rotate(3deg) translate(0,-4px);-ms-transform:rotate(3deg) translate(0,-4px);-o-transform:rotate(3deg) translate(0,-4px);transform:rotate(3deg) translate(0,-4px)}.pace .pace-activity{display:block;position:fixed;z-index:2000;top:15px;right:15px;width:14px;height:14px;border:2px solid transparent;border-top-color:#29d;border-left-color:#29d;border-radius:10px;-webkit-animation:pace-spinner .4s linear infinite;-moz-animation:pace-spinner .4s linear infinite;-ms-animation:pace-spinner .4s linear infinite;-o-animation:pace-spinner .4s linear infinite;animation:pace-spinner .4s linear infinite}@-webkit-keyframes pace-spinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@-moz-keyframes pace-spinner{0%{-moz-transform:rotate(0);transform:rotate(0)}100%{-moz-transform:rotate(360deg);transform:rotate(360deg)}}@-o-keyframes pace-spinner{0%{-o-transform:rotate(0);transform:rotate(0)}100%{-o-transform:rotate(360deg);transform:rotate(360deg)}}@-ms-keyframes pace-spinner{0%{-ms-transform:rotate(0);transform:rotate(0)}100%{-ms-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes pace-spinner{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}
|
1
themes/next/source/lib/pace/pace-theme-loading-bar.min.css
vendored
Normal file
1
themes/next/source/lib/pace/pace-theme-mac-osx.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace,.pace .pace-progress{width:100%;height:12px;overflow:hidden}.pace,.pace .pace-activity{position:fixed;top:0;left:0}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:2000;background:#fff}.pace-inactive{display:none}.pace .pace-progress{background-color:#0087E1;position:fixed;top:0;right:100%;-webkit-border-radius:0 0 4px;-moz-border-radius:0 0 4px;-o-border-radius:0 0 4px;border-radius:0 0 4px;-webkit-box-shadow:inset -1px 0 #00558F,inset 0 -1px #00558F,inset 0 2px rgba(255,255,255,.5),inset 0 6px rgba(255,255,255,.3);-moz-box-shadow:inset -1px 0 #00558F,inset 0 -1px #00558F,inset 0 2px rgba(255,255,255,.5),inset 0 6px rgba(255,255,255,.3);-o-box-shadow:inset -1px 0 #00558F,inset 0 -1px #00558F,inset 0 2px rgba(255,255,255,.5),inset 0 6px rgba(255,255,255,.3);box-shadow:inset -1px 0 #00558F,inset 0 -1px #00558F,inset 0 2px rgba(255,255,255,.5),inset 0 6px rgba(255,255,255,.3)}.pace .pace-activity{right:-28px;bottom:0;-webkit-background-image:radial-gradient(rgba(255,255,255,.65) 0,rgba(255,255,255,.15) 100%);-moz-background-image:radial-gradient(rgba(255,255,255,.65) 0,rgba(255,255,255,.15) 100%);-o-background-image:radial-gradient(rgba(255,255,255,.65) 0,rgba(255,255,255,.15) 100%);background-image:radial-gradient(rgba(255,255,255,.65) 0,rgba(255,255,255,.15) 100%);-webkit-background-size:28px 100%;-moz-background-size:28px 100%;-o-background-size:28px 100%;background-size:28px 100%;-webkit-animation:pace-theme-mac-osx-motion .5s linear infinite;-moz-animation:pace-theme-mac-osx-motion .5s linear infinite;-ms-animation:pace-theme-mac-osx-motion .5s linear infinite;-o-animation:pace-theme-mac-osx-motion .5s linear infinite;animation:pace-theme-mac-osx-motion .5s linear infinite}@-webkit-keyframes pace-theme-mac-osx-motion{0%{-webkit-transform:none;transform:none}100%{-webkit-transform:translate(-28px,0);transform:translate(-28px,0)}}@-moz-keyframes pace-theme-mac-osx-motion{0%{-moz-transform:none;transform:none}100%{-moz-transform:translate(-28px,0);transform:translate(-28px,0)}}@-o-keyframes pace-theme-mac-osx-motion{0%{-o-transform:none;transform:none}100%{-o-transform:translate(-28px,0);transform:translate(-28px,0)}}@-ms-keyframes pace-theme-mac-osx-motion{0%{-ms-transform:none;transform:none}100%{-ms-transform:translate(-28px,0);transform:translate(-28px,0)}}@keyframes pace-theme-mac-osx-motion{0%{transform:none}100%{transform:translate(-28px,0)}}
|
1
themes/next/source/lib/pace/pace-theme-minimal.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.pace-inactive{display:none}.pace .pace-progress{background:#29d;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:2px}
|
2
themes/next/source/lib/pace/pace.min.js
vendored
Normal file
20
themes/next/source/lib/three/canvas_lines.min.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
$(function(){var mouseX=0,mouseY=0,windowHalfX=window.innerWidth/2,windowHalfY=window.innerHeight/2,SEPARATION=200,AMOUNTX=10,AMOUNTY=10,camera,scene,renderer;init();animate();function init(){var container,separation=100,amountX=50,amountY=50,particles,particle;container=document.createElement("div");container.style.position="fixed";container.style.top="0px";container.style.left="0px";container.style.zIndex="-1";container.style.opacity="0.5";document.body.appendChild(container);camera=new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,1,10000);camera.position.z=100;scene=new THREE.Scene();renderer=new THREE.CanvasRenderer();renderer.setClearColor(16119801,0);renderer.setPixelRatio(window.devicePixelRatio);renderer.setSize(window.innerWidth,window.innerHeight);container.appendChild(renderer.domElement);var PI2=Math.PI*2;var material=new THREE.SpriteCanvasMaterial({color:10263708,program:function(context){context.beginPath();context.arc(0,0,0.5,0,PI2,true);context.fill()}});var geometry=new THREE.Geometry();for(var i=0;i<100;i++){particle=new THREE.Sprite(material);particle.position.x=Math.random()*2-1;particle.position.y=Math.random()*2-1;particle.position.z=Math.random()*2-1;particle.position.normalize();particle.position.multiplyScalar(Math.random()*10+450);particle.scale.x=particle.scale.y=10;scene.add(particle);geometry.vertices.push(particle.position)}var line=new THREE.Line(geometry,new THREE.LineBasicMaterial({color:10263708,opacity:0.5}));scene.add(line);document.addEventListener("mousemove",onDocumentMouseMove,false);document.addEventListener("touchstart",onDocumentTouchStart,false);document.addEventListener("touchmove",onDocumentTouchMove,false);window.addEventListener("resize",onWindowResize,false)}function onWindowResize(){windowHalfX=window.innerWidth/2;windowHalfY=window.innerHeight/2;camera.aspect=window.innerWidth/window.innerHeight;camera.updateProjectionMatrix();renderer.setSize(window.innerWidth,window.innerHeight)}function onDocumentMouseMove(event){mouseX=event.clientX-windowHalfX;
|
||||
mouseY=event.clientY-windowHalfY}function onDocumentTouchStart(event){if(event.touches.length>1){mouseX=event.touches[0].pageX-windowHalfX}}function onDocumentTouchMove(event){if(event.touches.length==1){mouseX=event.touches[0].pageX-windowHalfX}}function animate(){requestAnimationFrame(animate);render()}function render(){camera.position.x+=(mouseX-camera.position.x)*0.05;camera.position.y+=(-mouseY+200-camera.position.y)*0.05;camera.lookAt(scene.position);renderer.render(scene,camera)}});
|
||||
THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0;this.renderOrder=0};THREE.RenderableFace=function(){this.id=0;this.v1=new THREE.RenderableVertex();this.v2=new THREE.RenderableVertex();this.v3=new THREE.RenderableVertex();this.normalModel=new THREE.Vector3();this.vertexNormalsModel=[new THREE.Vector3(),new THREE.Vector3(),new THREE.Vector3()];this.vertexNormalsLength=0;this.color=new THREE.Color();this.material=null;this.uvs=[new THREE.Vector2(),new THREE.Vector2(),new THREE.Vector2()];this.z=0;this.renderOrder=0};THREE.RenderableVertex=function(){this.position=new THREE.Vector3();this.positionWorld=new THREE.Vector3();this.positionScreen=new THREE.Vector4();this.visible=true};THREE.RenderableVertex.prototype.copy=function(vertex){this.positionWorld.copy(vertex.positionWorld);this.positionScreen.copy(vertex.positionScreen)};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex();this.v2=new THREE.RenderableVertex();this.vertexColors=[new THREE.Color(),new THREE.Color()];this.material=null;this.z=0;this.renderOrder=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.x=0;this.y=0;this.z=0;this.rotation=0;this.scale=new THREE.Vector2();this.material=null;this.renderOrder=0};THREE.Projector=function(){var _object,_objectCount,_objectPool=[],_objectPoolLength=0,_vertex,_vertexCount,_vertexPool=[],_vertexPoolLength=0,_face,_faceCount,_facePool=[],_facePoolLength=0,_line,_lineCount,_linePool=[],_linePoolLength=0,_sprite,_spriteCount,_spritePool=[],_spritePoolLength=0,_renderData={objects:[],lights:[],elements:[]},_vector3=new THREE.Vector3(),_vector4=new THREE.Vector4(),_clipBox=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),_boundingBox=new THREE.Box3(),_points3=new Array(3),_points4=new Array(4),_viewMatrix=new THREE.Matrix4(),_viewProjectionMatrix=new THREE.Matrix4(),_modelMatrix,_modelViewProjectionMatrix=new THREE.Matrix4(),_normalMatrix=new THREE.Matrix3(),_frustum=new THREE.Frustum(),_clippedVertex1PositionScreen=new THREE.Vector4(),_clippedVertex2PositionScreen=new THREE.Vector4();
|
||||
this.projectVector=function(vector,camera){console.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")};var RenderList=function(){var normals=[];var uvs=[];var object=null;var material=null;var normalMatrix=new THREE.Matrix3();function setObject(value){object=value;material=object.material;normalMatrix.getNormalMatrix(object.matrixWorld);normals.length=0;uvs.length=0}function projectVertex(vertex){var position=vertex.position;var positionWorld=vertex.positionWorld;var positionScreen=vertex.positionScreen;positionWorld.copy(position).applyMatrix4(_modelMatrix);positionScreen.copy(positionWorld).applyMatrix4(_viewProjectionMatrix);var invW=1/positionScreen.w;positionScreen.x*=invW;positionScreen.y*=invW;positionScreen.z*=invW;vertex.visible=positionScreen.x>=-1&&positionScreen.x<=1&&positionScreen.y>=-1&&positionScreen.y<=1&&positionScreen.z>=-1&&positionScreen.z<=1}function pushVertex(x,y,z){_vertex=getNextVertexInPool();_vertex.position.set(x,y,z);projectVertex(_vertex)}function pushNormal(x,y,z){normals.push(x,y,z)}function pushUv(x,y){uvs.push(x,y)}function checkTriangleVisibility(v1,v2,v3){if(v1.visible===true||v2.visible===true||v3.visible===true){return true}_points3[0]=v1.positionScreen;_points3[1]=v2.positionScreen;_points3[2]=v3.positionScreen;return _clipBox.intersectsBox(_boundingBox.setFromPoints(_points3))}function checkBackfaceCulling(v1,v2,v3){return((v3.positionScreen.x-v1.positionScreen.x)*(v2.positionScreen.y-v1.positionScreen.y)-(v3.positionScreen.y-v1.positionScreen.y)*(v2.positionScreen.x-v1.positionScreen.x))<0}function pushLine(a,b){var v1=_vertexPool[a];var v2=_vertexPool[b];_line=getNextLineInPool();_line.id=object.id;_line.v1.copy(v1);_line.v2.copy(v2);
|
||||
_line.z=(v1.positionScreen.z+v2.positionScreen.z)/2;_line.renderOrder=object.renderOrder;_line.material=object.material;_renderData.elements.push(_line)}function pushTriangle(a,b,c){var v1=_vertexPool[a];var v2=_vertexPool[b];var v3=_vertexPool[c];if(checkTriangleVisibility(v1,v2,v3)===false){return}if(material.side===THREE.DoubleSide||checkBackfaceCulling(v1,v2,v3)===true){_face=getNextFaceInPool();_face.id=object.id;_face.v1.copy(v1);_face.v2.copy(v2);_face.v3.copy(v3);_face.z=(v1.positionScreen.z+v2.positionScreen.z+v3.positionScreen.z)/3;_face.renderOrder=object.renderOrder;_face.normalModel.fromArray(normals,a*3);_face.normalModel.applyMatrix3(normalMatrix).normalize();for(var i=0;i<3;i++){var normal=_face.vertexNormalsModel[i];normal.fromArray(normals,arguments[i]*3);normal.applyMatrix3(normalMatrix).normalize();var uv=_face.uvs[i];uv.fromArray(uvs,arguments[i]*2)}_face.vertexNormalsLength=3;_face.material=object.material;_renderData.elements.push(_face)}}return{setObject:setObject,projectVertex:projectVertex,checkTriangleVisibility:checkTriangleVisibility,checkBackfaceCulling:checkBackfaceCulling,pushVertex:pushVertex,pushNormal:pushNormal,pushUv:pushUv,pushLine:pushLine,pushTriangle:pushTriangle}};var renderList=new RenderList();this.projectScene=function(scene,camera,sortObjects,sortElements){_faceCount=0;_lineCount=0;_spriteCount=0;_renderData.elements.length=0;if(scene.autoUpdate===true){scene.updateMatrixWorld()}if(camera.parent===null){camera.updateMatrixWorld()}_viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));_viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix,_viewMatrix);_frustum.setFromMatrix(_viewProjectionMatrix);_objectCount=0;_renderData.objects.length=0;_renderData.lights.length=0;function addObject(object){_object=getNextObjectInPool();_object.id=object.id;_object.object=object;_vector3.setFromMatrixPosition(object.matrixWorld);_vector3.applyMatrix4(_viewProjectionMatrix);_object.z=_vector3.z;_object.renderOrder=object.renderOrder;
|
||||
_renderData.objects.push(_object)}scene.traverseVisible(function(object){if(object instanceof THREE.Light){_renderData.lights.push(object)}else{if(object instanceof THREE.Mesh||object instanceof THREE.Line){if(object.material.visible===false){return}if(object.frustumCulled===true&&_frustum.intersectsObject(object)===false){return}addObject(object)}else{if(object instanceof THREE.Sprite){if(object.material.visible===false){return}if(object.frustumCulled===true&&_frustum.intersectsSprite(object)===false){return}addObject(object)}}}});if(sortObjects===true){_renderData.objects.sort(painterSort)}for(var o=0,ol=_renderData.objects.length;o<ol;o++){var object=_renderData.objects[o].object;var geometry=object.geometry;renderList.setObject(object);_modelMatrix=object.matrixWorld;_vertexCount=0;if(object instanceof THREE.Mesh){if(geometry instanceof THREE.BufferGeometry){var attributes=geometry.attributes;var groups=geometry.groups;if(attributes.position===undefined){continue}var positions=attributes.position.array;for(var i=0,l=positions.length;i<l;i+=3){renderList.pushVertex(positions[i],positions[i+1],positions[i+2])}if(attributes.normal!==undefined){var normals=attributes.normal.array;for(var i=0,l=normals.length;i<l;i+=3){renderList.pushNormal(normals[i],normals[i+1],normals[i+2])}}if(attributes.uv!==undefined){var uvs=attributes.uv.array;for(var i=0,l=uvs.length;i<l;i+=2){renderList.pushUv(uvs[i],uvs[i+1])}}if(geometry.index!==null){var indices=geometry.index.array;if(groups.length>0){for(var g=0;g<groups.length;g++){var group=groups[g];for(var i=group.start,l=group.start+group.count;i<l;i+=3){renderList.pushTriangle(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0,l=indices.length;i<l;i+=3){renderList.pushTriangle(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0,l=positions.length/3;i<l;i+=3){renderList.pushTriangle(i,i+1,i+2)}}}else{if(geometry instanceof THREE.Geometry){var vertices=geometry.vertices;var faces=geometry.faces;var faceVertexUvs=geometry.faceVertexUvs[0];
|
||||
_normalMatrix.getNormalMatrix(_modelMatrix);var material=object.material;var isFaceMaterial=material instanceof THREE.MultiMaterial;var objectMaterials=isFaceMaterial===true?object.material:null;for(var v=0,vl=vertices.length;v<vl;v++){var vertex=vertices[v];_vector3.copy(vertex);if(material.morphTargets===true){var morphTargets=geometry.morphTargets;var morphInfluences=object.morphTargetInfluences;for(var t=0,tl=morphTargets.length;t<tl;t++){var influence=morphInfluences[t];if(influence===0){continue}var target=morphTargets[t];var targetVertex=target.vertices[v];_vector3.x+=(targetVertex.x-vertex.x)*influence;_vector3.y+=(targetVertex.y-vertex.y)*influence;_vector3.z+=(targetVertex.z-vertex.z)*influence}}renderList.pushVertex(_vector3.x,_vector3.y,_vector3.z)}for(var f=0,fl=faces.length;f<fl;f++){var face=faces[f];material=isFaceMaterial===true?objectMaterials.materials[face.materialIndex]:object.material;if(material===undefined){continue}var side=material.side;var v1=_vertexPool[face.a];var v2=_vertexPool[face.b];var v3=_vertexPool[face.c];if(renderList.checkTriangleVisibility(v1,v2,v3)===false){continue}var visible=renderList.checkBackfaceCulling(v1,v2,v3);if(side!==THREE.DoubleSide){if(side===THREE.FrontSide&&visible===false){continue}if(side===THREE.BackSide&&visible===true){continue}}_face=getNextFaceInPool();_face.id=object.id;_face.v1.copy(v1);_face.v2.copy(v2);_face.v3.copy(v3);_face.normalModel.copy(face.normal);if(visible===false&&(side===THREE.BackSide||side===THREE.DoubleSide)){_face.normalModel.negate()}_face.normalModel.applyMatrix3(_normalMatrix).normalize();var faceVertexNormals=face.vertexNormals;for(var n=0,nl=Math.min(faceVertexNormals.length,3);n<nl;n++){var normalModel=_face.vertexNormalsModel[n];normalModel.copy(faceVertexNormals[n]);if(visible===false&&(side===THREE.BackSide||side===THREE.DoubleSide)){normalModel.negate()}normalModel.applyMatrix3(_normalMatrix).normalize()}_face.vertexNormalsLength=faceVertexNormals.length;var vertexUvs=faceVertexUvs[f];
|
||||
if(vertexUvs!==undefined){for(var u=0;u<3;u++){_face.uvs[u].copy(vertexUvs[u])}}_face.color=face.color;_face.material=material;_face.z=(v1.positionScreen.z+v2.positionScreen.z+v3.positionScreen.z)/3;_face.renderOrder=object.renderOrder;_renderData.elements.push(_face)}}}}else{if(object instanceof THREE.Line){if(geometry instanceof THREE.BufferGeometry){var attributes=geometry.attributes;if(attributes.position!==undefined){var positions=attributes.position.array;for(var i=0,l=positions.length;i<l;i+=3){renderList.pushVertex(positions[i],positions[i+1],positions[i+2])}if(geometry.index!==null){var indices=geometry.index.array;for(var i=0,l=indices.length;i<l;i+=2){renderList.pushLine(indices[i],indices[i+1])}}else{var step=object instanceof THREE.LineSegments?2:1;for(var i=0,l=(positions.length/3)-1;i<l;i+=step){renderList.pushLine(i,i+1)}}}}else{if(geometry instanceof THREE.Geometry){_modelViewProjectionMatrix.multiplyMatrices(_viewProjectionMatrix,_modelMatrix);var vertices=object.geometry.vertices;if(vertices.length===0){continue}v1=getNextVertexInPool();v1.positionScreen.copy(vertices[0]).applyMatrix4(_modelViewProjectionMatrix);var step=object instanceof THREE.LineSegments?2:1;for(var v=1,vl=vertices.length;v<vl;v++){v1=getNextVertexInPool();v1.positionScreen.copy(vertices[v]).applyMatrix4(_modelViewProjectionMatrix);if((v+1)%step>0){continue}v2=_vertexPool[_vertexCount-2];_clippedVertex1PositionScreen.copy(v1.positionScreen);_clippedVertex2PositionScreen.copy(v2.positionScreen);if(clipLine(_clippedVertex1PositionScreen,_clippedVertex2PositionScreen)===true){_clippedVertex1PositionScreen.multiplyScalar(1/_clippedVertex1PositionScreen.w);_clippedVertex2PositionScreen.multiplyScalar(1/_clippedVertex2PositionScreen.w);_line=getNextLineInPool();_line.id=object.id;_line.v1.positionScreen.copy(_clippedVertex1PositionScreen);_line.v2.positionScreen.copy(_clippedVertex2PositionScreen);_line.z=Math.max(_clippedVertex1PositionScreen.z,_clippedVertex2PositionScreen.z);_line.renderOrder=object.renderOrder;
|
||||
_line.material=object.material;if(object.material.vertexColors===THREE.VertexColors){_line.vertexColors[0].copy(object.geometry.colors[v]);_line.vertexColors[1].copy(object.geometry.colors[v-1])}_renderData.elements.push(_line)}}}}}else{if(object instanceof THREE.Sprite){_vector4.set(_modelMatrix.elements[12],_modelMatrix.elements[13],_modelMatrix.elements[14],1);_vector4.applyMatrix4(_viewProjectionMatrix);var invW=1/_vector4.w;_vector4.z*=invW;if(_vector4.z>=-1&&_vector4.z<=1){_sprite=getNextSpriteInPool();_sprite.id=object.id;_sprite.x=_vector4.x*invW;_sprite.y=_vector4.y*invW;_sprite.z=_vector4.z;_sprite.renderOrder=object.renderOrder;_sprite.object=object;_sprite.rotation=object.rotation;_sprite.scale.x=object.scale.x*Math.abs(_sprite.x-(_vector4.x+camera.projectionMatrix.elements[0])/(_vector4.w+camera.projectionMatrix.elements[12]));_sprite.scale.y=object.scale.y*Math.abs(_sprite.y-(_vector4.y+camera.projectionMatrix.elements[5])/(_vector4.w+camera.projectionMatrix.elements[13]));_sprite.material=object.material;_renderData.elements.push(_sprite)}}}}}if(sortElements===true){_renderData.elements.sort(painterSort)}return _renderData};function getNextObjectInPool(){if(_objectCount===_objectPoolLength){var object=new THREE.RenderableObject();_objectPool.push(object);_objectPoolLength++;_objectCount++;return object}return _objectPool[_objectCount++]}function getNextVertexInPool(){if(_vertexCount===_vertexPoolLength){var vertex=new THREE.RenderableVertex();_vertexPool.push(vertex);_vertexPoolLength++;_vertexCount++;return vertex}return _vertexPool[_vertexCount++]}function getNextFaceInPool(){if(_faceCount===_facePoolLength){var face=new THREE.RenderableFace();_facePool.push(face);_facePoolLength++;_faceCount++;return face}return _facePool[_faceCount++]}function getNextLineInPool(){if(_lineCount===_linePoolLength){var line=new THREE.RenderableLine();_linePool.push(line);_linePoolLength++;_lineCount++;return line}return _linePool[_lineCount++]}function getNextSpriteInPool(){if(_spriteCount===_spritePoolLength){var sprite=new THREE.RenderableSprite();
|
||||
_spritePool.push(sprite);_spritePoolLength++;_spriteCount++;return sprite}return _spritePool[_spriteCount++]}function painterSort(a,b){if(a.renderOrder!==b.renderOrder){return a.renderOrder-b.renderOrder}else{if(a.z!==b.z){return b.z-a.z}else{if(a.id!==b.id){return a.id-b.id}else{return 0}}}}function clipLine(s1,s2){var alpha1=0,alpha2=1,bc1near=s1.z+s1.w,bc2near=s2.z+s2.w,bc1far=-s1.z+s1.w,bc2far=-s2.z+s2.w;if(bc1near>=0&&bc2near>=0&&bc1far>=0&&bc2far>=0){return true}else{if((bc1near<0&&bc2near<0)||(bc1far<0&&bc2far<0)){return false}else{if(bc1near<0){alpha1=Math.max(alpha1,bc1near/(bc1near-bc2near))}else{if(bc2near<0){alpha2=Math.min(alpha2,bc1near/(bc1near-bc2near))}}if(bc1far<0){alpha1=Math.max(alpha1,bc1far/(bc1far-bc2far))}else{if(bc2far<0){alpha2=Math.min(alpha2,bc1far/(bc1far-bc2far))}}if(alpha2<alpha1){return false}else{s1.lerp(s2,alpha1);s2.lerp(s1,1-alpha2);return true}}}}};
|
||||
THREE.SpriteCanvasMaterial=function(parameters){THREE.Material.call(this);this.type="SpriteCanvasMaterial";this.color=new THREE.Color(16777215);this.program=function(context,color){};this.setValues(parameters)};THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteCanvasMaterial.prototype.constructor=THREE.SpriteCanvasMaterial;THREE.SpriteCanvasMaterial.prototype.clone=function(){var material=new THREE.SpriteCanvasMaterial();material.copy(this);material.color.copy(this.color);material.program=this.program;return material};THREE.CanvasRenderer=function(parameters){console.log("THREE.CanvasRenderer",THREE.REVISION);parameters=parameters||{};var _this=this,_renderData,_elements,_lights,_projector=new THREE.Projector(),_canvas=parameters.canvas!==undefined?parameters.canvas:document.createElement("canvas"),_canvasWidth=_canvas.width,_canvasHeight=_canvas.height,_canvasWidthHalf=Math.floor(_canvasWidth/2),_canvasHeightHalf=Math.floor(_canvasHeight/2),_viewportX=0,_viewportY=0,_viewportWidth=_canvasWidth,_viewportHeight=_canvasHeight,_pixelRatio=1,_context=_canvas.getContext("2d",{alpha:parameters.alpha===true}),_clearColor=new THREE.Color(0),_clearAlpha=parameters.alpha===true?0:1,_contextGlobalAlpha=1,_contextGlobalCompositeOperation=0,_contextStrokeStyle=null,_contextFillStyle=null,_contextLineWidth=null,_contextLineCap=null,_contextLineJoin=null,_contextLineDash=[],_camera,_v1,_v2,_v3,_v4,_v5=new THREE.RenderableVertex(),_v6=new THREE.RenderableVertex(),_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_v4x,_v4y,_v5x,_v5y,_v6x,_v6y,_color=new THREE.Color(),_color1=new THREE.Color(),_color2=new THREE.Color(),_color3=new THREE.Color(),_color4=new THREE.Color(),_diffuseColor=new THREE.Color(),_emissiveColor=new THREE.Color(),_lightColor=new THREE.Color(),_patterns={},_image,_uvs,_uv1x,_uv1y,_uv2x,_uv2y,_uv3x,_uv3y,_clipBox=new THREE.Box2(),_clearBox=new THREE.Box2(),_elemBox=new THREE.Box2(),_ambientLight=new THREE.Color(),_directionalLights=new THREE.Color(),_pointLights=new THREE.Color(),_vector3=new THREE.Vector3(),_centroid=new THREE.Vector3(),_normal=new THREE.Vector3(),_normalViewMatrix=new THREE.Matrix3();
|
||||
if(_context.setLineDash===undefined){_context.setLineDash=function(){}}this.domElement=_canvas;this.autoClear=true;this.sortObjects=true;this.sortElements=true;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.getContext=function(){return _context};this.getContextAttributes=function(){return _context.getContextAttributes()};this.getPixelRatio=function(){return _pixelRatio};this.setPixelRatio=function(value){if(value!==undefined){_pixelRatio=value}};this.setSize=function(width,height,updateStyle){_canvasWidth=width*_pixelRatio;_canvasHeight=height*_pixelRatio;_canvas.width=_canvasWidth;_canvas.height=_canvasHeight;_canvasWidthHalf=Math.floor(_canvasWidth/2);_canvasHeightHalf=Math.floor(_canvasHeight/2);if(updateStyle!==false){_canvas.style.width=width+"px";_canvas.style.height=height+"px"}_clipBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clipBox.max.set(_canvasWidthHalf,_canvasHeightHalf);_clearBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clearBox.max.set(_canvasWidthHalf,_canvasHeightHalf);_contextGlobalAlpha=1;_contextGlobalCompositeOperation=0;_contextStrokeStyle=null;_contextFillStyle=null;_contextLineWidth=null;_contextLineCap=null;_contextLineJoin=null;this.setViewport(0,0,width,height)};this.setViewport=function(x,y,width,height){_viewportX=x*_pixelRatio;_viewportY=y*_pixelRatio;_viewportWidth=width*_pixelRatio;_viewportHeight=height*_pixelRatio};this.setScissor=function(){};this.setScissorTest=function(){};this.setClearColor=function(color,alpha){_clearColor.set(color);_clearAlpha=alpha!==undefined?alpha:1;_clearBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clearBox.max.set(_canvasWidthHalf,_canvasHeightHalf)};this.setClearColorHex=function(hex,alpha){console.warn("THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(hex,alpha)};this.getClearColor=function(){return _clearColor};this.getClearAlpha=function(){return _clearAlpha
|
||||
};this.getMaxAnisotropy=function(){return 0};this.clear=function(){if(_clearBox.isEmpty()===false){_clearBox.intersect(_clipBox);_clearBox.expandByScalar(2);_clearBox.min.x=_clearBox.min.x+_canvasWidthHalf;_clearBox.min.y=-_clearBox.min.y+_canvasHeightHalf;_clearBox.max.x=_clearBox.max.x+_canvasWidthHalf;_clearBox.max.y=-_clearBox.max.y+_canvasHeightHalf;if(_clearAlpha<1){_context.clearRect(_clearBox.min.x|0,_clearBox.max.y|0,(_clearBox.max.x-_clearBox.min.x)|0,(_clearBox.min.y-_clearBox.max.y)|0)}if(_clearAlpha>0){setBlending(THREE.NormalBlending);setOpacity(1);setFillStyle("rgba("+Math.floor(_clearColor.r*255)+","+Math.floor(_clearColor.g*255)+","+Math.floor(_clearColor.b*255)+","+_clearAlpha+")");_context.fillRect(_clearBox.min.x|0,_clearBox.max.y|0,(_clearBox.max.x-_clearBox.min.x)|0,(_clearBox.min.y-_clearBox.max.y)|0)}_clearBox.makeEmpty()}};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(scene,camera){if(camera instanceof THREE.Camera===false){console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");return}var background=scene.background;if(background&&background.isColor){setFillStyle("rgb("+Math.floor(background.r*255)+","+Math.floor(background.g*255)+","+Math.floor(background.b*255)+")");_context.fillRect(0,0,_canvasWidth,_canvasHeight)}else{if(this.autoClear===true){this.clear()}}_this.info.render.vertices=0;_this.info.render.faces=0;_context.setTransform(_viewportWidth/_canvasWidth,0,0,-_viewportHeight/_canvasHeight,_viewportX,_canvasHeight-_viewportY);_context.translate(_canvasWidthHalf,_canvasHeightHalf);_renderData=_projector.projectScene(scene,camera,this.sortObjects,this.sortElements);_elements=_renderData.elements;_lights=_renderData.lights;_camera=camera;_normalViewMatrix.getNormalMatrix(camera.matrixWorldInverse);calculateLights();for(var e=0,el=_elements.length;e<el;e++){var element=_elements[e];var material=element.material;if(material===undefined||material.opacity===0){continue
|
||||
}_elemBox.makeEmpty();if(element instanceof THREE.RenderableSprite){_v1=element;_v1.x*=_canvasWidthHalf;_v1.y*=_canvasHeightHalf;renderSprite(_v1,element,material)}else{if(element instanceof THREE.RenderableLine){_v1=element.v1;_v2=element.v2;_v1.positionScreen.x*=_canvasWidthHalf;_v1.positionScreen.y*=_canvasHeightHalf;_v2.positionScreen.x*=_canvasWidthHalf;_v2.positionScreen.y*=_canvasHeightHalf;_elemBox.setFromPoints([_v1.positionScreen,_v2.positionScreen]);if(_clipBox.intersectsBox(_elemBox)===true){renderLine(_v1,_v2,element,material)}}else{if(element instanceof THREE.RenderableFace){_v1=element.v1;_v2=element.v2;_v3=element.v3;if(_v1.positionScreen.z<-1||_v1.positionScreen.z>1){continue}if(_v2.positionScreen.z<-1||_v2.positionScreen.z>1){continue}if(_v3.positionScreen.z<-1||_v3.positionScreen.z>1){continue}_v1.positionScreen.x*=_canvasWidthHalf;_v1.positionScreen.y*=_canvasHeightHalf;_v2.positionScreen.x*=_canvasWidthHalf;_v2.positionScreen.y*=_canvasHeightHalf;_v3.positionScreen.x*=_canvasWidthHalf;_v3.positionScreen.y*=_canvasHeightHalf;if(material.overdraw>0){expand(_v1.positionScreen,_v2.positionScreen,material.overdraw);expand(_v2.positionScreen,_v3.positionScreen,material.overdraw);expand(_v3.positionScreen,_v1.positionScreen,material.overdraw)}_elemBox.setFromPoints([_v1.positionScreen,_v2.positionScreen,_v3.positionScreen]);if(_clipBox.intersectsBox(_elemBox)===true){renderFace3(_v1,_v2,_v3,0,1,2,element,material)}}}}_clearBox.union(_elemBox)}_context.setTransform(1,0,0,1,0,0)};function calculateLights(){_ambientLight.setRGB(0,0,0);_directionalLights.setRGB(0,0,0);_pointLights.setRGB(0,0,0);for(var l=0,ll=_lights.length;l<ll;l++){var light=_lights[l];var lightColor=light.color;if(light instanceof THREE.AmbientLight){_ambientLight.add(lightColor)}else{if(light instanceof THREE.DirectionalLight){_directionalLights.add(lightColor)}else{if(light instanceof THREE.PointLight){_pointLights.add(lightColor)}}}}}function calculateLight(position,normal,color){for(var l=0,ll=_lights.length;
|
||||
l<ll;l++){var light=_lights[l];_lightColor.copy(light.color);if(light instanceof THREE.DirectionalLight){var lightPosition=_vector3.setFromMatrixPosition(light.matrixWorld).normalize();var amount=normal.dot(lightPosition);if(amount<=0){continue}amount*=light.intensity;color.add(_lightColor.multiplyScalar(amount))}else{if(light instanceof THREE.PointLight){var lightPosition=_vector3.setFromMatrixPosition(light.matrixWorld);var amount=normal.dot(_vector3.subVectors(lightPosition,position).normalize());if(amount<=0){continue}amount*=light.distance==0?1:1-Math.min(position.distanceTo(lightPosition)/light.distance,1);if(amount==0){continue}amount*=light.intensity;color.add(_lightColor.multiplyScalar(amount))}}}}function renderSprite(v1,element,material){setOpacity(material.opacity);setBlending(material.blending);var scaleX=element.scale.x*_canvasWidthHalf;var scaleY=element.scale.y*_canvasHeightHalf;var dist=0.5*Math.sqrt(scaleX*scaleX+scaleY*scaleY);_elemBox.min.set(v1.x-dist,v1.y-dist);_elemBox.max.set(v1.x+dist,v1.y+dist);if(material instanceof THREE.SpriteMaterial){var texture=material.map;if(texture!==null){var pattern=_patterns[texture.id];if(pattern===undefined||pattern.version!==texture.version){pattern=textureToPattern(texture);_patterns[texture.id]=pattern}if(pattern.canvas!==undefined){setFillStyle(pattern.canvas);var bitmap=texture.image;var ox=bitmap.width*texture.offset.x;var oy=bitmap.height*texture.offset.y;var sx=bitmap.width*texture.repeat.x;var sy=bitmap.height*texture.repeat.y;var cx=scaleX/sx;var cy=scaleY/sy;_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.translate(-scaleX/2,-scaleY/2);_context.scale(cx,cy);_context.translate(-ox,-oy);_context.fillRect(ox,oy,sx,sy);_context.restore()}}else{setFillStyle(material.color.getStyle());_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.scale(scaleX,-scaleY);_context.fillRect(-0.5,-0.5,1,1);
|
||||
_context.restore()}}else{if(material instanceof THREE.SpriteCanvasMaterial){setStrokeStyle(material.color.getStyle());setFillStyle(material.color.getStyle());_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.scale(scaleX,scaleY);material.program(_context);_context.restore()}}}function renderLine(v1,v2,element,material){setOpacity(material.opacity);setBlending(material.blending);_context.beginPath();_context.moveTo(v1.positionScreen.x,v1.positionScreen.y);_context.lineTo(v2.positionScreen.x,v2.positionScreen.y);if(material instanceof THREE.LineBasicMaterial){setLineWidth(material.linewidth);setLineCap(material.linecap);setLineJoin(material.linejoin);if(material.vertexColors!==THREE.VertexColors){setStrokeStyle(material.color.getStyle())}else{var colorStyle1=element.vertexColors[0].getStyle();var colorStyle2=element.vertexColors[1].getStyle();if(colorStyle1===colorStyle2){setStrokeStyle(colorStyle1)}else{try{var grad=_context.createLinearGradient(v1.positionScreen.x,v1.positionScreen.y,v2.positionScreen.x,v2.positionScreen.y);grad.addColorStop(0,colorStyle1);grad.addColorStop(1,colorStyle2)}catch(exception){grad=colorStyle1}setStrokeStyle(grad)}}_context.stroke();_elemBox.expandByScalar(material.linewidth*2)}else{if(material instanceof THREE.LineDashedMaterial){setLineWidth(material.linewidth);setLineCap(material.linecap);setLineJoin(material.linejoin);setStrokeStyle(material.color.getStyle());setLineDash([material.dashSize,material.gapSize]);_context.stroke();_elemBox.expandByScalar(material.linewidth*2);setLineDash([])}}}function renderFace3(v1,v2,v3,uv1,uv2,uv3,element,material){_this.info.render.vertices+=3;_this.info.render.faces++;setOpacity(material.opacity);setBlending(material.blending);_v1x=v1.positionScreen.x;_v1y=v1.positionScreen.y;_v2x=v2.positionScreen.x;_v2y=v2.positionScreen.y;_v3x=v3.positionScreen.x;_v3y=v3.positionScreen.y;drawTriangle(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y);if((material instanceof THREE.MeshLambertMaterial||material instanceof THREE.MeshPhongMaterial)&&material.map===null){_diffuseColor.copy(material.color);
|
||||
_emissiveColor.copy(material.emissive);if(material.vertexColors===THREE.FaceColors){_diffuseColor.multiply(element.color)}_color.copy(_ambientLight);_centroid.copy(v1.positionWorld).add(v2.positionWorld).add(v3.positionWorld).divideScalar(3);calculateLight(_centroid,element.normalModel,_color);_color.multiply(_diffuseColor).add(_emissiveColor);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}else{if(material instanceof THREE.MeshBasicMaterial||material instanceof THREE.MeshLambertMaterial||material instanceof THREE.MeshPhongMaterial){if(material.map!==null){var mapping=material.map.mapping;if(mapping===THREE.UVMapping){_uvs=element.uvs;patternPath(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_uvs[uv1].x,_uvs[uv1].y,_uvs[uv2].x,_uvs[uv2].y,_uvs[uv3].x,_uvs[uv3].y,material.map)}}else{if(material.envMap!==null){if(material.envMap.mapping===THREE.SphericalReflectionMapping){_normal.copy(element.vertexNormalsModel[uv1]).applyMatrix3(_normalViewMatrix);_uv1x=0.5*_normal.x+0.5;_uv1y=0.5*_normal.y+0.5;_normal.copy(element.vertexNormalsModel[uv2]).applyMatrix3(_normalViewMatrix);_uv2x=0.5*_normal.x+0.5;_uv2y=0.5*_normal.y+0.5;_normal.copy(element.vertexNormalsModel[uv3]).applyMatrix3(_normalViewMatrix);_uv3x=0.5*_normal.x+0.5;_uv3y=0.5*_normal.y+0.5;patternPath(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_uv1x,_uv1y,_uv2x,_uv2y,_uv3x,_uv3y,material.envMap)}}else{_color.copy(material.color);if(material.vertexColors===THREE.FaceColors){_color.multiply(element.color)}material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}}}else{if(material instanceof THREE.MeshNormalMaterial){_normal.copy(element.normalModel).applyMatrix3(_normalViewMatrix);_color.setRGB(_normal.x,_normal.y,_normal.z).multiplyScalar(0.5).addScalar(0.5);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)
|
||||
}else{_color.setRGB(1,1,1);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}}}}function drawTriangle(x0,y0,x1,y1,x2,y2){_context.beginPath();_context.moveTo(x0,y0);_context.lineTo(x1,y1);_context.lineTo(x2,y2);_context.closePath()}function strokePath(color,linewidth,linecap,linejoin){setLineWidth(linewidth);setLineCap(linecap);setLineJoin(linejoin);setStrokeStyle(color.getStyle());_context.stroke();_elemBox.expandByScalar(linewidth*2)}function fillPath(color){setFillStyle(color.getStyle());_context.fill()}function textureToPattern(texture){if(texture.version===0||texture instanceof THREE.CompressedTexture||texture instanceof THREE.DataTexture){return{canvas:undefined,version:texture.version}}var image=texture.image;if(image.complete===false){return{canvas:undefined,version:0}}var repeatX=texture.wrapS===THREE.RepeatWrapping||texture.wrapS===THREE.MirroredRepeatWrapping;var repeatY=texture.wrapT===THREE.RepeatWrapping||texture.wrapT===THREE.MirroredRepeatWrapping;var mirrorX=texture.wrapS===THREE.MirroredRepeatWrapping;var mirrorY=texture.wrapT===THREE.MirroredRepeatWrapping;var canvas=document.createElement("canvas");canvas.width=image.width*(mirrorX?2:1);canvas.height=image.height*(mirrorY?2:1);var context=canvas.getContext("2d");context.setTransform(1,0,0,-1,0,image.height);context.drawImage(image,0,0);if(mirrorX===true){context.setTransform(-1,0,0,-1,image.width,image.height);context.drawImage(image,-image.width,0)}if(mirrorY===true){context.setTransform(1,0,0,1,0,0);context.drawImage(image,0,image.height)}if(mirrorX===true&&mirrorY===true){context.setTransform(-1,0,0,1,image.width,0);context.drawImage(image,-image.width,image.height)}var repeat="no-repeat";if(repeatX===true&&repeatY===true){repeat="repeat"}else{if(repeatX===true){repeat="repeat-x"}else{if(repeatY===true){repeat="repeat-y"}}}var pattern=_context.createPattern(canvas,repeat);if(texture.onUpdate){texture.onUpdate(texture)
|
||||
}return{canvas:pattern,version:texture.version}}function patternPath(x0,y0,x1,y1,x2,y2,u0,v0,u1,v1,u2,v2,texture){var pattern=_patterns[texture.id];if(pattern===undefined||pattern.version!==texture.version){pattern=textureToPattern(texture);_patterns[texture.id]=pattern}if(pattern.canvas!==undefined){setFillStyle(pattern.canvas)}else{setFillStyle("rgba( 0, 0, 0, 1)");_context.fill();return}var a,b,c,d,e,f,det,idet,offsetX=texture.offset.x/texture.repeat.x,offsetY=texture.offset.y/texture.repeat.y,width=texture.image.width*texture.repeat.x,height=texture.image.height*texture.repeat.y;u0=(u0+offsetX)*width;v0=(v0+offsetY)*height;u1=(u1+offsetX)*width;v1=(v1+offsetY)*height;u2=(u2+offsetX)*width;v2=(v2+offsetY)*height;x1-=x0;y1-=y0;x2-=x0;y2-=y0;u1-=u0;v1-=v0;u2-=u0;v2-=v0;det=u1*v2-u2*v1;if(det===0){return}idet=1/det;a=(v2*x1-v1*x2)*idet;b=(v2*y1-v1*y2)*idet;c=(u1*x2-u2*x1)*idet;d=(u1*y2-u2*y1)*idet;e=x0-a*u0-c*v0;f=y0-b*u0-d*v0;_context.save();_context.transform(a,b,c,d,e,f);_context.fill();_context.restore()}function clipImage(x0,y0,x1,y1,x2,y2,u0,v0,u1,v1,u2,v2,image){var a,b,c,d,e,f,det,idet,width=image.width-1,height=image.height-1;u0*=width;v0*=height;u1*=width;v1*=height;u2*=width;v2*=height;x1-=x0;y1-=y0;x2-=x0;y2-=y0;u1-=u0;v1-=v0;u2-=u0;v2-=v0;det=u1*v2-u2*v1;idet=1/det;a=(v2*x1-v1*x2)*idet;b=(v2*y1-v1*y2)*idet;c=(u1*x2-u2*x1)*idet;d=(u1*y2-u2*y1)*idet;e=x0-a*u0-c*v0;f=y0-b*u0-d*v0;_context.save();_context.transform(a,b,c,d,e,f);_context.clip();_context.drawImage(image,0,0);_context.restore()}function expand(v1,v2,pixels){var x=v2.x-v1.x,y=v2.y-v1.y,det=x*x+y*y,idet;if(det===0){return}idet=pixels/Math.sqrt(det);x*=idet;y*=idet;v2.x+=x;v2.y+=y;v1.x-=x;v1.y-=y}function setOpacity(value){if(_contextGlobalAlpha!==value){_context.globalAlpha=value;_contextGlobalAlpha=value}}function setBlending(value){if(_contextGlobalCompositeOperation!==value){if(value===THREE.NormalBlending){_context.globalCompositeOperation="source-over"}else{if(value===THREE.AdditiveBlending){_context.globalCompositeOperation="lighter"
|
||||
}else{if(value===THREE.SubtractiveBlending){_context.globalCompositeOperation="darker"}else{if(value===THREE.MultiplyBlending){_context.globalCompositeOperation="multiply"}}}}_contextGlobalCompositeOperation=value}}function setLineWidth(value){if(_contextLineWidth!==value){_context.lineWidth=value;_contextLineWidth=value}}function setLineCap(value){if(_contextLineCap!==value){_context.lineCap=value;_contextLineCap=value}}function setLineJoin(value){if(_contextLineJoin!==value){_context.lineJoin=value;_contextLineJoin=value}}function setStrokeStyle(value){if(_contextStrokeStyle!==value){_context.strokeStyle=value;_contextStrokeStyle=value}}function setFillStyle(value){if(_contextFillStyle!==value){_context.fillStyle=value;_contextFillStyle=value}}function setLineDash(value){if(_contextLineDash.length!==value.length){_context.setLineDash(value);_contextLineDash=value}}};
|
20
themes/next/source/lib/three/canvas_sphere.min.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
$(function(){var SCREEN_WIDTH=window.innerWidth,SCREEN_HEIGHT=window.innerHeight,mouseX=0,mouseY=0,windowHalfX=window.innerWidth/2,windowHalfY=window.innerHeight/2,SEPARATION=200,AMOUNTX=10,AMOUNTY=10,camera,scene,renderer;init();animate();function init(){var container,separation=100,amountX=50,amountY=50,particles,particle;container=document.createElement("div");container.style.position="fixed";container.style.top="0px";container.style.left="0px";container.style.zIndex="-1";container.style.opacity="0.5";document.body.appendChild(container);camera=new THREE.PerspectiveCamera(75,SCREEN_WIDTH/SCREEN_HEIGHT,1,10000);camera.position.z=1000;scene=new THREE.Scene();renderer=new THREE.CanvasRenderer();renderer.setClearColor(16119801,0);renderer.setPixelRatio(window.devicePixelRatio);renderer.setSize(SCREEN_WIDTH,SCREEN_HEIGHT);container.appendChild(renderer.domElement);var PI2=Math.PI*2;var material=new THREE.SpriteCanvasMaterial({color:10263708,program:function(context){context.beginPath();context.arc(0,0,0.5,0,PI2,true);context.fill()}});for(var i=0;i<1000;i++){particle=new THREE.Sprite(material);particle.position.x=Math.random()*2-1;particle.position.y=Math.random()*2-1;particle.position.z=Math.random()*2-1;particle.position.normalize();particle.position.multiplyScalar(Math.random()*10+450);particle.scale.multiplyScalar(2);scene.add(particle)}for(var i=0;i<300;i++){var geometry=new THREE.Geometry();var vertex=new THREE.Vector3(Math.random()*2-1,Math.random()*2-1,Math.random()*2-1);vertex.normalize();vertex.multiplyScalar(450);geometry.vertices.push(vertex);var vertex2=vertex.clone();vertex2.multiplyScalar(Math.random()*0.3+1);geometry.vertices.push(vertex2);var line=new THREE.Line(geometry,new THREE.LineBasicMaterial({color:10263708,opacity:Math.random()}));scene.add(line)}document.addEventListener("mousemove",onDocumentMouseMove,false);document.addEventListener("touchstart",onDocumentTouchStart,false);document.addEventListener("touchmove",onDocumentTouchMove,false);window.addEventListener("resize",onWindowResize,false)
|
||||
}function onWindowResize(){windowHalfX=window.innerWidth/2;windowHalfY=window.innerHeight/2;camera.aspect=window.innerWidth/window.innerHeight;camera.updateProjectionMatrix();renderer.setSize(window.innerWidth,window.innerHeight)}function onDocumentMouseMove(event){mouseX=event.clientX-windowHalfX;mouseY=event.clientY-windowHalfY}function onDocumentTouchStart(event){if(event.touches.length>1){mouseX=event.touches[0].pageX-windowHalfX}}function onDocumentTouchMove(event){if(event.touches.length==1){mouseX=event.touches[0].pageX-windowHalfX}}function animate(){requestAnimationFrame(animate);render()}function render(){camera.position.x+=(mouseX-camera.position.x)*0.05;camera.position.y+=(-mouseY+200-camera.position.y)*0.05;camera.lookAt(scene.position);renderer.render(scene,camera)}});
|
||||
THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0;this.renderOrder=0};THREE.RenderableFace=function(){this.id=0;this.v1=new THREE.RenderableVertex();this.v2=new THREE.RenderableVertex();this.v3=new THREE.RenderableVertex();this.normalModel=new THREE.Vector3();this.vertexNormalsModel=[new THREE.Vector3(),new THREE.Vector3(),new THREE.Vector3()];this.vertexNormalsLength=0;this.color=new THREE.Color();this.material=null;this.uvs=[new THREE.Vector2(),new THREE.Vector2(),new THREE.Vector2()];this.z=0;this.renderOrder=0};THREE.RenderableVertex=function(){this.position=new THREE.Vector3();this.positionWorld=new THREE.Vector3();this.positionScreen=new THREE.Vector4();this.visible=true};THREE.RenderableVertex.prototype.copy=function(vertex){this.positionWorld.copy(vertex.positionWorld);this.positionScreen.copy(vertex.positionScreen)};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex();this.v2=new THREE.RenderableVertex();this.vertexColors=[new THREE.Color(),new THREE.Color()];this.material=null;this.z=0;this.renderOrder=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.x=0;this.y=0;this.z=0;this.rotation=0;this.scale=new THREE.Vector2();this.material=null;this.renderOrder=0};THREE.Projector=function(){var _object,_objectCount,_objectPool=[],_objectPoolLength=0,_vertex,_vertexCount,_vertexPool=[],_vertexPoolLength=0,_face,_faceCount,_facePool=[],_facePoolLength=0,_line,_lineCount,_linePool=[],_linePoolLength=0,_sprite,_spriteCount,_spritePool=[],_spritePoolLength=0,_renderData={objects:[],lights:[],elements:[]},_vector3=new THREE.Vector3(),_vector4=new THREE.Vector4(),_clipBox=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),_boundingBox=new THREE.Box3(),_points3=new Array(3),_points4=new Array(4),_viewMatrix=new THREE.Matrix4(),_viewProjectionMatrix=new THREE.Matrix4(),_modelMatrix,_modelViewProjectionMatrix=new THREE.Matrix4(),_normalMatrix=new THREE.Matrix3(),_frustum=new THREE.Frustum(),_clippedVertex1PositionScreen=new THREE.Vector4(),_clippedVertex2PositionScreen=new THREE.Vector4();
|
||||
this.projectVector=function(vector,camera){console.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")};var RenderList=function(){var normals=[];var uvs=[];var object=null;var material=null;var normalMatrix=new THREE.Matrix3();function setObject(value){object=value;material=object.material;normalMatrix.getNormalMatrix(object.matrixWorld);normals.length=0;uvs.length=0}function projectVertex(vertex){var position=vertex.position;var positionWorld=vertex.positionWorld;var positionScreen=vertex.positionScreen;positionWorld.copy(position).applyMatrix4(_modelMatrix);positionScreen.copy(positionWorld).applyMatrix4(_viewProjectionMatrix);var invW=1/positionScreen.w;positionScreen.x*=invW;positionScreen.y*=invW;positionScreen.z*=invW;vertex.visible=positionScreen.x>=-1&&positionScreen.x<=1&&positionScreen.y>=-1&&positionScreen.y<=1&&positionScreen.z>=-1&&positionScreen.z<=1}function pushVertex(x,y,z){_vertex=getNextVertexInPool();_vertex.position.set(x,y,z);projectVertex(_vertex)}function pushNormal(x,y,z){normals.push(x,y,z)}function pushUv(x,y){uvs.push(x,y)}function checkTriangleVisibility(v1,v2,v3){if(v1.visible===true||v2.visible===true||v3.visible===true){return true}_points3[0]=v1.positionScreen;_points3[1]=v2.positionScreen;_points3[2]=v3.positionScreen;return _clipBox.intersectsBox(_boundingBox.setFromPoints(_points3))}function checkBackfaceCulling(v1,v2,v3){return((v3.positionScreen.x-v1.positionScreen.x)*(v2.positionScreen.y-v1.positionScreen.y)-(v3.positionScreen.y-v1.positionScreen.y)*(v2.positionScreen.x-v1.positionScreen.x))<0}function pushLine(a,b){var v1=_vertexPool[a];var v2=_vertexPool[b];_line=getNextLineInPool();_line.id=object.id;_line.v1.copy(v1);_line.v2.copy(v2);
|
||||
_line.z=(v1.positionScreen.z+v2.positionScreen.z)/2;_line.renderOrder=object.renderOrder;_line.material=object.material;_renderData.elements.push(_line)}function pushTriangle(a,b,c){var v1=_vertexPool[a];var v2=_vertexPool[b];var v3=_vertexPool[c];if(checkTriangleVisibility(v1,v2,v3)===false){return}if(material.side===THREE.DoubleSide||checkBackfaceCulling(v1,v2,v3)===true){_face=getNextFaceInPool();_face.id=object.id;_face.v1.copy(v1);_face.v2.copy(v2);_face.v3.copy(v3);_face.z=(v1.positionScreen.z+v2.positionScreen.z+v3.positionScreen.z)/3;_face.renderOrder=object.renderOrder;_face.normalModel.fromArray(normals,a*3);_face.normalModel.applyMatrix3(normalMatrix).normalize();for(var i=0;i<3;i++){var normal=_face.vertexNormalsModel[i];normal.fromArray(normals,arguments[i]*3);normal.applyMatrix3(normalMatrix).normalize();var uv=_face.uvs[i];uv.fromArray(uvs,arguments[i]*2)}_face.vertexNormalsLength=3;_face.material=object.material;_renderData.elements.push(_face)}}return{setObject:setObject,projectVertex:projectVertex,checkTriangleVisibility:checkTriangleVisibility,checkBackfaceCulling:checkBackfaceCulling,pushVertex:pushVertex,pushNormal:pushNormal,pushUv:pushUv,pushLine:pushLine,pushTriangle:pushTriangle}};var renderList=new RenderList();this.projectScene=function(scene,camera,sortObjects,sortElements){_faceCount=0;_lineCount=0;_spriteCount=0;_renderData.elements.length=0;if(scene.autoUpdate===true){scene.updateMatrixWorld()}if(camera.parent===null){camera.updateMatrixWorld()}_viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));_viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix,_viewMatrix);_frustum.setFromMatrix(_viewProjectionMatrix);_objectCount=0;_renderData.objects.length=0;_renderData.lights.length=0;function addObject(object){_object=getNextObjectInPool();_object.id=object.id;_object.object=object;_vector3.setFromMatrixPosition(object.matrixWorld);_vector3.applyMatrix4(_viewProjectionMatrix);_object.z=_vector3.z;_object.renderOrder=object.renderOrder;
|
||||
_renderData.objects.push(_object)}scene.traverseVisible(function(object){if(object instanceof THREE.Light){_renderData.lights.push(object)}else{if(object instanceof THREE.Mesh||object instanceof THREE.Line){if(object.material.visible===false){return}if(object.frustumCulled===true&&_frustum.intersectsObject(object)===false){return}addObject(object)}else{if(object instanceof THREE.Sprite){if(object.material.visible===false){return}if(object.frustumCulled===true&&_frustum.intersectsSprite(object)===false){return}addObject(object)}}}});if(sortObjects===true){_renderData.objects.sort(painterSort)}for(var o=0,ol=_renderData.objects.length;o<ol;o++){var object=_renderData.objects[o].object;var geometry=object.geometry;renderList.setObject(object);_modelMatrix=object.matrixWorld;_vertexCount=0;if(object instanceof THREE.Mesh){if(geometry instanceof THREE.BufferGeometry){var attributes=geometry.attributes;var groups=geometry.groups;if(attributes.position===undefined){continue}var positions=attributes.position.array;for(var i=0,l=positions.length;i<l;i+=3){renderList.pushVertex(positions[i],positions[i+1],positions[i+2])}if(attributes.normal!==undefined){var normals=attributes.normal.array;for(var i=0,l=normals.length;i<l;i+=3){renderList.pushNormal(normals[i],normals[i+1],normals[i+2])}}if(attributes.uv!==undefined){var uvs=attributes.uv.array;for(var i=0,l=uvs.length;i<l;i+=2){renderList.pushUv(uvs[i],uvs[i+1])}}if(geometry.index!==null){var indices=geometry.index.array;if(groups.length>0){for(var g=0;g<groups.length;g++){var group=groups[g];for(var i=group.start,l=group.start+group.count;i<l;i+=3){renderList.pushTriangle(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0,l=indices.length;i<l;i+=3){renderList.pushTriangle(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0,l=positions.length/3;i<l;i+=3){renderList.pushTriangle(i,i+1,i+2)}}}else{if(geometry instanceof THREE.Geometry){var vertices=geometry.vertices;var faces=geometry.faces;var faceVertexUvs=geometry.faceVertexUvs[0];
|
||||
_normalMatrix.getNormalMatrix(_modelMatrix);var material=object.material;var isFaceMaterial=material instanceof THREE.MultiMaterial;var objectMaterials=isFaceMaterial===true?object.material:null;for(var v=0,vl=vertices.length;v<vl;v++){var vertex=vertices[v];_vector3.copy(vertex);if(material.morphTargets===true){var morphTargets=geometry.morphTargets;var morphInfluences=object.morphTargetInfluences;for(var t=0,tl=morphTargets.length;t<tl;t++){var influence=morphInfluences[t];if(influence===0){continue}var target=morphTargets[t];var targetVertex=target.vertices[v];_vector3.x+=(targetVertex.x-vertex.x)*influence;_vector3.y+=(targetVertex.y-vertex.y)*influence;_vector3.z+=(targetVertex.z-vertex.z)*influence}}renderList.pushVertex(_vector3.x,_vector3.y,_vector3.z)}for(var f=0,fl=faces.length;f<fl;f++){var face=faces[f];material=isFaceMaterial===true?objectMaterials.materials[face.materialIndex]:object.material;if(material===undefined){continue}var side=material.side;var v1=_vertexPool[face.a];var v2=_vertexPool[face.b];var v3=_vertexPool[face.c];if(renderList.checkTriangleVisibility(v1,v2,v3)===false){continue}var visible=renderList.checkBackfaceCulling(v1,v2,v3);if(side!==THREE.DoubleSide){if(side===THREE.FrontSide&&visible===false){continue}if(side===THREE.BackSide&&visible===true){continue}}_face=getNextFaceInPool();_face.id=object.id;_face.v1.copy(v1);_face.v2.copy(v2);_face.v3.copy(v3);_face.normalModel.copy(face.normal);if(visible===false&&(side===THREE.BackSide||side===THREE.DoubleSide)){_face.normalModel.negate()}_face.normalModel.applyMatrix3(_normalMatrix).normalize();var faceVertexNormals=face.vertexNormals;for(var n=0,nl=Math.min(faceVertexNormals.length,3);n<nl;n++){var normalModel=_face.vertexNormalsModel[n];normalModel.copy(faceVertexNormals[n]);if(visible===false&&(side===THREE.BackSide||side===THREE.DoubleSide)){normalModel.negate()}normalModel.applyMatrix3(_normalMatrix).normalize()}_face.vertexNormalsLength=faceVertexNormals.length;var vertexUvs=faceVertexUvs[f];
|
||||
if(vertexUvs!==undefined){for(var u=0;u<3;u++){_face.uvs[u].copy(vertexUvs[u])}}_face.color=face.color;_face.material=material;_face.z=(v1.positionScreen.z+v2.positionScreen.z+v3.positionScreen.z)/3;_face.renderOrder=object.renderOrder;_renderData.elements.push(_face)}}}}else{if(object instanceof THREE.Line){if(geometry instanceof THREE.BufferGeometry){var attributes=geometry.attributes;if(attributes.position!==undefined){var positions=attributes.position.array;for(var i=0,l=positions.length;i<l;i+=3){renderList.pushVertex(positions[i],positions[i+1],positions[i+2])}if(geometry.index!==null){var indices=geometry.index.array;for(var i=0,l=indices.length;i<l;i+=2){renderList.pushLine(indices[i],indices[i+1])}}else{var step=object instanceof THREE.LineSegments?2:1;for(var i=0,l=(positions.length/3)-1;i<l;i+=step){renderList.pushLine(i,i+1)}}}}else{if(geometry instanceof THREE.Geometry){_modelViewProjectionMatrix.multiplyMatrices(_viewProjectionMatrix,_modelMatrix);var vertices=object.geometry.vertices;if(vertices.length===0){continue}v1=getNextVertexInPool();v1.positionScreen.copy(vertices[0]).applyMatrix4(_modelViewProjectionMatrix);var step=object instanceof THREE.LineSegments?2:1;for(var v=1,vl=vertices.length;v<vl;v++){v1=getNextVertexInPool();v1.positionScreen.copy(vertices[v]).applyMatrix4(_modelViewProjectionMatrix);if((v+1)%step>0){continue}v2=_vertexPool[_vertexCount-2];_clippedVertex1PositionScreen.copy(v1.positionScreen);_clippedVertex2PositionScreen.copy(v2.positionScreen);if(clipLine(_clippedVertex1PositionScreen,_clippedVertex2PositionScreen)===true){_clippedVertex1PositionScreen.multiplyScalar(1/_clippedVertex1PositionScreen.w);_clippedVertex2PositionScreen.multiplyScalar(1/_clippedVertex2PositionScreen.w);_line=getNextLineInPool();_line.id=object.id;_line.v1.positionScreen.copy(_clippedVertex1PositionScreen);_line.v2.positionScreen.copy(_clippedVertex2PositionScreen);_line.z=Math.max(_clippedVertex1PositionScreen.z,_clippedVertex2PositionScreen.z);_line.renderOrder=object.renderOrder;
|
||||
_line.material=object.material;if(object.material.vertexColors===THREE.VertexColors){_line.vertexColors[0].copy(object.geometry.colors[v]);_line.vertexColors[1].copy(object.geometry.colors[v-1])}_renderData.elements.push(_line)}}}}}else{if(object instanceof THREE.Sprite){_vector4.set(_modelMatrix.elements[12],_modelMatrix.elements[13],_modelMatrix.elements[14],1);_vector4.applyMatrix4(_viewProjectionMatrix);var invW=1/_vector4.w;_vector4.z*=invW;if(_vector4.z>=-1&&_vector4.z<=1){_sprite=getNextSpriteInPool();_sprite.id=object.id;_sprite.x=_vector4.x*invW;_sprite.y=_vector4.y*invW;_sprite.z=_vector4.z;_sprite.renderOrder=object.renderOrder;_sprite.object=object;_sprite.rotation=object.rotation;_sprite.scale.x=object.scale.x*Math.abs(_sprite.x-(_vector4.x+camera.projectionMatrix.elements[0])/(_vector4.w+camera.projectionMatrix.elements[12]));_sprite.scale.y=object.scale.y*Math.abs(_sprite.y-(_vector4.y+camera.projectionMatrix.elements[5])/(_vector4.w+camera.projectionMatrix.elements[13]));_sprite.material=object.material;_renderData.elements.push(_sprite)}}}}}if(sortElements===true){_renderData.elements.sort(painterSort)}return _renderData};function getNextObjectInPool(){if(_objectCount===_objectPoolLength){var object=new THREE.RenderableObject();_objectPool.push(object);_objectPoolLength++;_objectCount++;return object}return _objectPool[_objectCount++]}function getNextVertexInPool(){if(_vertexCount===_vertexPoolLength){var vertex=new THREE.RenderableVertex();_vertexPool.push(vertex);_vertexPoolLength++;_vertexCount++;return vertex}return _vertexPool[_vertexCount++]}function getNextFaceInPool(){if(_faceCount===_facePoolLength){var face=new THREE.RenderableFace();_facePool.push(face);_facePoolLength++;_faceCount++;return face}return _facePool[_faceCount++]}function getNextLineInPool(){if(_lineCount===_linePoolLength){var line=new THREE.RenderableLine();_linePool.push(line);_linePoolLength++;_lineCount++;return line}return _linePool[_lineCount++]}function getNextSpriteInPool(){if(_spriteCount===_spritePoolLength){var sprite=new THREE.RenderableSprite();
|
||||
_spritePool.push(sprite);_spritePoolLength++;_spriteCount++;return sprite}return _spritePool[_spriteCount++]}function painterSort(a,b){if(a.renderOrder!==b.renderOrder){return a.renderOrder-b.renderOrder}else{if(a.z!==b.z){return b.z-a.z}else{if(a.id!==b.id){return a.id-b.id}else{return 0}}}}function clipLine(s1,s2){var alpha1=0,alpha2=1,bc1near=s1.z+s1.w,bc2near=s2.z+s2.w,bc1far=-s1.z+s1.w,bc2far=-s2.z+s2.w;if(bc1near>=0&&bc2near>=0&&bc1far>=0&&bc2far>=0){return true}else{if((bc1near<0&&bc2near<0)||(bc1far<0&&bc2far<0)){return false}else{if(bc1near<0){alpha1=Math.max(alpha1,bc1near/(bc1near-bc2near))}else{if(bc2near<0){alpha2=Math.min(alpha2,bc1near/(bc1near-bc2near))}}if(bc1far<0){alpha1=Math.max(alpha1,bc1far/(bc1far-bc2far))}else{if(bc2far<0){alpha2=Math.min(alpha2,bc1far/(bc1far-bc2far))}}if(alpha2<alpha1){return false}else{s1.lerp(s2,alpha1);s2.lerp(s1,1-alpha2);return true}}}}};
|
||||
THREE.SpriteCanvasMaterial=function(parameters){THREE.Material.call(this);this.type="SpriteCanvasMaterial";this.color=new THREE.Color(16777215);this.program=function(context,color){};this.setValues(parameters)};THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteCanvasMaterial.prototype.constructor=THREE.SpriteCanvasMaterial;THREE.SpriteCanvasMaterial.prototype.clone=function(){var material=new THREE.SpriteCanvasMaterial();material.copy(this);material.color.copy(this.color);material.program=this.program;return material};THREE.CanvasRenderer=function(parameters){console.log("THREE.CanvasRenderer",THREE.REVISION);parameters=parameters||{};var _this=this,_renderData,_elements,_lights,_projector=new THREE.Projector(),_canvas=parameters.canvas!==undefined?parameters.canvas:document.createElement("canvas"),_canvasWidth=_canvas.width,_canvasHeight=_canvas.height,_canvasWidthHalf=Math.floor(_canvasWidth/2),_canvasHeightHalf=Math.floor(_canvasHeight/2),_viewportX=0,_viewportY=0,_viewportWidth=_canvasWidth,_viewportHeight=_canvasHeight,_pixelRatio=1,_context=_canvas.getContext("2d",{alpha:parameters.alpha===true}),_clearColor=new THREE.Color(0),_clearAlpha=parameters.alpha===true?0:1,_contextGlobalAlpha=1,_contextGlobalCompositeOperation=0,_contextStrokeStyle=null,_contextFillStyle=null,_contextLineWidth=null,_contextLineCap=null,_contextLineJoin=null,_contextLineDash=[],_camera,_v1,_v2,_v3,_v4,_v5=new THREE.RenderableVertex(),_v6=new THREE.RenderableVertex(),_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_v4x,_v4y,_v5x,_v5y,_v6x,_v6y,_color=new THREE.Color(),_color1=new THREE.Color(),_color2=new THREE.Color(),_color3=new THREE.Color(),_color4=new THREE.Color(),_diffuseColor=new THREE.Color(),_emissiveColor=new THREE.Color(),_lightColor=new THREE.Color(),_patterns={},_image,_uvs,_uv1x,_uv1y,_uv2x,_uv2y,_uv3x,_uv3y,_clipBox=new THREE.Box2(),_clearBox=new THREE.Box2(),_elemBox=new THREE.Box2(),_ambientLight=new THREE.Color(),_directionalLights=new THREE.Color(),_pointLights=new THREE.Color(),_vector3=new THREE.Vector3(),_centroid=new THREE.Vector3(),_normal=new THREE.Vector3(),_normalViewMatrix=new THREE.Matrix3();
|
||||
if(_context.setLineDash===undefined){_context.setLineDash=function(){}}this.domElement=_canvas;this.autoClear=true;this.sortObjects=true;this.sortElements=true;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.getContext=function(){return _context};this.getContextAttributes=function(){return _context.getContextAttributes()};this.getPixelRatio=function(){return _pixelRatio};this.setPixelRatio=function(value){if(value!==undefined){_pixelRatio=value}};this.setSize=function(width,height,updateStyle){_canvasWidth=width*_pixelRatio;_canvasHeight=height*_pixelRatio;_canvas.width=_canvasWidth;_canvas.height=_canvasHeight;_canvasWidthHalf=Math.floor(_canvasWidth/2);_canvasHeightHalf=Math.floor(_canvasHeight/2);if(updateStyle!==false){_canvas.style.width=width+"px";_canvas.style.height=height+"px"}_clipBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clipBox.max.set(_canvasWidthHalf,_canvasHeightHalf);_clearBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clearBox.max.set(_canvasWidthHalf,_canvasHeightHalf);_contextGlobalAlpha=1;_contextGlobalCompositeOperation=0;_contextStrokeStyle=null;_contextFillStyle=null;_contextLineWidth=null;_contextLineCap=null;_contextLineJoin=null;this.setViewport(0,0,width,height)};this.setViewport=function(x,y,width,height){_viewportX=x*_pixelRatio;_viewportY=y*_pixelRatio;_viewportWidth=width*_pixelRatio;_viewportHeight=height*_pixelRatio};this.setScissor=function(){};this.setScissorTest=function(){};this.setClearColor=function(color,alpha){_clearColor.set(color);_clearAlpha=alpha!==undefined?alpha:1;_clearBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clearBox.max.set(_canvasWidthHalf,_canvasHeightHalf)};this.setClearColorHex=function(hex,alpha){console.warn("THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(hex,alpha)};this.getClearColor=function(){return _clearColor};this.getClearAlpha=function(){return _clearAlpha
|
||||
};this.getMaxAnisotropy=function(){return 0};this.clear=function(){if(_clearBox.isEmpty()===false){_clearBox.intersect(_clipBox);_clearBox.expandByScalar(2);_clearBox.min.x=_clearBox.min.x+_canvasWidthHalf;_clearBox.min.y=-_clearBox.min.y+_canvasHeightHalf;_clearBox.max.x=_clearBox.max.x+_canvasWidthHalf;_clearBox.max.y=-_clearBox.max.y+_canvasHeightHalf;if(_clearAlpha<1){_context.clearRect(_clearBox.min.x|0,_clearBox.max.y|0,(_clearBox.max.x-_clearBox.min.x)|0,(_clearBox.min.y-_clearBox.max.y)|0)}if(_clearAlpha>0){setBlending(THREE.NormalBlending);setOpacity(1);setFillStyle("rgba("+Math.floor(_clearColor.r*255)+","+Math.floor(_clearColor.g*255)+","+Math.floor(_clearColor.b*255)+","+_clearAlpha+")");_context.fillRect(_clearBox.min.x|0,_clearBox.max.y|0,(_clearBox.max.x-_clearBox.min.x)|0,(_clearBox.min.y-_clearBox.max.y)|0)}_clearBox.makeEmpty()}};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(scene,camera){if(camera instanceof THREE.Camera===false){console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");return}var background=scene.background;if(background&&background.isColor){setFillStyle("rgb("+Math.floor(background.r*255)+","+Math.floor(background.g*255)+","+Math.floor(background.b*255)+")");_context.fillRect(0,0,_canvasWidth,_canvasHeight)}else{if(this.autoClear===true){this.clear()}}_this.info.render.vertices=0;_this.info.render.faces=0;_context.setTransform(_viewportWidth/_canvasWidth,0,0,-_viewportHeight/_canvasHeight,_viewportX,_canvasHeight-_viewportY);_context.translate(_canvasWidthHalf,_canvasHeightHalf);_renderData=_projector.projectScene(scene,camera,this.sortObjects,this.sortElements);_elements=_renderData.elements;_lights=_renderData.lights;_camera=camera;_normalViewMatrix.getNormalMatrix(camera.matrixWorldInverse);calculateLights();for(var e=0,el=_elements.length;e<el;e++){var element=_elements[e];var material=element.material;if(material===undefined||material.opacity===0){continue
|
||||
}_elemBox.makeEmpty();if(element instanceof THREE.RenderableSprite){_v1=element;_v1.x*=_canvasWidthHalf;_v1.y*=_canvasHeightHalf;renderSprite(_v1,element,material)}else{if(element instanceof THREE.RenderableLine){_v1=element.v1;_v2=element.v2;_v1.positionScreen.x*=_canvasWidthHalf;_v1.positionScreen.y*=_canvasHeightHalf;_v2.positionScreen.x*=_canvasWidthHalf;_v2.positionScreen.y*=_canvasHeightHalf;_elemBox.setFromPoints([_v1.positionScreen,_v2.positionScreen]);if(_clipBox.intersectsBox(_elemBox)===true){renderLine(_v1,_v2,element,material)}}else{if(element instanceof THREE.RenderableFace){_v1=element.v1;_v2=element.v2;_v3=element.v3;if(_v1.positionScreen.z<-1||_v1.positionScreen.z>1){continue}if(_v2.positionScreen.z<-1||_v2.positionScreen.z>1){continue}if(_v3.positionScreen.z<-1||_v3.positionScreen.z>1){continue}_v1.positionScreen.x*=_canvasWidthHalf;_v1.positionScreen.y*=_canvasHeightHalf;_v2.positionScreen.x*=_canvasWidthHalf;_v2.positionScreen.y*=_canvasHeightHalf;_v3.positionScreen.x*=_canvasWidthHalf;_v3.positionScreen.y*=_canvasHeightHalf;if(material.overdraw>0){expand(_v1.positionScreen,_v2.positionScreen,material.overdraw);expand(_v2.positionScreen,_v3.positionScreen,material.overdraw);expand(_v3.positionScreen,_v1.positionScreen,material.overdraw)}_elemBox.setFromPoints([_v1.positionScreen,_v2.positionScreen,_v3.positionScreen]);if(_clipBox.intersectsBox(_elemBox)===true){renderFace3(_v1,_v2,_v3,0,1,2,element,material)}}}}_clearBox.union(_elemBox)}_context.setTransform(1,0,0,1,0,0)};function calculateLights(){_ambientLight.setRGB(0,0,0);_directionalLights.setRGB(0,0,0);_pointLights.setRGB(0,0,0);for(var l=0,ll=_lights.length;l<ll;l++){var light=_lights[l];var lightColor=light.color;if(light instanceof THREE.AmbientLight){_ambientLight.add(lightColor)}else{if(light instanceof THREE.DirectionalLight){_directionalLights.add(lightColor)}else{if(light instanceof THREE.PointLight){_pointLights.add(lightColor)}}}}}function calculateLight(position,normal,color){for(var l=0,ll=_lights.length;
|
||||
l<ll;l++){var light=_lights[l];_lightColor.copy(light.color);if(light instanceof THREE.DirectionalLight){var lightPosition=_vector3.setFromMatrixPosition(light.matrixWorld).normalize();var amount=normal.dot(lightPosition);if(amount<=0){continue}amount*=light.intensity;color.add(_lightColor.multiplyScalar(amount))}else{if(light instanceof THREE.PointLight){var lightPosition=_vector3.setFromMatrixPosition(light.matrixWorld);var amount=normal.dot(_vector3.subVectors(lightPosition,position).normalize());if(amount<=0){continue}amount*=light.distance==0?1:1-Math.min(position.distanceTo(lightPosition)/light.distance,1);if(amount==0){continue}amount*=light.intensity;color.add(_lightColor.multiplyScalar(amount))}}}}function renderSprite(v1,element,material){setOpacity(material.opacity);setBlending(material.blending);var scaleX=element.scale.x*_canvasWidthHalf;var scaleY=element.scale.y*_canvasHeightHalf;var dist=0.5*Math.sqrt(scaleX*scaleX+scaleY*scaleY);_elemBox.min.set(v1.x-dist,v1.y-dist);_elemBox.max.set(v1.x+dist,v1.y+dist);if(material instanceof THREE.SpriteMaterial){var texture=material.map;if(texture!==null){var pattern=_patterns[texture.id];if(pattern===undefined||pattern.version!==texture.version){pattern=textureToPattern(texture);_patterns[texture.id]=pattern}if(pattern.canvas!==undefined){setFillStyle(pattern.canvas);var bitmap=texture.image;var ox=bitmap.width*texture.offset.x;var oy=bitmap.height*texture.offset.y;var sx=bitmap.width*texture.repeat.x;var sy=bitmap.height*texture.repeat.y;var cx=scaleX/sx;var cy=scaleY/sy;_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.translate(-scaleX/2,-scaleY/2);_context.scale(cx,cy);_context.translate(-ox,-oy);_context.fillRect(ox,oy,sx,sy);_context.restore()}}else{setFillStyle(material.color.getStyle());_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.scale(scaleX,-scaleY);_context.fillRect(-0.5,-0.5,1,1);
|
||||
_context.restore()}}else{if(material instanceof THREE.SpriteCanvasMaterial){setStrokeStyle(material.color.getStyle());setFillStyle(material.color.getStyle());_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.scale(scaleX,scaleY);material.program(_context);_context.restore()}}}function renderLine(v1,v2,element,material){setOpacity(material.opacity);setBlending(material.blending);_context.beginPath();_context.moveTo(v1.positionScreen.x,v1.positionScreen.y);_context.lineTo(v2.positionScreen.x,v2.positionScreen.y);if(material instanceof THREE.LineBasicMaterial){setLineWidth(material.linewidth);setLineCap(material.linecap);setLineJoin(material.linejoin);if(material.vertexColors!==THREE.VertexColors){setStrokeStyle(material.color.getStyle())}else{var colorStyle1=element.vertexColors[0].getStyle();var colorStyle2=element.vertexColors[1].getStyle();if(colorStyle1===colorStyle2){setStrokeStyle(colorStyle1)}else{try{var grad=_context.createLinearGradient(v1.positionScreen.x,v1.positionScreen.y,v2.positionScreen.x,v2.positionScreen.y);grad.addColorStop(0,colorStyle1);grad.addColorStop(1,colorStyle2)}catch(exception){grad=colorStyle1}setStrokeStyle(grad)}}_context.stroke();_elemBox.expandByScalar(material.linewidth*2)}else{if(material instanceof THREE.LineDashedMaterial){setLineWidth(material.linewidth);setLineCap(material.linecap);setLineJoin(material.linejoin);setStrokeStyle(material.color.getStyle());setLineDash([material.dashSize,material.gapSize]);_context.stroke();_elemBox.expandByScalar(material.linewidth*2);setLineDash([])}}}function renderFace3(v1,v2,v3,uv1,uv2,uv3,element,material){_this.info.render.vertices+=3;_this.info.render.faces++;setOpacity(material.opacity);setBlending(material.blending);_v1x=v1.positionScreen.x;_v1y=v1.positionScreen.y;_v2x=v2.positionScreen.x;_v2y=v2.positionScreen.y;_v3x=v3.positionScreen.x;_v3y=v3.positionScreen.y;drawTriangle(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y);if((material instanceof THREE.MeshLambertMaterial||material instanceof THREE.MeshPhongMaterial)&&material.map===null){_diffuseColor.copy(material.color);
|
||||
_emissiveColor.copy(material.emissive);if(material.vertexColors===THREE.FaceColors){_diffuseColor.multiply(element.color)}_color.copy(_ambientLight);_centroid.copy(v1.positionWorld).add(v2.positionWorld).add(v3.positionWorld).divideScalar(3);calculateLight(_centroid,element.normalModel,_color);_color.multiply(_diffuseColor).add(_emissiveColor);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}else{if(material instanceof THREE.MeshBasicMaterial||material instanceof THREE.MeshLambertMaterial||material instanceof THREE.MeshPhongMaterial){if(material.map!==null){var mapping=material.map.mapping;if(mapping===THREE.UVMapping){_uvs=element.uvs;patternPath(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_uvs[uv1].x,_uvs[uv1].y,_uvs[uv2].x,_uvs[uv2].y,_uvs[uv3].x,_uvs[uv3].y,material.map)}}else{if(material.envMap!==null){if(material.envMap.mapping===THREE.SphericalReflectionMapping){_normal.copy(element.vertexNormalsModel[uv1]).applyMatrix3(_normalViewMatrix);_uv1x=0.5*_normal.x+0.5;_uv1y=0.5*_normal.y+0.5;_normal.copy(element.vertexNormalsModel[uv2]).applyMatrix3(_normalViewMatrix);_uv2x=0.5*_normal.x+0.5;_uv2y=0.5*_normal.y+0.5;_normal.copy(element.vertexNormalsModel[uv3]).applyMatrix3(_normalViewMatrix);_uv3x=0.5*_normal.x+0.5;_uv3y=0.5*_normal.y+0.5;patternPath(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_uv1x,_uv1y,_uv2x,_uv2y,_uv3x,_uv3y,material.envMap)}}else{_color.copy(material.color);if(material.vertexColors===THREE.FaceColors){_color.multiply(element.color)}material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}}}else{if(material instanceof THREE.MeshNormalMaterial){_normal.copy(element.normalModel).applyMatrix3(_normalViewMatrix);_color.setRGB(_normal.x,_normal.y,_normal.z).multiplyScalar(0.5).addScalar(0.5);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)
|
||||
}else{_color.setRGB(1,1,1);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}}}}function drawTriangle(x0,y0,x1,y1,x2,y2){_context.beginPath();_context.moveTo(x0,y0);_context.lineTo(x1,y1);_context.lineTo(x2,y2);_context.closePath()}function strokePath(color,linewidth,linecap,linejoin){setLineWidth(linewidth);setLineCap(linecap);setLineJoin(linejoin);setStrokeStyle(color.getStyle());_context.stroke();_elemBox.expandByScalar(linewidth*2)}function fillPath(color){setFillStyle(color.getStyle());_context.fill()}function textureToPattern(texture){if(texture.version===0||texture instanceof THREE.CompressedTexture||texture instanceof THREE.DataTexture){return{canvas:undefined,version:texture.version}}var image=texture.image;if(image.complete===false){return{canvas:undefined,version:0}}var repeatX=texture.wrapS===THREE.RepeatWrapping||texture.wrapS===THREE.MirroredRepeatWrapping;var repeatY=texture.wrapT===THREE.RepeatWrapping||texture.wrapT===THREE.MirroredRepeatWrapping;var mirrorX=texture.wrapS===THREE.MirroredRepeatWrapping;var mirrorY=texture.wrapT===THREE.MirroredRepeatWrapping;var canvas=document.createElement("canvas");canvas.width=image.width*(mirrorX?2:1);canvas.height=image.height*(mirrorY?2:1);var context=canvas.getContext("2d");context.setTransform(1,0,0,-1,0,image.height);context.drawImage(image,0,0);if(mirrorX===true){context.setTransform(-1,0,0,-1,image.width,image.height);context.drawImage(image,-image.width,0)}if(mirrorY===true){context.setTransform(1,0,0,1,0,0);context.drawImage(image,0,image.height)}if(mirrorX===true&&mirrorY===true){context.setTransform(-1,0,0,1,image.width,0);context.drawImage(image,-image.width,image.height)}var repeat="no-repeat";if(repeatX===true&&repeatY===true){repeat="repeat"}else{if(repeatX===true){repeat="repeat-x"}else{if(repeatY===true){repeat="repeat-y"}}}var pattern=_context.createPattern(canvas,repeat);if(texture.onUpdate){texture.onUpdate(texture)
|
||||
}return{canvas:pattern,version:texture.version}}function patternPath(x0,y0,x1,y1,x2,y2,u0,v0,u1,v1,u2,v2,texture){var pattern=_patterns[texture.id];if(pattern===undefined||pattern.version!==texture.version){pattern=textureToPattern(texture);_patterns[texture.id]=pattern}if(pattern.canvas!==undefined){setFillStyle(pattern.canvas)}else{setFillStyle("rgba( 0, 0, 0, 1)");_context.fill();return}var a,b,c,d,e,f,det,idet,offsetX=texture.offset.x/texture.repeat.x,offsetY=texture.offset.y/texture.repeat.y,width=texture.image.width*texture.repeat.x,height=texture.image.height*texture.repeat.y;u0=(u0+offsetX)*width;v0=(v0+offsetY)*height;u1=(u1+offsetX)*width;v1=(v1+offsetY)*height;u2=(u2+offsetX)*width;v2=(v2+offsetY)*height;x1-=x0;y1-=y0;x2-=x0;y2-=y0;u1-=u0;v1-=v0;u2-=u0;v2-=v0;det=u1*v2-u2*v1;if(det===0){return}idet=1/det;a=(v2*x1-v1*x2)*idet;b=(v2*y1-v1*y2)*idet;c=(u1*x2-u2*x1)*idet;d=(u1*y2-u2*y1)*idet;e=x0-a*u0-c*v0;f=y0-b*u0-d*v0;_context.save();_context.transform(a,b,c,d,e,f);_context.fill();_context.restore()}function clipImage(x0,y0,x1,y1,x2,y2,u0,v0,u1,v1,u2,v2,image){var a,b,c,d,e,f,det,idet,width=image.width-1,height=image.height-1;u0*=width;v0*=height;u1*=width;v1*=height;u2*=width;v2*=height;x1-=x0;y1-=y0;x2-=x0;y2-=y0;u1-=u0;v1-=v0;u2-=u0;v2-=v0;det=u1*v2-u2*v1;idet=1/det;a=(v2*x1-v1*x2)*idet;b=(v2*y1-v1*y2)*idet;c=(u1*x2-u2*x1)*idet;d=(u1*y2-u2*y1)*idet;e=x0-a*u0-c*v0;f=y0-b*u0-d*v0;_context.save();_context.transform(a,b,c,d,e,f);_context.clip();_context.drawImage(image,0,0);_context.restore()}function expand(v1,v2,pixels){var x=v2.x-v1.x,y=v2.y-v1.y,det=x*x+y*y,idet;if(det===0){return}idet=pixels/Math.sqrt(det);x*=idet;y*=idet;v2.x+=x;v2.y+=y;v1.x-=x;v1.y-=y}function setOpacity(value){if(_contextGlobalAlpha!==value){_context.globalAlpha=value;_contextGlobalAlpha=value}}function setBlending(value){if(_contextGlobalCompositeOperation!==value){if(value===THREE.NormalBlending){_context.globalCompositeOperation="source-over"}else{if(value===THREE.AdditiveBlending){_context.globalCompositeOperation="lighter"
|
||||
}else{if(value===THREE.SubtractiveBlending){_context.globalCompositeOperation="darker"}else{if(value===THREE.MultiplyBlending){_context.globalCompositeOperation="multiply"}}}}_contextGlobalCompositeOperation=value}}function setLineWidth(value){if(_contextLineWidth!==value){_context.lineWidth=value;_contextLineWidth=value}}function setLineCap(value){if(_contextLineCap!==value){_context.lineCap=value;_contextLineCap=value}}function setLineJoin(value){if(_contextLineJoin!==value){_context.lineJoin=value;_contextLineJoin=value}}function setStrokeStyle(value){if(_contextStrokeStyle!==value){_context.strokeStyle=value;_contextStrokeStyle=value}}function setFillStyle(value){if(_contextFillStyle!==value){_context.fillStyle=value;_contextFillStyle=value}}function setLineDash(value){if(_contextLineDash.length!==value.length){_context.setLineDash(value);_contextLineDash=value}}};
|
20
themes/next/source/lib/three/three-waves.min.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
$(function(){var SEPARATION=100,AMOUNTX=50,AMOUNTY=50;var container;var camera,scene,renderer;var particles,particle,count=0;var mouseX=0,mouseY=0;var windowHalfX=window.innerWidth/2;var windowHalfY=window.innerHeight/2;init();animate();function init(){container=document.createElement("div");container.style.position="fixed";container.style.top="0px";container.style.left="0px";container.style.zIndex="-1";container.style.opacity="0.5";document.body.appendChild(container);camera=new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,1,10000);camera.position.z=1000;scene=new THREE.Scene();particles=new Array();var PI2=Math.PI*2;var material=new THREE.SpriteCanvasMaterial({color:10263708,program:function(context){context.beginPath();context.arc(0,0,0.5,0,PI2,true);context.fill()}});var i=0;for(var ix=0;ix<AMOUNTX;ix++){for(var iy=0;iy<AMOUNTY;iy++){particle=particles[i++]=new THREE.Sprite(material);particle.position.x=ix*SEPARATION-((AMOUNTX*SEPARATION)/2);particle.position.z=iy*SEPARATION-((AMOUNTY*SEPARATION)/2);scene.add(particle)}}renderer=new THREE.CanvasRenderer();renderer.setPixelRatio(window.devicePixelRatio);renderer.setSize(window.innerWidth,window.innerHeight);renderer.setClearColor(16119801,0);container.appendChild(renderer.domElement);document.addEventListener("mousemove",onDocumentMouseMove,false);window.addEventListener("resize",onWindowResize,false)}function onWindowResize(){windowHalfX=window.innerWidth/2;windowHalfY=window.innerHeight/2;camera.aspect=window.innerWidth/window.innerHeight;camera.updateProjectionMatrix();renderer.setSize(window.innerWidth,window.innerHeight)}function onDocumentMouseMove(event){mouseX=event.clientX-windowHalfX}function animate(){requestAnimationFrame(animate);render()}function render(){camera.position.x+=(mouseX-camera.position.x)*0.05;camera.position.y=362.05;camera.lookAt({x:scene.position.x,y:window.innerHeight/3,z:scene.position.z});var i=0;for(var ix=0;ix<AMOUNTX;ix++){for(var iy=0;iy<AMOUNTY;iy++){particle=particles[i++];
|
||||
particle.position.y=(Math.sin((ix+count)*0.3)*50)+(Math.sin((iy+count)*0.5)*50);particle.scale.x=particle.scale.y=(Math.sin((ix+count)*0.3)+1)*4+(Math.sin((iy+count)*0.5)+1)*4}}renderer.render(scene,camera);count+=0.1}});
|
||||
THREE.RenderableObject=function(){this.id=0;this.object=null;this.z=0;this.renderOrder=0};THREE.RenderableFace=function(){this.id=0;this.v1=new THREE.RenderableVertex();this.v2=new THREE.RenderableVertex();this.v3=new THREE.RenderableVertex();this.normalModel=new THREE.Vector3();this.vertexNormalsModel=[new THREE.Vector3(),new THREE.Vector3(),new THREE.Vector3()];this.vertexNormalsLength=0;this.color=new THREE.Color();this.material=null;this.uvs=[new THREE.Vector2(),new THREE.Vector2(),new THREE.Vector2()];this.z=0;this.renderOrder=0};THREE.RenderableVertex=function(){this.position=new THREE.Vector3();this.positionWorld=new THREE.Vector3();this.positionScreen=new THREE.Vector4();this.visible=true};THREE.RenderableVertex.prototype.copy=function(vertex){this.positionWorld.copy(vertex.positionWorld);this.positionScreen.copy(vertex.positionScreen)};THREE.RenderableLine=function(){this.id=0;this.v1=new THREE.RenderableVertex();this.v2=new THREE.RenderableVertex();this.vertexColors=[new THREE.Color(),new THREE.Color()];this.material=null;this.z=0;this.renderOrder=0};THREE.RenderableSprite=function(){this.id=0;this.object=null;this.x=0;this.y=0;this.z=0;this.rotation=0;this.scale=new THREE.Vector2();this.material=null;this.renderOrder=0};THREE.Projector=function(){var _object,_objectCount,_objectPool=[],_objectPoolLength=0,_vertex,_vertexCount,_vertexPool=[],_vertexPoolLength=0,_face,_faceCount,_facePool=[],_facePoolLength=0,_line,_lineCount,_linePool=[],_linePoolLength=0,_sprite,_spriteCount,_spritePool=[],_spritePoolLength=0,_renderData={objects:[],lights:[],elements:[]},_vector3=new THREE.Vector3(),_vector4=new THREE.Vector4(),_clipBox=new THREE.Box3(new THREE.Vector3(-1,-1,-1),new THREE.Vector3(1,1,1)),_boundingBox=new THREE.Box3(),_points3=new Array(3),_points4=new Array(4),_viewMatrix=new THREE.Matrix4(),_viewProjectionMatrix=new THREE.Matrix4(),_modelMatrix,_modelViewProjectionMatrix=new THREE.Matrix4(),_normalMatrix=new THREE.Matrix3(),_frustum=new THREE.Frustum(),_clippedVertex1PositionScreen=new THREE.Vector4(),_clippedVertex2PositionScreen=new THREE.Vector4();
|
||||
this.projectVector=function(vector,camera){console.warn("THREE.Projector: .projectVector() is now vector.project().");vector.project(camera)};this.unprojectVector=function(vector,camera){console.warn("THREE.Projector: .unprojectVector() is now vector.unproject().");vector.unproject(camera)};this.pickingRay=function(vector,camera){console.error("THREE.Projector: .pickingRay() is now raycaster.setFromCamera().")};var RenderList=function(){var normals=[];var uvs=[];var object=null;var material=null;var normalMatrix=new THREE.Matrix3();function setObject(value){object=value;material=object.material;normalMatrix.getNormalMatrix(object.matrixWorld);normals.length=0;uvs.length=0}function projectVertex(vertex){var position=vertex.position;var positionWorld=vertex.positionWorld;var positionScreen=vertex.positionScreen;positionWorld.copy(position).applyMatrix4(_modelMatrix);positionScreen.copy(positionWorld).applyMatrix4(_viewProjectionMatrix);var invW=1/positionScreen.w;positionScreen.x*=invW;positionScreen.y*=invW;positionScreen.z*=invW;vertex.visible=positionScreen.x>=-1&&positionScreen.x<=1&&positionScreen.y>=-1&&positionScreen.y<=1&&positionScreen.z>=-1&&positionScreen.z<=1}function pushVertex(x,y,z){_vertex=getNextVertexInPool();_vertex.position.set(x,y,z);projectVertex(_vertex)}function pushNormal(x,y,z){normals.push(x,y,z)}function pushUv(x,y){uvs.push(x,y)}function checkTriangleVisibility(v1,v2,v3){if(v1.visible===true||v2.visible===true||v3.visible===true){return true}_points3[0]=v1.positionScreen;_points3[1]=v2.positionScreen;_points3[2]=v3.positionScreen;return _clipBox.intersectsBox(_boundingBox.setFromPoints(_points3))}function checkBackfaceCulling(v1,v2,v3){return((v3.positionScreen.x-v1.positionScreen.x)*(v2.positionScreen.y-v1.positionScreen.y)-(v3.positionScreen.y-v1.positionScreen.y)*(v2.positionScreen.x-v1.positionScreen.x))<0}function pushLine(a,b){var v1=_vertexPool[a];var v2=_vertexPool[b];_line=getNextLineInPool();_line.id=object.id;_line.v1.copy(v1);_line.v2.copy(v2);
|
||||
_line.z=(v1.positionScreen.z+v2.positionScreen.z)/2;_line.renderOrder=object.renderOrder;_line.material=object.material;_renderData.elements.push(_line)}function pushTriangle(a,b,c){var v1=_vertexPool[a];var v2=_vertexPool[b];var v3=_vertexPool[c];if(checkTriangleVisibility(v1,v2,v3)===false){return}if(material.side===THREE.DoubleSide||checkBackfaceCulling(v1,v2,v3)===true){_face=getNextFaceInPool();_face.id=object.id;_face.v1.copy(v1);_face.v2.copy(v2);_face.v3.copy(v3);_face.z=(v1.positionScreen.z+v2.positionScreen.z+v3.positionScreen.z)/3;_face.renderOrder=object.renderOrder;_face.normalModel.fromArray(normals,a*3);_face.normalModel.applyMatrix3(normalMatrix).normalize();for(var i=0;i<3;i++){var normal=_face.vertexNormalsModel[i];normal.fromArray(normals,arguments[i]*3);normal.applyMatrix3(normalMatrix).normalize();var uv=_face.uvs[i];uv.fromArray(uvs,arguments[i]*2)}_face.vertexNormalsLength=3;_face.material=object.material;_renderData.elements.push(_face)}}return{setObject:setObject,projectVertex:projectVertex,checkTriangleVisibility:checkTriangleVisibility,checkBackfaceCulling:checkBackfaceCulling,pushVertex:pushVertex,pushNormal:pushNormal,pushUv:pushUv,pushLine:pushLine,pushTriangle:pushTriangle}};var renderList=new RenderList();this.projectScene=function(scene,camera,sortObjects,sortElements){_faceCount=0;_lineCount=0;_spriteCount=0;_renderData.elements.length=0;if(scene.autoUpdate===true){scene.updateMatrixWorld()}if(camera.parent===null){camera.updateMatrixWorld()}_viewMatrix.copy(camera.matrixWorldInverse.getInverse(camera.matrixWorld));_viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix,_viewMatrix);_frustum.setFromMatrix(_viewProjectionMatrix);_objectCount=0;_renderData.objects.length=0;_renderData.lights.length=0;function addObject(object){_object=getNextObjectInPool();_object.id=object.id;_object.object=object;_vector3.setFromMatrixPosition(object.matrixWorld);_vector3.applyMatrix4(_viewProjectionMatrix);_object.z=_vector3.z;_object.renderOrder=object.renderOrder;
|
||||
_renderData.objects.push(_object)}scene.traverseVisible(function(object){if(object instanceof THREE.Light){_renderData.lights.push(object)}else{if(object instanceof THREE.Mesh||object instanceof THREE.Line){if(object.material.visible===false){return}if(object.frustumCulled===true&&_frustum.intersectsObject(object)===false){return}addObject(object)}else{if(object instanceof THREE.Sprite){if(object.material.visible===false){return}if(object.frustumCulled===true&&_frustum.intersectsSprite(object)===false){return}addObject(object)}}}});if(sortObjects===true){_renderData.objects.sort(painterSort)}for(var o=0,ol=_renderData.objects.length;o<ol;o++){var object=_renderData.objects[o].object;var geometry=object.geometry;renderList.setObject(object);_modelMatrix=object.matrixWorld;_vertexCount=0;if(object instanceof THREE.Mesh){if(geometry instanceof THREE.BufferGeometry){var attributes=geometry.attributes;var groups=geometry.groups;if(attributes.position===undefined){continue}var positions=attributes.position.array;for(var i=0,l=positions.length;i<l;i+=3){renderList.pushVertex(positions[i],positions[i+1],positions[i+2])}if(attributes.normal!==undefined){var normals=attributes.normal.array;for(var i=0,l=normals.length;i<l;i+=3){renderList.pushNormal(normals[i],normals[i+1],normals[i+2])}}if(attributes.uv!==undefined){var uvs=attributes.uv.array;for(var i=0,l=uvs.length;i<l;i+=2){renderList.pushUv(uvs[i],uvs[i+1])}}if(geometry.index!==null){var indices=geometry.index.array;if(groups.length>0){for(var g=0;g<groups.length;g++){var group=groups[g];for(var i=group.start,l=group.start+group.count;i<l;i+=3){renderList.pushTriangle(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0,l=indices.length;i<l;i+=3){renderList.pushTriangle(indices[i],indices[i+1],indices[i+2])}}}else{for(var i=0,l=positions.length/3;i<l;i+=3){renderList.pushTriangle(i,i+1,i+2)}}}else{if(geometry instanceof THREE.Geometry){var vertices=geometry.vertices;var faces=geometry.faces;var faceVertexUvs=geometry.faceVertexUvs[0];
|
||||
_normalMatrix.getNormalMatrix(_modelMatrix);var material=object.material;var isFaceMaterial=material instanceof THREE.MultiMaterial;var objectMaterials=isFaceMaterial===true?object.material:null;for(var v=0,vl=vertices.length;v<vl;v++){var vertex=vertices[v];_vector3.copy(vertex);if(material.morphTargets===true){var morphTargets=geometry.morphTargets;var morphInfluences=object.morphTargetInfluences;for(var t=0,tl=morphTargets.length;t<tl;t++){var influence=morphInfluences[t];if(influence===0){continue}var target=morphTargets[t];var targetVertex=target.vertices[v];_vector3.x+=(targetVertex.x-vertex.x)*influence;_vector3.y+=(targetVertex.y-vertex.y)*influence;_vector3.z+=(targetVertex.z-vertex.z)*influence}}renderList.pushVertex(_vector3.x,_vector3.y,_vector3.z)}for(var f=0,fl=faces.length;f<fl;f++){var face=faces[f];material=isFaceMaterial===true?objectMaterials.materials[face.materialIndex]:object.material;if(material===undefined){continue}var side=material.side;var v1=_vertexPool[face.a];var v2=_vertexPool[face.b];var v3=_vertexPool[face.c];if(renderList.checkTriangleVisibility(v1,v2,v3)===false){continue}var visible=renderList.checkBackfaceCulling(v1,v2,v3);if(side!==THREE.DoubleSide){if(side===THREE.FrontSide&&visible===false){continue}if(side===THREE.BackSide&&visible===true){continue}}_face=getNextFaceInPool();_face.id=object.id;_face.v1.copy(v1);_face.v2.copy(v2);_face.v3.copy(v3);_face.normalModel.copy(face.normal);if(visible===false&&(side===THREE.BackSide||side===THREE.DoubleSide)){_face.normalModel.negate()}_face.normalModel.applyMatrix3(_normalMatrix).normalize();var faceVertexNormals=face.vertexNormals;for(var n=0,nl=Math.min(faceVertexNormals.length,3);n<nl;n++){var normalModel=_face.vertexNormalsModel[n];normalModel.copy(faceVertexNormals[n]);if(visible===false&&(side===THREE.BackSide||side===THREE.DoubleSide)){normalModel.negate()}normalModel.applyMatrix3(_normalMatrix).normalize()}_face.vertexNormalsLength=faceVertexNormals.length;var vertexUvs=faceVertexUvs[f];
|
||||
if(vertexUvs!==undefined){for(var u=0;u<3;u++){_face.uvs[u].copy(vertexUvs[u])}}_face.color=face.color;_face.material=material;_face.z=(v1.positionScreen.z+v2.positionScreen.z+v3.positionScreen.z)/3;_face.renderOrder=object.renderOrder;_renderData.elements.push(_face)}}}}else{if(object instanceof THREE.Line){if(geometry instanceof THREE.BufferGeometry){var attributes=geometry.attributes;if(attributes.position!==undefined){var positions=attributes.position.array;for(var i=0,l=positions.length;i<l;i+=3){renderList.pushVertex(positions[i],positions[i+1],positions[i+2])}if(geometry.index!==null){var indices=geometry.index.array;for(var i=0,l=indices.length;i<l;i+=2){renderList.pushLine(indices[i],indices[i+1])}}else{var step=object instanceof THREE.LineSegments?2:1;for(var i=0,l=(positions.length/3)-1;i<l;i+=step){renderList.pushLine(i,i+1)}}}}else{if(geometry instanceof THREE.Geometry){_modelViewProjectionMatrix.multiplyMatrices(_viewProjectionMatrix,_modelMatrix);var vertices=object.geometry.vertices;if(vertices.length===0){continue}v1=getNextVertexInPool();v1.positionScreen.copy(vertices[0]).applyMatrix4(_modelViewProjectionMatrix);var step=object instanceof THREE.LineSegments?2:1;for(var v=1,vl=vertices.length;v<vl;v++){v1=getNextVertexInPool();v1.positionScreen.copy(vertices[v]).applyMatrix4(_modelViewProjectionMatrix);if((v+1)%step>0){continue}v2=_vertexPool[_vertexCount-2];_clippedVertex1PositionScreen.copy(v1.positionScreen);_clippedVertex2PositionScreen.copy(v2.positionScreen);if(clipLine(_clippedVertex1PositionScreen,_clippedVertex2PositionScreen)===true){_clippedVertex1PositionScreen.multiplyScalar(1/_clippedVertex1PositionScreen.w);_clippedVertex2PositionScreen.multiplyScalar(1/_clippedVertex2PositionScreen.w);_line=getNextLineInPool();_line.id=object.id;_line.v1.positionScreen.copy(_clippedVertex1PositionScreen);_line.v2.positionScreen.copy(_clippedVertex2PositionScreen);_line.z=Math.max(_clippedVertex1PositionScreen.z,_clippedVertex2PositionScreen.z);_line.renderOrder=object.renderOrder;
|
||||
_line.material=object.material;if(object.material.vertexColors===THREE.VertexColors){_line.vertexColors[0].copy(object.geometry.colors[v]);_line.vertexColors[1].copy(object.geometry.colors[v-1])}_renderData.elements.push(_line)}}}}}else{if(object instanceof THREE.Sprite){_vector4.set(_modelMatrix.elements[12],_modelMatrix.elements[13],_modelMatrix.elements[14],1);_vector4.applyMatrix4(_viewProjectionMatrix);var invW=1/_vector4.w;_vector4.z*=invW;if(_vector4.z>=-1&&_vector4.z<=1){_sprite=getNextSpriteInPool();_sprite.id=object.id;_sprite.x=_vector4.x*invW;_sprite.y=_vector4.y*invW;_sprite.z=_vector4.z;_sprite.renderOrder=object.renderOrder;_sprite.object=object;_sprite.rotation=object.rotation;_sprite.scale.x=object.scale.x*Math.abs(_sprite.x-(_vector4.x+camera.projectionMatrix.elements[0])/(_vector4.w+camera.projectionMatrix.elements[12]));_sprite.scale.y=object.scale.y*Math.abs(_sprite.y-(_vector4.y+camera.projectionMatrix.elements[5])/(_vector4.w+camera.projectionMatrix.elements[13]));_sprite.material=object.material;_renderData.elements.push(_sprite)}}}}}if(sortElements===true){_renderData.elements.sort(painterSort)}return _renderData};function getNextObjectInPool(){if(_objectCount===_objectPoolLength){var object=new THREE.RenderableObject();_objectPool.push(object);_objectPoolLength++;_objectCount++;return object}return _objectPool[_objectCount++]}function getNextVertexInPool(){if(_vertexCount===_vertexPoolLength){var vertex=new THREE.RenderableVertex();_vertexPool.push(vertex);_vertexPoolLength++;_vertexCount++;return vertex}return _vertexPool[_vertexCount++]}function getNextFaceInPool(){if(_faceCount===_facePoolLength){var face=new THREE.RenderableFace();_facePool.push(face);_facePoolLength++;_faceCount++;return face}return _facePool[_faceCount++]}function getNextLineInPool(){if(_lineCount===_linePoolLength){var line=new THREE.RenderableLine();_linePool.push(line);_linePoolLength++;_lineCount++;return line}return _linePool[_lineCount++]}function getNextSpriteInPool(){if(_spriteCount===_spritePoolLength){var sprite=new THREE.RenderableSprite();
|
||||
_spritePool.push(sprite);_spritePoolLength++;_spriteCount++;return sprite}return _spritePool[_spriteCount++]}function painterSort(a,b){if(a.renderOrder!==b.renderOrder){return a.renderOrder-b.renderOrder}else{if(a.z!==b.z){return b.z-a.z}else{if(a.id!==b.id){return a.id-b.id}else{return 0}}}}function clipLine(s1,s2){var alpha1=0,alpha2=1,bc1near=s1.z+s1.w,bc2near=s2.z+s2.w,bc1far=-s1.z+s1.w,bc2far=-s2.z+s2.w;if(bc1near>=0&&bc2near>=0&&bc1far>=0&&bc2far>=0){return true}else{if((bc1near<0&&bc2near<0)||(bc1far<0&&bc2far<0)){return false}else{if(bc1near<0){alpha1=Math.max(alpha1,bc1near/(bc1near-bc2near))}else{if(bc2near<0){alpha2=Math.min(alpha2,bc1near/(bc1near-bc2near))}}if(bc1far<0){alpha1=Math.max(alpha1,bc1far/(bc1far-bc2far))}else{if(bc2far<0){alpha2=Math.min(alpha2,bc1far/(bc1far-bc2far))}}if(alpha2<alpha1){return false}else{s1.lerp(s2,alpha1);s2.lerp(s1,1-alpha2);return true}}}}};
|
||||
THREE.SpriteCanvasMaterial=function(parameters){THREE.Material.call(this);this.type="SpriteCanvasMaterial";this.color=new THREE.Color(16777215);this.program=function(context,color){};this.setValues(parameters)};THREE.SpriteCanvasMaterial.prototype=Object.create(THREE.Material.prototype);THREE.SpriteCanvasMaterial.prototype.constructor=THREE.SpriteCanvasMaterial;THREE.SpriteCanvasMaterial.prototype.clone=function(){var material=new THREE.SpriteCanvasMaterial();material.copy(this);material.color.copy(this.color);material.program=this.program;return material};THREE.CanvasRenderer=function(parameters){console.log("THREE.CanvasRenderer",THREE.REVISION);parameters=parameters||{};var _this=this,_renderData,_elements,_lights,_projector=new THREE.Projector(),_canvas=parameters.canvas!==undefined?parameters.canvas:document.createElement("canvas"),_canvasWidth=_canvas.width,_canvasHeight=_canvas.height,_canvasWidthHalf=Math.floor(_canvasWidth/2),_canvasHeightHalf=Math.floor(_canvasHeight/2),_viewportX=0,_viewportY=0,_viewportWidth=_canvasWidth,_viewportHeight=_canvasHeight,_pixelRatio=1,_context=_canvas.getContext("2d",{alpha:parameters.alpha===true}),_clearColor=new THREE.Color(0),_clearAlpha=parameters.alpha===true?0:1,_contextGlobalAlpha=1,_contextGlobalCompositeOperation=0,_contextStrokeStyle=null,_contextFillStyle=null,_contextLineWidth=null,_contextLineCap=null,_contextLineJoin=null,_contextLineDash=[],_camera,_v1,_v2,_v3,_v4,_v5=new THREE.RenderableVertex(),_v6=new THREE.RenderableVertex(),_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_v4x,_v4y,_v5x,_v5y,_v6x,_v6y,_color=new THREE.Color(),_color1=new THREE.Color(),_color2=new THREE.Color(),_color3=new THREE.Color(),_color4=new THREE.Color(),_diffuseColor=new THREE.Color(),_emissiveColor=new THREE.Color(),_lightColor=new THREE.Color(),_patterns={},_image,_uvs,_uv1x,_uv1y,_uv2x,_uv2y,_uv3x,_uv3y,_clipBox=new THREE.Box2(),_clearBox=new THREE.Box2(),_elemBox=new THREE.Box2(),_ambientLight=new THREE.Color(),_directionalLights=new THREE.Color(),_pointLights=new THREE.Color(),_vector3=new THREE.Vector3(),_centroid=new THREE.Vector3(),_normal=new THREE.Vector3(),_normalViewMatrix=new THREE.Matrix3();
|
||||
if(_context.setLineDash===undefined){_context.setLineDash=function(){}}this.domElement=_canvas;this.autoClear=true;this.sortObjects=true;this.sortElements=true;this.info={render:{vertices:0,faces:0}};this.supportsVertexTextures=function(){};this.setFaceCulling=function(){};this.getContext=function(){return _context};this.getContextAttributes=function(){return _context.getContextAttributes()};this.getPixelRatio=function(){return _pixelRatio};this.setPixelRatio=function(value){if(value!==undefined){_pixelRatio=value}};this.setSize=function(width,height,updateStyle){_canvasWidth=width*_pixelRatio;_canvasHeight=height*_pixelRatio;_canvas.width=_canvasWidth;_canvas.height=_canvasHeight;_canvasWidthHalf=Math.floor(_canvasWidth/2);_canvasHeightHalf=Math.floor(_canvasHeight/2);if(updateStyle!==false){_canvas.style.width=width+"px";_canvas.style.height=height+"px"}_clipBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clipBox.max.set(_canvasWidthHalf,_canvasHeightHalf);_clearBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clearBox.max.set(_canvasWidthHalf,_canvasHeightHalf);_contextGlobalAlpha=1;_contextGlobalCompositeOperation=0;_contextStrokeStyle=null;_contextFillStyle=null;_contextLineWidth=null;_contextLineCap=null;_contextLineJoin=null;this.setViewport(0,0,width,height)};this.setViewport=function(x,y,width,height){_viewportX=x*_pixelRatio;_viewportY=y*_pixelRatio;_viewportWidth=width*_pixelRatio;_viewportHeight=height*_pixelRatio};this.setScissor=function(){};this.setScissorTest=function(){};this.setClearColor=function(color,alpha){_clearColor.set(color);_clearAlpha=alpha!==undefined?alpha:1;_clearBox.min.set(-_canvasWidthHalf,-_canvasHeightHalf);_clearBox.max.set(_canvasWidthHalf,_canvasHeightHalf)};this.setClearColorHex=function(hex,alpha){console.warn("THREE.CanvasRenderer: .setClearColorHex() is being removed. Use .setClearColor() instead.");this.setClearColor(hex,alpha)};this.getClearColor=function(){return _clearColor};this.getClearAlpha=function(){return _clearAlpha
|
||||
};this.getMaxAnisotropy=function(){return 0};this.clear=function(){if(_clearBox.isEmpty()===false){_clearBox.intersect(_clipBox);_clearBox.expandByScalar(2);_clearBox.min.x=_clearBox.min.x+_canvasWidthHalf;_clearBox.min.y=-_clearBox.min.y+_canvasHeightHalf;_clearBox.max.x=_clearBox.max.x+_canvasWidthHalf;_clearBox.max.y=-_clearBox.max.y+_canvasHeightHalf;if(_clearAlpha<1){_context.clearRect(_clearBox.min.x|0,_clearBox.max.y|0,(_clearBox.max.x-_clearBox.min.x)|0,(_clearBox.min.y-_clearBox.max.y)|0)}if(_clearAlpha>0){setBlending(THREE.NormalBlending);setOpacity(1);setFillStyle("rgba("+Math.floor(_clearColor.r*255)+","+Math.floor(_clearColor.g*255)+","+Math.floor(_clearColor.b*255)+","+_clearAlpha+")");_context.fillRect(_clearBox.min.x|0,_clearBox.max.y|0,(_clearBox.max.x-_clearBox.min.x)|0,(_clearBox.min.y-_clearBox.max.y)|0)}_clearBox.makeEmpty()}};this.clearColor=function(){};this.clearDepth=function(){};this.clearStencil=function(){};this.render=function(scene,camera){if(camera instanceof THREE.Camera===false){console.error("THREE.CanvasRenderer.render: camera is not an instance of THREE.Camera.");return}var background=scene.background;if(background&&background.isColor){setFillStyle("rgb("+Math.floor(background.r*255)+","+Math.floor(background.g*255)+","+Math.floor(background.b*255)+")");_context.fillRect(0,0,_canvasWidth,_canvasHeight)}else{if(this.autoClear===true){this.clear()}}_this.info.render.vertices=0;_this.info.render.faces=0;_context.setTransform(_viewportWidth/_canvasWidth,0,0,-_viewportHeight/_canvasHeight,_viewportX,_canvasHeight-_viewportY);_context.translate(_canvasWidthHalf,_canvasHeightHalf);_renderData=_projector.projectScene(scene,camera,this.sortObjects,this.sortElements);_elements=_renderData.elements;_lights=_renderData.lights;_camera=camera;_normalViewMatrix.getNormalMatrix(camera.matrixWorldInverse);calculateLights();for(var e=0,el=_elements.length;e<el;e++){var element=_elements[e];var material=element.material;if(material===undefined||material.opacity===0){continue
|
||||
}_elemBox.makeEmpty();if(element instanceof THREE.RenderableSprite){_v1=element;_v1.x*=_canvasWidthHalf;_v1.y*=_canvasHeightHalf;renderSprite(_v1,element,material)}else{if(element instanceof THREE.RenderableLine){_v1=element.v1;_v2=element.v2;_v1.positionScreen.x*=_canvasWidthHalf;_v1.positionScreen.y*=_canvasHeightHalf;_v2.positionScreen.x*=_canvasWidthHalf;_v2.positionScreen.y*=_canvasHeightHalf;_elemBox.setFromPoints([_v1.positionScreen,_v2.positionScreen]);if(_clipBox.intersectsBox(_elemBox)===true){renderLine(_v1,_v2,element,material)}}else{if(element instanceof THREE.RenderableFace){_v1=element.v1;_v2=element.v2;_v3=element.v3;if(_v1.positionScreen.z<-1||_v1.positionScreen.z>1){continue}if(_v2.positionScreen.z<-1||_v2.positionScreen.z>1){continue}if(_v3.positionScreen.z<-1||_v3.positionScreen.z>1){continue}_v1.positionScreen.x*=_canvasWidthHalf;_v1.positionScreen.y*=_canvasHeightHalf;_v2.positionScreen.x*=_canvasWidthHalf;_v2.positionScreen.y*=_canvasHeightHalf;_v3.positionScreen.x*=_canvasWidthHalf;_v3.positionScreen.y*=_canvasHeightHalf;if(material.overdraw>0){expand(_v1.positionScreen,_v2.positionScreen,material.overdraw);expand(_v2.positionScreen,_v3.positionScreen,material.overdraw);expand(_v3.positionScreen,_v1.positionScreen,material.overdraw)}_elemBox.setFromPoints([_v1.positionScreen,_v2.positionScreen,_v3.positionScreen]);if(_clipBox.intersectsBox(_elemBox)===true){renderFace3(_v1,_v2,_v3,0,1,2,element,material)}}}}_clearBox.union(_elemBox)}_context.setTransform(1,0,0,1,0,0)};function calculateLights(){_ambientLight.setRGB(0,0,0);_directionalLights.setRGB(0,0,0);_pointLights.setRGB(0,0,0);for(var l=0,ll=_lights.length;l<ll;l++){var light=_lights[l];var lightColor=light.color;if(light instanceof THREE.AmbientLight){_ambientLight.add(lightColor)}else{if(light instanceof THREE.DirectionalLight){_directionalLights.add(lightColor)}else{if(light instanceof THREE.PointLight){_pointLights.add(lightColor)}}}}}function calculateLight(position,normal,color){for(var l=0,ll=_lights.length;
|
||||
l<ll;l++){var light=_lights[l];_lightColor.copy(light.color);if(light instanceof THREE.DirectionalLight){var lightPosition=_vector3.setFromMatrixPosition(light.matrixWorld).normalize();var amount=normal.dot(lightPosition);if(amount<=0){continue}amount*=light.intensity;color.add(_lightColor.multiplyScalar(amount))}else{if(light instanceof THREE.PointLight){var lightPosition=_vector3.setFromMatrixPosition(light.matrixWorld);var amount=normal.dot(_vector3.subVectors(lightPosition,position).normalize());if(amount<=0){continue}amount*=light.distance==0?1:1-Math.min(position.distanceTo(lightPosition)/light.distance,1);if(amount==0){continue}amount*=light.intensity;color.add(_lightColor.multiplyScalar(amount))}}}}function renderSprite(v1,element,material){setOpacity(material.opacity);setBlending(material.blending);var scaleX=element.scale.x*_canvasWidthHalf;var scaleY=element.scale.y*_canvasHeightHalf;var dist=0.5*Math.sqrt(scaleX*scaleX+scaleY*scaleY);_elemBox.min.set(v1.x-dist,v1.y-dist);_elemBox.max.set(v1.x+dist,v1.y+dist);if(material instanceof THREE.SpriteMaterial){var texture=material.map;if(texture!==null){var pattern=_patterns[texture.id];if(pattern===undefined||pattern.version!==texture.version){pattern=textureToPattern(texture);_patterns[texture.id]=pattern}if(pattern.canvas!==undefined){setFillStyle(pattern.canvas);var bitmap=texture.image;var ox=bitmap.width*texture.offset.x;var oy=bitmap.height*texture.offset.y;var sx=bitmap.width*texture.repeat.x;var sy=bitmap.height*texture.repeat.y;var cx=scaleX/sx;var cy=scaleY/sy;_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.translate(-scaleX/2,-scaleY/2);_context.scale(cx,cy);_context.translate(-ox,-oy);_context.fillRect(ox,oy,sx,sy);_context.restore()}}else{setFillStyle(material.color.getStyle());_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.scale(scaleX,-scaleY);_context.fillRect(-0.5,-0.5,1,1);
|
||||
_context.restore()}}else{if(material instanceof THREE.SpriteCanvasMaterial){setStrokeStyle(material.color.getStyle());setFillStyle(material.color.getStyle());_context.save();_context.translate(v1.x,v1.y);if(material.rotation!==0){_context.rotate(material.rotation)}_context.scale(scaleX,scaleY);material.program(_context);_context.restore()}}}function renderLine(v1,v2,element,material){setOpacity(material.opacity);setBlending(material.blending);_context.beginPath();_context.moveTo(v1.positionScreen.x,v1.positionScreen.y);_context.lineTo(v2.positionScreen.x,v2.positionScreen.y);if(material instanceof THREE.LineBasicMaterial){setLineWidth(material.linewidth);setLineCap(material.linecap);setLineJoin(material.linejoin);if(material.vertexColors!==THREE.VertexColors){setStrokeStyle(material.color.getStyle())}else{var colorStyle1=element.vertexColors[0].getStyle();var colorStyle2=element.vertexColors[1].getStyle();if(colorStyle1===colorStyle2){setStrokeStyle(colorStyle1)}else{try{var grad=_context.createLinearGradient(v1.positionScreen.x,v1.positionScreen.y,v2.positionScreen.x,v2.positionScreen.y);grad.addColorStop(0,colorStyle1);grad.addColorStop(1,colorStyle2)}catch(exception){grad=colorStyle1}setStrokeStyle(grad)}}_context.stroke();_elemBox.expandByScalar(material.linewidth*2)}else{if(material instanceof THREE.LineDashedMaterial){setLineWidth(material.linewidth);setLineCap(material.linecap);setLineJoin(material.linejoin);setStrokeStyle(material.color.getStyle());setLineDash([material.dashSize,material.gapSize]);_context.stroke();_elemBox.expandByScalar(material.linewidth*2);setLineDash([])}}}function renderFace3(v1,v2,v3,uv1,uv2,uv3,element,material){_this.info.render.vertices+=3;_this.info.render.faces++;setOpacity(material.opacity);setBlending(material.blending);_v1x=v1.positionScreen.x;_v1y=v1.positionScreen.y;_v2x=v2.positionScreen.x;_v2y=v2.positionScreen.y;_v3x=v3.positionScreen.x;_v3y=v3.positionScreen.y;drawTriangle(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y);if((material instanceof THREE.MeshLambertMaterial||material instanceof THREE.MeshPhongMaterial)&&material.map===null){_diffuseColor.copy(material.color);
|
||||
_emissiveColor.copy(material.emissive);if(material.vertexColors===THREE.FaceColors){_diffuseColor.multiply(element.color)}_color.copy(_ambientLight);_centroid.copy(v1.positionWorld).add(v2.positionWorld).add(v3.positionWorld).divideScalar(3);calculateLight(_centroid,element.normalModel,_color);_color.multiply(_diffuseColor).add(_emissiveColor);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}else{if(material instanceof THREE.MeshBasicMaterial||material instanceof THREE.MeshLambertMaterial||material instanceof THREE.MeshPhongMaterial){if(material.map!==null){var mapping=material.map.mapping;if(mapping===THREE.UVMapping){_uvs=element.uvs;patternPath(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_uvs[uv1].x,_uvs[uv1].y,_uvs[uv2].x,_uvs[uv2].y,_uvs[uv3].x,_uvs[uv3].y,material.map)}}else{if(material.envMap!==null){if(material.envMap.mapping===THREE.SphericalReflectionMapping){_normal.copy(element.vertexNormalsModel[uv1]).applyMatrix3(_normalViewMatrix);_uv1x=0.5*_normal.x+0.5;_uv1y=0.5*_normal.y+0.5;_normal.copy(element.vertexNormalsModel[uv2]).applyMatrix3(_normalViewMatrix);_uv2x=0.5*_normal.x+0.5;_uv2y=0.5*_normal.y+0.5;_normal.copy(element.vertexNormalsModel[uv3]).applyMatrix3(_normalViewMatrix);_uv3x=0.5*_normal.x+0.5;_uv3y=0.5*_normal.y+0.5;patternPath(_v1x,_v1y,_v2x,_v2y,_v3x,_v3y,_uv1x,_uv1y,_uv2x,_uv2y,_uv3x,_uv3y,material.envMap)}}else{_color.copy(material.color);if(material.vertexColors===THREE.FaceColors){_color.multiply(element.color)}material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}}}else{if(material instanceof THREE.MeshNormalMaterial){_normal.copy(element.normalModel).applyMatrix3(_normalViewMatrix);_color.setRGB(_normal.x,_normal.y,_normal.z).multiplyScalar(0.5).addScalar(0.5);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)
|
||||
}else{_color.setRGB(1,1,1);material.wireframe===true?strokePath(_color,material.wireframeLinewidth,material.wireframeLinecap,material.wireframeLinejoin):fillPath(_color)}}}}function drawTriangle(x0,y0,x1,y1,x2,y2){_context.beginPath();_context.moveTo(x0,y0);_context.lineTo(x1,y1);_context.lineTo(x2,y2);_context.closePath()}function strokePath(color,linewidth,linecap,linejoin){setLineWidth(linewidth);setLineCap(linecap);setLineJoin(linejoin);setStrokeStyle(color.getStyle());_context.stroke();_elemBox.expandByScalar(linewidth*2)}function fillPath(color){setFillStyle(color.getStyle());_context.fill()}function textureToPattern(texture){if(texture.version===0||texture instanceof THREE.CompressedTexture||texture instanceof THREE.DataTexture){return{canvas:undefined,version:texture.version}}var image=texture.image;if(image.complete===false){return{canvas:undefined,version:0}}var repeatX=texture.wrapS===THREE.RepeatWrapping||texture.wrapS===THREE.MirroredRepeatWrapping;var repeatY=texture.wrapT===THREE.RepeatWrapping||texture.wrapT===THREE.MirroredRepeatWrapping;var mirrorX=texture.wrapS===THREE.MirroredRepeatWrapping;var mirrorY=texture.wrapT===THREE.MirroredRepeatWrapping;var canvas=document.createElement("canvas");canvas.width=image.width*(mirrorX?2:1);canvas.height=image.height*(mirrorY?2:1);var context=canvas.getContext("2d");context.setTransform(1,0,0,-1,0,image.height);context.drawImage(image,0,0);if(mirrorX===true){context.setTransform(-1,0,0,-1,image.width,image.height);context.drawImage(image,-image.width,0)}if(mirrorY===true){context.setTransform(1,0,0,1,0,0);context.drawImage(image,0,image.height)}if(mirrorX===true&&mirrorY===true){context.setTransform(-1,0,0,1,image.width,0);context.drawImage(image,-image.width,image.height)}var repeat="no-repeat";if(repeatX===true&&repeatY===true){repeat="repeat"}else{if(repeatX===true){repeat="repeat-x"}else{if(repeatY===true){repeat="repeat-y"}}}var pattern=_context.createPattern(canvas,repeat);if(texture.onUpdate){texture.onUpdate(texture)
|
||||
}return{canvas:pattern,version:texture.version}}function patternPath(x0,y0,x1,y1,x2,y2,u0,v0,u1,v1,u2,v2,texture){var pattern=_patterns[texture.id];if(pattern===undefined||pattern.version!==texture.version){pattern=textureToPattern(texture);_patterns[texture.id]=pattern}if(pattern.canvas!==undefined){setFillStyle(pattern.canvas)}else{setFillStyle("rgba( 0, 0, 0, 1)");_context.fill();return}var a,b,c,d,e,f,det,idet,offsetX=texture.offset.x/texture.repeat.x,offsetY=texture.offset.y/texture.repeat.y,width=texture.image.width*texture.repeat.x,height=texture.image.height*texture.repeat.y;u0=(u0+offsetX)*width;v0=(v0+offsetY)*height;u1=(u1+offsetX)*width;v1=(v1+offsetY)*height;u2=(u2+offsetX)*width;v2=(v2+offsetY)*height;x1-=x0;y1-=y0;x2-=x0;y2-=y0;u1-=u0;v1-=v0;u2-=u0;v2-=v0;det=u1*v2-u2*v1;if(det===0){return}idet=1/det;a=(v2*x1-v1*x2)*idet;b=(v2*y1-v1*y2)*idet;c=(u1*x2-u2*x1)*idet;d=(u1*y2-u2*y1)*idet;e=x0-a*u0-c*v0;f=y0-b*u0-d*v0;_context.save();_context.transform(a,b,c,d,e,f);_context.fill();_context.restore()}function clipImage(x0,y0,x1,y1,x2,y2,u0,v0,u1,v1,u2,v2,image){var a,b,c,d,e,f,det,idet,width=image.width-1,height=image.height-1;u0*=width;v0*=height;u1*=width;v1*=height;u2*=width;v2*=height;x1-=x0;y1-=y0;x2-=x0;y2-=y0;u1-=u0;v1-=v0;u2-=u0;v2-=v0;det=u1*v2-u2*v1;idet=1/det;a=(v2*x1-v1*x2)*idet;b=(v2*y1-v1*y2)*idet;c=(u1*x2-u2*x1)*idet;d=(u1*y2-u2*y1)*idet;e=x0-a*u0-c*v0;f=y0-b*u0-d*v0;_context.save();_context.transform(a,b,c,d,e,f);_context.clip();_context.drawImage(image,0,0);_context.restore()}function expand(v1,v2,pixels){var x=v2.x-v1.x,y=v2.y-v1.y,det=x*x+y*y,idet;if(det===0){return}idet=pixels/Math.sqrt(det);x*=idet;y*=idet;v2.x+=x;v2.y+=y;v1.x-=x;v1.y-=y}function setOpacity(value){if(_contextGlobalAlpha!==value){_context.globalAlpha=value;_contextGlobalAlpha=value}}function setBlending(value){if(_contextGlobalCompositeOperation!==value){if(value===THREE.NormalBlending){_context.globalCompositeOperation="source-over"}else{if(value===THREE.AdditiveBlending){_context.globalCompositeOperation="lighter"
|
||||
}else{if(value===THREE.SubtractiveBlending){_context.globalCompositeOperation="darker"}else{if(value===THREE.MultiplyBlending){_context.globalCompositeOperation="multiply"}}}}_contextGlobalCompositeOperation=value}}function setLineWidth(value){if(_contextLineWidth!==value){_context.lineWidth=value;_contextLineWidth=value}}function setLineCap(value){if(_contextLineCap!==value){_context.lineCap=value;_contextLineCap=value}}function setLineJoin(value){if(_contextLineJoin!==value){_context.lineJoin=value;_contextLineJoin=value}}function setStrokeStyle(value){if(_contextStrokeStyle!==value){_context.strokeStyle=value;_contextStrokeStyle=value}}function setFillStyle(value){if(_contextFillStyle!==value){_context.fillStyle=value;_contextFillStyle=value}}function setLineDash(value){if(_contextLineDash.length!==value.length){_context.setLineDash(value);_contextLineDash=value}}};
|
859
themes/next/source/lib/three/three.min.js
vendored
Normal file
9
themes/next/source/lib/ua-parser-js/dist/ua-parser.min.js
vendored
Normal file
9
themes/next/source/lib/ua-parser-js/dist/ua-parser.pack.js
vendored
Normal file
50
themes/next/source/lib/velocity/.bower.json
Normal file
@ -0,0 +1,50 @@
|
||||
{
|
||||
"name": "velocity",
|
||||
"version": "1.2.2",
|
||||
"homepage": "http://velocityjs.org",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Julian Shapiro",
|
||||
"homepage": "http://julian.com/"
|
||||
}
|
||||
],
|
||||
"description": "Accelerated JavaScript animation.",
|
||||
"main": [
|
||||
"./velocity.js",
|
||||
"./velocity.ui.js"
|
||||
],
|
||||
"keywords": [
|
||||
"animation",
|
||||
"jquery",
|
||||
"animate",
|
||||
"lightweight",
|
||||
"smooth",
|
||||
"ui",
|
||||
"velocity.js",
|
||||
"velocityjs",
|
||||
"javascript"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"*.json",
|
||||
"!/bower.json",
|
||||
"LICENSE",
|
||||
"*.md"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": "*"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/julianshapiro/velocity.git"
|
||||
},
|
||||
"_release": "1.2.2",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "1.2.2",
|
||||
"commit": "6b227928631aab5694255df3c219736c4c02449d"
|
||||
},
|
||||
"_source": "git://github.com/julianshapiro/velocity.git",
|
||||
"_target": "~1.2.1",
|
||||
"_originalSource": "velocity"
|
||||
}
|
38
themes/next/source/lib/velocity/bower.json
Normal file
@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "velocity",
|
||||
"version": "1.2.2",
|
||||
"homepage": "http://velocityjs.org",
|
||||
"authors": [
|
||||
{ "name" : "Julian Shapiro",
|
||||
"homepage" : "http://julian.com/"
|
||||
}
|
||||
],
|
||||
"description": "Accelerated JavaScript animation.",
|
||||
"main": [ "./velocity.js", "./velocity.ui.js"],
|
||||
"keywords": [
|
||||
"animation",
|
||||
"jquery",
|
||||
"animate",
|
||||
"lightweight",
|
||||
"smooth",
|
||||
"ui",
|
||||
"velocity.js",
|
||||
"velocityjs",
|
||||
"javascript"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"*.json",
|
||||
"!/bower.json",
|
||||
"LICENSE",
|
||||
"*.md"
|
||||
],
|
||||
"dependencies": {
|
||||
"jquery": "*"
|
||||
},
|
||||
"repository" :
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "http://github.com/julianshapiro/velocity.git"
|
||||
}
|
||||
}
|
3868
themes/next/source/lib/velocity/velocity.js
Normal file
4
themes/next/source/lib/velocity/velocity.min.js
vendored
Normal file
762
themes/next/source/lib/velocity/velocity.ui.js
Normal file
@ -0,0 +1,762 @@
|
||||
/**********************
|
||||
Velocity UI Pack
|
||||
**********************/
|
||||
|
||||
/* VelocityJS.org UI Pack (5.0.4). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License. Portions copyright Daniel Eden, Christian Pucci. */
|
||||
|
||||
;(function (factory) {
|
||||
/* CommonJS module. */
|
||||
if (typeof require === "function" && typeof exports === "object" ) {
|
||||
module.exports = factory();
|
||||
/* AMD module. */
|
||||
} else if (typeof define === "function" && define.amd) {
|
||||
define([ "velocity" ], factory);
|
||||
/* Browser globals. */
|
||||
} else {
|
||||
factory();
|
||||
}
|
||||
}(function() {
|
||||
return function (global, window, document, undefined) {
|
||||
|
||||
/*************
|
||||
Checks
|
||||
*************/
|
||||
|
||||
if (!global.Velocity || !global.Velocity.Utilities) {
|
||||
window.console && console.log("Velocity UI Pack: Velocity must be loaded first. Aborting.");
|
||||
return;
|
||||
} else {
|
||||
var Velocity = global.Velocity,
|
||||
$ = Velocity.Utilities;
|
||||
}
|
||||
|
||||
var velocityVersion = Velocity.version,
|
||||
requiredVersion = { major: 1, minor: 1, patch: 0 };
|
||||
|
||||
function greaterSemver (primary, secondary) {
|
||||
var versionInts = [];
|
||||
|
||||
if (!primary || !secondary) { return false; }
|
||||
|
||||
$.each([ primary, secondary ], function(i, versionObject) {
|
||||
var versionIntsComponents = [];
|
||||
|
||||
$.each(versionObject, function(component, value) {
|
||||
while (value.toString().length < 5) {
|
||||
value = "0" + value;
|
||||
}
|
||||
versionIntsComponents.push(value);
|
||||
});
|
||||
|
||||
versionInts.push(versionIntsComponents.join(""))
|
||||
});
|
||||
|
||||
return (parseFloat(versionInts[0]) > parseFloat(versionInts[1]));
|
||||
}
|
||||
|
||||
if (greaterSemver(requiredVersion, velocityVersion)){
|
||||
var abortError = "Velocity UI Pack: You need to update Velocity (jquery.velocity.js) to a newer version. Visit http://github.com/julianshapiro/velocity.";
|
||||
alert(abortError);
|
||||
throw new Error(abortError);
|
||||
}
|
||||
|
||||
/************************
|
||||
Effect Registration
|
||||
************************/
|
||||
|
||||
/* Note: RegisterUI is a legacy name. */
|
||||
Velocity.RegisterEffect = Velocity.RegisterUI = function (effectName, properties) {
|
||||
/* Animate the expansion/contraction of the elements' parent's height for In/Out effects. */
|
||||
function animateParentHeight (elements, direction, totalDuration, stagger) {
|
||||
var totalHeightDelta = 0,
|
||||
parentNode;
|
||||
|
||||
/* Sum the total height (including padding and margin) of all targeted elements. */
|
||||
$.each(elements.nodeType ? [ elements ] : elements, function(i, element) {
|
||||
if (stagger) {
|
||||
/* Increase the totalDuration by the successive delay amounts produced by the stagger option. */
|
||||
totalDuration += i * stagger;
|
||||
}
|
||||
|
||||
parentNode = element.parentNode;
|
||||
|
||||
$.each([ "height", "paddingTop", "paddingBottom", "marginTop", "marginBottom"], function(i, property) {
|
||||
totalHeightDelta += parseFloat(Velocity.CSS.getPropertyValue(element, property));
|
||||
});
|
||||
});
|
||||
|
||||
/* Animate the parent element's height adjustment (with a varying duration multiplier for aesthetic benefits). */
|
||||
Velocity.animate(
|
||||
parentNode,
|
||||
{ height: (direction === "In" ? "+" : "-") + "=" + totalHeightDelta },
|
||||
{ queue: false, easing: "ease-in-out", duration: totalDuration * (direction === "In" ? 0.6 : 1) }
|
||||
);
|
||||
}
|
||||
|
||||
/* Register a custom redirect for each effect. */
|
||||
Velocity.Redirects[effectName] = function (element, redirectOptions, elementsIndex, elementsSize, elements, promiseData) {
|
||||
var finalElement = (elementsIndex === elementsSize - 1);
|
||||
|
||||
if (typeof properties.defaultDuration === "function") {
|
||||
properties.defaultDuration = properties.defaultDuration.call(elements, elements);
|
||||
} else {
|
||||
properties.defaultDuration = parseFloat(properties.defaultDuration);
|
||||
}
|
||||
|
||||
/* Iterate through each effect's call array. */
|
||||
for (var callIndex = 0; callIndex < properties.calls.length; callIndex++) {
|
||||
var call = properties.calls[callIndex],
|
||||
propertyMap = call[0],
|
||||
redirectDuration = (redirectOptions.duration || properties.defaultDuration || 1000),
|
||||
durationPercentage = call[1],
|
||||
callOptions = call[2] || {},
|
||||
opts = {};
|
||||
|
||||
/* Assign the whitelisted per-call options. */
|
||||
opts.duration = redirectDuration * (durationPercentage || 1);
|
||||
opts.queue = redirectOptions.queue || "";
|
||||
opts.easing = callOptions.easing || "ease";
|
||||
opts.delay = parseFloat(callOptions.delay) || 0;
|
||||
opts._cacheValues = callOptions._cacheValues || true;
|
||||
|
||||
/* Special processing for the first effect call. */
|
||||
if (callIndex === 0) {
|
||||
/* If a delay was passed into the redirect, combine it with the first call's delay. */
|
||||
opts.delay += (parseFloat(redirectOptions.delay) || 0);
|
||||
|
||||
if (elementsIndex === 0) {
|
||||
opts.begin = function() {
|
||||
/* Only trigger a begin callback on the first effect call with the first element in the set. */
|
||||
redirectOptions.begin && redirectOptions.begin.call(elements, elements);
|
||||
|
||||
var direction = effectName.match(/(In|Out)$/);
|
||||
|
||||
/* Make "in" transitioning elements invisible immediately so that there's no FOUC between now
|
||||
and the first RAF tick. */
|
||||
if ((direction && direction[0] === "In") && propertyMap.opacity !== undefined) {
|
||||
$.each(elements.nodeType ? [ elements ] : elements, function(i, element) {
|
||||
Velocity.CSS.setPropertyValue(element, "opacity", 0);
|
||||
});
|
||||
}
|
||||
|
||||
/* Only trigger animateParentHeight() if we're using an In/Out transition. */
|
||||
if (redirectOptions.animateParentHeight && direction) {
|
||||
animateParentHeight(elements, direction[0], redirectDuration + opts.delay, redirectOptions.stagger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the user isn't overriding the display option, default to "auto" for "In"-suffixed transitions. */
|
||||
if (redirectOptions.display !== null) {
|
||||
if (redirectOptions.display !== undefined && redirectOptions.display !== "none") {
|
||||
opts.display = redirectOptions.display;
|
||||
} else if (/In$/.test(effectName)) {
|
||||
/* Inline elements cannot be subjected to transforms, so we switch them to inline-block. */
|
||||
var defaultDisplay = Velocity.CSS.Values.getDisplayType(element);
|
||||
opts.display = (defaultDisplay === "inline") ? "inline-block" : defaultDisplay;
|
||||
}
|
||||
}
|
||||
|
||||
if (redirectOptions.visibility && redirectOptions.visibility !== "hidden") {
|
||||
opts.visibility = redirectOptions.visibility;
|
||||
}
|
||||
}
|
||||
|
||||
/* Special processing for the last effect call. */
|
||||
if (callIndex === properties.calls.length - 1) {
|
||||
/* Append promise resolving onto the user's redirect callback. */
|
||||
function injectFinalCallbacks () {
|
||||
if ((redirectOptions.display === undefined || redirectOptions.display === "none") && /Out$/.test(effectName)) {
|
||||
$.each(elements.nodeType ? [ elements ] : elements, function(i, element) {
|
||||
Velocity.CSS.setPropertyValue(element, "display", "none");
|
||||
});
|
||||
}
|
||||
|
||||
redirectOptions.complete && redirectOptions.complete.call(elements, elements);
|
||||
|
||||
if (promiseData) {
|
||||
promiseData.resolver(elements || element);
|
||||
}
|
||||
}
|
||||
|
||||
opts.complete = function() {
|
||||
if (properties.reset) {
|
||||
for (var resetProperty in properties.reset) {
|
||||
var resetValue = properties.reset[resetProperty];
|
||||
|
||||
/* Format each non-array value in the reset property map to [ value, value ] so that changes apply
|
||||
immediately and DOM querying is avoided (via forcefeeding). */
|
||||
/* Note: Don't forcefeed hooks, otherwise their hook roots will be defaulted to their null values. */
|
||||
if (Velocity.CSS.Hooks.registered[resetProperty] === undefined && (typeof resetValue === "string" || typeof resetValue === "number")) {
|
||||
properties.reset[resetProperty] = [ properties.reset[resetProperty], properties.reset[resetProperty] ];
|
||||
}
|
||||
}
|
||||
|
||||
/* So that the reset values are applied instantly upon the next rAF tick, use a zero duration and parallel queueing. */
|
||||
var resetOptions = { duration: 0, queue: false };
|
||||
|
||||
/* Since the reset option uses up the complete callback, we trigger the user's complete callback at the end of ours. */
|
||||
if (finalElement) {
|
||||
resetOptions.complete = injectFinalCallbacks;
|
||||
}
|
||||
|
||||
Velocity.animate(element, properties.reset, resetOptions);
|
||||
/* Only trigger the user's complete callback on the last effect call with the last element in the set. */
|
||||
} else if (finalElement) {
|
||||
injectFinalCallbacks();
|
||||
}
|
||||
};
|
||||
|
||||
if (redirectOptions.visibility === "hidden") {
|
||||
opts.visibility = redirectOptions.visibility;
|
||||
}
|
||||
}
|
||||
|
||||
Velocity.animate(element, propertyMap, opts);
|
||||
}
|
||||
};
|
||||
|
||||
/* Return the Velocity object so that RegisterUI calls can be chained. */
|
||||
return Velocity;
|
||||
};
|
||||
|
||||
/*********************
|
||||
Packaged Effects
|
||||
*********************/
|
||||
|
||||
/* Externalize the packagedEffects data so that they can optionally be modified and re-registered. */
|
||||
/* Support: <=IE8: Callouts will have no effect, and transitions will simply fade in/out. IE9/Android 2.3: Most effects are fully supported, the rest fade in/out. All other browsers: full support. */
|
||||
Velocity.RegisterEffect.packagedEffects =
|
||||
{
|
||||
/* Animate.css */
|
||||
"callout.bounce": {
|
||||
defaultDuration: 550,
|
||||
calls: [
|
||||
[ { translateY: -30 }, 0.25 ],
|
||||
[ { translateY: 0 }, 0.125 ],
|
||||
[ { translateY: -15 }, 0.125 ],
|
||||
[ { translateY: 0 }, 0.25 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"callout.shake": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { translateX: -11 }, 0.125 ],
|
||||
[ { translateX: 11 }, 0.125 ],
|
||||
[ { translateX: -11 }, 0.125 ],
|
||||
[ { translateX: 11 }, 0.125 ],
|
||||
[ { translateX: -11 }, 0.125 ],
|
||||
[ { translateX: 11 }, 0.125 ],
|
||||
[ { translateX: -11 }, 0.125 ],
|
||||
[ { translateX: 0 }, 0.125 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"callout.flash": {
|
||||
defaultDuration: 1100,
|
||||
calls: [
|
||||
[ { opacity: [ 0, "easeInOutQuad", 1 ] }, 0.25 ],
|
||||
[ { opacity: [ 1, "easeInOutQuad" ] }, 0.25 ],
|
||||
[ { opacity: [ 0, "easeInOutQuad" ] }, 0.25 ],
|
||||
[ { opacity: [ 1, "easeInOutQuad" ] }, 0.25 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"callout.pulse": {
|
||||
defaultDuration: 825,
|
||||
calls: [
|
||||
[ { scaleX: 1.1, scaleY: 1.1 }, 0.50, { easing: "easeInExpo" } ],
|
||||
[ { scaleX: 1, scaleY: 1 }, 0.50 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"callout.swing": {
|
||||
defaultDuration: 950,
|
||||
calls: [
|
||||
[ { rotateZ: 15 }, 0.20 ],
|
||||
[ { rotateZ: -10 }, 0.20 ],
|
||||
[ { rotateZ: 5 }, 0.20 ],
|
||||
[ { rotateZ: -5 }, 0.20 ],
|
||||
[ { rotateZ: 0 }, 0.20 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"callout.tada": {
|
||||
defaultDuration: 1000,
|
||||
calls: [
|
||||
[ { scaleX: 0.9, scaleY: 0.9, rotateZ: -3 }, 0.10 ],
|
||||
[ { scaleX: 1.1, scaleY: 1.1, rotateZ: 3 }, 0.10 ],
|
||||
[ { scaleX: 1.1, scaleY: 1.1, rotateZ: -3 }, 0.10 ],
|
||||
[ "reverse", 0.125 ],
|
||||
[ "reverse", 0.125 ],
|
||||
[ "reverse", 0.125 ],
|
||||
[ "reverse", 0.125 ],
|
||||
[ "reverse", 0.125 ],
|
||||
[ { scaleX: 1, scaleY: 1, rotateZ: 0 }, 0.20 ]
|
||||
]
|
||||
},
|
||||
"transition.fadeIn": {
|
||||
defaultDuration: 500,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ] } ]
|
||||
]
|
||||
},
|
||||
"transition.fadeOut": {
|
||||
defaultDuration: 500,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ] } ]
|
||||
]
|
||||
},
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.flipXIn": {
|
||||
defaultDuration: 700,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformPerspective: [ 800, 800 ], rotateY: [ 0, -55 ] } ]
|
||||
],
|
||||
reset: { transformPerspective: 0 }
|
||||
},
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.flipXOut": {
|
||||
defaultDuration: 700,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformPerspective: [ 800, 800 ], rotateY: 55 } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, rotateY: 0 }
|
||||
},
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.flipYIn": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformPerspective: [ 800, 800 ], rotateX: [ 0, -45 ] } ]
|
||||
],
|
||||
reset: { transformPerspective: 0 }
|
||||
},
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.flipYOut": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformPerspective: [ 800, 800 ], rotateX: 25 } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, rotateX: 0 }
|
||||
},
|
||||
/* Animate.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.flipBounceXIn": {
|
||||
defaultDuration: 900,
|
||||
calls: [
|
||||
[ { opacity: [ 0.725, 0 ], transformPerspective: [ 400, 400 ], rotateY: [ -10, 90 ] }, 0.50 ],
|
||||
[ { opacity: 0.80, rotateY: 10 }, 0.25 ],
|
||||
[ { opacity: 1, rotateY: 0 }, 0.25 ]
|
||||
],
|
||||
reset: { transformPerspective: 0 }
|
||||
},
|
||||
/* Animate.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.flipBounceXOut": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 0.9, 1 ], transformPerspective: [ 400, 400 ], rotateY: -10 }, 0.50 ],
|
||||
[ { opacity: 0, rotateY: 90 }, 0.50 ]
|
||||
],
|
||||
reset: { transformPerspective: 0, rotateY: 0 }
|
||||
},
|
||||
/* Animate.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.flipBounceYIn": {
|
||||
defaultDuration: 850,
|
||||
calls: [
|
||||
[ { opacity: [ 0.725, 0 ], transformPerspective: [ 400, 400 ], rotateX: [ -10, 90 ] }, 0.50 ],
|
||||
[ { opacity: 0.80, rotateX: 10 }, 0.25 ],
|
||||
[ { opacity: 1, rotateX: 0 }, 0.25 ]
|
||||
],
|
||||
reset: { transformPerspective: 0 }
|
||||
},
|
||||
/* Animate.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.flipBounceYOut": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 0.9, 1 ], transformPerspective: [ 400, 400 ], rotateX: -15 }, 0.50 ],
|
||||
[ { opacity: 0, rotateX: 90 }, 0.50 ]
|
||||
],
|
||||
reset: { transformPerspective: 0, rotateX: 0 }
|
||||
},
|
||||
/* Magic.css */
|
||||
"transition.swoopIn": {
|
||||
defaultDuration: 850,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformOriginX: [ "100%", "50%" ], transformOriginY: [ "100%", "100%" ], scaleX: [ 1, 0 ], scaleY: [ 1, 0 ], translateX: [ 0, -700 ], translateZ: 0 } ]
|
||||
],
|
||||
reset: { transformOriginX: "50%", transformOriginY: "50%" }
|
||||
},
|
||||
/* Magic.css */
|
||||
"transition.swoopOut": {
|
||||
defaultDuration: 850,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformOriginX: [ "50%", "100%" ], transformOriginY: [ "100%", "100%" ], scaleX: 0, scaleY: 0, translateX: -700, translateZ: 0 } ]
|
||||
],
|
||||
reset: { transformOriginX: "50%", transformOriginY: "50%", scaleX: 1, scaleY: 1, translateX: 0 }
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3. (Fades and scales only.) */
|
||||
"transition.whirlIn": {
|
||||
defaultDuration: 850,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformOriginX: [ "50%", "50%" ], transformOriginY: [ "50%", "50%" ], scaleX: [ 1, 0 ], scaleY: [ 1, 0 ], rotateY: [ 0, 160 ] }, 1, { easing: "easeInOutSine" } ]
|
||||
]
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3. (Fades and scales only.) */
|
||||
"transition.whirlOut": {
|
||||
defaultDuration: 750,
|
||||
calls: [
|
||||
[ { opacity: [ 0, "easeInOutQuint", 1 ], transformOriginX: [ "50%", "50%" ], transformOriginY: [ "50%", "50%" ], scaleX: 0, scaleY: 0, rotateY: 160 }, 1, { easing: "swing" } ]
|
||||
],
|
||||
reset: { scaleX: 1, scaleY: 1, rotateY: 0 }
|
||||
},
|
||||
"transition.shrinkIn": {
|
||||
defaultDuration: 750,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformOriginX: [ "50%", "50%" ], transformOriginY: [ "50%", "50%" ], scaleX: [ 1, 1.5 ], scaleY: [ 1, 1.5 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.shrinkOut": {
|
||||
defaultDuration: 600,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformOriginX: [ "50%", "50%" ], transformOriginY: [ "50%", "50%" ], scaleX: 1.3, scaleY: 1.3, translateZ: 0 } ]
|
||||
],
|
||||
reset: { scaleX: 1, scaleY: 1 }
|
||||
},
|
||||
"transition.expandIn": {
|
||||
defaultDuration: 700,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformOriginX: [ "50%", "50%" ], transformOriginY: [ "50%", "50%" ], scaleX: [ 1, 0.625 ], scaleY: [ 1, 0.625 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.expandOut": {
|
||||
defaultDuration: 700,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformOriginX: [ "50%", "50%" ], transformOriginY: [ "50%", "50%" ], scaleX: 0.5, scaleY: 0.5, translateZ: 0 } ]
|
||||
],
|
||||
reset: { scaleX: 1, scaleY: 1 }
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceIn": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], scaleX: [ 1.05, 0.3 ], scaleY: [ 1.05, 0.3 ] }, 0.40 ],
|
||||
[ { scaleX: 0.9, scaleY: 0.9, translateZ: 0 }, 0.20 ],
|
||||
[ { scaleX: 1, scaleY: 1 }, 0.50 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceOut": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { scaleX: 0.95, scaleY: 0.95 }, 0.35 ],
|
||||
[ { scaleX: 1.1, scaleY: 1.1, translateZ: 0 }, 0.35 ],
|
||||
[ { opacity: [ 0, 1 ], scaleX: 0.3, scaleY: 0.3 }, 0.30 ]
|
||||
],
|
||||
reset: { scaleX: 1, scaleY: 1 }
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceUpIn": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateY: [ -30, 1000 ] }, 0.60, { easing: "easeOutCirc" } ],
|
||||
[ { translateY: 10 }, 0.20 ],
|
||||
[ { translateY: 0 }, 0.20 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceUpOut": {
|
||||
defaultDuration: 1000,
|
||||
calls: [
|
||||
[ { translateY: 20 }, 0.20 ],
|
||||
[ { opacity: [ 0, "easeInCirc", 1 ], translateY: -1000 }, 0.80 ]
|
||||
],
|
||||
reset: { translateY: 0 }
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceDownIn": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateY: [ 30, -1000 ] }, 0.60, { easing: "easeOutCirc" } ],
|
||||
[ { translateY: -10 }, 0.20 ],
|
||||
[ { translateY: 0 }, 0.20 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceDownOut": {
|
||||
defaultDuration: 1000,
|
||||
calls: [
|
||||
[ { translateY: -20 }, 0.20 ],
|
||||
[ { opacity: [ 0, "easeInCirc", 1 ], translateY: 1000 }, 0.80 ]
|
||||
],
|
||||
reset: { translateY: 0 }
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceLeftIn": {
|
||||
defaultDuration: 750,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateX: [ 30, -1250 ] }, 0.60, { easing: "easeOutCirc" } ],
|
||||
[ { translateX: -10 }, 0.20 ],
|
||||
[ { translateX: 0 }, 0.20 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceLeftOut": {
|
||||
defaultDuration: 750,
|
||||
calls: [
|
||||
[ { translateX: 30 }, 0.20 ],
|
||||
[ { opacity: [ 0, "easeInCirc", 1 ], translateX: -1250 }, 0.80 ]
|
||||
],
|
||||
reset: { translateX: 0 }
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceRightIn": {
|
||||
defaultDuration: 750,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateX: [ -30, 1250 ] }, 0.60, { easing: "easeOutCirc" } ],
|
||||
[ { translateX: 10 }, 0.20 ],
|
||||
[ { translateX: 0 }, 0.20 ]
|
||||
]
|
||||
},
|
||||
/* Animate.css */
|
||||
"transition.bounceRightOut": {
|
||||
defaultDuration: 750,
|
||||
calls: [
|
||||
[ { translateX: -30 }, 0.20 ],
|
||||
[ { opacity: [ 0, "easeInCirc", 1 ], translateX: 1250 }, 0.80 ]
|
||||
],
|
||||
reset: { translateX: 0 }
|
||||
},
|
||||
"transition.slideUpIn": {
|
||||
defaultDuration: 900,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateY: [ 0, 20 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.slideUpOut": {
|
||||
defaultDuration: 900,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], translateY: -20, translateZ: 0 } ]
|
||||
],
|
||||
reset: { translateY: 0 }
|
||||
},
|
||||
"transition.slideDownIn": {
|
||||
defaultDuration: 900,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateY: [ 0, -20 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.slideDownOut": {
|
||||
defaultDuration: 900,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], translateY: 20, translateZ: 0 } ]
|
||||
],
|
||||
reset: { translateY: 0 }
|
||||
},
|
||||
"transition.slideLeftIn": {
|
||||
defaultDuration: 1000,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateX: [ 0, -20 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.slideLeftOut": {
|
||||
defaultDuration: 1050,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], translateX: -20, translateZ: 0 } ]
|
||||
],
|
||||
reset: { translateX: 0 }
|
||||
},
|
||||
"transition.slideRightIn": {
|
||||
defaultDuration: 1000,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateX: [ 0, 20 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.slideRightOut": {
|
||||
defaultDuration: 1050,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], translateX: 20, translateZ: 0 } ]
|
||||
],
|
||||
reset: { translateX: 0 }
|
||||
},
|
||||
"transition.slideUpBigIn": {
|
||||
defaultDuration: 850,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateY: [ 0, 75 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.slideUpBigOut": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], translateY: -75, translateZ: 0 } ]
|
||||
],
|
||||
reset: { translateY: 0 }
|
||||
},
|
||||
"transition.slideDownBigIn": {
|
||||
defaultDuration: 850,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateY: [ 0, -75 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.slideDownBigOut": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], translateY: 75, translateZ: 0 } ]
|
||||
],
|
||||
reset: { translateY: 0 }
|
||||
},
|
||||
"transition.slideLeftBigIn": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateX: [ 0, -75 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.slideLeftBigOut": {
|
||||
defaultDuration: 750,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], translateX: -75, translateZ: 0 } ]
|
||||
],
|
||||
reset: { translateX: 0 }
|
||||
},
|
||||
"transition.slideRightBigIn": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], translateX: [ 0, 75 ], translateZ: 0 } ]
|
||||
]
|
||||
},
|
||||
"transition.slideRightBigOut": {
|
||||
defaultDuration: 750,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], translateX: 75, translateZ: 0 } ]
|
||||
],
|
||||
reset: { translateX: 0 }
|
||||
},
|
||||
/* Magic.css */
|
||||
"transition.perspectiveUpIn": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformPerspective: [ 800, 800 ], transformOriginX: [ 0, 0 ], transformOriginY: [ "100%", "100%" ], rotateX: [ 0, -180 ] } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, transformOriginX: "50%", transformOriginY: "50%" }
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.perspectiveUpOut": {
|
||||
defaultDuration: 850,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformPerspective: [ 800, 800 ], transformOriginX: [ 0, 0 ], transformOriginY: [ "100%", "100%" ], rotateX: -180 } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, transformOriginX: "50%", transformOriginY: "50%", rotateX: 0 }
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.perspectiveDownIn": {
|
||||
defaultDuration: 800,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformPerspective: [ 800, 800 ], transformOriginX: [ 0, 0 ], transformOriginY: [ 0, 0 ], rotateX: [ 0, 180 ] } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, transformOriginX: "50%", transformOriginY: "50%" }
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.perspectiveDownOut": {
|
||||
defaultDuration: 850,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformPerspective: [ 800, 800 ], transformOriginX: [ 0, 0 ], transformOriginY: [ 0, 0 ], rotateX: 180 } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, transformOriginX: "50%", transformOriginY: "50%", rotateX: 0 }
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.perspectiveLeftIn": {
|
||||
defaultDuration: 950,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformPerspective: [ 2000, 2000 ], transformOriginX: [ 0, 0 ], transformOriginY: [ 0, 0 ], rotateY: [ 0, -180 ] } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, transformOriginX: "50%", transformOriginY: "50%" }
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.perspectiveLeftOut": {
|
||||
defaultDuration: 950,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformPerspective: [ 2000, 2000 ], transformOriginX: [ 0, 0 ], transformOriginY: [ 0, 0 ], rotateY: -180 } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, transformOriginX: "50%", transformOriginY: "50%", rotateY: 0 }
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.perspectiveRightIn": {
|
||||
defaultDuration: 950,
|
||||
calls: [
|
||||
[ { opacity: [ 1, 0 ], transformPerspective: [ 2000, 2000 ], transformOriginX: [ "100%", "100%" ], transformOriginY: [ 0, 0 ], rotateY: [ 0, 180 ] } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, transformOriginX: "50%", transformOriginY: "50%" }
|
||||
},
|
||||
/* Magic.css */
|
||||
/* Support: Loses rotation in IE9/Android 2.3 (fades only). */
|
||||
"transition.perspectiveRightOut": {
|
||||
defaultDuration: 950,
|
||||
calls: [
|
||||
[ { opacity: [ 0, 1 ], transformPerspective: [ 2000, 2000 ], transformOriginX: [ "100%", "100%" ], transformOriginY: [ 0, 0 ], rotateY: 180 } ]
|
||||
],
|
||||
reset: { transformPerspective: 0, transformOriginX: "50%", transformOriginY: "50%", rotateY: 0 }
|
||||
}
|
||||
};
|
||||
|
||||
/* Register the packaged effects. */
|
||||
for (var effectName in Velocity.RegisterEffect.packagedEffects) {
|
||||
Velocity.RegisterEffect(effectName, Velocity.RegisterEffect.packagedEffects[effectName]);
|
||||
}
|
||||
|
||||
/*********************
|
||||
Sequence Running
|
||||
**********************/
|
||||
|
||||
/* Note: Sequence calls must use Velocity's single-object arguments syntax. */
|
||||
Velocity.RunSequence = function (originalSequence) {
|
||||
var sequence = $.extend(true, [], originalSequence);
|
||||
|
||||
if (sequence.length > 1) {
|
||||
$.each(sequence.reverse(), function(i, currentCall) {
|
||||
var nextCall = sequence[i + 1];
|
||||
|
||||
if (nextCall) {
|
||||
/* Parallel sequence calls (indicated via sequenceQueue:false) are triggered
|
||||
in the previous call's begin callback. Otherwise, chained calls are normally triggered
|
||||
in the previous call's complete callback. */
|
||||
var currentCallOptions = currentCall.o || currentCall.options,
|
||||
nextCallOptions = nextCall.o || nextCall.options;
|
||||
|
||||
var timing = (currentCallOptions && currentCallOptions.sequenceQueue === false) ? "begin" : "complete",
|
||||
callbackOriginal = nextCallOptions && nextCallOptions[timing],
|
||||
options = {};
|
||||
|
||||
options[timing] = function() {
|
||||
var nextCallElements = nextCall.e || nextCall.elements;
|
||||
var elements = nextCallElements.nodeType ? [ nextCallElements ] : nextCallElements;
|
||||
|
||||
callbackOriginal && callbackOriginal.call(elements, elements);
|
||||
Velocity(currentCall);
|
||||
}
|
||||
|
||||
if (nextCall.o) {
|
||||
nextCall.o = $.extend({}, nextCallOptions, options);
|
||||
} else {
|
||||
nextCall.options = $.extend({}, nextCallOptions, options);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sequence.reverse();
|
||||
}
|
||||
|
||||
Velocity(sequence[0]);
|
||||
};
|
||||
}((window.jQuery || window.Zepto || window), window, document);
|
||||
}));
|