Initial commit: Complete workspace configuration

- MOper/ configurations
- home-assistant/ configurations
- scripts/ automation scripts
- unix/ system configurations
- docker/ Docker services (app, devtools, database, infra, maintenance, portainer, supervision, test)

Excludes: databases, logs, large files, Git submodules, secrets (via .gitignore)
This commit is contained in:
2026-01-02 16:09:32 +00:00
commit 07377e5237
6048 changed files with 1248288 additions and 0 deletions

View File

@@ -0,0 +1,291 @@
/* General
---------------------------------------- */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
}
p, blockquote, q, pre, address, hr, code, samp,
dl, ol, ul, form, table, fieldset, menu {
margin-bottom: 1.5em;
}
/* Structure
---------------------------------------- */
html {
font-size: 100%;
}
/*
body {
font-family: arial, helvetica, sans-serif;
font-size: .875em;
}
*/
/* Text
---------------------------------------- */
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
}
h1 {
font-size: 3em;
line-height: 1.1;
margin-bottom: .238em;
}
h2 {
font-size: 2em;
line-height: 1.15;
margin-bottom: .357em;
}
h3 {
font-size: 1.5em;
line-height: 1.2;
margin-bottom: .476em;
}
h4, h5, h6 {
margin-bottom: .571em;
}
h4 {
font-size: 1.25em;
line-height: 1.25;
}
h5 {
font-size: 1em;
}
h6 {
font-size: 1em;
}
em, i {
font-style: italic;
}
strong, b {
font-weight: bold;
}
blockquote, q, cite {
font-style: italic;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: "";
content: none;
}
code, kbd, pre, samp, tt {
font-family: "andale mono", consolas, monaco, "lucida console", "courier new", courier, monospace;
line-height: 1.3;
}
pre {
/* word-wrap: break-word; */
white-space: pre-wrap;
}
abbr, acronym, dfn {
border-bottom: 1px dotted;
cursor: help;
font-variant: normal;
font-style: normal;
}
var {
font-style: normal;
}
center {
text-align: center;
}
/* Hypertext
---------------------------------------- */
/*
a:link {
}
a:visited {
}
a:hover {
}
a:active {
}
a:focus {
outline: 1px dotted;
}
*/
/* Image
---------------------------------------- */
img {
border: 0;
}
/* List
---------------------------------------- */
ul {
list-style: disc outside none;
}
ol {
list-style: decimal outside none;
}
li {
margin-left: 2em;
}
li ul, li ol {
margin-bottom: 0;
}
dt {
font-weight: bold;
}
dd {
margin-bottom: 1em;
}
/* Presentation
---------------------------------------- */
hr {
border: 0;
border-bottom: 1px solid;
}
big {
font-size: 1.25em;
}
small, sub, sup {
font-size: .85em;
}
sub, sup {
line-height: 1;
}
sub {
vertical-align: bottom;
}
sup {
vertical-align: top;
}
del, s, strike {
text-decoration: line-through;
}
ins {
text-decoration: none;
border-bottom: 1px dotted;
}
bdo {
border-bottom: 1px dotted;
}
u {
text-decoration: underline;
}
/* Form
---------------------------------------- */
fieldset {
padding: 1em;
}
legend {
font-weight: bold;
padding: 0 .25em;
}
input, textarea, select, button {
font-family: inherit;
font-size: 1em;
}
input[type=button], input[type=file], input[type=image], input[type=reset], input[type=submit],
button[type=button], button[type=reset], button[type=submit] {
cursor: pointer;
line-height: 1;
}
/*
input[type=text], input[type=password], textarea {
padding: 1px;
}
*/
textarea {
text-align: left;
line-height: 1.25;
}
/* Table
---------------------------------------- */
table {
border-collapse: collapse;
border-spacing: 0;
border: 0;
line-height: 1.3;
}
caption, th, td {
text-align: left;
vertical-align: top;
}
th, td {
padding: .5em 1em;
border: 1px solid;
}
caption {
padding-bottom: 1em;
}
th {
font-weight: bold;
}
/* Classes
---------------------------------------- */
ul.nolist, ul.nolist li {
display:block;
list-style:none;
padding:0;
margin:0;
}
.clear {
clear:both;
}

View File

@@ -0,0 +1,63 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Diagrams</title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<link href="http://fonts.googleapis.com/css?family=Cabin+Sketch:bold" rel="stylesheet" type="text/css" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/raphael.js" type="text/javascript"></script>
<script src="js/init.js" type="text/javascript"></script>
</head>
<body>
<div id="content">
<div class="legend">
<h1>Legend:</h1>
<div class="skills">
<ul>
<li class="jq">JavaScript</li>
<li class="css">CSS3</li>
<li class="html">HTML5</li>
<li class="php">PHP</li>
<li class="sql">MySQL</li>
</ul>
</div>
</div>
<div id="diagram"></div>
</div>
<div class="footer">
<div class="inside">
<a href="http://playground.mobily.pl">Marcin Dziewulski</a> for <a href="http://tympanus.net/codrops/2011/04/22/animated-skills-diagram/">Codrops</a>
</div>
</div>
<div class="get">
<div class="arc">
<span class="text">JavaScript</span>
<input type="hidden" class="percent" value="95" />
<input type="hidden" class="color" value="#97BE0D" />
</div>
<div class="arc">
<span class="text">CSS3</span>
<input type="hidden" class="percent" value="90" />
<input type="hidden" class="color" value="#D84F5F" />
</div>
<div class="arc">
<span class="text">HTML5</span>
<input type="hidden" class="percent" value="80" />
<input type="hidden" class="color" value="#88B8E6" />
</div>
<div class="arc">
<span class="text">PHP</span>
<input type="hidden" class="percent" value="53" />
<input type="hidden" class="color" value="#BEDBE9" />
</div>
<div class="arc">
<span class="text">MySQL</span>
<input type="hidden" class="percent" value="45" />
<input type="hidden" class="color" value="#EDEBEE" />
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,62 @@
var o = {
init: function(){
this.diagram();
},
random: function(l, u){
return Math.floor((Math.random()*(u-l+1))+l);
},
diagram: function(){
var r = Raphael('diagram', 250, 250),
rad = 73,
defaultText = 'Sales',
speed = 250;
r.circle(125, 125, 75).attr({ stroke: 'none', fill: '#193340' });
var title = r.text(125, 125, defaultText).attr({
font: '20px Arial',
fill: '#fff'
}).toFront();
r.customAttributes.arc = function(value, color, rad){
var v = 3.6*value,
alpha = v == 360 ? 359.99 : v,
random = o.random(91, 240),
a = (random-alpha) * Math.PI/180,
b = random * Math.PI/180,
sx = 125 + rad * Math.cos(b),
sy = 125 - rad * Math.sin(b),
x = 125 + rad * Math.cos(a),
y = 125 - rad * Math.sin(a),
path = [['M', sx, sy], ['A', rad, rad, 0, +(alpha > 180), 1, x, y]];
return { path: path, stroke: color }
}
$('.get').find('.arc').each(function(i){
var t = $(this),
color = t.find('.color').val(),
value = t.find('.percent').val(),
text = t.find('.text').text();
rad += 9;
var z = r.path().attr({ arc: [value, color, rad], 'stroke-width': 8 });
z.mouseover(function(){
this.animate({ 'stroke-width': 25, opacity: .75 }, 1000, 'elastic');
if(Raphael.type != 'VML') //solves IE problem
this.toFront();
title.stop().animate({ opacity: 0 }, speed, '>', function(){
this.attr({ text: text + '\n' + value + '%' }).animate({ opacity: 1 }, speed, '<');
});
}).mouseout(function(){
this.stop().animate({ 'stroke-width': 10, opacity: 1 }, speed*4, 'elastic');
title.stop().animate({ opacity: 0 }, speed, '>', function(){
title.attr({ text: defaultText }).animate({ opacity: 1 }, speed, '<');
});
});
});
}
}
$(function(){ o.init(); });

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,99 @@
/* Header */
.large-header {
position: relative;
width: 100%;
background: #333;
overflow: hidden;
background-size: cover;
background-position: center center;
z-index: 1;
}
.demo-1 .large-header {
background-image: url('../img/demo-1-bg.jpg');
}
.demo-3 .large-header {
background: #7f8c8d;
}
.demo-4 .large-header {
background: #f9f1e9;
}
.main-title {
position: absolute;
margin: 0;
padding: 0;
color: #f9f1e9;
text-align: center;
top: 50%;
left: 50%;
-webkit-transform: translate3d(-50%,-50%,0);
transform: translate3d(-50%,-50%,0);
}
.demo-1 .main-title,
.demo-3 .main-title {
text-transform: uppercase;
font-size: 4.2em;
letter-spacing: 0.1em;
}
.demo-2 .main-title {
font-family: 'Clicker Script', cursive;
font-weight: normal;
font-size: 8em;
padding-left: 10px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}
.demo-2 .main-title::before {
content: '';
width: 20vw;
height: 20vw;
min-width: 3.5em;
min-height: 3.5em;
background: url(../img/deco.svg) no-repeat center center;
background-size: cover;
position: absolute;
top: 50%;
left: 50%;
border-radius: 50%;
z-index: -1;
-webkit-transform: translate3d(-50%,-50%,0);
transform: translate3d(-50%,-50%,0);
}
.demo-3 .main-title {
padding: 10px 40px;
border: 10px double #f9f1e9;
text-transform: uppercase;
font-family: Londrina Outline, sans-serif;
}
.demo-4 .main-title {
font-size: 6em;
font-weight: 300;
padding: 10px 30px;
text-transform: uppercase;
color: #222;
}
.main-title .thin {
font-weight: 200;
}
@media only screen and (max-width : 768px) {
.demo-1 .main-title,
.demo-3 .main-title,
.demo-4 .main-title {
font-size: 3em;
}
.demo-2 .main-title {
font-size: 4em;
}
}

View File

@@ -0,0 +1,195 @@
@font-face {
font-weight: normal;
font-style: normal;
font-family: 'codropsicons';
src:url('../fonts/codropsicons/codropsicons.eot');
src:url('../fonts/codropsicons/codropsicons.eot?#iefix') format('embedded-opentype'),
url('../fonts/codropsicons/codropsicons.woff') format('woff'),
url('../fonts/codropsicons/codropsicons.ttf') format('truetype'),
url('../fonts/codropsicons/codropsicons.svg#codropsicons') format('svg');
}
*, *:after, *:before { -webkit-box-sizing: border-box; box-sizing: border-box; }
.clearfix:before, .clearfix:after { content: ''; display: table; }
.clearfix:after { clear: both; }
body {
background: #fff;
color: #383a3c;
font-weight: 400;
font-size: 1em;
line-height: 1.25;
font-family: 'Raleway', Calibri, Arial, sans-serif;
}
a, button {
outline: none;
}
a {
color: #566473;
text-decoration: none;
}
a:hover, a:focus {
color: #34495e;
}
section {
padding: 1em;
text-align: center;
}
p.ref {
text-align: center;
padding: 2em 1em;
}
/* Header */
.codrops-header {
margin: 0 auto;
padding: 2em;
text-align: center;
max-width: 900px;
}
.codrops-header h1 {
margin: 0;
font-size: 4.5em;
line-height: 1;
font-weight: 200;
}
.codrops-header h1 span {
display: block;
padding: 1em 0 1.5em;
font-size: 36%;
color: #95a5a6;
line-height: 1.4;
}
/* To Navigation Style */
.codrops-top {
width: 100%;
text-transform: uppercase;
font-weight: 700;
font-size: 0.69em;
text-align: center;
padding: 3em 0;
}
.codrops-top a {
display: inline-block;
padding: 1.5em;
text-decoration: none;
letter-spacing: 1px;
}
.codrops-icon:before {
margin: 0 4px;
text-transform: none;
font-weight: normal;
font-style: normal;
font-variant: normal;
font-family: 'codropsicons';
line-height: 1;
speak: none;
-webkit-font-smoothing: antialiased;
}
.codrops-icon-drop:before {
content: "\e001";
}
.codrops-icon-prev:before {
content: "\e004";
}
/* Demo Buttons Style */
.codrops-demos {
padding-top: 1em;
font-size: 0.8em;
}
.codrops-demos a {
display: inline-block;
margin: 0.35em 0.1em;
padding: 0.5em 1.2em;
outline: none;
text-decoration: none;
text-transform: uppercase;
letter-spacing: 1px;
font-weight: 700;
border-radius: 2px;
font-size: 110%;
border: 2px solid transparent;
}
.codrops-demos a:hover,
.codrops-demos a.current-demo {
border-color: #383a3c;
}
.codrops-demos h3 {
margin: 0;
padding: 1em 0 0.5em 0;
font-size: 0.9em;
float: left;
min-width: 90px;
clear: left;
}
.codrops-demos div:not(:first-child) h3 {
padding-top: 2em;
}
.codrops-demos a:hover,
.codrops-demos a.current-demo {
color: inherit;
border-color: initial;
}
/* Related demos */
.related {
padding: 10em 0;
}
.related p {
font-size: 1.5em;
}
.related > a {
display: inline-block;
text-align: center;
margin: 20px 10px;
padding: 25px;
vertical-align: middle;
}
.related a img {
max-width: 100%;
opacity: 0.8;
border-radius: 10px;
}
.related a:hover img,
.related a:active img {
opacity: 1;
}
.related a h3 {
margin: 0;
min-height: 63px;
padding: 0.5em 0 0.3em;
max-width: 300px;
text-align: center;
font-weight: 400;
font-size: 1em;
}
@media screen and (max-width: 40em) {
.codrops-header h1 {
font-size: 2.5em;
}
}

View File

@@ -0,0 +1 @@
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden]{display:none;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em 0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C" "\201D" "\2018" "\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:0;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;}

View File

@@ -0,0 +1,290 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<filter id="dropShadow">
<feGaussianBlur in="SourceAlpha" stdDeviation="0.5" result="blur"/>
<feOffset in="blur" dx="0.5" dy="0.5" result="offsetBlur"/>
<feFlood flood-color="#00000" flood-opacity="0.5" result="offsetColor"/>
<feComposite in="offsetColor" in2="offsetBlur" operator="in" result="offsetBlur"/>
<feMerge>
<feMergeNode />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<g filter="url(#dropShadow)" opacity="0.5">
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M36.437,8.695c-0.004-0.002-0.007-0.001-0.013-0.005
c0.002-0.003,0.005-0.005,0.008-0.009L36.437,8.695z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M14.296,49.683c-0.007,0-0.015-0.002-0.021-0.001
c0-0.008-0.001-0.016-0.003-0.024c0.011,0.004,0.015,0.01,0.025,0.015C14.296,49.676,14.297,49.68,14.296,49.683z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M14.296,49.683c-0.119,0.727,0.42,1.239,0.632,1.854
c0.197,0.568,0.39,1.11,0.265,1.797c-0.562-0.302-0.922-0.615-1.13-1.251c-0.368-1.116-0.707-2.245-1.404-3.257
c-0.48-0.694-0.929-1.119-1.774-1.153c-0.504-0.021-0.965-0.228-1.407-0.521c-0.402-0.264-0.807-0.279-0.801,0.448
c0.007,0.904-0.036,1.8,0.104,2.7c0.185,1.173,0.857,1.795,1.96,2.167c1.075,0.361,2.147,0.643,3.267,0.849
c1.31,0.238,1.756,1.412,2.009,2.558c0.581,2.613,1.627,5.013,3,7.306c0.99,1.648,1.868,3.369,2.716,5.099
c1.045,2.129,2.436,3.96,4.168,5.587c1.229,1.155,2.461,2.32,4.089,2.761c1.282,0.346,2.234,1.157,3.485,1.78
c-0.698,0.24-1.249,0.092-1.799-0.021c-1.768-0.366-3.531-0.711-5.133-1.63c-1.472-0.847-2.56-2.118-3.774-3.248
c-2.155-2.003-4.508-3.714-7.107-5.107c-1.491-0.799-3.044-1.531-4.346-2.624c-1.228-1.034-2.01-2.427-2.594-3.917
c-0.163-0.417-0.302-0.839-0.849-1.027c0.541,1.819,1.443,3.384,2.667,4.78c-0.05,0.05-0.102,0.1-0.151,0.148
c-2.53-1.421-5.062-2.842-7.592-4.262c-0.026,0.044-0.053,0.088-0.079,0.129c0.95,0.612,1.854,1.318,2.86,1.816
c2.04,1.013,3.84,2.443,5.928,3.356c2.068,0.903,3.962,2.118,5.934,3.196c2.309,1.261,4.178,2.99,6.008,4.814
c1.154,1.152,2.422,2.182,3.848,3.016c-1.376-0.07-2.506-0.772-3.679-1.349c-0.785-0.386-1.554-0.771-2.055-1.576
c-0.203-0.324-0.667-0.518-1.047-0.693c-0.787-0.364-1.598-0.68-2.339-1.164c0.817,1.547,2.603,1.872,3.741,3.024
c1.154,1.171,2.72,1.688,4.265,2.215c-1.053,0.339-2.059,0.567-3.022-0.194c-0.814-0.646-1.849-0.829-2.795-1.191
c-0.608-0.232-1.175,0.055-1.711,0.306c-1.05,0.491-2.077,1.034-3.252,1.186c-0.243,0.031-0.555,0.108-0.604,0.392
c-0.05,0.283,0.206,0.436,0.442,0.546c0.881,0.409,1.632,1.013,2.364,1.633c0.75,0.637,1.624,1.042,2.537,1.337
c0.994,0.32,1.909,0.075,2.636-0.701c0.584-0.622,1.191-1.216,1.965-1.604c0.1-0.05,0.225-0.114,0.265-0.205
c0.7-1.543,2.022-1.113,3.256-1.08c2.162,0.06,4.096,1.244,6.273,1.203c1.458-0.03,2.918-0.033,4.378-0.028
c1.44,0.005,2.843,0.377,4.274,0.479c4.936,0.349,9.624,1.962,14.462,2.81c0.41,0.07,0.83,0.124,1.324,0.199
c-2.916,1.225-5.676,2.616-8.734,3.208c-0.439,0.085-0.875,0.254-1.275,0.46c-0.85,0.442-1.732,0.633-2.688,0.539
c-1.933-0.187-3.875-0.178-5.811-0.127c-1.575,0.039-3.076-0.278-4.522-0.879c2.472,1.695,5.329,0.969,8.152,1.205
c-0.791,1.043-1.653,1.646-2.907,1.733c-1.415,0.102-2.874-0.146-4.236,0.545c-0.259,0.13-0.886,0.371-1.114-0.277
c-0.029-0.08-0.053-0.083-0.157-0.078c-2.637,0.117-5.041-1.056-7.6-1.391c-0.973-0.127-1.952-0.293-2.844-0.764
c-0.094-0.049-0.29,0.101-0.551,0.198c2.992,1.282,6.249,1.228,9.212,2.48c-0.447,0.287-0.889,0.127-1.214,0.23
c3.09,0.754,6.087-0.609,9.371-0.73c-1.71,2.56-4.683,3.281-6.583,5.342c0.34,0.184,0.52-0.072,0.643-0.187
c1.244-1.179,2.809-1.889,4.167-2.898c0.475-0.354,0.997-0.703,1.329-1.174c0.72-1.026,1.762-1.304,2.887-1.489
c1.974-0.322,3.944-0.675,5.748-1.659c-0.042,1.487-0.836,2.529-2.136,2.854c-0.876,0.217-1.592,1.312-1.6,2.452
c-0.002,0.651-0.039,1.307,0.019,1.954c0.113,1.29-0.052,2.512-0.69,3.66c-0.11,0.203-0.417,0.509,0.001,0.714
c0.351,0.173,0.516-0.165,0.676-0.37c0.445-0.58,0.846-1.196,1.474-1.609c0.143-0.092,0.279-0.209,0.437-0.259
c1.114-0.354,1.607-1.011,1.802-2.282c0.241-1.552,0.233-3.099-0.032-4.643c-0.075-0.445,0.233-0.739,0.316-1.107
c0.427-1.955,1.952-2.512,3.591-3.139c1.777-0.681,3.715-0.653,5.442-1.449c1.84-0.846,3.817-0.7,5.745-0.735
c2.884-0.05,5.22-1.151,7.262-3.13c1.311-1.271,2.752-2.406,4.271-3.717c-0.293,1.319-0.898,2.345-1.447,3.382
c-0.279,0.524-0.652,1.017-0.828,1.58c-0.526,1.666-1.821,2.673-2.951,3.892c-1.399,1.513-2.595,3.295-3.07,5.391
c-0.112,0.484-0.624,0.992-0.104,1.635c0.575-2.188,1.502-4.132,3.048-5.659c0.862-0.853,1.473-1.908,2.442-2.677
c0.657-0.521,0.699-1.519,1.158-2.232c0.152-0.235,0.283-0.483,0.455-0.786c0.298,0.464,0.267,0.901,0.142,1.325
c-0.172,0.598-0.331,1.21-0.599,1.768c-1.105,2.303-1.891,4.728-2.804,7.104c-0.228,0.597-0.439,1.202-0.388,1.868
c0.809-2.312,1.807-4.545,2.678-6.828c0.441-1.162,1.216-2.176,1.467-3.431c0.124-0.623,0.114-1.238,0.126-1.861
c0.035-1.808,1.042-3.251,1.845-4.753c1.305-2.446,3.54-4.17,5.08-6.463c2.009-2.99,3.056-6.23,3.205-9.779
c0.041-0.993,0.439-1.868,0.623-2.809c0.371-1.878,0.779-3.744,0.853-5.67c0.075-2.028-0.271-4.01-0.724-5.958
c-0.388-1.668-0.774-3.339-1.134-5.012c-0.336-1.56-0.862-3.045-1.487-4.5c-0.867-2.024-1.691-4.062-2.211-6.223
c0.609,0.584,0.918,1.393,1.538,1.948c1.295,1.156,2.295,2.537,3.236,3.987c0.529,0.819,0.617,1.758,1.004,2.604
c0.911,1.983,1.539,4.074,2.117,6.166c0.676,2.452,1.201,4.948,1.765,7.428c0.229,1.003-0.915,2.614-2.184,3.063
c-0.607,0.216-1.146,0.5-1.522,1.016c-0.551,0.754-0.516,1.871,0.214,2.738c0.825,0.979,1.539,2.025,2.208,3.11
c0.413,0.675,0.689,0.697,1.109,0.027c0.741-1.181,1.694-2.307,1.24-3.892c-0.16-0.557-0.503-1.009-0.728-1.523
c-0.425-0.978-0.789-1.955-0.051-3.057c0.492,0.966,0.959,1.882,1.425,2.795c0.119-0.611-0.128-1.122-0.362-1.622
c-0.569-1.217-0.768-2.506-0.963-3.822c-0.211-1.45-0.594-2.881-0.999-4.295c-0.629-2.201-1.322-4.384-2.022-6.564
c-0.406-1.264-0.882-2.506-1.383-3.928c1.063,0.814,1.765,1.716,2.182,2.835c0.257,0.687,0.485,1.388,0.722,2.081
c0.108-1.238-0.46-2.28-1.004-3.324c-0.363-0.688-0.937-1.229-1.4-1.852c2.036,0.688,3.226,2.226,4.171,4.038
c0.762,1.457,1,3.181,2.254,4.393c0.208-0.171,0.013-0.325-0.055-0.432c-0.896-1.393-1.314-3.004-2.079-4.456
c-0.835-1.587-1.799-3.072-3.542-3.827c-1.944-0.841-3.455-2.127-4.545-3.991c-0.314-0.54-0.649-1.189-1.302-1.587
c-0.575-0.35-0.697-1.133-1.007-1.734c-0.515-1.001-1.021-2.011-1.68-2.935c-0.171-0.238-0.293-0.546-0.269-0.919
c0.5-0.019,0.552,0.396,0.697,0.691c0.634,1.287,1.439,2.41,2.657,3.234c0.777,0.527,1.605,0.644,2.484,0.662
c0.817,0.014,1.638-0.027,2.445,0.069c0.61,0.069,0.666-0.166,0.485-0.605c-0.222-0.549-0.439-1.115-0.761-1.607
c-0.776-1.185-1.596-2.338-2.289-3.573c-0.443-0.789-1.109-0.931-1.936-0.657c-0.884,0.295-1.816,0.464-2.667,0.83
c-1.243,0.532-2.2,0.029-3.048-0.739c-1.377-1.248-2.509-2.74-3.947-3.935c-2.271-1.882-4.499-3.824-6.985-5.425
c-0.882-0.569-1.888-0.889-2.907-1.116c-3.056-0.685-6.073-1.663-9.29-1.196c-1.65,0.241-3.17,0.851-4.675,1.496
c-0.627,0.269-1.171,0.33-1.787,0.052c-3.134-1.407-6.405-1.599-9.714-0.88c-2.964,0.643-5.734,1.768-8.031,3.844
c-0.326,0.293-0.683,0.557-1.101,0.775c0.345-1.137,0.995-2.098,1.622-3.064c1.13-1.746,2.689-3.063,4.347-4.278
c0.195-0.144,0.356-0.336,0.534-0.507c-0.341-0.18-0.408,0.351-0.828,0.262c0.157-0.547,0.155-1.094,0.871-1.336
c0.556-0.19,1.05-0.553,1.596-0.788c0.517-0.223,0.677-0.585,0.52-1.091c-0.237-0.756-0.509-1.5-0.971-2.161
c-0.176-0.252-0.347-0.517-0.47-0.798c-0.375-0.867-0.894-1.078-1.704-0.581c-0.654,0.399-1.223,0.909-1.698,1.52
c-0.255,0.329-0.268,0.648-0.093,1.026c0.347,0.739,0.672,1.479,1.174,2.143c0.675,0.897,0.593,2.283-0.197,2.864
c-2.433,1.79-3.982,4.189-5.161,6.927c-0.563,1.306-1.492,2.449-2.206,3.695c-1.041,1.814-2.05,3.648-3.044,5.488
c-0.323,0.595-0.749,1.057-1.343,1.366c-1.514,0.786-2.899,1.774-4.236,2.814c-0.906,0.704-1.319,1.819-1.832,2.822
c-0.816,1.595-0.997,3.409-1.746,5.044c-1.045,2.284-0.884,4.723-0.671,7.154c0.127,1.478,0.185,2.962,0.261,4.445
C14.662,49.777,14.449,49.689,14.296,49.683z M34.933,3.462c0.062,0.322,0.37,0.547,0.348,0.931
c-0.285,0.023-0.374-0.319-0.695-0.239c0.385,0.512,0.733,0.953,1.056,1.413c0.217,0.308,0.339,0.648,0.216,1.042
c-0.112,0.36-0.219,0.49-0.55,0.15c-0.472-0.483-0.668-1.11-0.962-1.679C33.943,4.291,34.079,3.989,34.933,3.462z M36.244,2.56
c-0.247,0.661-0.049,1.271-0.312,1.857C34.825,3.246,34.841,3.073,36.244,2.56z M37.265,4.63c-0.965-0.097-1.092-0.536-0.704-2.114
c0.378,0.673,0.785,1.32,1.121,2.004c0.711,1.441,0.694,1.454-0.734,2.151c-0.137,0.068-0.249,0.248-0.489,0.109
C36.446,5.992,36.398,5.188,37.265,4.63z M88.169,28.061c-1.65-0.497-2.964-1.556-4.426-2.378c0.51-0.924,1.714-0.231,2.287-0.987
c0.372,0.285,0.502,0.735,0.755,1.101c0.161,0.232,0.342,0.451,0.506,0.677C87.646,26.969,88.072,27.43,88.169,28.061z
M85.225,27.293c0.749,0.646,1.859,0.591,2.611,1.353C86.256,29.062,86.054,28.958,85.225,27.293z M81.69,25.411
c1.357,0.526,2.837,0.875,3.311,2.522c0.06,0.205,0.396,0.36,0.224,0.579c-0.175,0.229-0.494,0.1-0.714,0.013
C83.056,27.956,82.32,26.73,81.69,25.411z M81.088,24.29c1.144-0.516,2.299-0.783,3.449-1.051c0.203-0.047,0.404-0.023,0.564,0.111
c0.103,0.085,0.229,0.211,0.238,0.326c0.015,0.164-0.173,0.195-0.307,0.205c-0.648,0.039-1.152,0.424-1.715,0.683
C82.583,24.907,81.791,25.342,81.088,24.29z M91.409,56.473c1.395,2.402,1.444,2.861,0.499,4.242
C90.437,59.473,91.322,58.014,91.409,56.473z M90.554,58.854c-0.145,0.754,0.11,1.454,0.189,2.278
c-0.452-0.233-0.51-0.634-0.724-0.914C89.466,59.508,89.608,59.141,90.554,58.854z M90.894,55.794
c-0.317,0.407-0.091,0.901-0.261,1.374c-0.196,0.418-0.586,0.687-1.034,0.881c-0.292,0.129-0.577,0.521-0.885,0.307
c-0.335-0.233-0.261-0.718-0.289-1.105c-0.008-0.117,0.117-0.243,0.166-0.37c0.369-0.965,1.374-0.864,2.09-1.244
C90.821,55.561,90.933,55.743,90.894,55.794z M48.991,90.983c-0.342,0.635-0.467,0.7-1.395,0.789
C47.968,91.145,48.02,91.114,48.991,90.983z M47.274,95.099c-0.338-2.184-0.004-2.918,1.261-2.981
C48.137,93.059,47.744,93.989,47.274,95.099z M50.385,87.146c-2.129,1.346-4.574,1.569-7.168,2.076
c0.601-0.819,1.179-1.262,2.019-1.309c0.619-0.034,1.235,0.021,1.859-0.029C48.235,87.793,49.257,87.283,50.385,87.146z
M48.231,94.347c0.625,1.694,0.57,1.99-0.407,2.476c-0.152,0.075-0.339,0.203-0.463,0.082c-0.087-0.086-0.1-0.322-0.055-0.463
C47.532,95.728,47.807,95.032,48.231,94.347z M49.825,91.071c0.301,1.672,0.075,3.265-0.478,4.947
C48.302,94.411,48.546,92.283,49.825,91.071z M16.64,79.462c0.392,0.029,0.615,0.032,0.835,0.068
c1.34,0.21,2.683,0.218,4.026,0.039c0.362-0.048,0.825-0.218,1.051,0.007c0.298,0.298-0.118,0.663-0.241,0.979
c-0.433,1.106-1.469,1.485-2.571,1.087C18.556,81.215,17.7,80.358,16.64,79.462z M18.753,79.069
c-0.876,0.116-1.677,0.003-2.585-0.209C17.57,78.107,17.664,78.117,18.753,79.069z M19.659,78.088
c0.199,0.194,0.413,0.382,0.573,0.606c0.109,0.153,0.47,0.303,0.212,0.524c-0.184,0.159-0.571,0.279-0.752,0.001
c-0.344-0.523-0.98-0.621-1.39-1.083C18.781,77.497,19.222,77.659,19.659,78.088z M22.927,78.933
c-1.627,0.688-2.445-0.588-3.549-1.382c0.184-0.086,0.278-0.16,0.382-0.174c1.305-0.18,2.316,0.598,3.386,1.121
C23.549,78.694,23.176,78.827,22.927,78.933z M24.435,79.613c-0.471,0.348-0.95,0.684-1.524,1.094
c0.024-0.264,0.03-0.396,0.046-0.524c0.105-0.875,0.48-1.163,1.319-1.03c0.15,0.023,0.3,0.053,0.324,0.204
C24.614,79.432,24.516,79.554,24.435,79.613z M9.432,50.377c0.097-0.262,0.448-0.131,0.684-0.188
c0.655-0.157,0.848,0.442,1.206,0.756c0.16,0.141,0.424,0.321,0.323,0.544c-0.125,0.274-0.445,0.32-0.74,0.295
c-0.198-0.019-0.392-0.051-0.675-0.092c-0.146-0.148-0.339-0.35-0.535-0.55C9.484,50.927,9.334,50.634,9.432,50.377z M9.328,48.546
c0.253,0.367,0.809,0.548,0.729,1.055c-0.033,0.202-0.401,0.199-0.583,0.083C9.023,49.4,9.266,48.96,9.328,48.546z M11.666,50.404
c-0.067,0.012-0.172-0.041-0.219-0.097c-0.629-0.735-1.456-1.312-1.846-2.389c0.322,0.099,0.558,0.199,0.802,0.245
c1.633,0.31,1.353,0.413,1.435,1.913C11.846,50.218,11.843,50.375,11.666,50.404z M13.555,52.007
c-1.214-0.733-1.428-1.237-1.182-2.666C13.135,50.068,13.233,51.003,13.555,52.007z M29.383,24.608
c-2.826,2.832-5.265,5.816-7.92,8.624c-0.167-0.238-0.016-0.37,0.048-0.516c0.506-1.164,1.294-2.163,1.905-3.267
C24.715,27.103,26.434,25.242,29.383,24.608z M63.243,76.229c-2.974,1.269-6.117,1.937-9.283,2.342
c-2.976,0.386-5.978-0.121-8.949-0.521c-1.821-0.244-3.584-0.736-5.355-1.254c-2.809-0.821-5.575-1.587-7.917-3.505
c-2.204-1.805-4.241-3.728-5.681-6.202c-1.023-1.757-1.678-3.678-2.309-5.606c-0.892-2.725-2.372-5.181-3.589-7.756
c-0.829-1.756-1.708-3.493-1.874-5.474c-0.315-3.801,0.364-7.46,1.591-11.039c0.688-1.959,2.003-3.473,3.477-4.85
c1.734-1.622,3.667-2.998,5.55-4.441c2.387-1.83,4.828-3.552,7.6-4.722c2.874-1.214,5.348-3.118,8.114-4.514
c2.37-1.199,4.728-2.127,7.5-1.769c2.326,0.298,4.604,0.843,6.93,1.113c1.86,0.213,3.663,0.711,5.38,1.433
c1.172,0.493,2.351,0.931,3.566,1.298c0.798,0.241,1.591,0.592,2.284,1.049c2.547,1.679,4.428,4.062,6.251,6.432
c1.171,1.524,2.442,2.954,3.689,4.405c0.821,0.956,1.453,1.956,1.674,3.16c0.515,2.799,1.027,5.58,0.768,8.485
c-0.275,3.041-0.085,6.117-0.741,9.14c-0.561,2.573-0.929,5.202-2.407,7.466c-0.563,0.861-0.742,1.93-1.379,2.715
c-1.021,1.257-1.758,2.694-2.726,3.978c-0.933,1.237-1.646,2.663-2.79,3.712c-1.522,1.396-3.512,2.092-5.241,3.185
C66.106,75.286,64.62,75.643,63.243,76.229z M69.011,74.854c0.047,0.08,0.092,0.157,0.14,0.237
c-1.007,0.566-1.778,1.536-3.134,1.513C67.015,76.021,68.014,75.438,69.011,74.854z M81.728,56.583
c0.347-1.092,0.538-2.25,1.261-3.2c-0.214,3.988-0.707,7.902-2.832,11.404c-1.191,1.964-2.588,3.739-4.751,5.009
c0.133-0.541,0.391-0.764,0.587-1.037c0.811-1.133,1.788-2.134,2.271-3.52c0.369-1.053,0.531-2.221,1.251-3.13
C80.802,60.481,81.123,58.479,81.728,56.583z M74.574,69.688c1.148-1.656,2.087-3.453,3.319-5.053
C77.453,66.76,75.594,67.945,74.574,69.688z M73.326,23.117c2.909,1.925,5.573,4.07,6.748,7.547
C77.93,28.056,75.518,25.687,73.326,23.117z M59.934,16.683c3.061-0.122,5.43,1.574,7.908,2.984
C65.03,19.156,62.503,17.864,59.934,16.683z M59.715,17.449c-0.699-0.045-1.245-0.035-1.855-0.337
C58.598,16.662,59.111,16.854,59.715,17.449z M52.815,15.801c1.715-0.838,3.005,0.124,4.366,0.611
C55.734,16.542,54.352,16.23,52.815,15.801z M33.629,20.671c-1.927,2.205-4.496,3.218-7.08,4.406
c1.202-2.641,3.676-3.893,5.695-5.574c2.397-1.993,5.378-2.806,8.328-3.618c1.45-0.4,2.913-0.662,4.419-0.663
c0.233,0,0.454-0.027,0.65,0.242c-0.542,0.501-1.206,1.07-1.866,1.058c-1.934-0.031-3.656,0.56-5.405,1.255
C36.613,18.479,34.862,19.259,33.629,20.671z M41.966,17.364c-2.479,1.533-5.084,2.787-7.812,3.791
C36.334,19.027,39.077,18.042,41.966,17.364z M45.669,16.996c0.431,0.007,0.81-0.511,1.351-0.049
c-0.954,0.337-1.764,0.727-2.546,1.181c-2.342,1.357-4.63,2.829-7.056,4.02c-2.879,1.414-5.7,2.874-8.209,4.898
c-0.923,0.743-1.92,1.4-2.882,2.097c0.809-1.301,1.857-2.36,2.898-3.423c1.036-1.058,2.228-1.974,3.401-2.834
c1.436-1.05,3.15-1.759,4.816-2.444c1.28-0.526,2.471-1.199,3.709-1.795C42.603,17.942,43.962,16.966,45.669,16.996z
M45.793,16.118c1.369-0.843,1.369-0.843,3.948-0.038C48.487,16.091,47.232,16.104,45.793,16.118z M48.611,13.541
c-0.696,0.453-1.34,1.246-2.185,1.209c-2.379-0.104-4.671,0.247-6.935,0.925c-2.688,0.807-5.322,1.738-7.619,3.412
c-0.522,0.382-0.955,0.888-1.483,1.26c-1.527,1.079-2.896,2.291-3.918,3.891c-0.344,0.536-0.651,1.158-1.255,1.571
c-0.073-0.366,0.082-0.602,0.234-0.832c0.886-1.348,1.637-2.802,2.326-4.23c1.515-3.146,4.047-5.151,6.933-6.728
c2.101-1.148,4.469-1.66,6.905-1.867c2.319-0.197,4.49,0.26,6.649,0.957C48.462,13.172,48.96,13.315,48.611,13.541z M52.91,15.006
c-1.713,0.888-3.373,0.248-5.083-0.063C48.922,13.456,50.702,13.495,52.91,15.006z M70.805,16.779
c-0.018,0.031-0.037,0.061-0.055,0.091c-0.841-0.298-1.665-0.641-2.52-0.882c-1.435-0.406-2.846-0.875-4.317-1.171
c-2.387-0.475-4.78-0.99-7.189-0.479c-1.981,0.419-3.789,0.197-5.559-0.697c-0.158-0.079-0.431-0.06-0.412-0.334
c0.006-0.086,0.123-0.196,0.215-0.235c2.356-0.991,4.755-1.692,7.373-1.458c1.7,0.152,3.297,0.724,4.96,0.999
c1.738,0.287,3.272,1.017,4.774,1.871c0.189,0.109,0.563,0.235,0.485,0.408c-0.33,0.731,0.321,0.592,0.611,0.782
C69.722,16.036,70.263,16.411,70.805,16.779z M60.02,83.903c-0.91,0.584-1.765,0.68-2.658,0.59
C58.16,84.144,58.956,83.771,60.02,83.903z M47.907,80.456c0.618-0.526,1.214-0.242,1.771-0.215
c2.358,0.117,4.654-0.249,6.981-0.606c3.232-0.496,6.479-0.801,9.626-1.804c2.687-0.856,5.163-2.032,7.3-3.891
c1.916-1.666,3.825-3.345,5.755-4.997c1.349-1.153,2.329-2.573,3.161-4.114c-1.197,1.606-2.537,3.06-4.057,4.374
c-2.26,1.954-4.365,4.091-6.871,5.748c-1.264,0.833-2.612,1.498-4.08,1.915c1.064-0.812,2.133-1.595,3.015-2.592
c0.451-0.507,0.875-1.047,1.474-1.386c1.261-0.71,2.364-1.639,3.53-2.48c2.411-1.737,4.295-3.912,5.616-6.556
c1.594-3.197,2.063-6.682,2.291-10.177c0.145-2.209,0.486-4.407,0.325-6.65c-0.11-1.501,0.41-3.051,0.257-4.539
c-0.41-3.975-1.354-7.805-3.002-11.509c-1.672-3.765-4.362-6.531-7.689-8.652c-3.137-1.995-6.26-4.057-9.717-5.519
c-1.341-0.568-2.699-0.968-4.109-0.709c-1.446,0.265-2.474-0.674-3.735-0.918c1.105-0.401,2.216-0.505,3.344-0.45
c2.777,0.135,5.461,0.71,8.114,1.551c1.933,0.613,3.789,1.343,5.458,2.482c4.089,2.792,6.541,6.845,8.524,11.242
c0.906,2.012,1.396,4.167,2.109,6.241c0.973,2.836,1.88,5.674,2.336,8.637c0.303,1.978,0.47,3.968,0.193,5.971
c-0.044,0.324-0.142,0.666,0.005,1.087c0.611-2.182,0.418-4.319,0.411-6.439c1.516,4.229,1.168,8.442,0.12,12.766
c-0.772-0.829-0.457-1.771-0.64-2.816c-0.341,0.913-0.292,1.621-0.282,2.325c0.026,1.657-0.011,3.26-1.421,4.509
c-0.555,0.494-0.848,1.282-1.26,1.938c0.96-0.808,1.441-1.981,2.421-2.922c-0.002,2.038-0.555,3.776-1.093,5.535
c-0.675,2.196-2.25,3.771-3.532,5.553c-0.558,0.775-1.209,1.454-1.895,2.133c-2.146,2.121-4.396,4.128-6.636,6.145
c-1.109,0.998-2.566,0.7-3.203-0.637c-0.156-0.33-0.331-0.658-0.528-0.966c-0.114-0.178-0.244-0.381-0.537-0.296
c-1.264,0.354-2.651,0.316-3.744,1.201c-0.176,0.143-0.459,0.288-0.359,0.518c0.263,0.599,0.513,1.235,0.933,1.718
c0.299,0.345,0.611,0.898,1.212,0.816c1.176-0.161,2.4-0.363,3.3-1.159c0.504-0.446,0.786-0.376,1.276-0.072
c-0.536,0.496-1.176,0.727-1.814,0.926c-2.704,0.849-5.492,0.642-8.232,0.397c-3.254-0.292-6.401-1.287-9.621-1.841
C49.782,81.113,48.897,80.752,47.907,80.456z M68.631,81.229c0.201,0.133,0.185,0.258-0.03,0.363
c-0.847,0.412-1.724,0.733-2.675,0.758c-0.382,0.01-0.557-0.238-0.669-0.531c0.069-0.077,0.088-0.097,0.107-0.119
C65.803,81.14,68.008,80.82,68.631,81.229z M68.26,80.792c-0.092-0.023-0.217-0.108-0.245-0.193
c-0.123-0.402-0.299-0.772-0.622-1.16c0.668,0.038,1.163,0.639,1.053,1.145C68.422,80.689,68.403,80.827,68.26,80.792z
M66.39,80.505c-0.399-0.349-0.939-0.035-1.479-0.381c0.591-0.326,1.108-0.711,1.693-0.13c0.114,0.114,0.179,0.306,0.085,0.458
C66.65,80.513,66.44,80.55,66.39,80.505z M43.278,78.457c1.3,0.205,2.598,0.41,3.897,0.613
C45.773,79.415,44.5,79.012,43.278,78.457z M34.085,79.378c-1.095,0.15-1.167,0.134-1.807-0.385
C32.9,78.893,33.458,79.019,34.085,79.378z M25.747,73c0.048-0.056,0.095-0.109,0.141-0.163c0.916,0.793,1.831,1.586,2.746,2.38
C27.403,74.79,26.637,73.823,25.747,73z M22.342,67.198c1.023,0.995,2.027,2.011,2.982,3.071c1.367,1.521,2.803,2.926,4.748,3.723
c0.804,0.328,1.577,0.758,2.31,1.227c2.052,1.314,4.342,2.038,6.623,2.802c1.221,0.408,2.448,0.795,3.698,1.1
C32.006,78.378,26.473,74.227,22.342,67.198z M19.343,60.153c3.64,4.887,7.344,9.695,12.08,13.702
c-0.544-0.02-0.806-0.369-1.145-0.557c-2.089-1.152-3.937-2.61-5.469-4.462c-1.346-1.627-2.477-3.416-3.934-4.961
C19.933,62.877,19.639,61.514,19.343,60.153z M18.079,51.119c-0.042-0.2-0.107-0.491,0.162-0.645
c2.257,5.262,5.21,10.19,6.775,15.724c-0.232,0.015-0.314-0.151-0.431-0.269c-1.415-1.428-2.573-3.064-3.786-4.656
c-0.615-0.806-1.17-1.637-1.55-2.593C18.28,56.245,18.595,53.62,18.079,51.119z M17.223,45.035c0.563,3.558,0.522,7.141,0.828,10.7
C15.4,52.328,16.285,48.675,17.223,45.035z M14.825,40.899c0.115-1.585,0.796-3.041,1.299-4.541
c0.897-2.674,1.831-5.298,4.299-6.969c0.79-0.536,1.546-1.174,2.55-1.498c-0.461,1.513-1.343,2.713-1.879,4.077
c-0.797,2.026-1.504,4.085-2.538,6.019c-0.948,1.776-1.629,3.687-2.023,5.654c-0.458,2.291-0.73,4.616-0.882,7.158
c-0.145-0.24-0.208-0.301-0.224-0.375C14.792,47.277,14.594,44.096,14.825,40.899z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M11.911,25.471c-0.274,0.801-0.614,1.578-0.737,2.437
c-0.166,1.171,0.064,2.265,1.062,2.855c2.107,1.251,1.743,3.204,1.624,5.081c-0.071,1.094-0.388,2.163-0.491,3.269
c-0.286,3.072-0.271,6.119,0.417,9.141c0.109,0.482-0.126,1.1,0.486,1.404c-0.157-1.22-0.19-2.474-0.505-3.653
c-0.559-2.086-0.116-4.155-0.123-6.231c-0.006-1.866,0.586-3.625,1.029-5.406c0.311-1.258,1.105-2.302,1.921-3.266
c1.381-1.632,2.339-3.504,3.235-5.407c0.482-1.028,1.206-1.896,1.673-2.934c0.919-2.032,1.612-4.14,2.222-6.287
c-0.754,1.784-1.479,3.581-2.271,5.347c-0.812,1.808-1.815,3.522-2.717,5.286c-0.898,1.753-1.859,3.508-3.424,4.847
c1.454-3.542,3.686-6.735,4.887-10.394c1.198-3.646,2.389-7.293,4.043-10.773c-0.084-0.036-0.169-0.073-0.255-0.109
c-0.801,1.896-1.604,3.792-2.407,5.689c-0.071-0.018-0.144-0.04-0.216-0.06c-0.126-2.17,0.66-4.39-0.287-6.517
c-0.352,0.767,0.016,1.534-0.014,2.304c-0.157,4.077-0.419,8.122-2.223,11.89c-0.925,1.932-1.879,3.851-3.003,5.672
c-0.623,1.009-0.793,2.171-1.354,3.22c-0.135-0.898-0.509-1.874-0.074-2.684c0.981-1.82,0.257-3.341-0.582-4.882
c-0.304-0.56-0.579-1.42-1.245-1.352C11.989,24.02,12.097,24.931,11.911,25.471z M14.058,29.516c-0.47-0.743,0.07-1.217,0.319-1.95
C14.643,28.398,14.412,28.934,14.058,29.516z M11.722,28.761c0.312,0.271,0.604,0.483,0.843,0.74
c0.258,0.277,0.597,0.398,0.901,0.591c0.333,0.21,0.202,0.54,0.072,0.828c-0.059,0.129-0.142,0.22-0.323,0.155
C12.531,30.834,11.75,29.685,11.722,28.761z M11.931,27.114c0.159-0.362,0.251-0.281,0.539-0.121
c1.014,0.569,0.828,1.541,1.018,2.625c-0.495-0.364-0.808-0.639-1.161-0.844C11.595,28.347,11.633,27.79,11.931,27.114z
M12.75,24.774c0.077-0.114,0.167-0.054,0.271,0.02c0.626,0.431,1.029,2.145,0.604,2.915c-0.334-0.915-0.648-1.769-0.947-2.63
C12.648,24.994,12.693,24.857,12.75,24.774z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M41.744,6.95c1.671,0.047,3.291,0.424,4.883,0.88
c0.987,0.283,1.964,0.529,2.983,0.527c1.705-0.005,3.361,0.36,4.98,0.789c1.579,0.42,3.059,0.158,4.584-0.268
c-2.514,0.458-4.919,0.053-7.262-0.921c0.603,0.065,1.207,0.195,1.811,0.185c1.932-0.03,3.902-0.386,5.785-0.112
c2.556,0.372,4.717-0.937,7.104-1.141c0.961-0.082,1.925-0.159,2.878-0.332c-1.643-0.239-3.256-0.172-4.861,0.292
c-1.796,0.518-3.591,1.158-5.591,0.58c0.887-0.703,1.871-1.056,2.883-1.373c-0.924-0.236-1.726,0.193-2.438,0.601
c-1.367,0.785-2.801,1.074-4.312,0.829c-0.602-0.095-0.935,0.3-1.406,0.381c-0.737,0.127-1.461-0.109-2.188-0.183
c-0.772-0.079-1.524-0.324-2.311-0.506c0.325-0.564,0.775-0.534,1.281-0.477c0.917,0.106,1.829,0.295,2.766,0.154
c1.311-0.195,1.971-0.857,2.133-2.199c0.077-0.624-0.082-1.269,0.268-1.878c0.109-0.188-0.206-0.542-0.432-0.468
c-0.8,0.262-1.435-0.173-2.107-0.418c-1.854-0.672-3.431,0.389-3.459,2.357c-0.004,0.281-0.043,0.565-0.054,0.847
c-0.048,1.341-0.847,2.063-2.177,1.959c-0.36-0.027-0.722-0.05-1.086-0.035c1.398,0.353,2.864,0.352,4.416,0.844
c-1.863,0.13-3.511-0.017-5.116-0.547c-1.092-0.361-2.218-0.577-3.359-0.697C42.15,6.599,41.714,6.439,41.744,6.95z M53.306,4.037
c0.606-0.282,1.115-0.519,1.641-0.764C55.052,4.44,54.88,4.525,53.306,4.037z M50.874,6.046c0.787-1.258,1.949-1.296,3.139-1.274
c0.271,0.006,0.611-0.143,0.744,0.207c0.108,0.29-0.113,0.528-0.294,0.746c-0.224,0.27-0.5,0.407-0.854,0.489
C52.7,6.42,51.834,6.244,50.874,6.046z M52.363,2.388c0.51-0.303,1.14,0.104,1.711,0.496c-0.685,0.344-1.162,0.855-1.863,1.034
C52.095,3.355,51.984,2.612,52.363,2.388z M50.212,4.461c-0.078-0.829,0.387-1.62,1.163-1.963c0.143-0.063,0.304-0.247,0.445-0.078
c0.167,0.199,0.113,0.521-0.067,0.614c-0.767,0.401-0.731,1.208-1.01,1.854c-0.092,0.211-0.158,0.421-0.438,0.553
C50.271,5.075,50.24,4.77,50.212,4.461z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M74.953,92.236c0.412,0.476,0.464,1.796,0.141,2.345
c-0.224,0.381-0.515,0.398-0.866,0.286c-0.864-0.275-1.15-1.159-0.739-2.275C73.777,91.806,74.442,91.645,74.953,92.236z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M97.165,44.311c-0.467-0.307-0.772-0.869-0.629-1.28
c0.322-0.743,0.698-0.97,1.062-0.82c0.598,0.245,0.962,1,0.692,1.532C98.063,44.189,97.653,44.632,97.165,44.311z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M6.715,66.896c0.469,0.295,0.888,0.722,0.562,1.465
c-0.176,0.286-0.45,0.651-0.882,0.349c-0.422-0.295-0.876-0.697-0.575-1.316C5.985,67.056,6.257,66.607,6.715,66.896z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M18.098,18.69c-0.185,0.27-0.44,0.416-0.791,0.201
c-0.654-0.401-0.657-0.806,0.018-2.037C18.078,17.265,18.463,18.154,18.098,18.69z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M68.562,10.773c-0.505-0.171-0.556-0.639-0.405-1.048
c0.109-0.309,0.32-0.665,0.712-0.611c0.537,0.345,0.846,0.754,0.619,1.319C69.335,10.816,68.921,10.895,68.562,10.773z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M30.585,86.429c-0.257,0.516-0.569,0.453-0.967,0.265
c-0.39-0.184-0.708-0.448-0.493-0.91c0.178-0.378,0.529-0.48,0.915-0.257C30.362,85.745,30.91,85.775,30.585,86.429z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M36.437,8.695l-0.005-0.013c0.02-0.006,0.04-0.016,0.059-0.022
C36.474,8.672,36.456,8.683,36.437,8.695z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M40.881,6.693c0.348-0.065,0.601,0.086,0.863,0.257l0,0
c0,0,0,0-0.001,0c-0.451-0.113-0.865,0-1.304,0.125c-1.373,0.39-2.605,1.119-3.948,1.584C37.832,7.73,39.259,7.001,40.881,6.693z"
/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M69.723,94.255c0.448,0.184,0.545,0.604,0.387,0.986
c-0.101,0.235-0.362,0.555-0.59,0.404c-0.646-0.341-0.653-0.779-0.551-1.193C69.076,94.022,69.45,94.145,69.723,94.255z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M66.672,90.456c0.346,0.217,0.633,0.542,0.441,0.982
c-0.128,0.296-0.455,0.282-0.749,0.221c-0.257-0.254-0.626-0.479-0.44-0.911C66.053,90.446,66.341,90.247,66.672,90.456z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M95.24,49.88c-0.441-0.173-0.344-0.501-0.274-0.888
c0.185-0.183,0.412-0.434,0.745-0.273c0.429,0.208,0.48,0.647,0.326,1.012C95.902,50.05,95.557,50.005,95.24,49.88z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M22.669,8.025c-0.244-0.1-0.387-0.317-0.296-0.609
c0.303-0.329,0.669-0.547,1.104-0.403c0.206,0.067,0.554,0.393,0.351,0.538C23.5,7.777,23.178,8.234,22.669,8.025z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M3.742,57.999c0.319,0.112,0.486,0.37,0.36,0.66
c-0.154,0.354-0.488,0.394-0.865,0.306c-0.455-0.108-0.194-0.459-0.312-0.721C3.148,57.994,3.403,57.881,3.742,57.999z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M95.795,39.866c-0.227-0.144-0.537-0.376-0.32-0.768
c0.076-0.403,0.391-0.353,0.66-0.296c0.417,0.091,0.419,0.466,0.32,0.74C96.37,39.787,96.081,40.047,95.795,39.866z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M23.358,91.224c-0.003-0.238-0.052-0.606,0.303-0.501
c0.402,0.119,0.375,0.609,0.239,0.862c-0.148,0.279-0.41,0.839-0.765,0.629C22.497,91.835,23.302,91.57,23.358,91.224z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M27.975,8.244c-0.254-0.074-0.324-0.301-0.188-0.547
c0.165-0.303,0.344-0.597,0.815-0.461c0.26,0.167,0.299,0.431,0.164,0.711C28.604,8.28,28.282,8.333,27.975,8.244z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M40.459,97.056c0.37,0.17,0.479,0.509,0.376,0.839
c-0.078,0.253-0.414,0.366-0.648,0.246c-0.312-0.161-0.355-0.486-0.256-0.79C40.04,97.09,40.172,96.924,40.459,97.056z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M59.06,3.6c-0.302-0.06-0.407-0.307-0.302-0.582
c0.119-0.31,0.37-0.476,0.709-0.47c0.273,0.154,0.354,0.37,0.245,0.641C59.597,3.481,59.375,3.661,59.06,3.6z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M72.52,9.846c-0.341-0.136-0.449-0.351-0.357-0.624
c0.086-0.268,0.327-0.436,0.579-0.293c0.215,0.118,0.487,0.301,0.325,0.664C72.932,9.898,72.718,9.905,72.52,9.846z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M91.707,43.885c-0.283-0.856-0.905-1.586-0.936-2.538
C91.367,42.084,91.356,43.054,91.707,43.885z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M90.771,41.348c-0.009-0.012-0.016-0.025-0.025-0.037
c0.002-0.021,0-0.042,0.001-0.065c0.009,0.02,0.016,0.039,0.021,0.057C90.768,41.317,90.771,41.333,90.771,41.348z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M66.126,97.716c0.339,0.07,0.444,0.366,0.421,0.635
c-0.021,0.243-0.265,0.323-0.557,0.223c-0.267-0.11-0.365-0.348-0.315-0.656C65.721,97.643,65.936,97.675,66.126,97.716z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M75.037,90.961c-0.289-0.103-0.424-0.312-0.314-0.588
c0.109-0.268,0.357-0.335,0.606-0.226c0.283,0.152,0.398,0.339,0.266,0.634C75.471,91.058,75.271,91.043,75.037,90.961z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M29.109,94.891c0.281,0.136,0.402,0.407,0.269,0.708
c-0.1,0.227-0.297,0.353-0.546,0.193c-0.226-0.142-0.382-0.333-0.256-0.691C28.739,95.062,28.857,94.771,29.109,94.891z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M20.921,3.004c-0.033,0.645-0.065,1.289-0.099,1.935
C20.563,4.31,20.432,3.639,20.921,3.004z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M22.202,86.873c-0.711-0.003-1.235-0.203-1.616-0.721
C21.091,86.394,21.769,86.245,22.202,86.873z"/>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#F9F1E9" d="M26.197,5.923c0.095,0.586-0.187,1.066-0.473,1.762
C25.597,6.874,25.927,6.407,26.197,5.923z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 KiB

View File

@@ -0,0 +1,12 @@
/*!
* VERSION: beta 1.9.4
* DATE: 2014-07-17
* UPDATES AND DOCS AT: http://www.greensock.com
*
* @license Copyright (c) 2008-2014, GreenSock. All rights reserved.
* This work is subject to the terms at http://www.greensock.com/terms_of_use.html or for
* Club GreenSock members, the software agreement that was issued with your membership.
*
* @author: Jack Doyle, jack@greensock.com
**/
var _gsScope="undefined"!=typeof module&&module.exports&&"undefined"!=typeof global?global:this||window;(_gsScope._gsQueue||(_gsScope._gsQueue=[])).push(function(){"use strict";_gsScope._gsDefine("easing.Back",["easing.Ease"],function(t){var e,i,s,r=_gsScope.GreenSockGlobals||_gsScope,n=r.com.greensock,a=2*Math.PI,o=Math.PI/2,h=n._class,l=function(e,i){var s=h("easing."+e,function(){},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,s},_=t.register||function(){},u=function(t,e,i,s){var r=h("easing."+t,{easeOut:new e,easeIn:new i,easeInOut:new s},!0);return _(r,t),r},c=function(t,e,i){this.t=t,this.v=e,i&&(this.next=i,i.prev=this,this.c=i.v-e,this.gap=i.t-t)},p=function(e,i){var s=h("easing."+e,function(t){this._p1=t||0===t?t:1.70158,this._p2=1.525*this._p1},!0),r=s.prototype=new t;return r.constructor=s,r.getRatio=i,r.config=function(t){return new s(t)},s},f=u("Back",p("BackOut",function(t){return(t-=1)*t*((this._p1+1)*t+this._p1)+1}),p("BackIn",function(t){return t*t*((this._p1+1)*t-this._p1)}),p("BackInOut",function(t){return 1>(t*=2)?.5*t*t*((this._p2+1)*t-this._p2):.5*((t-=2)*t*((this._p2+1)*t+this._p2)+2)})),m=h("easing.SlowMo",function(t,e,i){e=e||0===e?e:.7,null==t?t=.7:t>1&&(t=1),this._p=1!==t?e:0,this._p1=(1-t)/2,this._p2=t,this._p3=this._p1+this._p2,this._calcEnd=i===!0},!0),d=m.prototype=new t;return d.constructor=m,d.getRatio=function(t){var e=t+(.5-t)*this._p;return this._p1>t?this._calcEnd?1-(t=1-t/this._p1)*t:e-(t=1-t/this._p1)*t*t*t*e:t>this._p3?this._calcEnd?1-(t=(t-this._p3)/this._p1)*t:e+(t-e)*(t=(t-this._p3)/this._p1)*t*t*t:this._calcEnd?1:e},m.ease=new m(.7,.7),d.config=m.config=function(t,e,i){return new m(t,e,i)},e=h("easing.SteppedEase",function(t){t=t||1,this._p1=1/t,this._p2=t+1},!0),d=e.prototype=new t,d.constructor=e,d.getRatio=function(t){return 0>t?t=0:t>=1&&(t=.999999999),(this._p2*t>>0)*this._p1},d.config=e.config=function(t){return new e(t)},i=h("easing.RoughEase",function(e){e=e||{};for(var i,s,r,n,a,o,h=e.taper||"none",l=[],_=0,u=0|(e.points||20),p=u,f=e.randomize!==!1,m=e.clamp===!0,d=e.template instanceof t?e.template:null,g="number"==typeof e.strength?.4*e.strength:.4;--p>-1;)i=f?Math.random():1/u*p,s=d?d.getRatio(i):i,"none"===h?r=g:"out"===h?(n=1-i,r=n*n*g):"in"===h?r=i*i*g:.5>i?(n=2*i,r=.5*n*n*g):(n=2*(1-i),r=.5*n*n*g),f?s+=Math.random()*r-.5*r:p%2?s+=.5*r:s-=.5*r,m&&(s>1?s=1:0>s&&(s=0)),l[_++]={x:i,y:s};for(l.sort(function(t,e){return t.x-e.x}),o=new c(1,1,null),p=u;--p>-1;)a=l[p],o=new c(a.x,a.y,o);this._prev=new c(0,0,0!==o.t?o:o.next)},!0),d=i.prototype=new t,d.constructor=i,d.getRatio=function(t){var e=this._prev;if(t>e.t){for(;e.next&&t>=e.t;)e=e.next;e=e.prev}else for(;e.prev&&e.t>=t;)e=e.prev;return this._prev=e,e.v+(t-e.t)/e.gap*e.c},d.config=function(t){return new i(t)},i.ease=new i,u("Bounce",l("BounceOut",function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}),l("BounceIn",function(t){return 1/2.75>(t=1-t)?1-7.5625*t*t:2/2.75>t?1-(7.5625*(t-=1.5/2.75)*t+.75):2.5/2.75>t?1-(7.5625*(t-=2.25/2.75)*t+.9375):1-(7.5625*(t-=2.625/2.75)*t+.984375)}),l("BounceInOut",function(t){var e=.5>t;return t=e?1-2*t:2*t-1,t=1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375,e?.5*(1-t):.5*t+.5})),u("Circ",l("CircOut",function(t){return Math.sqrt(1-(t-=1)*t)}),l("CircIn",function(t){return-(Math.sqrt(1-t*t)-1)}),l("CircInOut",function(t){return 1>(t*=2)?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)})),s=function(e,i,s){var r=h("easing."+e,function(t,e){this._p1=t||1,this._p2=e||s,this._p3=this._p2/a*(Math.asin(1/this._p1)||0)},!0),n=r.prototype=new t;return n.constructor=r,n.getRatio=i,n.config=function(t,e){return new r(t,e)},r},u("Elastic",s("ElasticOut",function(t){return this._p1*Math.pow(2,-10*t)*Math.sin((t-this._p3)*a/this._p2)+1},.3),s("ElasticIn",function(t){return-(this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2))},.3),s("ElasticInOut",function(t){return 1>(t*=2)?-.5*this._p1*Math.pow(2,10*(t-=1))*Math.sin((t-this._p3)*a/this._p2):.5*this._p1*Math.pow(2,-10*(t-=1))*Math.sin((t-this._p3)*a/this._p2)+1},.45)),u("Expo",l("ExpoOut",function(t){return 1-Math.pow(2,-10*t)}),l("ExpoIn",function(t){return Math.pow(2,10*(t-1))-.001}),l("ExpoInOut",function(t){return 1>(t*=2)?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*(t-1)))})),u("Sine",l("SineOut",function(t){return Math.sin(t*o)}),l("SineIn",function(t){return-Math.cos(t*o)+1}),l("SineInOut",function(t){return-.5*(Math.cos(Math.PI*t)-1)})),h("easing.EaseLookup",{find:function(e){return t.map[e]}},!0),_(r.SlowMo,"SlowMo","ease,"),_(i,"RoughEase","ease,"),_(e,"SteppedEase","ease,"),f},!0)}),_gsScope._gsDefine&&_gsScope._gsQueue.pop()();

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,185 @@
(function() {
var width, height, largeHeader, canvas, ctx, points, target, animateHeader = true;
// Main
initHeader();
initAnimation();
addListeners();
function initHeader() {
width = window.innerWidth;
height = window.innerHeight;
target = {x: width/2, y: height/2};
largeHeader = document.getElementById('large-header');
largeHeader.style.height = height+'px';
canvas = document.getElementById('demo-canvas');
canvas.width = width;
canvas.height = height;
ctx = canvas.getContext('2d');
// create points
points = [];
for(var x = 0; x < width; x = x + width/20) {
for(var y = 0; y < height; y = y + height/20) {
var px = x + Math.random()*width/20;
var py = y + Math.random()*height/20;
var p = {x: px, originX: px, y: py, originY: py };
points.push(p);
}
}
// for each point find the 5 closest points
for(var i = 0; i < points.length; i++) {
var closest = [];
var p1 = points[i];
for(var j = 0; j < points.length; j++) {
var p2 = points[j]
if(!(p1 == p2)) {
var placed = false;
for(var k = 0; k < 5; k++) {
if(!placed) {
if(closest[k] == undefined) {
closest[k] = p2;
placed = true;
}
}
}
for(var k = 0; k < 5; k++) {
if(!placed) {
if(getDistance(p1, p2) < getDistance(p1, closest[k])) {
closest[k] = p2;
placed = true;
}
}
}
}
}
p1.closest = closest;
}
// assign a circle to each point
for(var i in points) {
var c = new Circle(points[i], 2+Math.random()*2, 'rgba(255,255,255,0.3)');
points[i].circle = c;
}
}
// Event handling
function addListeners() {
if(!('ontouchstart' in window)) {
window.addEventListener('mousemove', mouseMove);
}
window.addEventListener('scroll', scrollCheck);
window.addEventListener('resize', resize);
}
function mouseMove(e) {
var posx = posy = 0;
if (e.pageX || e.pageY) {
posx = e.pageX;
posy = e.pageY;
}
else if (e.clientX || e.clientY) {
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
target.x = posx;
target.y = posy;
}
function scrollCheck() {
if(document.body.scrollTop > height) animateHeader = false;
else animateHeader = true;
}
function resize() {
width = window.innerWidth;
height = window.innerHeight;
largeHeader.style.height = height+'px';
canvas.width = width;
canvas.height = height;
}
// animation
function initAnimation() {
animate();
for(var i in points) {
shiftPoint(points[i]);
}
}
function animate() {
if(animateHeader) {
ctx.clearRect(0,0,width,height);
for(var i in points) {
// detect points in range
if(Math.abs(getDistance(target, points[i])) < 4000) {
points[i].active = 0.3;
points[i].circle.active = 0.6;
} else if(Math.abs(getDistance(target, points[i])) < 20000) {
points[i].active = 0.1;
points[i].circle.active = 0.3;
} else if(Math.abs(getDistance(target, points[i])) < 40000) {
points[i].active = 0.02;
points[i].circle.active = 0.1;
} else {
points[i].active = 0;
points[i].circle.active = 0;
}
drawLines(points[i]);
points[i].circle.draw();
}
}
requestAnimationFrame(animate);
}
function shiftPoint(p) {
TweenLite.to(p, 1+1*Math.random(), {x:p.originX-50+Math.random()*100,
y: p.originY-50+Math.random()*100, ease:Circ.easeInOut,
onComplete: function() {
shiftPoint(p);
}});
}
// Canvas manipulation
function drawLines(p) {
if(!p.active) return;
for(var i in p.closest) {
ctx.beginPath();
ctx.moveTo(p.x, p.y);
ctx.lineTo(p.closest[i].x, p.closest[i].y);
ctx.strokeStyle = 'rgba(156,217,249,'+ p.active+')';
ctx.stroke();
}
}
function Circle(pos,rad,color) {
var _this = this;
// constructor
(function() {
_this.pos = pos || null;
_this.radius = rad || null;
_this.color = color || null;
})();
this.draw = function() {
if(!_this.active) return;
ctx.beginPath();
ctx.arc(_this.pos.x, _this.pos.y, _this.radius, 0, 2 * Math.PI, false);
ctx.fillStyle = 'rgba(156,217,249,'+ _this.active+')';
ctx.fill();
};
}
// Util
function getDistance(p1, p2) {
return Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2);
}
})();

View File

@@ -0,0 +1,92 @@
(function() {
var width, height, largeHeader, canvas, ctx, circles, target, animateHeader = true;
// Main
initHeader();
addListeners();
function initHeader() {
width = window.innerWidth;
height = 400;
target = {x: 0, y: height};
largeHeader = document.getElementById('banners');
largeHeader.style.height = height+'px';
canvas = document.getElementById('demo-canvas');
canvas.width = width;
canvas.height = height;
ctx = canvas.getContext('2d');
// create particles
circles = [];
for(var x = 0; x < width*0.5; x++) {
var c = new Circle();
circles.push(c);
}
animate();
}
// Event handling
function addListeners() {
window.addEventListener('scroll', scrollCheck);
window.addEventListener('resize', resize);
}
function scrollCheck() {
if(document.body.scrollTop > height) animateHeader = false;
else animateHeader = true;
}
function resize() {
width = window.innerWidth;
height = 460;
largeHeader.style.height = height+'px';
canvas.width = width;
canvas.height = height;
}
function animate() {
if(animateHeader) {
ctx.clearRect(0,0,width,height);
for(var i in circles) {
circles[i].draw();
}
}
requestAnimationFrame(animate);
}
// Canvas manipulation
function Circle() {
var _this = this;
// constructor
(function() {
_this.pos = {};
init();
console.log(_this);
})();
function init() {
_this.pos.x = Math.random()*width;
_this.pos.y = height+Math.random()*100;
_this.alpha = 0.1+Math.random()*0.3;
_this.scale = 0.1+Math.random()*0.3;
_this.velocity = Math.random();
}
this.draw = function() {
if(_this.alpha <= 0) {
init();
}
_this.pos.y -= _this.velocity;
_this.alpha -= 0.0005;
ctx.beginPath();
ctx.arc(_this.pos.x, _this.pos.y, _this.scale*10, 0, 2 * Math.PI, false);
ctx.fillStyle = 'rgba(255,255,255,'+ _this.alpha+')';
ctx.fill();
};
}
})();

View File

@@ -0,0 +1,126 @@
(function() {
var width, height, largeHeader, canvas, ctx, triangles, target, animateHeader = true;
var colors = ['72,35,68', '43,81,102', '66,152,103', '250,178,67', '224,33,48'];
// Main
initHeader();
addListeners();
initAnimation();
function initHeader() {
width = window.innerWidth;
height = window.innerHeight;
target = {x: 0, y: height};
largeHeader = document.getElementById('large-header');
largeHeader.style.height = height+'px';
canvas = document.getElementById('demo-canvas');
canvas.width = width;
canvas.height = height;
ctx = canvas.getContext('2d');
// create particles
triangles = [];
for(var x = 0; x < 480; x++) {
addTriangle(x*10);
}
}
function addTriangle(delay) {
setTimeout(function() {
var t = new Triangle();
triangles.push(t);
tweenTriangle(t);
}, delay);
}
function initAnimation() {
animate();
}
function tweenTriangle(tri) {
var t = Math.random()*(2*Math.PI);
var x = (200+Math.random()*100)*Math.cos(t) + width*0.5;
var y = (200+Math.random()*100)*Math.sin(t) + height*0.5-20;
var time = 4+3*Math.random();
TweenLite.to(tri.pos, time, {x: x,
y: y, ease:Circ.easeOut,
onComplete: function() {
tri.init();
tweenTriangle(tri);
}});
}
// Event handling
function addListeners() {
window.addEventListener('scroll', scrollCheck);
window.addEventListener('resize', resize);
}
function scrollCheck() {
if(document.body.scrollTop > height) animateHeader = false;
else animateHeader = true;
}
function resize() {
width = window.innerWidth;
height = window.innerHeight;
largeHeader.style.height = height+'px';
canvas.width = width;
canvas.height = height;
}
function animate() {
if(animateHeader) {
ctx.clearRect(0,0,width,height);
for(var i in triangles) {
triangles[i].draw();
}
}
requestAnimationFrame(animate);
}
// Canvas manipulation
function Triangle() {
var _this = this;
// constructor
(function() {
_this.coords = [{},{},{}];
_this.pos = {};
init();
})();
function init() {
_this.pos.x = width*0.5;
_this.pos.y = height*0.5-20;
_this.coords[0].x = -10+Math.random()*40;
_this.coords[0].y = -10+Math.random()*40;
_this.coords[1].x = -10+Math.random()*40;
_this.coords[1].y = -10+Math.random()*40;
_this.coords[2].x = -10+Math.random()*40;
_this.coords[2].y = -10+Math.random()*40;
_this.scale = 0.1+Math.random()*0.3;
_this.color = colors[Math.floor(Math.random()*colors.length)];
setTimeout(function() { _this.alpha = 0.8; }, 10);
}
this.draw = function() {
if(_this.alpha >= 0.005) _this.alpha -= 0.005;
else _this.alpha = 0;
ctx.beginPath();
ctx.moveTo(_this.coords[0].x+_this.pos.x, _this.coords[0].y+_this.pos.y);
ctx.lineTo(_this.coords[1].x+_this.pos.x, _this.coords[1].y+_this.pos.y);
ctx.lineTo(_this.coords[2].x+_this.pos.x, _this.coords[2].y+_this.pos.y);
ctx.closePath();
ctx.fillStyle = 'rgba('+_this.color+','+ _this.alpha+')';
ctx.fill();
};
this.init = init;
}
})();

View File

@@ -0,0 +1,100 @@
(function() {
var width, height, largeHeader, canvas, ctx, lines, target, size, animateHeader = true;
// Main
initHeader();
addListeners();
initAnimation();
function initHeader() {
width = window.innerWidth;
height = window.innerHeight;
size = width > height ? height : width;
target = {x: 0, y: height};
largeHeader = document.getElementById('large-header');
largeHeader.style.height = height+'px';
canvas = document.getElementById('demo-canvas');
canvas.width = width;
canvas.height = height;
ctx = canvas.getContext('2d');
// create particles
lines = [];
for(var i = 0; i < 90; i++) {
var l = new Line(Math.random()*360);
lines.push(l);
}
}
function initAnimation() {
animate();
}
// Event handling
function addListeners() {
window.addEventListener('scroll', scrollCheck);
window.addEventListener('resize', resize);
}
function scrollCheck() {
if(document.body.scrollTop > height) animateHeader = false;
else animateHeader = true;
}
function resize() {
width = window.innerWidth;
height = window.innerHeight;
size = width > height ? height : width;
largeHeader.style.height = height+'px';
canvas.width = width;
canvas.height = height;
}
function animate() {
if(animateHeader) {
ctx.clearRect(0,0,width,height);
for(var i in lines) {
lines[i].draw();
}
}
requestAnimationFrame(animate);
}
// Canvas manipulation
function Line(angle) {
var _this = this;
// constructor
(function() {
_this.angle = angle;
})();
this.draw = function() {
var r1 = Math.random()*(size < 400 ? 400 : size)*0.4;
var r2 = Math.random()*(size < 400 ? 400 : size)*0.4;
var x1 = r1*Math.cos(_this.angle*(Math.PI/180)) + width*0.5;
var y1 = r1*Math.sin(_this.angle*(Math.PI/180)) + height*0.48;
var x2 = r2*Math.cos(_this.angle*(Math.PI/180)) + width*0.5;
var y2 = r2*Math.sin(_this.angle*(Math.PI/180)) + height*0.48;
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.strokeStyle = 'rgba(255,193,127,'+(0.5+Math.random()*0.5)+')';
ctx.stroke();
ctx.beginPath();
ctx.arc(x1, y1, 2, 0, 2 * Math.PI, false);
ctx.fillStyle = 'rgba(255,165,70,'+(0.5+Math.random()*0.5)+')';
ctx.fill();
_this.angle += Math.random();
};
}
})();

View File

@@ -0,0 +1,31 @@
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}());

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,269 @@
$( document ).ready(function() {
var ctx1 = document.getElementById("chart1").getContext("2d");
var data1 = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My Second dataset",
fillColor: "rgba(243,245,246,0.9)",
strokeColor: "rgba(243,245,246,0.9)",
pointColor: "rgba(243,245,246,0.9)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(243,245,246,0.9)",
data: [28, 48, 40, 19, 86, 27, 90]
},
{
label: "My First dataset",
fillColor: "rgba(44,171,227,0.8)",
strokeColor: "rgba(44,171,227,0.8)",
pointColor: "rgba(44,171,227,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(44,171,227,1)",
data: [0, 59, 80, 58, 20, 55, 40]
}
]
};
var chart1 = new Chart(ctx1).Line(data1, {
scaleShowGridLines : true,
scaleGridLineColor : "rgba(0,0,0,.005)",
scaleGridLineWidth : 0,
scaleShowHorizontalLines: true,
scaleShowVerticalLines: true,
bezierCurve : true,
bezierCurveTension : 0.4,
pointDot : true,
pointDotRadius : 4,
pointDotStrokeWidth : 1,
pointHitDetectionRadius : 2,
datasetStroke : true,
tooltipCornerRadius: 2,
datasetStrokeWidth : 2,
datasetFill : true,
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",
responsive: true
});
var ctx2 = document.getElementById("chart2").getContext("2d");
var data2 = {
labels: ["January", "February", "March", "April", "May", "June", "July"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(255,118,118,0.8)",
strokeColor: "rgba(255,118,118,0.8)",
highlightFill: "rgba(255,118,118,1)",
highlightStroke: "rgba(255,118,118,1)",
data: [10, 30, 80, 61, 26, 75, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(180,193,215,0.8)",
strokeColor: "rgba(180,193,215,0.8)",
highlightFill: "rgba(180,193,215,1)",
highlightStroke: "rgba(180,193,215,1)",
data: [28, 48, 40, 19, 86, 27, 90]
}
]
};
var chart2 = new Chart(ctx2).Bar(data2, {
scaleBeginAtZero : true,
scaleShowGridLines : true,
scaleGridLineColor : "rgba(0,0,0,.005)",
scaleGridLineWidth : 0,
scaleShowHorizontalLines: true,
scaleShowVerticalLines: true,
barShowStroke : true,
barStrokeWidth : 0,
tooltipCornerRadius: 2,
barDatasetSpacing : 3,
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",
responsive: true
});
var ctx3 = document.getElementById("chart3").getContext("2d");
var data3 = [
{
value: 300,
color:"#2cabe3",
highlight: "#2cabe3",
label: "Blue"
},
{
value: 50,
color: "#edf1f5",
highlight: "#edf1f5",
label: "Light"
},
{
value: 50,
color: "#b4c1d7",
highlight: "#b4c1d7",
label: "Dark"
},
{
value: 50,
color: "#53e69d",
highlight: "#53e69d",
label: "Megna"
},
{
value: 100,
color: "#ff7676",
highlight: "#ff7676",
label: "Orange"
}
];
var myPieChart = new Chart(ctx3).Pie(data3,{
segmentShowStroke : true,
segmentStrokeColor : "#fff",
segmentStrokeWidth : 0,
animationSteps : 100,
tooltipCornerRadius: 0,
animationEasing : "easeOutBounce",
animateRotate : true,
animateScale : false,
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>",
responsive: true
});
var ctx4 = document.getElementById("chart4").getContext("2d");
var data4 = [
{
value: 300,
color:"#2cabe3",
highlight: "#2cabe3",
label: "Blue"
},
{
value: 50,
color: "#53e69d",
highlight: "#53e69d",
label: "Green"
},
{
value: 100,
color: "#ff7676",
highlight: "#ff7676",
label: "Orange"
}
];
var myDoughnutChart = new Chart(ctx4).Doughnut(data4,{
segmentShowStroke : true,
segmentStrokeColor : "#fff",
segmentStrokeWidth : 0,
animationSteps : 100,
tooltipCornerRadius: 2,
animationEasing : "easeOutBounce",
animateRotate : true,
animateScale : false,
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>",
responsive: true
});
var ctx5 = document.getElementById("chart5").getContext("2d");
var data5 = [
{
value: 300,
color:"#2cabe3",
highlight: "#2cabe3",
label: "Blue"
},
{
value: 50,
color: "#53e69d",
highlight: "#53e69d",
label: "Green"
},
{
value: 100,
color: "#ff7676",
highlight: "#ff7676",
label: "Orange"
},
{
value: 40,
color: "#949FB1",
highlight: "#A8B3C5",
label: "Grey"
}
];
var myPolarArea = new Chart(ctx5).PolarArea(data5, {
scaleShowLabelBackdrop : true,
scaleBackdropColor : "rgba(255,255,255,0.75)",
scaleBeginAtZero : true,
scaleBackdropPaddingY : 2,
scaleBackdropPaddingX : 2,
scaleShowLine : true,
segmentShowStroke : true,
segmentStrokeColor : "#fff",
segmentStrokeWidth : 2,
animationSteps : 100,
tooltipCornerRadius: 2,
animationEasing : "easeOutBounce",
animateRotate : true,
animateScale : false,
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>",
responsive: true
});
var ctx6 = document.getElementById("chart6").getContext("2d");
var data6 = {
labels: ["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"],
datasets: [
{
label: "My First dataset",
fillColor: "rgba(44,171,227,0.8)",
strokeColor: "rgba(44,171,227,1)",
pointColor: "rgba(44,171,227,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(19,218,254,1)",
data: [65, 59, 90, 81, 56, 55, 40]
},
{
label: "My Second dataset",
fillColor: "rgba(255,118,118,0.8)",
strokeColor: "rgba(255,118,118,1)",
pointColor: "rgba(255,118,118,1)",
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(255,118,118,1)",
data: [28, 48, 40, 19, 96, 27, 100]
}
]
};
var myRadarChart = new Chart(ctx6).Radar(data6, {
scaleShowLine : true,
angleShowLineOut : true,
scaleShowLabels : false,
scaleBeginAtZero : true,
angleLineColor : "rgba(0,0,0,.1)",
angleLineWidth : 1,
pointLabelFontFamily : "'Arial'",
pointLabelFontStyle : "normal",
pointLabelFontSize : 10,
pointLabelFontColor : "#666",
pointDot : true,
pointDotRadius : 3,
tooltipCornerRadius: 2,
pointDotStrokeWidth : 1,
pointHitDetectionRadius : 20,
datasetStroke : true,
datasetStrokeWidth : 2,
datasetFill : true,
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>",
responsive: true
});
});

View File

@@ -0,0 +1,302 @@
(function(){
"use strict";
var root = this,
Chart = root.Chart,
helpers = Chart.helpers;
var defaultConfig = {
//Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value
scaleBeginAtZero : true,
//Boolean - Whether grid lines are shown across the chart
scaleShowGridLines : true,
//String - Colour of the grid lines
scaleGridLineColor : "rgba(0,0,0,.05)",
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines: true,
//Boolean - If there is a stroke on each bar
barShowStroke : true,
//Number - Pixel width of the bar stroke
barStrokeWidth : 2,
//Number - Spacing between each of the X value sets
barValueSpacing : 5,
//Number - Spacing between data sets within X values
barDatasetSpacing : 1,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].fillColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
};
Chart.Type.extend({
name: "Bar",
defaults : defaultConfig,
initialize: function(data){
//Expose options as a scope variable here so we can access it in the ScaleClass
var options = this.options;
this.ScaleClass = Chart.Scale.extend({
offsetGridLines : true,
calculateBarX : function(datasetCount, datasetIndex, barIndex){
//Reusable method for calculating the xPosition of a given bar based on datasetIndex & width of the bar
var xWidth = this.calculateBaseWidth(),
xAbsolute = this.calculateX(barIndex) - (xWidth/2),
barWidth = this.calculateBarWidth(datasetCount);
return xAbsolute + (barWidth * datasetIndex) + (datasetIndex * options.barDatasetSpacing) + barWidth/2;
},
calculateBaseWidth : function(){
return (this.calculateX(1) - this.calculateX(0)) - (2*options.barValueSpacing);
},
calculateBarWidth : function(datasetCount){
//The padding between datasets is to the right of each bar, providing that there are more than 1 dataset
var baseWidth = this.calculateBaseWidth() - ((datasetCount - 1) * options.barDatasetSpacing);
return (baseWidth / datasetCount);
}
});
this.datasets = [];
//Set up tooltip events on the chart
if (this.options.showTooltips){
helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
var activeBars = (evt.type !== 'mouseout') ? this.getBarsAtEvent(evt) : [];
this.eachBars(function(bar){
bar.restore(['fillColor', 'strokeColor']);
});
helpers.each(activeBars, function(activeBar){
activeBar.fillColor = activeBar.highlightFill;
activeBar.strokeColor = activeBar.highlightStroke;
});
this.showTooltip(activeBars);
});
}
//Declare the extension of the default point, to cater for the options passed in to the constructor
this.BarClass = Chart.Rectangle.extend({
strokeWidth : this.options.barStrokeWidth,
showStroke : this.options.barShowStroke,
ctx : this.chart.ctx
});
//Iterate through each of the datasets, and build this into a property of the chart
helpers.each(data.datasets,function(dataset,datasetIndex){
var datasetObject = {
label : dataset.label || null,
fillColor : dataset.fillColor,
strokeColor : dataset.strokeColor,
bars : []
};
this.datasets.push(datasetObject);
helpers.each(dataset.data,function(dataPoint,index){
//Add a new point for each piece of data, passing any required data to draw.
datasetObject.bars.push(new this.BarClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
strokeColor : dataset.strokeColor,
fillColor : dataset.fillColor,
highlightFill : dataset.highlightFill || dataset.fillColor,
highlightStroke : dataset.highlightStroke || dataset.strokeColor
}));
},this);
},this);
this.buildScale(data.labels);
this.BarClass.prototype.base = this.scale.endPoint;
this.eachBars(function(bar, index, datasetIndex){
helpers.extend(bar, {
width : this.scale.calculateBarWidth(this.datasets.length),
x: this.scale.calculateBarX(this.datasets.length, datasetIndex, index),
y: this.scale.endPoint
});
bar.save();
}, this);
this.render();
},
update : function(){
this.scale.update();
// Reset any highlight colours before updating.
helpers.each(this.activeElements, function(activeElement){
activeElement.restore(['fillColor', 'strokeColor']);
});
this.eachBars(function(bar){
bar.save();
});
this.render();
},
eachBars : function(callback){
helpers.each(this.datasets,function(dataset, datasetIndex){
helpers.each(dataset.bars, callback, this, datasetIndex);
},this);
},
getBarsAtEvent : function(e){
var barsArray = [],
eventPosition = helpers.getRelativePosition(e),
datasetIterator = function(dataset){
barsArray.push(dataset.bars[barIndex]);
},
barIndex;
for (var datasetIndex = 0; datasetIndex < this.datasets.length; datasetIndex++) {
for (barIndex = 0; barIndex < this.datasets[datasetIndex].bars.length; barIndex++) {
if (this.datasets[datasetIndex].bars[barIndex].inRange(eventPosition.x,eventPosition.y)){
helpers.each(this.datasets, datasetIterator);
return barsArray;
}
}
}
return barsArray;
},
buildScale : function(labels){
var self = this;
var dataTotal = function(){
var values = [];
self.eachBars(function(bar){
values.push(bar.value);
});
return values;
};
var scaleOptions = {
templateString : this.options.scaleLabel,
height : this.chart.height,
width : this.chart.width,
ctx : this.chart.ctx,
textColor : this.options.scaleFontColor,
fontSize : this.options.scaleFontSize,
fontStyle : this.options.scaleFontStyle,
fontFamily : this.options.scaleFontFamily,
valuesCount : labels.length,
beginAtZero : this.options.scaleBeginAtZero,
integersOnly : this.options.scaleIntegersOnly,
calculateYRange: function(currentHeight){
var updatedRanges = helpers.calculateScaleRange(
dataTotal(),
currentHeight,
this.fontSize,
this.beginAtZero,
this.integersOnly
);
helpers.extend(this, updatedRanges);
},
xLabels : labels,
font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),
lineWidth : this.options.scaleLineWidth,
lineColor : this.options.scaleLineColor,
showHorizontalLines : this.options.scaleShowHorizontalLines,
showVerticalLines : this.options.scaleShowVerticalLines,
gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,
gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",
padding : (this.options.showScale) ? 0 : (this.options.barShowStroke) ? this.options.barStrokeWidth : 0,
showLabels : this.options.scaleShowLabels,
display : this.options.showScale
};
if (this.options.scaleOverride){
helpers.extend(scaleOptions, {
calculateYRange: helpers.noop,
steps: this.options.scaleSteps,
stepValue: this.options.scaleStepWidth,
min: this.options.scaleStartValue,
max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)
});
}
this.scale = new this.ScaleClass(scaleOptions);
},
addData : function(valuesArray,label){
//Map the values array for each of the datasets
helpers.each(valuesArray,function(value,datasetIndex){
//Add a new point for each piece of data, passing any required data to draw.
this.datasets[datasetIndex].bars.push(new this.BarClass({
value : value,
label : label,
x: this.scale.calculateBarX(this.datasets.length, datasetIndex, this.scale.valuesCount+1),
y: this.scale.endPoint,
width : this.scale.calculateBarWidth(this.datasets.length),
base : this.scale.endPoint,
strokeColor : this.datasets[datasetIndex].strokeColor,
fillColor : this.datasets[datasetIndex].fillColor
}));
},this);
this.scale.addXLabel(label);
//Then re-render the chart.
this.update();
},
removeData : function(){
this.scale.removeXLabel();
//Then re-render the chart.
helpers.each(this.datasets,function(dataset){
dataset.bars.shift();
},this);
this.update();
},
reflow : function(){
helpers.extend(this.BarClass.prototype,{
y: this.scale.endPoint,
base : this.scale.endPoint
});
var newScaleProps = helpers.extend({
height : this.chart.height,
width : this.chart.width
});
this.scale.update(newScaleProps);
},
draw : function(ease){
var easingDecimal = ease || 1;
this.clear();
var ctx = this.chart.ctx;
this.scale.draw(easingDecimal);
//Draw all the bars for each dataset
helpers.each(this.datasets,function(dataset,datasetIndex){
helpers.each(dataset.bars,function(bar,index){
if (bar.hasValue()){
bar.base = this.scale.endPoint;
//Transition then draw
bar.transition({
x : this.scale.calculateBarX(this.datasets.length, datasetIndex, index),
y : this.scale.calculateY(bar.value),
width : this.scale.calculateBarWidth(this.datasets.length)
}, easingDecimal).draw();
}
},this);
},this);
}
});
}).call(this);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,184 @@
(function(){
"use strict";
var root = this,
Chart = root.Chart,
//Cache a local reference to Chart.helpers
helpers = Chart.helpers;
var defaultConfig = {
//Boolean - Whether we should show a stroke on each segment
segmentShowStroke : true,
//String - The colour of each segment stroke
segmentStrokeColor : "#fff",
//Number - The width of each segment stroke
segmentStrokeWidth : 2,
//The percentage of the chart that we cut out of the middle.
percentageInnerCutout : 50,
//Number - Amount of animation steps
animationSteps : 100,
//String - Animation easing effect
animationEasing : "easeOutBounce",
//Boolean - Whether we animate the rotation of the Doughnut
animateRotate : true,
//Boolean - Whether we animate scaling the Doughnut from the centre
animateScale : false,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
};
Chart.Type.extend({
//Passing in a name registers this chart in the Chart namespace
name: "Doughnut",
//Providing a defaults will also register the deafults in the chart namespace
defaults : defaultConfig,
//Initialize is fired when the chart is initialized - Data is passed in as a parameter
//Config is automatically merged by the core of Chart.js, and is available at this.options
initialize: function(data){
//Declare segments as a static property to prevent inheriting across the Chart type prototype
this.segments = [];
this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2;
this.SegmentArc = Chart.Arc.extend({
ctx : this.chart.ctx,
x : this.chart.width/2,
y : this.chart.height/2
});
//Set up tooltip events on the chart
if (this.options.showTooltips){
helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];
helpers.each(this.segments,function(segment){
segment.restore(["fillColor"]);
});
helpers.each(activeSegments,function(activeSegment){
activeSegment.fillColor = activeSegment.highlightColor;
});
this.showTooltip(activeSegments);
});
}
this.calculateTotal(data);
helpers.each(data,function(datapoint, index){
this.addData(datapoint, index, true);
},this);
this.render();
},
getSegmentsAtEvent : function(e){
var segmentsArray = [];
var location = helpers.getRelativePosition(e);
helpers.each(this.segments,function(segment){
if (segment.inRange(location.x,location.y)) segmentsArray.push(segment);
},this);
return segmentsArray;
},
addData : function(segment, atIndex, silent){
var index = atIndex || this.segments.length;
this.segments.splice(index, 0, new this.SegmentArc({
value : segment.value,
outerRadius : (this.options.animateScale) ? 0 : this.outerRadius,
innerRadius : (this.options.animateScale) ? 0 : (this.outerRadius/100) * this.options.percentageInnerCutout,
fillColor : segment.color,
highlightColor : segment.highlight || segment.color,
showStroke : this.options.segmentShowStroke,
strokeWidth : this.options.segmentStrokeWidth,
strokeColor : this.options.segmentStrokeColor,
startAngle : Math.PI * 1.5,
circumference : (this.options.animateRotate) ? 0 : this.calculateCircumference(segment.value),
label : segment.label
}));
if (!silent){
this.reflow();
this.update();
}
},
calculateCircumference : function(value){
return (Math.PI*2)*(Math.abs(value) / this.total);
},
calculateTotal : function(data){
this.total = 0;
helpers.each(data,function(segment){
this.total += Math.abs(segment.value);
},this);
},
update : function(){
this.calculateTotal(this.segments);
// Reset any highlight colours before updating.
helpers.each(this.activeElements, function(activeElement){
activeElement.restore(['fillColor']);
});
helpers.each(this.segments,function(segment){
segment.save();
});
this.render();
},
removeData: function(atIndex){
var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length-1;
this.segments.splice(indexToDelete, 1);
this.reflow();
this.update();
},
reflow : function(){
helpers.extend(this.SegmentArc.prototype,{
x : this.chart.width/2,
y : this.chart.height/2
});
this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2;
helpers.each(this.segments, function(segment){
segment.update({
outerRadius : this.outerRadius,
innerRadius : (this.outerRadius/100) * this.options.percentageInnerCutout
});
}, this);
},
draw : function(easeDecimal){
var animDecimal = (easeDecimal) ? easeDecimal : 1;
this.clear();
helpers.each(this.segments,function(segment,index){
segment.transition({
circumference : this.calculateCircumference(segment.value),
outerRadius : this.outerRadius,
innerRadius : (this.outerRadius/100) * this.options.percentageInnerCutout
},animDecimal);
segment.endAngle = segment.startAngle + segment.circumference;
segment.draw();
if (index === 0){
segment.startAngle = Math.PI * 1.5;
}
//Check to see if it's the last segment, if not get the next and update the start angle
if (index < this.segments.length-1){
this.segments[index+1].startAngle = segment.endAngle;
}
},this);
}
});
Chart.types.Doughnut.extend({
name : "Pie",
defaults : helpers.merge(defaultConfig,{percentageInnerCutout : 0})
});
}).call(this);

View File

@@ -0,0 +1,374 @@
(function(){
"use strict";
var root = this,
Chart = root.Chart,
helpers = Chart.helpers;
var defaultConfig = {
///Boolean - Whether grid lines are shown across the chart
scaleShowGridLines : true,
//String - Colour of the grid lines
scaleGridLineColor : "rgba(0,0,0,.05)",
//Number - Width of the grid lines
scaleGridLineWidth : 1,
//Boolean - Whether to show horizontal lines (except X axis)
scaleShowHorizontalLines: true,
//Boolean - Whether to show vertical lines (except Y axis)
scaleShowVerticalLines: true,
//Boolean - Whether the line is curved between points
bezierCurve : true,
//Number - Tension of the bezier curve between points
bezierCurveTension : 0.4,
//Boolean - Whether to show a dot for each point
pointDot : true,
//Number - Radius of each point dot in pixels
pointDotRadius : 4,
//Number - Pixel width of point dot stroke
pointDotStrokeWidth : 1,
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
pointHitDetectionRadius : 20,
//Boolean - Whether to show a stroke for datasets
datasetStroke : true,
//Number - Pixel width of dataset stroke
datasetStrokeWidth : 2,
//Boolean - Whether to fill the dataset with a colour
datasetFill : true,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
};
Chart.Type.extend({
name: "Line",
defaults : defaultConfig,
initialize: function(data){
//Declare the extension of the default point, to cater for the options passed in to the constructor
this.PointClass = Chart.Point.extend({
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
display: this.options.pointDot,
hitDetectionRadius : this.options.pointHitDetectionRadius,
ctx : this.chart.ctx,
inRange : function(mouseX){
return (Math.pow(mouseX-this.x, 2) < Math.pow(this.radius + this.hitDetectionRadius,2));
}
});
this.datasets = [];
//Set up tooltip events on the chart
if (this.options.showTooltips){
helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
var activePoints = (evt.type !== 'mouseout') ? this.getPointsAtEvent(evt) : [];
this.eachPoints(function(point){
point.restore(['fillColor', 'strokeColor']);
});
helpers.each(activePoints, function(activePoint){
activePoint.fillColor = activePoint.highlightFill;
activePoint.strokeColor = activePoint.highlightStroke;
});
this.showTooltip(activePoints);
});
}
//Iterate through each of the datasets, and build this into a property of the chart
helpers.each(data.datasets,function(dataset){
var datasetObject = {
label : dataset.label || null,
fillColor : dataset.fillColor,
strokeColor : dataset.strokeColor,
pointColor : dataset.pointColor,
pointStrokeColor : dataset.pointStrokeColor,
points : []
};
this.datasets.push(datasetObject);
helpers.each(dataset.data,function(dataPoint,index){
//Add a new point for each piece of data, passing any required data to draw.
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
strokeColor : dataset.pointStrokeColor,
fillColor : dataset.pointColor,
highlightFill : dataset.pointHighlightFill || dataset.pointColor,
highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor
}));
},this);
this.buildScale(data.labels);
this.eachPoints(function(point, index){
helpers.extend(point, {
x: this.scale.calculateX(index),
y: this.scale.endPoint
});
point.save();
}, this);
},this);
this.render();
},
update : function(){
this.scale.update();
// Reset any highlight colours before updating.
helpers.each(this.activeElements, function(activeElement){
activeElement.restore(['fillColor', 'strokeColor']);
});
this.eachPoints(function(point){
point.save();
});
this.render();
},
eachPoints : function(callback){
helpers.each(this.datasets,function(dataset){
helpers.each(dataset.points,callback,this);
},this);
},
getPointsAtEvent : function(e){
var pointsArray = [],
eventPosition = helpers.getRelativePosition(e);
helpers.each(this.datasets,function(dataset){
helpers.each(dataset.points,function(point){
if (point.inRange(eventPosition.x,eventPosition.y)) pointsArray.push(point);
});
},this);
return pointsArray;
},
buildScale : function(labels){
var self = this;
var dataTotal = function(){
var values = [];
self.eachPoints(function(point){
values.push(point.value);
});
return values;
};
var scaleOptions = {
templateString : this.options.scaleLabel,
height : this.chart.height,
width : this.chart.width,
ctx : this.chart.ctx,
textColor : this.options.scaleFontColor,
fontSize : this.options.scaleFontSize,
fontStyle : this.options.scaleFontStyle,
fontFamily : this.options.scaleFontFamily,
valuesCount : labels.length,
beginAtZero : this.options.scaleBeginAtZero,
integersOnly : this.options.scaleIntegersOnly,
calculateYRange : function(currentHeight){
var updatedRanges = helpers.calculateScaleRange(
dataTotal(),
currentHeight,
this.fontSize,
this.beginAtZero,
this.integersOnly
);
helpers.extend(this, updatedRanges);
},
xLabels : labels,
font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily),
lineWidth : this.options.scaleLineWidth,
lineColor : this.options.scaleLineColor,
showHorizontalLines : this.options.scaleShowHorizontalLines,
showVerticalLines : this.options.scaleShowVerticalLines,
gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0,
gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)",
padding: (this.options.showScale) ? 0 : this.options.pointDotRadius + this.options.pointDotStrokeWidth,
showLabels : this.options.scaleShowLabels,
display : this.options.showScale
};
if (this.options.scaleOverride){
helpers.extend(scaleOptions, {
calculateYRange: helpers.noop,
steps: this.options.scaleSteps,
stepValue: this.options.scaleStepWidth,
min: this.options.scaleStartValue,
max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)
});
}
this.scale = new Chart.Scale(scaleOptions);
},
addData : function(valuesArray,label){
//Map the values array for each of the datasets
helpers.each(valuesArray,function(value,datasetIndex){
//Add a new point for each piece of data, passing any required data to draw.
this.datasets[datasetIndex].points.push(new this.PointClass({
value : value,
label : label,
x: this.scale.calculateX(this.scale.valuesCount+1),
y: this.scale.endPoint,
strokeColor : this.datasets[datasetIndex].pointStrokeColor,
fillColor : this.datasets[datasetIndex].pointColor
}));
},this);
this.scale.addXLabel(label);
//Then re-render the chart.
this.update();
},
removeData : function(){
this.scale.removeXLabel();
//Then re-render the chart.
helpers.each(this.datasets,function(dataset){
dataset.points.shift();
},this);
this.update();
},
reflow : function(){
var newScaleProps = helpers.extend({
height : this.chart.height,
width : this.chart.width
});
this.scale.update(newScaleProps);
},
draw : function(ease){
var easingDecimal = ease || 1;
this.clear();
var ctx = this.chart.ctx;
// Some helper methods for getting the next/prev points
var hasValue = function(item){
return item.value !== null;
},
nextPoint = function(point, collection, index){
return helpers.findNextWhere(collection, hasValue, index) || point;
},
previousPoint = function(point, collection, index){
return helpers.findPreviousWhere(collection, hasValue, index) || point;
};
this.scale.draw(easingDecimal);
helpers.each(this.datasets,function(dataset){
var pointsWithValues = helpers.where(dataset.points, hasValue);
//Transition each point first so that the line and point drawing isn't out of sync
//We can use this extra loop to calculate the control points of this dataset also in this loop
helpers.each(dataset.points, function(point, index){
if (point.hasValue()){
point.transition({
y : this.scale.calculateY(point.value),
x : this.scale.calculateX(index)
}, easingDecimal);
}
},this);
// Control points need to be calculated in a seperate loop, because we need to know the current x/y of the point
// This would cause issues when there is no animation, because the y of the next point would be 0, so beziers would be skewed
if (this.options.bezierCurve){
helpers.each(pointsWithValues, function(point, index){
var tension = (index > 0 && index < pointsWithValues.length - 1) ? this.options.bezierCurveTension : 0;
point.controlPoints = helpers.splineCurve(
previousPoint(point, pointsWithValues, index),
point,
nextPoint(point, pointsWithValues, index),
tension
);
// Prevent the bezier going outside of the bounds of the graph
// Cap puter bezier handles to the upper/lower scale bounds
if (point.controlPoints.outer.y > this.scale.endPoint){
point.controlPoints.outer.y = this.scale.endPoint;
}
else if (point.controlPoints.outer.y < this.scale.startPoint){
point.controlPoints.outer.y = this.scale.startPoint;
}
// Cap inner bezier handles to the upper/lower scale bounds
if (point.controlPoints.inner.y > this.scale.endPoint){
point.controlPoints.inner.y = this.scale.endPoint;
}
else if (point.controlPoints.inner.y < this.scale.startPoint){
point.controlPoints.inner.y = this.scale.startPoint;
}
},this);
}
//Draw the line between all the points
ctx.lineWidth = this.options.datasetStrokeWidth;
ctx.strokeStyle = dataset.strokeColor;
ctx.beginPath();
helpers.each(pointsWithValues, function(point, index){
if (index === 0){
ctx.moveTo(point.x, point.y);
}
else{
if(this.options.bezierCurve){
var previous = previousPoint(point, pointsWithValues, index);
ctx.bezierCurveTo(
previous.controlPoints.outer.x,
previous.controlPoints.outer.y,
point.controlPoints.inner.x,
point.controlPoints.inner.y,
point.x,
point.y
);
}
else{
ctx.lineTo(point.x,point.y);
}
}
}, this);
ctx.stroke();
if (this.options.datasetFill && pointsWithValues.length > 0){
//Round off the line by going to the base of the chart, back to the start, then fill.
ctx.lineTo(pointsWithValues[pointsWithValues.length - 1].x, this.scale.endPoint);
ctx.lineTo(pointsWithValues[0].x, this.scale.endPoint);
ctx.fillStyle = dataset.fillColor;
ctx.closePath();
ctx.fill();
}
//Now draw the points over the line
//A little inefficient double looping, but better than the line
//lagging behind the point positions
helpers.each(pointsWithValues,function(point){
point.draw();
});
},this);
}
});
}).call(this);

View File

@@ -0,0 +1,250 @@
(function(){
"use strict";
var root = this,
Chart = root.Chart,
//Cache a local reference to Chart.helpers
helpers = Chart.helpers;
var defaultConfig = {
//Boolean - Show a backdrop to the scale label
scaleShowLabelBackdrop : true,
//String - The colour of the label backdrop
scaleBackdropColor : "rgba(255,255,255,0.75)",
// Boolean - Whether the scale should begin at zero
scaleBeginAtZero : true,
//Number - The backdrop padding above & below the label in pixels
scaleBackdropPaddingY : 2,
//Number - The backdrop padding to the side of the label in pixels
scaleBackdropPaddingX : 2,
//Boolean - Show line for each value in the scale
scaleShowLine : true,
//Boolean - Stroke a line around each segment in the chart
segmentShowStroke : true,
//String - The colour of the stroke on each segement.
segmentStrokeColor : "#fff",
//Number - The width of the stroke value in pixels
segmentStrokeWidth : 2,
//Number - Amount of animation steps
animationSteps : 100,
//String - Animation easing effect.
animationEasing : "easeOutBounce",
//Boolean - Whether to animate the rotation of the chart
animateRotate : true,
//Boolean - Whether to animate scaling the chart from the centre
animateScale : false,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
};
Chart.Type.extend({
//Passing in a name registers this chart in the Chart namespace
name: "PolarArea",
//Providing a defaults will also register the deafults in the chart namespace
defaults : defaultConfig,
//Initialize is fired when the chart is initialized - Data is passed in as a parameter
//Config is automatically merged by the core of Chart.js, and is available at this.options
initialize: function(data){
this.segments = [];
//Declare segment class as a chart instance specific class, so it can share props for this instance
this.SegmentArc = Chart.Arc.extend({
showStroke : this.options.segmentShowStroke,
strokeWidth : this.options.segmentStrokeWidth,
strokeColor : this.options.segmentStrokeColor,
ctx : this.chart.ctx,
innerRadius : 0,
x : this.chart.width/2,
y : this.chart.height/2
});
this.scale = new Chart.RadialScale({
display: this.options.showScale,
fontStyle: this.options.scaleFontStyle,
fontSize: this.options.scaleFontSize,
fontFamily: this.options.scaleFontFamily,
fontColor: this.options.scaleFontColor,
showLabels: this.options.scaleShowLabels,
showLabelBackdrop: this.options.scaleShowLabelBackdrop,
backdropColor: this.options.scaleBackdropColor,
backdropPaddingY : this.options.scaleBackdropPaddingY,
backdropPaddingX: this.options.scaleBackdropPaddingX,
lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0,
lineColor: this.options.scaleLineColor,
lineArc: true,
width: this.chart.width,
height: this.chart.height,
xCenter: this.chart.width/2,
yCenter: this.chart.height/2,
ctx : this.chart.ctx,
templateString: this.options.scaleLabel,
valuesCount: data.length
});
this.updateScaleRange(data);
this.scale.update();
helpers.each(data,function(segment,index){
this.addData(segment,index,true);
},this);
//Set up tooltip events on the chart
if (this.options.showTooltips){
helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : [];
helpers.each(this.segments,function(segment){
segment.restore(["fillColor"]);
});
helpers.each(activeSegments,function(activeSegment){
activeSegment.fillColor = activeSegment.highlightColor;
});
this.showTooltip(activeSegments);
});
}
this.render();
},
getSegmentsAtEvent : function(e){
var segmentsArray = [];
var location = helpers.getRelativePosition(e);
helpers.each(this.segments,function(segment){
if (segment.inRange(location.x,location.y)) segmentsArray.push(segment);
},this);
return segmentsArray;
},
addData : function(segment, atIndex, silent){
var index = atIndex || this.segments.length;
this.segments.splice(index, 0, new this.SegmentArc({
fillColor: segment.color,
highlightColor: segment.highlight || segment.color,
label: segment.label,
value: segment.value,
outerRadius: (this.options.animateScale) ? 0 : this.scale.calculateCenterOffset(segment.value),
circumference: (this.options.animateRotate) ? 0 : this.scale.getCircumference(),
startAngle: Math.PI * 1.5
}));
if (!silent){
this.reflow();
this.update();
}
},
removeData: function(atIndex){
var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length-1;
this.segments.splice(indexToDelete, 1);
this.reflow();
this.update();
},
calculateTotal: function(data){
this.total = 0;
helpers.each(data,function(segment){
this.total += segment.value;
},this);
this.scale.valuesCount = this.segments.length;
},
updateScaleRange: function(datapoints){
var valuesArray = [];
helpers.each(datapoints,function(segment){
valuesArray.push(segment.value);
});
var scaleSizes = (this.options.scaleOverride) ?
{
steps: this.options.scaleSteps,
stepValue: this.options.scaleStepWidth,
min: this.options.scaleStartValue,
max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)
} :
helpers.calculateScaleRange(
valuesArray,
helpers.min([this.chart.width, this.chart.height])/2,
this.options.scaleFontSize,
this.options.scaleBeginAtZero,
this.options.scaleIntegersOnly
);
helpers.extend(
this.scale,
scaleSizes,
{
size: helpers.min([this.chart.width, this.chart.height]),
xCenter: this.chart.width/2,
yCenter: this.chart.height/2
}
);
},
update : function(){
this.calculateTotal(this.segments);
helpers.each(this.segments,function(segment){
segment.save();
});
this.reflow();
this.render();
},
reflow : function(){
helpers.extend(this.SegmentArc.prototype,{
x : this.chart.width/2,
y : this.chart.height/2
});
this.updateScaleRange(this.segments);
this.scale.update();
helpers.extend(this.scale,{
xCenter: this.chart.width/2,
yCenter: this.chart.height/2
});
helpers.each(this.segments, function(segment){
segment.update({
outerRadius : this.scale.calculateCenterOffset(segment.value)
});
}, this);
},
draw : function(ease){
var easingDecimal = ease || 1;
//Clear & draw the canvas
this.clear();
helpers.each(this.segments,function(segment, index){
segment.transition({
circumference : this.scale.getCircumference(),
outerRadius : this.scale.calculateCenterOffset(segment.value)
},easingDecimal);
segment.endAngle = segment.startAngle + segment.circumference;
// If we've removed the first segment we need to set the first one to
// start at the top.
if (index === 0){
segment.startAngle = Math.PI * 1.5;
}
//Check to see if it's the last segment, if not get the next and update the start angle
if (index < this.segments.length - 1){
this.segments[index+1].startAngle = segment.endAngle;
}
segment.draw();
}, this);
this.scale.draw();
}
});
}).call(this);

View File

@@ -0,0 +1,343 @@
(function(){
"use strict";
var root = this,
Chart = root.Chart,
helpers = Chart.helpers;
Chart.Type.extend({
name: "Radar",
defaults:{
//Boolean - Whether to show lines for each scale point
scaleShowLine : true,
//Boolean - Whether we show the angle lines out of the radar
angleShowLineOut : true,
//Boolean - Whether to show labels on the scale
scaleShowLabels : false,
// Boolean - Whether the scale should begin at zero
scaleBeginAtZero : true,
//String - Colour of the angle line
angleLineColor : "rgba(0,0,0,.1)",
//Number - Pixel width of the angle line
angleLineWidth : 1,
//String - Point label font declaration
pointLabelFontFamily : "'Arial'",
//String - Point label font weight
pointLabelFontStyle : "normal",
//Number - Point label font size in pixels
pointLabelFontSize : 10,
//String - Point label font colour
pointLabelFontColor : "#666",
//Boolean - Whether to show a dot for each point
pointDot : true,
//Number - Radius of each point dot in pixels
pointDotRadius : 3,
//Number - Pixel width of point dot stroke
pointDotStrokeWidth : 1,
//Number - amount extra to add to the radius to cater for hit detection outside the drawn point
pointHitDetectionRadius : 20,
//Boolean - Whether to show a stroke for datasets
datasetStroke : true,
//Number - Pixel width of dataset stroke
datasetStrokeWidth : 2,
//Boolean - Whether to fill the dataset with a colour
datasetFill : true,
//String - A legend template
legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\"background-color:<%=datasets[i].strokeColor%>\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>"
},
initialize: function(data){
this.PointClass = Chart.Point.extend({
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
display: this.options.pointDot,
hitDetectionRadius : this.options.pointHitDetectionRadius,
ctx : this.chart.ctx
});
this.datasets = [];
this.buildScale(data);
//Set up tooltip events on the chart
if (this.options.showTooltips){
helpers.bindEvents(this, this.options.tooltipEvents, function(evt){
var activePointsCollection = (evt.type !== 'mouseout') ? this.getPointsAtEvent(evt) : [];
this.eachPoints(function(point){
point.restore(['fillColor', 'strokeColor']);
});
helpers.each(activePointsCollection, function(activePoint){
activePoint.fillColor = activePoint.highlightFill;
activePoint.strokeColor = activePoint.highlightStroke;
});
this.showTooltip(activePointsCollection);
});
}
//Iterate through each of the datasets, and build this into a property of the chart
helpers.each(data.datasets,function(dataset){
var datasetObject = {
label: dataset.label || null,
fillColor : dataset.fillColor,
strokeColor : dataset.strokeColor,
pointColor : dataset.pointColor,
pointStrokeColor : dataset.pointStrokeColor,
points : []
};
this.datasets.push(datasetObject);
helpers.each(dataset.data,function(dataPoint,index){
//Add a new point for each piece of data, passing any required data to draw.
var pointPosition;
if (!this.scale.animation){
pointPosition = this.scale.getPointPosition(index, this.scale.calculateCenterOffset(dataPoint));
}
datasetObject.points.push(new this.PointClass({
value : dataPoint,
label : data.labels[index],
datasetLabel: dataset.label,
x: (this.options.animation) ? this.scale.xCenter : pointPosition.x,
y: (this.options.animation) ? this.scale.yCenter : pointPosition.y,
strokeColor : dataset.pointStrokeColor,
fillColor : dataset.pointColor,
highlightFill : dataset.pointHighlightFill || dataset.pointColor,
highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor
}));
},this);
},this);
this.render();
},
eachPoints : function(callback){
helpers.each(this.datasets,function(dataset){
helpers.each(dataset.points,callback,this);
},this);
},
getPointsAtEvent : function(evt){
var mousePosition = helpers.getRelativePosition(evt),
fromCenter = helpers.getAngleFromPoint({
x: this.scale.xCenter,
y: this.scale.yCenter
}, mousePosition);
var anglePerIndex = (Math.PI * 2) /this.scale.valuesCount,
pointIndex = Math.round((fromCenter.angle - Math.PI * 1.5) / anglePerIndex),
activePointsCollection = [];
// If we're at the top, make the pointIndex 0 to get the first of the array.
if (pointIndex >= this.scale.valuesCount || pointIndex < 0){
pointIndex = 0;
}
if (fromCenter.distance <= this.scale.drawingArea){
helpers.each(this.datasets, function(dataset){
activePointsCollection.push(dataset.points[pointIndex]);
});
}
return activePointsCollection;
},
buildScale : function(data){
this.scale = new Chart.RadialScale({
display: this.options.showScale,
fontStyle: this.options.scaleFontStyle,
fontSize: this.options.scaleFontSize,
fontFamily: this.options.scaleFontFamily,
fontColor: this.options.scaleFontColor,
showLabels: this.options.scaleShowLabels,
showLabelBackdrop: this.options.scaleShowLabelBackdrop,
backdropColor: this.options.scaleBackdropColor,
backdropPaddingY : this.options.scaleBackdropPaddingY,
backdropPaddingX: this.options.scaleBackdropPaddingX,
lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0,
lineColor: this.options.scaleLineColor,
angleLineColor : this.options.angleLineColor,
angleLineWidth : (this.options.angleShowLineOut) ? this.options.angleLineWidth : 0,
// Point labels at the edge of each line
pointLabelFontColor : this.options.pointLabelFontColor,
pointLabelFontSize : this.options.pointLabelFontSize,
pointLabelFontFamily : this.options.pointLabelFontFamily,
pointLabelFontStyle : this.options.pointLabelFontStyle,
height : this.chart.height,
width: this.chart.width,
xCenter: this.chart.width/2,
yCenter: this.chart.height/2,
ctx : this.chart.ctx,
templateString: this.options.scaleLabel,
labels: data.labels,
valuesCount: data.datasets[0].data.length
});
this.scale.setScaleSize();
this.updateScaleRange(data.datasets);
this.scale.buildYLabels();
},
updateScaleRange: function(datasets){
var valuesArray = (function(){
var totalDataArray = [];
helpers.each(datasets,function(dataset){
if (dataset.data){
totalDataArray = totalDataArray.concat(dataset.data);
}
else {
helpers.each(dataset.points, function(point){
totalDataArray.push(point.value);
});
}
});
return totalDataArray;
})();
var scaleSizes = (this.options.scaleOverride) ?
{
steps: this.options.scaleSteps,
stepValue: this.options.scaleStepWidth,
min: this.options.scaleStartValue,
max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth)
} :
helpers.calculateScaleRange(
valuesArray,
helpers.min([this.chart.width, this.chart.height])/2,
this.options.scaleFontSize,
this.options.scaleBeginAtZero,
this.options.scaleIntegersOnly
);
helpers.extend(
this.scale,
scaleSizes
);
},
addData : function(valuesArray,label){
//Map the values array for each of the datasets
this.scale.valuesCount++;
helpers.each(valuesArray,function(value,datasetIndex){
var pointPosition = this.scale.getPointPosition(this.scale.valuesCount, this.scale.calculateCenterOffset(value));
this.datasets[datasetIndex].points.push(new this.PointClass({
value : value,
label : label,
x: pointPosition.x,
y: pointPosition.y,
strokeColor : this.datasets[datasetIndex].pointStrokeColor,
fillColor : this.datasets[datasetIndex].pointColor
}));
},this);
this.scale.labels.push(label);
this.reflow();
this.update();
},
removeData : function(){
this.scale.valuesCount--;
this.scale.labels.shift();
helpers.each(this.datasets,function(dataset){
dataset.points.shift();
},this);
this.reflow();
this.update();
},
update : function(){
this.eachPoints(function(point){
point.save();
});
this.reflow();
this.render();
},
reflow: function(){
helpers.extend(this.scale, {
width : this.chart.width,
height: this.chart.height,
size : helpers.min([this.chart.width, this.chart.height]),
xCenter: this.chart.width/2,
yCenter: this.chart.height/2
});
this.updateScaleRange(this.datasets);
this.scale.setScaleSize();
this.scale.buildYLabels();
},
draw : function(ease){
var easeDecimal = ease || 1,
ctx = this.chart.ctx;
this.clear();
this.scale.draw();
helpers.each(this.datasets,function(dataset){
//Transition each point first so that the line and point drawing isn't out of sync
helpers.each(dataset.points,function(point,index){
if (point.hasValue()){
point.transition(this.scale.getPointPosition(index, this.scale.calculateCenterOffset(point.value)), easeDecimal);
}
},this);
//Draw the line between all the points
ctx.lineWidth = this.options.datasetStrokeWidth;
ctx.strokeStyle = dataset.strokeColor;
ctx.beginPath();
helpers.each(dataset.points,function(point,index){
if (index === 0){
ctx.moveTo(point.x,point.y);
}
else{
ctx.lineTo(point.x,point.y);
}
},this);
ctx.closePath();
ctx.stroke();
ctx.fillStyle = dataset.fillColor;
ctx.fill();
//Now draw the points over the line
//A little inefficient double looping, but better than the line
//lagging behind the point positions
helpers.each(dataset.points,function(point){
if (point.hasValue()){
point.draw();
}
});
},this);
}
});
}).call(this);

View File

@@ -0,0 +1,24 @@
Gemfile.lock
test/dest
*.gem
pkg/
*.swp
*~
_site/
.bundle/
.DS_Store
bbin/
sftp-config*
_site
.htaccess
private-*
__article/
node_modules
_production
all.min.css
*.sublime-*
website/dist/
*.idea
/.idea
.node-version
.sass-cache/

View File

@@ -0,0 +1,21 @@
{
"curly": false,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": false,
"unused": true,
"boss": true,
"eqnull": true,
"browser": true,
"predef": [
"define",
"module",
"mfp"
],
"jquery": true
}

View File

@@ -0,0 +1,7 @@
language: node_js
node_js:
- "0.10"
before_install:
- npm install grunt-cli -g

View File

@@ -0,0 +1,213 @@
/**
*
* Run 'grunt' to generate JS and CSS in folder 'dist' and site in folder '_site'
* *
* Run 'grunt watch' to automatically regenerate '_site' when you change files in 'src' or in 'website'
*
*/
module.exports = function(grunt) {
'use strict';
var jekyllConfig = "isLocal : false \r\n"+
"permalink: /:title/ \r\n"+
"exclude: ['.json', '.rvmrc', '.rbenv-version', 'README.md', 'Rakefile', 'changelog.md', 'compiler.jar', 'private', 'magnific-popup.sublime-project', 'magnific-popup.sublime-workspace', '.htaccess'] \r\n"+
"auto: true \r\n"+
"mfpversion: <%= pkg.version %> \r\n"+
"pygments: true \r\n";
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('magnific-popup.jquery.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>; */\n',
// Task configuration.
clean: {
files: ['dist']
},
sass: {
dist: {
files: {
'dist/magnific-popup.css': 'src/css/main.scss'
}
}
},
jshint: {
all: [
'Gruntfile.js',
'src/js/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
mfpbuild: {
all: {
src: [
'inline',
'ajax',
'image',
'zoom',
'iframe',
'gallery',
'retina',
],
basePath: 'src/js/',
dest: 'dist/jquery.magnific-popup.js',
banner: '<%= banner %>'
}
},
jekyll: {
dev: {
options: {
src: 'website',
dest: '_site',
url: 'local',
raw: jekyllConfig + "url: local"
}
},
production: {
options: {
src: 'website',
dest: '_production',
url: 'production',
raw: jekyllConfig + "url: production"
}
}
},
copy: {
main: {
files: [
{expand:true, src: ['dist/**'], dest: 'website/'}
]
},
dev: {
files: [
{expand:true, src: ['dist/**'], dest: '_site/'}
]
}
},
uglify: {
my_target: {
files: {
'dist/jquery.magnific-popup.min.js': ['dist/jquery.magnific-popup.js']
},
preserveComments: 'some'
},
options: {
preserveComments: 'some'
}
},
watch: { // for development run 'grunt watch'
jekyll: {
files: ['website/**'],
tasks: ['jekyll:dev', 'copy:dev']
},
files: ['src/**'],
tasks: [ 'sass', 'mfpbuild', 'copy:dev', 'uglify']
},
cssmin: {
compress: {
files: {
"website/site-assets/all.min.css": ["website/site-assets/site.css", "website/dist/magnific-popup.css"]
}
}
}
});
// Makes Magnific Popup JS file.
// grunt mfpbuild --mfp-exclude=ajax,image
grunt.task.registerMultiTask('mfpbuild', 'Makes Magnific Popup JS file.', function() {
var files = this.data.src,
includes = grunt.option('mfp-exclude'),
basePath = this.data.basePath,
newContents = this.data.banner + ";(function (factory) { \n" +
"if (typeof define === 'function' && define.amd) { \n" +
" // AMD. Register as an anonymous module. \n" +
" define(['jquery'], factory); \n" +
" } else if (typeof exports === 'object') { \n" +
" // Node/CommonJS \n" +
" factory(require('jquery')); \n" +
" } else { \n" +
" // Browser globals \n" +
" factory(window.jQuery || window.Zepto); \n" +
" } \n" +
" }(function($) { \n";
if(includes) {
includes = includes.split(/[\s,]+/); // 'a,b,c' => ['a','b','c']
var removeA = function (arr) {
var what, a = arguments, L = a.length, ax;
while (L > 1 && arr.length) {
what = a[--L];
while ((ax= arr.indexOf(what)) !== -1) {
arr.splice(ax, 1);
}
}
return arr;
};
includes.forEach(function( name ) {
if(name) {
grunt.log.writeln( 'removed "'+name +'"' );
files = removeA(files, name);
}
});
}
files.unshift('core');
grunt.log.writeln( 'Your build is made of:'+files );
files.forEach(function( name ) {
// Wrap each module with a pience of code to be able to exlude it, stolen for modernizr.com
newContents += "\n/*>>"+name+"*/\n";
newContents += grunt.file.read( basePath + name + '.js' ) + '\n';
newContents += "\n/*>>"+name+"*/\n";
});
newContents+= " _checkInstance(); }));";
grunt.file.write( this.data.dest, newContents );
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-jekyll');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task.
grunt.registerTask('default', ['sass', 'mfpbuild', 'uglify', 'copy', 'jekyll:dev']);
grunt.registerTask('production', ['sass', 'mfpbuild', 'uglify', 'copy', 'cssmin', 'jekyll:production']);
grunt.registerTask('nosite', ['sass', 'mfpbuild', 'uglify']);
grunt.registerTask('hint', ['jshint']);
};

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014-2016 Dmitry Semenov, http://dimsemenov.com
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.

View File

@@ -0,0 +1,76 @@
# Magnific Popup Repository
[![Build Status](https://travis-ci.org/dimsemenov/Magnific-Popup.png)](https://travis-ci.org/dimsemenov/Magnific-Popup)
[![Flattr](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/thing/1310305/Magnific-Popup-by-dimsemenov)
Fast, light and responsive lightbox plugin, for jQuery and Zepto.js.
- [Documentation and getting started guide](http://dimsemenov.com/plugins/magnific-popup/documentation.html).
- [Examples and plugin home page](http://dimsemenov.com/plugins/magnific-popup/).
- More examples in [CodePen collection](http://codepen.io/collection/nLcqo).
Optionally, install via Bower `bower install magnific-popup` or npm: `npm install magnific-popup`.
[Ruby gem](https://rubygems.org/gems/magnific-popup-rails): `gem install magnific-popup-rails`.
## Extensions
- WordPress plugin - [under development](http://dimsemenov.com/plugins/magnific-popup/wordpress.html).
- [Drupal module](https://drupal.org/project/magnific_popup).
- [Concrete5 add-on](https://github.com/cdowdy/concrete5-Magnific-Popup).
- [Redaxo add-on](http://www.redaxo.org/de/download/addons/?addon_id=1131).
- [Contao extension](https://github.com/fritzmg/contao-magnific-popup).
If you created an extension for some CMS, email me and I'll add it to this list.
## Location of stuff
- Generated popup JS and CSS files are in folder [dist/](https://github.com/dimsemenov/Magnific-Popup/tree/master/dist). (Online build tool is on [documentation page](http://dimsemenov.com/plugins/magnific-popup/documentation.html)).
- Source files are in folder [src/](https://github.com/dimsemenov/Magnific-Popup/tree/master/src). They include [Sass CSS file](https://github.com/dimsemenov/Magnific-Popup/blob/master/src/css/main.scss) and js parts (edit them if you wish to submit commit).
- Website (examples & documentation) is in folder [website/](https://github.com/dimsemenov/Magnific-Popup/tree/master/website).
- Documentation page itself is in [website/documentation.md](https://github.com/dimsemenov/Magnific-Popup/blob/master/website/documentation.md) (contributions to it are very welcome).
## Using Magnific Popup?
If you used Magnific Popup in some interesting way, or on site of popular brand, I'd be very grateful if you <a href="mailto:diiiimaaaa@gmail.com?subject="Site that uses Magnific Popup"">shoot me</a> a link to it.
## Build
To compile Magnific Popup by yourself, first of make sure that you have [Node.js](http://nodejs.org/), [Grunt.js](https://github.com/cowboy/grunt), [Ruby](http://www.ruby-lang.org/) and [Jekyll](https://github.com/mojombo/jekyll/) installed, then:
1) Copy repository
git clone https://github.com/dimsemenov/Magnific-Popup.git
2) Go inside Magnific Popup folder that you fetched and install Node dependencies
cd Magnific-Popup && npm install
3) Now simply run `grunt` to generate JS and CSS in folder `dist` and site in folder `_site/`.
grunt
Optionally:
- Run `grunt watch` to automatically rebuild script when you change files in `src/` or in `website/`.
- If you don't have and don't want to install Jekyll, run `grunt nosite` to just build JS and CSS files related to popup in `dist/`.
## [Changelog](https://github.com/dimsemenov/Magnific-Popup/releases)
## License
Script is MIT licensed and free and will always be kept this way. But has a small restriction from me - please do not create public WordPress plugin based on it(or at least contact me before creating it), because I will make it and it'll be open source too ([want to get notified?](http://dimsemenov.com/subscribe.html)).
Created by [@dimsemenov](http://twitter.com/dimsemenov) & [contributors](https://github.com/dimsemenov/Magnific-Popup/contributors).
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/dimsemenov/magnific-popup/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
## Bugs & contributing
Please report bugs via GitHub and ask general questions through [StackOverflow](http://stackoverflow.com/questions/tagged/magnific-popup). Feel free to submit commit [pull-request](https://github.com/dimsemenov/Magnific-Popup/pulls), even the tiniest contributions to the script or to the documentation are very welcome.

View File

@@ -0,0 +1,16 @@
{
"name": "magnific-popup",
"main": [
"dist/jquery.magnific-popup.js",
"dist/magnific-popup.css"
],
"dependencies": {
"jquery": ">=1.8.0"
},
"ignore": [
"node_modules/",
"components/",
"website/",
"libs/"
]
}

View File

@@ -0,0 +1,5 @@
{
"name": "dimsemenov/magnific-popup",
"description": "Light and responsive lightbox script with focus on performance.",
"homepage": "http://dimsemenov.com/plugins/magnific-popup/"
}

View File

@@ -0,0 +1,133 @@
$(document).ready(function() {
$('.image-popup-vertical-fit').magnificPopup({
type: 'image',
closeOnContentClick: true,
mainClass: 'mfp-img-mobile',
image: {
verticalFit: true
}
});
$('.image-popup-fit-width').magnificPopup({
type: 'image',
closeOnContentClick: true,
image: {
verticalFit: false
}
});
$('.image-popup-no-margins').magnificPopup({
type: 'image',
closeOnContentClick: true,
closeBtnInside: false,
fixedContentPos: true,
mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side
image: {
verticalFit: true
},
zoom: {
enabled: true,
duration: 300 // don't foget to change the duration also in CSS
}
});
$('.popup-gallery').magnificPopup({
delegate: 'a',
type: 'image',
tLoading: 'Loading image #%curr%...',
mainClass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
image: {
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
titleSrc: function(item) {
return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';
}
}
});
$('.zoom-gallery').magnificPopup({
delegate: 'a',
type: 'image',
closeOnContentClick: false,
closeBtnInside: false,
mainClass: 'mfp-with-zoom mfp-img-mobile',
image: {
verticalFit: true,
titleSrc: function(item) {
return item.el.attr('title') + ' &middot; <a class="image-source-link" href="'+item.el.attr('data-source')+'" target="_blank">image source</a>';
}
},
gallery: {
enabled: true
},
zoom: {
enabled: true,
duration: 300, // don't foget to change the duration also in CSS
opener: function(element) {
return element.find('img');
}
}
});
$('#image-popups').magnificPopup({
delegate: 'a',
type: 'image',
removalDelay: 500, //delay removal by X to allow out-animation
callbacks: {
beforeOpen: function() {
// just a hack that adds mfp-anim class to markup
this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
this.st.mainClass = this.st.el.attr('data-effect');
}
},
closeOnContentClick: true,
midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
});
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
$('.popup-with-form').magnificPopup({
type: 'inline',
preloader: false,
focus: '#name',
// When elemened is focused, some mobile browsers in some cases zoom in
// It looks not nice, so we disable it:
callbacks: {
beforeOpen: function() {
if($(window).width() < 700) {
this.st.focus = false;
} else {
this.st.focus = '#name';
}
}
}
});
$('.simple-ajax-popup-align-top').magnificPopup({
type: 'ajax',
alignTop: true,
overflowY: 'scroll' // as we know that popup content is tall we set scroll overflow by default to avoid jump
});
$('.simple-ajax-popup').magnificPopup({
type: 'ajax'
});
});

View File

@@ -0,0 +1,644 @@
/* Magnific Popup CSS */
.mfp-bg {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1042;
overflow: hidden;
position: fixed;
background: #0b0b0b;
opacity: 0.8; }
.mfp-wrap {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1043;
position: fixed;
outline: none !important;
overflow-y: auto;
-webkit-backface-visibility: hidden; }
.mfp-container {
text-align: center;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
padding: 0 8px;
box-sizing: border-box; }
.mfp-container:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle; }
.mfp-align-top .mfp-container:before {
display: none; }
.mfp-content {
position: relative;
display: inline-block;
vertical-align: middle;
margin: 0 auto;
text-align: left;
z-index: 1045; }
.mfp-inline-holder .mfp-content,
.mfp-ajax-holder .mfp-content {
width: 100%;
cursor: auto; }
.mfp-ajax-cur {
cursor: progress; }
.mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close {
cursor: -moz-zoom-out;
cursor: -webkit-zoom-out;
cursor: zoom-out; }
.mfp-zoom {
cursor: pointer;
cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
cursor: zoom-in; }
.mfp-auto-cursor .mfp-content {
cursor: auto; }
.mfp-close,
.mfp-arrow,
.mfp-preloader,
.mfp-counter {
-webkit-user-select: none;
-moz-user-select: none;
user-select: none; }
.mfp-loading.mfp-figure {
display: none; }
.mfp-hide {
display: none !important; }
.mfp-preloader {
color: #CCC;
position: absolute;
top: 50%;
width: auto;
text-align: center;
margin-top: -0.8em;
left: 8px;
right: 8px;
z-index: 1044; }
.mfp-preloader a {
color: #CCC; }
.mfp-preloader a:hover {
color: #FFF; }
.mfp-s-ready .mfp-preloader {
display: none; }
.mfp-s-error .mfp-content {
display: none; }
button.mfp-close,
button.mfp-arrow {
overflow: visible;
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none;
display: block;
outline: none;
padding: 0;
z-index: 1046;
box-shadow: none;
touch-action: manipulation; }
button::-moz-focus-inner {
padding: 0;
border: 0; }
.mfp-close {
width: 44px;
height: 44px;
line-height: 44px;
position: absolute;
right: 0;
top: 0;
text-decoration: none;
text-align: center;
opacity: 0.65;
padding: 0 0 18px 10px;
color: #FFF;
font-style: normal;
font-size: 28px;
font-family: Arial, Baskerville, monospace; }
.mfp-close:hover,
.mfp-close:focus {
opacity: 1; }
.mfp-close:active {
top: 1px; }
.mfp-close-btn-in .mfp-close {
color: #333; }
.mfp-image-holder .mfp-close,
.mfp-iframe-holder .mfp-close {
color: #FFF;
right: -6px;
text-align: right;
padding-right: 6px;
width: 100%; }
.mfp-counter {
position: absolute;
top: 0;
right: 0;
color: #CCC;
font-size: 12px;
line-height: 18px;
white-space: nowrap; }
.mfp-arrow {
position: absolute;
opacity: 0.65;
margin: 0;
top: 50%;
margin-top: -55px;
padding: 0;
width: 90px;
height: 110px;
-webkit-tap-highlight-color: transparent; }
.mfp-arrow:active {
margin-top: -54px; }
.mfp-arrow:hover,
.mfp-arrow:focus {
opacity: 1; }
.mfp-arrow:before,
.mfp-arrow:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 0;
top: 0;
margin-top: 35px;
margin-left: 35px;
border: medium inset transparent; }
.mfp-arrow:after {
border-top-width: 13px;
border-bottom-width: 13px;
top: 8px; }
.mfp-arrow:before {
border-top-width: 21px;
border-bottom-width: 21px;
opacity: 0.7; }
.mfp-arrow-left {
left: 0; }
.mfp-arrow-left:after {
border-right: 17px solid #FFF;
margin-left: 31px; }
.mfp-arrow-left:before {
margin-left: 25px;
border-right: 27px solid #3F3F3F; }
.mfp-arrow-right {
right: 0; }
.mfp-arrow-right:after {
border-left: 17px solid #FFF;
margin-left: 39px; }
.mfp-arrow-right:before {
border-left: 27px solid #3F3F3F; }
.mfp-iframe-holder {
padding-top: 40px;
padding-bottom: 40px; }
.mfp-iframe-holder .mfp-content {
line-height: 0;
width: 100%;
max-width: 900px; }
.mfp-iframe-holder .mfp-close {
top: -40px; }
.mfp-iframe-scaler {
width: 100%;
height: 0;
overflow: hidden;
padding-top: 56.25%; }
.mfp-iframe-scaler iframe {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
background: #000; }
/* Main image in popup */
img.mfp-img {
width: auto;
max-width: 100%;
height: auto;
display: block;
line-height: 0;
box-sizing: border-box;
padding: 40px 0 40px;
margin: 0 auto; }
/* The shadow behind the image */
.mfp-figure {
line-height: 0; }
.mfp-figure:after {
content: '';
position: absolute;
left: 0;
top: 40px;
bottom: 40px;
display: block;
right: 0;
width: auto;
height: auto;
z-index: -1;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
background: #444; }
.mfp-figure small {
color: #BDBDBD;
display: block;
font-size: 12px;
line-height: 14px; }
.mfp-figure figure {
margin: 0; }
.mfp-bottom-bar {
margin-top: -36px;
position: absolute;
top: 100%;
left: 0;
width: 100%;
cursor: auto; }
.mfp-title {
text-align: left;
line-height: 18px;
color: #F3F3F3;
word-wrap: break-word;
padding-right: 36px; }
.mfp-image-holder .mfp-content {
max-width: 100%; }
.mfp-gallery .mfp-image-holder .mfp-figure {
cursor: pointer; }
@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) {
/**
* Remove all paddings around the image on small screen
*/
.mfp-img-mobile .mfp-image-holder {
padding-left: 0;
padding-right: 0; }
.mfp-img-mobile img.mfp-img {
padding: 0; }
.mfp-img-mobile .mfp-figure:after {
top: 0;
bottom: 0; }
.mfp-img-mobile .mfp-figure small {
display: inline;
margin-left: 5px; }
.mfp-img-mobile .mfp-bottom-bar {
background: rgba(0, 0, 0, 0.6);
bottom: 0;
margin: 0;
top: auto;
padding: 3px 5px;
position: fixed;
box-sizing: border-box; }
.mfp-img-mobile .mfp-bottom-bar:empty {
padding: 0; }
.mfp-img-mobile .mfp-counter {
right: 5px;
top: 3px; }
.mfp-img-mobile .mfp-close {
top: 0;
right: 0;
width: 35px;
height: 35px;
line-height: 35px;
background: rgba(0, 0, 0, 0.6);
position: fixed;
text-align: center;
padding: 0; } }
@media all and (max-width: 900px) {
.mfp-arrow {
-webkit-transform: scale(0.75);
transform: scale(0.75); }
.mfp-arrow-left {
-webkit-transform-origin: 0;
transform-origin: 0; }
.mfp-arrow-right {
-webkit-transform-origin: 100%;
transform-origin: 100%; }
.mfp-container {
padding-left: 6px;
padding-right: 6px; } }
/*
====== Zoom effect ======
*/
.mfp-zoom-in {
/* start state */
/* animate in */
/* animate out */
}
.mfp-zoom-in .mfp-with-anim {
opacity: 0;
transition: all 0.2s ease-in-out;
transform: scale(0.8);
}
.mfp-zoom-in.mfp-bg {
opacity: 0;
transition: all 0.3s ease-out;
}
.mfp-zoom-in.mfp-ready .mfp-with-anim {
opacity: 1;
transform: scale(1);
}
.mfp-zoom-in.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-zoom-in.mfp-removing .mfp-with-anim {
transform: scale(0.8);
opacity: 0;
}
.mfp-zoom-in.mfp-removing.mfp-bg {
opacity: 0;
}
/*
====== Newspaper effect ======
*/
.mfp-newspaper {
/* start state */
/* animate in */
/* animate out */
}
.mfp-newspaper .mfp-with-anim {
opacity: 0;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.5s;
transform: scale(0) rotate(500deg);
}
.mfp-newspaper.mfp-bg {
opacity: 0;
transition: all 0.5s;
}
.mfp-newspaper.mfp-ready .mfp-with-anim {
opacity: 1;
transform: scale(1) rotate(0deg);
}
.mfp-newspaper.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-newspaper.mfp-removing .mfp-with-anim {
transform: scale(0) rotate(500deg);
opacity: 0;
}
.mfp-newspaper.mfp-removing.mfp-bg {
opacity: 0;
}
/*
====== Move-horizontal effect ======
*/
.mfp-move-horizontal {
/* start state */
/* animate in */
/* animate out */
}
.mfp-move-horizontal .mfp-with-anim {
opacity: 0;
transition: all 0.3s;
transform: translateX(-50px);
}
.mfp-move-horizontal.mfp-bg {
opacity: 0;
transition: all 0.3s;
}
.mfp-move-horizontal.mfp-ready .mfp-with-anim {
opacity: 1;
transform: translateX(0);
}
.mfp-move-horizontal.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-move-horizontal.mfp-removing .mfp-with-anim {
transform: translateX(50px);
opacity: 0;
}
.mfp-move-horizontal.mfp-removing.mfp-bg {
opacity: 0;
}
/*
====== Move-from-top effect ======
*/
.mfp-move-from-top {
/* start state */
/* animate in */
/* animate out */
}
.mfp-move-from-top .mfp-content {
vertical-align: top;
}
.mfp-move-from-top .mfp-with-anim {
opacity: 0;
transition: all 0.2s;
transform: translateY(-100px);
}
.mfp-move-from-top.mfp-bg {
opacity: 0;
transition: all 0.2s;
}
.mfp-move-from-top.mfp-ready .mfp-with-anim {
opacity: 1;
transform: translateY(0);
}
.mfp-move-from-top.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-move-from-top.mfp-removing .mfp-with-anim {
transform: translateY(-50px);
opacity: 0;
}
.mfp-move-from-top.mfp-removing.mfp-bg {
opacity: 0;
}
/*
====== 3d unfold ======
*/
.mfp-3d-unfold {
/* start state */
/* animate in */
/* animate out */
}
.mfp-3d-unfold .mfp-content {
perspective: 2000px;
}
.mfp-3d-unfold .mfp-with-anim {
opacity: 0;
transition: all 0.3s ease-in-out;
transform-style: preserve-3d;
transform: rotateY(-60deg);
}
.mfp-3d-unfold.mfp-bg {
opacity: 0;
transition: all 0.5s;
}
.mfp-3d-unfold.mfp-ready .mfp-with-anim {
opacity: 1;
transform: rotateY(0deg);
}
.mfp-3d-unfold.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-3d-unfold.mfp-removing .mfp-with-anim {
transform: rotateY(60deg);
opacity: 0;
}
.mfp-3d-unfold.mfp-removing.mfp-bg {
opacity: 0;
}
/*
====== Zoom-out effect ======
*/
.mfp-zoom-out {
/* start state */
/* animate in */
/* animate out */
}
.mfp-zoom-out .mfp-with-anim {
opacity: 0;
transition: all 0.3s ease-in-out;
transform: scale(1.3);
}
.mfp-zoom-out.mfp-bg {
opacity: 0;
transition: all 0.3s ease-out;
}
.mfp-zoom-out.mfp-ready .mfp-with-anim {
opacity: 1;
transform: scale(1);
}
.mfp-zoom-out.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-zoom-out.mfp-removing .mfp-with-anim {
transform: scale(1.3);
opacity: 0;
}
.mfp-zoom-out.mfp-removing.mfp-bg {
opacity: 0;
}
/*
====== "Hinge" close effect ======
*/
@keyframes hinge {
0% {
transform: rotate(0);
transform-origin: top left;
animation-timing-function: ease-in-out;
}
20%,
60% {
transform: rotate(80deg);
transform-origin: top left;
animation-timing-function: ease-in-out;
}
40% {
transform: rotate(60deg);
transform-origin: top left;
animation-timing-function: ease-in-out;
}
80% {
transform: rotate(60deg) translateY(0);
opacity: 1;
transform-origin: top left;
animation-timing-function: ease-in-out;
}
100% {
transform: translateY(700px);
opacity: 0;
}
}
.hinge {
animation-duration: 1s;
animation-name: hinge;
}
.mfp-with-fade .mfp-content,
.mfp-with-fade.mfp-bg {
opacity: 0;
transition: opacity 0.5s ease-out;
}
.mfp-with-fade.mfp-ready .mfp-content {
opacity: 1;
}
.mfp-with-fade.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-with-fade.mfp-removing.mfp-bg {
opacity: 0;
}
.white-popup-block{
background: #FFF;
padding: 20px 30px;
text-align: left;
max-width: 650px;
margin: 40px auto;
position: relative;}
.mfp-fade.mfp-bg {
opacity: 0;
-webkit-transition: all 0.15s ease-out;
-moz-transition: all 0.15s ease-out;
transition: all 0.15s ease-out;
}
.mfp-fade.mfp-bg.mfp-ready {
opacity: 0.8;
}
.mfp-fade.mfp-bg.mfp-removing {
opacity: 0;
}
.mfp-fade.mfp-wrap .mfp-content {
opacity: 0;
-webkit-transition: all 0.15s ease-out;
-moz-transition: all 0.15s ease-out;
transition: all 0.15s ease-out;
}
.mfp-fade.mfp-wrap.mfp-ready .mfp-content {
opacity: 1;
}
.mfp-fade.mfp-wrap.mfp-removing .mfp-content {
opacity: 0;

View File

@@ -0,0 +1,12 @@
(function() {
// Default to the local version.
var path = '../libs/jquery/jquery.js';
// Get any jquery=___ param from the query string.
var jqversion = location.search.match(/[?&]jquery=(.*?)(?=&|$)/);
// If a version was specified, use that version from code.jquery.com.
if (jqversion) {
path = 'http://code.jquery.com/jquery-' + jqversion[1] + '.js';
}
// This is the only time I'll ever use document.write, I promise!
document.write('<script src="' + path + '"></script>');
}());

View File

@@ -0,0 +1,244 @@
/**
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
*
* http://qunitjs.com
*
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*/
/** Font Family and Sizes */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
}
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
#qunit-tests { font-size: smaller; }
/** Resets */
#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
margin: 0;
padding: 0;
}
/** Header */
#qunit-header {
padding: 0.5em 0 0.5em 1em;
color: #8699a4;
background-color: #0d3349;
font-size: 1.5em;
line-height: 1em;
font-weight: normal;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
}
#qunit-header a {
text-decoration: none;
color: #c2ccd1;
}
#qunit-header a:hover,
#qunit-header a:focus {
color: #fff;
}
#qunit-testrunner-toolbar label {
display: inline-block;
padding: 0 .5em 0 .1em;
}
#qunit-banner {
height: 5px;
}
#qunit-testrunner-toolbar {
padding: 0.5em 0 0.5em 2em;
color: #5E740B;
background-color: #eee;
overflow: hidden;
}
#qunit-userAgent {
padding: 0.5em 0 0.5em 2.5em;
background-color: #2b81af;
color: #fff;
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
}
#qunit-modulefilter-container {
float: right;
}
/** Tests: Pass/Fail */
#qunit-tests {
list-style-position: inside;
}
#qunit-tests li {
padding: 0.4em 0.5em 0.4em 2.5em;
border-bottom: 1px solid #fff;
list-style-position: inside;
}
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
display: none;
}
#qunit-tests li strong {
cursor: pointer;
}
#qunit-tests li a {
padding: 0.5em;
color: #c2ccd1;
text-decoration: none;
}
#qunit-tests li a:hover,
#qunit-tests li a:focus {
color: #000;
}
#qunit-tests li .runtime {
float: right;
font-size: smaller;
}
.qunit-assert-list {
margin-top: 0.5em;
padding: 0.5em;
background-color: #fff;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.qunit-collapsed {
display: none;
}
#qunit-tests table {
border-collapse: collapse;
margin-top: .2em;
}
#qunit-tests th {
text-align: right;
vertical-align: top;
padding: 0 .5em 0 0;
}
#qunit-tests td {
vertical-align: top;
}
#qunit-tests pre {
margin: 0;
white-space: pre-wrap;
word-wrap: break-word;
}
#qunit-tests del {
background-color: #e0f2be;
color: #374e0c;
text-decoration: none;
}
#qunit-tests ins {
background-color: #ffcaca;
color: #500;
text-decoration: none;
}
/*** Test Counts */
#qunit-tests b.counts { color: black; }
#qunit-tests b.passed { color: #5E740B; }
#qunit-tests b.failed { color: #710909; }
#qunit-tests li li {
padding: 5px;
background-color: #fff;
border-bottom: none;
list-style-position: inside;
}
/*** Passing Styles */
#qunit-tests li li.pass {
color: #3c510c;
background-color: #fff;
border-left: 10px solid #C6E746;
}
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
#qunit-tests .pass .test-name { color: #366097; }
#qunit-tests .pass .test-actual,
#qunit-tests .pass .test-expected { color: #999999; }
#qunit-banner.qunit-pass { background-color: #C6E746; }
/*** Failing Styles */
#qunit-tests li li.fail {
color: #710909;
background-color: #fff;
border-left: 10px solid #EE5757;
white-space: pre;
}
#qunit-tests > li:last-child {
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
}
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
#qunit-tests .fail .test-name,
#qunit-tests .fail .module-name { color: #000000; }
#qunit-tests .fail .test-actual { color: #EE5757; }
#qunit-tests .fail .test-expected { color: green; }
#qunit-banner.qunit-fail { background-color: #EE5757; }
/** Result */
#qunit-testresult {
padding: 0.5em 0.5em 0.5em 2.5em;
color: #2b81af;
background-color: #D2E0E6;
border-bottom: 1px solid white;
}
#qunit-testresult .module-name {
font-weight: bold;
}
/** Fixture */
#qunit-fixture {
position: absolute;
top: -10000px;
left: -10000px;
width: 1000px;
height: 1000px;
}

View File

@@ -0,0 +1,29 @@
{
"name": "magnific-popup",
"title": "Magnific Popup",
"description": "Fast, light, mobile-friendly and responsive lightbox and modal dialog plugin. Open inline HTML, ajax loaded content, image, form, iframe (YouTube video, Vimeo, Google Maps), photo gallery. Animation effects added with CSS3 transitions. For jQuery or Zepto.",
"version": "1.1.0",
"homepage": "http://dimsemenov.com/plugins/magnific-popup/",
"demo": "http://dimsemenov.com/plugins/magnific-popup/",
"docs": "http://dimsemenov.com/plugins/magnific-popup/documentation.html",
"author": {
"name": "Dmitry Semenov",
"email": "diiiimaaaa@gmail.com",
"url": "http://dimsemenov.com"
},
"repository": {
"type": "git",
"url": "https://github.com/dimsemenov/Magnific-Popup.git"
},
"bugs": "https://github.com/dimsemenov/Magnific-Popup/issues",
"dependencies": {
"jquery": ">=1.8.0"
},
"keywords": ["lightbox","popup","modal","window","dialog","ui","gallery","slideshow","video","image","ajax","html5","animation","jquery","photo","responsive","mobile"],
"licenses": [
{
"type": "MIT",
"url": "http://www.opensource.org/licenses/mit-license.php"
}
]
}

View File

@@ -0,0 +1,55 @@
{
"name": "magnific-popup",
"version": "1.1.0",
"title": "Magnific Popup",
"description": "Lightbox and modal dialog plugin. Can display inline HTML, iframes (YouTube video, Vimeo, Google Maps), or an image gallery. Animation effects are added with CSS3 transitions. For jQuery or Zepto.",
"keywords": [
"ecosystem:jquery",
"jquery-plugin",
"zepto",
"lightbox",
"popup",
"modal",
"window",
"dialog",
"gallery",
"jquery",
"photo",
"responsive",
"mobile"
],
"author": {
"name": "Dmitry Semenov",
"email": "diiiimaaaa@gmail.com",
"web": "http://dimsemenov.com"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/dimsemenov/Magnific-Popup/issues"
},
"main": "dist/jquery.magnific-popup.js",
"style": "dist/magnific-popup.css",
"homepage": "http://dimsemenov.com/plugins/magnific-popup/",
"engines": {
"node": ">= 0.8.0"
},
"scripts": {
"test": "grunt jshint"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-clean": "~0.6.0",
"grunt-contrib-concat": "^0.5.1",
"grunt-contrib-copy": "~0.8.1",
"grunt-contrib-cssmin": "^0.14.0",
"grunt-contrib-jshint": "~0.11.3",
"grunt-contrib-uglify": "~0.9.2",
"grunt-contrib-watch": "~0.6.1",
"grunt-jekyll": "~0.4.2",
"grunt-sass": "~1.0.0"
},
"repository": {
"type": "git",
"url": "https://github.com/dimsemenov/Magnific-Popup.git"
}
}

View File

@@ -0,0 +1,44 @@
////////////////////////
// Settings //
////////////////////////
// overlay
$mfp-overlay-color: #0b0b0b !default; // Color of overlay screen
$mfp-overlay-opacity: 0.8 !default; // Opacity of overlay screen
$mfp-shadow: 0 0 8px rgba(0, 0, 0, 0.6) !default; // Shadow on image or iframe
// spacing
$mfp-popup-padding-left: 8px !default; // Padding from left and from right side
$mfp-popup-padding-left-mobile: 6px !default; // Same as above, but is applied when width of window is less than 800px
$mfp-z-index-base: 1040 !default; // Base z-index of popup
// controls
$mfp-include-arrows: true !default; // Include styles for nav arrows
$mfp-controls-opacity: 0.65 !default; // Opacity of controls
$mfp-controls-color: #FFF !default; // Color of controls
$mfp-controls-border-color: #3F3F3F !default; // Border color of controls
$mfp-inner-close-icon-color: #333 !default; // Color of close button when inside
$mfp-controls-text-color: #CCC !default; // Color of preloader and "1 of X" indicator
$mfp-controls-text-color-hover: #FFF !default; // Hover color of preloader and "1 of X" indicator
// Iframe-type options
$mfp-include-iframe-type: true !default; // Enable Iframe-type popups
$mfp-iframe-padding-top: 40px !default; // Iframe padding top
$mfp-iframe-background: #000 !default; // Background color of iframes
$mfp-iframe-max-width: 900px !default; // Maximum width of iframes
$mfp-iframe-ratio: 9/16 !default; // Ratio of iframe (9/16 = widescreen, 3/4 = standard, etc.)
// Image-type options
$mfp-include-image-type: true !default; // Enable Image-type popups
$mfp-image-background: #444 !default;
$mfp-image-padding-top: 40px !default; // Image padding top
$mfp-image-padding-bottom: 40px !default; // Image padding bottom
$mfp-include-mobile-layout-for-image: true !default; // Removes paddings from top and bottom
// Image caption options
$mfp-caption-title-color: #F3F3F3 !default; // Caption title color
$mfp-caption-subtitle-color: #BDBDBD !default; // Caption subtitle color
// A11y
$mfp-use-visuallyhidden: false !default; // Hide content from browsers, but make it available for screen readers

View File

@@ -0,0 +1,543 @@
/* Magnific Popup CSS */
@import "settings";
////////////////////////
//
// Contents:
//
// 1. General styles
// - Transluscent overlay
// - Containers, wrappers
// - Cursors
// - Helper classes
// 2. Appearance
// - Preloader & text that displays error messages
// - CSS reset for buttons
// - Close icon
// - "1 of X" counter
// - Navigation (left/right) arrows
// - Iframe content type styles
// - Image content type styles
// - Media query where size of arrows is reduced
// - IE7 support
//
////////////////////////
////////////////////////
// 1. General styles
////////////////////////
// Transluscent overlay
.mfp-bg {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: $mfp-z-index-base + 2;
overflow: hidden;
position: fixed;
background: $mfp-overlay-color;
opacity: $mfp-overlay-opacity;
}
// Wrapper for popup
.mfp-wrap {
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: $mfp-z-index-base + 3;
position: fixed;
outline: none !important;
-webkit-backface-visibility: hidden; // fixes webkit bug that can cause "false" scrollbar
}
// Root container
.mfp-container {
text-align: center;
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
padding: 0 $mfp-popup-padding-left;
box-sizing: border-box;
}
// Vertical centerer helper
.mfp-container {
&:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
}
}
// Remove vertical centering when popup has class `mfp-align-top`
.mfp-align-top {
.mfp-container {
&:before {
display: none;
}
}
}
// Popup content holder
.mfp-content {
position: relative;
display: inline-block;
vertical-align: middle;
margin: 0 auto;
text-align: left;
z-index: $mfp-z-index-base + 5;
}
.mfp-inline-holder,
.mfp-ajax-holder {
.mfp-content {
width: 100%;
cursor: auto;
}
}
// Cursors
.mfp-ajax-cur {
cursor: progress;
}
.mfp-zoom-out-cur {
&, .mfp-image-holder .mfp-close {
cursor: -moz-zoom-out;
cursor: -webkit-zoom-out;
cursor: zoom-out;
}
}
.mfp-zoom {
cursor: pointer;
cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
cursor: zoom-in;
}
.mfp-auto-cursor {
.mfp-content {
cursor: auto;
}
}
.mfp-close,
.mfp-arrow,
.mfp-preloader,
.mfp-counter {
-webkit-user-select:none;
-moz-user-select: none;
user-select: none;
}
// Hide the image during the loading
.mfp-loading {
&.mfp-figure {
display: none;
}
}
// Helper class that hides stuff
@if $mfp-use-visuallyhidden {
// From HTML5 Boilerplate https://github.com/h5bp/html5-boilerplate/blob/v4.2.0/doc/css.md#visuallyhidden
.mfp-hide {
border: 0 !important;
clip: rect(0 0 0 0) !important;
height: 1px !important;
margin: -1px !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
width: 1px !important;
}
} @else {
.mfp-hide {
display: none !important;
}
}
////////////////////////
// 2. Appearance
////////////////////////
// Preloader and text that displays error messages
.mfp-preloader {
color: $mfp-controls-text-color;
position: absolute;
top: 50%;
width: auto;
text-align: center;
margin-top: -0.8em;
left: 8px;
right: 8px;
z-index: $mfp-z-index-base + 4;
a {
color: $mfp-controls-text-color;
&:hover {
color: $mfp-controls-text-color-hover;
}
}
}
// Hide preloader when content successfully loaded
.mfp-s-ready {
.mfp-preloader {
display: none;
}
}
// Hide content when it was not loaded
.mfp-s-error {
.mfp-content {
display: none;
}
}
// CSS-reset for buttons
button {
&.mfp-close,
&.mfp-arrow {
overflow: visible;
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none;
display: block;
outline: none;
padding: 0;
z-index: $mfp-z-index-base + 6;
box-shadow: none;
touch-action: manipulation;
}
&::-moz-focus-inner {
padding: 0;
border: 0
}
}
// Close icon
.mfp-close {
width: 44px;
height: 44px;
line-height: 44px;
position: absolute;
right: 0;
top: 0;
text-decoration: none;
text-align: center;
opacity: $mfp-controls-opacity;
padding: 0 0 18px 10px;
color: $mfp-controls-color;
font-style: normal;
font-size: 28px;
font-family: Arial, Baskerville, monospace;
&:hover,
&:focus {
opacity: 1;
}
&:active {
top: 1px;
}
}
.mfp-close-btn-in {
.mfp-close {
color: $mfp-inner-close-icon-color;
}
}
.mfp-image-holder,
.mfp-iframe-holder {
.mfp-close {
color: $mfp-controls-color;
right: -6px;
text-align: right;
padding-right: 6px;
width: 100%;
}
}
// "1 of X" counter
.mfp-counter {
position: absolute;
top: 0;
right: 0;
color: $mfp-controls-text-color;
font-size: 12px;
line-height: 18px;
white-space: nowrap;
}
// Navigation arrows
@if $mfp-include-arrows {
.mfp-arrow {
position: absolute;
opacity: $mfp-controls-opacity;
margin: 0;
top: 50%;
margin-top: -55px;
padding: 0;
width: 90px;
height: 110px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
&:active {
margin-top: -54px;
}
&:hover,
&:focus {
opacity: 1;
}
&:before,
&:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 0;
top: 0;
margin-top: 35px;
margin-left: 35px;
border: medium inset transparent;
}
&:after {
border-top-width: 13px;
border-bottom-width: 13px;
top:8px;
}
&:before {
border-top-width: 21px;
border-bottom-width: 21px;
opacity: 0.7;
}
}
.mfp-arrow-left {
left: 0;
&:after {
border-right: 17px solid $mfp-controls-color;
margin-left: 31px;
}
&:before {
margin-left: 25px;
border-right: 27px solid $mfp-controls-border-color;
}
}
.mfp-arrow-right {
right: 0;
&:after {
border-left: 17px solid $mfp-controls-color;
margin-left: 39px
}
&:before {
border-left: 27px solid $mfp-controls-border-color;
}
}
}
// Iframe content type
@if $mfp-include-iframe-type {
.mfp-iframe-holder {
padding-top: $mfp-iframe-padding-top;
padding-bottom: $mfp-iframe-padding-top;
.mfp-content {
line-height: 0;
width: 100%;
max-width: $mfp-iframe-max-width;
}
.mfp-close {
top: -40px;
}
}
.mfp-iframe-scaler {
width: 100%;
height: 0;
overflow: hidden;
padding-top: $mfp-iframe-ratio * 100%;
iframe {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
box-shadow: $mfp-shadow;
background: $mfp-iframe-background;
}
}
}
// Image content type
@if $mfp-include-image-type {
/* Main image in popup */
img {
&.mfp-img {
width: auto;
max-width: 100%;
height: auto;
display: block;
line-height: 0;
box-sizing: border-box;
padding: $mfp-image-padding-top 0 $mfp-image-padding-bottom;
margin: 0 auto;
}
}
/* The shadow behind the image */
.mfp-figure {
line-height: 0;
&:after {
content: '';
position: absolute;
left: 0;
top: $mfp-image-padding-top;
bottom: $mfp-image-padding-bottom;
display: block;
right: 0;
width: auto;
height: auto;
z-index: -1;
box-shadow: $mfp-shadow;
background: $mfp-image-background;
}
small {
color: $mfp-caption-subtitle-color;
display: block;
font-size: 12px;
line-height: 14px;
}
figure {
margin: 0;
}
}
.mfp-bottom-bar {
margin-top: -$mfp-image-padding-bottom + 4;
position: absolute;
top: 100%;
left: 0;
width: 100%;
cursor: auto;
}
.mfp-title {
text-align: left;
line-height: 18px;
color: $mfp-caption-title-color;
word-wrap: break-word;
padding-right: 36px; // leave some space for counter at right side
}
.mfp-image-holder {
.mfp-content {
max-width: 100%;
}
}
.mfp-gallery {
.mfp-image-holder {
.mfp-figure {
cursor: pointer;
}
}
}
@if $mfp-include-mobile-layout-for-image {
@media screen and (max-width: 800px) and (orientation:landscape), screen and (max-height: 300px) {
/**
* Remove all paddings around the image on small screen
*/
.mfp-img-mobile {
.mfp-image-holder {
padding-left: 0;
padding-right: 0;
}
img {
&.mfp-img {
padding: 0;
}
}
.mfp-figure {
// The shadow behind the image
&:after {
top: 0;
bottom: 0;
}
small {
display: inline;
margin-left: 5px;
}
}
.mfp-bottom-bar {
background: rgba(0,0,0,0.6);
bottom: 0;
margin: 0;
top: auto;
padding: 3px 5px;
position: fixed;
box-sizing: border-box;
&:empty {
padding: 0;
}
}
.mfp-counter {
right: 5px;
top: 3px;
}
.mfp-close {
top: 0;
right: 0;
width: 35px;
height: 35px;
line-height: 35px;
background: rgba(0, 0, 0, 0.6);
position: fixed;
text-align: center;
padding: 0;
}
}
}
}
}
// Scale navigation arrows and reduce padding from sides
@media all and (max-width: 900px) {
.mfp-arrow {
-webkit-transform: scale(0.75);
transform: scale(0.75);
}
.mfp-arrow-left {
-webkit-transform-origin: 0;
transform-origin: 0;
}
.mfp-arrow-right {
-webkit-transform-origin: 100%;
transform-origin: 100%;
}
.mfp-container {
padding-left: $mfp-popup-padding-left-mobile;
padding-right: $mfp-popup-padding-left-mobile;
}
}

View File

@@ -0,0 +1,77 @@
var AJAX_NS = 'ajax',
_ajaxCur,
_removeAjaxCursor = function() {
if(_ajaxCur) {
$(document.body).removeClass(_ajaxCur);
}
},
_destroyAjaxRequest = function() {
_removeAjaxCursor();
if(mfp.req) {
mfp.req.abort();
}
};
$.magnificPopup.registerModule(AJAX_NS, {
options: {
settings: null,
cursor: 'mfp-ajax-cur',
tError: '<a href="%url%">The content</a> could not be loaded.'
},
proto: {
initAjax: function() {
mfp.types.push(AJAX_NS);
_ajaxCur = mfp.st.ajax.cursor;
_mfpOn(CLOSE_EVENT+'.'+AJAX_NS, _destroyAjaxRequest);
_mfpOn('BeforeChange.' + AJAX_NS, _destroyAjaxRequest);
},
getAjax: function(item) {
if(_ajaxCur) {
$(document.body).addClass(_ajaxCur);
}
mfp.updateStatus('loading');
var opts = $.extend({
url: item.src,
success: function(data, textStatus, jqXHR) {
var temp = {
data:data,
xhr:jqXHR
};
_mfpTrigger('ParseAjax', temp);
mfp.appendContent( $(temp.data), AJAX_NS );
item.finished = true;
_removeAjaxCursor();
mfp._setFocus();
setTimeout(function() {
mfp.wrap.addClass(READY_CLASS);
}, 16);
mfp.updateStatus('ready');
_mfpTrigger('AjaxContentAdded');
},
error: function() {
_removeAjaxCursor();
item.finished = item.loadError = true;
mfp.updateStatus('error', mfp.st.ajax.tError.replace('%url%', item.src));
}
}, mfp.st.ajax.settings);
mfp.req = $.ajax(opts);
return '';
}
}
});

View File

@@ -0,0 +1,939 @@
/**
*
* Magnific Popup Core JS file
*
*/
/**
* Private static constants
*/
var CLOSE_EVENT = 'Close',
BEFORE_CLOSE_EVENT = 'BeforeClose',
AFTER_CLOSE_EVENT = 'AfterClose',
BEFORE_APPEND_EVENT = 'BeforeAppend',
MARKUP_PARSE_EVENT = 'MarkupParse',
OPEN_EVENT = 'Open',
CHANGE_EVENT = 'Change',
NS = 'mfp',
EVENT_NS = '.' + NS,
READY_CLASS = 'mfp-ready',
REMOVING_CLASS = 'mfp-removing',
PREVENT_CLOSE_CLASS = 'mfp-prevent-close';
/**
* Private vars
*/
/*jshint -W079 */
var mfp, // As we have only one instance of MagnificPopup object, we define it locally to not to use 'this'
MagnificPopup = function(){},
_isJQ = !!(window.jQuery),
_prevStatus,
_window = $(window),
_document,
_prevContentType,
_wrapClasses,
_currPopupType;
/**
* Private functions
*/
var _mfpOn = function(name, f) {
mfp.ev.on(NS + name + EVENT_NS, f);
},
_getEl = function(className, appendTo, html, raw) {
var el = document.createElement('div');
el.className = 'mfp-'+className;
if(html) {
el.innerHTML = html;
}
if(!raw) {
el = $(el);
if(appendTo) {
el.appendTo(appendTo);
}
} else if(appendTo) {
appendTo.appendChild(el);
}
return el;
},
_mfpTrigger = function(e, data) {
mfp.ev.triggerHandler(NS + e, data);
if(mfp.st.callbacks) {
// converts "mfpEventName" to "eventName" callback and triggers it if it's present
e = e.charAt(0).toLowerCase() + e.slice(1);
if(mfp.st.callbacks[e]) {
mfp.st.callbacks[e].apply(mfp, $.isArray(data) ? data : [data]);
}
}
},
_getCloseBtn = function(type) {
if(type !== _currPopupType || !mfp.currTemplate.closeBtn) {
mfp.currTemplate.closeBtn = $( mfp.st.closeMarkup.replace('%title%', mfp.st.tClose ) );
_currPopupType = type;
}
return mfp.currTemplate.closeBtn;
},
// Initialize Magnific Popup only when called at least once
_checkInstance = function() {
if(!$.magnificPopup.instance) {
/*jshint -W020 */
mfp = new MagnificPopup();
mfp.init();
$.magnificPopup.instance = mfp;
}
},
// CSS transition detection, http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
supportsTransitions = function() {
var s = document.createElement('p').style, // 's' for style. better to create an element if body yet to exist
v = ['ms','O','Moz','Webkit']; // 'v' for vendor
if( s['transition'] !== undefined ) {
return true;
}
while( v.length ) {
if( v.pop() + 'Transition' in s ) {
return true;
}
}
return false;
};
/**
* Public functions
*/
MagnificPopup.prototype = {
constructor: MagnificPopup,
/**
* Initializes Magnific Popup plugin.
* This function is triggered only once when $.fn.magnificPopup or $.magnificPopup is executed
*/
init: function() {
var appVersion = navigator.appVersion;
mfp.isLowIE = mfp.isIE8 = document.all && !document.addEventListener;
mfp.isAndroid = (/android/gi).test(appVersion);
mfp.isIOS = (/iphone|ipad|ipod/gi).test(appVersion);
mfp.supportsTransition = supportsTransitions();
// We disable fixed positioned lightbox on devices that don't handle it nicely.
// If you know a better way of detecting this - let me know.
mfp.probablyMobile = (mfp.isAndroid || mfp.isIOS || /(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent) );
_document = $(document);
mfp.popupsCache = {};
},
/**
* Opens popup
* @param data [description]
*/
open: function(data) {
var i;
if(data.isObj === false) {
// convert jQuery collection to array to avoid conflicts later
mfp.items = data.items.toArray();
mfp.index = 0;
var items = data.items,
item;
for(i = 0; i < items.length; i++) {
item = items[i];
if(item.parsed) {
item = item.el[0];
}
if(item === data.el[0]) {
mfp.index = i;
break;
}
}
} else {
mfp.items = $.isArray(data.items) ? data.items : [data.items];
mfp.index = data.index || 0;
}
// if popup is already opened - we just update the content
if(mfp.isOpen) {
mfp.updateItemHTML();
return;
}
mfp.types = [];
_wrapClasses = '';
if(data.mainEl && data.mainEl.length) {
mfp.ev = data.mainEl.eq(0);
} else {
mfp.ev = _document;
}
if(data.key) {
if(!mfp.popupsCache[data.key]) {
mfp.popupsCache[data.key] = {};
}
mfp.currTemplate = mfp.popupsCache[data.key];
} else {
mfp.currTemplate = {};
}
mfp.st = $.extend(true, {}, $.magnificPopup.defaults, data );
mfp.fixedContentPos = mfp.st.fixedContentPos === 'auto' ? !mfp.probablyMobile : mfp.st.fixedContentPos;
if(mfp.st.modal) {
mfp.st.closeOnContentClick = false;
mfp.st.closeOnBgClick = false;
mfp.st.showCloseBtn = false;
mfp.st.enableEscapeKey = false;
}
// Building markup
// main containers are created only once
if(!mfp.bgOverlay) {
// Dark overlay
mfp.bgOverlay = _getEl('bg').on('click'+EVENT_NS, function() {
mfp.close();
});
mfp.wrap = _getEl('wrap').attr('tabindex', -1).on('click'+EVENT_NS, function(e) {
if(mfp._checkIfClose(e.target)) {
mfp.close();
}
});
mfp.container = _getEl('container', mfp.wrap);
}
mfp.contentContainer = _getEl('content');
if(mfp.st.preloader) {
mfp.preloader = _getEl('preloader', mfp.container, mfp.st.tLoading);
}
// Initializing modules
var modules = $.magnificPopup.modules;
for(i = 0; i < modules.length; i++) {
var n = modules[i];
n = n.charAt(0).toUpperCase() + n.slice(1);
mfp['init'+n].call(mfp);
}
_mfpTrigger('BeforeOpen');
if(mfp.st.showCloseBtn) {
// Close button
if(!mfp.st.closeBtnInside) {
mfp.wrap.append( _getCloseBtn() );
} else {
_mfpOn(MARKUP_PARSE_EVENT, function(e, template, values, item) {
values.close_replaceWith = _getCloseBtn(item.type);
});
_wrapClasses += ' mfp-close-btn-in';
}
}
if(mfp.st.alignTop) {
_wrapClasses += ' mfp-align-top';
}
if(mfp.fixedContentPos) {
mfp.wrap.css({
overflow: mfp.st.overflowY,
overflowX: 'hidden',
overflowY: mfp.st.overflowY
});
} else {
mfp.wrap.css({
top: _window.scrollTop(),
position: 'absolute'
});
}
if( mfp.st.fixedBgPos === false || (mfp.st.fixedBgPos === 'auto' && !mfp.fixedContentPos) ) {
mfp.bgOverlay.css({
height: _document.height(),
position: 'absolute'
});
}
if(mfp.st.enableEscapeKey) {
// Close on ESC key
_document.on('keyup' + EVENT_NS, function(e) {
if(e.keyCode === 27) {
mfp.close();
}
});
}
_window.on('resize' + EVENT_NS, function() {
mfp.updateSize();
});
if(!mfp.st.closeOnContentClick) {
_wrapClasses += ' mfp-auto-cursor';
}
if(_wrapClasses)
mfp.wrap.addClass(_wrapClasses);
// this triggers recalculation of layout, so we get it once to not to trigger twice
var windowHeight = mfp.wH = _window.height();
var windowStyles = {};
if( mfp.fixedContentPos ) {
if(mfp._hasScrollBar(windowHeight)){
var s = mfp._getScrollbarSize();
if(s) {
windowStyles.marginRight = s;
}
}
}
if(mfp.fixedContentPos) {
if(!mfp.isIE7) {
windowStyles.overflow = 'hidden';
} else {
// ie7 double-scroll bug
$('body, html').css('overflow', 'hidden');
}
}
var classesToadd = mfp.st.mainClass;
if(mfp.isIE7) {
classesToadd += ' mfp-ie7';
}
if(classesToadd) {
mfp._addClassToMFP( classesToadd );
}
// add content
mfp.updateItemHTML();
_mfpTrigger('BuildControls');
// remove scrollbar, add margin e.t.c
$('html').css(windowStyles);
// add everything to DOM
mfp.bgOverlay.add(mfp.wrap).prependTo( mfp.st.prependTo || $(document.body) );
// Save last focused element
mfp._lastFocusedEl = document.activeElement;
// Wait for next cycle to allow CSS transition
setTimeout(function() {
if(mfp.content) {
mfp._addClassToMFP(READY_CLASS);
mfp._setFocus();
} else {
// if content is not defined (not loaded e.t.c) we add class only for BG
mfp.bgOverlay.addClass(READY_CLASS);
}
// Trap the focus in popup
_document.on('focusin' + EVENT_NS, mfp._onFocusIn);
}, 16);
mfp.isOpen = true;
mfp.updateSize(windowHeight);
_mfpTrigger(OPEN_EVENT);
return data;
},
/**
* Closes the popup
*/
close: function() {
if(!mfp.isOpen) return;
_mfpTrigger(BEFORE_CLOSE_EVENT);
mfp.isOpen = false;
// for CSS3 animation
if(mfp.st.removalDelay && !mfp.isLowIE && mfp.supportsTransition ) {
mfp._addClassToMFP(REMOVING_CLASS);
setTimeout(function() {
mfp._close();
}, mfp.st.removalDelay);
} else {
mfp._close();
}
},
/**
* Helper for close() function
*/
_close: function() {
_mfpTrigger(CLOSE_EVENT);
var classesToRemove = REMOVING_CLASS + ' ' + READY_CLASS + ' ';
mfp.bgOverlay.detach();
mfp.wrap.detach();
mfp.container.empty();
if(mfp.st.mainClass) {
classesToRemove += mfp.st.mainClass + ' ';
}
mfp._removeClassFromMFP(classesToRemove);
if(mfp.fixedContentPos) {
var windowStyles = {marginRight: ''};
if(mfp.isIE7) {
$('body, html').css('overflow', '');
} else {
windowStyles.overflow = '';
}
$('html').css(windowStyles);
}
_document.off('keyup' + EVENT_NS + ' focusin' + EVENT_NS);
mfp.ev.off(EVENT_NS);
// clean up DOM elements that aren't removed
mfp.wrap.attr('class', 'mfp-wrap').removeAttr('style');
mfp.bgOverlay.attr('class', 'mfp-bg');
mfp.container.attr('class', 'mfp-container');
// remove close button from target element
if(mfp.st.showCloseBtn &&
(!mfp.st.closeBtnInside || mfp.currTemplate[mfp.currItem.type] === true)) {
if(mfp.currTemplate.closeBtn)
mfp.currTemplate.closeBtn.detach();
}
if(mfp.st.autoFocusLast && mfp._lastFocusedEl) {
$(mfp._lastFocusedEl).focus(); // put tab focus back
}
mfp.currItem = null;
mfp.content = null;
mfp.currTemplate = null;
mfp.prevHeight = 0;
_mfpTrigger(AFTER_CLOSE_EVENT);
},
updateSize: function(winHeight) {
if(mfp.isIOS) {
// fixes iOS nav bars https://github.com/dimsemenov/Magnific-Popup/issues/2
var zoomLevel = document.documentElement.clientWidth / window.innerWidth;
var height = window.innerHeight * zoomLevel;
mfp.wrap.css('height', height);
mfp.wH = height;
} else {
mfp.wH = winHeight || _window.height();
}
// Fixes #84: popup incorrectly positioned with position:relative on body
if(!mfp.fixedContentPos) {
mfp.wrap.css('height', mfp.wH);
}
_mfpTrigger('Resize');
},
/**
* Set content of popup based on current index
*/
updateItemHTML: function() {
var item = mfp.items[mfp.index];
// Detach and perform modifications
mfp.contentContainer.detach();
if(mfp.content)
mfp.content.detach();
if(!item.parsed) {
item = mfp.parseEl( mfp.index );
}
var type = item.type;
_mfpTrigger('BeforeChange', [mfp.currItem ? mfp.currItem.type : '', type]);
// BeforeChange event works like so:
// _mfpOn('BeforeChange', function(e, prevType, newType) { });
mfp.currItem = item;
if(!mfp.currTemplate[type]) {
var markup = mfp.st[type] ? mfp.st[type].markup : false;
// allows to modify markup
_mfpTrigger('FirstMarkupParse', markup);
if(markup) {
mfp.currTemplate[type] = $(markup);
} else {
// if there is no markup found we just define that template is parsed
mfp.currTemplate[type] = true;
}
}
if(_prevContentType && _prevContentType !== item.type) {
mfp.container.removeClass('mfp-'+_prevContentType+'-holder');
}
var newContent = mfp['get' + type.charAt(0).toUpperCase() + type.slice(1)](item, mfp.currTemplate[type]);
mfp.appendContent(newContent, type);
item.preloaded = true;
_mfpTrigger(CHANGE_EVENT, item);
_prevContentType = item.type;
// Append container back after its content changed
mfp.container.prepend(mfp.contentContainer);
_mfpTrigger('AfterChange');
},
/**
* Set HTML content of popup
*/
appendContent: function(newContent, type) {
mfp.content = newContent;
if(newContent) {
if(mfp.st.showCloseBtn && mfp.st.closeBtnInside &&
mfp.currTemplate[type] === true) {
// if there is no markup, we just append close button element inside
if(!mfp.content.find('.mfp-close').length) {
mfp.content.append(_getCloseBtn());
}
} else {
mfp.content = newContent;
}
} else {
mfp.content = '';
}
_mfpTrigger(BEFORE_APPEND_EVENT);
mfp.container.addClass('mfp-'+type+'-holder');
mfp.contentContainer.append(mfp.content);
},
/**
* Creates Magnific Popup data object based on given data
* @param {int} index Index of item to parse
*/
parseEl: function(index) {
var item = mfp.items[index],
type;
if(item.tagName) {
item = { el: $(item) };
} else {
type = item.type;
item = { data: item, src: item.src };
}
if(item.el) {
var types = mfp.types;
// check for 'mfp-TYPE' class
for(var i = 0; i < types.length; i++) {
if( item.el.hasClass('mfp-'+types[i]) ) {
type = types[i];
break;
}
}
item.src = item.el.attr('data-mfp-src');
if(!item.src) {
item.src = item.el.attr('href');
}
}
item.type = type || mfp.st.type || 'inline';
item.index = index;
item.parsed = true;
mfp.items[index] = item;
_mfpTrigger('ElementParse', item);
return mfp.items[index];
},
/**
* Initializes single popup or a group of popups
*/
addGroup: function(el, options) {
var eHandler = function(e) {
e.mfpEl = this;
mfp._openClick(e, el, options);
};
if(!options) {
options = {};
}
var eName = 'click.magnificPopup';
options.mainEl = el;
if(options.items) {
options.isObj = true;
el.off(eName).on(eName, eHandler);
} else {
options.isObj = false;
if(options.delegate) {
el.off(eName).on(eName, options.delegate , eHandler);
} else {
options.items = el;
el.off(eName).on(eName, eHandler);
}
}
},
_openClick: function(e, el, options) {
var midClick = options.midClick !== undefined ? options.midClick : $.magnificPopup.defaults.midClick;
if(!midClick && ( e.which === 2 || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey ) ) {
return;
}
var disableOn = options.disableOn !== undefined ? options.disableOn : $.magnificPopup.defaults.disableOn;
if(disableOn) {
if($.isFunction(disableOn)) {
if( !disableOn.call(mfp) ) {
return true;
}
} else { // else it's number
if( _window.width() < disableOn ) {
return true;
}
}
}
if(e.type) {
e.preventDefault();
// This will prevent popup from closing if element is inside and popup is already opened
if(mfp.isOpen) {
e.stopPropagation();
}
}
options.el = $(e.mfpEl);
if(options.delegate) {
options.items = el.find(options.delegate);
}
mfp.open(options);
},
/**
* Updates text on preloader
*/
updateStatus: function(status, text) {
if(mfp.preloader) {
if(_prevStatus !== status) {
mfp.container.removeClass('mfp-s-'+_prevStatus);
}
if(!text && status === 'loading') {
text = mfp.st.tLoading;
}
var data = {
status: status,
text: text
};
// allows to modify status
_mfpTrigger('UpdateStatus', data);
status = data.status;
text = data.text;
mfp.preloader.html(text);
mfp.preloader.find('a').on('click', function(e) {
e.stopImmediatePropagation();
});
mfp.container.addClass('mfp-s-'+status);
_prevStatus = status;
}
},
/*
"Private" helpers that aren't private at all
*/
// Check to close popup or not
// "target" is an element that was clicked
_checkIfClose: function(target) {
if($(target).hasClass(PREVENT_CLOSE_CLASS)) {
return;
}
var closeOnContent = mfp.st.closeOnContentClick;
var closeOnBg = mfp.st.closeOnBgClick;
if(closeOnContent && closeOnBg) {
return true;
} else {
// We close the popup if click is on close button or on preloader. Or if there is no content.
if(!mfp.content || $(target).hasClass('mfp-close') || (mfp.preloader && target === mfp.preloader[0]) ) {
return true;
}
// if click is outside the content
if( (target !== mfp.content[0] && !$.contains(mfp.content[0], target)) ) {
if(closeOnBg) {
// last check, if the clicked element is in DOM, (in case it's removed onclick)
if( $.contains(document, target) ) {
return true;
}
}
} else if(closeOnContent) {
return true;
}
}
return false;
},
_addClassToMFP: function(cName) {
mfp.bgOverlay.addClass(cName);
mfp.wrap.addClass(cName);
},
_removeClassFromMFP: function(cName) {
this.bgOverlay.removeClass(cName);
mfp.wrap.removeClass(cName);
},
_hasScrollBar: function(winHeight) {
return ( (mfp.isIE7 ? _document.height() : document.body.scrollHeight) > (winHeight || _window.height()) );
},
_setFocus: function() {
(mfp.st.focus ? mfp.content.find(mfp.st.focus).eq(0) : mfp.wrap).focus();
},
_onFocusIn: function(e) {
if( e.target !== mfp.wrap[0] && !$.contains(mfp.wrap[0], e.target) ) {
mfp._setFocus();
return false;
}
},
_parseMarkup: function(template, values, item) {
var arr;
if(item.data) {
values = $.extend(item.data, values);
}
_mfpTrigger(MARKUP_PARSE_EVENT, [template, values, item] );
$.each(values, function(key, value) {
if(value === undefined || value === false) {
return true;
}
arr = key.split('_');
if(arr.length > 1) {
var el = template.find(EVENT_NS + '-'+arr[0]);
if(el.length > 0) {
var attr = arr[1];
if(attr === 'replaceWith') {
if(el[0] !== value[0]) {
el.replaceWith(value);
}
} else if(attr === 'img') {
if(el.is('img')) {
el.attr('src', value);
} else {
el.replaceWith( $('<img>').attr('src', value).attr('class', el.attr('class')) );
}
} else {
el.attr(arr[1], value);
}
}
} else {
template.find(EVENT_NS + '-'+key).html(value);
}
});
},
_getScrollbarSize: function() {
// thx David
if(mfp.scrollbarSize === undefined) {
var scrollDiv = document.createElement("div");
scrollDiv.style.cssText = 'width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;';
document.body.appendChild(scrollDiv);
mfp.scrollbarSize = scrollDiv.offsetWidth - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
}
return mfp.scrollbarSize;
}
}; /* MagnificPopup core prototype end */
/**
* Public static functions
*/
$.magnificPopup = {
instance: null,
proto: MagnificPopup.prototype,
modules: [],
open: function(options, index) {
_checkInstance();
if(!options) {
options = {};
} else {
options = $.extend(true, {}, options);
}
options.isObj = true;
options.index = index || 0;
return this.instance.open(options);
},
close: function() {
return $.magnificPopup.instance && $.magnificPopup.instance.close();
},
registerModule: function(name, module) {
if(module.options) {
$.magnificPopup.defaults[name] = module.options;
}
$.extend(this.proto, module.proto);
this.modules.push(name);
},
defaults: {
// Info about options is in docs:
// http://dimsemenov.com/plugins/magnific-popup/documentation.html#options
disableOn: 0,
key: null,
midClick: false,
mainClass: '',
preloader: true,
focus: '', // CSS selector of input to focus after popup is opened
closeOnContentClick: false,
closeOnBgClick: true,
closeBtnInside: true,
showCloseBtn: true,
enableEscapeKey: true,
modal: false,
alignTop: false,
removalDelay: 0,
prependTo: null,
fixedContentPos: 'auto',
fixedBgPos: 'auto',
overflowY: 'auto',
closeMarkup: '<button title="%title%" type="button" class="mfp-close">&#215;</button>',
tClose: 'Close (Esc)',
tLoading: 'Loading...',
autoFocusLast: true
}
};
$.fn.magnificPopup = function(options) {
_checkInstance();
var jqEl = $(this);
// We call some API method of first param is a string
if (typeof options === "string" ) {
if(options === 'open') {
var items,
itemOpts = _isJQ ? jqEl.data('magnificPopup') : jqEl[0].magnificPopup,
index = parseInt(arguments[1], 10) || 0;
if(itemOpts.items) {
items = itemOpts.items[index];
} else {
items = jqEl;
if(itemOpts.delegate) {
items = items.find(itemOpts.delegate);
}
items = items.eq( index );
}
mfp._openClick({mfpEl:items}, jqEl, itemOpts);
} else {
if(mfp.isOpen)
mfp[options].apply(mfp, Array.prototype.slice.call(arguments, 1));
}
} else {
// clone options obj
options = $.extend(true, {}, options);
/*
* As Zepto doesn't support .data() method for objects
* and it works only in normal browsers
* we assign "options" object directly to the DOM element. FTW!
*/
if(_isJQ) {
jqEl.data('magnificPopup', options);
} else {
jqEl[0].magnificPopup = options;
}
mfp.addGroup(jqEl, options);
}
return jqEl;
};

View File

@@ -0,0 +1,164 @@
/**
* Get looped index depending on number of slides
*/
var _getLoopedId = function(index) {
var numSlides = mfp.items.length;
if(index > numSlides - 1) {
return index - numSlides;
} else if(index < 0) {
return numSlides + index;
}
return index;
},
_replaceCurrTotal = function(text, curr, total) {
return text.replace(/%curr%/gi, curr + 1).replace(/%total%/gi, total);
};
$.magnificPopup.registerModule('gallery', {
options: {
enabled: false,
arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-arrow-%dir%"></button>',
preload: [0,2],
navigateByImgClick: true,
arrows: true,
tPrev: 'Previous (Left arrow key)',
tNext: 'Next (Right arrow key)',
tCounter: '%curr% of %total%'
},
proto: {
initGallery: function() {
var gSt = mfp.st.gallery,
ns = '.mfp-gallery';
mfp.direction = true; // true - next, false - prev
if(!gSt || !gSt.enabled ) return false;
_wrapClasses += ' mfp-gallery';
_mfpOn(OPEN_EVENT+ns, function() {
if(gSt.navigateByImgClick) {
mfp.wrap.on('click'+ns, '.mfp-img', function() {
if(mfp.items.length > 1) {
mfp.next();
return false;
}
});
}
_document.on('keydown'+ns, function(e) {
if (e.keyCode === 37) {
mfp.prev();
} else if (e.keyCode === 39) {
mfp.next();
}
});
});
_mfpOn('UpdateStatus'+ns, function(e, data) {
if(data.text) {
data.text = _replaceCurrTotal(data.text, mfp.currItem.index, mfp.items.length);
}
});
_mfpOn(MARKUP_PARSE_EVENT+ns, function(e, element, values, item) {
var l = mfp.items.length;
values.counter = l > 1 ? _replaceCurrTotal(gSt.tCounter, item.index, l) : '';
});
_mfpOn('BuildControls' + ns, function() {
if(mfp.items.length > 1 && gSt.arrows && !mfp.arrowLeft) {
var markup = gSt.arrowMarkup,
arrowLeft = mfp.arrowLeft = $( markup.replace(/%title%/gi, gSt.tPrev).replace(/%dir%/gi, 'left') ).addClass(PREVENT_CLOSE_CLASS),
arrowRight = mfp.arrowRight = $( markup.replace(/%title%/gi, gSt.tNext).replace(/%dir%/gi, 'right') ).addClass(PREVENT_CLOSE_CLASS);
arrowLeft.click(function() {
mfp.prev();
});
arrowRight.click(function() {
mfp.next();
});
mfp.container.append(arrowLeft.add(arrowRight));
}
});
_mfpOn(CHANGE_EVENT+ns, function() {
if(mfp._preloadTimeout) clearTimeout(mfp._preloadTimeout);
mfp._preloadTimeout = setTimeout(function() {
mfp.preloadNearbyImages();
mfp._preloadTimeout = null;
}, 16);
});
_mfpOn(CLOSE_EVENT+ns, function() {
_document.off(ns);
mfp.wrap.off('click'+ns);
mfp.arrowRight = mfp.arrowLeft = null;
});
},
next: function() {
mfp.direction = true;
mfp.index = _getLoopedId(mfp.index + 1);
mfp.updateItemHTML();
},
prev: function() {
mfp.direction = false;
mfp.index = _getLoopedId(mfp.index - 1);
mfp.updateItemHTML();
},
goTo: function(newIndex) {
mfp.direction = (newIndex >= mfp.index);
mfp.index = newIndex;
mfp.updateItemHTML();
},
preloadNearbyImages: function() {
var p = mfp.st.gallery.preload,
preloadBefore = Math.min(p[0], mfp.items.length),
preloadAfter = Math.min(p[1], mfp.items.length),
i;
for(i = 1; i <= (mfp.direction ? preloadAfter : preloadBefore); i++) {
mfp._preloadItem(mfp.index+i);
}
for(i = 1; i <= (mfp.direction ? preloadBefore : preloadAfter); i++) {
mfp._preloadItem(mfp.index-i);
}
},
_preloadItem: function(index) {
index = _getLoopedId(index);
if(mfp.items[index].preloaded) {
return;
}
var item = mfp.items[index];
if(!item.parsed) {
item = mfp.parseEl( index );
}
_mfpTrigger('LazyLoad', item);
if(item.type === 'image') {
item.img = $('<img class="mfp-img" />').on('load.mfploader', function() {
item.hasSize = true;
}).on('error.mfploader', function() {
item.hasSize = true;
item.loadError = true;
_mfpTrigger('LazyLoadError', item);
}).attr('src', item.src);
}
item.preloaded = true;
}
}
});

View File

@@ -0,0 +1,102 @@
var IFRAME_NS = 'iframe',
_emptyPage = '//about:blank',
_fixIframeBugs = function(isShowing) {
if(mfp.currTemplate[IFRAME_NS]) {
var el = mfp.currTemplate[IFRAME_NS].find('iframe');
if(el.length) {
// reset src after the popup is closed to avoid "video keeps playing after popup is closed" bug
if(!isShowing) {
el[0].src = _emptyPage;
}
// IE8 black screen bug fix
if(mfp.isIE8) {
el.css('display', isShowing ? 'block' : 'none');
}
}
}
};
$.magnificPopup.registerModule(IFRAME_NS, {
options: {
markup: '<div class="mfp-iframe-scaler">'+
'<div class="mfp-close"></div>'+
'<iframe class="mfp-iframe" src="//about:blank" frameborder="0" allowfullscreen></iframe>'+
'</div>',
srcAction: 'iframe_src',
// we don't care and support only one default type of URL by default
patterns: {
youtube: {
index: 'youtube.com',
id: 'v=',
src: '//www.youtube.com/embed/%id%?autoplay=1'
},
vimeo: {
index: 'vimeo.com/',
id: '/',
src: '//player.vimeo.com/video/%id%?autoplay=1'
},
gmaps: {
index: '//maps.google.',
src: '%id%&output=embed'
}
}
},
proto: {
initIframe: function() {
mfp.types.push(IFRAME_NS);
_mfpOn('BeforeChange', function(e, prevType, newType) {
if(prevType !== newType) {
if(prevType === IFRAME_NS) {
_fixIframeBugs(); // iframe if removed
} else if(newType === IFRAME_NS) {
_fixIframeBugs(true); // iframe is showing
}
}// else {
// iframe source is switched, don't do anything
//}
});
_mfpOn(CLOSE_EVENT + '.' + IFRAME_NS, function() {
_fixIframeBugs();
});
},
getIframe: function(item, template) {
var embedSrc = item.src;
var iframeSt = mfp.st.iframe;
$.each(iframeSt.patterns, function() {
if(embedSrc.indexOf( this.index ) > -1) {
if(this.id) {
if(typeof this.id === 'string') {
embedSrc = embedSrc.substr(embedSrc.lastIndexOf(this.id)+this.id.length, embedSrc.length);
} else {
embedSrc = this.id.call( this, embedSrc );
}
}
embedSrc = this.src.replace('%id%', embedSrc );
return false; // break;
}
});
var dataObj = {};
if(iframeSt.srcAction) {
dataObj[iframeSt.srcAction] = embedSrc;
}
mfp._parseMarkup(template, dataObj, item);
mfp.updateStatus('ready');
return template;
}
}
});

View File

@@ -0,0 +1,244 @@
var _imgInterval,
_getTitle = function(item) {
if(item.data && item.data.title !== undefined)
return item.data.title;
var src = mfp.st.image.titleSrc;
if(src) {
if($.isFunction(src)) {
return src.call(mfp, item);
} else if(item.el) {
return item.el.attr(src) || '';
}
}
return '';
};
$.magnificPopup.registerModule('image', {
options: {
markup: '<div class="mfp-figure">'+
'<div class="mfp-close"></div>'+
'<figure>'+
'<div class="mfp-img"></div>'+
'<figcaption>'+
'<div class="mfp-bottom-bar">'+
'<div class="mfp-title"></div>'+
'<div class="mfp-counter"></div>'+
'</div>'+
'</figcaption>'+
'</figure>'+
'</div>',
cursor: 'mfp-zoom-out-cur',
titleSrc: 'title',
verticalFit: true,
tError: '<a href="%url%">The image</a> could not be loaded.'
},
proto: {
initImage: function() {
var imgSt = mfp.st.image,
ns = '.image';
mfp.types.push('image');
_mfpOn(OPEN_EVENT+ns, function() {
if(mfp.currItem.type === 'image' && imgSt.cursor) {
$(document.body).addClass(imgSt.cursor);
}
});
_mfpOn(CLOSE_EVENT+ns, function() {
if(imgSt.cursor) {
$(document.body).removeClass(imgSt.cursor);
}
_window.off('resize' + EVENT_NS);
});
_mfpOn('Resize'+ns, mfp.resizeImage);
if(mfp.isLowIE) {
_mfpOn('AfterChange', mfp.resizeImage);
}
},
resizeImage: function() {
var item = mfp.currItem;
if(!item || !item.img) return;
if(mfp.st.image.verticalFit) {
var decr = 0;
// fix box-sizing in ie7/8
if(mfp.isLowIE) {
decr = parseInt(item.img.css('padding-top'), 10) + parseInt(item.img.css('padding-bottom'),10);
}
item.img.css('max-height', mfp.wH-decr);
}
},
_onImageHasSize: function(item) {
if(item.img) {
item.hasSize = true;
if(_imgInterval) {
clearInterval(_imgInterval);
}
item.isCheckingImgSize = false;
_mfpTrigger('ImageHasSize', item);
if(item.imgHidden) {
if(mfp.content)
mfp.content.removeClass('mfp-loading');
item.imgHidden = false;
}
}
},
/**
* Function that loops until the image has size to display elements that rely on it asap
*/
findImageSize: function(item) {
var counter = 0,
img = item.img[0],
mfpSetInterval = function(delay) {
if(_imgInterval) {
clearInterval(_imgInterval);
}
// decelerating interval that checks for size of an image
_imgInterval = setInterval(function() {
if(img.naturalWidth > 0) {
mfp._onImageHasSize(item);
return;
}
if(counter > 200) {
clearInterval(_imgInterval);
}
counter++;
if(counter === 3) {
mfpSetInterval(10);
} else if(counter === 40) {
mfpSetInterval(50);
} else if(counter === 100) {
mfpSetInterval(500);
}
}, delay);
};
mfpSetInterval(1);
},
getImage: function(item, template) {
var guard = 0,
// image load complete handler
onLoadComplete = function() {
if(item) {
if (item.img[0].complete) {
item.img.off('.mfploader');
if(item === mfp.currItem){
mfp._onImageHasSize(item);
mfp.updateStatus('ready');
}
item.hasSize = true;
item.loaded = true;
_mfpTrigger('ImageLoadComplete');
}
else {
// if image complete check fails 200 times (20 sec), we assume that there was an error.
guard++;
if(guard < 200) {
setTimeout(onLoadComplete,100);
} else {
onLoadError();
}
}
}
},
// image error handler
onLoadError = function() {
if(item) {
item.img.off('.mfploader');
if(item === mfp.currItem){
mfp._onImageHasSize(item);
mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
}
item.hasSize = true;
item.loaded = true;
item.loadError = true;
}
},
imgSt = mfp.st.image;
var el = template.find('.mfp-img');
if(el.length) {
var img = document.createElement('img');
img.className = 'mfp-img';
if(item.el && item.el.find('img').length) {
img.alt = item.el.find('img').attr('alt');
}
item.img = $(img).on('load.mfploader', onLoadComplete).on('error.mfploader', onLoadError);
img.src = item.src;
// without clone() "error" event is not firing when IMG is replaced by new IMG
// TODO: find a way to avoid such cloning
if(el.is('img')) {
item.img = item.img.clone();
}
img = item.img[0];
if(img.naturalWidth > 0) {
item.hasSize = true;
} else if(!img.width) {
item.hasSize = false;
}
}
mfp._parseMarkup(template, {
title: _getTitle(item),
img_replaceWith: item.img
}, item);
mfp.resizeImage();
if(item.hasSize) {
if(_imgInterval) clearInterval(_imgInterval);
if(item.loadError) {
template.addClass('mfp-loading');
mfp.updateStatus('error', imgSt.tError.replace('%url%', item.src) );
} else {
template.removeClass('mfp-loading');
mfp.updateStatus('ready');
}
return template;
}
mfp.updateStatus('loading');
item.loading = true;
if(!item.hasSize) {
item.imgHidden = true;
template.addClass('mfp-loading');
mfp.findImageSize(item);
}
return template;
}
}
});

View File

@@ -0,0 +1,66 @@
var INLINE_NS = 'inline',
_hiddenClass,
_inlinePlaceholder,
_lastInlineElement,
_putInlineElementsBack = function() {
if(_lastInlineElement) {
_inlinePlaceholder.after( _lastInlineElement.addClass(_hiddenClass) ).detach();
_lastInlineElement = null;
}
};
$.magnificPopup.registerModule(INLINE_NS, {
options: {
hiddenClass: 'hide', // will be appended with `mfp-` prefix
markup: '',
tNotFound: 'Content not found'
},
proto: {
initInline: function() {
mfp.types.push(INLINE_NS);
_mfpOn(CLOSE_EVENT+'.'+INLINE_NS, function() {
_putInlineElementsBack();
});
},
getInline: function(item, template) {
_putInlineElementsBack();
if(item.src) {
var inlineSt = mfp.st.inline,
el = $(item.src);
if(el.length) {
// If target element has parent - we replace it with placeholder and put it back after popup is closed
var parent = el[0].parentNode;
if(parent && parent.tagName) {
if(!_inlinePlaceholder) {
_hiddenClass = inlineSt.hiddenClass;
_inlinePlaceholder = _getEl(_hiddenClass);
_hiddenClass = 'mfp-'+_hiddenClass;
}
// replace target inline element with placeholder
_lastInlineElement = el.after(_inlinePlaceholder).detach().removeClass(_hiddenClass);
}
mfp.updateStatus('ready');
} else {
mfp.updateStatus('error', inlineSt.tNotFound);
el = $('<div>');
}
item.inlineElement = el;
return el;
}
mfp.updateStatus('ready');
mfp._parseMarkup(template, {}, item);
return template;
}
}
});

View File

@@ -0,0 +1,35 @@
var RETINA_NS = 'retina';
$.magnificPopup.registerModule(RETINA_NS, {
options: {
replaceSrc: function(item) {
return item.src.replace(/\.\w+$/, function(m) { return '@2x' + m; });
},
ratio: 1 // Function or number. Set to 1 to disable.
},
proto: {
initRetina: function() {
if(window.devicePixelRatio > 1) {
var st = mfp.st.retina,
ratio = st.ratio;
ratio = !isNaN(ratio) ? ratio : ratio();
if(ratio > 1) {
_mfpOn('ImageHasSize' + '.' + RETINA_NS, function(e, item) {
item.img.css({
'max-width': item.img[0].naturalWidth / ratio,
'width': '100%'
});
});
_mfpOn('ElementParse' + '.' + RETINA_NS, function(e, item) {
item.src = st.replaceSrc(item, ratio);
});
}
}
}
}
});

View File

@@ -0,0 +1,183 @@
var hasMozTransform,
getHasMozTransform = function() {
if(hasMozTransform === undefined) {
hasMozTransform = document.createElement('p').style.MozTransform !== undefined;
}
return hasMozTransform;
};
$.magnificPopup.registerModule('zoom', {
options: {
enabled: false,
easing: 'ease-in-out',
duration: 300,
opener: function(element) {
return element.is('img') ? element : element.find('img');
}
},
proto: {
initZoom: function() {
var zoomSt = mfp.st.zoom,
ns = '.zoom',
image;
if(!zoomSt.enabled || !mfp.supportsTransition) {
return;
}
var duration = zoomSt.duration,
getElToAnimate = function(image) {
var newImg = image.clone().removeAttr('style').removeAttr('class').addClass('mfp-animated-image'),
transition = 'all '+(zoomSt.duration/1000)+'s ' + zoomSt.easing,
cssObj = {
position: 'fixed',
zIndex: 9999,
left: 0,
top: 0,
'-webkit-backface-visibility': 'hidden'
},
t = 'transition';
cssObj['-webkit-'+t] = cssObj['-moz-'+t] = cssObj['-o-'+t] = cssObj[t] = transition;
newImg.css(cssObj);
return newImg;
},
showMainContent = function() {
mfp.content.css('visibility', 'visible');
},
openTimeout,
animatedImg;
_mfpOn('BuildControls'+ns, function() {
if(mfp._allowZoom()) {
clearTimeout(openTimeout);
mfp.content.css('visibility', 'hidden');
// Basically, all code below does is clones existing image, puts in on top of the current one and animated it
image = mfp._getItemToZoom();
if(!image) {
showMainContent();
return;
}
animatedImg = getElToAnimate(image);
animatedImg.css( mfp._getOffset() );
mfp.wrap.append(animatedImg);
openTimeout = setTimeout(function() {
animatedImg.css( mfp._getOffset( true ) );
openTimeout = setTimeout(function() {
showMainContent();
setTimeout(function() {
animatedImg.remove();
image = animatedImg = null;
_mfpTrigger('ZoomAnimationEnded');
}, 16); // avoid blink when switching images
}, duration); // this timeout equals animation duration
}, 16); // by adding this timeout we avoid short glitch at the beginning of animation
// Lots of timeouts...
}
});
_mfpOn(BEFORE_CLOSE_EVENT+ns, function() {
if(mfp._allowZoom()) {
clearTimeout(openTimeout);
mfp.st.removalDelay = duration;
if(!image) {
image = mfp._getItemToZoom();
if(!image) {
return;
}
animatedImg = getElToAnimate(image);
}
animatedImg.css( mfp._getOffset(true) );
mfp.wrap.append(animatedImg);
mfp.content.css('visibility', 'hidden');
setTimeout(function() {
animatedImg.css( mfp._getOffset() );
}, 16);
}
});
_mfpOn(CLOSE_EVENT+ns, function() {
if(mfp._allowZoom()) {
showMainContent();
if(animatedImg) {
animatedImg.remove();
}
image = null;
}
});
},
_allowZoom: function() {
return mfp.currItem.type === 'image';
},
_getItemToZoom: function() {
if(mfp.currItem.hasSize) {
return mfp.currItem.img;
} else {
return false;
}
},
// Get element postion relative to viewport
_getOffset: function(isLarge) {
var el;
if(isLarge) {
el = mfp.currItem.img;
} else {
el = mfp.st.zoom.opener(mfp.currItem.el || mfp.currItem);
}
var offset = el.offset();
var paddingTop = parseInt(el.css('padding-top'),10);
var paddingBottom = parseInt(el.css('padding-bottom'),10);
offset.top -= ( $(window).scrollTop() - paddingTop );
/*
Animating left + top + width/height looks glitchy in Firefox, but perfect in Chrome. And vice-versa.
*/
var obj = {
width: el.width(),
// fix Zepto height+padding issue
height: (_isJQ ? el.innerHeight() : el[0].offsetHeight) - paddingBottom - paddingTop
};
// I hate to do this, but there is no another option
if( getHasMozTransform() ) {
obj['-moz-transform'] = obj['transform'] = 'translate(' + offset.left + 'px,' + offset.top + 'px)';
} else {
obj.left = offset.left;
obj.top = offset.top;
}
return obj;
}
}
});

View File

@@ -0,0 +1,24 @@
{% if site.url == 'local' %}
<!-- analytics removed -->
{% else %}
<!-- Analytics start -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25969065-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
function recordOutboundLink(link, category, action) {
_gat._getTrackerByName()._trackEvent(category, action);
setTimeout('document.location = "' + link.href + '"', 100);
}
</script>
<!-- ya metrika -->
<script type="text/javascript">(function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter11382601 = new Ya.Metrika({id:11382601, webvisor:true, clickmap:true, trackLinks:true, accurateTrackBounce:true}); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="//mc.yandex.ru/watch/11382601" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
{% endif %}

View File

@@ -0,0 +1,273 @@
<!-- Basic idea of such build tool is stolen from modernizr.com -->
<div id="mfp-build-tool" class="mfp-hide">
<h2>Magnific Popup v{{site.mfpversion}} Build Tool</h2>
<form id="mfp-build-form">
<p class="help-block">Here you can generate optimized version of main JS file. Please note that CSS you should download directly: <a target="_blank" href="https://raw.github.com/dimsemenov/Magnific-Popup/master/src/css/main.scss">Sass version</a> or <a target="_blank" href="https://raw.github.com/dimsemenov/Magnific-Popup/master/dist/magnific-popup.css">CSS version</a>.</p>
<label class="checkbox">
<input type="checkbox" name="inline" checked> Inline
</label>
<label class="checkbox">
<input type="checkbox" name="image" checked> Image
</label>
<label class="checkbox">
<input type="checkbox" name="ajax" checked> Ajax
</label>
<label class="checkbox">
<input type="checkbox" name="iframe" checked> Iframe
</label>
<label class="checkbox">
<input type="checkbox" name="gallery" checked> Gallery
</label>
<label class="checkbox">
<input type="checkbox" name="retina" checked> High-DPI (retina) support for image type
</label>
<label class="checkbox">
<input type="checkbox" name="imagezoom" checked> Image zoom animation
</label>
</form>
<br/>
<div>
<button id="mfp-build-button">Generate build</button>
<label class="checkbox">
<input id="mfp-minify" type="checkbox" name="minify" checked="checked"> Minify code
</label>
</div>
<br/>
<p id="mfp-build-status" style="display:none"></p>
<br/>
<textarea id="mfp-build-tool-out" style="width: 100%; height: 300px; display:none;"></textarea>
</div>
<script type="text/javascript">
$(document).ready(function($) {
$('.mfp-build-tool-link').magnificPopup({closeBtnInside:true, type:'inline', midClick: true});
var h = window.location.hash;
if(h.indexOf('build=') > -1) {
var formInputs = $('#mfp-build-form input');
if(h.indexOf('&') > 0) {
h = h.substr(0, h.indexOf('&'));
}
var items = h.substr(h.indexOf('build=') + 6, h.length).split('+');
for(var i = 0; i < items.length; i++) {
var name = items[i];
if(name) {
formInputs.filter('[name="' +name+ '"]').addClass('present');
}
}
formInputs.not('.present').prop('checked', false);
}
var button = $('#mfp-build-button').click(function(e) {
e.preventDefault();
button.attr('disabled', 'disabled');
var statusTimeout;
var setStatus = function(msg, type) {
clearTimeout(statusTimeout);
$('#mfp-build-status').html('<span class="'+type+'">'+msg+'</span>').show();
};
setStatus('Wait a moment please...', 'progress');
$('#mfp-build-tool-out').val( '' );
var minify = $('#mfp-minify')[0].checked;
var removeModule = function(source, key) {
source = source.replace(new RegExp("\\/\\*>>"+key+"\\*\\/[\\s|\\S]*?\\/\\*>>"+key+"\\*\\/", "ig"), "");
return source;
};
var onError = function() {
setStatus("Error: Build tool wasn't able to GET the js file. Please try again or make file by yourself using Grunt.", 'error');
};
var version = '{{site.mfpversion}}';
var loadedScripts = [];
var onScriptsLoaded = function() {
var src = loadedScripts[0];
var hash = '',
name;
$('#mfp-build-form input').each(function() {
name = $(this).attr('name');
if( this.checked ) {
hash += name + '+';
} else {
src = removeModule(src, name);
}
});
var output = '';
if(hash) {
hash = hash.substr(0, hash.length-1);
}
if(minify) {
src = uglify(src, ["--extra","--unsafe"]);
output = '// Magnific Popup v'+version+' by Dmitry Semenov' + "\n";
output += '// http://bit.ly/magnific-popup' + (hash ? '#build=' + hash : '') + "\n" + src;
} else {
output = src;
}
if(!hash) {
hash = 'core';
} else {
hash = 'core+' + hash;
}
$('#mfp-build-tool-out').val( output ).show();
button.removeAttr('disabled');
setStatus('Magnific Popup main js file successfully generated! You can copy generated code from textarea below.' + (hash ? (' Your build includes: <strong>' + hash.split('+').join(', ')) + '</strong>. ' : ''), 'success');
};
$.ajax({
url:"dist/jquery.magnific-popup.js?v="+version,
dataType: 'text',
success: function( data) {
loadedScripts[0] = data;
if(loadedScripts[1]) {
onScriptsLoaded();
}
},
error: onError
});
$.ajax({
url:"third-party-libs/uglify.js",
dataType: 'script',
cache: true,
success: function(data) {
loadedScripts[1] = data;
if(loadedScripts[0]) {
onScriptsLoaded();
}
},
error: onError
});
});
/* build tool END */
/**
* Popup with source code for each example
*/
var example,
getCode,
CSS,
JS,
HTML,
highlighterLoaded;
var formatCode = function (str) {
if(str) {
// replace special chars
str = str.replace(/[&<>"']/g, function($0) {
return "&" + {"&":"amp", "<":"lt", ">":"gt", '"':"quot", "'":"#39"}[$0] + ";";
});
// remove spaces from each line based on spaces on first line
var firstLineLength = str.match(/^(\s*)/)[1].length;
var regExp = new RegExp('^ {' + (firstLineLength-1) + '}', "gm");
str = str.replace(regExp, '');
// replace spaces with tabs
str = str.replace(/ /g,'\t');
str = $.trim(str);
}
return str;
};
var highlight = function() {
hljs.highlightBlock(JS.find('code')[0]);
if(CSS)
hljs.highlightBlock(CSS.find('code')[0]);
if(HTML)
hljs.highlightBlock(HTML.find('code')[0]);
};
$('.example').each(function() {
$(this).find('h3').click(function() {
var example = $(this).parent('.example');
var getCodeWindow = $('<div class="get-code-window"><h1>'+example.find('h3').text()+'</h1></div>');
JS = $('<div class="highlight"><pre><code class="javascript">'+formatCode(example.find('script').eq(0).html())+'</code></pre></div>');
CSS = example.find('style');
if(CSS.length) {
CSS = $('<div class="highlight"><pre><code class="css">'+formatCode(CSS.html())+'</code></pre></div>');
} else {
CSS = '';
}
HTML = example.find('.html-code');
if(HTML.length) {
HTML = $('<div class="highlight"><pre><code class="xml html">'+formatCode(HTML.html())+'</code></pre></div>');
} else {
HTML = '';
}
if(!highlighterLoaded) {
highlighterLoaded = true;
var script = document.createElement("script"),
$script = $(script);
script.src = 'http://yandex.st/highlightjs/7.3/highlight.min.js';
if(window.jQuery) {
$.getScript(script.src , function() {
highlight();
});
} else {
$(script).appendTo("head").on("load", function() {
highlight();
});
}
} else {
highlight();
}
getCodeWindow.append(JS);
getCodeWindow.append(HTML);
getCodeWindow.append(CSS);
getCodeWindow.append('<p>Code above is dynamically generated directly from the source of this example.<br/>Please read <a href="documentation.html">the documentation</a> before using it.</p>');
$.magnificPopup.open({
items: {
src: getCodeWindow,
type: 'inline'
}
});
});
});
});
</script>

View File

@@ -0,0 +1,676 @@
{% if site.url == 'local' %}
<!-- <script src="third-party-libs/zepto.js"></script> -->
<script>
document.write('<script src=third-party-libs/' +
('__proto__' in {} ? 'zepto' : 'jquery') +
'.min.js><\/script>')
</script>
<script src="dist/jquery.magnific-popup.js?v={{site.mfpversion}}"></script>
{% else %}
<script>
document.write('<script src=third-party-libs/' +
('__proto__' in {} ? 'zepto' : 'jquery') +
'.min.js><\/script>')
</script>
<script src="dist/jquery.magnific-popup.min.js?v={{site.mfpversion}}"></script>
{% endif %}
<!--
Each '.example' block contains JS, HTML and optionally CSS for popup.
-->
<h2 id="examples">Examples</h2>
<div class="grid-c">
<div class="example gc3">
<h3>Single image lightbox</h3>
<p>Three simple popups with different scaling settings.<br/>
1 &mdash; fits horizontally and vertically,<br/>
2 &mdash; only horizontally,<br/>
3 &mdash; no gaps, zoom animation, close icon in top-right corner.<br/>
</p>
<div class="html-code grid-of-images">
<a class="image-popup-vertical-fit" href="http://farm9.staticflickr.com/8241/8589392310_7b6127e243_b.jpg" title="Caption. Can be aligned to any side and contain any HTML.">
<img src="http://farm9.staticflickr.com/8241/8589392310_7b6127e243_s.jpg" width="75" height="75" />
</a>
<a class="image-popup-fit-width" href="http://farm9.staticflickr.com/8379/8588290361_ecf8c27021_b.jpg" title="This image fits only horizontally.">
<img src="http://farm9.staticflickr.com/8379/8588290361_ecf8c27021_s.jpg" width="75" height="75" />
</a>
<a class="image-popup-no-margins" href="http://farm4.staticflickr.com/3721/9207329484_ba28755ec4_o.jpg">
<img src="http://farm4.staticflickr.com/3721/9207329484_ba28755ec4_o.jpg" width="107" height="75" />
</a>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.image-popup-vertical-fit').magnificPopup({
type: 'image',
closeOnContentClick: true,
mainClass: 'mfp-img-mobile',
image: {
verticalFit: true
}
});
$('.image-popup-fit-width').magnificPopup({
type: 'image',
closeOnContentClick: true,
image: {
verticalFit: false
}
});
$('.image-popup-no-margins').magnificPopup({
type: 'image',
closeOnContentClick: true,
closeBtnInside: false,
fixedContentPos: true,
mainClass: 'mfp-no-margins mfp-with-zoom', // class to remove default margin from left and right side
image: {
verticalFit: true
},
zoom: {
enabled: true,
duration: 300 // don't foget to change the duration also in CSS
}
});
});
</script>
<style type="text/css">
/* padding-bottom and top for image */
.mfp-no-margins img.mfp-img {
padding: 0;
}
/* position of shadow behind the image */
.mfp-no-margins .mfp-figure:after {
top: 0;
bottom: 0;
}
/* padding for main container */
.mfp-no-margins .mfp-container {
padding: 0;
}
/*
for zoom animation
uncomment this part if you haven't added this code anywhere else
*/
/*
.mfp-with-zoom .mfp-container,
.mfp-with-zoom.mfp-bg {
opacity: 0;
-webkit-backface-visibility: hidden;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.mfp-with-zoom.mfp-ready .mfp-container {
opacity: 1;
}
.mfp-with-zoom.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-with-zoom.mfp-removing .mfp-container,
.mfp-with-zoom.mfp-removing.mfp-bg {
opacity: 0;
}
*/
</style>
</div>
<div class="example gc3">
<h3>Lightbox gallery</h3>
<p>You may put any HTML content in each gallery item and <a href="http://codepen.io/dimsemenov/pen/vKrqs">mix content types</a>. In this example lazy-loading of images is enabled for the next image based on move direction. If you wish to add touch-swipe support, check <a href="http://coding.smashingmagazine.com/2013/05/02/truly-responsive-lightbox/">my article</a> on the Smashing Magazine, or <a href="http://photoswipe.com">new PhotoSwipe</a> script.</p>
<div class="html-code grid-of-images">
<div class="popup-gallery">
<a href="http://farm9.staticflickr.com/8242/8558295633_f34a55c1c6_b.jpg" title="The Cleaner"><img src="http://farm9.staticflickr.com/8242/8558295633_f34a55c1c6_s.jpg" width="75" height="75" /></a>
<a href="http://farm9.staticflickr.com/8382/8558295631_0f56c1284f_b.jpg" title="Winter Dance"><img src="http://farm9.staticflickr.com/8382/8558295631_0f56c1284f_s.jpg" width="75" height="75" /></a>
<a href="http://farm9.staticflickr.com/8225/8558295635_b1c5ce2794_b.jpg" title="The Uninvited Guest"><img src="http://farm9.staticflickr.com/8225/8558295635_b1c5ce2794_s.jpg" width="75" height="75" /></a>
<a href="http://farm9.staticflickr.com/8383/8563475581_df05e9906d_b.jpg" title="Oh no, not again!"><img src="http://farm9.staticflickr.com/8383/8563475581_df05e9906d_s.jpg" width="75" height="75" /></a>
<a href="http://farm9.staticflickr.com/8235/8559402846_8b7f82e05d_b.jpg" title="Swan Lake"><img src="http://farm9.staticflickr.com/8235/8559402846_8b7f82e05d_s.jpg" width="75" height="75" /></a>
<a href="http://farm9.staticflickr.com/8235/8558295467_e89e95e05a_b.jpg" title="The Shake"><img src="http://farm9.staticflickr.com/8235/8558295467_e89e95e05a_s.jpg" width="75" height="75" /></a>
<a href="http://farm9.staticflickr.com/8378/8559402848_9fcd90d20b_b.jpg" title="Who's that, mommy?"><img src="http://farm9.staticflickr.com/8378/8559402848_9fcd90d20b_s.jpg" width="75" height="75" /></a>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.popup-gallery').magnificPopup({
delegate: 'a',
type: 'image',
tLoading: 'Loading image #%curr%...',
mainClass: 'mfp-img-mobile',
gallery: {
enabled: true,
navigateByImgClick: true,
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
},
image: {
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
titleSrc: function(item) {
return item.el.attr('title') + '<small>by Marsel Van Oosten</small>';
}
}
});
});
</script>
</div>
<div class="example gc3">
<h3>Zoom-gallery</h3>
<p>If you wish to open the popup only after image is fully loaded, you may preload image via JS. Or use scaled down image instead of thumbnail. Zoom effect works only with images, for now.</p>
<div class="html-code grid-of-images">
<div class="zoom-gallery">
<!--
Width/height ratio of thumbnail and the main image must match to avoid glitches.
If ratios are different, you may add CSS3 opacity transition to the main image to make the change less noticable.
-->
<a href="http://farm4.staticflickr.com/3763/9204547649_0472680945_o.jpg" data-source="http://500px.com/photo/32736307" title="Into The Blue" style="width:193px;height:125px;">
<img src="http://farm4.staticflickr.com/3763/9204547649_7de96ee188_t.jpg" width="193" height="125" />
</a>
<a href="http://farm3.staticflickr.com/2856/9207329420_7f2a668b06_o.jpg" data-source="http://500px.com/photo/32554131" title="Light Sabre" style="width:82px;height:125px;">
<img src="http://farm3.staticflickr.com/2856/9207329420_e485948b01_t.jpg" width="82px" height="125" />
</a>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.zoom-gallery').magnificPopup({
delegate: 'a',
type: 'image',
closeOnContentClick: false,
closeBtnInside: false,
mainClass: 'mfp-with-zoom mfp-img-mobile',
image: {
verticalFit: true,
titleSrc: function(item) {
return item.el.attr('title') + ' &middot; <a class="image-source-link" href="'+item.el.attr('data-source')+'" target="_blank">image source</a>';
}
},
gallery: {
enabled: true
},
zoom: {
enabled: true,
duration: 300, // don't foget to change the duration also in CSS
opener: function(element) {
return element.find('img');
}
}
});
});
</script>
<style type="text/css">
.image-source-link {
color: #98C3D1;
}
.mfp-with-zoom .mfp-container,
.mfp-with-zoom.mfp-bg {
opacity: 0;
-webkit-backface-visibility: hidden;
/* ideally, transition speed should match zoom duration */
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.mfp-with-zoom.mfp-ready .mfp-container {
opacity: 1;
}
.mfp-with-zoom.mfp-ready.mfp-bg {
opacity: 0.8;
}
.mfp-with-zoom.mfp-removing .mfp-container,
.mfp-with-zoom.mfp-removing.mfp-bg {
opacity: 0;
}
</style>
</div>
<div class="example gc3">
<h3>Popup with video or map</h3>
<p>In this example lightboxes are automatically disabled on small screen size and default behavior of link is triggered.</p>
<div class="html-code">
<a class="popup-youtube" href="http://www.youtube.com/watch?v=0O2aH4XLbto">Open YouTube video</a><br/>
<a class="popup-vimeo" href="https://vimeo.com/45830194" >Open Vimeo video</a><br/>
<a class="popup-gmaps" href="https://maps.google.com/maps?q=221B+Baker+Street,+London,+United+Kingdom&hl=en&t=v&hnear=221B+Baker+St,+London+NW1+6XE,+United+Kingdom">Open Google Map</a>
</div>
<style type="text/css">
/**
* Simple fade transition,
*/
.mfp-fade.mfp-bg {
opacity: 0;
-webkit-transition: all 0.15s ease-out;
-moz-transition: all 0.15s ease-out;
transition: all 0.15s ease-out;
}
.mfp-fade.mfp-bg.mfp-ready {
opacity: 0.8;
}
.mfp-fade.mfp-bg.mfp-removing {
opacity: 0;
}
.mfp-fade.mfp-wrap .mfp-content {
opacity: 0;
-webkit-transition: all 0.15s ease-out;
-moz-transition: all 0.15s ease-out;
transition: all 0.15s ease-out;
}
.mfp-fade.mfp-wrap.mfp-ready .mfp-content {
opacity: 1;
}
.mfp-fade.mfp-wrap.mfp-removing .mfp-content {
opacity: 0;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
$('.popup-youtube, .popup-vimeo, .popup-gmaps').magnificPopup({
disableOn: 700,
type: 'iframe',
mainClass: 'mfp-fade',
removalDelay: 160,
preloader: false,
fixedContentPos: false
});
});
</script>
</div>
<div class="example gc3">
<h3>Dialog with CSS animation</h3>
<p>Animations are added with simple CSS transitions, you can make them look however you wish.<br/>More <a href="http://codepen.io/dimsemenov/pen/GAIkt">animation effects on CodePen</a>.</p>
<div class="html-code">
<a class="popup-with-zoom-anim" href="#small-dialog" >Open with fade-zoom animation</a><br/>
<a class="popup-with-move-anim" href="#small-dialog" >Open with fade-slide animation</a>
<!-- dialog itself, mfp-hide class is required to make dialog hidden -->
<div id="small-dialog" class="zoom-anim-dialog mfp-hide">
<h1>Dialog example</h1>
<p>This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed.</p>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.popup-with-zoom-anim').magnificPopup({
type: 'inline',
fixedContentPos: false,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in'
});
$('.popup-with-move-anim').magnificPopup({
type: 'inline',
fixedContentPos: false,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-slide-bottom'
});
});
</script>
<style type="text/css">
/* Styles for dialog window */
#small-dialog {
background: white;
padding: 20px 30px;
text-align: left;
max-width: 400px;
margin: 40px auto;
position: relative;
}
/**
* Fade-zoom animation for first dialog
*/
/* start state */
.my-mfp-zoom-in .zoom-anim-dialog {
opacity: 0;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
-ms-transform: scale(0.8);
-o-transform: scale(0.8);
transform: scale(0.8);
}
/* animate in */
.my-mfp-zoom-in.mfp-ready .zoom-anim-dialog {
opacity: 1;
-webkit-transform: scale(1);
-moz-transform: scale(1);
-ms-transform: scale(1);
-o-transform: scale(1);
transform: scale(1);
}
/* animate out */
.my-mfp-zoom-in.mfp-removing .zoom-anim-dialog {
-webkit-transform: scale(0.8);
-moz-transform: scale(0.8);
-ms-transform: scale(0.8);
-o-transform: scale(0.8);
transform: scale(0.8);
opacity: 0;
}
/* Dark overlay, start state */
.my-mfp-zoom-in.mfp-bg {
opacity: 0;
-webkit-transition: opacity 0.3s ease-out;
-moz-transition: opacity 0.3s ease-out;
-o-transition: opacity 0.3s ease-out;
transition: opacity 0.3s ease-out;
}
/* animate in */
.my-mfp-zoom-in.mfp-ready.mfp-bg {
opacity: 0.8;
}
/* animate out */
.my-mfp-zoom-in.mfp-removing.mfp-bg {
opacity: 0;
}
/**
* Fade-move animation for second dialog
*/
/* at start */
.my-mfp-slide-bottom .zoom-anim-dialog {
opacity: 0;
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
-o-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
-webkit-transform: translateY(-20px) perspective( 600px ) rotateX( 10deg );
-moz-transform: translateY(-20px) perspective( 600px ) rotateX( 10deg );
-ms-transform: translateY(-20px) perspective( 600px ) rotateX( 10deg );
-o-transform: translateY(-20px) perspective( 600px ) rotateX( 10deg );
transform: translateY(-20px) perspective( 600px ) rotateX( 10deg );
}
/* animate in */
.my-mfp-slide-bottom.mfp-ready .zoom-anim-dialog {
opacity: 1;
-webkit-transform: translateY(0) perspective( 600px ) rotateX( 0 );
-moz-transform: translateY(0) perspective( 600px ) rotateX( 0 );
-ms-transform: translateY(0) perspective( 600px ) rotateX( 0 );
-o-transform: translateY(0) perspective( 600px ) rotateX( 0 );
transform: translateY(0) perspective( 600px ) rotateX( 0 );
}
/* animate out */
.my-mfp-slide-bottom.mfp-removing .zoom-anim-dialog {
opacity: 0;
-webkit-transform: translateY(-10px) perspective( 600px ) rotateX( 10deg );
-moz-transform: translateY(-10px) perspective( 600px ) rotateX( 10deg );
-ms-transform: translateY(-10px) perspective( 600px ) rotateX( 10deg );
-o-transform: translateY(-10px) perspective( 600px ) rotateX( 10deg );
transform: translateY(-10px) perspective( 600px ) rotateX( 10deg );
}
/* Dark overlay, start state */
.my-mfp-slide-bottom.mfp-bg {
opacity: 0;
-webkit-transition: opacity 0.3s ease-out;
-moz-transition: opacity 0.3s ease-out;
-o-transition: opacity 0.3s ease-out;
transition: opacity 0.3s ease-out;
}
/* animate in */
.my-mfp-slide-bottom.mfp-ready.mfp-bg {
opacity: 0.8;
}
/* animate out */
.my-mfp-slide-bottom.mfp-removing.mfp-bg {
opacity: 0;
}
</style>
</div>
<div class="example gc3">
<h3>Popup with form</h3>
<p>Entered data is not lost if you open and close the popup or if you go to another page and then press back browser button.</p>
<div class="html-code">
<!-- link that opens popup -->
<a class="popup-with-form" href="#test-form">Open form</a>
<!-- form itself -->
<form id="test-form" class="mfp-hide white-popup-block">
<h1>Form</h1>
<fieldset style="border:0;">
<p>Lightbox has an option to automatically focus on the first input. It's strongly recommended to use <code>inline</code> popup type for lightboxes with form instead of <code>ajax</code> (to keep entered data if the user accidentally refreshed the page).</p>
<ol>
<li>
<label for="name">Name</label>
<input id="name" name="name" type="text" placeholder="Name" required>
</li>
<li>
<label for="email">Email</label>
<input id="email" name="email" type="email" placeholder="example@domain.com" required>
</li>
<li>
<label for="phone">Phone</label>
<input id="phone" name="phone" type="tel" placeholder="Eg. +447500000000" required>
</li>
<li>
<label for="textarea">Textarea</label><br/>
<textarea id="textarea">Try to resize me to see how popup CSS-based resizing works.</textarea>
</li>
</ol>
</fieldset>
</form>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.popup-with-form').magnificPopup({
type: 'inline',
preloader: false,
focus: '#name',
// When elemened is focused, some mobile browsers in some cases zoom in
// It looks not nice, so we disable it:
callbacks: {
beforeOpen: function() {
if($(window).width() < 700) {
this.st.focus = false;
} else {
this.st.focus = '#name';
}
}
}
});
});
</script>
</div>
<div class="example gc3">
<h3>Ajax popup</h3>
<p>You have full control of what is displayed in popup, align it to any side via CSS, enable or disable scroll on right side of window - whatever.</p>
<div class="html-code">
<a class="simple-ajax-popup-align-top" href="site-assets/ajax/test-ajax.html" >Load content via ajax</a><br/>
<a class="simple-ajax-popup" href="site-assets/ajax/test-ajax-2.html" >Load another content via ajax</a>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('.simple-ajax-popup-align-top').magnificPopup({
type: 'ajax',
alignTop: true,
overflowY: 'scroll' // as we know that popup content is tall we set scroll overflow by default to avoid jump
});
$('.simple-ajax-popup').magnificPopup({
type: 'ajax'
});
});
</script>
</div>
<div class="example gc3">
<h3>Modal popup</h3>
<p>A modal popup disables the usual ways to close popups.</p>
<div class="html-code">
<a class="popup-modal" href="#test-modal">Open modal</a>
<div id="test-modal" class="mfp-hide white-popup-block">
<h1>Modal dialog</h1>
<p>You won't be able to dismiss this by usual means (escape or
click button), but you can close it programatically based on
user choices or actions.</p>
<p><a class="popup-modal-dismiss" href="#">Dismiss</a></p>
</div>
</div>
<script type="text/javascript">
$(function () {
$('.popup-modal').magnificPopup({
type: 'inline',
preloader: false,
focus: '#username',
modal: true
});
$(document).on('click', '.popup-modal-dismiss', function (e) {
e.preventDefault();
$.magnificPopup.close();
});
});
</script>
</div>
<div class="example gc3">
<h3>Error handling</h3>
<p>This is just basic example of how error messages are displayed. Surely, you can change text or style them.</p>
<div class="html-code">
<!-- classes mfp-image and mfp-ajax define type of the popup -->
<a id="broken-image" class="mfp-image" href="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/Blois_Loire_Panorama_-_July_2011.jpg/640px-Blois_Loire_Panorama_-_July_2011-fake.jpg" >Broken image</a><br/>
<a id="broken-ajax" class="mfp-ajax" href="http://example.com/fakeg" >Broken ajax request</a>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#broken-image, #broken-ajax').magnificPopup({});
});
</script>
</div>
<!-- <div class="example gc3">
<h3>Other variations</h3>
<div class="html-code">
<a id="inline-html-content" class="mfp-inline" data-mfp-src="#custom-content" href="#custom-content" >Open inline text block</a>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#inline-html-content').magnificPopup({
disableOn:0,
alignTop: true,
marTop: 0,
marBottom: 0,
closeBtnInside: true,
mainClass: 'mfp-dark-close-button mfp-with-40-margin',
preloader: false
});
});
</script>
</div> -->
</div>
<!--
Examples end.
-->

View File

@@ -0,0 +1,50 @@
<script type="text/javascript">
(function() {
var isCanvasSupported = function () {
var elem = document.createElement('canvas');
return !!(elem.getContext && elem.getContext('2d'));
};
if( isCanvasSupported() ) {
var canvas = document.getElementById('broken-glass'),
context = canvas.getContext('2d'),
width = canvas.width = Math.min(800, window.innerWidth),
height = canvas.height,
numTriangles = 100,
rand = function(min, max){
return Math.floor( (Math.random() * (max - min + 1) ) + min);
};
window.drawTriangles = function(){
context.clearRect(0, 0, width, height);
var hue = rand(0,360);
var increment = 80 / numTriangles;
for(var i = 0; i < numTriangles; i++) {
context.beginPath();
context.moveTo(rand(0,width), rand(0,height) );
context.lineTo(rand(0,width), rand(0,height) );
context.lineTo(rand(0,width), rand(0,height) );
context.globalAlpha = 0.5;
context.fillStyle = 'hsl('+Math.round(hue)+', '+rand(15,60)+'%, '+ rand(10, 60) +'%)';
context.closePath();
context.fill();
hue+=increment;
if(hue > 360) hue = 0;
}
canvas.style.cssText = '-webkit-filter: contrast(115%);';
};
document.getElementById('logo-title').style.color = 'rgba(250, 250, 250, 0.95)';
drawTriangles();
var el = document.getElementById('logo');
el.onclick = function() {
drawTriangles();
};
}
})();
</script>

View File

@@ -0,0 +1,99 @@
<div id="mc_embed_signup" class="embed-form zoom-anim-dialog mfp-hide">
<style>
#mc_embed_signup h4 {
font-size: 30px;
line-height: 1.2;
margin-bottom: 12px;
}
#mc_embed_signup input[type="email"] {
border: 1px solid #CCC;
border-top: 1px solid #999;
padding: 5px;
font-size: 18px;
width: 200px;
margin-right: 10px;
height: 25px;
transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
}
#mc_embed_signup input[type="email"]:focus {
background-color: #FFF;
border: 1px solid #3169B3;
box-shadow: #3169B3 0px 0px 5px;
-moz-box-shadow: #3169B3 0px 0px 5px;
-webkit-box-shadow: #3169B3 0px 0px 5px;
outline: none;
}
#mc_embed_signup input[type="submit"] {
border: 1px solid #3169B3;
font-size: 13px;
font-weight: bold;
color: #FFF;
height: auto;
padding: 8px 13px;
cursor: pointer;
background-color: #3169B3;
display: inline-block;
width: auto;
-webkit-appearance: none;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
vertical-align: top;
}
.embed-form {
padding: 30px;
background: #FFF;
margin: 30px auto;
display: block;
width: auto;
max-width: 350px;
position: relative;
}
#mc_embed_signup .mc-field-group {
margin-top: 20px;
}
#mc_embed_signup p {
font-size: 15px;
color: #4F4F4F;
}
</style>
<script>
if(window.$) {
$(document).ready(function() {
$('.wp-version-link').magnificPopup({
type: 'inline',
fixedContentPos: false,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in'
});
});
}
</script>
<form action="http://dimsemenov.us1.list-manage.com/subscribe/post?u=ef6026d946a7b5d41d92c02e4&amp;id=54fae727da" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<h4>Magnific WordPress Plugin is under development!</h4>
<p>To get notified about the release, subscribe to my Mailchimp list that I send 3-4 times a year. Any feature requests are welcome.</p>
<div class="mc-field-group">
<input type="email" value="" name="EMAIL" placeholder="Your email" class="required email" id="mce-EMAIL">
<input type="hidden" id="group_2" name="group[2065][2]" value="true">
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="display:none"></div>
<div class="response" id="mce-success-response" style="display:none"></div>
</div>
</form>
</div>

View File

@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{ page.title }}</title>
<meta charset="utf-8">
<meta name="description" content="{{page.description}}"/>
<meta name="viewport" content="width = device-width, initial-scale = 1.0" />
<meta name="author" content="Dmitry Semenov">
<link rel="canonical" href="{{page.canonical_url}}" />
<meta property="og:url" content="{{page.canonical_url}}">
<meta property="og:title" content="{{page.title}}">
<meta property="og:description" content="{{page.description}}">
<meta property="og:image" content="http://dimsemenov.com/magnific-og-400x400.jpg">
<link href="https://plus.google.com/102586375605352607718" rel="publisher" />
{% if site.url == 'local' %}
<link href="site-assets/site.css?v={{site.mfpversion}}" rel="stylesheet" />
<link href="dist/magnific-popup.css?v={{site.mfpversion}}" rel="stylesheet" />
{% else %}
<link href="site-assets/all.min.css?v={{site.mfpversion}}" rel="stylesheet" />
{% endif %}
{% if page.title == 'Magnific Popup Documentation' %}
<style type="text/css"> #main-wrapper{background: #FFF;} </style>
{% endif %}
</head>
<body>
<div id="main-wrapper">
{{ content | markdown }}
<div id="footer">
Created by <a href="http://dimsemenov.com" rel="author">Dmitry Semenov</a>.{% if page.include_credit %} Photography in demo by <a href="http://www.squiver.com">Marsel Van Oosten</a>{% endif %}
</div>
</div>
{{page.footer}}
{% if page.addjs %}
{% if site.url == 'local' %}
<script>
document.write('<script src=third-party-libs/' +
('__proto__' in {} ? 'zepto' : 'jquery') +
'.js><\/script>')
</script>
<script src="dist/jquery.magnific-popup.js?v={{site.mfpversion}}"></script>
{% else %}
<script>
document.write('<script src=third-party-libs/' +
('__proto__' in {} ? 'zepto' : 'jquery') +
'.min.js><\/script>')
</script>
<script src="dist/jquery.magnific-popup.min.js?v={{site.mfpversion}}"></script>
{% endif %}
{% endif %}
{% include analytics.html %}
{% if page.buildtool %}
{% include build-tool.html %}
{% endif %}
{% if site.url == 'local' %}
<strong style="display:block; width:100%;text-align:center;">This page is just for tests and should not be used for production!</strong>
{% endif %}
</body>
</html>

View File

@@ -0,0 +1,101 @@
---
layout: default
title: Magnific Popup&#58; Responsive jQuery Lightbox Plugin
description: Light and open source responsive lightbox plugin with focus on performance, for jQuery and Zepto.js. High-DPI (retina) display support, fast tap for touch devices.
canonical_url: http://dimsemenov.com/plugins/magnific-popup/
include_credit: true
buildtool: true
---
<div id="logo">
<canvas id="broken-glass"></canvas>
<h1 id="logo-title">Magnific Popup</h1>
</div>
{% include logo.html %}
<div>
<h2 class="intro">Magnific Popup is a responsive lightbox &amp; dialog script with focus on performance and providing best experience for user with any device<br/>(for jQuery or Zepto.js).</h2>
<div id="header-links">
<a href="documentation.html">Documentation</a> &middot; <a href="https://github.com/dimsemenov/Magnific-Popup">GitHub</a> &middot; <a href="wordpress.html" class="wp-version-link" data-mfp-src="#mc_embed_signup">WordPress plugin</a> &middot; <a href="#mfp-build-tool" class="mfp-build-tool-link">Build tool</a> &middot; <a class="smashing-link" href="http://coding.smashingmagazine.com/2013/05/02/truly-responsive-lightbox/">How it was made</a>
</div>
</div>
{% include examples.html %}
<p id="smashing">Don't forget to check out <a href="http://coding.smashingmagazine.com/2013/05/02/truly-responsive-lightbox/">my new article</a> about this plugin on the <a class="smashing-link" href="http://coding.smashingmagazine.com/2013/05/02/truly-responsive-lightbox/">Smashing Magazine</a>.</p>
<h2>What makes this plugin different?</h2>
<div class="features grid-c">
<div class="gc3">
<h3>Light and modular</h3>
<p>You can choose to include only the features that you need using the <a href="#mfp-build-tool" class="mfp-build-tool-link popup-link">online build tool</a> or by compiling it yourself with <a href="http://gruntjs.com">Grunt.js</a>. Size of core JS file is about <strong>3KB</strong> + each module weighs about 0.5KB (gzipped). Sass CSS preprocessor is used for easier skinning, but you're not obligated to use it.</p>
</div>
<div class="gc3">
<h3>Content is resized with CSS</h3>
<p>The majority of lightbox plugins require you to define size of it via JS option. Magnific Popup does not - feel free to use relative units like EM's or resize lightbox with help of CSS media queries. Update content inside lightbox without worrying about how it'll resize and center.</p>
</div>
<div class="gc3">
<h3>Fast</h3>
<p>Magnific Popup displays images before they're completely loaded to take full advantage of progressive loading. For in and out transitions CSS3 is used instead of slow JavaScript animation.</p>
</div>
<div class="gc3">
<h3>High-DPI (Retina) display support</h3>
<p>Default controls are made with pure CSS, without external graphics. For the main image there is a built in way to provide appropriate source for different pixel density displays.</p>
</div>
<div class="gc3">
<h3>Conditional lightbox</h3>
<p>Plugin has an option to automatically switch to alternative mobile-friendly source on small screen size. Brad Frost has a <a href="http://bradfrostweb.com/blog/post/conditional-lightbox/">terrific article</a> about this technique.</p>
</div>
<div class="gc3">
<h3>Memory management</h3>
<p>Popup has an extendable micro templating engine that reuses existing DOM elements (<a href="http://codepen.io/dimsemenov/pen/sHoxp">example</a>), which is especially useful when your popups same pattern.</p>
</div>
</div><br/>
{% include signup.html %}
<h2>Browser support</h2>
<p>Tested on desktop: Chrome, Safari, FF, Opera, IE8+, partial support of IE7 (works, but some visual layout features, like vertical centering, are missing). Mobile: default browser in Android 2.3+, iOS5+, Blackberry
10+, WP7+, mobile Opera and Chrome on Android. If you noticed any bug, please open an <a href="https://github.com/dimsemenov/Magnific-Popup/issues?state=open">issue on GitHub</a></p>
<h2 id="license">License</h2>
<p>Script is available under MIT license and will always be kept this way.<br/>But please do me a favor and do not create a public WordPress plugin based on it, because I will make it soon and it will be open souce too. (<a href="http://dimsemenov.com/subscribe.html">Want to get notified?</a>).
</p>
<h2>Bugs & contributing</h2>
<p>Please report bugs via <a href="https://github.com/dimsemenov/Magnific-Popup/issues">GitHub</a> and ask general questions through <a href="http://stackoverflow.com/questions/ask?tags=magnific-popup">StackOverflow</a>. Feel free to submit commit, even the tiniest contributions to the script or to the documentation are very welcome.</p>
<p>Special thanks to:</p>
<ul>
<li><a href="https://twitter.com/lokesh">Lokesh Dhakar</a> for original Lightbox script.</li>
<li><a href="https://twitter.com/chriscoyier">Chris Coyier</a> for awesome CSS techniques.</li>
<li><a href="https://twitter.com/brad_frost">Brad Frost</a> for conditional lightbox technique.</li>
</uL>
<h2>Updates</h2>
<p>If you wish to get notified about important plugin updates, you may star and watch the repository on <a href="https://github.com/dimsemenov/Magnific-Popup">GitHub</a>, follow <a href="http://twitter.com/dimsemenov">me on Twitter</a>, or join my tiny Mailchimp <a href="http://dimsemenov.com/subscribe.html">email newsletter</a> that I send 3-4 times a year.</p>
<div class="share-buttons">
<h2>Please spread the word if you find the plugin useful</h2>
<div id="buttons-row">
<a id="tweet" rel="nofollow" href="https://twitter.com/intent/tweet?text=Magnific%20Popup%20-%20responsive%20lightbox%20plugin&amp;url=http%3A%2F%2Fbit.ly%2Fmagnificpopup&amp;via=dimsemenov">Tweet!</a>
<a id="like" rel="nofollow" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Fdimsemenov.com%2Fplugins%2Fmagnific-popup%2F%3Futm_source%3Dfb%26utm_medium%3Dsocial%26utm_campaign%3Dmfp">Like!</a>
<a id="gplus" rel="nofollow" href="https://plus.google.com/share?url=http%3A%2F%2Fdimsemenov.com%2Fplugins%2Fmagnific-popup%2F%3Futm_source%3Dgplus%26utm_medium%3Dsocial%26utm_campaign%3Dmfp">+1</a>
<iframe src="http://ghbtns.com/github-btn.html?user=dimsemenov&amp;repo=magnific-popup&amp;type=watch&amp;count=true&amp;size=large" allowtransparency="true" frameborder="0" scrolling="0" width="155" height="30" style="transform: translateY(8px);-moz-transform: translateY(8px);-webkit-transform: translateY(8px); margin-left: 9px;"></iframe>
</div>
</div>
<script>
(function(){
var openWindowPopup = function(e) {
if(!e) return;
e.preventDefault();
window.open(e.target.href, "intent", "scrollbars=yes,resizable=yes,toolbar=no,location=yes,width=550,height=420,left=" + (window.screen ? Math.round(screen.width / 2 - 275) : 50) + ",top=" + 100);
};
var ids = ['tweet', 'like', 'gplus'];
for(var i = 0; i < ids.length; i++) {
document.getElementById(ids[i]).onclick = openWindowPopup;
}
})();
</script>

View File

@@ -0,0 +1,29 @@
<div class="ajax-text-and-image white-popup-block">
<style>
.ajax-text-and-image {
max-width:800px; margin: 20px auto; background: #FFF; padding: 0; line-height: 0;
}
.ajcol {
width: 50%; float:left;
}
.ajcol img {
width: 100%; height: auto;
}
@media all and (max-width:30em) {
.ajcol {
width: 100%;
float:none;
}
}
</style>
<div class="ajcol">
<img src="http://upload.wikimedia.org/wikipedia/commons/thumb/e/e7/Marabou_stork%2C_Leptoptilos_crumeniferus_edit1.jpg/603px-Marabou_stork%2C_Leptoptilos_crumeniferus_edit1.jpg"/>
</div>
<div class="ajcol" style="line-height: 1.231;">
<div style="padding: 1em">
<h1>This is just block of HTML, loaded via ajax</h1>
<p>You can put absolutely any HTML here and resize it dynamically just with help of CSS.</p>
</div>
</div>
<div style="clear:both; line-height: 0;"></div>
</div>

View File

@@ -0,0 +1,10 @@
<div id="custom-content" class="white-popup-block" style="max-width:600px; margin: 20px auto;">
<h1>HTML content, loaded via ajax</h1>
<style>
#custom-content img {max-width: 100%;margin-bottom: 10px;}
</style>
<p>This is dummy copy. It is not meant to be read. It has been placed here solely to demonstrate the look and feel of finished, typeset text. Only for show. He who searches for meaning here will be sorely disappointed. These words are here to provide the reader with a basic impression of how actual text will appear in its final presentation. </p>
<p>This is dummy copy. It's Greek to you. Unless, of course, you're Greek, in which case, it really makes no sense. Why, you can't even read it! It is strictly for mock-ups. You may mock it up as strictly as you wish.</p>
<img src="http://farm9.staticflickr.com/8242/8558295633_f34a55c1c6_b.jpg" />
<img src="http://farm9.staticflickr.com/8382/8558295631_0f56c1284f_b.jpg" />
</div>

View File

@@ -0,0 +1,861 @@
/* Demo site CSS. Not mobile first, not semantic, not optimized, made for 20 minutes, mess */
html, body, div, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, ol, ul, li, form, fieldset, legend, label, table, header, footer, nav, section, figure {
margin: 0;
padding: 0;
}
html {
overflow-y: scroll;
}
body {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 1.6;
color: #5A6064;
}
pre,code{
tab-size: 4;
}
p {
margin: 0 0 11px;
}
ul {
list-style: disc;
}
ul, ol {
padding: 0;
margin: 0 0 11px 25px;
}
li {
line-height: 22px;
margin: 0 0 .5em 0;
}
h1, h2, h3, h4, h5, h6 {
margin: 0;
font-weight: normal;
text-rendering: optimizelegibility;
color: #282B30;
font-family:Calibri, "PT Sans", "Trebuchet MS", 'Helvetica Neue', Arial
}
.mfp-preloader {
font-size: 13px;
}
img {
border: 0;
}
h1 {
margin-bottom: 5px;
}
.get-code-window {
position: relative;
background: #FFF;
padding: 2em 3em;
width: auto;
margin: 20px auto;
max-width: 600px;
}
#magnific_popup_documentation {
font-size: 3em;
margin-bottom: 1em;
font-weight: bold;
text-align: center;
}
h2 {
font-weight: bold;
margin-top: 2em;
margin-bottom: .3em;
border-bottom: 1px solid #DDD;
padding-bottom: 0.2em;
font-size: 1.8em;
}
h3 {
font-size: 22px;
line-height: 24px;
margin-bottom: 12px;
margin-top: 20px;
}
h4 {
margin-bottom: 5px;
}
a {
color: #3169B3;
text-decoration: underline;
}
a:hover {
color: #C00;
text-decoration: underline;
}
body {
background: #fafafa;
}
.grid-c h3 {
margin-top: 0;
}
.grid-c {
clear: both;
}
.grid-c p {
margin-bottom: .5em;
}
.grid-c {
overflow: hidden;
margin: 0 -1em;
}
.gc3 {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 50%;
float: left;
padding: 1em;
overflow: hidden;
}
.grid-c .gc3:nth-of-type(2n+1) {
clear: left;
}
h1#magnific-popup-docs {
display: none;
}
#logo {
height: 150px;
text-align: center;
position: relative;
width: 100%;
-webkit-user-select: none;
-moz-user-select: none;
padding: 0 3em;
margin-left: -3em;
cursor: pointer;
margin-top: 50px;
margin-bottom: 50px;
}
#broken-glass {
height: 100%;
-webkit-tap-highlight-color: transparent;
position: absolute;
left: 0;
top: 0;
width: 100%;
}
#logo:active h1 {
top: 1px;
}
#logo h1 {
margin-top: 27px;
font-size: 63px;
line-height: 1.4;
top: 0;
}
#logo h1 {
text-align: center;
font-weight: bold;
width: 100%;
color: #000;
position: absolute;
left: 0;
-webkit-user-select: none;
-moz-user-select: none;
cursor: pointer;
}
h2.intro {
font-size: 22px;
line-height: 1.2;
font-weight: normal;
border: 0;
margin-top: 0;
}
#header-links {
font-size: 16px;
}
/*#header-links a {
color: #A5CCFF;
}
#header-links a:hover {
opacity: 0.8;
}*/
#markdown-toc {
position: fixed;
left: 0;
top: 50px;
padding: 20px 20px;
background: rgba(255, 255, 255, 0.71);
-webkit-backface-visibility:hidden;
list-style: none;
}
#markdown-toc a[href="#magnific-popup-docs"] {
display: none;
}
#markdown-toc ul {
list-style: none;
}
#markdown-toc ul ul {
display: none;
}
#markdown-toc:before {
content: 'Table of contents';
font-weight: bold;
display: block;
margin-bottom: 10px;
}
@media all and (max-width: 75em) {
#markdown-toc {
position: static;
padding: 0;
background: none;
}
}
#markdown-toc a {
text-decoration: none;
border-bottom: 1px dotted;
}
#markdown-toc ul {
margin: 0;
padding: 0;
}
#markdown-toc .active a{
text-decoration: none;
color: #666;
}
/*h2:target {
font-weight: bold;
margin-top: 0;
border-top: 1.8em solid transparent;
margin-bottom: .3em;
border-bottom: 0;
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
background-color: #FFF6BF;
padding-top: .2em;
padding-left: .5em;
}*/
code,pre {
font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code {
background: #F8F8F8;
padding: .1em .4em;
color: #c82829;
font-size: 13px;
}
pre {
background: none;
line-height: 18px;
overflow: auto;
padding: 20px 25px;
border-radius: 2px;
}
pre code {
border: 0;
padding: 0;
background: none;
color: #000;
font-size: 13px;
}
.highlight {
position: relative;
margin-bottom: 0.5em;
margin-left: -1.5em;
width: 100%;
padding: 0 1.5em;
background-color: #F5FAFC;
}
pre code:before {
display: block;
position: absolute;
right: 3px;
top: 6px;
padding: 3px 7px 0;
color: #889499;
font-size: 12px;
line-height: 13px;
}
code.html:before {
content: 'HTML';
}
code.javascript:before {
content: 'JS';
}
code.css:before {
content: 'CSS';
}
#mc_embed_signup {
max-width: 350px;
padding: 32px;
background: #EEE;
}
#mc_embed_signup input[type="email"] {
border: 1px solid #CCC;
border-top: 1px solid #999;
padding: 5px;
font-size: 18px;
width: 200px;
margin-right: 10px;
height: 25px;
transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-webkit-transition: all 0.3s ease;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
}
#mc_embed_signup input[type="email"]:focus {
background-color: #FFF;
border: 1px solid #3169B3;
box-shadow: #3169B3 0px 0px 5px;
-moz-box-shadow: #3169B3 0px 0px 5px;
-webkit-box-shadow: #3169B3 0px 0px 5px;
outline: none;
}
#mc_embed_signup input[type="submit"] {
border: 1px solid #3169B3;
font-size: 13px;
font-weight: bold;
color: #FFF;
height: auto;
padding: 8px 13px;
cursor: pointer;
background-color: #3169B3;
display: inline-block;
width: auto;
-webkit-appearance: none;
border-radius: 2px;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
vertical-align: top;
}
.embed-form {
position: relative;
}
#mc_embed_signup p {
font-size: 15px;
color: #4F4F4F;
}
#main-wrapper {
background: none;
max-width: 800px;
width: 100%;
margin: 2em auto 4em;
padding: 3em;
padding-top: 0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
position: relative;
}
.white-popup-block {
background: #FFF;
padding: 20px 30px;
text-align: left;
max-width: 650px;
margin: 40px auto;
position: relative;
}
#examples:after {
content: 'to view source click on the title of example';
opacity: 0.4;
font-weight: normal;
font-size: 14px;
margin-top: 13px;
float: right;
}
.example {
margin-bottom: 20px;
position: relative;
}
.example h3 {
display: inline-block;
cursor: pointer;
border-bottom: 1px dotted #949494;
}
.example h3:hover {
color: #C00;
}
.example h3:hover:after {
content: 'view source';
padding-left: 8px;
color: #999;
position: absolute;
top: 16px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
font-size: 12px;
}
/*button.get-code-btn {
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none;
display: block;
z-index: 1;
padding: 0;
outline: none;
background: red;
position: absolute;
right: 0;
top: 0;
}*/
.square-tmb {
margin: 0 10px 0 0;
cursor: pointer;
}
.zoom-cursor {
cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
cursor: zoom-in;
}
.example a,
a.popup-link {
text-decoration: none;
border-bottom: 1px dotted;
}
.example a:hover,
a.popup-link:hover {
text-decoration: none;
}
.example a {
line-height: 26px;
}
.example p a {
text-decoration: underline;
border: 0;
line-height: 1.6;
}
#image-gallery a,
#single-image {
border-bottom: none;
}
.not-ready-yet-notice {
padding: 20px 20px;
background: #EEE;
}
#footer {
border-top: 1px solid #DDD;
padding-top: 3em;
margin: 5em 0 0;
width: 100%;
text-align: center;
opacity: 0.9;
}
#conditional-lightbox-notice {
display: none;
}
#logo-status {
opacity: 0;
-webkit-transition: opacity 0.5s;
-moz-transition: opacity 0.5s;
transition: opacity 0.5s;
width: 100%;
text-align: center;
}
#logo-status.down {
opacity: 1;
}
.grid-of-images a {
cursor: -webkit-zoom-in;
cursor: -moz-zoom-in;
cursor: zoom-in;
border-bottom: 0;
height: 75px;
display: block;
float: left;
margin: 0 5px 5px 0;
width: 75px;
}
.grid-of-images a:hover {
opacity: 0.9;
}
h3 em {
opacity: 0.3;
}
code.def {
padding: 0;
background: #FFF;
border: 0;
display: block;
margin-bottom: 8px;
margin-top: -10px;
color: #A3A3A3;
}
@media all and (max-width: 50em) {
#logo h1 {
font-size: 52px;
margin-top: 36px;
}
}
@media all and (max-width: 30em) {
#examples:after {
display: none;
}
.gc3 {
width: 100%;
}
.grid-c .gc3:nth-of-type(2n+1) {
clear: none;
}
#main-wrapper {
padding: 1em;
margin-top: 0;
}
.highlight {
padding: 0.2em 1em;
margin: 1em -1em;
}
#logo {
height: 95px;
width: 100%;
padding: 0;
margin: 0 auto;
margin-top: 0;
margin-bottom: 2em;
}
#logo h1 {
font-size: 32px;
margin-top: 23px;
}
h2.intro {
font-size: 20px;
}
}
@media all and (max-width: 700px) {
.zoom-cursor {
cursor: pointer;
}
#conditional-lightbox-notice {
display: block;
padding: 10px;
background: #FFEAEA;
}
}
#logo-overlay {
width: 100%;
height: 75px;
}
#logo-overlay {
opacity: 1;
background: red;
position: absolute;
left: 0;
top: 0;
opacity: 0;
}
#mfp-build-tool {
background: #FFF;
padding: 30px 40px 40px 40px;
max-width: 500px;
text-align: left;
margin: 10px auto;
position: relative;
}
#mfp-build-tool h2 {
margin-top: 0;
margin-bottom: 0.7em;
}
#mfp-build-form label {
display: block;
margin-bottom: 5px;
min-height: 18px;
padding-left: 18px;
}
#mfp-build-form input[type="checkbox"] {
margin: 3px 0;
line-height: normal;
cursor: pointer;
width: auto;
margin-right: 5px;
float: left;
margin-left: -18px;
}
#mfp-build-status {
min-height: 40px;
}
#mfp-build-status .error {
color: #830C0C;
}
#mfp-build-status .success {
color: #014B04;
}
#mfp-build-status .progress {
color: #000;
}
#smashing {
text-align: center;
font-weight: bold;
}
#smashing a {
color: #EF4A35;
}
#smashing a:hover {
color: #FF9369;
}
#smashing strong {
color: #EF4A35;
}
.smashing-link {
margin-left: 29px;
position: relative;
}
.smashing-link:before {
content: '';
display: inline-block;
width: 24px;
height: 24px;
background: url("http://dimsemenov.com/images/sm-logo-24x24.png");
position: absolute;
top: -4px;
left: -28px;
}
#hackernews {
margin-left: 24px;
}
#hackernews:before {
background: url("http://dimsemenov.com/images/hn-logo-18x18.gif");
width: 18px;
height: 18px;
top: -1px;
left: -22px;
}
.share-buttons {
text-align: center;
}
.share-buttons h2 {
text-align: center;
border: 0;
}
.share-buttons {
position: relative;
margin: 70px 0;
}
.share-buttons a {
-moz-border-radius: 2px;
border-radius: 2px;
display: inline-block;
padding: 10px 20px;
margin: 10px;
color: #FFF;
text-decoration: none;
background: #5AAF63;
font-size: 16px;
line-height: 22px;
cursor: pointer;
}
.share-buttons a:hover {
opacity: 0.7;
}
#tweet {
background: #0096c4;
}
#like {
background: #3b5998;
}
#gplus {
background: #d34836;
}
#vkcom {
background: #6e8fb1;
}
pre .comment,
pre .template_comment,
pre .diff .header,
pre .javadoc {
color: #998;
font-style: italic
}
pre .keyword,
pre .css .rule .keyword,
pre .winutils,
pre .javascript .title,
pre .nginx .title,
pre .subst,
pre .request,
pre .status {
color: #333;
font-weight: bold
}
pre .number,
pre .hexcolor,
pre .ruby .constant {
color: #099;
}
pre .string,
pre .tag .value,
pre .phpdoc,
pre .tex .formula {
color: #D01040;
}
pre .title,
pre .id {
color: #900;
font-weight: bold
}
pre .javascript .title,
pre .lisp .title,
pre .clojure .title,
pre .subst {
font-weight: normal
}
pre .class .title,
pre .haskell .type,
pre .vhdl .literal,
pre .tex .command {
color: #458;
font-weight: bold
}
pre .tag,
pre .tag .title,
pre .rules .property,
pre .django .tag .keyword {
color: #000080;
font-weight: normal
}
pre .attribute,
pre .variable,
pre .lisp .body {
color: teal;
}
pre .regexp {
color: #009926
}
pre .class {
color: #458;
font-weight: bold
}
pre .symbol,
pre .ruby .symbol .string,
pre .lisp .keyword,
pre .tex .special,
pre .prompt {
}
pre .built_in,
pre .lisp .title,
pre .clojure .built_in {
color: #0086b3
}
pre .preprocessor,
pre .pi,
pre .doctype,
pre .shebang,
pre .cdata {
color: #999;
font-weight: bold
}
pre .deletion {
background: #fdd
}
pre .addition {
background: #dfd
}
pre .diff .change {
background: #0086b3
}
pre .chunk {
color: #aaa
}
#documentation-intro {
background: #2b2b2b;
text-align: center;
padding: 3em;
width: 100%;
margin-left: -3em;
margin-bottom: 3em;
}
#documentation-intro h1 {
color: #FFF;
width: 100%;
text-align: center;
font-size: 44px;
line-height: 1.1em;
}
#id1 {
display: none;
}
#documentation-intro h1 a {
text-decoration: none;
color: #FFF;
}
#documentation-intro p a {
font-size: 15px;
color: #7CB5FF;
}
#documentation-intro a:hover {
opacity: 0.75;
text-decoration: underline;
}
/* Syntax highlighter */
.hll{background-color:#ffc}.c{color:#998;font-style:italic}.err{color:#a61717;background-color:#e3d2d2}.k{color:#000;font-weight:bold}.o{color:#000;font-weight:bold}.cm{color:#998;font-style:italic}.cp{color:#999;font-weight:bold;font-style:italic}.c1{color:#998;font-style:italic}.cs{color:#999;font-weight:bold;font-style:italic}.gd{color:#000;background-color:#fdd}.ge{color:#000;font-style:italic}.gr{color:#a00}.gh{color:#999}.gi{color:#000;background-color:#dfd}.go{color:#888}.gp{color:#555}.gs{font-weight:bold}.gu{color:#aaa}.gt{color:#a00}.kc{color:#000;font-weight:bold}.kd{color:#000;font-weight:bold}.kn{color:#000;font-weight:bold}.kp{color:#000;font-weight:bold}.kr{color:#000;font-weight:bold}.kt{color:#458;font-weight:bold}.m{color:#099}.s{color:#d01040}.na{color:#008080}.nb{color:#0086b3}.nc{color:#458;font-weight:bold}.no{color:#008080}.nd{color:#3c5d5d;font-weight:bold}.ni{color:#800080}.ne{color:#900;font-weight:bold}.nf{color:#900;font-weight:bold}.nl{color:#900;font-weight:bold}.nn{color:#555}.nt{color:#000080}.nv{color:#008080}.ow{color:#000;font-weight:bold}.w{color:#bbb}.mf{color:#099}.mh{color:#099}.mi{color:#099}.mo{color:#099}.sb{color:#d01040}.sc{color:#d01040}.sd{color:#d01040}.s2{color:#d01040}.se{color:#d01040}.sh{color:#d01040}.si{color:#d01040}.sx{color:#d01040}.sr{color:#009926}.s1{color:#d01040}.ss{color:#990073}.bp{color:#999}.vc{color:#008080}.vg{color:#008080}.vi{color:#008080}.il{color:#099}

View File

@@ -0,0 +1,24 @@
---
layout: default
title: Magnific WordPress Plugin
description: The complete guide on how to use Magnific Popup - the open source responsive lightbox plugin.
addjs: false
canonical_url: http://dimsemenov.com/plugins/magnific-popup/wordpress.html
buildtool: false
---
<style>
#mc_embed_signup {
display: block !important;
max-width: 540px;
background: none;
}
</style>
{% include signup.html %}

View File

@@ -0,0 +1,3 @@
*.js linguist-language=javascript
*.css linguist-language=javascript
*.html linguist-language=javascript

View File

@@ -0,0 +1,14 @@
# cmGauge
仪表盘插件
#使用方法
HTML结构
<div>
<div class="gauge-arrow" data-percentage="40" style="transform: rotate(0deg);"></div>
</div>
插件调用
$('.gauge-arrow').cmGauge();
详细请看index.html

View File

@@ -0,0 +1,96 @@
.gauge {
position: relative;
display: inline-block;
font-size: 33px;
line-height: 1em;
height: 250px;
width: 250px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.gauge.gauge-big {
font-size: 117px;
}
.gauge.gauge-small {
font-size: 17px;
}
.gauge:before {
content: '';
position: absolute;
left: 0;
top: 20%;
font-size: 100%;
height: 250px;
width: 250px;
line-height: 1em;
border: 0.35em solid #666666;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
-ms-border-radius: 100%;
-o-border-radius: 100%;
border-radius: 100%;
clip: rect(auto, auto, 150px, auto);
}
.gauge .gauge-arrow {
height: 150px;
width: 5px;
top: 20%;
margin-left: -.05em;
-webkit-transform-origin: 50% 100%;
-moz-transform-origin: 50% 100%;
-ms-transform-origin: 50% 100%;
-o-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.gauge .gauge-arrow, .gauge .gauge-arrow:before {
position: absolute;
display: inline-block;
background: #4e5767;
left: 50%;
border-radius: 100% 100% 100% 100% / 100% 100% 0 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.gauge .gauge-arrow:before {
content: '';
height: 0.25em;
width: 0.255em;
bottom: -0em;
margin-left: -0.12em;
border-radius: 100%;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
-ms-border-radius: 100%;
-o-border-radius: 100%;
}
.gauge-red.gauge:before {
border-color: #2dace2;
}
.gauge-orange.gauge:before {
border-color: #8ceab9;
}
.gauge-yellow.gauge:before {
border-color: #ff7676;
}
.gauge-green.gauge:before {
border-color: #8ceab9;
}

View File

@@ -0,0 +1,40 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery cmGauge Demo</title>
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" integrity="sha384-AysaV+vQoT3kOAXZkl02PThvDr8HYKPZhNT5h/CXfBThSRXQ6jW5DO2ekP5ViFdi" crossorigin="anonymous">
<link rel="stylesheet" href="css/cmGauge.css">
</head>
<body>
<div class="container">
<h1>jQuery cmGauge Demo</h1>
<div id="gaugeDemo" class="gauge gauge-big gauge-green">
<div class="gauge-arrow" data-percentage="40"
style="transform: rotate(0deg);"></div>
</div>
<div style="margin-top: 30px;">
<button class="btn btn-primary">Update The Gauge</button>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="js/cmGauge.js"></script>
<script type="text/javascript">
$(function () {
$("button").click(function () {
var randomNum = Math.floor((Math.random() * 100));
$('#gaugeDemo .gauge-arrow').trigger('updateGauge', randomNum);
});
$('#gaugeDemo .gauge-arrow').cmGauge();
});
</script>
</body>
</html>

View File

@@ -0,0 +1,48 @@
/**
* Created by hale on 2016/12/29.
*/
;(function ($, window, document, undefined) {
var Gauge = function (el) {
this.$element = el,
this.defaults = {},
this.options = $.extend({}, this.defaults, {})
};
Gauge.prototype = {
colors: ['gauge-green', 'gauge-orange', 'gauge-yellow', 'gauge-red'],
partSize: 0,
initParams: function () {
var colorLen = Gauge.prototype.colors.length;
Gauge.prototype.partSize = 100.0 / colorLen;
},
createGauge: function (elArray) {
elArray.each(function () {
Gauge.prototype.updateGauge($(this));
});
//添加updateGauge事件 更新百分比
elArray.bind('updateGauge', function (e, num) {
$(this).data('percentage', num);
Gauge.prototype.updateGauge($(this));
});
},
updateGauge: function (el) {
Gauge.prototype.initParams();
var percentage = el.data('percentage');
percentage = (percentage > 100) ? 100 : (percentage < 0) ? 0 : percentage;
el.css('transform', 'rotate(' + ((1.8 * percentage) - 90) + 'deg)');
el.parent()
.removeClass(Gauge.prototype.colors.join(' '))
.addClass(Gauge.prototype.colors[Math.floor(percentage / Gauge.prototype.partSize)]);
}
};
$.fn.cmGauge = function () {
var gauge = new Gauge(this);
return gauge.createGauge(this);
}
})(jQuery, window, document);

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,513 @@
define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"], function(require, exports, module) {
"use strict";
var dom = require("../lib/dom");
var lang = require("../lib/lang");
var event = require("../lib/event");
var searchboxCss = "\
.ace_search {\
background-color: #ddd;\
color: #666;\
border: 1px solid #cbcbcb;\
border-top: 0 none;\
overflow: hidden;\
margin: 0;\
padding: 4px 6px 0 4px;\
position: absolute;\
top: 0;\
z-index: 99;\
white-space: normal;\
}\
.ace_search.left {\
border-left: 0 none;\
border-radius: 0px 0px 5px 0px;\
left: 0;\
}\
.ace_search.right {\
border-radius: 0px 0px 0px 5px;\
border-right: 0 none;\
right: 0;\
}\
.ace_search_form, .ace_replace_form {\
margin: 0 20px 4px 0;\
overflow: hidden;\
line-height: 1.9;\
}\
.ace_replace_form {\
margin-right: 0;\
}\
.ace_search_form.ace_nomatch {\
outline: 1px solid red;\
}\
.ace_search_field {\
border-radius: 3px 0 0 3px;\
background-color: white;\
color: black;\
border: 1px solid #cbcbcb;\
border-right: 0 none;\
outline: 0;\
padding: 0;\
font-size: inherit;\
margin: 0;\
line-height: inherit;\
padding: 0 6px;\
min-width: 17em;\
vertical-align: top;\
min-height: 1.8em;\
box-sizing: content-box;\
}\
.ace_searchbtn {\
border: 1px solid #cbcbcb;\
line-height: inherit;\
display: inline-block;\
padding: 0 6px;\
background: #fff;\
border-right: 0 none;\
border-left: 1px solid #dcdcdc;\
cursor: pointer;\
margin: 0;\
position: relative;\
color: #666;\
}\
.ace_searchbtn:last-child {\
border-radius: 0 3px 3px 0;\
border-right: 1px solid #cbcbcb;\
}\
.ace_searchbtn:disabled {\
background: none;\
cursor: default;\
}\
.ace_searchbtn:hover {\
background-color: #eef1f6;\
}\
.ace_searchbtn.prev, .ace_searchbtn.next {\
padding: 0px 0.7em\
}\
.ace_searchbtn.prev:after, .ace_searchbtn.next:after {\
content: \"\";\
border: solid 2px #888;\
width: 0.5em;\
height: 0.5em;\
border-width: 2px 0 0 2px;\
display:inline-block;\
transform: rotate(-45deg);\
}\
.ace_searchbtn.next:after {\
border-width: 0 2px 2px 0 ;\
}\
.ace_searchbtn_close {\
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\
border-radius: 50%;\
border: 0 none;\
color: #656565;\
cursor: pointer;\
font: 16px/16px Arial;\
padding: 0;\
height: 14px;\
width: 14px;\
top: 9px;\
right: 7px;\
position: absolute;\
}\
.ace_searchbtn_close:hover {\
background-color: #656565;\
background-position: 50% 100%;\
color: white;\
}\
.ace_button {\
margin-left: 2px;\
cursor: pointer;\
-webkit-user-select: none;\
-moz-user-select: none;\
-o-user-select: none;\
-ms-user-select: none;\
user-select: none;\
overflow: hidden;\
opacity: 0.7;\
border: 1px solid rgba(100,100,100,0.23);\
padding: 1px;\
box-sizing: border-box!important;\
color: black;\
}\
.ace_button:hover {\
background-color: #eee;\
opacity:1;\
}\
.ace_button:active {\
background-color: #ddd;\
}\
.ace_button.checked {\
border-color: #3399ff;\
opacity:1;\
}\
.ace_search_options{\
margin-bottom: 3px;\
text-align: right;\
-webkit-user-select: none;\
-moz-user-select: none;\
-o-user-select: none;\
-ms-user-select: none;\
user-select: none;\
clear: both;\
}\
.ace_search_counter {\
float: left;\
font-family: arial;\
padding: 0 8px;\
}";
var HashHandler = require("../keyboard/hash_handler").HashHandler;
var keyUtil = require("../lib/keys");
var MAX_COUNT = 999;
dom.importCssString(searchboxCss, "ace_searchbox", false);
var SearchBox = function(editor, range, showReplaceForm) {
var div = dom.createElement("div");
dom.buildDom(["div", {class:"ace_search right"},
["span", {action: "hide", class: "ace_searchbtn_close"}],
["div", {class: "ace_search_form"},
["input", {class: "ace_search_field", placeholder: "Search for", spellcheck: "false"}],
["span", {action: "findPrev", class: "ace_searchbtn prev"}, "\u200b"],
["span", {action: "findNext", class: "ace_searchbtn next"}, "\u200b"],
["span", {action: "findAll", class: "ace_searchbtn", title: "Alt-Enter"}, "All"]
],
["div", {class: "ace_replace_form"},
["input", {class: "ace_search_field", placeholder: "Replace with", spellcheck: "false"}],
["span", {action: "replaceAndFindNext", class: "ace_searchbtn"}, "Replace"],
["span", {action: "replaceAll", class: "ace_searchbtn"}, "All"]
],
["div", {class: "ace_search_options"},
["span", {action: "toggleReplace", class: "ace_button", title: "Toggle Replace mode",
style: "float:left;margin-top:-2px;padding:0 5px;"}, "+"],
["span", {class: "ace_search_counter"}],
["span", {action: "toggleRegexpMode", class: "ace_button", title: "RegExp Search"}, ".*"],
["span", {action: "toggleCaseSensitive", class: "ace_button", title: "CaseSensitive Search"}, "Aa"],
["span", {action: "toggleWholeWords", class: "ace_button", title: "Whole Word Search"}, "\\b"],
["span", {action: "searchInSelection", class: "ace_button", title: "Search In Selection"}, "S"]
]
], div);
this.element = div.firstChild;
this.setSession = this.setSession.bind(this);
this.$init();
this.setEditor(editor);
dom.importCssString(searchboxCss, "ace_searchbox", editor.container);
};
(function() {
this.setEditor = function(editor) {
editor.searchBox = this;
editor.renderer.scroller.appendChild(this.element);
this.editor = editor;
};
this.setSession = function(e) {
this.searchRange = null;
this.$syncOptions(true);
};
this.$initElements = function(sb) {
this.searchBox = sb.querySelector(".ace_search_form");
this.replaceBox = sb.querySelector(".ace_replace_form");
this.searchOption = sb.querySelector("[action=searchInSelection]");
this.replaceOption = sb.querySelector("[action=toggleReplace]");
this.regExpOption = sb.querySelector("[action=toggleRegexpMode]");
this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]");
this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]");
this.searchInput = this.searchBox.querySelector(".ace_search_field");
this.replaceInput = this.replaceBox.querySelector(".ace_search_field");
this.searchCounter = sb.querySelector(".ace_search_counter");
};
this.$init = function() {
var sb = this.element;
this.$initElements(sb);
var _this = this;
event.addListener(sb, "mousedown", function(e) {
setTimeout(function(){
_this.activeInput.focus();
}, 0);
event.stopPropagation(e);
});
event.addListener(sb, "click", function(e) {
var t = e.target || e.srcElement;
var action = t.getAttribute("action");
if (action && _this[action])
_this[action]();
else if (_this.$searchBarKb.commands[action])
_this.$searchBarKb.commands[action].exec(_this);
event.stopPropagation(e);
});
event.addCommandKeyListener(sb, function(e, hashId, keyCode) {
var keyString = keyUtil.keyCodeToString(keyCode);
var command = _this.$searchBarKb.findKeyCommand(hashId, keyString);
if (command && command.exec) {
command.exec(_this);
event.stopEvent(e);
}
});
this.$onChange = lang.delayedCall(function() {
_this.find(false, false);
});
event.addListener(this.searchInput, "input", function() {
_this.$onChange.schedule(20);
});
event.addListener(this.searchInput, "focus", function() {
_this.activeInput = _this.searchInput;
_this.searchInput.value && _this.highlight();
});
event.addListener(this.replaceInput, "focus", function() {
_this.activeInput = _this.replaceInput;
_this.searchInput.value && _this.highlight();
});
};
this.$closeSearchBarKb = new HashHandler([{
bindKey: "Esc",
name: "closeSearchBar",
exec: function(editor) {
editor.searchBox.hide();
}
}]);
this.$searchBarKb = new HashHandler();
this.$searchBarKb.bindKeys({
"Ctrl-f|Command-f": function(sb) {
var isReplace = sb.isReplace = !sb.isReplace;
sb.replaceBox.style.display = isReplace ? "" : "none";
sb.replaceOption.checked = false;
sb.$syncOptions();
sb.searchInput.focus();
},
"Ctrl-H|Command-Option-F": function(sb) {
if (sb.editor.getReadOnly())
return;
sb.replaceOption.checked = true;
sb.$syncOptions();
sb.replaceInput.focus();
},
"Ctrl-G|Command-G": function(sb) {
sb.findNext();
},
"Ctrl-Shift-G|Command-Shift-G": function(sb) {
sb.findPrev();
},
"esc": function(sb) {
setTimeout(function() { sb.hide();});
},
"Return": function(sb) {
if (sb.activeInput == sb.replaceInput)
sb.replace();
sb.findNext();
},
"Shift-Return": function(sb) {
if (sb.activeInput == sb.replaceInput)
sb.replace();
sb.findPrev();
},
"Alt-Return": function(sb) {
if (sb.activeInput == sb.replaceInput)
sb.replaceAll();
sb.findAll();
},
"Tab": function(sb) {
(sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus();
}
});
this.$searchBarKb.addCommands([{
name: "toggleRegexpMode",
bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"},
exec: function(sb) {
sb.regExpOption.checked = !sb.regExpOption.checked;
sb.$syncOptions();
}
}, {
name: "toggleCaseSensitive",
bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"},
exec: function(sb) {
sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked;
sb.$syncOptions();
}
}, {
name: "toggleWholeWords",
bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"},
exec: function(sb) {
sb.wholeWordOption.checked = !sb.wholeWordOption.checked;
sb.$syncOptions();
}
}, {
name: "toggleReplace",
exec: function(sb) {
sb.replaceOption.checked = !sb.replaceOption.checked;
sb.$syncOptions();
}
}, {
name: "searchInSelection",
exec: function(sb) {
sb.searchOption.checked = !sb.searchRange;
sb.setSearchRange(sb.searchOption.checked && sb.editor.getSelectionRange());
sb.$syncOptions();
}
}]);
this.setSearchRange = function(range) {
this.searchRange = range;
if (range) {
this.searchRangeMarker = this.editor.session.addMarker(range, "ace_active-line");
} else if (this.searchRangeMarker) {
this.editor.session.removeMarker(this.searchRangeMarker);
this.searchRangeMarker = null;
}
};
this.$syncOptions = function(preventScroll) {
dom.setCssClass(this.replaceOption, "checked", this.searchRange);
dom.setCssClass(this.searchOption, "checked", this.searchOption.checked);
this.replaceOption.textContent = this.replaceOption.checked ? "-" : "+";
dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked);
dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked);
dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked);
var readOnly = this.editor.getReadOnly();
this.replaceOption.style.display = readOnly ? "none" : "";
this.replaceBox.style.display = this.replaceOption.checked && !readOnly ? "" : "none";
this.find(false, false, preventScroll);
};
this.highlight = function(re) {
this.editor.session.highlight(re || this.editor.$search.$options.re);
this.editor.renderer.updateBackMarkers();
};
this.find = function(skipCurrent, backwards, preventScroll) {
var range = this.editor.find(this.searchInput.value, {
skipCurrent: skipCurrent,
backwards: backwards,
wrap: true,
regExp: this.regExpOption.checked,
caseSensitive: this.caseSensitiveOption.checked,
wholeWord: this.wholeWordOption.checked,
preventScroll: preventScroll,
range: this.searchRange
});
var noMatch = !range && this.searchInput.value;
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
this.editor._emit("findSearchBox", { match: !noMatch });
this.highlight();
this.updateCounter();
};
this.updateCounter = function() {
var editor = this.editor;
var regex = editor.$search.$options.re;
var all = 0;
var before = 0;
if (regex) {
var value = this.searchRange
? editor.session.getTextRange(this.searchRange)
: editor.getValue();
var offset = editor.session.doc.positionToIndex(editor.selection.anchor);
if (this.searchRange)
offset -= editor.session.doc.positionToIndex(this.searchRange.start);
var last = regex.lastIndex = 0;
var m;
while ((m = regex.exec(value))) {
all++;
last = m.index;
if (last <= offset)
before++;
if (all > MAX_COUNT)
break;
if (!m[0]) {
regex.lastIndex = last += 1;
if (last >= value.length)
break;
}
}
}
this.searchCounter.textContent = before + " of " + (all > MAX_COUNT ? MAX_COUNT + "+" : all);
};
this.findNext = function() {
this.find(true, false);
};
this.findPrev = function() {
this.find(true, true);
};
this.findAll = function(){
var range = this.editor.findAll(this.searchInput.value, {
regExp: this.regExpOption.checked,
caseSensitive: this.caseSensitiveOption.checked,
wholeWord: this.wholeWordOption.checked
});
var noMatch = !range && this.searchInput.value;
dom.setCssClass(this.searchBox, "ace_nomatch", noMatch);
this.editor._emit("findSearchBox", { match: !noMatch });
this.highlight();
this.hide();
};
this.replace = function() {
if (!this.editor.getReadOnly())
this.editor.replace(this.replaceInput.value);
};
this.replaceAndFindNext = function() {
if (!this.editor.getReadOnly()) {
this.editor.replace(this.replaceInput.value);
this.findNext();
}
};
this.replaceAll = function() {
if (!this.editor.getReadOnly())
this.editor.replaceAll(this.replaceInput.value);
};
this.hide = function() {
this.active = false;
this.setSearchRange(null);
this.editor.off("changeSession", this.setSession);
this.element.style.display = "none";
this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
this.editor.focus();
};
this.show = function(value, isReplace) {
this.active = true;
this.editor.on("changeSession", this.setSession);
this.element.style.display = "";
this.replaceOption.checked = isReplace;
if (value)
this.searchInput.value = value;
this.searchInput.focus();
this.searchInput.select();
this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb);
this.$syncOptions(true);
};
this.isFocused = function() {
var el = document.activeElement;
return el == this.searchInput || el == this.replaceInput;
};
}).call(SearchBox.prototype);
exports.SearchBox = SearchBox;
exports.Search = function(editor, isReplace) {
var sb = editor.searchBox || new SearchBox(editor);
sb.show(editor.session.getTextRange(), isReplace);
};
}); (function() {
window.require(["ace/ext/searchbox"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,796 @@
define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var DocCommentHighlightRules = function() {
this.$rules = {
"start" : [ {
token : "comment.doc.tag",
regex : "@[\\w\\d_]+" // TODO: fix email addresses
},
DocCommentHighlightRules.getTagRule(),
{
defaultToken : "comment.doc",
caseInsensitive: true
}]
};
};
oop.inherits(DocCommentHighlightRules, TextHighlightRules);
DocCommentHighlightRules.getTagRule = function(start) {
return {
token : "comment.doc.tag.storage.type",
regex : "\\b(?:TODO|FIXME|XXX|HACK)\\b"
};
};
DocCommentHighlightRules.getStartRule = function(start) {
return {
token : "comment.doc", // doc comment
regex : "\\/\\*(?=\\*)",
next : start
};
};
DocCommentHighlightRules.getEndRule = function (start) {
return {
token : "comment.doc", // closing comment
regex : "\\*\\/",
next : start
};
};
exports.DocCommentHighlightRules = DocCommentHighlightRules;
});
define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules;
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*";
var JavaScriptHighlightRules = function(options) {
var keywordMapper = this.createKeywordMapper({
"variable.language":
"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|" + // Constructors
"Namespace|QName|XML|XMLList|" + // E4X
"ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" +
"Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|" +
"Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + // Errors
"SyntaxError|TypeError|URIError|" +
"decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|" + // Non-constructor functions
"isNaN|parseFloat|parseInt|" +
"JSON|Math|" + // Other
"this|arguments|prototype|window|document" , // Pseudo
"keyword":
"const|yield|import|get|set|async|await|" +
"break|case|catch|continue|default|delete|do|else|finally|for|function|" +
"if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|" +
"__parent__|__count__|escape|unescape|with|__proto__|" +
"class|enum|extends|super|export|implements|private|public|interface|package|protected|static",
"storage.type":
"const|let|var|function",
"constant.language":
"null|Infinity|NaN|undefined",
"support.function":
"alert",
"constant.language.boolean": "true|false"
}, "identifier");
var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void";
var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|" + // hex
"u[0-9a-fA-F]{4}|" + // unicode
"u{[0-9a-fA-F]{1,6}}|" + // es6 unicode
"[0-2][0-7]{0,2}|" + // oct
"3[0-7][0-7]?|" + // oct
"[4-7][0-7]?|" + //oct
".)";
this.$rules = {
"no_regex" : [
DocCommentHighlightRules.getStartRule("doc-start"),
comments("no_regex"),
{
token : "string",
regex : "'(?=.)",
next : "qstring"
}, {
token : "string",
regex : '"(?=.)',
next : "qqstring"
}, {
token : "constant.numeric", // hexadecimal, octal and binary
regex : /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/
}, {
token : "constant.numeric", // decimal integers and floats
regex : /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/
}, {
token : [
"storage.type", "punctuation.operator", "support.function",
"punctuation.operator", "entity.name.function", "text","keyword.operator"
],
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)",
next: "function_arguments"
}, {
token : [
"storage.type", "punctuation.operator", "entity.name.function", "text",
"keyword.operator", "text", "storage.type", "text", "paren.lparen"
],
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, {
token : [
"entity.name.function", "text", "keyword.operator", "text", "storage.type",
"text", "paren.lparen"
],
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, {
token : [
"storage.type", "punctuation.operator", "entity.name.function", "text",
"keyword.operator", "text",
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
],
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",
next: "function_arguments"
}, {
token : [
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
],
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()",
next: "function_arguments"
}, {
token : [
"entity.name.function", "text", "punctuation.operator",
"text", "storage.type", "text", "paren.lparen"
],
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, {
token : [
"text", "text", "storage.type", "text", "paren.lparen"
],
regex : "(:)(\\s*)(function)(\\s*)(\\()",
next: "function_arguments"
}, {
token : "keyword",
regex : "from(?=\\s*('|\"))"
}, {
token : "keyword",
regex : "(?:" + kwBeforeRe + ")\\b",
next : "start"
}, {
token : ["support.constant"],
regex : /that\b/
}, {
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
regex : /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/
}, {
token : keywordMapper,
regex : identifierRe
}, {
token : "punctuation.operator",
regex : /[.](?![.])/,
next : "property"
}, {
token : "storage.type",
regex : /=>/
}, {
token : "keyword.operator",
regex : /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,
next : "start"
}, {
token : "punctuation.operator",
regex : /[?:,;.]/,
next : "start"
}, {
token : "paren.lparen",
regex : /[\[({]/,
next : "start"
}, {
token : "paren.rparen",
regex : /[\])}]/
}, {
token: "comment",
regex: /^#!.*$/
}
],
property: [{
token : "text",
regex : "\\s+"
}, {
token : [
"storage.type", "punctuation.operator", "entity.name.function", "text",
"keyword.operator", "text",
"storage.type", "text", "entity.name.function", "text", "paren.lparen"
],
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",
next: "function_arguments"
}, {
token : "punctuation.operator",
regex : /[.](?![.])/
}, {
token : "support.function",
regex : /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
}, {
token : "support.function.dom",
regex : /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
}, {
token : "support.constant",
regex : /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
}, {
token : "identifier",
regex : identifierRe
}, {
regex: "",
token: "empty",
next: "no_regex"
}
],
"start": [
DocCommentHighlightRules.getStartRule("doc-start"),
comments("start"),
{
token: "string.regexp",
regex: "\\/",
next: "regex"
}, {
token : "text",
regex : "\\s+|^$",
next : "start"
}, {
token: "empty",
regex: "",
next: "no_regex"
}
],
"regex": [
{
token: "regexp.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "string.regexp",
regex: "/[sxngimy]*",
next: "no_regex"
}, {
token : "invalid",
regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/
}, {
token : "constant.language.escape",
regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/
}, {
token : "constant.language.delimiter",
regex: /\|/
}, {
token: "constant.language.escape",
regex: /\[\^?/,
next: "regex_character_class"
}, {
token: "empty",
regex: "$",
next: "no_regex"
}, {
defaultToken: "string.regexp"
}
],
"regex_character_class": [
{
token: "regexp.charclass.keyword.operator",
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
}, {
token: "constant.language.escape",
regex: "]",
next: "regex"
}, {
token: "constant.language.escape",
regex: "-"
}, {
token: "empty",
regex: "$",
next: "no_regex"
}, {
defaultToken: "string.regexp.charachterclass"
}
],
"function_arguments": [
{
token: "variable.parameter",
regex: identifierRe
}, {
token: "punctuation.operator",
regex: "[, ]+"
}, {
token: "punctuation.operator",
regex: "$"
}, {
token: "empty",
regex: "",
next: "no_regex"
}
],
"qqstring" : [
{
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
regex : "\\\\$",
consumeLineEnd : true
}, {
token : "string",
regex : '"|$',
next : "no_regex"
}, {
defaultToken: "string"
}
],
"qstring" : [
{
token : "constant.language.escape",
regex : escapedRe
}, {
token : "string",
regex : "\\\\$",
consumeLineEnd : true
}, {
token : "string",
regex : "'|$",
next : "no_regex"
}, {
defaultToken: "string"
}
]
};
if (!options || !options.noES6) {
this.$rules.no_regex.unshift({
regex: "[{}]", onMatch: function(val, state, stack) {
this.next = val == "{" ? this.nextState : "";
if (val == "{" && stack.length) {
stack.unshift("start", state);
}
else if (val == "}" && stack.length) {
stack.shift();
this.next = stack.shift();
if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1)
return "paren.quasi.end";
}
return val == "{" ? "paren.lparen" : "paren.rparen";
},
nextState: "start"
}, {
token : "string.quasi.start",
regex : /`/,
push : [{
token : "constant.language.escape",
regex : escapedRe
}, {
token : "paren.quasi.start",
regex : /\${/,
push : "start"
}, {
token : "string.quasi.end",
regex : /`/,
next : "pop"
}, {
defaultToken: "string.quasi"
}]
});
if (!options || options.jsx != false)
JSX.call(this);
}
this.embedRules(DocCommentHighlightRules, "doc-",
[ DocCommentHighlightRules.getEndRule("no_regex") ]);
this.normalizeRules();
};
oop.inherits(JavaScriptHighlightRules, TextHighlightRules);
function JSX() {
var tagRegex = identifierRe.replace("\\d", "\\d\\-");
var jsxTag = {
onMatch : function(val, state, stack) {
var offset = val.charAt(1) == "/" ? 2 : 1;
if (offset == 1) {
if (state != this.nextState)
stack.unshift(this.next, this.nextState, 0);
else
stack.unshift(this.next);
stack[2]++;
} else if (offset == 2) {
if (state == this.nextState) {
stack[1]--;
if (!stack[1] || stack[1] < 0) {
stack.shift();
stack.shift();
}
}
}
return [{
type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml",
value: val.slice(0, offset)
}, {
type: "meta.tag.tag-name.xml",
value: val.substr(offset)
}];
},
regex : "</?" + tagRegex + "",
next: "jsxAttributes",
nextState: "jsx"
};
this.$rules.start.unshift(jsxTag);
var jsxJsRule = {
regex: "{",
token: "paren.quasi.start",
push: "start"
};
this.$rules.jsx = [
jsxJsRule,
jsxTag,
{include : "reference"},
{defaultToken: "string"}
];
this.$rules.jsxAttributes = [{
token : "meta.tag.punctuation.tag-close.xml",
regex : "/?>",
onMatch : function(value, currentState, stack) {
if (currentState == stack[0])
stack.shift();
if (value.length == 2) {
if (stack[0] == this.nextState)
stack[1]--;
if (!stack[1] || stack[1] < 0) {
stack.splice(0, 2);
}
}
this.next = stack[0] || "start";
return [{type: this.token, value: value}];
},
nextState: "jsx"
},
jsxJsRule,
comments("jsxAttributes"),
{
token : "entity.other.attribute-name.xml",
regex : tagRegex
}, {
token : "keyword.operator.attribute-equals.xml",
regex : "="
}, {
token : "text.tag-whitespace.xml",
regex : "\\s+"
}, {
token : "string.attribute-value.xml",
regex : "'",
stateName : "jsx_attr_q",
push : [
{token : "string.attribute-value.xml", regex: "'", next: "pop"},
{include : "reference"},
{defaultToken : "string.attribute-value.xml"}
]
}, {
token : "string.attribute-value.xml",
regex : '"',
stateName : "jsx_attr_qq",
push : [
{token : "string.attribute-value.xml", regex: '"', next: "pop"},
{include : "reference"},
{defaultToken : "string.attribute-value.xml"}
]
},
jsxTag
];
this.$rules.reference = [{
token : "constant.language.escape.reference.xml",
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
}];
}
function comments(next) {
return [
{
token : "comment", // multi line comment
regex : /\/\*/,
next: [
DocCommentHighlightRules.getTagRule(),
{token : "comment", regex : "\\*\\/", next : next || "pop"},
{defaultToken : "comment", caseInsensitive: true}
]
}, {
token : "comment",
regex : "\\/\\/",
next: [
DocCommentHighlightRules.getTagRule(),
{token : "comment", regex : "$|^", next : next || "pop"},
{defaultToken : "comment", caseInsensitive: true}
]
}
];
}
exports.JavaScriptHighlightRules = JavaScriptHighlightRules;
});
define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"], function(require, exports, module) {
"use strict";
var Range = require("../range").Range;
var MatchingBraceOutdent = function() {};
(function() {
this.checkOutdent = function(line, input) {
if (! /^\s+$/.test(line))
return false;
return /^\s*\}/.test(input);
};
this.autoOutdent = function(doc, row) {
var line = doc.getLine(row);
var match = line.match(/^(\s*\})/);
if (!match) return 0;
var column = match[1].length;
var openBracePos = doc.findMatchingBracket({row: row, column: column});
if (!openBracePos || openBracePos.row == row) return 0;
var indent = this.$getIndent(doc.getLine(openBracePos.row));
doc.replace(new Range(row, 0, row, column-1), indent);
};
this.$getIndent = function(line) {
return line.match(/^\s*/)[0];
};
}).call(MatchingBraceOutdent.prototype);
exports.MatchingBraceOutdent = MatchingBraceOutdent;
});
define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"], function(require, exports, module) {
"use strict";
var oop = require("../../lib/oop");
var Range = require("../../range").Range;
var BaseFoldMode = require("./fold_mode").FoldMode;
var FoldMode = exports.FoldMode = function(commentRegex) {
if (commentRegex) {
this.foldingStartMarker = new RegExp(
this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)
);
this.foldingStopMarker = new RegExp(
this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)
);
}
};
oop.inherits(FoldMode, BaseFoldMode);
(function() {
this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/;
this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/;
this.singleLineBlockCommentRe= /^\s*(\/\*).*\*\/\s*$/;
this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/;
this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/;
this._getFoldWidgetBase = this.getFoldWidget;
this.getFoldWidget = function(session, foldStyle, row) {
var line = session.getLine(row);
if (this.singleLineBlockCommentRe.test(line)) {
if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line))
return "";
}
var fw = this._getFoldWidgetBase(session, foldStyle, row);
if (!fw && this.startRegionRe.test(line))
return "start"; // lineCommentRegionStart
return fw;
};
this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) {
var line = session.getLine(row);
if (this.startRegionRe.test(line))
return this.getCommentRegionBlock(session, line, row);
var match = line.match(this.foldingStartMarker);
if (match) {
var i = match.index;
if (match[1])
return this.openingBracketBlock(session, match[1], row, i);
var range = session.getCommentFoldRange(row, i + match[0].length, 1);
if (range && !range.isMultiLine()) {
if (forceMultiline) {
range = this.getSectionRange(session, row);
} else if (foldStyle != "all")
range = null;
}
return range;
}
if (foldStyle === "markbegin")
return;
var match = line.match(this.foldingStopMarker);
if (match) {
var i = match.index + match[0].length;
if (match[1])
return this.closingBracketBlock(session, match[1], row, i);
return session.getCommentFoldRange(row, i, -1);
}
};
this.getSectionRange = function(session, row) {
var line = session.getLine(row);
var startIndent = line.search(/\S/);
var startRow = row;
var startColumn = line.length;
row = row + 1;
var endRow = row;
var maxRow = session.getLength();
while (++row < maxRow) {
line = session.getLine(row);
var indent = line.search(/\S/);
if (indent === -1)
continue;
if (startIndent > indent)
break;
var subRange = this.getFoldWidgetRange(session, "all", row);
if (subRange) {
if (subRange.start.row <= startRow) {
break;
} else if (subRange.isMultiLine()) {
row = subRange.end.row;
} else if (startIndent == indent) {
break;
}
}
endRow = row;
}
return new Range(startRow, startColumn, endRow, session.getLine(endRow).length);
};
this.getCommentRegionBlock = function(session, line, row) {
var startColumn = line.search(/\s*$/);
var maxRow = session.getLength();
var startRow = row;
var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/;
var depth = 1;
while (++row < maxRow) {
line = session.getLine(row);
var m = re.exec(line);
if (!m) continue;
if (m[1]) depth--;
else depth++;
if (!depth) break;
}
var endRow = row;
if (endRow > startRow) {
return new Range(startRow, startColumn, endRow, line.length);
}
};
}).call(FoldMode.prototype);
});
define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"], function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var WorkerClient = require("../worker/worker_client").WorkerClient;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
this.HighlightRules = JavaScriptHighlightRules;
this.$outdent = new MatchingBraceOutdent();
this.$behaviour = new CstyleBehaviour();
this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "//";
this.blockComment = {start: "/*", end: "*/"};
this.$quotes = {'"': '"', "'": "'", "`": "`"};
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
var endState = tokenizedLine.state;
if (tokens.length && tokens[tokens.length-1].type == "comment") {
return indent;
}
if (state == "start" || state == "no_regex") {
var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);
if (match) {
indent += tab;
}
} else if (state == "doc-start") {
if (endState == "start" || endState == "no_regex") {
return "";
}
var match = line.match(/^\s*(\/?)\*/);
if (match) {
if (match[1]) {
indent += " ";
}
indent += "* ";
}
}
return indent;
};
this.checkOutdent = function(state, line, input) {
return this.$outdent.checkOutdent(line, input);
};
this.autoOutdent = function(state, doc, row) {
this.$outdent.autoOutdent(doc, row);
};
this.createWorker = function(session) {
var worker = new WorkerClient(["ace"], "ace/mode/javascript_worker", "JavaScriptWorker");
worker.attachToDocument(session.getDocument());
worker.on("annotate", function(results) {
session.setAnnotations(results.data);
});
worker.on("terminate", function() {
session.clearAnnotations();
});
return worker;
};
this.$id = "ace/mode/javascript";
}).call(Mode.prototype);
exports.Mode = Mode;
});
(function() {
window.require(["ace/mode/javascript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/abap",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="abap"});
(function() {
window.require(["ace/snippets/abap"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/abc",["require","exports","module"],function(e,t,n){"use strict";t.snippetText='\nsnippet zupfnoter.print\n %%%%hn.print {"startpos": ${1:pos_y}, "t":"${2:title}", "v":[${3:voices}], "s":[[${4:syncvoices}1,2]], "f":[${5:flowlines}], "sf":[${6:subflowlines}], "j":[${7:jumplines}]}\n\nsnippet zupfnoter.note\n %%%%hn.note {"pos": [${1:pos_x},${2:pos_y}], "text": "${3:text}", "style": "${4:style}"}\n\nsnippet zupfnoter.annotation\n %%%%hn.annotation {"id": "${1:id}", "pos": [${2:pos}], "text": "${3:text}"}\n\nsnippet zupfnoter.lyrics\n %%%%hn.lyrics {"pos": [${1:x_pos},${2:y_pos}]}\n\nsnippet zupfnoter.legend\n %%%%hn.legend {"pos": [${1:x_pos},${2:y_pos}]}\n\n\n\nsnippet zupfnoter.target\n "^:${1:target}"\n\nsnippet zupfnoter.goto\n "^@${1:target}@${2:distance}"\n\nsnippet zupfnoter.annotationref\n "^#${1:target}"\n\nsnippet zupfnoter.annotation\n "^!${1:text}@${2:x_offset},${3:y_offset}"\n\n\n',t.scope="abc"});
(function() {
window.require(["ace/snippets/abc"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/actionscript",["require","exports","module"],function(e,t,n){"use strict";t.snippetText='snippet main\n package {\n import flash.display.*;\n import flash.Events.*;\n \n public class Main extends Sprite {\n public function Main ( ) {\n trace("start");\n stage.scaleMode = StageScaleMode.NO_SCALE;\n stage.addEventListener(Event.RESIZE, resizeListener);\n }\n \n private function resizeListener (e:Event):void {\n trace("The application window changed size!");\n trace("New width: " + stage.stageWidth);\n trace("New height: " + stage.stageHeight);\n }\n \n }\n \n }\nsnippet class\n ${1:public|internal} class ${2:name} ${3:extends } {\n public function $2 ( ) {\n ("start");\n }\n }\nsnippet all\n package name {\n\n ${1:public|internal|final} class ${2:name} ${3:extends } {\n private|public| static const FOO = "abc";\n private|public| static var BAR = "abc";\n\n // class initializer - no JIT !! one time setup\n if Cababilities.os == "Linux|MacOS" {\n FOO = "other";\n }\n\n // constructor:\n public function $2 ( ){\n super2();\n trace("start");\n }\n public function name (a, b...){\n super.name(..);\n lable:break\n }\n }\n }\n\n function A(){\n // A can only be accessed within this file\n }\nsnippet switch\n switch(${1}){\n case ${2}:\n ${3}\n break;\n default:\n }\nsnippet case\n case ${1}:\n ${2}\n break;\nsnippet package\n package ${1:package}{\n ${2}\n }\nsnippet wh\n while ${1:cond}{\n ${2}\n }\nsnippet do\n do {\n ${2}\n } while (${1:cond})\nsnippet while\n while ${1:cond}{\n ${2}\n }\nsnippet for enumerate names\n for (${1:var} in ${2:object}){\n ${3}\n }\nsnippet for enumerate values\n for each (${1:var} in ${2:object}){\n ${3}\n }\nsnippet get_set\n function get ${1:name} {\n return ${2}\n }\n function set $1 (newValue) {\n ${3}\n }\nsnippet interface\n interface name {\n function method(${1}):${2:returntype};\n }\nsnippet try\n try {\n ${1}\n } catch (error:ErrorType) {\n ${2}\n } finally {\n ${3}\n }\n# For Loop (same as c.snippet)\nsnippet for for (..) {..}\n for (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {\n ${4:/* code */}\n }\n# Custom For Loop\nsnippet forr\n for (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {\n ${5:/* code */}\n }\n# If Condition\nsnippet if\n if (${1:/* condition */}) {\n ${2:/* code */}\n }\nsnippet el\n else {\n ${1}\n }\n# Ternary conditional\nsnippet t\n ${1:/* condition */} ? ${2:a} : ${3:b}\nsnippet fun\n function ${1:function_name}(${2})${3}\n {\n ${4:/* code */}\n }\n# FlxSprite (usefull when using the flixel library)\nsnippet FlxSprite\n package\n {\n import org.flixel.*\n\n public class ${1:ClassName} extends ${2:FlxSprite}\n {\n public function $1(${3: X:Number, Y:Number}):void\n {\n super(X,Y);\n ${4: //code...}\n }\n\n override public function update():void\n {\n super.update();\n ${5: //code...}\n }\n }\n }\n\n',t.scope="actionscript"});
(function() {
window.require(["ace/snippets/actionscript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/ada",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="ada"});
(function() {
window.require(["ace/snippets/ada"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/apache_conf",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="apache_conf"});
(function() {
window.require(["ace/snippets/apache_conf"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/applescript",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="applescript"});
(function() {
window.require(["ace/snippets/applescript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/asciidoc",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="asciidoc"});
(function() {
window.require(["ace/snippets/asciidoc"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/asl",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="asl"});
(function() {
window.require(["ace/snippets/asl"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/assembly_x86",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="assembly_x86"});
(function() {
window.require(["ace/snippets/assembly_x86"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/autohotkey",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="autohotkey"});
(function() {
window.require(["ace/snippets/autohotkey"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/batchfile",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="batchfile"});
(function() {
window.require(["ace/snippets/batchfile"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/bro",["require","exports","module"],function(e,t,n){"use strict";t.snippetText=undefined,t.scope=""});
(function() {
window.require(["ace/snippets/bro"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/c9search",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="c9search"});
(function() {
window.require(["ace/snippets/c9search"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/c_cpp",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="## STL Collections\n# std::array\nsnippet array\n std::array<${1:T}, ${2:N}> ${3};${4}\n# std::vector\nsnippet vector\n std::vector<${1:T}> ${2};${3}\n# std::deque\nsnippet deque\n std::deque<${1:T}> ${2};${3}\n# std::forward_list\nsnippet flist\n std::forward_list<${1:T}> ${2};${3}\n# std::list\nsnippet list\n std::list<${1:T}> ${2};${3}\n# std::set\nsnippet set\n std::set<${1:T}> ${2};${3}\n# std::map\nsnippet map\n std::map<${1:Key}, ${2:T}> ${3};${4}\n# std::multiset\nsnippet mset\n std::multiset<${1:T}> ${2};${3}\n# std::multimap\nsnippet mmap\n std::multimap<${1:Key}, ${2:T}> ${3};${4}\n# std::unordered_set\nsnippet uset\n std::unordered_set<${1:T}> ${2};${3}\n# std::unordered_map\nsnippet umap\n std::unordered_map<${1:Key}, ${2:T}> ${3};${4}\n# std::unordered_multiset\nsnippet umset\n std::unordered_multiset<${1:T}> ${2};${3}\n# std::unordered_multimap\nsnippet ummap\n std::unordered_multimap<${1:Key}, ${2:T}> ${3};${4}\n# std::stack\nsnippet stack\n std::stack<${1:T}> ${2};${3}\n# std::queue\nsnippet queue\n std::queue<${1:T}> ${2};${3}\n# std::priority_queue\nsnippet pqueue\n std::priority_queue<${1:T}> ${2};${3}\n##\n## Access Modifiers\n# private\nsnippet pri\n private\n# protected\nsnippet pro\n protected\n# public\nsnippet pub\n public\n# friend\nsnippet fr\n friend\n# mutable\nsnippet mu\n mutable\n## \n## Class\n# class\nsnippet cl\n class ${1:`Filename('$1', 'name')`} \n {\n public:\n $1(${2});\n ~$1();\n\n private:\n ${3:/* data */}\n };\n# member function implementation\nsnippet mfun\n ${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {\n ${5:/* code */}\n }\n# namespace\nsnippet ns\n namespace ${1:`Filename('', 'my')`} {\n ${2}\n } /* namespace $1 */\n##\n## Input/Output\n# std::cout\nsnippet cout\n std::cout << ${1} << std::endl;${2}\n# std::cin\nsnippet cin\n std::cin >> ${1};${2}\n##\n## Iteration\n# for i \nsnippet fori\n for (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {\n ${4:/* code */}\n }${5}\n\n# foreach\nsnippet fore\n for (${1:auto} ${2:i} : ${3:container}) {\n ${4:/* code */}\n }${5}\n# iterator\nsnippet iter\n for (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) {\n ${6}\n }${7}\n\n# auto iterator\nsnippet itera\n for (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) {\n ${2:std::cout << *$1 << std::endl;}\n }${3}\n##\n## Lambdas\n# lamda (one line)\nsnippet ld\n [${1}](${2}){${3:/* code */}}${4}\n# lambda (multi-line)\nsnippet lld\n [${1}](${2}){\n ${3:/* code */}\n }${4}\n",t.scope="c_cpp"});
(function() {
window.require(["ace/snippets/c_cpp"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/cirru",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="cirru"});
(function() {
window.require(["ace/snippets/cirru"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/clojure",["require","exports","module"],function(e,t,n){"use strict";t.snippetText='snippet comm\n (comment\n ${1}\n )\nsnippet condp\n (condp ${1:pred} ${2:expr}\n ${3})\nsnippet def\n (def ${1})\nsnippet defm\n (defmethod ${1:multifn} "${2:doc-string}" ${3:dispatch-val} [${4:args}]\n ${5})\nsnippet defmm\n (defmulti ${1:name} "${2:doc-string}" ${3:dispatch-fn})\nsnippet defma\n (defmacro ${1:name} "${2:doc-string}" ${3:dispatch-fn})\nsnippet defn\n (defn ${1:name} "${2:doc-string}" [${3:arg-list}]\n ${4})\nsnippet defp\n (defprotocol ${1:name}\n ${2})\nsnippet defr\n (defrecord ${1:name} [${2:fields}]\n ${3:protocol}\n ${4})\nsnippet deft\n (deftest ${1:name}\n (is (= ${2:assertion})))\n ${3})\nsnippet is\n (is (= ${1} ${2}))\nsnippet defty\n (deftype ${1:Name} [${2:fields}]\n ${3:Protocol}\n ${4})\nsnippet doseq\n (doseq [${1:elem} ${2:coll}]\n ${3})\nsnippet fn\n (fn [${1:arg-list}] ${2})\nsnippet if\n (if ${1:test-expr}\n ${2:then-expr}\n ${3:else-expr})\nsnippet if-let \n (if-let [${1:result} ${2:test-expr}]\n (${3:then-expr} $1)\n (${4:else-expr}))\nsnippet imp\n (:import [${1:package}])\n & {:keys [${1:keys}] :or {${2:defaults}}}\nsnippet let\n (let [${1:name} ${2:expr}]\n ${3})\nsnippet letfn\n (letfn [(${1:name) [${2:args}]\n ${3})])\nsnippet map\n (map ${1:func} ${2:coll})\nsnippet mapl\n (map #(${1:lambda}) ${2:coll})\nsnippet met\n (${1:name} [${2:this} ${3:args}]\n ${4})\nsnippet ns\n (ns ${1:name}\n ${2})\nsnippet dotimes\n (dotimes [_ 10]\n (time\n (dotimes [_ ${1:times}]\n ${2})))\nsnippet pmethod\n (${1:name} [${2:this} ${3:args}])\nsnippet refer\n (:refer-clojure :exclude [${1}])\nsnippet require\n (:require [${1:namespace} :as [${2}]])\nsnippet use\n (:use [${1:namespace} :only [${2}]])\nsnippet print\n (println ${1})\nsnippet reduce\n (reduce ${1:(fn [p n] ${3})} ${2})\nsnippet when\n (when ${1:test} ${2:body})\nsnippet when-let\n (when-let [${1:result} ${2:test}]\n ${3:body})\n',t.scope="clojure"});
(function() {
window.require(["ace/snippets/clojure"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

View File

@@ -0,0 +1,9 @@
define("ace/snippets/cobol",["require","exports","module"],function(e,t,n){"use strict";t.snippetText="",t.scope="cobol"});
(function() {
window.require(["ace/snippets/cobol"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();

Some files were not shown because too many files have changed in this diff Show More