blogng: theme based on Foundation CSS framework

This commit is contained in:
fabrixxm 2013-01-21 11:55:42 -05:00
parent f4bb753e81
commit 1af8c86925
38 changed files with 15750 additions and 0 deletions

View File

@ -0,0 +1,62 @@
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
<title><?php if (x($page, 'title')) echo $page['title'] ?></title>
<script>var baseurl="<?php echo $a->get_baseurl() ?>";</script>
<!-- Included CSS Files (Compressed) -->
<link rel="stylesheet" href="<?php echo $a->get_baseurl() ?>/view/theme/blogng/stylesheets/foundation.min.css">
<link rel="stylesheet" href="<?php echo $a->get_baseurl() ?>/view/theme/blogng/stylesheets/app.css">
<script src="<?php echo $a->get_baseurl() ?>/view/theme/blogng/javascripts/modernizr.foundation.js"></script>
<!-- IE Fix for HTML5 Tags -->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- questo preferirei evitarlo, ma importa degli script che servono -->
<?php if (x($page, 'htmlhead')) echo $page['htmlhead'] ?>
</head>
<body>
<?php if (x($page, 'nav')) echo $page['nav']; ?>
<div class="row">
<div class="nine columns">
<?php if (x($page, 'content')) echo $page['content']; ?>
</div>
<div class="three columns">
<?php if (x($page, 'aside')) echo $page['aside']; ?>
</div>
</div>
<!--
<aside><?php if (x($page, 'aside')) echo $page['aside']; ?></aside>
<section><?php if (x($page, 'content')) echo $page['content']; ?>
<div id="page-footer"></div>
</section>
<right_aside><?php if (x($page, 'right_aside')) echo $page['right_aside']; ?></right_aside>
<footer><?php if (x($page, 'footer')) echo $page['footer']; ?></footer>-->
<!-- Included JS Files (Compressed) -->
<!-- <script src="<?php echo $a->get_baseurl() ?>/view/theme/blogng/javascripts/jquery.js"></script> -->
<script src="<?php echo $a->get_baseurl() ?>/view/theme/blogng/javascripts/foundation.min.js"></script>
<!-- Initialize JS Plugins -->
<script src="<?php echo $a->get_baseurl() ?>/view/theme/blogng/javascripts/app.js"></script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 523 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

478
view/theme/blogng/index.php Normal file
View File

@ -0,0 +1,478 @@
<?php
include 'ttfInfo.class.php';
define("FONT_DIR", "/media/nas/1_dati/fonts/");
define("CACHE_DIR","/media/nas/1_dati/fonts/.cache/");
define("LIST_PERPAGE", 40);
$file_db = new PDO('sqlite:data/fonts.sqlite3');
$file_db->setAttribute(PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
// Create table messages
$file_db->exec("CREATE TABLE IF NOT EXISTS fonts (
name TEXT,
style TEXT,
file TEXT,
hash TEXT,
PRIMARY KEY (file, hash))");
/**
* walk dir tree, call $callback on files
* callback($dir, $file)
*/
function walk_for_file($dir, $callback){
$cdir = scandir($dir);
foreach ($cdir as $key => $value) {
if (!in_array($value,array(".",".."))) {
if (is_dir($dir . DIRECTORY_SEPARATOR . $value)) {
walk_for_file($dir . DIRECTORY_SEPARATOR . $value, $callback);
} else {
call_user_func_array($callback, array($dir,$value));
}
}
}
}
function update_cb($dir, $file){
global $file_db;
$fullpath = $dir.DIRECTORY_SEPARATOR .$file;
$stmt= $file_db->prepare('SELECT count(hash) FROM fonts WHERE file=:file');
$stmt->bindValue(":file", $fullpath, PDO::PARAM_STR);
if ($stmt->execute()){
if ($stmt->fetchColumn() == 0) {
$fontinfo = getFontInfo($fullpath);
$hash = hash('md5', $fontinfo[1]);
$insert = $file_db->prepare('INSERT INTO fonts (name, style, file, hash) VALUES (:name, :style, :file, :hash);');
$insert->bindValue(":name", $fontinfo[1], PDO::PARAM_STR);
$insert->bindValue(":style", $fontinfo[2], PDO::PARAM_STR);
$insert->bindValue(":file", $fullpath, PDO::PARAM_STR);
$insert->bindValue(":hash", $hash, PDO::PARAM_STR);
$insert->execute();
}
}
$stmt = null;
}
function get_abc(){
global $file_db;
$res = array("Tutti");
$result = $file_db->query("SELECT name FROM fonts GROUP BY name ORDER BY name");
foreach ($result as $row) {
$char = strtoupper($row['name'][0]);
if (!$char==""){
if (!in_array($char, $res)) $res[] = $char;
}
}
return $res;
}
function get_list($filter, $search, $page){
global $file_db;
if ($filter == "Tutti") $filter="%";
$filter .= '%';
$sqlextra = "name LIKE :filter";
if (!is_null($search) && $search!="") {
$search = '%'.$search.'%';
$sqlextra .= " AND (name LIKE :search OR style LIKE :search)";
}
// pagination
$stm = $file_db->prepare("SELECT count(hash) FROM fonts WHERE " . $sqlextra . " GROUP BY name");
$stm->bindValue(":filter", $filter, PDO::PARAM_STR);
if (!is_null($search) && $search!="") $stm->bindValue(":search", $search, PDO::PARAM_STR);
$stm->execute();
$totalcount = count($stm->fetchAll(PDO::FETCH_ASSOC));
$totalpages = ceil($totalcount / LIST_PERPAGE);
$start = $page * LIST_PERPAGE;
$query = "SELECT *, count(name) as variations FROM fonts WHERE " . $sqlextra . " GROUP BY name ORDER BY name LIMIT :start,:len";
$stm = $file_db->prepare($query);
$stm->bindValue(":filter", $filter, PDO::PARAM_STR);
if (!is_null($search) && $search!="") $stm->bindValue(":search", $search, PDO::PARAM_STR);
$stm->bindValue(":start", $start, PDO::PARAM_INT);
$stm->bindValue(":len", LIST_PERPAGE, PDO::PARAM_INT);
$stm->execute();
return array(
'pagination' => array(
'totalcount' => $totalcount,
'totalpages' => $totalpages,
'currentpage' => $page
),
'items' => $stm->fetchAll(PDO::FETCH_ASSOC)
);
}
function get_fonts($hash, $style=Null){
global $file_db;
$sqlextra = "";
if (!is_null($style)) $sqlextra = "AND style = :style";
$stm = $file_db->prepare("SELECT * FROM fonts WHERE hash = :hash ".$sqlextra);
$stm->bindValue(":hash", $hash, PDO::PARAM_STR);
if (!is_null($style)) $stm->bindValue(":style", $style, PDO::PARAM_STR);
$stm->execute();
return $stm->fetchAll(PDO::FETCH_ASSOC);
}
if (isset($_GET['op'])){
switch($_GET['op']){
case "update":
walk_for_file(FONT_DIR, 'update_cb');
echo '"Ok"';
break;
case "navbar":
echo json_encode(get_abc());
break;
case "list":
echo json_encode(get_list($_GET['filter'], $_GET['search'], $_GET['page']));
break;
case "font";
$hash = $_GET['hash'];
echo json_encode(get_fonts($hash));
break;
case "image":
header('Content-Type: image/png');
$hash = $_GET['hash'];
$style = $_GET['style'];
$type = $_GET['type'];
if (is_null($type) || ( $type!="big" && $type!="regular" ) ) $type="regular";
/*if (is_file(CACHE_DIR.DIRECTORY_SEPARATOR.$hash.$type){
echo file_get_contents(CACHE_DIR.DIRECTORY_SEPARATOR.$hash);
die();
}*/
$fonts = get_fonts($hash, $style);
if ($type=="big"){
// Create the image
$im = imagecreatetruecolor(600, 100);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 600, 100, $white);
// Replace path by your own font path
$font = $fonts[0]['file'];
// Add the text
$text = "ABCDEFGHIJKLMNOPQERTUVWXYZ";
imagettftext($im, 20, 0, 5, 20, $black, $font, $text);
$text = "abcdefghijklmnopqrstuvwxyz";
imagettftext($im, 20, 0, 5, 50, $black, $font, $text);
$text = ".,:;-_!\"£$%&/()=?^";
imagettftext($im, 20, 0, 5, 80, $black, $font, $text);
} else {
// Create the image
$im = imagecreatetruecolor(200, 50);
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 200, 50, $white);
// The text to draw
$text = $fonts[0]['name'];
// Replace path by your own font path
$font = $fonts[0]['file'];
// Add the text
imagettftext($im, 20, 0, 5, 30, $black, $font, $text);
}
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
break;
case "dwl":
$hash = $_GET['hash'];
$style = $_GET['style'];
$fonts = get_fonts($hash, $style);
header('Content-Type:font/truetype');
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename= " . basename($fonts[0]['file']));
header("Content-Transfer-Encoding: binary");
echo file_get_contents($fonts[0]['file']);
break;
}
die();
}
?>
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
<title>Fonts</title>
<!-- Included CSS Files (Compressed) -->
<link rel="stylesheet" href="stylesheets/foundation.min.css">
<link rel="stylesheet" href="stylesheets/app.css">
<script src="javascripts/modernizr.foundation.js"></script>
<!-- IE Fix for HTML5 Tags -->
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<div class="row">
<div class="twelve columns">
<h2>Fontology</h2>
</div>
</div>
<div class="row">
<div class="eight columns">
<dl class="sub-nav">
<dt data-bind="text: pagination().totalcount"></dt>
<!-- ko foreach: navbar -->
<dd data-bind="css: { active : $parent.currentNav() == $data }"><a href="#" data-bind="text: $data, click: $parent.changeFilter "></a></dd>
<!-- /ko -->
</dl>
</div>
<div class="four columns">
<input type="text" placeholder="Cerca..." data-bind="value: search"/>
</div>
</div>
<div class="row">
<div class="twelve columns">
<ul class="pagination">
<li class="arrow" data-bind="css: {unavailable: pagination().firstpage }"><a href="#" data-bind="click: pagination().prev">&laquo;</a></li>
<!-- ko foreach: pagination().pages -->
<li data-bind="css: { current : is_current }"><a href="#" data-bind="text: label, click: changeto"></a></li>
<!-- /ko -->
<li class="arrow" data-bind="css: {unavailable: pagination().lastpage }"><a href="#" data-bind="click: pagination().next">&raquo;</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="twelve columns">
<ul class="block-grid four-up" data-bind="foreach: fontlist">
<li>
<ul class="pricing-table">
<li class="title" data-bind="text: name"></li>
<li class="description"><img data-bind="attr: { src: image }"></img></li>
<li class="description" data-bind="text: vartext"></li>
<li class="cta-button"><a class="button" href="#" data-bind="click: $parent.showDetails">Dettagli &raquo;</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="row">
<div class="twelve columns">
<ul class="pagination">
<li class="arrow" data-bind="css: {unavailable: pagination().firstpage }"><a href="#" data-bind="click: pagination().prev">&laquo;</a></li>
<!-- ko foreach: pagination().pages -->
<li data-bind="css: { current : is_current }"><a href="#" data-bind="text: label, click: changeto"></a></li>
<!-- /ko -->
<li class="arrow" data-bind="css: {unavailable: pagination().lastpage }"><a href="#" data-bind="click: pagination().next">&raquo;</a></li>
</ul>
</div>
</div>
<div id="fontDetail" class="reveal-modal large">
<h2 data-bind="text: currentfontname()"></h2>
<!-- ko foreach: currentfont -->
<div class="row">
<div class="twelve columns"><img data-bind="attr: { src: imagebig }"></img></div>
</div>
<div class="row panel">
<div class="nine columns" data-bind="text: style"></div>
<div class="three columns"><a href="#" class="button" data-bind="attr: { href: url }">Download &raquo;</a></div>
</div>
<!-- /ko -->
<a class="close-reveal-modal">&#215;</a>
</div>
<!-- Included JS Files (Compressed) -->
<script src="javascripts/jquery.js"></script>
<script src="javascripts/foundation.min.js"></script>
<script src="javascripts/knockout-2.2.0.js"></script>
<!-- Initialize JS Plugins -->
<script src="javascripts/app.js"></script>
<script>
function FontModel(data){
this.name = ko.observable(data.name);
this.style = ko.observable(data.style);
this.hash = ko.observable(data.hash);
this.file = ko.observable(data.file);
this.variations = ko.observable(data['variations']);
this.vartext = ko.computed(function() {
var t = "variant";
if (this.variations()==1) { t+="e"; } else { t+="i"; }
return this.variations() + " " + t;
}, this);
this.image = ko.computed(function() {
return "index.php?op=image&hash=" + encodeURIComponent(this.hash())+"&style="+ encodeURIComponent(this.style());
}, this);
this.imagebig = ko.computed(function() {
return "index.php?op=image&type=big&hash=" + encodeURIComponent(this.hash())+"&style="+ encodeURIComponent(this.style());
}, this);
this.url = ko.computed(function() {
return "index.php?op=dwl&hash=" + encodeURIComponent(this.hash()) + "&style="+ encodeURIComponent(this.style());
}, this);
}
function PaginationModel(data) {
var self = this;
self.totalcount = ko.observable(data.totalcount);
self.currentpage = ko.observable(data.currentpage);
self.totalpages = ko.observable(data.totalpages);
self.update = function(data) {
self.totalcount(data.totalcount);
self.currentpage(data.currentpage);
self.totalpages(data.totalpages);
}
self.pages = ko.computed(function() {
var pages = [];
for(k=1; k<=self.totalpages(); k++) {
pages.push({
label:k,
page:k-1,
is_current: (k-1 == self.currentpage()),
changeto : self.changeto
});
}
return pages
});
self.firstpage = ko.computed(function() {
return (self.currentpage()==0);
});
self.lastpage = ko.computed(function() {
return (self.currentpage()==self.totalpages()-1);
});
self.changeto = function(page) {
self.currentpage(page.page);
}
self.next = function () {
if (!self.lastpage()) self.currentpage( 1 + parseInt(self.currentpage()) );
}
self.prev = function () {
if (!self.firstpage()) self.currentpage(parseInt(self.currentpage()) - 1 );
}
}
function FontListModel(){
var self = this;
self.currentNav = ko.observable("");
self.navbar = ko.observableArray([]);
self.fontlist = ko.observableArray([]);
self.pagination = ko.observable(new PaginationModel({
totalcount: 0,
totalpages: 0,
currentpage: 0
}));
self.currentfont = ko.observableArray([]);
self.currentfontname = ko.computed(function(){
if (self.currentfont().length>0)
return self.currentfont()[0].name;
return "";
});
self.searchterm = "";
this.search = ko.computed({
read: function() { return self.searchterm; },
write: function(value) {
console.log(value);
self.searchterm = value;
self.updateList();
},
});
self.updateList = ko.computed(function() {
$.getJSON("index.php", {op:'list', filter: self.currentNav, page: self.pagination().currentpage(), search : self.searchterm }, function(allData) {
self.pagination().update(allData['pagination']);
self.fontlist.removeAll();
$.map(allData['items'], function(item) {
self.fontlist.push(new FontModel(item));
});
});
});
self.changeFilter = function(filter) {
self.pagination().currentpage(0);
self.currentNav(filter);
}
self.showDetails = function(font) {
$.getJSON("index.php", {op:'font', hash: font.hash()}, function(allData) {
self.currentfont.removeAll();
$.map(allData, function(item) {
self.currentfont.push(new FontModel(item));
});
$("#fontDetail").reveal();
});
}
// load navbar
$.getJSON("index.php", {op:'navbar'}, function(allData) {
self.navbar(allData);
self.currentNav(allData[0]);
self.updateList();
});
}
ko.applyBindings(new FontListModel());
/*$(window).load(function(){
$("#featured").orbit();
});*/
</script>
</body>
</html>
<?php
$file_db = null;
?>

View File

@ -0,0 +1,38 @@
;(function ($, window, undefined) {
'use strict';
var $doc = $(document),
Modernizr = window.Modernizr;
$(document).ready(function() {
$.fn.foundationAlerts ? $doc.foundationAlerts() : null;
$.fn.foundationButtons ? $doc.foundationButtons() : null;
$.fn.foundationAccordion ? $doc.foundationAccordion() : null;
$.fn.foundationNavigation ? $doc.foundationNavigation() : null;
$.fn.foundationTopBar ? $doc.foundationTopBar() : null;
$.fn.foundationCustomForms ? $doc.foundationCustomForms() : null;
$.fn.foundationMediaQueryViewer ? $doc.foundationMediaQueryViewer() : null;
$.fn.foundationTabs ? $doc.foundationTabs({callback : $.foundation.customForms.appendCustomMarkup}) : null;
$.fn.foundationTooltips ? $doc.foundationTooltips() : null;
$.fn.foundationMagellan ? $doc.foundationMagellan() : null;
$.fn.foundationClearing ? $doc.foundationClearing() : null;
$.fn.placeholder ? $('input, textarea').placeholder() : null;
});
// UNCOMMENT THE LINE YOU WANT BELOW IF YOU WANT IE8 SUPPORT AND ARE USING .block-grids
// $('.block-grid.two-up>li:nth-child(2n+1)').css({clear: 'both'});
// $('.block-grid.three-up>li:nth-child(3n+1)').css({clear: 'both'});
// $('.block-grid.four-up>li:nth-child(4n+1)').css({clear: 'both'});
// $('.block-grid.five-up>li:nth-child(5n+1)').css({clear: 'both'});
// Hide address bar on mobile devices (except if #hash present, so we don't mess up deep linking).
if (Modernizr.touch && !window.location.hash) {
$(window).load(function () {
setTimeout(function () {
window.scrollTo(0, 1);
}, 0);
});
}
})(jQuery, this);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,39 @@
;(function ($, window, undefined){
'use strict';
$.fn.foundationAccordion = function (options) {
var $accordion = $('.accordion');
if ($accordion.hasClass('hover') && !Modernizr.touch) {
$('.accordion li', this).on({
mouseenter : function () {
console.log('due');
var p = $(this).parent(),
flyout = $(this).children('.content').first();
$('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
flyout.show(0, function () {
flyout.parent('li').addClass('active');
});
}
});
} else {
$('.accordion li', this).on('click.fndtn', function () {
var li = $(this),
p = $(this).parent(),
flyout = $(this).children('.content').first();
if (li.hasClass('active')) {
p.find('li').removeClass('active').end().find('.content').hide();
} else {
$('.content', p).not(flyout).hide().parent('li').removeClass('active'); //changed this
flyout.show(0, function () {
flyout.parent('li').addClass('active');
});
}
});
}
};
})( jQuery, this );

View File

@ -0,0 +1,20 @@
;(function ($, window, undefined) {
'use strict';
$.fn.foundationAlerts = function (options) {
var settings = $.extend({
callback: $.noop
}, options);
$(document).on("click", ".alert-box a.close", function (e) {
e.preventDefault();
$(this).closest(".alert-box").fadeOut(function () {
$(this).remove();
// Do something else after the alert closes
settings.callback();
});
});
};
})(jQuery, this);

View File

@ -0,0 +1,79 @@
;(function ($, window, undefined) {
'use strict';
$.fn.foundationButtons = function (options) {
var $doc = $(document),
config = $.extend({
dropdownAsToggle:true,
activeClass:'active'
}, options),
// close all dropdowns except for the dropdown passed
closeDropdowns = function (dropdown) {
$('.button.dropdown').find('ul').not(dropdown).removeClass('show-dropdown');
},
// reset all toggle states except for the button passed
resetToggles = function (button) {
var buttons = $('.button.dropdown').not(button);
buttons.add($('> span.' + config.activeClass, buttons)).removeClass(config.activeClass);
};
// Prevent event propagation on disabled buttons
$doc.on('click.fndtn', '.button.disabled', function (e) {
e.preventDefault();
});
$('.button.dropdown > ul', this).addClass('no-hover');
// reset other active states
$doc.on('click.fndtn', '.button.dropdown:not(.split), .button.dropdown.split span', function (e) {
var $el = $(this),
button = $el.closest('.button.dropdown'),
dropdown = $('> ul', button);
// If the click is registered on an actual link then do not preventDefault which stops the browser from following the link
if (e.target.nodeName !== "A"){
e.preventDefault();
}
// close other dropdowns
closeDropdowns(config.dropdownAsToggle ? dropdown : '');
dropdown.toggleClass('show-dropdown');
if (config.dropdownAsToggle) {
resetToggles(button);
$el.toggleClass(config.activeClass);
}
});
// close all dropdowns and deactivate all buttons
$doc.on('click.fndtn', 'body, html', function (e) {
if (undefined == e.originalEvent) { return; }
// check original target instead of stopping event propagation to play nice with other events
if (!$(e.originalEvent.target).is('.button.dropdown:not(.split), .button.dropdown.split span')) {
closeDropdowns();
if (config.dropdownAsToggle) {
resetToggles();
}
}
});
// Positioning the Flyout List
var normalButtonHeight = $('.button.dropdown:not(.large):not(.small):not(.tiny)', this).outerHeight() - 1,
largeButtonHeight = $('.button.large.dropdown', this).outerHeight() - 1,
smallButtonHeight = $('.button.small.dropdown', this).outerHeight() - 1,
tinyButtonHeight = $('.button.tiny.dropdown', this).outerHeight() - 1;
$('.button.dropdown:not(.large):not(.small):not(.tiny) > ul', this).css('top', normalButtonHeight);
$('.button.dropdown.large > ul', this).css('top', largeButtonHeight);
$('.button.dropdown.small > ul', this).css('top', smallButtonHeight);
$('.button.dropdown.tiny > ul', this).css('top', tinyButtonHeight);
$('.button.dropdown.up:not(.large):not(.small):not(.tiny) > ul', this).css('top', 'auto').css('bottom', normalButtonHeight - 2);
$('.button.dropdown.up.large > ul', this).css('top', 'auto').css('bottom', largeButtonHeight - 2);
$('.button.dropdown.up.small > ul', this).css('top', 'auto').css('bottom', smallButtonHeight - 2);
$('.button.dropdown.up.tiny > ul', this).css('top', 'auto').css('bottom', tinyButtonHeight - 2);
};
})( jQuery, this );

View File

@ -0,0 +1,480 @@
/*
* jQuery Foundation Clearing 1.0
* http://foundation.zurb.com
* Copyright 2012, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
/*jslint unparam: true, browser: true, indent: 2 */
;(function ($, window, undefined) {
'use strict';
var defaults = {
templates : {
viewing : '<a href="#" class="clearing-close">&times;</a>' +
'<div class="visible-img" style="display: none"><img src="#">' +
'<p class="clearing-caption"></p><a href="#" class="clearing-main-left"></a>' +
'<a href="#" class="clearing-main-right"></a></div>'
},
initialized : false,
locked : false
},
superMethods = {},
methods = {
init : function (options, extendMethods) {
return this.find('ul[data-clearing]').each(function () {
var doc = $(document),
$el = $(this),
options = options || {},
extendMethods = extendMethods || {},
settings = $el.data('fndtn.clearing.settings');
if (!settings) {
options.$parent = $el.parent();
$el.data('fndtn.clearing.settings', $.extend({}, defaults, options));
// developer goodness experiment
methods.extend(methods, extendMethods);
// if the gallery hasn't been built yet...build it
methods.assemble($el.find('li'));
if (!defaults.initialized) methods.events();
}
});
},
events : function () {
var doc = $(document);
doc.on('click.fndtn.clearing', 'ul[data-clearing] li', function (e, current, target) {
var current = current || $(this),
target = target || current,
settings = current.parent().data('fndtn.clearing.settings');
e.preventDefault();
if (!settings) {
current.parent().foundationClearing();
}
// set current and target to the clicked li if not otherwise defined.
methods.open($(e.target), current, target);
methods.update_paddles(target);
});
$(window).on('resize.fndtn.clearing', function () {
var image = $('.clearing-blackout .visible-img').find('img');
if (image.length > 0) {
methods.center(image);
}
});
doc.on('click.fndtn.clearing', '.clearing-main-right', function (e) {
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
e.preventDefault();
methods.go(clearing, 'next');
});
doc.on('click.fndtn.clearing', '.clearing-main-left', function (e) {
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
e.preventDefault();
methods.go(clearing, 'prev');
});
doc.on('click.fndtn.clearing', 'a.clearing-close, div.clearing-blackout, div.visible-img', function (e) {
var root = (function (target) {
if (/blackout/.test(target.selector)) {
return target;
} else {
return target.closest('.clearing-blackout');
}
}($(this))), container, visible_image;
if (this === e.target && root) {
container = root.find('div:first'),
visible_image = container.find('.visible-img');
defaults.prev_index = 0;
root.find('ul[data-clearing]').attr('style', '')
root.removeClass('clearing-blackout');
container.removeClass('clearing-container');
visible_image.hide();
}
return false;
});
// should specify a target selector
doc.on('keydown.fndtn.clearing', function (e) {
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
// right
if (e.which === 39) {
methods.go(clearing, 'next');
}
// left
if (e.which === 37) {
methods.go(clearing, 'prev');
}
if (e.which === 27) {
$('a.clearing-close').trigger('click');
}
});
doc.on('movestart', function(e) {
// If the movestart is heading off in an upwards or downwards
// direction, prevent it so that the browser scrolls normally.
if ((e.distX > e.distY && e.distX < -e.distY) ||
(e.distX < e.distY && e.distX > -e.distY)) {
e.preventDefault();
}
});
doc.bind('swipeleft', 'ul[data-clearing] li', function () {
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
methods.go(clearing, 'next');
});
doc.bind('swiperight', 'ul[data-clearing] li', function () {
var clearing = $('.clearing-blackout').find('ul[data-clearing]');
methods.go(clearing, 'prev');
});
defaults.initialized = true;
},
assemble : function ($li) {
var $el = $li.parent(),
settings = $el.data('fndtn.clearing.settings'),
grid = $el.detach(),
data = {
grid: '<div class="carousel">' + this.outerHTML(grid[0]) + '</div>',
viewing: settings.templates.viewing
},
wrapper = '<div class="clearing-assembled"><div>' + data.viewing + data.grid + '</div></div>';
return settings.$parent.append(wrapper);
},
open : function ($image, current, target) {
var root = target.closest('.clearing-assembled'),
container = root.find('div:first'),
visible_image = container.find('.visible-img'),
image = visible_image.find('img').not($image);
if (!methods.locked()) {
// set the image to the selected thumbnail
image.attr('src', this.load($image));
image.is_good(function () {
// toggle the gallery if not visible
root.addClass('clearing-blackout');
container.addClass('clearing-container');
methods.caption(visible_image.find('.clearing-caption'), $image);
visible_image.show();
methods.fix_height(target);
methods.center(image);
// shift the thumbnails if necessary
methods.shift(current, target, function () {
target.siblings().removeClass('visible');
target.addClass('visible');
});
});
}
},
fix_height : function (target) {
var lis = target.siblings();
lis.each(function () {
var li = $(this),
image = li.find('img');
if (li.height() > image.outerHeight()) {
li.addClass('fix-height');
}
});
lis.closest('ul').width(lis.length * 100 + '%');
},
update_paddles : function (target) {
var visible_image = target.closest('.carousel').siblings('.visible-img');
if (target.next().length > 0) {
visible_image.find('.clearing-main-right').removeClass('disabled');
} else {
visible_image.find('.clearing-main-right').addClass('disabled');
}
if (target.prev().length > 0) {
visible_image.find('.clearing-main-left').removeClass('disabled');
} else {
visible_image.find('.clearing-main-left').addClass('disabled');
}
},
load : function ($image) {
var href = $image.parent().attr('href');
// preload next and previous
this.preload($image);
if (href) {
return href;
}
return $image.attr('src');
},
preload : function ($image) {
var next = $image.closest('li').next(),
prev = $image.closest('li').prev(),
next_a, prev_a,
next_img, prev_img;
if (next.length > 0) {
next_img = new Image();
next_a = next.find('a');
if (next_a.length > 0) {
next_img.src = next_a.attr('href');
} else {
next_img.src = next.find('img').attr('src');
}
}
if (prev.length > 0) {
prev_img = new Image();
prev_a = prev.find('a');
if (prev_a.length > 0) {
prev_img.src = prev_a.attr('href');
} else {
prev_img.src = prev.find('img').attr('src');
}
}
},
caption : function (container, $image) {
var caption = $image.data('caption');
if (caption) {
container.text(caption).show();
} else {
container.text('').hide();
}
},
go : function ($ul, direction) {
var current = $ul.find('.visible'),
target = current[direction]();
if (target.length > 0) {
target.find('img').trigger('click', [current, target]);
}
},
shift : function (current, target, callback) {
var clearing = target.parent(),
container = clearing.closest('.clearing-container'),
target_offset = target.position().left,
thumbs_offset = clearing.position().left,
old_index = defaults.prev_index,
direction = this.direction(clearing, current, target),
left = parseInt(clearing.css('left'), 10),
width = target.outerWidth(),
skip_shift;
// we use jQuery animate instead of CSS transitions because we
// need a callback to unlock the next animation
if (target.index() !== old_index && !/skip/.test(direction)){
if (/left/.test(direction)) {
methods.lock();
clearing.animate({left : left + width}, 300, methods.unlock);
} else if (/right/.test(direction)) {
methods.lock();
clearing.animate({left : left - width}, 300, methods.unlock);
}
} else if (/skip/.test(direction)) {
// the target image is not adjacent to the current image, so
// do we scroll right or not
skip_shift = target.index() - defaults.up_count;
methods.lock();
if (skip_shift > 0) {
clearing.animate({left : -(skip_shift * width)}, 300, methods.unlock);
} else {
clearing.animate({left : 0}, 300, methods.unlock);
}
}
callback();
},
lock : function () {
defaults.locked = true;
},
unlock : function () {
defaults.locked = false;
},
locked : function () {
return defaults.locked;
},
direction : function ($el, current, target) {
var lis = $el.find('li'),
li_width = lis.outerWidth() + (lis.outerWidth() / 4),
container = $('.clearing-container'),
up_count = Math.floor(container.outerWidth() / li_width) - 1,
shift_count = lis.length - up_count,
target_index = lis.index(target),
current_index = lis.index(current),
response;
defaults.up_count = up_count;
if (this.adjacent(defaults.prev_index, target_index)) {
if ((target_index > up_count) && target_index > defaults.prev_index) {
response = 'right';
} else if ((target_index > up_count - 1) && target_index <= defaults.prev_index) {
response = 'left';
} else {
response = false;
}
} else {
response = 'skip';
}
defaults.prev_index = target_index;
return response;
},
adjacent : function (current_index, target_index) {
if (target_index - 1 === current_index) {
return true;
} else if (target_index + 1 === current_index) {
return true;
} else if (target_index === current_index) {
return true;
}
return false;
},
center : function (target) {
target.css({
marginLeft : -(target.outerWidth() / 2),
marginTop : -(target.outerHeight() / 2)
});
},
outerHTML : function (el) {
// support FireFox < 11
return el.outerHTML || new XMLSerializer().serializeToString(el);
},
// experimental functionality for overwriting or extending
// clearing methods during initialization.
//
// ex $doc.foundationClearing({}, {
// shift : function (current, target, callback) {
// // modify arguments, etc.
// this._super('shift', [current, target, callback]);
// // do something else here.
// }
// });
extend : function (supers, extendMethods) {
$.each(supers, function (name, method) {
if (extendMethods.hasOwnProperty(name)) {
superMethods[name] = method;
}
});
$.extend(methods, extendMethods);
},
// you can call this._super('methodName', [args]) to call
// the original method and wrap it in your own code
_super : function (method, args) {
return superMethods[method].apply(this, args);
}
};
$.fn.foundationClearing = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.foundationClearing');
}
};
// jquery.imageready.js
// @weblinc, @jsantell, (c) 2012
(function( $ ) {
$.fn.is_good = function ( callback, userSettings ) {
var
options = $.extend( {}, $.fn.is_good.defaults, userSettings ),
$images = this.find( 'img' ).add( this.filter( 'img' ) ),
unloadedImages = $images.length;
function loaded () {
unloadedImages -= 1;
!unloadedImages && callback();
}
function bindLoad () {
this.one( 'load', loaded );
if ( $.browser.msie ) {
var
src = this.attr( 'src' ),
param = src.match( /\?/ ) ? '&' : '?';
param += options.cachePrefix + '=' + ( new Date() ).getTime();
this.attr( 'src', src + param );
}
}
return $images.each(function () {
var $this = $( this );
if ( !$this.attr( 'src' ) ) {
loaded();
return;
}
this.complete || this.readyState === 4 ?
loaded() :
bindLoad.call( $this );
});
};
$.fn.is_good.defaults = {
cachePrefix: 'random'
};
}(jQuery));
}(jQuery, this));

View File

@ -0,0 +1,486 @@
/*
* jQuery Custom Forms Plugin 1.0
* www.ZURB.com
* Copyright 2010, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function( $ ){
/**
* Helper object used to quickly adjust all hidden parent element's, display and visibility properties.
* This is currently used for the custom drop downs. When the dropdowns are contained within a reveal modal
* we cannot accurately determine the list-item elements width property, since the modal's display property is set
* to 'none'.
*
* This object will help us work around that problem.
*
* NOTE: This could also be plugin.
*
* @function hiddenFix
*/
var hiddenFix = function() {
return {
/**
* Sets all hidden parent elements and self to visibile.
*
* @method adjust
* @param {jQuery Object} $child
*/
// We'll use this to temporarily store style properties.
tmp : [],
// We'll use this to set hidden parent elements.
hidden : null,
adjust : function( $child ) {
// Internal reference.
var _self = this;
// Set all hidden parent elements, including this element.
_self.hidden = $child.parents().andSelf().filter( ":hidden" );
// Loop through all hidden elements.
_self.hidden.each( function() {
// Cache the element.
var $elem = $( this );
// Store the style attribute.
// Undefined if element doesn't have a style attribute.
_self.tmp.push( $elem.attr( 'style' ) );
// Set the element's display property to block,
// but ensure it's visibility is hidden.
$elem.css( { 'visibility' : 'hidden', 'display' : 'block' } );
});
}, // end adjust
/**
* Resets the elements previous state.
*
* @method reset
*/
reset : function() {
// Internal reference.
var _self = this;
// Loop through our hidden element collection.
_self.hidden.each( function( i ) {
// Cache this element.
var $elem = $( this ),
_tmp = _self.tmp[ i ]; // Get the stored 'style' value for this element.
// If the stored value is undefined.
if( _tmp === undefined )
// Remove the style attribute.
$elem.removeAttr( 'style' );
else
// Otherwise, reset the element style attribute.
$elem.attr( 'style', _tmp );
});
// Reset the tmp array.
_self.tmp = [];
// Reset the hidden elements variable.
_self.hidden = null;
} // end reset
}; // end return
};
jQuery.foundation = jQuery.foundation || {};
jQuery.foundation.customForms = jQuery.foundation.customForms || {};
$.foundation.customForms.appendCustomMarkup = function ( options ) {
var defaults = {
disable_class: "js-disable-custom"
};
options = $.extend( defaults, options );
function appendCustomMarkup(idx, sel) {
var $this = $(sel).hide(),
type = $this.attr('type'),
$span = $this.next('span.custom.' + type);
if ($span.length === 0) {
$span = $('<span class="custom ' + type + '"></span>').insertAfter($this);
}
$span.toggleClass('checked', $this.is(':checked'));
$span.toggleClass('disabled', $this.is(':disabled'));
}
function appendCustomSelect(idx, sel) {
var hiddenFixObj = hiddenFix();
//
// jQueryify the <select> element and cache it.
//
var $this = $( sel ),
//
// Find the custom drop down element.
//
$customSelect = $this.next( 'div.custom.dropdown' ),
//
// Find the custom select element within the custom drop down.
//
$customList = $customSelect.find( 'ul' ),
//
// Find the custom a.current element.
//
$selectCurrent = $customSelect.find( ".current" ),
//
// Find the custom a.selector element (the drop-down icon).
//
$selector = $customSelect.find( ".selector" ),
//
// Get the <options> from the <select> element.
//
$options = $this.find( 'option' ),
//
// Filter down the selected options
//
$selectedOption = $options.filter( ':selected' ),
//
// Initial max width.
//
maxWidth = 0,
//
// We'll use this variable to create the <li> elements for our custom select.
//
liHtml = '',
//
// We'll use this to cache the created <li> elements within our custom select.
//
$listItems
;
var $currentSelect = false;
//
// Should we not create a custom list?
//
if ( $this.hasClass( 'no-custom' ) ) return;
//
// Did we not create a custom select element yet?
//
if ( $customSelect.length === 0 ) {
//
// Let's create our custom select element!
//
//
// Determine what select size to use.
//
var customSelectSize = $this.hasClass( 'small' ) ? 'small' :
$this.hasClass( 'medium' ) ? 'medium' :
$this.hasClass( 'large' ) ? 'large' :
$this.hasClass( 'expand' ) ? 'expand' : ''
;
//
// Build our custom list.
//
$customSelect = $('<div class="' + ['custom', 'dropdown', customSelectSize ].join( ' ' ) + '"><a href="#" class="selector"></a><ul /></div>"');
//
// Grab the selector element
//
$selector = $customSelect.find( ".selector" );
//
// Grab the unordered list element from the custom list.
//
$customList = $customSelect.find( "ul" );
//
// Build our <li> elements.
//
liHtml = $options.map( function() { return "<li>" + $( this ).html() + "</li>"; } ).get().join( '' );
//
// Append our <li> elements to the custom list (<ul>).
//
$customList.append( liHtml );
//
// Insert the the currently selected list item before all other elements.
// Then, find the element and assign it to $currentSelect.
//
$currentSelect = $customSelect.prepend( '<a href="#" class="current">' + $selectedOption.html() + '</a>' ).find( ".current" );
//
// Add the custom select element after the <select> element.
//
$this.after( $customSelect )
//
//then hide the <select> element.
//
.hide();
} else {
//
// Create our list item <li> elements.
//
liHtml = $options.map( function() { return "<li>" + $( this ).html() + "</li>"; } ).get().join( '' );
//
// Refresh the ul with options from the select in case the supplied markup doesn't match.
// Clear what's currently in the <ul> element.
//
$customList.html( '' )
//
// Populate the list item <li> elements.
//
.append( liHtml );
} // endif $customSelect.length === 0
//
// Determine whether or not the custom select element should be disabled.
//
$customSelect.toggleClass( 'disabled', $this.is( ':disabled' ) );
//
// Cache our List item elements.
//
$listItems = $customList.find( 'li' );
//
// Determine which elements to select in our custom list.
//
$options.each( function ( index ) {
if ( this.selected ) {
//
// Add the selected class to the current li element
//
$listItems.eq( index ).addClass( 'selected' );
//
// Update the current element with the option value.
//
if ($currentSelect) {
$currentSelect.html( $( this ).html() );
}
}
});
//
// Update the custom <ul> list width property.
//
$customList.css( 'width', 'inherit' );
//
// Set the custom select width property.
//
$customSelect.css( 'width', 'inherit' );
//
// If we're not specifying a predetermined form size.
//
if ( !$customSelect.is( '.small, .medium, .large, .expand' ) ) {
// ------------------------------------------------------------------------------------
// This is a work-around for when elements are contained within hidden parents.
// For example, when custom-form elements are inside of a hidden reveal modal.
//
// We need to display the current custom list element as well as hidden parent elements
// in order to properly calculate the list item element's width property.
// -------------------------------------------------------------------------------------
//
// Show the drop down.
// This should ensure that the list item's width values are properly calculated.
//
$customSelect.addClass( 'open' );
//
// Quickly, display all parent elements.
// This should help us calcualate the width of the list item's within the drop down.
//
hiddenFixObj.adjust( $customList );
//
// Grab the largest list item width.
//
maxWidth = ( $listItems.outerWidth() > maxWidth ) ? $listItems.outerWidth() : maxWidth;
//
// Okay, now reset the parent elements.
// This will hide them again.
//
hiddenFixObj.reset();
//
// Finally, hide the drop down.
//
$customSelect.removeClass( 'open' );
//
// Set the custom list width.
//
$customSelect.width( maxWidth + 18);
//
// Set the custom list element (<ul />) width.
//
$customList.width( maxWidth + 16 );
} // endif
}
$('form.custom input:radio[data-customforms!=disabled]').each(appendCustomMarkup);
$('form.custom input:checkbox[data-customforms!=disabled]').each(appendCustomMarkup);
$('form.custom select[data-customforms!=disabled]').each(appendCustomSelect);
};
var refreshCustomSelect = function($select) {
var maxWidth = 0,
$customSelect = $select.next();
$options = $select.find('option');
$customSelect.find('ul').html('');
$options.each(function () {
$li = $('<li>' + $(this).html() + '</li>');
$customSelect.find('ul').append($li);
});
// re-populate
$options.each(function (index) {
if (this.selected) {
$customSelect.find('li').eq(index).addClass('selected');
$customSelect.find('.current').html($(this).html());
}
});
// fix width
$customSelect.removeAttr('style')
.find('ul').removeAttr('style');
$customSelect.find('li').each(function () {
$customSelect.addClass('open');
if ($(this).outerWidth() > maxWidth) {
maxWidth = $(this).outerWidth();
}
$customSelect.removeClass('open');
});
$customSelect.css('width', maxWidth + 18 + 'px');
$customSelect.find('ul').css('width', maxWidth + 16 + 'px');
};
var toggleCheckbox = function($element) {
var $input = $element.prev(),
input = $input[0];
if (false === $input.is(':disabled')) {
input.checked = ((input.checked) ? false : true);
$element.toggleClass('checked');
$input.trigger('change');
}
};
var toggleRadio = function($element) {
var $input = $element.prev(),
$form = $input.closest('form.custom'),
input = $input[0];
if (false === $input.is(':disabled')) {
$form.find('input:radio[name="' + $input.attr('name') + '"]').next().not($element).removeClass('checked');
if ( !$element.hasClass('checked') ) {
$element.toggleClass('checked');
}
input.checked = $element.hasClass('checked');
$input.trigger('change');
}
};
$(document).on('click', 'form.custom span.custom.checkbox', function (event) {
event.preventDefault();
event.stopPropagation();
toggleCheckbox($(this));
});
$(document).on('click', 'form.custom span.custom.radio', function (event) {
event.preventDefault();
event.stopPropagation();
toggleRadio($(this));
});
$(document).on('change', 'form.custom select[data-customforms!=disabled]', function (event) {
refreshCustomSelect($(this));
});
$(document).on('click', 'form.custom label', function (event) {
var $associatedElement = $('#' + $(this).attr('for') + '[data-customforms!=disabled]'),
$customCheckbox,
$customRadio;
if ($associatedElement.length !== 0) {
if ($associatedElement.attr('type') === 'checkbox') {
event.preventDefault();
$customCheckbox = $(this).find('span.custom.checkbox');
toggleCheckbox($customCheckbox);
} else if ($associatedElement.attr('type') === 'radio') {
event.preventDefault();
$customRadio = $(this).find('span.custom.radio');
toggleRadio($customRadio);
}
}
});
$(document).on('click', 'form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector', function (event) {
var $this = $(this),
$dropdown = $this.closest('div.custom.dropdown'),
$select = $dropdown.prev();
event.preventDefault();
$('div.dropdown').removeClass('open');
if (false === $select.is(':disabled')) {
$dropdown.toggleClass('open');
if ($dropdown.hasClass('open')) {
$(document).bind('click.customdropdown', function (event) {
$dropdown.removeClass('open');
$(document).unbind('.customdropdown');
});
} else {
$(document).unbind('.customdropdown');
}
return false;
}
});
$(document).on('click', 'form.custom div.custom.dropdown li', function (event) {
var $this = $(this),
$customDropdown = $this.closest('div.custom.dropdown'),
$select = $customDropdown.prev(),
selectedIndex = 0;
event.preventDefault();
event.stopPropagation();
$('div.dropdown').removeClass('open');
$this
.closest('ul')
.find('li')
.removeClass('selected');
$this.addClass('selected');
$customDropdown
.removeClass('open')
.find('a.current')
.html($this.html());
$this.closest('ul').find('li').each(function (index) {
if ($this[0] == this) {
selectedIndex = index;
}
});
$select[0].selectedIndex = selectedIndex;
$select.trigger('change');
});
$.fn.foundationCustomForms = $.foundation.customForms.appendCustomMarkup;
})( jQuery );

View File

@ -0,0 +1,639 @@
/*
* jQuery Foundation Joyride Plugin 2.0.2
* http://foundation.zurb.com
* Copyright 2012, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
/*jslint unparam: true, browser: true, indent: 2 */
;(function ($, window, undefined) {
'use strict';
var defaults = {
'version' : '2.0.1',
'tipLocation' : 'bottom', // 'top' or 'bottom' in relation to parent
'nubPosition' : 'auto', // override on a per tooltip bases
'scrollSpeed' : 300, // Page scrolling speed in milliseconds
'timer' : 0, // 0 = no timer , all other numbers = timer in milliseconds
'startTimerOnClick' : true, // true or false - true requires clicking the first button start the timer
'startOffset' : 0, // the index of the tooltip you want to start on (index of the li)
'nextButton' : true, // true or false to control whether a next button is used
'tipAnimation' : 'fade', // 'pop' or 'fade' in each tip
'pauseAfter' : [], // array of indexes where to pause the tour after
'tipAnimationFadeSpeed': 300, // when tipAnimation = 'fade' this is speed in milliseconds for the transition
'cookieMonster' : false, // true or false to control whether cookies are used
'cookieName' : 'joyride', // Name the cookie you'll use
'cookieDomain' : false, // Will this cookie be attached to a domain, ie. '.notableapp.com'
'tipContainer' : 'body', // Where will the tip be attached
'postRideCallback' : $.noop, // A method to call once the tour closes (canceled or complete)
'postStepCallback' : $.noop, // A method to call after each step
'template' : { // HTML segments for tip layout
'link' : '<a href="#close" class="joyride-close-tip">X</a>',
'timer' : '<div class="joyride-timer-indicator-wrap"><span class="joyride-timer-indicator"></span></div>',
'tip' : '<div class="joyride-tip-guide"><span class="joyride-nub"></span></div>',
'wrapper' : '<div class="joyride-content-wrapper"></div>',
'button' : '<a href="#" class="small button joyride-next-tip"></a>'
}
},
Modernizr = Modernizr || false,
settings = {},
methods = {
init : function (opts) {
return this.each(function () {
if ($.isEmptyObject(settings)) {
settings = $.extend(defaults, opts);
// non configureable settings
settings.document = window.document;
settings.$document = $(settings.document);
settings.$window = $(window);
settings.$content_el = $(this);
settings.body_offset = $(settings.tipContainer).position();
settings.$tip_content = $('> li', settings.$content_el);
settings.paused = false;
settings.attempts = 0;
settings.tipLocationPatterns = {
top: ['bottom'],
bottom: [], // bottom should not need to be repositioned
left: ['right', 'top', 'bottom'],
right: ['left', 'top', 'bottom']
};
// are we using jQuery 1.7+
methods.jquery_check();
// can we create cookies?
if (!$.isFunction($.cookie)) {
settings.cookieMonster = false;
}
// generate the tips and insert into dom.
if (!settings.cookieMonster || !$.cookie(settings.cookieName)) {
settings.$tip_content.each(function (index) {
methods.create({$li : $(this), index : index});
});
// show first tip
if (!settings.startTimerOnClick && settings.timer > 0) {
methods.show('init');
methods.startTimer();
} else {
methods.show('init');
}
}
settings.$document.on('click.joyride', '.joyride-next-tip, .joyride-modal-bg', function (e) {
e.preventDefault();
if (settings.$li.next().length < 1) {
methods.end();
} else if (settings.timer > 0) {
clearTimeout(settings.automate);
methods.hide();
methods.show();
methods.startTimer();
} else {
methods.hide();
methods.show();
}
});
settings.$document.on('click.joyride', '.joyride-close-tip', function (e) {
e.preventDefault();
methods.end();
});
settings.$window.bind('resize.joyride', function (e) {
if (methods.is_phone()) {
methods.pos_phone();
} else {
methods.pos_default();
}
});
} else {
methods.restart();
}
});
},
// call this method when you want to resume the tour
resume : function () {
methods.set_li();
methods.show();
},
tip_template : function (opts) {
var $blank, content;
opts.tip_class = opts.tip_class || '';
$blank = $(settings.template.tip).addClass(opts.tip_class);
content = $.trim($(opts.li).html()) +
methods.button_text(opts.button_text) +
settings.template.link +
methods.timer_instance(opts.index);
$blank.append($(settings.template.wrapper));
$blank.first().attr('data-index', opts.index);
$('.joyride-content-wrapper', $blank).append(content);
return $blank[0];
},
timer_instance : function (index) {
var txt;
if ((index === 0 && settings.startTimerOnClick && settings.timer > 0) || settings.timer === 0) {
txt = '';
} else {
txt = methods.outerHTML($(settings.template.timer)[0]);
}
return txt;
},
button_text : function (txt) {
if (settings.nextButton) {
txt = $.trim(txt) || 'Next';
txt = methods.outerHTML($(settings.template.button).append(txt)[0]);
} else {
txt = '';
}
return txt;
},
create : function (opts) {
// backwards compatability with data-text attribute
var buttonText = opts.$li.attr('data-button') || opts.$li.attr('data-text'),
tipClass = opts.$li.attr('class'),
$tip_content = $(methods.tip_template({
tip_class : tipClass,
index : opts.index,
button_text : buttonText,
li : opts.$li
}));
$(settings.tipContainer).append($tip_content);
},
show : function (init) {
var opts = {}, ii, opts_arr = [], opts_len = 0, p,
$timer = null;
// are we paused?
if (settings.$li === undefined || ($.inArray(settings.$li.index(), settings.pauseAfter) === -1)) {
// don't go to the next li if the tour was paused
if (settings.paused) {
settings.paused = false;
} else {
methods.set_li(init);
}
settings.attempts = 0;
if (settings.$li.length && settings.$target.length > 0) {
opts_arr = (settings.$li.data('options') || ':').split(';');
opts_len = opts_arr.length;
// parse options
for (ii = opts_len - 1; ii >= 0; ii--) {
p = opts_arr[ii].split(':');
if (p.length === 2) {
opts[$.trim(p[0])] = $.trim(p[1]);
}
}
settings.tipSettings = $.extend({}, settings, opts);
settings.tipSettings.tipLocationPattern = settings.tipLocationPatterns[settings.tipSettings.tipLocation];
// scroll if not modal
if (!/body/i.test(settings.$target.selector)) {
methods.scroll_to();
}
if (methods.is_phone()) {
methods.pos_phone(true);
} else {
methods.pos_default(true);
}
$timer = $('.joyride-timer-indicator', settings.$next_tip);
if (/pop/i.test(settings.tipAnimation)) {
$timer.outerWidth(0);
if (settings.timer > 0) {
settings.$next_tip.show();
$timer.animate({
width: $('.joyride-timer-indicator-wrap', settings.$next_tip).outerWidth()
}, settings.timer);
} else {
settings.$next_tip.show();
}
} else if (/fade/i.test(settings.tipAnimation)) {
$timer.outerWidth(0);
if (settings.timer > 0) {
settings.$next_tip.fadeIn(settings.tipAnimationFadeSpeed);
settings.$next_tip.show();
$timer.animate({
width: $('.joyride-timer-indicator-wrap', settings.$next_tip).outerWidth()
}, settings.timer);
} else {
settings.$next_tip.fadeIn(settings.tipAnimationFadeSpeed);
}
}
settings.$current_tip = settings.$next_tip;
// skip non-existant targets
} else if (settings.$li && settings.$target.length < 1) {
methods.show();
} else {
methods.end();
}
} else {
settings.paused = true;
}
},
// detect phones with media queries if supported.
is_phone : function () {
if (Modernizr) {
return Modernizr.mq('only screen and (max-width: 767px)');
}
return (settings.$window.width() < 767) ? true : false;
},
hide : function () {
settings.postStepCallback(settings.$li.index(), settings.$current_tip);
$('.joyride-modal-bg').hide();
settings.$current_tip.hide();
},
set_li : function (init) {
if (init) {
settings.$li = settings.$tip_content.eq(settings.startOffset);
methods.set_next_tip();
settings.$current_tip = settings.$next_tip;
} else {
settings.$li = settings.$li.next();
methods.set_next_tip();
}
methods.set_target();
},
set_next_tip : function () {
settings.$next_tip = $('.joyride-tip-guide[data-index=' + settings.$li.index() + ']');
},
set_target : function () {
var cl = settings.$li.attr('data-class'),
id = settings.$li.attr('data-id'),
$sel = function () {
if (id) {
return $(settings.document.getElementById(id));
} else if (cl) {
return $('.' + cl).first();
} else {
return $('body');
}
};
settings.$target = $sel();
},
scroll_to : function () {
var window_half, tipOffset;
window_half = settings.$window.height() / 2;
tipOffset = Math.ceil(settings.$target.offset().top - window_half + settings.$next_tip.outerHeight());
$("html, body").stop().animate({
scrollTop: tipOffset
}, settings.scrollSpeed);
},
paused : function () {
if (($.inArray((settings.$li.index() + 1), settings.pauseAfter) === -1)) {
return true;
}
return false;
},
destroy : function () {
settings.$document.off('.joyride');
$(window).off('.joyride');
$('.joyride-close-tip, .joyride-next-tip, .joyride-modal-bg').off('.joyride');
$('.joyride-tip-guide, .joyride-modal-bg').remove();
clearTimeout(settings.automate);
settings = {};
},
restart : function () {
methods.hide();
settings.$li = undefined;
methods.show('init');
},
pos_default : function (init) {
var half_fold = Math.ceil(settings.$window.height() / 2),
tip_position = settings.$next_tip.offset(),
$nub = $('.joyride-nub', settings.$next_tip),
nub_height = Math.ceil($nub.outerHeight() / 2),
toggle = init || false;
// tip must not be "display: none" to calculate position
if (toggle) {
settings.$next_tip.css('visibility', 'hidden');
settings.$next_tip.show();
}
if (!/body/i.test(settings.$target.selector)) {
if (methods.bottom()) {
settings.$next_tip.css({
top: (settings.$target.offset().top + nub_height + settings.$target.outerHeight()),
left: settings.$target.offset().left});
methods.nub_position($nub, settings.tipSettings.nubPosition, 'top');
} else if (methods.top()) {
settings.$next_tip.css({
top: (settings.$target.offset().top - settings.$next_tip.outerHeight() - nub_height),
left: settings.$target.offset().left});
methods.nub_position($nub, settings.tipSettings.nubPosition, 'bottom');
} else if (methods.right()) {
settings.$next_tip.css({
top: settings.$target.offset().top,
left: (settings.$target.outerWidth() + settings.$target.offset().left)});
methods.nub_position($nub, settings.tipSettings.nubPosition, 'left');
} else if (methods.left()) {
settings.$next_tip.css({
top: settings.$target.offset().top,
left: (settings.$target.offset().left - settings.$next_tip.outerWidth() - nub_height)});
methods.nub_position($nub, settings.tipSettings.nubPosition, 'right');
}
if (!methods.visible(methods.corners(settings.$next_tip)) && settings.attempts < settings.tipSettings.tipLocationPattern.length) {
$nub.removeClass('bottom')
.removeClass('top')
.removeClass('right')
.removeClass('left');
settings.tipSettings.tipLocation = settings.tipSettings.tipLocationPattern[settings.attempts];
settings.attempts++;
methods.pos_default(true);
}
} else if (settings.$li.length) {
methods.pos_modal($nub);
}
if (toggle) {
settings.$next_tip.hide();
settings.$next_tip.css('visibility', 'visible');
}
},
pos_phone : function (init) {
var tip_height = settings.$next_tip.outerHeight(),
tip_offset = settings.$next_tip.offset(),
target_height = settings.$target.outerHeight(),
$nub = $('.joyride-nub', settings.$next_tip),
nub_height = Math.ceil($nub.outerHeight() / 2),
toggle = init || false;
$nub.removeClass('bottom')
.removeClass('top')
.removeClass('right')
.removeClass('left');
if (toggle) {
settings.$next_tip.css('visibility', 'hidden');
settings.$next_tip.show();
}
if (!/body/i.test(settings.$target.selector)) {
if (methods.top()) {
settings.$next_tip.offset({top: settings.$target.offset().top - tip_height - nub_height});
$nub.addClass('bottom');
} else {
settings.$next_tip.offset({top: settings.$target.offset().top + target_height + nub_height});
$nub.addClass('top');
}
} else if (settings.$li.length) {
methods.pos_modal($nub);
}
if (toggle) {
settings.$next_tip.hide();
settings.$next_tip.css('visibility', 'visible');
}
},
pos_modal : function ($nub) {
methods.center();
$nub.hide();
if ($('.joyride-modal-bg').length < 1) {
$('body').append('<div class="joyride-modal-bg">').show();
}
if (/pop/i.test(settings.tipAnimation)) {
$('.joyride-modal-bg').show();
} else {
$('.joyride-modal-bg').fadeIn(settings.tipAnimationFadeSpeed);
}
},
center : function () {
var $w = settings.$window;
settings.$next_tip.css({
top : ((($w.height() - settings.$next_tip.outerHeight()) / 2) + $w.scrollTop()),
left : ((($w.width() - settings.$next_tip.outerWidth()) / 2) + $w.scrollLeft())
});
return true;
},
bottom : function () {
return /bottom/i.test(settings.tipSettings.tipLocation);
},
top : function () {
return /top/i.test(settings.tipSettings.tipLocation);
},
right : function () {
return /right/i.test(settings.tipSettings.tipLocation);
},
left : function () {
return /left/i.test(settings.tipSettings.tipLocation);
},
corners : function (el) {
var w = settings.$window,
right = w.width() + w.scrollLeft(),
bottom = w.width() + w.scrollTop();
return [
el.offset().top <= w.scrollTop(),
right <= el.offset().left + el.outerWidth(),
bottom <= el.offset().top + el.outerHeight(),
w.scrollLeft() >= el.offset().left
];
},
visible : function (hidden_corners) {
var i = hidden_corners.length;
while (i--) {
if (hidden_corners[i]) return false;
}
return true;
},
nub_position : function (nub, pos, def) {
if (pos === 'auto') {
nub.addClass(def);
} else {
nub.addClass(pos);
}
},
startTimer : function () {
if (settings.$li.length) {
settings.automate = setTimeout(function () {
methods.hide();
methods.show();
methods.startTimer();
}, settings.timer);
} else {
clearTimeout(settings.automate);
}
},
end : function () {
if (settings.cookieMonster) {
$.cookie(settings.cookieName, 'ridden', { expires: 365, domain: settings.cookieDomain });
}
if (settings.timer > 0) {
clearTimeout(settings.automate);
}
$('.joyride-modal-bg').hide();
settings.$current_tip.hide();
settings.postStepCallback(settings.$li.index(), settings.$current_tip);
settings.postRideCallback(settings.$li.index(), settings.$current_tip);
},
jquery_check : function () {
// define on() and off() for older jQuery
if (!$.isFunction($.fn.on)) {
$.fn.on = function (types, sel, fn) {
return this.delegate(sel, types, fn);
};
$.fn.off = function (types, sel, fn) {
return this.undelegate(sel, types, fn);
};
return false;
}
return true;
},
outerHTML : function (el) {
// support FireFox < 11
return el.outerHTML || new XMLSerializer().serializeToString(el);
},
version : function () {
return settings.version;
}
};
$.fn.joyride = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.joyride');
}
};
}(jQuery, this));

View File

@ -0,0 +1,86 @@
/*
* jQuery Foundation Magellan 0.0.1
* http://foundation.zurb.com
* Copyright 2012, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
/*jslint unparam: true, browser: true, indent: 2 */
;(function ($, window, undefined) {
'use strict';
$.fn.foundationMagellan = function(options) {
var $fixedMagellan = $('[data-magellan-expedition=fixed]'),
defaults = {
threshold: ($fixedMagellan.length) ? $fixedMagellan.outerHeight(true) : 25,
activeClass: 'active'
},
options = $.extend({}, defaults, options);
// Indicate we have arrived at a destination
$(document).on('magellan.arrival', '[data-magellan-arrival]', function(e) {
var $expedition = $(this).closest('[data-magellan-expedition]'),
activeClass = $expedition.attr('data-magellan-active-class') || options.activeClass;
$(this)
.closest('[data-magellan-expedition]')
.find('[data-magellan-arrival]')
.not(this)
.removeClass(activeClass);
$(this).addClass(activeClass);
});
// Set starting point as the current destination
var $expedition = $('[data-magellan-expedition]');
$expedition.find('[data-magellan-arrival]:first')
.addClass($expedition.attr('data-magellan-active-class') || options.activeClass);
// Update fixed position
$fixedMagellan.on('magellan.update-position', function(){
var $el = $(this);
$el.data("magellan-fixed-position","");
$el.data("magellan-top-offset", "");
});
$fixedMagellan.trigger('magellan.update-position');
$(window).on('resize.magellan', function() {
$fixedMagellan.trigger('magellan.update-position');
});
$(window).on('scroll.magellan', function() {
var windowScrollTop = $(window).scrollTop();
$fixedMagellan.each(function() {
var $expedition = $(this);
if ($expedition.data("magellan-top-offset") === "") {
$expedition.data("magellan-top-offset", $expedition.offset().top);
}
var fixed_position = (windowScrollTop + options.threshold) > $expedition.data("magellan-top-offset");
if ($expedition.data("magellan-fixed-position") != fixed_position) {
$expedition.data("magellan-fixed-position", fixed_position);
if (fixed_position) {
$expedition.css({position:"fixed", top:0});
} else {
$expedition.css({position:"", top:""});
}
}
});
});
// Determine when a destination has been reached, ah0y!
$(window).on('scroll.magellan', function(e){
var windowScrollTop = $(window).scrollTop();
$('[data-magellan-destination]').each(function(){
var $destination = $(this),
destination_name = $destination.attr('data-magellan-destination'),
topOffset = $destination.offset().top - windowScrollTop;
if (topOffset <= options.threshold) {
$('[data-magellan-arrival=' + destination_name + ']')
.trigger('magellan.arrival');
}
});
});
};
}(jQuery, this));

View File

@ -0,0 +1,27 @@
;(function ($, window, undefined) {
'use strict';
$.fn.foundationMediaQueryViewer = function (options) {
var settings = $.extend(options,{toggleKey:77}), // Press 'M'
$doc = $(document);
$doc.on("keyup.mediaQueryViewer", ":input", function (e){
if (e.which === settings.toggleKey) {
e.stopPropagation();
}
});
$doc.on("keyup.mediaQueryViewer", function (e) {
var $mqViewer = $('#fqv');
if (e.which === settings.toggleKey) {
if ($mqViewer.length > 0) {
$mqViewer.remove();
} else {
$('body').prepend('<div id="fqv" style="position:fixed;top:4px;left:4px;z-index:999;color:#fff;"><p style="font-size:12px;background:rgba(0,0,0,0.75);padding:5px;margin-bottom:1px;line-height:1.2;"><span class="left">Media:</span> <span style="font-weight:bold;" class="show-for-xlarge">Extra Large</span><span style="font-weight:bold;" class="show-for-large">Large</span><span style="font-weight:bold;" class="show-for-medium">Medium</span><span style="font-weight:bold;" class="show-for-small">Small</span><span style="font-weight:bold;" class="show-for-landscape">Landscape</span><span style="font-weight:bold;" class="show-for-portrait">Portrait</span><span style="font-weight:bold;" class="show-for-touch">Touch</span></p></div>');
}
}
});
};
})(jQuery, this);

View File

@ -0,0 +1,55 @@
;(function ($, window, undefined) {
'use strict';
$.fn.foundationNavigation = function (options) {
var lockNavBar = false;
// Windows Phone, sadly, does not register touch events :(
if (Modernizr.touch || navigator.userAgent.match(/Windows Phone/i)) {
$(document).on('click.fndtn touchstart.fndtn', '.nav-bar a.flyout-toggle', function (e) {
e.preventDefault();
var flyout = $(this).siblings('.flyout').first();
if (lockNavBar === false) {
$('.nav-bar .flyout').not(flyout).slideUp(500);
flyout.slideToggle(500, function () {
lockNavBar = false;
});
}
lockNavBar = true;
});
$('.nav-bar>li.has-flyout', this).addClass('is-touch');
} else {
$('.nav-bar>li.has-flyout', this).on('mouseenter mouseleave', function (e) {
if (e.type == 'mouseenter') {
$('.nav-bar').find('.flyout').hide();
$(this).children('.flyout').show();
}
if (e.type == 'mouseleave') {
var flyout = $(this).children('.flyout'),
inputs = flyout.find('input'),
hasFocus = function (inputs) {
var focus;
if (inputs.length > 0) {
inputs.each(function () {
if ($(this).is(":focus")) {
focus = true;
}
});
return focus;
}
return false;
};
if (!hasFocus(inputs)) {
$(this).children('.flyout').hide();
}
}
});
}
};
})( jQuery, this );

View File

@ -0,0 +1,897 @@
/*
* jQuery Orbit Plugin 1.4.0
* www.ZURB.com/playground
* Copyright 2010, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function ($) {
'use strict';
$.fn.findFirstImage = function () {
return this.first()
.find('img')
.andSelf().filter('img')
.first();
};
var ORBIT = {
defaults: {
animation: 'horizontal-push', // fade, horizontal-slide, vertical-slide, horizontal-push, vertical-push
animationSpeed: 600, // how fast animations are
timer: true, // display timer?
advanceSpeed: 4000, // if timer is enabled, time between transitions
pauseOnHover: false, // if you hover pauses the slider
startClockOnMouseOut: false, // if clock should start on MouseOut
startClockOnMouseOutAfter: 1000, // how long after MouseOut should the timer start again
directionalNav: true, // manual advancing directional navs
directionalNavRightText: 'Right', // text of right directional element for accessibility
directionalNavLeftText: 'Left', // text of left directional element for accessibility
captions: true, // do you want captions?
captionAnimation: 'fade', // fade, slideOpen, none
captionAnimationSpeed: 600, // if so how quickly should they animate in
resetTimerOnClick: false, // true resets the timer instead of pausing slideshow progress on manual navigation
bullets: false, // true or false to activate the bullet navigation
bulletThumbs: false, // thumbnails for the bullets
bulletThumbLocation: '', // relative path to thumbnails from this file
afterSlideChange: $.noop, // callback to execute after slide changes
afterLoadComplete: $.noop, // callback to execute after everything has been loaded
fluid: true,
centerBullets: true, // center bullet nav with js, turn this off if you want to position the bullet nav manually
singleCycle: false, // cycles through orbit slides only once
slideNumber: false, // display slide numbers?
stackOnSmall: false // stack slides on small devices (i.e. phones)
},
activeSlide: 0,
numberSlides: 0,
orbitWidth: null,
orbitHeight: null,
locked: null,
timerRunning: null,
degrees: 0,
wrapperHTML: '<div class="orbit-wrapper" />',
timerHTML: '<div class="timer"><span class="mask"><span class="rotator"></span></span><span class="pause"></span></div>',
captionHTML: '<div class="orbit-caption"></div>',
directionalNavHTML: '<div class="slider-nav hide-for-small"><span class="right"></span><span class="left"></span></div>',
bulletHTML: '<ul class="orbit-bullets"></ul>',
slideNumberHTML: '<span class="orbit-slide-counter"></span>',
init: function (element, options) {
var $imageSlides,
imagesLoadedCount = 0,
self = this;
// Bind functions to correct context
this.clickTimer = $.proxy(this.clickTimer, this);
this.addBullet = $.proxy(this.addBullet, this);
this.resetAndUnlock = $.proxy(this.resetAndUnlock, this);
this.stopClock = $.proxy(this.stopClock, this);
this.startTimerAfterMouseLeave = $.proxy(this.startTimerAfterMouseLeave, this);
this.clearClockMouseLeaveTimer = $.proxy(this.clearClockMouseLeaveTimer, this);
this.rotateTimer = $.proxy(this.rotateTimer, this);
this.options = $.extend({}, this.defaults, options);
if (this.options.timer === 'false') this.options.timer = false;
if (this.options.captions === 'false') this.options.captions = false;
if (this.options.directionalNav === 'false') this.options.directionalNav = false;
this.$element = $(element);
this.$wrapper = this.$element.wrap(this.wrapperHTML).parent();
this.$slides = this.$element.children('img, a, div, figure');
this.$element.on('movestart', function(e) {
// If the movestart is heading off in an upwards or downwards
// direction, prevent it so that the browser scrolls normally.
if ((e.distX > e.distY && e.distX < -e.distY) ||
(e.distX < e.distY && e.distX > -e.distY)) {
e.preventDefault();
}
});
this.$element.bind('orbit.next swipeleft', function () {
self.shift('next');
});
this.$element.bind('orbit.prev swiperight', function () {
self.shift('prev');
});
this.$element.bind('orbit.goto', function (event, index) {
self.shift(index);
});
this.$element.bind('orbit.start', function (event, index) {
self.startClock();
});
this.$element.bind('orbit.stop', function (event, index) {
self.stopClock();
});
$imageSlides = this.$slides.filter('img');
if ($imageSlides.length === 0) {
this.loaded();
} else {
$imageSlides.bind('imageready', function () {
imagesLoadedCount += 1;
if (imagesLoadedCount === $imageSlides.length) {
self.loaded();
}
});
}
},
loaded: function () {
this.$element
.addClass('orbit')
.css({width: '1px', height: '1px'});
if (this.options.stackOnSmall) {
this.$element.addClass('orbit-stack-on-small');
}
this.$slides.addClass('orbit-slide');
this.setDimentionsFromLargestSlide();
this.updateOptionsIfOnlyOneSlide();
this.setupFirstSlide();
this.notifySlideChange();
if (this.options.timer) {
this.setupTimer();
this.startClock();
}
if (this.options.captions) {
this.setupCaptions();
}
if (this.options.directionalNav) {
this.setupDirectionalNav();
}
if (this.options.bullets) {
this.setupBulletNav();
this.setActiveBullet();
}
this.options.afterLoadComplete.call(this);
Holder.run();
},
currentSlide: function () {
return this.$slides.eq(this.activeSlide);
},
notifySlideChange: function() {
if (this.options.slideNumber) {
var txt = (this.activeSlide+1) + ' of ' + this.$slides.length;
this.$element.trigger("orbit.change", {slideIndex: this.activeSlide, slideCount: this.$slides.length});
if (this.$counter === undefined) {
var $counter = $(this.slideNumberHTML).html(txt);
this.$counter = $counter;
this.$wrapper.append(this.$counter);
} else {
this.$counter.html(txt);
}
}
},
setDimentionsFromLargestSlide: function () {
//Collect all slides and set slider size of largest image
var self = this,
$fluidPlaceholder;
self.$element.add(self.$wrapper).width(this.$slides.first().outerWidth());
self.$element.add(self.$wrapper).height(this.$slides.first().height());
self.orbitWidth = this.$slides.first().outerWidth();
self.orbitHeight = this.$slides.first().height();
$fluidPlaceholder = this.$slides.first().findFirstImage().clone();
this.$slides.each(function () {
var slide = $(this),
slideWidth = slide.outerWidth(),
slideHeight = slide.height();
if (slideWidth > self.$element.outerWidth()) {
self.$element.add(self.$wrapper).width(slideWidth);
self.orbitWidth = self.$element.outerWidth();
}
if (slideHeight > self.$element.height()) {
self.$element.add(self.$wrapper).height(slideHeight);
self.orbitHeight = self.$element.height();
$fluidPlaceholder = $(this).findFirstImage().clone();
}
self.numberSlides += 1;
});
if (this.options.fluid) {
if (typeof this.options.fluid === "string") {
// $fluidPlaceholder = $("<img>").attr("src", "http://placehold.it/" + this.options.fluid);
$fluidPlaceholder = $("<img>").attr("data-src", "holder.js/" + this.options.fluid);
//var inner = $("<div/>").css({"display":"inline-block", "width":"2px", "height":"2px"});
//$fluidPlaceholder = $("<div/>").css({"float":"left"});
//$fluidPlaceholder.wrapInner(inner);
//$fluidPlaceholder = $("<div/>").css({"height":"1px", "width":"2px"});
//$fluidPlaceholder = $("<div style='display:inline-block;width:2px;height:1px;'></div>");
}
self.$element.prepend($fluidPlaceholder);
$fluidPlaceholder.addClass('fluid-placeholder');
self.$element.add(self.$wrapper).css({width: 'inherit'});
self.$element.add(self.$wrapper).css({height: 'inherit'});
$(window).bind('resize', function () {
self.orbitWidth = self.$element.outerWidth();
self.orbitHeight = self.$element.height();
});
}
},
//Animation locking functions
lock: function () {
this.locked = true;
},
unlock: function () {
this.locked = false;
},
updateOptionsIfOnlyOneSlide: function () {
if(this.$slides.length === 1) {
this.options.directionalNav = false;
this.options.timer = false;
this.options.bullets = false;
}
},
setupFirstSlide: function () {
//Set initial front photo z-index and fades it in
var self = this;
this.$slides.first()
.css({"z-index" : 3, "opacity" : 1})
.fadeIn(function() {
//brings in all other slides IF css declares a display: none
self.$slides.css({"display":"block"})
});
},
startClock: function () {
var self = this;
if(!this.options.timer) {
return false;
}
if (this.$timer.is(':hidden')) {
this.clock = setInterval(function () {
self.$element.trigger('orbit.next');
}, this.options.advanceSpeed);
} else {
this.timerRunning = true;
this.$pause.removeClass('active');
this.clock = setInterval(this.rotateTimer, this.options.advanceSpeed / 180, false);
}
},
rotateTimer: function (reset) {
var degreeCSS = "rotate(" + this.degrees + "deg)";
this.degrees += 2;
this.$rotator.css({
"-webkit-transform": degreeCSS,
"-moz-transform": degreeCSS,
"-o-transform": degreeCSS,
"-ms-transform": degreeCSS
});
if(this.degrees > 180) {
this.$rotator.addClass('move');
this.$mask.addClass('move');
}
if(this.degrees > 360 || reset) {
this.$rotator.removeClass('move');
this.$mask.removeClass('move');
this.degrees = 0;
this.$element.trigger('orbit.next');
}
},
stopClock: function () {
if (!this.options.timer) {
return false;
} else {
this.timerRunning = false;
clearInterval(this.clock);
this.$pause.addClass('active');
}
},
setupTimer: function () {
this.$timer = $(this.timerHTML);
this.$wrapper.append(this.$timer);
this.$rotator = this.$timer.find('.rotator');
this.$mask = this.$timer.find('.mask');
this.$pause = this.$timer.find('.pause');
this.$timer.click(this.clickTimer);
if (this.options.startClockOnMouseOut) {
this.$wrapper.mouseleave(this.startTimerAfterMouseLeave);
this.$wrapper.mouseenter(this.clearClockMouseLeaveTimer);
}
if (this.options.pauseOnHover) {
this.$wrapper.mouseenter(this.stopClock);
}
},
startTimerAfterMouseLeave: function () {
var self = this;
this.outTimer = setTimeout(function() {
if(!self.timerRunning){
self.startClock();
}
}, this.options.startClockOnMouseOutAfter)
},
clearClockMouseLeaveTimer: function () {
clearTimeout(this.outTimer);
},
clickTimer: function () {
if(!this.timerRunning) {
this.startClock();
} else {
this.stopClock();
}
},
setupCaptions: function () {
this.$caption = $(this.captionHTML);
this.$wrapper.append(this.$caption);
this.setCaption();
},
setCaption: function () {
var captionLocation = this.currentSlide().attr('data-caption'),
captionHTML;
if (!this.options.captions) {
return false;
}
//Set HTML for the caption if it exists
if (captionLocation) {
//if caption text is blank, don't show captions
if ($.trim($(captionLocation).text()).length < 1){
return false;
}
captionHTML = $(captionLocation).html(); //get HTML from the matching HTML entity
this.$caption
.attr('id', captionLocation) // Add ID caption TODO why is the id being set?
.html(captionHTML); // Change HTML in Caption
//Animations for Caption entrances
switch (this.options.captionAnimation) {
case 'none':
this.$caption.show();
break;
case 'fade':
this.$caption.fadeIn(this.options.captionAnimationSpeed);
break;
case 'slideOpen':
this.$caption.slideDown(this.options.captionAnimationSpeed);
break;
}
} else {
//Animations for Caption exits
switch (this.options.captionAnimation) {
case 'none':
this.$caption.hide();
break;
case 'fade':
this.$caption.fadeOut(this.options.captionAnimationSpeed);
break;
case 'slideOpen':
this.$caption.slideUp(this.options.captionAnimationSpeed);
break;
}
}
},
setupDirectionalNav: function () {
var self = this,
$directionalNav = $(this.directionalNavHTML);
$directionalNav.find('.right').html(this.options.directionalNavRightText);
$directionalNav.find('.left').html(this.options.directionalNavLeftText);
this.$wrapper.append($directionalNav);
this.$wrapper.find('.left').click(function () {
self.stopClock();
if (self.options.resetTimerOnClick) {
self.rotateTimer(true);
self.startClock();
}
self.$element.trigger('orbit.prev');
});
this.$wrapper.find('.right').click(function () {
self.stopClock();
if (self.options.resetTimerOnClick) {
self.rotateTimer(true);
self.startClock();
}
self.$element.trigger('orbit.next');
});
},
setupBulletNav: function () {
this.$bullets = $(this.bulletHTML);
this.$wrapper.append(this.$bullets);
this.$slides.each(this.addBullet);
this.$element.addClass('with-bullets');
if (this.options.centerBullets) this.$bullets.css('margin-left', -this.$bullets.outerWidth() / 2);
},
addBullet: function (index, slide) {
var position = index + 1,
$li = $('<li>' + (position) + '</li>'),
thumbName,
self = this;
if (this.options.bulletThumbs) {
thumbName = $(slide).attr('data-thumb');
if (thumbName) {
$li
.addClass('has-thumb')
.css({background: "url(" + this.options.bulletThumbLocation + thumbName + ") no-repeat"});;
}
}
this.$bullets.append($li);
$li.data('index', index);
$li.click(function () {
self.stopClock();
if (self.options.resetTimerOnClick) {
self.rotateTimer(true);
self.startClock();
}
self.$element.trigger('orbit.goto', [$li.data('index')])
});
},
setActiveBullet: function () {
if(!this.options.bullets) { return false; } else {
this.$bullets.find('li')
.removeClass('active')
.eq(this.activeSlide)
.addClass('active');
}
},
resetAndUnlock: function () {
this.$slides
.eq(this.prevActiveSlide)
.css({"z-index" : 1});
this.unlock();
this.options.afterSlideChange.call(this, this.$slides.eq(this.prevActiveSlide), this.$slides.eq(this.activeSlide));
},
shift: function (direction) {
var slideDirection = direction;
//remember previous activeSlide
this.prevActiveSlide = this.activeSlide;
//exit function if bullet clicked is same as the current image
if (this.prevActiveSlide == slideDirection) { return false; }
if (this.$slides.length == "1") { return false; }
if (!this.locked) {
this.lock();
//deduce the proper activeImage
if (direction == "next") {
this.activeSlide++;
if (this.activeSlide == this.numberSlides) {
this.activeSlide = 0;
}
} else if (direction == "prev") {
this.activeSlide--
if (this.activeSlide < 0) {
this.activeSlide = this.numberSlides - 1;
}
} else {
this.activeSlide = direction;
if (this.prevActiveSlide < this.activeSlide) {
slideDirection = "next";
} else if (this.prevActiveSlide > this.activeSlide) {
slideDirection = "prev"
}
}
//set to correct bullet
this.setActiveBullet();
this.notifySlideChange();
//set previous slide z-index to one below what new activeSlide will be
this.$slides
.eq(this.prevActiveSlide)
.css({"z-index" : 2});
//fade
if (this.options.animation == "fade") {
this.$slides
.eq(this.activeSlide)
.css({"opacity" : 0, "z-index" : 3})
.animate({"opacity" : 1}, this.options.animationSpeed, this.resetAndUnlock);
this.$slides
.eq(this.prevActiveSlide)
.animate({"opacity":0}, this.options.animationSpeed);
}
//horizontal-slide
if (this.options.animation == "horizontal-slide") {
if (slideDirection == "next") {
this.$slides
.eq(this.activeSlide)
.css({"left": this.orbitWidth, "z-index" : 3})
.css("opacity", 1)
.animate({"left" : 0}, this.options.animationSpeed, this.resetAndUnlock);
}
if (slideDirection == "prev") {
this.$slides
.eq(this.activeSlide)
.css({"left": -this.orbitWidth, "z-index" : 3})
.css("opacity", 1)
.animate({"left" : 0}, this.options.animationSpeed, this.resetAndUnlock);
}
this.$slides
.eq(this.prevActiveSlide)
.css("opacity", 0);
}
//vertical-slide
if (this.options.animation == "vertical-slide") {
if (slideDirection == "prev") {
this.$slides
.eq(this.activeSlide)
.css({"top": this.orbitHeight, "z-index" : 3})
.css("opacity", 1)
.animate({"top" : 0}, this.options.animationSpeed, this.resetAndUnlock);
this.$slides
.eq(this.prevActiveSlide)
.css("opacity", 0);
}
if (slideDirection == "next") {
this.$slides
.eq(this.activeSlide)
.css({"top": -this.orbitHeight, "z-index" : 3})
.css("opacity", 1)
.animate({"top" : 0}, this.options.animationSpeed, this.resetAndUnlock);
}
this.$slides
.eq(this.prevActiveSlide)
.css("opacity", 0);
}
//horizontal-push
if (this.options.animation == "horizontal-push") {
if (slideDirection == "next") {
this.$slides
.eq(this.activeSlide)
.css({"left": this.orbitWidth, "z-index" : 3})
.animate({"left" : 0, "opacity" : 1}, this.options.animationSpeed, this.resetAndUnlock);
this.$slides
.eq(this.prevActiveSlide)
.animate({"left" : -this.orbitWidth}, this.options.animationSpeed, "", function(){
$(this).css({"opacity" : 0});
});
}
if (slideDirection == "prev") {
this.$slides
.eq(this.activeSlide)
.css({"left": -this.orbitWidth, "z-index" : 3})
.animate({"left" : 0, "opacity" : 1}, this.options.animationSpeed, this.resetAndUnlock);
this.$slides
.eq(this.prevActiveSlide)
.animate({"left" : this.orbitWidth}, this.options.animationSpeed, "", function(){
$(this).css({"opacity" : 0});
});
}
}
//vertical-push
if (this.options.animation == "vertical-push") {
if (slideDirection == "next") {
this.$slides
.eq(this.activeSlide)
.css({top: -this.orbitHeight, "z-index" : 3})
.css("opacity", 1)
.animate({top : 0, "opacity":1}, this.options.animationSpeed, this.resetAndUnlock);
this.$slides
.eq(this.prevActiveSlide)
.css("opacity", 0)
.animate({top : this.orbitHeight}, this.options.animationSpeed, "");
}
if (slideDirection == "prev") {
this.$slides
.eq(this.activeSlide)
.css({top: this.orbitHeight, "z-index" : 3})
.css("opacity", 1)
.animate({top : 0}, this.options.animationSpeed, this.resetAndUnlock);
this.$slides
.eq(this.prevActiveSlide)
.css("opacity", 0)
.animate({top : -this.orbitHeight}, this.options.animationSpeed);
}
}
this.setCaption();
}
if (this.$slides.last() && this.options.singleCycle) {
this.stopClock();
}
}
};
$.fn.orbit = function (options) {
return this.each(function () {
var orbit = $.extend({}, ORBIT);
orbit.init(this, options);
});
};
})(jQuery);
/*!
* jQuery imageready Plugin
* http://www.zurb.com/playground/
*
* Copyright 2011, ZURB
* Released under the MIT License
*/
(function ($) {
var options = {};
$.event.special.imageready = {
setup: function (data, namespaces, eventHandle) {
options = data || options;
},
add: function (handleObj) {
var $this = $(this),
src;
if ( this.nodeType === 1 && this.tagName.toLowerCase() === 'img' && this.src !== '' ) {
if (options.forceLoad) {
src = $this.attr('src');
$this.attr('src', '');
bindToLoad(this, handleObj.handler);
$this.attr('src', src);
} else if ( this.complete || this.readyState === 4 ) {
handleObj.handler.apply(this, arguments);
} else {
bindToLoad(this, handleObj.handler);
}
}
},
teardown: function (namespaces) {
$(this).unbind('.imageready');
}
};
function bindToLoad(element, callback) {
var $this = $(element);
$this.bind('load.imageready', function () {
callback.apply(element, arguments);
$this.unbind('load.imageready');
});
}
}(jQuery));
/*
Holder - 1.3 - client side image placeholders
(c) 2012 Ivan Malopinsky / http://imsky.co
Provided under the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
Commercial use requires attribution.
*/
var Holder = Holder || {};
(function (app, win) {
var preempted = false,
fallback = false,
canvas = document.createElement('canvas');
//http://javascript.nwbox.com/ContentLoaded by Diego Perini with modifications
function contentLoaded(n,t){var l="complete",s="readystatechange",u=!1,h=u,c=!0,i=n.document,a=i.documentElement,e=i.addEventListener?"addEventListener":"attachEvent",v=i.addEventListener?"removeEventListener":"detachEvent",f=i.addEventListener?"":"on",r=function(e){(e.type!=s||i.readyState==l)&&((e.type=="load"?n:i)[v](f+e.type,r,u),!h&&(h=!0)&&t.call(n,null))},o=function(){try{a.doScroll("left")}catch(n){setTimeout(o,50);return}r("poll")};if(i.readyState==l)t.call(n,"lazy");else{if(i.createEventObject&&a.doScroll){try{c=!n.frameElement}catch(y){}c&&o()}i[e](f+"DOMContentLoaded",r,u),i[e](f+s,r,u),n[e](f+"load",r,u)}};
//https://gist.github.com/991057 by Jed Schmidt with modifications
function selector(a){
a=a.match(/^(\W)?(.*)/);var b=document["getElement"+(a[1]?a[1]=="#"?"ById":"sByClassName":"sByTagName")](a[2]);
var ret=[]; b!=null&&(b.length?ret=b:b.length==0?ret=b:ret=[b]); return ret;
}
//shallow object property extend
function extend(a,b){var c={};for(var d in a)c[d]=a[d];for(var e in b)c[e]=b[e];return c}
function draw(ctx, dimensions, template) {
var dimension_arr = [dimensions.height, dimensions.width].sort();
var maxFactor = Math.round(dimension_arr[1] / 16),
minFactor = Math.round(dimension_arr[0] / 16);
var text_height = Math.max(template.size, maxFactor);
canvas.width = dimensions.width;
canvas.height = dimensions.height;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = template.background;
ctx.fillRect(0, 0, dimensions.width, dimensions.height);
ctx.fillStyle = template.foreground;
ctx.font = "bold " + text_height + "px sans-serif";
var text = template.text ? template.text : (dimensions.width + "x" + dimensions.height);
if (Math.round(ctx.measureText(text).width) / dimensions.width > 1) {
text_height = Math.max(minFactor, template.size);
}
ctx.font = "bold " + text_height + "px sans-serif";
ctx.fillText(text, (dimensions.width / 2), (dimensions.height / 2), dimensions.width);
return canvas.toDataURL("image/png");
}
if (!canvas.getContext) {
fallback = true;
} else {
if (canvas.toDataURL("image/png").indexOf("data:image/png") < 0) {
//Android doesn't support data URI
fallback = true;
} else {
var ctx = canvas.getContext("2d");
}
}
var settings = {
domain: "holder.js",
images: "img",
themes: {
"gray": {
background: "#eee",
foreground: "#aaa",
size: 12
},
"social": {
background: "#3a5a97",
foreground: "#fff",
size: 12
},
"industrial": {
background: "#434A52",
foreground: "#C2F200",
size: 12
}
}
};
app.flags = {
dimensions: {
regex: /([0-9]+)x([0-9]+)/,
output: function(val){
var exec = this.regex.exec(val);
return {
width: +exec[1],
height: +exec[2]
}
}
},
colors: {
regex: /#([0-9a-f]{3,})\:#([0-9a-f]{3,})/i,
output: function(val){
var exec = this.regex.exec(val);
return {
size: settings.themes.gray.size,
foreground: "#" + exec[2],
background: "#" + exec[1]
}
}
},
text: {
regex: /text\:(.*)/,
output: function(val){
return this.regex.exec(val)[1];
}
}
}
for(var flag in app.flags){
app.flags[flag].match = function (val){
return val.match(this.regex)
}
}
app.add_theme = function (name, theme) {
name != null && theme != null && (settings.themes[name] = theme);
return app;
};
app.add_image = function (src, el) {
var node = selector(el);
if (node.length) {
for (var i = 0, l = node.length; i < l; i++) {
var img = document.createElement("img")
img.setAttribute("data-src", src);
node[i].appendChild(img);
}
}
return app;
};
app.run = function (o) {
var options = extend(settings, o),
images = selector(options.images),
preempted = true;
for (var l = images.length, i = 0; i < l; i++) {
var theme = settings.themes.gray;
var src = images[i].getAttribute("data-src") || images[i].getAttribute("src");
if ( !! ~src.indexOf(options.domain)) {
var render = false,
dimensions = null,
text = null;
var flags = src.substr(src.indexOf(options.domain) + options.domain.length + 1).split("/");
for (sl = flags.length, j = 0; j < sl; j++) {
if (app.flags.dimensions.match(flags[j])) {
render = true;
dimensions = app.flags.dimensions.output(flags[j]);
} else if (app.flags.colors.match(flags[j])) {
theme = app.flags.colors.output(flags[j]);
} else if (options.themes[flags[j]]) {
//If a theme is specified, it will override custom colors
theme = options.themes[flags[j]];
} else if (app.flags.text.match(flags[j])) {
text = app.flags.text.output(flags[j]);
}
}
if (render) {
images[i].setAttribute("data-src", src);
var dimensions_caption = dimensions.width + "x" + dimensions.height;
images[i].setAttribute("alt", text ? text : theme.text ? theme.text + " [" + dimensions_caption + "]" : dimensions_caption);
// Fallback
// images[i].style.width = dimensions.width + "px";
// images[i].style.height = dimensions.height + "px";
images[i].style.backgroundColor = theme.background;
var theme = (text ? extend(theme, {
text: text
}) : theme);
if (!fallback) {
images[i].setAttribute("src", draw(ctx, dimensions, theme));
}
}
}
}
return app;
};
contentLoaded(win, function () {
preempted || app.run()
})
})(Holder, window);

View File

@ -0,0 +1,794 @@
/*
* jQuery Reveal Plugin 1.1
* www.ZURB.com
* Copyright 2010, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
/*globals jQuery */
(function ($) {
'use strict';
//
// Global variable.
// Helps us determine if the current modal is being queued for display.
//
var modalQueued = false;
//
// Bind the live 'click' event to all anchor elemnets with the data-reveal-id attribute.
//
$(document).on('click', 'a[data-reveal-id]', function ( event ) {
//
// Prevent default action of the event.
//
event.preventDefault();
//
// Get the clicked anchor data-reveal-id attribute value.
//
var modalLocation = $( this ).attr( 'data-reveal-id' );
//
// Find the element with that modalLocation id and call the reveal plugin.
//
$( '#' + modalLocation ).reveal( $( this ).data() );
});
/**
* @module reveal
* @property {Object} [options] Reveal options
*/
$.fn.reveal = function ( options ) {
/*
* Cache the document object.
*/
var $doc = $( document ),
/*
* Default property values.
*/
defaults = {
/**
* Possible options: fade, fadeAndPop, none
*
* @property animation
* @type {String}
* @default fadeAndPop
*/
animation: 'fadeAndPop',
/**
* Speed at which the reveal should show. How fast animtions are.
*
* @property animationSpeed
* @type {Integer}
* @default 300
*/
animationSpeed: 300,
/**
* Should the modal close when the background is clicked?
*
* @property closeOnBackgroundClick
* @type {Boolean}
* @default true
*/
closeOnBackgroundClick: true,
/**
* Specify a class name for the 'close modal' element.
* This element will close an open modal.
*
@example
<a href='#close' class='close-reveal-modal'>Close Me</a>
*
* @property dismissModalClass
* @type {String}
* @default close-reveal-modal
*/
dismissModalClass: 'close-reveal-modal',
/**
* Specify a callback function that triggers 'before' the modal opens.
*
* @property open
* @type {Function}
* @default function(){}
*/
open: $.noop,
/**
* Specify a callback function that triggers 'after' the modal is opened.
*
* @property opened
* @type {Function}
* @default function(){}
*/
opened: $.noop,
/**
* Specify a callback function that triggers 'before' the modal prepares to close.
*
* @property close
* @type {Function}
* @default function(){}
*/
close: $.noop,
/**
* Specify a callback function that triggers 'after' the modal is closed.
*
* @property closed
* @type {Function}
* @default function(){}
*/
closed: $.noop
}
;
//
// Extend the default options.
// This replaces the passed in option (options) values with default values.
//
options = $.extend( {}, defaults, options );
//
// Apply the plugin functionality to each element in the jQuery collection.
//
return this.not('.reveal-modal.open').each( function () {
//
// Cache the modal element
//
var modal = $( this ),
//
// Get the current css 'top' property value in decimal format.
//
topMeasure = parseInt( modal.css( 'top' ), 10 ),
//
// Calculate the top offset.
//
topOffset = modal.height() + topMeasure,
//
// Helps determine if the modal is locked.
// This way we keep the modal from triggering while it's in the middle of animating.
//
locked = false,
//
// Get the modal background element.
//
modalBg = $( '.reveal-modal-bg' ),
//
// Show modal properties
//
cssOpts = {
//
// Used, when we show the modal.
//
open : {
//
// Set the 'top' property to the document scroll minus the calculated top offset.
//
'top': 0,
//
// Opacity gets set to 0.
//
'opacity': 0,
//
// Show the modal
//
'visibility': 'visible',
//
// Ensure it's displayed as a block element.
//
'display': 'block'
},
//
// Used, when we hide the modal.
//
close : {
//
// Set the default 'top' property value.
//
'top': topMeasure,
//
// Has full opacity.
//
'opacity': 1,
//
// Hide the modal
//
'visibility': 'hidden',
//
// Ensure the elment is hidden.
//
'display': 'none'
}
},
//
// Initial closeButton variable.
//
$closeButton
;
//
// Do we have a modal background element?
//
if ( modalBg.length === 0 ) {
//
// No we don't. So, let's create one.
//
modalBg = $( '<div />', { 'class' : 'reveal-modal-bg' } )
//
// Then insert it after the modal element.
//
.insertAfter( modal );
//
// Now, fade it out a bit.
//
modalBg.fadeTo( 'fast', 0.8 );
}
//
// Helper Methods
//
/**
* Unlock the modal for animation.
*
* @method unlockModal
*/
function unlockModal() {
locked = false;
}
/**
* Lock the modal to prevent further animation.
*
* @method lockModal
*/
function lockModal() {
locked = true;
}
/**
* Closes all open modals.
*
* @method closeOpenModal
*/
function closeOpenModals() {
//
// Get all reveal-modal elements with the .open class.
//
var $openModals = $( ".reveal-modal.open" );
//
// Do we have modals to close?
//
if ( $openModals.length === 1 ) {
//
// Set the modals for animation queuing.
//
modalQueued = true;
//
// Trigger the modal close event.
//
$openModals.trigger( "reveal:close" );
}
}
/**
* Animates the modal opening.
* Handles the modal 'open' event.
*
* @method openAnimation
*/
function openAnimation() {
//
// First, determine if we're in the middle of animation.
//
if ( !locked ) {
//
// We're not animating, let's lock the modal for animation.
//
lockModal();
//
// Close any opened modals.
//
closeOpenModals();
//
// Now, add the open class to this modal.
//
modal.addClass( "open" );
//
// Are we executing the 'fadeAndPop' animation?
//
if ( options.animation === "fadeAndPop" ) {
//
// Yes, we're doing the 'fadeAndPop' animation.
// Okay, set the modal css properties.
//
//
// Set the 'top' property to the document scroll minus the calculated top offset.
//
cssOpts.open.top = $doc.scrollTop() - topOffset;
//
// Flip the opacity to 0.
//
cssOpts.open.opacity = 0;
//
// Set the css options.
//
modal.css( cssOpts.open );
//
// Fade in the background element, at half the speed of the modal element.
// So, faster than the modal element.
//
modalBg.fadeIn( options.animationSpeed / 2 );
//
// Let's delay the next animation queue.
// We'll wait until the background element is faded in.
//
modal.delay( options.animationSpeed / 2 )
//
// Animate the following css properties.
//
.animate( {
//
// Set the 'top' property to the document scroll plus the calculated top measure.
//
"top": $doc.scrollTop() + topMeasure + 'px',
//
// Set it to full opacity.
//
"opacity": 1
},
/*
* Fade speed.
*/
options.animationSpeed,
/*
* End of animation callback.
*/
function () {
//
// Trigger the modal reveal:opened event.
// This should trigger the functions set in the options.opened property.
//
modal.trigger( 'reveal:opened' );
}); // end of animate.
} // end if 'fadeAndPop'
//
// Are executing the 'fade' animation?
//
if ( options.animation === "fade" ) {
//
// Yes, were executing 'fade'.
// Okay, let's set the modal properties.
//
cssOpts.open.top = $doc.scrollTop() + topMeasure;
//
// Flip the opacity to 0.
//
cssOpts.open.opacity = 0;
//
// Set the css options.
//
modal.css( cssOpts.open );
//
// Fade in the modal background at half the speed of the modal.
// So, faster than modal.
//
modalBg.fadeIn( options.animationSpeed / 2 );
//
// Delay the modal animation.
// Wait till the modal background is done animating.
//
modal.delay( options.animationSpeed / 2 )
//
// Now animate the modal.
//
.animate( {
//
// Set to full opacity.
//
"opacity": 1
},
/*
* Animation speed.
*/
options.animationSpeed,
/*
* End of animation callback.
*/
function () {
//
// Trigger the modal reveal:opened event.
// This should trigger the functions set in the options.opened property.
//
modal.trigger( 'reveal:opened' );
});
} // end if 'fade'
//
// Are we not animating?
//
if ( options.animation === "none" ) {
//
// We're not animating.
// Okay, let's set the modal css properties.
//
//
// Set the top property.
//
cssOpts.open.top = $doc.scrollTop() + topMeasure;
//
// Set the opacity property to full opacity, since we're not fading (animating).
//
cssOpts.open.opacity = 1;
//
// Set the css property.
//
modal.css( cssOpts.open );
//
// Show the modal Background.
//
modalBg.css( { "display": "block" } );
//
// Trigger the modal opened event.
//
modal.trigger( 'reveal:opened' );
} // end if animating 'none'
}// end if !locked
}// end openAnimation
function openVideos() {
var video = modal.find('.flex-video'),
iframe = video.find('iframe');
if (iframe.length > 0) {
iframe.attr("src", iframe.data("src"));
video.fadeIn(100);
}
}
//
// Bind the reveal 'open' event.
// When the event is triggered, openAnimation is called
// along with any function set in the options.open property.
//
modal.bind( 'reveal:open.reveal', openAnimation );
modal.bind( 'reveal:open.reveal', openVideos);
/**
* Closes the modal element(s)
* Handles the modal 'close' event.
*
* @method closeAnimation
*/
function closeAnimation() {
//
// First, determine if we're in the middle of animation.
//
if ( !locked ) {
//
// We're not animating, let's lock the modal for animation.
//
lockModal();
//
// Clear the modal of the open class.
//
modal.removeClass( "open" );
//
// Are we using the 'fadeAndPop' animation?
//
if ( options.animation === "fadeAndPop" ) {
//
// Yes, okay, let's set the animation properties.
//
modal.animate( {
//
// Set the top property to the document scrollTop minus calculated topOffset.
//
"top": $doc.scrollTop() - topOffset + 'px',
//
// Fade the modal out, by using the opacity property.
//
"opacity": 0
},
/*
* Fade speed.
*/
options.animationSpeed / 2,
/*
* End of animation callback.
*/
function () {
//
// Set the css hidden options.
//
modal.css( cssOpts.close );
});
//
// Is the modal animation queued?
//
if ( !modalQueued ) {
//
// Oh, the modal(s) are mid animating.
// Let's delay the animation queue.
//
modalBg.delay( options.animationSpeed )
//
// Fade out the modal background.
//
.fadeOut(
/*
* Animation speed.
*/
options.animationSpeed,
/*
* End of animation callback.
*/
function () {
//
// Trigger the modal 'closed' event.
// This should trigger any method set in the options.closed property.
//
modal.trigger( 'reveal:closed' );
});
} else {
//
// We're not mid queue.
// Trigger the modal 'closed' event.
// This should trigger any method set in the options.closed propety.
//
modal.trigger( 'reveal:closed' );
} // end if !modalQueued
} // end if animation 'fadeAndPop'
//
// Are we using the 'fade' animation.
//
if ( options.animation === "fade" ) {
//
// Yes, we're using the 'fade' animation.
//
modal.animate( { "opacity" : 0 },
/*
* Animation speed.
*/
options.animationSpeed,
/*
* End of animation callback.
*/
function () {
//
// Set the css close options.
//
modal.css( cssOpts.close );
}); // end animate
//
// Are we mid animating the modal(s)?
//
if ( !modalQueued ) {
//
// Oh, the modal(s) are mid animating.
// Let's delay the animation queue.
//
modalBg.delay( options.animationSpeed )
//
// Let's fade out the modal background element.
//
.fadeOut(
/*
* Animation speed.
*/
options.animationSpeed,
/*
* End of animation callback.
*/
function () {
//
// Trigger the modal 'closed' event.
// This should trigger any method set in the options.closed propety.
//
modal.trigger( 'reveal:closed' );
}); // end fadeOut
} else {
//
// We're not mid queue.
// Trigger the modal 'closed' event.
// This should trigger any method set in the options.closed propety.
//
modal.trigger( 'reveal:closed' );
} // end if !modalQueued
} // end if animation 'fade'
//
// Are we not animating?
//
if ( options.animation === "none" ) {
//
// We're not animating.
// Set the modal close css options.
//
modal.css( cssOpts.close );
//
// Is the modal in the middle of an animation queue?
//
if ( !modalQueued ) {
//
// It's not mid queueu. Just hide it.
//
modalBg.css( { 'display': 'none' } );
}
//
// Trigger the modal 'closed' event.
// This should trigger any method set in the options.closed propety.
//
modal.trigger( 'reveal:closed' );
} // end if not animating
//
// Reset the modalQueued variable.
//
modalQueued = false;
} // end if !locked
} // end closeAnimation
/**
* Destroys the modal and it's events.
*
* @method destroy
*/
function destroy() {
//
// Unbind all .reveal events from the modal.
//
modal.unbind( '.reveal' );
//
// Unbind all .reveal events from the modal background.
//
modalBg.unbind( '.reveal' );
//
// Unbind all .reveal events from the modal 'close' button.
//
$closeButton.unbind( '.reveal' );
//
// Unbind all .reveal events from the body.
//
$( 'body' ).unbind( '.reveal' );
}
function closeVideos() {
var video = modal.find('.flex-video'),
iframe = video.find('iframe');
if (iframe.length > 0) {
iframe.data("src", iframe.attr("src"));
iframe.attr("src", "");
video.fadeOut(100);
}
}
//
// Bind the modal 'close' event
//
modal.bind( 'reveal:close.reveal', closeAnimation );
modal.bind( 'reveal:closed.reveal', closeVideos );
//
// Bind the modal 'opened' + 'closed' event
// Calls the unlockModal method.
//
modal.bind( 'reveal:opened.reveal reveal:closed.reveal', unlockModal );
//
// Bind the modal 'closed' event.
// Calls the destroy method.
//
modal.bind( 'reveal:closed.reveal', destroy );
//
// Bind the modal 'open' event
// Handled by the options.open property function.
//
modal.bind( 'reveal:open.reveal', options.open );
//
// Bind the modal 'opened' event.
// Handled by the options.opened property function.
//
modal.bind( 'reveal:opened.reveal', options.opened );
//
// Bind the modal 'close' event.
// Handled by the options.close property function.
//
modal.bind( 'reveal:close.reveal', options.close );
//
// Bind the modal 'closed' event.
// Handled by the options.closed property function.
//
modal.bind( 'reveal:closed.reveal', options.closed );
//
// We're running this for the first time.
// Trigger the modal 'open' event.
//
modal.trigger( 'reveal:open' );
//
// Get the closeButton variable element(s).
//
$closeButton = $( '.' + options.dismissModalClass )
//
// Bind the element 'click' event and handler.
//
.bind( 'click.reveal', function () {
//
// Trigger the modal 'close' event.
//
modal.trigger( 'reveal:close' );
});
//
// Should we close the modal background on click?
//
if ( options.closeOnBackgroundClick ) {
//
// Yes, close the modal background on 'click'
// Set the modal background css 'cursor' propety to pointer.
// Adds a pointer symbol when you mouse over the modal background.
//
modalBg.css( { "cursor": "pointer" } );
//
// Bind a 'click' event handler to the modal background.
//
modalBg.bind( 'click.reveal', function () {
//
// Trigger the modal 'close' event.
//
modal.trigger( 'reveal:close' );
});
}
//
// Bind keyup functions on the body element.
// We'll want to close the modal when the 'escape' key is hit.
//
$( 'body' ).bind( 'keyup.reveal', function ( event ) {
//
// Did the escape key get triggered?
//
if ( event.which === 27 ) { // 27 is the keycode for the Escape key
//
// Escape key was triggered.
// Trigger the modal 'close' event.
//
modal.trigger( 'reveal:close' );
}
}); // end $(body)
}); // end this.each
}; // end $.fn
} ( jQuery ) );

View File

@ -0,0 +1,56 @@
;(function ($, window, document, undefined) {
'use strict';
var settings = {
callback: $.noop,
init: false
},
methods = {
init : function (options) {
settings = $.extend({}, options, settings);
return this.each(function () {
if (!settings.init) methods.events();
});
},
events : function () {
$(document).on('click.fndtn', '.tabs a', function (e) {
methods.set_tab($(this).parent('dd, li'), e);
});
settings.init = true;
},
set_tab : function ($tab, e) {
var $activeTab = $tab.closest('dl, ul').find('.active'),
target = $tab.children('a').attr("href"),
hasHash = /^#/.test(target),
$content = $(target + 'Tab');
if (hasHash && $content.length > 0) {
// Show tab content
e.preventDefault();
$content.closest('.tabs-content').children('li').removeClass('active').hide();
$content.css('display', 'block').addClass('active');
}
// Make active tab
$activeTab.removeClass('active');
$tab.addClass('active');
settings.callback();
}
}
$.fn.foundationTabs = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.foundationTooltips');
}
};
}(jQuery, this, this.document));

View File

@ -0,0 +1,193 @@
/*
* jQuery Foundation Tooltips 2.0.1
* http://foundation.zurb.com
* Copyright 2012, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
/*jslint unparam: true, browser: true, indent: 2 */
;(function ($, window, undefined) {
'use strict';
var settings = {
bodyHeight : 0,
selector : '.has-tip',
tooltipClass : '.tooltip',
tipTemplate : function (selector, content) {
return '<span data-selector="' + selector + '" class="' + settings.tooltipClass.substring(1) + '">' + content + '<span class="nub"></span></span>';
}
},
methods = {
init : function (options) {
settings = $.extend(settings, options);
// alias the old targetClass option
settings.selector = settings.targetClass ? settings.targetClass : settings.selector;
return this.each(function () {
var $body = $('body');
if (Modernizr.touch) {
$body.on('click.tooltip touchstart.tooltip touchend.tooltip', settings.selector, function (e) {
e.preventDefault();
$(settings.tooltipClass).hide();
methods.showOrCreateTip($(this));
});
$body.on('click.tooltip touchstart.tooltip touchend.tooltip', settings.tooltipClass, function (e) {
e.preventDefault();
$(this).fadeOut(150);
});
} else {
$body.on('mouseenter.tooltip mouseleave.tooltip', settings.selector, function (e) {
var $this = $(this);
if (e.type === 'mouseenter') {
methods.showOrCreateTip($this);
} else if (e.type === 'mouseleave') {
methods.hide($this);
}
});
}
$(this).data('tooltips', true);
});
},
showOrCreateTip : function ($target) {
var $tip = methods.getTip($target);
if ($tip && $tip.length > 0) {
methods.show($target);
} else {
methods.create($target);
}
},
getTip : function ($target) {
var selector = methods.selector($target),
tip = null;
if (selector) {
tip = $('span[data-selector=' + selector + ']' + settings.tooltipClass);
}
return (tip.length > 0) ? tip : false;
},
selector : function ($target) {
var id = $target.attr('id'),
dataSelector = $target.data('selector');
if (id === undefined && dataSelector === undefined) {
dataSelector = 'tooltip' + Math.random().toString(36).substring(7);
$target.attr('data-selector', dataSelector);
}
return (id) ? id : dataSelector;
},
create : function ($target) {
var $tip = $(settings.tipTemplate(methods.selector($target), $('<div>').html($target.attr('title')).html())),
classes = methods.inheritable_classes($target);
$tip.addClass(classes).appendTo('body');
if (Modernizr.touch) {
$tip.append('<span class="tap-to-close">tap to close </span>');
}
$target.removeAttr('title');
methods.show($target);
},
reposition : function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, column, objPos;
tip.css('visibility', 'hidden').show();
width = target.data('width');
nub = tip.children('.nub');
nubHeight = nub.outerHeight();
nubWidth = nub.outerWidth();
objPos = function (obj, top, right, bottom, left, width) {
return obj.css({
'top' : top,
'bottom' : bottom,
'left' : left,
'right' : right,
'width' : (width) ? width : 'auto'
}).end();
};
objPos(tip, (target.offset().top + target.outerHeight() + 10), 'auto', 'auto', target.offset().left, width);
objPos(nub, -nubHeight, 'auto', 'auto', 10);
if ($(window).width() < 767) {
column = target.closest('.columns');
if (column.length < 0) {
// if not using Foundation
column = $('body');
}
tip.width(column.outerWidth() - 25).css('left', 15).addClass('tip-override');
objPos(nub, -nubHeight, 'auto', 'auto', target.offset().left);
} else {
if (classes && classes.indexOf('tip-top') > -1) {
objPos(tip, (target.offset().top - tip.outerHeight() - nubHeight), 'auto', 'auto', target.offset().left, width)
.removeClass('tip-override');
objPos(nub, 'auto', 'auto', -nubHeight, 'auto');
} else if (classes && classes.indexOf('tip-left') > -1) {
objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight), 'auto', 'auto', (target.offset().left - tip.outerWidth() - 10), width)
.removeClass('tip-override');
objPos(nub, (tip.outerHeight() / 2) - (nubHeight / 2), -nubHeight, 'auto', 'auto');
} else if (classes && classes.indexOf('tip-right') > -1) {
objPos(tip, (target.offset().top + (target.outerHeight() / 2) - nubHeight), 'auto', 'auto', (target.offset().left + target.outerWidth() + 10), width)
.removeClass('tip-override');
objPos(nub, (tip.outerHeight() / 2) - (nubHeight / 2), 'auto', 'auto', -nubHeight);
}
}
tip.css('visibility', 'visible').hide();
},
inheritable_classes : function (target) {
var inheritables = ['tip-top', 'tip-left', 'tip-bottom', 'tip-right', 'noradius'],
classes = target.attr('class'),
filtered = classes ? $.map(classes.split(' '), function (el, i) {
if ($.inArray(el, inheritables) !== -1) {
return el;
}
}).join(' ') : '';
return $.trim(filtered);
},
show : function ($target) {
var $tip = methods.getTip($target);
methods.reposition($target, $tip, $target.attr('class'));
$tip.fadeIn(150);
},
hide : function ($target) {
var $tip = methods.getTip($target);
$tip.fadeOut(150);
},
reload : function () {
var $self = $(this);
return ($self.data('tooltips')) ? $self.foundationTooltips('destroy').foundationTooltips('init') : $self.foundationTooltips('init');
},
destroy : function () {
return this.each(function () {
$(window).off('.tooltip');
$(settings.selector).off('.tooltip');
$(settings.tooltipClass).each(function (i) {
$($(settings.selector).get(i)).attr('title', $(this).text());
}).remove();
});
}
};
$.fn.foundationTooltips = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.foundationTooltips');
}
};
}(jQuery, this));

View File

@ -0,0 +1,156 @@
/*
* jQuery Foundation Top Bar 2.0.2
* http://foundation.zurb.com
* Copyright 2012, ZURB
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
/*jslint unparam: true, browser: true, indent: 2 */
;(function ($, window, undefined) {
'use strict';
var settings = {
index : 0,
initialized : false
},
methods = {
init : function (options) {
return this.each(function () {
settings = $.extend(settings, options);
settings.$w = $(window),
settings.$topbar = $('nav.top-bar'),
settings.$section = settings.$topbar.find('section'),
settings.$titlebar = settings.$topbar.children('ul:first');
var breakpoint = $("<div class='top-bar-js-breakpoint'/>").appendTo("body");
settings.breakPoint = breakpoint.width();
breakpoint.remove();
if (!settings.initialized) {
methods.assemble();
settings.initialized = true;
}
if (!settings.height) {
methods.largestUL();
}
if (settings.$topbar.parent().hasClass('fixed')) {
$('body').css('padding-top',settings.$topbar.outerHeight())
}
$('.top-bar .toggle-topbar').die('click.fndtn').live('click.fndtn', function (e) {
e.preventDefault();
if (methods.breakpoint()) {
settings.$topbar.toggleClass('expanded');
settings.$topbar.css('min-height', '');
}
if (!settings.$topbar.hasClass('expanded')) {
settings.$section.css({left: '0%'});
settings.$section.find('>.name').css({left: '100%'});
settings.$section.find('li.moved').removeClass('moved');
settings.index = 0;
}
});
// Show the Dropdown Levels on Click
$('.top-bar .has-dropdown>a').die('click.fndtn').live('click.fndtn', function (e) {
if (Modernizr.touch || methods.breakpoint())
e.preventDefault();
if (methods.breakpoint()) {
var $this = $(this),
$selectedLi = $this.closest('li'),
$nextLevelUl = $selectedLi.children('ul'),
$nextLevelUlHeight = 0,
$largestUl;
settings.index += 1;
$selectedLi.addClass('moved');
settings.$section.css({left: -(100 * settings.index) + '%'});
settings.$section.find('>.name').css({left: 100 * settings.index + '%'});
$this.siblings('ul').height(settings.height + settings.$titlebar.outerHeight(true));
settings.$topbar.css('min-height', settings.height + settings.$titlebar.outerHeight(true) * 2)
}
});
$(window).on('resize.fndtn.topbar',function() {
if (!methods.breakpoint()) {
settings.$topbar.css('min-height', '');
}
});
// Go up a level on Click
$('.top-bar .has-dropdown .back').die('click.fndtn').live('click.fndtn', function (e) {
e.preventDefault();
var $this = $(this),
$movedLi = $this.closest('li.moved'),
$previousLevelUl = $movedLi.parent();
settings.index -= 1;
settings.$section.css({left: -(100 * settings.index) + '%'});
settings.$section.find('>.name').css({'left': 100 * settings.index + '%'});
if (settings.index === 0) {
settings.$topbar.css('min-height', 0);
}
setTimeout(function () {
$movedLi.removeClass('moved');
}, 300);
});
});
},
breakpoint : function () {
return settings.$w.width() < settings.breakPoint;
},
assemble : function () {
// Pull element out of the DOM for manipulation
settings.$section.detach();
settings.$section.find('.has-dropdown>a').each(function () {
var $link = $(this),
$dropdown = $link.siblings('.dropdown'),
$titleLi = $('<li class="title back js-generated"><h5><a href="#"></a></h5></li>');
// Copy link to subnav
$titleLi.find('h5>a').html($link.html());
$dropdown.prepend($titleLi);
});
// Put element back in the DOM
settings.$section.appendTo(settings.$topbar);
},
largestUL : function () {
var uls = settings.$topbar.find('section ul ul'),
largest = uls.first(),
total = 0;
uls.each(function () {
if ($(this).children('li').length > largest.children('li').length) {
largest = $(this);
}
});
largest.children('li').each(function () { total += $(this).outerHeight(true); });
settings.height = total;
}
};
$.fn.foundationTopBar = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.foundationTopBar');
}
};
}(jQuery, this));

9440
view/theme/blogng/javascripts/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,157 @@
/*! http://mths.be/placeholder v2.0.7 by @mathias */
;(function(window, document, $) {
var isInputSupported = 'placeholder' in document.createElement('input'),
isTextareaSupported = 'placeholder' in document.createElement('textarea'),
prototype = $.fn,
valHooks = $.valHooks,
hooks,
placeholder;
if (isInputSupported && isTextareaSupported) {
placeholder = prototype.placeholder = function() {
return this;
};
placeholder.input = placeholder.textarea = true;
} else {
placeholder = prototype.placeholder = function() {
var $this = this;
$this
.filter((isInputSupported ? 'textarea' : ':input') + '[placeholder]')
.not('.placeholder')
.bind({
'focus.placeholder': clearPlaceholder,
'blur.placeholder': setPlaceholder
})
.data('placeholder-enabled', true)
.trigger('blur.placeholder');
return $this;
};
placeholder.input = isInputSupported;
placeholder.textarea = isTextareaSupported;
hooks = {
'get': function(element) {
var $element = $(element);
return $element.data('placeholder-enabled') && $element.hasClass('placeholder') ? '' : element.value;
},
'set': function(element, value) {
var $element = $(element);
if (!$element.data('placeholder-enabled')) {
return element.value = value;
}
if (value == '') {
element.value = value;
// Issue #56: Setting the placeholder causes problems if the element continues to have focus.
if (element != document.activeElement) {
// We can't use `triggerHandler` here because of dummy text/password inputs :(
setPlaceholder.call(element);
}
} else if ($element.hasClass('placeholder')) {
clearPlaceholder.call(element, true, value) || (element.value = value);
} else {
element.value = value;
}
// `set` can not return `undefined`; see http://jsapi.info/jquery/1.7.1/val#L2363
return $element;
}
};
isInputSupported || (valHooks.input = hooks);
isTextareaSupported || (valHooks.textarea = hooks);
$(function() {
// Look for forms
$(document).delegate('form', 'submit.placeholder', function() {
// Clear the placeholder values so they don't get submitted
var $inputs = $('.placeholder', this).each(clearPlaceholder);
setTimeout(function() {
$inputs.each(setPlaceholder);
}, 10);
});
});
// Clear placeholder values upon page reload
$(window).bind('beforeunload.placeholder', function() {
$('.placeholder').each(function() {
this.value = '';
});
});
}
function args(elem) {
// Return an object of element attributes
var newAttrs = {},
rinlinejQuery = /^jQuery\d+$/;
$.each(elem.attributes, function(i, attr) {
if (attr.specified && !rinlinejQuery.test(attr.name)) {
newAttrs[attr.name] = attr.value;
}
});
return newAttrs;
}
function clearPlaceholder(event, value) {
var input = this,
$input = $(input);
if (input.value == $input.attr('placeholder') && $input.hasClass('placeholder')) {
if ($input.data('placeholder-password')) {
$input = $input.hide().next().show().attr('id', $input.removeAttr('id').data('placeholder-id'));
// If `clearPlaceholder` was called from `$.valHooks.input.set`
if (event === true) {
return $input[0].value = value;
}
$input.focus();
} else {
input.value = '';
$input.removeClass('placeholder');
input == document.activeElement && input.select();
}
}
}
function setPlaceholder() {
var $replacement,
input = this,
$input = $(input),
$origInput = $input,
id = this.id;
if (input.value == '') {
if (input.type == 'password') {
if (!$input.data('placeholder-textinput')) {
try {
$replacement = $input.clone().attr({ 'type': 'text' });
} catch(e) {
$replacement = $('<input>').attr($.extend(args(this), { 'type': 'text' }));
}
$replacement
.removeAttr('name')
.data({
'placeholder-password': true,
'placeholder-id': id
})
.bind('focus.placeholder', clearPlaceholder);
$input
.data({
'placeholder-textinput': $replacement,
'placeholder-id': id
})
.before($replacement);
}
$input = $input.removeAttr('id').hide().prev().attr('id', id).show();
// Note: `$input[0] != input` now!
}
$input.addClass('placeholder');
$input[0].value = $input.attr('placeholder');
} else {
$input.removeClass('placeholder');
}
}
}(this, document, jQuery));

View File

@ -0,0 +1,85 @@
// Knockout JavaScript library v2.2.0
// (c) Steven Sanderson - http://knockoutjs.com/
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
(function() {function i(v){throw v;}var l=!0,n=null,q=!1;function t(v){return function(){return v}};var w=window,x=document,fa=navigator,E=window.jQuery,H=void 0;
function K(v){function ga(a,d,c,e,f){var g=[],a=b.j(function(){var a=d(c,f)||[];0<g.length&&(b.a.Xa(L(g),a),e&&b.r.K(e,n,[c,a,f]));g.splice(0,g.length);b.a.P(g,a)},n,{W:a,Ja:function(){return 0==g.length||!b.a.X(g[0])}});return{M:g,j:a.oa()?a:H}}function L(a){for(;a.length&&!b.a.X(a[0]);)a.splice(0,1);if(1<a.length){for(var d=a[0],c=a[a.length-1],e=[d];d!==c;){d=d.nextSibling;if(!d)return;e.push(d)}Array.prototype.splice.apply(a,[0,a.length].concat(e))}return a}function R(a,b,c,e,f){var g=Math.min,
h=Math.max,j=[],k,m=a.length,p,r=b.length,u=r-m||1,F=m+r+1,I,z,y;for(k=0;k<=m;k++){z=I;j.push(I=[]);y=g(r,k+u);for(p=h(0,k-1);p<=y;p++)I[p]=p?k?a[k-1]===b[p-1]?z[p-1]:g(z[p]||F,I[p-1]||F)+1:p+1:k+1}g=[];h=[];u=[];k=m;for(p=r;k||p;)r=j[k][p]-1,p&&r===j[k][p-1]?h.push(g[g.length]={status:c,value:b[--p],index:p}):k&&r===j[k-1][p]?u.push(g[g.length]={status:e,value:a[--k],index:k}):(g.push({status:"retained",value:b[--p]}),--k);if(h.length&&u.length)for(var a=10*m,s,b=c=0;(f||b<a)&&(s=h[c]);c++){for(e=
0;j=u[e];e++)if(s.value===j.value){s.moved=j.index;j.moved=s.index;u.splice(e,1);b=e=0;break}b+=e}return g.reverse()}function S(a,d,c,e,f){var f=f||{},g=a&&M(a),g=g&&g.ownerDocument,h=f.templateEngine||N;b.ya.ub(c,h,g);c=h.renderTemplate(c,e,f,g);("number"!=typeof c.length||0<c.length&&"number"!=typeof c[0].nodeType)&&i(Error("Template engine must return an array of DOM nodes"));g=q;switch(d){case "replaceChildren":b.e.N(a,c);g=l;break;case "replaceNode":b.a.Xa(a,c);g=l;break;case "ignoreTargetNode":break;
default:i(Error("Unknown renderMode: "+d))}g&&(T(c,e),f.afterRender&&b.r.K(f.afterRender,n,[c,e.$data]));return c}function M(a){return a.nodeType?a:0<a.length?a[0]:n}function T(a,d){if(a.length){var c=a[0],e=a[a.length-1];U(c,e,function(a){b.Ca(d,a)});U(c,e,function(a){b.s.hb(a,[d])})}}function U(a,d,c){for(var e,d=b.e.nextSibling(d);a&&(e=a)!==d;)a=b.e.nextSibling(e),(1===e.nodeType||8===e.nodeType)&&c(e)}function V(a,d,c){for(var a=b.g.aa(a),e=b.g.Q,f=0;f<a.length;f++){var g=a[f].key;if(e.hasOwnProperty(g)){var h=
e[g];"function"===typeof h?(g=h(a[f].value))&&i(Error(g)):h||i(Error("This template engine does not support the '"+g+"' binding within its templates"))}}a="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+b.g.ba(a)+" } })()})";return c.createJavaScriptEvaluatorBlock(a)+d}function W(a,d,c,e){function f(a){return function(){return j[a]}}function g(){return j}var h=0,j,k;b.j(function(){var m=c&&c instanceof b.z?c:new b.z(b.a.d(c)),p=m.$data;e&&b.cb(a,m);if(j=("function"==typeof d?
d(m,a):d)||b.J.instance.getBindings(a,m)){if(0===h){h=1;for(var r in j){var u=b.c[r];u&&8===a.nodeType&&!b.e.I[r]&&i(Error("The binding '"+r+"' cannot be used with virtual elements"));if(u&&"function"==typeof u.init&&(u=(0,u.init)(a,f(r),g,p,m))&&u.controlsDescendantBindings)k!==H&&i(Error("Multiple bindings ("+k+" and "+r+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.")),k=r}h=2}if(2===h)for(r in j)(u=b.c[r])&&"function"==
typeof u.update&&(0,u.update)(a,f(r),g,p,m)}},n,{W:a});return{Mb:k===H}}function X(a,d,c){var e=l,f=1===d.nodeType;f&&b.e.Sa(d);if(f&&c||b.J.instance.nodeHasBindings(d))e=W(d,n,a,c).Mb;e&&Y(a,d,!f)}function Y(a,d,c){for(var e=b.e.firstChild(d);d=e;)e=b.e.nextSibling(d),X(a,d,c)}function Z(a,b){var c=$(a,b);return c?0<c.length?c[c.length-1].nextSibling:a.nextSibling:n}function $(a,b){for(var c=a,e=1,f=[];c=c.nextSibling;){if(G(c)&&(e--,0===e))return f;f.push(c);A(c)&&e++}b||i(Error("Cannot find closing comment tag to match: "+
a.nodeValue));return n}function G(a){return 8==a.nodeType&&(J?a.text:a.nodeValue).match(ha)}function A(a){return 8==a.nodeType&&(J?a.text:a.nodeValue).match(ia)}function O(a,b){for(var c=n;a!=c;)c=a,a=a.replace(ja,function(a,c){return b[c]});return a}function ka(){var a=[],d=[];this.save=function(c,e){var f=b.a.i(a,c);0<=f?d[f]=e:(a.push(c),d.push(e))};this.get=function(c){c=b.a.i(a,c);return 0<=c?d[c]:H}}function aa(a,b,c){function e(e){var g=b(a[e]);switch(typeof g){case "boolean":case "number":case "string":case "function":f[e]=
g;break;case "object":case "undefined":var h=c.get(g);f[e]=h!==H?h:aa(g,b,c)}}c=c||new ka;a=b(a);if(!("object"==typeof a&&a!==n&&a!==H&&!(a instanceof Date)))return a;var f=a instanceof Array?[]:{};c.save(a,f);var g=a;if(g instanceof Array){for(var h=0;h<g.length;h++)e(h);"function"==typeof g.toJSON&&e("toJSON")}else for(h in g)e(h);return f}function ba(a,d){if(a)if(8==a.nodeType){var c=b.s.Ta(a.nodeValue);c!=n&&d.push({rb:a,Eb:c})}else if(1==a.nodeType)for(var c=0,e=a.childNodes,f=e.length;c<f;c++)ba(e[c],
d)}function P(a,d,c,e){b.c[a]={init:function(a){b.a.f.set(a,ca,{});return{controlsDescendantBindings:l}},update:function(a,g,h,j,k){var h=b.a.f.get(a,ca),g=b.a.d(g()),j=!c!==!g,m=!h.Ya;if(m||d||j!==h.pb)m&&(h.Ya=b.a.Ha(b.e.childNodes(a),l)),j?(m||b.e.N(a,b.a.Ha(h.Ya)),b.Da(e?e(k,g):k,a)):b.e.Y(a),h.pb=j}};b.g.Q[a]=q;b.e.I[a]=l}function da(a,d,c){c&&d!==b.k.q(a)&&b.k.T(a,d);d!==b.k.q(a)&&b.r.K(b.a.Aa,n,[a,"change"])}var b="undefined"!==typeof v?v:{};b.b=function(a,d){for(var c=a.split("."),e=b,f=0;f<
c.length-1;f++)e=e[c[f]];e[c[c.length-1]]=d};b.p=function(a,b,c){a[b]=c};b.version="2.2.0";b.b("version",b.version);b.a=new function(){function a(a,d){if("input"!==b.a.u(a)||!a.type||"click"!=d.toLowerCase())return q;var c=a.type;return"checkbox"==c||"radio"==c}var d=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,c={},e={};c[/Firefox\/2/i.test(fa.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];c.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");
for(var f in c){var g=c[f];if(g.length)for(var h=0,j=g.length;h<j;h++)e[g[h]]=f}var k={propertychange:l},m,c=3;f=x.createElement("div");for(g=f.getElementsByTagName("i");f.innerHTML="<\!--[if gt IE "+ ++c+"]><i></i><![endif]--\>",g[0];);m=4<c?c:H;return{Ma:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],o:function(a,b){for(var d=0,c=a.length;d<c;d++)b(a[d])},i:function(a,b){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var d=0,c=a.length;d<
c;d++)if(a[d]===b)return d;return-1},kb:function(a,b,d){for(var c=0,e=a.length;c<e;c++)if(b.call(d,a[c]))return a[c];return n},ga:function(a,d){var c=b.a.i(a,d);0<=c&&a.splice(c,1)},Fa:function(a){for(var a=a||[],d=[],c=0,e=a.length;c<e;c++)0>b.a.i(d,a[c])&&d.push(a[c]);return d},V:function(a,b){for(var a=a||[],d=[],c=0,e=a.length;c<e;c++)d.push(b(a[c]));return d},fa:function(a,b){for(var a=a||[],d=[],c=0,e=a.length;c<e;c++)b(a[c])&&d.push(a[c]);return d},P:function(a,b){if(b instanceof Array)a.push.apply(a,
b);else for(var d=0,c=b.length;d<c;d++)a.push(b[d]);return a},extend:function(a,b){if(b)for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a},ka:function(a){for(;a.firstChild;)b.removeNode(a.firstChild)},Gb:function(a){for(var a=b.a.L(a),d=x.createElement("div"),c=0,e=a.length;c<e;c++)d.appendChild(b.A(a[c]));return d},Ha:function(a,d){for(var c=0,e=a.length,g=[];c<e;c++){var f=a[c].cloneNode(l);g.push(d?b.A(f):f)}return g},N:function(a,d){b.a.ka(a);if(d)for(var c=0,e=d.length;c<e;c++)a.appendChild(d[c])},
Xa:function(a,d){var c=a.nodeType?[a]:a;if(0<c.length){for(var e=c[0],g=e.parentNode,f=0,h=d.length;f<h;f++)g.insertBefore(d[f],e);f=0;for(h=c.length;f<h;f++)b.removeNode(c[f])}},ab:function(a,b){7>m?a.setAttribute("selected",b):a.selected=b},D:function(a){return(a||"").replace(d,"")},Qb:function(a,d){for(var c=[],e=(a||"").split(d),f=0,g=e.length;f<g;f++){var h=b.a.D(e[f]);""!==h&&c.push(h)}return c},Nb:function(a,b){a=a||"";return b.length>a.length?q:a.substring(0,b.length)===b},sb:function(a,b){if(b.compareDocumentPosition)return 16==
(b.compareDocumentPosition(a)&16);for(;a!=n;){if(a==b)return l;a=a.parentNode}return q},X:function(a){return b.a.sb(a,a.ownerDocument)},u:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},n:function(b,d,c){var e=m&&k[d];if(!e&&"undefined"!=typeof E){if(a(b,d))var f=c,c=function(a,b){var d=this.checked;b&&(this.checked=b.mb!==l);f.call(this,a);this.checked=d};E(b).bind(d,c)}else!e&&"function"==typeof b.addEventListener?b.addEventListener(d,c,q):"undefined"!=typeof b.attachEvent?b.attachEvent("on"+
d,function(a){c.call(b,a)}):i(Error("Browser doesn't support addEventListener or attachEvent"))},Aa:function(b,d){(!b||!b.nodeType)&&i(Error("element must be a DOM node when calling triggerEvent"));if("undefined"!=typeof E){var c=[];a(b,d)&&c.push({mb:b.checked});E(b).trigger(d,c)}else"function"==typeof x.createEvent?"function"==typeof b.dispatchEvent?(c=x.createEvent(e[d]||"HTMLEvents"),c.initEvent(d,l,l,w,0,0,0,0,0,q,q,q,q,0,b),b.dispatchEvent(c)):i(Error("The supplied element doesn't support dispatchEvent")):
"undefined"!=typeof b.fireEvent?(a(b,d)&&(b.checked=b.checked!==l),b.fireEvent("on"+d)):i(Error("Browser doesn't support triggering events"))},d:function(a){return b.$(a)?a():a},ta:function(a){return b.$(a)?a.t():a},da:function(a,d,c){if(d){var e=/[\w-]+/g,f=a.className.match(e)||[];b.a.o(d.match(e),function(a){var d=b.a.i(f,a);0<=d?c||f.splice(d,1):c&&f.push(a)});a.className=f.join(" ")}},bb:function(a,d){var c=b.a.d(d);if(c===n||c===H)c="";if(3===a.nodeType)a.data=c;else{var e=b.e.firstChild(a);
!e||3!=e.nodeType||b.e.nextSibling(e)?b.e.N(a,[x.createTextNode(c)]):e.data=c;b.a.vb(a)}},$a:function(a,b){a.name=b;if(7>=m)try{a.mergeAttributes(x.createElement("<input name='"+a.name+"'/>"),q)}catch(d){}},vb:function(a){9<=m&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},tb:function(a){if(9<=m){var b=a.style.width;a.style.width=0;a.style.width=b}},Kb:function(a,d){for(var a=b.a.d(a),d=b.a.d(d),c=[],e=a;e<=d;e++)c.push(e);return c},L:function(a){for(var b=[],d=0,c=a.length;d<
c;d++)b.push(a[d]);return b},Ob:6===m,Pb:7===m,Z:m,Na:function(a,d){for(var c=b.a.L(a.getElementsByTagName("input")).concat(b.a.L(a.getElementsByTagName("textarea"))),e="string"==typeof d?function(a){return a.name===d}:function(a){return d.test(a.name)},f=[],g=c.length-1;0<=g;g--)e(c[g])&&f.push(c[g]);return f},Hb:function(a){return"string"==typeof a&&(a=b.a.D(a))?w.JSON&&w.JSON.parse?w.JSON.parse(a):(new Function("return "+a))():n},wa:function(a,d,c){("undefined"==typeof JSON||"undefined"==typeof JSON.stringify)&&
i(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js"));return JSON.stringify(b.a.d(a),d,c)},Ib:function(a,d,c){var c=c||{},e=c.params||{},f=c.includeFields||this.Ma,g=a;if("object"==typeof a&&"form"===b.a.u(a))for(var g=a.action,h=f.length-1;0<=h;h--)for(var j=b.a.Na(a,f[h]),k=j.length-1;0<=k;k--)e[j[k].name]=j[k].value;var d=b.a.d(d),m=x.createElement("form");
m.style.display="none";m.action=g;m.method="post";for(var v in d)a=x.createElement("input"),a.name=v,a.value=b.a.wa(b.a.d(d[v])),m.appendChild(a);for(v in e)a=x.createElement("input"),a.name=v,a.value=e[v],m.appendChild(a);x.body.appendChild(m);c.submitter?c.submitter(m):m.submit();setTimeout(function(){m.parentNode.removeChild(m)},0)}}};b.b("utils",b.a);b.b("utils.arrayForEach",b.a.o);b.b("utils.arrayFirst",b.a.kb);b.b("utils.arrayFilter",b.a.fa);b.b("utils.arrayGetDistinctValues",b.a.Fa);b.b("utils.arrayIndexOf",
b.a.i);b.b("utils.arrayMap",b.a.V);b.b("utils.arrayPushAll",b.a.P);b.b("utils.arrayRemoveItem",b.a.ga);b.b("utils.extend",b.a.extend);b.b("utils.fieldsIncludedWithJsonPost",b.a.Ma);b.b("utils.getFormFields",b.a.Na);b.b("utils.peekObservable",b.a.ta);b.b("utils.postJson",b.a.Ib);b.b("utils.parseJson",b.a.Hb);b.b("utils.registerEventHandler",b.a.n);b.b("utils.stringifyJson",b.a.wa);b.b("utils.range",b.a.Kb);b.b("utils.toggleDomNodeCssClass",b.a.da);b.b("utils.triggerEvent",b.a.Aa);b.b("utils.unwrapObservable",
b.a.d);Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Array.prototype.slice.call(arguments),a=c.shift();return function(){return b.apply(a,c.concat(Array.prototype.slice.call(arguments)))}});b.a.f=new function(){var a=0,d="__ko__"+(new Date).getTime(),c={};return{get:function(a,d){var c=b.a.f.getAll(a,q);return c===H?H:c[d]},set:function(a,d,c){c===H&&b.a.f.getAll(a,q)===H||(b.a.f.getAll(a,l)[d]=c)},getAll:function(b,f){var g=b[d];if(!g||!("null"!==g&&c[g])){if(!f)return H;
g=b[d]="ko"+a++;c[g]={}}return c[g]},clear:function(a){var b=a[d];return b?(delete c[b],a[d]=n,l):q}}};b.b("utils.domData",b.a.f);b.b("utils.domData.clear",b.a.f.clear);b.a.F=new function(){function a(a,d){var e=b.a.f.get(a,c);e===H&&d&&(e=[],b.a.f.set(a,c,e));return e}function d(c){var e=a(c,q);if(e)for(var e=e.slice(0),j=0;j<e.length;j++)e[j](c);b.a.f.clear(c);"function"==typeof E&&"function"==typeof E.cleanData&&E.cleanData([c]);if(f[c.nodeType])for(e=c.firstChild;c=e;)e=c.nextSibling,8===c.nodeType&&
d(c)}var c="__ko_domNodeDisposal__"+(new Date).getTime(),e={1:l,8:l,9:l},f={1:l,9:l};return{Ba:function(b,d){"function"!=typeof d&&i(Error("Callback must be a function"));a(b,l).push(d)},Wa:function(d,e){var f=a(d,q);f&&(b.a.ga(f,e),0==f.length&&b.a.f.set(d,c,H))},A:function(a){if(e[a.nodeType]&&(d(a),f[a.nodeType])){var c=[];b.a.P(c,a.getElementsByTagName("*"));for(var j=0,k=c.length;j<k;j++)d(c[j])}return a},removeNode:function(a){b.A(a);a.parentNode&&a.parentNode.removeChild(a)}}};b.A=b.a.F.A;
b.removeNode=b.a.F.removeNode;b.b("cleanNode",b.A);b.b("removeNode",b.removeNode);b.b("utils.domNodeDisposal",b.a.F);b.b("utils.domNodeDisposal.addDisposeCallback",b.a.F.Ba);b.b("utils.domNodeDisposal.removeDisposeCallback",b.a.F.Wa);b.a.sa=function(a){var d;if("undefined"!=typeof E){if((d=E.clean([a]))&&d[0]){for(a=d[0];a.parentNode&&11!==a.parentNode.nodeType;)a=a.parentNode;a.parentNode&&a.parentNode.removeChild(a)}}else{var c=b.a.D(a).toLowerCase();d=x.createElement("div");c=c.match(/^<(thead|tbody|tfoot)/)&&
[1,"<table>","</table>"]||!c.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!c.indexOf("<td")||!c.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];a="ignored<div>"+c[1]+a+c[2]+"</div>";for("function"==typeof w.innerShiv?d.appendChild(w.innerShiv(a)):d.innerHTML=a;c[0]--;)d=d.lastChild;d=b.a.L(d.lastChild.childNodes)}return d};b.a.ca=function(a,d){b.a.ka(a);d=b.a.d(d);if(d!==n&&d!==H)if("string"!=typeof d&&(d=d.toString()),"undefined"!=typeof E)E(a).html(d);else for(var c=
b.a.sa(d),e=0;e<c.length;e++)a.appendChild(c[e])};b.b("utils.parseHtmlFragment",b.a.sa);b.b("utils.setHtml",b.a.ca);var Q={};b.s={qa:function(a){"function"!=typeof a&&i(Error("You can only pass a function to ko.memoization.memoize()"));var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);Q[b]=a;return"<\!--[ko_memo:"+b+"]--\>"},gb:function(a,b){var c=Q[a];c===H&&i(Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized."));
try{return c.apply(n,b||[]),l}finally{delete Q[a]}},hb:function(a,d){var c=[];ba(a,c);for(var e=0,f=c.length;e<f;e++){var g=c[e].rb,h=[g];d&&b.a.P(h,d);b.s.gb(c[e].Eb,h);g.nodeValue="";g.parentNode&&g.parentNode.removeChild(g)}},Ta:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:n}};b.b("memoization",b.s);b.b("memoization.memoize",b.s.qa);b.b("memoization.unmemoize",b.s.gb);b.b("memoization.parseMemoText",b.s.Ta);b.b("memoization.unmemoizeDomNodeAndDescendants",b.s.hb);b.La={throttle:function(a,
d){a.throttleEvaluation=d;var c=n;return b.j({read:a,write:function(b){clearTimeout(c);c=setTimeout(function(){a(b)},d)}})},notify:function(a,d){a.equalityComparer="always"==d?t(q):b.m.fn.equalityComparer;return a}};b.b("extenders",b.La);b.eb=function(a,d,c){this.target=a;this.ha=d;this.qb=c;b.p(this,"dispose",this.B)};b.eb.prototype.B=function(){this.Bb=l;this.qb()};b.S=function(){this.w={};b.a.extend(this,b.S.fn);b.p(this,"subscribe",this.xa);b.p(this,"extend",this.extend);b.p(this,"getSubscriptionsCount",
this.xb)};b.S.fn={xa:function(a,d,c){var c=c||"change",a=d?a.bind(d):a,e=new b.eb(this,a,function(){b.a.ga(this.w[c],e)}.bind(this));this.w[c]||(this.w[c]=[]);this.w[c].push(e);return e},notifySubscribers:function(a,d){d=d||"change";this.w[d]&&b.r.K(function(){b.a.o(this.w[d].slice(0),function(b){b&&b.Bb!==l&&b.ha(a)})},this)},xb:function(){var a=0,b;for(b in this.w)this.w.hasOwnProperty(b)&&(a+=this.w[b].length);return a},extend:function(a){var d=this;if(a)for(var c in a){var e=b.La[c];"function"==
typeof e&&(d=e(d,a[c]))}return d}};b.Pa=function(a){return"function"==typeof a.xa&&"function"==typeof a.notifySubscribers};b.b("subscribable",b.S);b.b("isSubscribable",b.Pa);var B=[];b.r={lb:function(a){B.push({ha:a,Ka:[]})},end:function(){B.pop()},Va:function(a){b.Pa(a)||i(Error("Only subscribable things can act as dependencies"));if(0<B.length){var d=B[B.length-1];d&&!(0<=b.a.i(d.Ka,a))&&(d.Ka.push(a),d.ha(a))}},K:function(a,b,c){try{return B.push(n),a.apply(b,c||[])}finally{B.pop()}}};var la={undefined:l,
"boolean":l,number:l,string:l};b.m=function(a){function d(){if(0<arguments.length){if(!d.equalityComparer||!d.equalityComparer(c,arguments[0]))d.H(),c=arguments[0],d.G();return this}b.r.Va(d);return c}var c=a;b.S.call(d);d.t=function(){return c};d.G=function(){d.notifySubscribers(c)};d.H=function(){d.notifySubscribers(c,"beforeChange")};b.a.extend(d,b.m.fn);b.p(d,"peek",d.t);b.p(d,"valueHasMutated",d.G);b.p(d,"valueWillMutate",d.H);return d};b.m.fn={equalityComparer:function(a,b){return a===n||typeof a in
la?a===b:q}};var D=b.m.Jb="__ko_proto__";b.m.fn[D]=b.m;b.la=function(a,d){return a===n||a===H||a[D]===H?q:a[D]===d?l:b.la(a[D],d)};b.$=function(a){return b.la(a,b.m)};b.Qa=function(a){return"function"==typeof a&&a[D]===b.m||"function"==typeof a&&a[D]===b.j&&a.yb?l:q};b.b("observable",b.m);b.b("isObservable",b.$);b.b("isWriteableObservable",b.Qa);b.R=function(a){0==arguments.length&&(a=[]);a!==n&&(a!==H&&!("length"in a))&&i(Error("The argument passed when initializing an observable array must be an array, or null, or undefined."));
var d=b.m(a);b.a.extend(d,b.R.fn);return d};b.R.fn={remove:function(a){for(var b=this.t(),c=[],e="function"==typeof a?a:function(b){return b===a},f=0;f<b.length;f++){var g=b[f];e(g)&&(0===c.length&&this.H(),c.push(g),b.splice(f,1),f--)}c.length&&this.G();return c},removeAll:function(a){if(a===H){var d=this.t(),c=d.slice(0);this.H();d.splice(0,d.length);this.G();return c}return!a?[]:this.remove(function(d){return 0<=b.a.i(a,d)})},destroy:function(a){var b=this.t(),c="function"==typeof a?a:function(b){return b===
a};this.H();for(var e=b.length-1;0<=e;e--)c(b[e])&&(b[e]._destroy=l);this.G()},destroyAll:function(a){return a===H?this.destroy(t(l)):!a?[]:this.destroy(function(d){return 0<=b.a.i(a,d)})},indexOf:function(a){var d=this();return b.a.i(d,a)},replace:function(a,b){var c=this.indexOf(a);0<=c&&(this.H(),this.t()[c]=b,this.G())}};b.a.o("pop push reverse shift sort splice unshift".split(" "),function(a){b.R.fn[a]=function(){var b=this.t();this.H();b=b[a].apply(b,arguments);this.G();return b}});b.a.o(["slice"],
function(a){b.R.fn[a]=function(){var b=this();return b[a].apply(b,arguments)}});b.b("observableArray",b.R);b.j=function(a,d,c){function e(){b.a.o(y,function(a){a.B()});y=[]}function f(){var a=h.throttleEvaluation;a&&0<=a?(clearTimeout(s),s=setTimeout(g,a)):g()}function g(){if(!p)if(m&&v())z();else{p=l;try{var a=b.a.V(y,function(a){return a.target});b.r.lb(function(c){var d;0<=(d=b.a.i(a,c))?a[d]=H:y.push(c.xa(f))});for(var c=r.call(d),e=a.length-1;0<=e;e--)a[e]&&y.splice(e,1)[0].B();m=l;h.notifySubscribers(k,
"beforeChange");k=c}finally{b.r.end()}h.notifySubscribers(k);p=q;y.length||z()}}function h(){if(0<arguments.length)return"function"===typeof u?u.apply(d,arguments):i(Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.")),this;m||g();b.r.Va(h);return k}function j(){return!m||0<y.length}var k,m=q,p=q,r=a;r&&"object"==typeof r?(c=r,r=c.read):(c=c||{},r||(r=c.read));"function"!=typeof r&&i(Error("Pass a function that returns the value of the ko.computed"));
var u=c.write,F=c.disposeWhenNodeIsRemoved||c.W||n,v=c.disposeWhen||c.Ja||t(q),z=e,y=[],s=n;d||(d=c.owner);h.t=function(){m||g();return k};h.wb=function(){return y.length};h.yb="function"===typeof c.write;h.B=function(){z()};h.oa=j;b.S.call(h);b.a.extend(h,b.j.fn);b.p(h,"peek",h.t);b.p(h,"dispose",h.B);b.p(h,"isActive",h.oa);b.p(h,"getDependenciesCount",h.wb);c.deferEvaluation!==l&&g();if(F&&j()){z=function(){b.a.F.Wa(F,arguments.callee);e()};b.a.F.Ba(F,z);var C=v,v=function(){return!b.a.X(F)||C()}}return h};
b.Ab=function(a){return b.la(a,b.j)};v=b.m.Jb;b.j[v]=b.m;b.j.fn={};b.j.fn[v]=b.j;b.b("dependentObservable",b.j);b.b("computed",b.j);b.b("isComputed",b.Ab);b.fb=function(a){0==arguments.length&&i(Error("When calling ko.toJS, pass the object you want to convert."));return aa(a,function(a){for(var c=0;b.$(a)&&10>c;c++)a=a();return a})};b.toJSON=function(a,d,c){a=b.fb(a);return b.a.wa(a,d,c)};b.b("toJS",b.fb);b.b("toJSON",b.toJSON);b.k={q:function(a){switch(b.a.u(a)){case "option":return a.__ko__hasDomDataOptionValue__===
l?b.a.f.get(a,b.c.options.ra):7>=b.a.Z?a.getAttributeNode("value").specified?a.value:a.text:a.value;case "select":return 0<=a.selectedIndex?b.k.q(a.options[a.selectedIndex]):H;default:return a.value}},T:function(a,d){switch(b.a.u(a)){case "option":switch(typeof d){case "string":b.a.f.set(a,b.c.options.ra,H);"__ko__hasDomDataOptionValue__"in a&&delete a.__ko__hasDomDataOptionValue__;a.value=d;break;default:b.a.f.set(a,b.c.options.ra,d),a.__ko__hasDomDataOptionValue__=l,a.value="number"===typeof d?
d:""}break;case "select":for(var c=a.options.length-1;0<=c;c--)if(b.k.q(a.options[c])==d){a.selectedIndex=c;break}break;default:if(d===n||d===H)d="";a.value=d}}};b.b("selectExtensions",b.k);b.b("selectExtensions.readValue",b.k.q);b.b("selectExtensions.writeValue",b.k.T);var ja=/\@ko_token_(\d+)\@/g,ma=["true","false"],na=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i;b.g={Q:[],aa:function(a){var d=b.a.D(a);if(3>d.length)return[];"{"===d.charAt(0)&&(d=d.substring(1,d.length-1));for(var a=[],
c=n,e,f=0;f<d.length;f++){var g=d.charAt(f);if(c===n)switch(g){case '"':case "'":case "/":c=f,e=g}else if(g==e&&"\\"!==d.charAt(f-1)){g=d.substring(c,f+1);a.push(g);var h="@ko_token_"+(a.length-1)+"@",d=d.substring(0,c)+h+d.substring(f+1),f=f-(g.length-h.length),c=n}}e=c=n;for(var j=0,k=n,f=0;f<d.length;f++){g=d.charAt(f);if(c===n)switch(g){case "{":c=f;k=g;e="}";break;case "(":c=f;k=g;e=")";break;case "[":c=f,k=g,e="]"}g===k?j++:g===e&&(j--,0===j&&(g=d.substring(c,f+1),a.push(g),h="@ko_token_"+(a.length-
1)+"@",d=d.substring(0,c)+h+d.substring(f+1),f-=g.length-h.length,c=n))}e=[];d=d.split(",");c=0;for(f=d.length;c<f;c++)j=d[c],k=j.indexOf(":"),0<k&&k<j.length-1?(g=j.substring(k+1),e.push({key:O(j.substring(0,k),a),value:O(g,a)})):e.push({unknown:O(j,a)});return e},ba:function(a){for(var d="string"===typeof a?b.g.aa(a):a,c=[],a=[],e,f=0;e=d[f];f++)if(0<c.length&&c.push(","),e.key){var g;a:{g=e.key;var h=b.a.D(g);switch(h.length&&h.charAt(0)){case "'":case '"':break a;default:g="'"+h+"'"}}e=e.value;
c.push(g);c.push(":");c.push(e);e=b.a.D(e);0<=b.a.i(ma,b.a.D(e).toLowerCase())?e=q:(h=e.match(na),e=h===n?q:h[1]?"Object("+h[1]+")"+h[2]:e);e&&(0<a.length&&a.push(", "),a.push(g+" : function(__ko_value) { "+e+" = __ko_value; }"))}else e.unknown&&c.push(e.unknown);d=c.join("");0<a.length&&(d=d+", '_ko_property_writers' : { "+a.join("")+" } ");return d},Db:function(a,d){for(var c=0;c<a.length;c++)if(b.a.D(a[c].key)==d)return l;return q},ea:function(a,d,c,e,f){if(!a||!b.Qa(a)){if((a=d()._ko_property_writers)&&
a[c])a[c](e)}else(!f||a.t()!==e)&&a(e)}};b.b("expressionRewriting",b.g);b.b("expressionRewriting.bindingRewriteValidators",b.g.Q);b.b("expressionRewriting.parseObjectLiteral",b.g.aa);b.b("expressionRewriting.preProcessBindings",b.g.ba);b.b("jsonExpressionRewriting",b.g);b.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",b.g.ba);var J="<\!--test--\>"===x.createComment("test").text,ia=J?/^<\!--\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*--\>$/:/^\s*ko(?:\s+(.+\s*\:[\s\S]*))?\s*$/,ha=J?/^<\!--\s*\/ko\s*--\>$/:
/^\s*\/ko\s*$/,oa={ul:l,ol:l};b.e={I:{},childNodes:function(a){return A(a)?$(a):a.childNodes},Y:function(a){if(A(a))for(var a=b.e.childNodes(a),d=0,c=a.length;d<c;d++)b.removeNode(a[d]);else b.a.ka(a)},N:function(a,d){if(A(a)){b.e.Y(a);for(var c=a.nextSibling,e=0,f=d.length;e<f;e++)c.parentNode.insertBefore(d[e],c)}else b.a.N(a,d)},Ua:function(a,b){A(a)?a.parentNode.insertBefore(b,a.nextSibling):a.firstChild?a.insertBefore(b,a.firstChild):a.appendChild(b)},Oa:function(a,d,c){c?A(a)?a.parentNode.insertBefore(d,
c.nextSibling):c.nextSibling?a.insertBefore(d,c.nextSibling):a.appendChild(d):b.e.Ua(a,d)},firstChild:function(a){return!A(a)?a.firstChild:!a.nextSibling||G(a.nextSibling)?n:a.nextSibling},nextSibling:function(a){A(a)&&(a=Z(a));return a.nextSibling&&G(a.nextSibling)?n:a.nextSibling},ib:function(a){return(a=A(a))?a[1]:n},Sa:function(a){if(oa[b.a.u(a)]){var d=a.firstChild;if(d){do if(1===d.nodeType){var c;c=d.firstChild;var e=n;if(c){do if(e)e.push(c);else if(A(c)){var f=Z(c,l);f?c=f:e=[c]}else G(c)&&
(e=[c]);while(c=c.nextSibling)}if(c=e){e=d.nextSibling;for(f=0;f<c.length;f++)e?a.insertBefore(c[f],e):a.appendChild(c[f])}}while(d=d.nextSibling)}}}};b.b("virtualElements",b.e);b.b("virtualElements.allowedBindings",b.e.I);b.b("virtualElements.emptyNode",b.e.Y);b.b("virtualElements.insertAfter",b.e.Oa);b.b("virtualElements.prepend",b.e.Ua);b.b("virtualElements.setDomNodeChildren",b.e.N);b.J=function(){this.Ga={}};b.a.extend(b.J.prototype,{nodeHasBindings:function(a){switch(a.nodeType){case 1:return a.getAttribute("data-bind")!=
n;case 8:return b.e.ib(a)!=n;default:return q}},getBindings:function(a,b){var c=this.getBindingsString(a,b);return c?this.parseBindingsString(c,b,a):n},getBindingsString:function(a){switch(a.nodeType){case 1:return a.getAttribute("data-bind");case 8:return b.e.ib(a);default:return n}},parseBindingsString:function(a,d,c){try{var e;if(!(e=this.Ga[a])){var f=this.Ga,g="with($context){with($data||{}){return{"+b.g.ba(a)+"}}}";e=f[a]=new Function("$context","$element",g)}return e(d,c)}catch(h){i(Error("Unable to parse bindings.\nMessage: "+
h+";\nBindings value: "+a))}}});b.J.instance=new b.J;b.b("bindingProvider",b.J);b.c={};b.z=function(a,d,c){d?(b.a.extend(this,d),this.$parentContext=d,this.$parent=d.$data,this.$parents=(d.$parents||[]).slice(0),this.$parents.unshift(this.$parent)):(this.$parents=[],this.$root=a,this.ko=b);this.$data=a;c&&(this[c]=a)};b.z.prototype.createChildContext=function(a,d){return new b.z(a,this,d)};b.z.prototype.extend=function(a){var d=b.a.extend(new b.z,this);return b.a.extend(d,a)};b.cb=function(a,d){if(2==
arguments.length)b.a.f.set(a,"__ko_bindingContext__",d);else return b.a.f.get(a,"__ko_bindingContext__")};b.Ea=function(a,d,c){1===a.nodeType&&b.e.Sa(a);return W(a,d,c,l)};b.Da=function(a,b){(1===b.nodeType||8===b.nodeType)&&Y(a,b,l)};b.Ca=function(a,b){b&&(1!==b.nodeType&&8!==b.nodeType)&&i(Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node"));b=b||w.document.body;X(a,b,l)};b.ja=function(a){switch(a.nodeType){case 1:case 8:var d=b.cb(a);if(d)return d;
if(a.parentNode)return b.ja(a.parentNode)}return H};b.ob=function(a){return(a=b.ja(a))?a.$data:H};b.b("bindingHandlers",b.c);b.b("applyBindings",b.Ca);b.b("applyBindingsToDescendants",b.Da);b.b("applyBindingsToNode",b.Ea);b.b("contextFor",b.ja);b.b("dataFor",b.ob);var ea={"class":"className","for":"htmlFor"};b.c.attr={update:function(a,d){var c=b.a.d(d())||{},e;for(e in c)if("string"==typeof e){var f=b.a.d(c[e]),g=f===q||f===n||f===H;g&&a.removeAttribute(e);8>=b.a.Z&&e in ea?(e=ea[e],g?a.removeAttribute(e):
a[e]=f):g||a.setAttribute(e,f.toString());"name"===e&&b.a.$a(a,g?"":f.toString())}}};b.c.checked={init:function(a,d,c){b.a.n(a,"click",function(){var e;if("checkbox"==a.type)e=a.checked;else if("radio"==a.type&&a.checked)e=a.value;else return;var f=d(),g=b.a.d(f);"checkbox"==a.type&&g instanceof Array?(e=b.a.i(g,a.value),a.checked&&0>e?f.push(a.value):!a.checked&&0<=e&&f.splice(e,1)):b.g.ea(f,c,"checked",e,l)});"radio"==a.type&&!a.name&&b.c.uniqueName.init(a,t(l))},update:function(a,d){var c=b.a.d(d());
"checkbox"==a.type?a.checked=c instanceof Array?0<=b.a.i(c,a.value):c:"radio"==a.type&&(a.checked=a.value==c)}};b.c.css={update:function(a,d){var c=b.a.d(d());if("object"==typeof c)for(var e in c){var f=b.a.d(c[e]);b.a.da(a,e,f)}else c=String(c||""),b.a.da(a,a.__ko__cssValue,q),a.__ko__cssValue=c,b.a.da(a,c,l)}};b.c.enable={update:function(a,d){var c=b.a.d(d());c&&a.disabled?a.removeAttribute("disabled"):!c&&!a.disabled&&(a.disabled=l)}};b.c.disable={update:function(a,d){b.c.enable.update(a,function(){return!b.a.d(d())})}};
b.c.event={init:function(a,d,c,e){var f=d()||{},g;for(g in f)(function(){var f=g;"string"==typeof f&&b.a.n(a,f,function(a){var g,m=d()[f];if(m){var p=c();try{var r=b.a.L(arguments);r.unshift(e);g=m.apply(e,r)}finally{g!==l&&(a.preventDefault?a.preventDefault():a.returnValue=q)}p[f+"Bubble"]===q&&(a.cancelBubble=l,a.stopPropagation&&a.stopPropagation())}})})()}};b.c.foreach={Ra:function(a){return function(){var d=a(),c=b.a.ta(d);if(!c||"number"==typeof c.length)return{foreach:d,templateEngine:b.C.na};
b.a.d(d);return{foreach:c.data,as:c.as,includeDestroyed:c.includeDestroyed,afterAdd:c.afterAdd,beforeRemove:c.beforeRemove,afterRender:c.afterRender,beforeMove:c.beforeMove,afterMove:c.afterMove,templateEngine:b.C.na}}},init:function(a,d){return b.c.template.init(a,b.c.foreach.Ra(d))},update:function(a,d,c,e,f){return b.c.template.update(a,b.c.foreach.Ra(d),c,e,f)}};b.g.Q.foreach=q;b.e.I.foreach=l;b.c.hasfocus={init:function(a,d,c){function e(e){a.__ko_hasfocusUpdating=l;var f=a.ownerDocument;"activeElement"in
f&&(e=f.activeElement===a);f=d();b.g.ea(f,c,"hasfocus",e,l);a.__ko_hasfocusUpdating=q}var f=e.bind(n,l),g=e.bind(n,q);b.a.n(a,"focus",f);b.a.n(a,"focusin",f);b.a.n(a,"blur",g);b.a.n(a,"focusout",g)},update:function(a,d){var c=b.a.d(d());a.__ko_hasfocusUpdating||(c?a.focus():a.blur(),b.r.K(b.a.Aa,n,[a,c?"focusin":"focusout"]))}};b.c.html={init:function(){return{controlsDescendantBindings:l}},update:function(a,d){b.a.ca(a,d())}};var ca="__ko_withIfBindingData";P("if");P("ifnot",q,l);P("with",l,q,function(a,
b){return a.createChildContext(b)});b.c.options={update:function(a,d,c){"select"!==b.a.u(a)&&i(Error("options binding applies only to SELECT elements"));for(var e=0==a.length,f=b.a.V(b.a.fa(a.childNodes,function(a){return a.tagName&&"option"===b.a.u(a)&&a.selected}),function(a){return b.k.q(a)||a.innerText||a.textContent}),g=a.scrollTop,h=b.a.d(d());0<a.length;)b.A(a.options[0]),a.remove(0);if(h){var c=c(),j=c.optionsIncludeDestroyed;"number"!=typeof h.length&&(h=[h]);if(c.optionsCaption){var k=x.createElement("option");
b.a.ca(k,c.optionsCaption);b.k.T(k,H);a.appendChild(k)}for(var d=0,m=h.length;d<m;d++){var p=h[d];if(!p||!p._destroy||j){var k=x.createElement("option"),r=function(a,b,c){var d=typeof b;return"function"==d?b(a):"string"==d?a[b]:c},u=r(p,c.optionsValue,p);b.k.T(k,b.a.d(u));p=r(p,c.optionsText,u);b.a.bb(k,p);a.appendChild(k)}}h=a.getElementsByTagName("option");d=j=0;for(m=h.length;d<m;d++)0<=b.a.i(f,b.k.q(h[d]))&&(b.a.ab(h[d],l),j++);a.scrollTop=g;e&&"value"in c&&da(a,b.a.ta(c.value),l);b.a.tb(a)}}};
b.c.options.ra="__ko.optionValueDomData__";b.c.selectedOptions={init:function(a,d,c){b.a.n(a,"change",function(){var e=d(),f=[];b.a.o(a.getElementsByTagName("option"),function(a){a.selected&&f.push(b.k.q(a))});b.g.ea(e,c,"value",f)})},update:function(a,d){"select"!=b.a.u(a)&&i(Error("values binding applies only to SELECT elements"));var c=b.a.d(d());c&&"number"==typeof c.length&&b.a.o(a.getElementsByTagName("option"),function(a){var d=0<=b.a.i(c,b.k.q(a));b.a.ab(a,d)})}};b.c.style={update:function(a,
d){var c=b.a.d(d()||{}),e;for(e in c)if("string"==typeof e){var f=b.a.d(c[e]);a.style[e]=f||""}}};b.c.submit={init:function(a,d,c,e){"function"!=typeof d()&&i(Error("The value for a submit binding must be a function"));b.a.n(a,"submit",function(b){var c,h=d();try{c=h.call(e,a)}finally{c!==l&&(b.preventDefault?b.preventDefault():b.returnValue=q)}})}};b.c.text={update:function(a,d){b.a.bb(a,d())}};b.e.I.text=l;b.c.uniqueName={init:function(a,d){if(d()){var c="ko_unique_"+ ++b.c.uniqueName.nb;b.a.$a(a,
c)}}};b.c.uniqueName.nb=0;b.c.value={init:function(a,d,c){function e(){h=q;var e=d(),f=b.k.q(a);b.g.ea(e,c,"value",f)}var f=["change"],g=c().valueUpdate,h=q;g&&("string"==typeof g&&(g=[g]),b.a.P(f,g),f=b.a.Fa(f));if(b.a.Z&&("input"==a.tagName.toLowerCase()&&"text"==a.type&&"off"!=a.autocomplete&&(!a.form||"off"!=a.form.autocomplete))&&-1==b.a.i(f,"propertychange"))b.a.n(a,"propertychange",function(){h=l}),b.a.n(a,"blur",function(){h&&e()});b.a.o(f,function(c){var d=e;b.a.Nb(c,"after")&&(d=function(){setTimeout(e,
0)},c=c.substring(5));b.a.n(a,c,d)})},update:function(a,d){var c="select"===b.a.u(a),e=b.a.d(d()),f=b.k.q(a),g=e!=f;0===e&&(0!==f&&"0"!==f)&&(g=l);g&&(f=function(){b.k.T(a,e)},f(),c&&setTimeout(f,0));c&&0<a.length&&da(a,e,q)}};b.c.visible={update:function(a,d){var c=b.a.d(d()),e="none"!=a.style.display;c&&!e?a.style.display="":!c&&e&&(a.style.display="none")}};b.c.click={init:function(a,d,c,e){return b.c.event.init.call(this,a,function(){var a={};a.click=d();return a},c,e)}};b.v=function(){};b.v.prototype.renderTemplateSource=
function(){i(Error("Override renderTemplateSource"))};b.v.prototype.createJavaScriptEvaluatorBlock=function(){i(Error("Override createJavaScriptEvaluatorBlock"))};b.v.prototype.makeTemplateSource=function(a,d){if("string"==typeof a){var d=d||x,c=d.getElementById(a);c||i(Error("Cannot find template with ID "+a));return new b.l.h(c)}if(1==a.nodeType||8==a.nodeType)return new b.l.O(a);i(Error("Unknown template type: "+a))};b.v.prototype.renderTemplate=function(a,b,c,e){a=this.makeTemplateSource(a,e);
return this.renderTemplateSource(a,b,c)};b.v.prototype.isTemplateRewritten=function(a,b){return this.allowTemplateRewriting===q?l:this.makeTemplateSource(a,b).data("isRewritten")};b.v.prototype.rewriteTemplate=function(a,b,c){a=this.makeTemplateSource(a,c);b=b(a.text());a.text(b);a.data("isRewritten",l)};b.b("templateEngine",b.v);var pa=/(<[a-z]+\d*(\s+(?!data-bind=)[a-z0-9\-]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])([\s\S]*?)\5/gi,qa=/<\!--\s*ko\b\s*([\s\S]*?)\s*--\>/g;b.ya={ub:function(a,
d,c){d.isTemplateRewritten(a,c)||d.rewriteTemplate(a,function(a){return b.ya.Fb(a,d)},c)},Fb:function(a,b){return a.replace(pa,function(a,e,f,g,h,j,k){return V(k,e,b)}).replace(qa,function(a,e){return V(e,"<\!-- ko --\>",b)})},jb:function(a){return b.s.qa(function(d,c){d.nextSibling&&b.Ea(d.nextSibling,a,c)})}};b.b("__tr_ambtns",b.ya.jb);b.l={};b.l.h=function(a){this.h=a};b.l.h.prototype.text=function(){var a=b.a.u(this.h),a="script"===a?"text":"textarea"===a?"value":"innerHTML";if(0==arguments.length)return this.h[a];
var d=arguments[0];"innerHTML"===a?b.a.ca(this.h,d):this.h[a]=d};b.l.h.prototype.data=function(a){if(1===arguments.length)return b.a.f.get(this.h,"templateSourceData_"+a);b.a.f.set(this.h,"templateSourceData_"+a,arguments[1])};b.l.O=function(a){this.h=a};b.l.O.prototype=new b.l.h;b.l.O.prototype.text=function(){if(0==arguments.length){var a=b.a.f.get(this.h,"__ko_anon_template__")||{};a.za===H&&a.ia&&(a.za=a.ia.innerHTML);return a.za}b.a.f.set(this.h,"__ko_anon_template__",{za:arguments[0]})};b.l.h.prototype.nodes=
function(){if(0==arguments.length)return(b.a.f.get(this.h,"__ko_anon_template__")||{}).ia;b.a.f.set(this.h,"__ko_anon_template__",{ia:arguments[0]})};b.b("templateSources",b.l);b.b("templateSources.domElement",b.l.h);b.b("templateSources.anonymousTemplate",b.l.O);var N;b.va=function(a){a!=H&&!(a instanceof b.v)&&i(Error("templateEngine must inherit from ko.templateEngine"));N=a};b.ua=function(a,d,c,e,f){c=c||{};(c.templateEngine||N)==H&&i(Error("Set a template engine before calling renderTemplate"));
f=f||"replaceChildren";if(e){var g=M(e);return b.j(function(){var h=d&&d instanceof b.z?d:new b.z(b.a.d(d)),j="function"==typeof a?a(h.$data,h):a,h=S(e,f,j,h,c);"replaceNode"==f&&(e=h,g=M(e))},n,{Ja:function(){return!g||!b.a.X(g)},W:g&&"replaceNode"==f?g.parentNode:g})}return b.s.qa(function(e){b.ua(a,d,c,e,"replaceNode")})};b.Lb=function(a,d,c,e,f){function g(a,b){T(b,j);c.afterRender&&c.afterRender(b,a)}function h(d,e){j=f.createChildContext(b.a.d(d),c.as);j.$index=e;var g="function"==typeof a?
a(d,j):a;return S(n,"ignoreTargetNode",g,j,c)}var j;return b.j(function(){var a=b.a.d(d)||[];"undefined"==typeof a.length&&(a=[a]);a=b.a.fa(a,function(a){return c.includeDestroyed||a===H||a===n||!b.a.d(a._destroy)});b.r.K(b.a.Za,n,[e,a,h,c,g])},n,{W:e})};b.c.template={init:function(a,d){var c=b.a.d(d());if("string"!=typeof c&&!c.name&&(1==a.nodeType||8==a.nodeType))c=1==a.nodeType?a.childNodes:b.e.childNodes(a),c=b.a.Gb(c),(new b.l.O(a)).nodes(c);return{controlsDescendantBindings:l}},update:function(a,
d,c,e,f){var d=b.a.d(d()),c={},e=l,g,h=n;"string"!=typeof d&&(c=d,d=c.name,"if"in c&&(e=b.a.d(c["if"])),e&&"ifnot"in c&&(e=!b.a.d(c.ifnot)),g=b.a.d(c.data));"foreach"in c?h=b.Lb(d||a,e&&c.foreach||[],c,a,f):e?(f="data"in c?f.createChildContext(g,c.as):f,h=b.ua(d||a,f,c,a)):b.e.Y(a);f=h;(g=b.a.f.get(a,"__ko__templateComputedDomDataKey__"))&&"function"==typeof g.B&&g.B();b.a.f.set(a,"__ko__templateComputedDomDataKey__",f&&f.oa()?f:H)}};b.g.Q.template=function(a){a=b.g.aa(a);return 1==a.length&&a[0].unknown||
b.g.Db(a,"name")?n:"This template engine does not support anonymous templates nested within its templates"};b.e.I.template=l;b.b("setTemplateEngine",b.va);b.b("renderTemplate",b.ua);b.a.Ia=function(a,b,c){a=a||[];b=b||[];return a.length<=b.length?R(a,b,"added","deleted",c):R(b,a,"deleted","added",c)};b.b("utils.compareArrays",b.a.Ia);b.a.Za=function(a,d,c,e,f){function g(a,b){s=k[b];v!==b&&(y[a]=s);s.ma(v++);L(s.M);r.push(s);z.push(s)}function h(a,c){if(a)for(var d=0,e=c.length;d<e;d++)c[d]&&b.a.o(c[d].M,
function(b){a(b,d,c[d].U)})}for(var d=d||[],e=e||{},j=b.a.f.get(a,"setDomNodeChildrenFromArrayMapping_lastMappingResult")===H,k=b.a.f.get(a,"setDomNodeChildrenFromArrayMapping_lastMappingResult")||[],m=b.a.V(k,function(a){return a.U}),p=b.a.Ia(m,d),r=[],u=0,v=0,A=[],z=[],d=[],y=[],m=[],s,C=0,B,D;B=p[C];C++)switch(D=B.moved,B.status){case "deleted":D===H&&(s=k[u],s.j&&s.j.B(),A.push.apply(A,L(s.M)),e.beforeRemove&&(d[C]=s,z.push(s)));u++;break;case "retained":g(C,u++);break;case "added":D!==H?g(C,
D):(s={U:B.value,ma:b.m(v++)},r.push(s),z.push(s),j||(m[C]=s))}h(e.beforeMove,y);b.a.o(A,e.beforeRemove?b.A:b.removeNode);for(var C=0,j=b.e.firstChild(a),G;s=z[C];C++){s.M||b.a.extend(s,ga(a,c,s.U,f,s.ma));for(u=0;p=s.M[u];j=p.nextSibling,G=p,u++)p!==j&&b.e.Oa(a,p,G);!s.zb&&f&&(f(s.U,s.M,s.ma),s.zb=l)}h(e.beforeRemove,d);h(e.afterMove,y);h(e.afterAdd,m);b.a.f.set(a,"setDomNodeChildrenFromArrayMapping_lastMappingResult",r)};b.b("utils.setDomNodeChildrenFromArrayMapping",b.a.Za);b.C=function(){this.allowTemplateRewriting=
q};b.C.prototype=new b.v;b.C.prototype.renderTemplateSource=function(a){var d=!(9>b.a.Z)&&a.nodes?a.nodes():n;if(d)return b.a.L(d.cloneNode(l).childNodes);a=a.text();return b.a.sa(a)};b.C.na=new b.C;b.va(b.C.na);b.b("nativeTemplateEngine",b.C);b.pa=function(){var a=this.Cb=function(){if("undefined"==typeof E||!E.tmpl)return 0;try{if(0<=E.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,c,e){e=e||{};2>a&&i(Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."));
var f=b.data("precompiled");f||(f=b.text()||"",f=E.template(n,"{{ko_with $item.koBindingContext}}"+f+"{{/ko_with}}"),b.data("precompiled",f));b=[c.$data];c=E.extend({koBindingContext:c},e.templateOptions);c=E.tmpl(f,b,c);c.appendTo(x.createElement("div"));E.fragments={};return c};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+a+" })()) }}"};this.addTemplate=function(a,b){x.write("<script type='text/html' id='"+a+"'>"+b+"<\/script>")};0<a&&(E.tmpl.tag.ko_code=
{open:"__.push($1 || '');"},E.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};b.pa.prototype=new b.v;v=new b.pa;0<v.Cb&&b.va(v);b.b("jqueryTmplTemplateEngine",b.pa)}"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?K(module.exports||exports):"function"===typeof define&&define.amd?define(["exports"],K):K(w.ko={});l;
})();

File diff suppressed because one or more lines are too long

115
view/theme/blogng/nav.tpl Normal file
View File

@ -0,0 +1,115 @@
<div class="fixed contain-to-grid">
<nav class="top-bar">
<ul>
<!-- Title Area -->
<li class="name">
<h1>
<a href="#">$banner</a>
</h1>
</li>
<li class="toggle-topbar"><a href="#"></a></li>
</ul>
<section>
<!-- Left Nav Section -->
<ul class="left">
<li class="divider"></li>
{{ if $userinfo }}
<li class="has-dropdown">
<a href="#"><img src="$[userinfo.icon]" alt="$[userinfo.name]">$userinfo.name</a>
<ul class="dropdown">
{{ for $nav.usermenu as $usermenu }}
<li><a class="$usermenu.2" href="$usermenu.0" title="$usermenu.3">$usermenu.1</a></li>
{{ endfor }}
{{ if $nav.notifications }}<li><a class="$nav.notifications.2" href="$nav.notifications.0" title="$nav.notifications.3" >$nav.notifications.1</a></li>{{ endif }}
{{ if $nav.messages }}<li><a class="$nav.messages.2" href="$nav.messages.0" title="$nav.messages.3" >$nav.messages.1</a></li>{{ endif }}
{{ if $nav.contacts }}<li><a class="$nav.contacts.2" href="$nav.contacts.0" title="$nav.contacts.3" >$nav.contacts.1</a></li>{{ endif }}
<li class="divider"></li>
{{ if $nav.manage }}
<li><a class="$nav.manage.2" href="$nav.manage.0" title="$nav.manage.3">$nav.manage.1</a></li>
<li class="divider"></li>
{{ endif }}
{{ if $nav.settings }}<li><a class="$nav.settings.2" href="$nav.settings.0" title="$nav.settings.3">$nav.settings.1</a></li>{{ endif }}
{{ if $nav.admin }}<li><a class="$nav.admin.2" href="$nav.admin.0" title="$nav.admin.3" >$nav.admin.1</a></li>{{ endif }}
{{ if $nav.logout }}<li><a class="$nav.logout.2" href="$nav.logout.0" title="$nav.logout.3" >$nav.logout.1</a></li>{{ endif }}
</ul>
</li>
{{ endif }}
{{ if $nav.login }}<li><a class="$nav.login.2" href="$nav.login.0" title="$nav.login.3" >$nav.login.1</a><li>{{ endif }}
{{ if $nav.community }}
<li id="nav-community-link" class="$sel.community">
<a class="$nav.community.2" href="$nav.community.0" title="$nav.community.3" >$nav.community.1</a>
</li>
{{ endif }}
{{ if $nav.network }}
<li id="nav-network-link" class="$sel.network">
<a class="$nav.network.2" href="$nav.network.0" title="$nav.network.3" >$nav.network.1
<span id="net-update" class="nav-notify"></span>
</a>
</li>
{{ endif }}
{{ if $nav.home }}
<li id="nav-home-link" class="$sel.home">
<a class="$nav.home.2" href="$nav.home.0" title="$nav.home.3" >$nav.home.1
<span id="home-update" class="nav-notify"></span>
</a>
</li>
{{ endif }}
{{ if $nav.notifications }}
<li id="nav-notifications-linkmenu" class="has-dropdown">
<a href="$nav.notifications.0" title="$nav.notifications.1">$nav.notifications.1 <span id="notify-update" class="nav-notify"></span></a>
<ul id="nav-notifications-menu" class="dropdown">
<!-- TODO: better icons! -->
<li id="nav-notifications-mark-all" class="toolbar"><a href="#" onclick="notifyMarkAll(); return false;" title="$nav.notifications.mark.1"><span class="icon s10 edit"></span></a></a><a href="$nav.notifications.all.0" title="$nav.notifications.all.1"><span class="icon s10 plugin"></span></a></li>
<li class="empty"><label>$emptynotifications</label></li>
</ul>
</li>
{{ endif }}
<li class="divider hide-for-small"></li>
</ul>
<!-- Right Nav Section -->
<ul class="right">
<li class="divider show-for-medium-and-up"></li>
{{ if $nav.help }}
<li id="nav-help-link" class="$sel.help">
<a class="$nav.help.2" target="friendica-help" href="$nav.help.0" title="$nav.help.3" >$nav.help.1</a>
</li>
{{ endif }}
<li id="nav-search-link" class="$sel.search">
<a class="$nav.search.2" href="$nav.search.0" title="$nav.search.3" >$nav.search.1</a>
</li>
<li id="nav-directory-link" class="$sel.directory">
<a class="$nav.directory.2" href="$nav.directory.0" title="$nav.directory.3" >$nav.directory.1</a>
</li>
{{ if $nav.apps }}
<li id="nav-apps-link" class="$sel.apps">
<a class=" $nav.apps.2" href="#" rel="#nav-apps-menu" title="$nav.apps.3" >$nav.apps.1</a>
<ul id="nav-apps-menu" class="menu-popup">
{{ for $apps as $ap }}
<li>$ap</li>
{{ endfor }}
</ul>
</li>
{{ endif }}
</ul>
</section>
</nav>
</div>
<ul id="nav-notifications-template" style="display:none;" rel="template">
<li><a href="{0}"><img data-src="{1}">{2} <span class="notif-when">{3}</span></a></li>
</ul>

View File

@ -0,0 +1,6 @@
/* nav */
.top-bar li a>img {
max-height: 40px;
padding-right: 5px;
vertical-align: middle;
}

View File

@ -0,0 +1,29 @@
/* Artfully masterminded by ZURB */
/* --------------------------------------------------
Table of Contents
-----------------------------------------------------
:: Shared Styles
:: Page Name 1
:: Page Name 2
*/
/* -----------------------------------------
Shared Styles
----------------------------------------- */
/* -----------------------------------------
Page Name 1
----------------------------------------- */
/* -----------------------------------------
Page Name 2
----------------------------------------- */

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,15 @@
<?php
/**
* Name: Blog-NG
* Version: 0.0.1
* Author: Fabio <http://kirgroup.com/profile/fabrixxm>
*/
function blogng_init(&$a) {
$a->theme_info = array(
'family' => 'blog',
'version' => '0.0.1'
);
set_template_engine($a, 'smarty3');
}