first commit

This commit is contained in:
2024-11-17 19:56:17 +01:00
commit 81b1185f8e
6599 changed files with 832395 additions and 0 deletions

View File

@@ -0,0 +1,459 @@
/*
* jQuery.dockmodal - jQuery dockable modal dialog widget
*
* Copyright 2014, uxMine
* Dual licensed under the MIT or GPL Version 2 licenses.
* Date: 2/11/2014
* @author Tarafder Ashek E Elahi
* @version 1.1
* Depends:
* jquery.js
*
*/
;
(function ($) {
var defaults = {
width: 400,
height: "65%",
minimizedWidth: 200,
gutter: 10,
poppedOutDistance: "6%",
title: function() {
return "";
},
dialogClass: "",
buttons: [], /* id, html, buttonClass, click */
animationSpeed: 400,
opacity: 1,
initialState: 'modal', /* "modal", "docked", "minimized" */
showClose: true,
showPopout: true,
showMinimize: true,
create: undefined,
open: undefined,
beforeClose: undefined,
close: undefined,
beforeMinimize: undefined,
minimize: undefined,
beforeRestore: undefined,
restore: undefined,
beforePopout: undefined,
popout: undefined
};
var dClass = "dockmodal";
var windowWidth = $(window).width();
function setAnimationCSS($this, $el) {
var aniSpeed = $this.options.animationSpeed / 1000;
$el.css({"transition": aniSpeed + "s right, " + aniSpeed + "s left, " + aniSpeed + "s top, " + aniSpeed + "s bottom, " + aniSpeed + "s height, " + aniSpeed + "s width"});
return true;
}
function removeAnimationCSS($el) {
$el.css({"transition": "none"});
return true;
}
var methods = {
init: function (options) {
return this.each(function () {
var $this = $(this);
var data = $this.data('dockmodal');
$this.options = $.extend({}, defaults, options);
// Check to see if title is a returned function
(function titleCheck() {
if (typeof $this.options.title == "function") {
$this.options.title = $this.options.title.call($this);
}
})();
// If the plugin hasn't been initialized yet
if (!data) {
$this.data('dockmodal', $this);
} else {
$("body").append($this.closest("." + dClass).show());
//methods.restore.apply($this);
methods.refreshLayout();
setTimeout(function () {
methods.restore.apply($this);
}, $this.options.animationSpeed);
return;
}
// create modal
var $body = $("body");
var $window = $(window);
var $dockModal = $('<div/>').addClass(dClass).addClass($this.options.dialogClass);
if ($this.options.initialState == "modal") {
$dockModal.addClass("popped-out");
} else if ($this.options.initialState == "minimized") {
$dockModal.addClass("minimized");
}
//$dockModal.width($this.options.width);
$dockModal.height(0);
setAnimationCSS($this, $dockModal);
// create title
var $dockHeader = $('<div></div>').addClass(dClass + "-header");
if ($this.options.showClose) {
$('<a href="#" class="header-action action-close" title="Close"><i class="icon-dockmodal-close"></i></a>').appendTo($dockHeader).click(function (e) {
methods.destroy.apply($this);
return false;
});
}
if ($this.options.showPopout) {
$('<a href="#" class="header-action action-popout" title="Pop out"><i class="icon-dockmodal-popout"></i></a>').appendTo($dockHeader).click(function (e) {
if ($dockModal.hasClass("popped-out")) {
methods.restore.apply($this);
} else {
methods.popout.apply($this);
}
return false;
});
}
if ($this.options.showMinimize) {
$('<a href="#" class="header-action action-minimize" title="Minimize"><i class="icon-dockmodal-minimize"></i></a>').appendTo($dockHeader).click(function (e) {
if ($dockModal.hasClass("minimized")) {
if ($dockModal.hasClass("popped-out")) {
methods.popout.apply($this);
} else {
methods.restore.apply($this);
}
} else {
methods.minimize.apply($this);
}
return false;
});
}
if ($this.options.showMinimize && $this.options.showPopout) {
$dockHeader.click(function () {
if ($dockModal.hasClass("minimized")) {
if ($dockModal.hasClass("popped-out")) {
methods.popout.apply($this);
} else {
methods.restore.apply($this);
}
} else {
methods.minimize.apply($this);
}
return false;
});
}
$dockHeader.append('<div class="title-text">' + ($this.options.title || $this.attr("title")) + '</div>');
$dockModal.append($dockHeader);
// create body section
var $placeholder = $('<div class="modal-placeholder"></div>').insertAfter($this);
$this.placeholder = $placeholder;
var $dockBody = $('<div></div>').addClass(dClass + "-body").append($this);
$dockModal.append($dockBody);
// create footer
if ($this.options.buttons.length) {
var $dockFooter = $('<div></div>').addClass(dClass + "-footer");
var $dockFooterButtonset = $('<div></div>').addClass(dClass + "-footer-buttonset");
$dockFooter.append($dockFooterButtonset);
$.each($this.options.buttons, function (indx, el) {
var $btn = $('<a href="#" class="btn"></a>');
$btn.attr({ "id": el.id, "class": el.buttonClass });
$btn.html(el.html);
$btn.click(function (e) {
el.click(e, $this);
return false;
});
$dockFooterButtonset.append($btn);
});
$dockModal.append($dockFooter);
} else {
$dockModal.addClass("no-footer");
}
// create overlay
var $overlay = $("." + dClass + "-overlay");
if (!$overlay.length) {
$overlay = $('<div/>').addClass(dClass + "-overlay");
}
// raise create event
if ($.isFunction($this.options.create)) {
$this.options.create($this);
}
$body.append($dockModal);
$dockModal.after($overlay);
$dockBody.focus();
// raise open event
if ($.isFunction($this.options.open)) {
setTimeout(function () {
$this.options.open($this);
}, $this.options.animationSpeed);
}
//methods.restore.apply($this);
if ($dockModal.hasClass("minimized")) {
$dockModal.find(".dockmodal-body, .dockmodal-footer").hide();
methods.minimize.apply($this);
} else {
if ($dockModal.hasClass("popped-out")) {
methods.popout.apply($this);
} else {
methods.restore.apply($this);
}
}
// attach resize event
// track width, set to window width
$body.data("windowWidth", $window.width());
$window.unbind("resize.dockmodal").bind("resize.dockmodal", function () {
// do nothing if the width is the same
// update new width value
if ($window.width() == $body.data("windowWidth")) {
return;
}
$body.data("windowWidth", $window.width());
methods.refreshLayout();
});
});
},
destroy: function () {
return this.each(function () {
var $this = $(this).data('dockmodal');
if (!$this)
return;
// raise beforeClose event
if ($.isFunction($this.options.beforeClose)) {
if ($this.options.beforeClose($this) === false) {
return;
}
}
try {
var $dockModal = $this.closest("." + dClass);
if ($dockModal.hasClass("popped-out") && !$dockModal.hasClass("minimized")) {
$dockModal.css({
"left": "50%",
"right": "50%",
"top": "50%",
"bottom": "50%"
});
} else {
$dockModal.css({
"width": "0",
"height": "0"
});
}
setTimeout(function () {
$this.removeData('dockmodal');
$this.placeholder.replaceWith($this);
$dockModal.remove();
$("." + dClass + "-overlay").hide();
methods.refreshLayout();
// raise close event
if ($.isFunction($this.options.close)) {
$this.options.close($this);
}
}, $this.options.animationSpeed);
}
catch (err) {
alert(err.message);
}
// other destroy routines
})
},
close: function () {
methods.destroy.apply(this);
},
minimize: function () {
return this.each(function () {
var $this = $(this).data('dockmodal');
if (!$this)
return;
// raise beforeMinimize event
if ($.isFunction($this.options.beforeMinimize)) {
if ($this.options.beforeMinimize($this) === false) {
return;
}
}
var $dockModal = $this.closest("." + dClass);
var headerHeight = $dockModal.find(".dockmodal-header").outerHeight();
$dockModal.addClass("minimized").css({
"width": $this.options.minimizedWidth + "px",
"height": headerHeight + "px",
"left": "auto",
"right": "auto",
"top": "auto",
"bottom": "0"
});
setTimeout(function () {
// for safty, hide the body and footer
$dockModal.find(".dockmodal-body, .dockmodal-footer").hide();
// raise minimize event
if ($.isFunction($this.options.minimize)) {
$this.options.minimize($this);
}
}, $this.options.animationSpeed);
$("." + dClass + "-overlay").hide();
$dockModal.find(".action-minimize").attr("title", "Restore");
methods.refreshLayout();
})
},
restore: function () {
return this.each(function () {
var $this = $(this).data('dockmodal');
if (!$this)
return;
// raise beforeRestore event
if ($.isFunction($this.options.beforeRestore)) {
if ($this.options.beforeRestore($this) === false) {
return;
}
}
var $dockModal = $this.closest("." + dClass);
$dockModal.removeClass("minimized popped-out");
$dockModal.find(".dockmodal-body, .dockmodal-footer").show();
$dockModal.css({
"width": $this.options.width + "px",
"height": $this.options.height,
"left": "auto",
"right": "auto",
"top": "auto",
"bottom": "0"
});
$("." + dClass + "-overlay").hide();
$dockModal.find(".action-minimize").attr("title", "Minimize");
$dockModal.find(".action-popout").attr("title", "Pop-out");
setTimeout(function () {
// raise restore event
if ($.isFunction($this.options.restore)) {
$this.options.restore($this);
}
}, $this.options.animationSpeed);
methods.refreshLayout();
})
},
popout: function () {
return this.each(function () {
var $this = $(this).data('dockmodal');
if (!$this)
return;
// raise beforePopout event
if ($.isFunction($this.options.beforePopout)) {
if ($this.options.beforePopout($this) === false) {
return;
}
}
var $dockModal = $this.closest("." + dClass);
$dockModal.find(".dockmodal-body, .dockmodal-footer").show();
// prepare element for animation
removeAnimationCSS($dockModal);
var offset = $dockModal.position();
var windowWidth = $(window).width();
$dockModal.css({
"width": "auto",
"height": "auto",
"left": offset.left + "px",
"right": (windowWidth - offset.left - $dockModal.outerWidth(true)) + "px",
"top": offset.top + "px",
"bottom": 0
});
setAnimationCSS($this, $dockModal);
setTimeout(function () {
$dockModal.removeClass("minimized").addClass("popped-out").css({
"width": "auto",
"height": "auto",
"left": $this.options.poppedOutDistance,
"right": $this.options.poppedOutDistance,
"top": $this.options.poppedOutDistance,
"bottom": $this.options.poppedOutDistance
});
$("." + dClass + "-overlay").show();
$dockModal.find(".action-popout").attr("title", "Pop-in");
methods.refreshLayout();
}, 10);
setTimeout(function () {
// raise popout event
if ($.isFunction($this.options.popout)) {
$this.options.popout($this);
}
}, $this.options.animationSpeed);
});
},
refreshLayout: function () {
var right = 0;
var windowWidth = $(window).width();
$.each($("." + dClass).toArray().reverse(), function (i, val) {
var $dockModal = $(this);
var $this = $dockModal.find("." + dClass + "-body > div").data("dockmodal");
if ($dockModal.hasClass("popped-out") && !$dockModal.hasClass("minimized")) {
return;
}
right += $this.options.gutter;
$dockModal.css({ "right": right + "px" });
if ($dockModal.hasClass("minimized")) {
right += $this.options.minimizedWidth;
} else {
right += $this.options.width;
}
if (right > windowWidth) {
$dockModal.hide();
} else {
setTimeout(function () {
$dockModal.show();
}, $this.options.animationSpeed);
}
});
}
};
$.fn.dockmodal = 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.dockmodal');
}
};
})(jQuery);

View File

@@ -0,0 +1,644 @@
/*
* AdminPanels.js was created solely for this theme.
* Author: AdminDesigns.com
*
*/
;
(function($, window, document, undefined) {
// Plugin definition.
$.fn.adminpanel = function(options) {
// Default plugin options.
var defaults = {
grid: '.admin-grid',
draggable: false,
mobile: false,
preserveGrid: false,
onPanel: function() {
console.log('callback:', 'onPanel');
},
onStart: function() {
console.log('callback:', 'onStart');
},
onSave: function() {
console.log('callback:', 'onSave');
},
onDrop: function() {
// An "onSave" callback will also be called if
// the drop also changes the elements DOM position
console.log('callback:', 'onDrop');
},
onFinish: function() {
console.log('callback:', 'onFinish');
},
};
// Extend default options.
var options = $.extend({}, defaults, options);
// Variables.
var plugin = $(this);
var pluginID = plugin.attr('id');
var pluginGrid = options.grid;
var dragSetting = options.draggable;
var mobileSetting = options.mobile;
var preserveSetting = options.preserveGrid;
var panels = plugin.find('.panel');
// HTML5 LocalStorage Keys
var settingsKey = 'panel-settings_' + location.pathname;
var positionsKey = 'panel-positions_' + location.pathname;
// HTML5 LocalStorage Gets
var settingsGet = localStorage.getItem(settingsKey);
var positionsGet = localStorage.getItem(positionsKey);
// Control Menu Click Handler
$('.panel').on('click', '.panel-controls > a', function(e) {
e.preventDefault();
// if a panel is being dragged disable menu clicks
if ($('body.ui-drag-active').length) {
return;
}
// determine appropriate event response
methods.controlHandlers.call(this, options);
});
var methods = {
init: function(options) {
var This = $(this);
// onStart callback
if (typeof options.onStart == 'function') {
options.onStart();
}
// Check onload to see if positions key is empty
if (!positionsGet) {
localStorage.setItem(positionsKey, methods.findPositions());
} else {
methods.setPositions();
}
// Check onload to see if settings key is empty
if (!settingsGet) {
localStorage.setItem(settingsKey, methods.modifySettings());
}
// Helper function that adds unique ID's to grid elements
$(pluginGrid).each(function(i, e) {
$(e).attr('id', 'grid-' + i);
});
// Check if empty columns should be preserved using an invisible panel
if (preserveSetting) {
var Panel = "<div class='panel preserve-grid'></div>";
$(pluginGrid).each(function(i, e) {
$(e).append(Panel);
});
}
// Prep admin panel/container prior to menu creation
methods.createControls(options);
// Create Mobile Menus
methods.createMobileControls(options);
// Loop through settings key and apply options to panels
methods.applySettings();
if (dragSetting === true) {
// Activate jQuery sortable on declared grids/panels
plugin.sortable({
items: plugin.find('.panel:not(".sort-disable")'),
connectWith: pluginGrid,
cursor: 'default',
revert: 250,
handle: '.panel-heading',
opacity: 1,
delay: 100,
tolerance: "pointer",
scroll: true,
placeholder: 'panel-placeholder',
forcePlaceholderSize: true,
forceHelperSize: true,
start: function(e, ui) {
$('body').addClass('ui-drag-active');
ui.placeholder.height(ui.helper.outerHeight() - 4);
},
beforeStop: function() {
// onMove callback
if (typeof options.onDrop == 'function') {
options.onDrop();
}
},
stop: function() {
$('body').removeClass('ui-drag-active');
},
update: function(event, ui) {
// toggle loading indicator
methods.toggleLoader();
// store the positions of the plugins */
methods.updatePositions(options);
}
});
}
// onFinish callback
if (typeof options.onFinish == 'function') {
options.onFinish();
}
},
createMobileControls: function(options) {
var controls = panels.find('.panel-controls');
var arr = {};
$.each(controls, function(i, e) {
var This = $(e);
var ID = $(e).parents('.panel').attr('id');
var controlW = This.width();
var titleW = This.siblings('.panel-title').width();
var headingW = This.parent('.panel-heading').width();
var mobile = (controlW + titleW);
arr[ID] = mobile;
});
console.log(arr)
$.each(arr, function(i, e) {
var This = $('#' + i);
var headingW = This.width() - 75;
var controls = This.find('.panel-controls');
if (mobileSetting === true || headingW < e) {
This.addClass('mobile-controls');
var options = {
html: true,
placement: "left",
content: function(e) {
var Content = $(this).clone();
return Content;
},
template: '<div data-popover-id="'+i+'" class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
}
controls.popover(options);
} else {
controls.removeClass('mobile-controls');
}
});
// Toggle mobile controls menu open on click
$('.mobile-controls .panel-heading > .panel-controls').on('click', function() {
$(this).toggleClass('panel-controls-open');
});
},
applySettings: function(options) {
// Variables.
var obj = this;
var localSettings = localStorage.getItem(settingsKey);
var parseSettings = JSON.parse(localSettings);
// Possible panel colors
var panelColors = "panel-primary panel-success panel-info panel-warning panel-danger panel-alert panel-system panel-dark panel-default";
// Pull localstorage obj, parse the data, and then loop
// through each panel and apply its given settings
$.each(parseSettings, function(i, e) {
$.each(e, function(i, e) {
var panelID = e['id'];
var panelTitle = e['title'];
var panelCollapsed = e['collapsed'];
var panelHidden = e['hidden'];
var panelColor = e['color'];
var Target = $('#' + panelID);
if (panelTitle) {
Target.children('.panel-heading').find('.panel-title').text(panelTitle);
}
if (panelCollapsed === 1) {
Target.addClass('panel-collapsed')
.children('.panel-body, .panel-menu, .panel-footer').hide();
}
if (panelColor) {
Target.removeClass(panelColors).addClass(panelColor).attr('data-panel-color', panelColor);
}
if (panelHidden === 1) {
Target.addClass('panel-hidden').hide().remove();
}
});
});
},
createControls: function(options) {
// List of available panel controls
var panelControls = '<span class="panel-controls"></span>';
var panelTitle = '<a href="#" class="panel-control-title"></a>';
var panelColor = '<a href="#" class="panel-control-color"></a>';
var panelCollapse = '<a href="#" class="panel-control-collapse"></a>';
var panelFullscreen = '<a href="#" class="panel-control-fullscreen"></a>';
var panelRemove = '<a href="#" class="panel-control-remove"></a>';
var panelCallback = '<a href="#" class="panel-control-callback"></a>';
var panelDock = '<a href="#" class="panel-control-dockable" data-toggle="popover" data-content="panelDockContent();"></a>';
var panelExpose = '<a href="#" class="panel-control-expose"></a>';
var panelLoader = '<a href="#" class="panel-control-loader"></a>';
panels.each(function(i, e) {
var This = $(e);
// Create panel menu container
var panelHeader = This.children('.panel-heading');
$(panelControls).appendTo(panelHeader);
// Check panel for settings specific attr. Use this
// value to determine if menu item should be displayed
var title = This.attr('data-panel-title');
var color = This.attr('data-panel-color');
var collapse = This.attr('data-panel-collapse');
var fullscreen = This.attr('data-panel-fullscreen');
var remove = This.attr('data-panel-remove');
var callback = This.attr('data-panel-callback');
var paneldock = This.attr('data-panel-dockable');
var expose = This.attr('data-panel-expose');
var loader = This.attr('data-panel-loader');
// attach loading indicator like any other button
if (!loader) {
// Create button
var panelMenu = panelHeader.find('.panel-controls');
$(panelLoader).appendTo(panelMenu);
}
// Upcoming feature, not currently implemented
if (expose) {
// Create button
var panelMenu = panelHeader.find('.panel-controls');
$(panelExpose).appendTo(panelMenu);
}
// Upcoming feature, not currently implemented
if (paneldock) {
// Create button
var panelMenu = panelHeader.find('.panel-controls');
$(panelDock).appendTo(panelMenu);
}
// callback attr must be set true, else icon hidden
if (callback) {
// Create button
var panelMenu = panelHeader.find('.panel-controls');
$(panelCallback).appendTo(panelMenu);
}
if (!remove) {
// Create button
var panelMenu = panelHeader.find('.panel-controls');
$(panelRemove).appendTo(panelMenu);
}
if (!title) {
// Create button
var panelMenu = panelHeader.find('.panel-controls');
$(panelTitle).appendTo(panelMenu);
}
if (!color) {
var panelMenu = panelHeader.find('.panel-controls');
$(panelColor).appendTo(panelMenu);
}
if (!collapse) {
// Create button
var panelMenu = panelHeader.find('.panel-controls');
$(panelCollapse).appendTo(panelMenu);
}
if (!fullscreen) {
// Create button
var panelMenu = panelHeader.find('.panel-controls');
$(panelFullscreen).appendTo(panelMenu);
}
});
},
controlHandlers: function(e) {
var This = $(this);
// Control button indentifiers
var action = This.attr('class');
var panel = This.parents('.panel');
// Panel header variables
var panelHeading = panel.children('.panel-heading');
var panelTitle = panel.find('.panel-title');
// Edit Title definition
var panelEditTitle = function() {
// function for toggling the editbox menu
var toggleBox = function() {
var panelEditBox = panel.find('.panel-editbox');
panelEditBox.slideToggle('fast', function() {
panel.toggleClass('panel-editbox-open');
// Save settings to key if editbox is being closed
if (!panel.hasClass('panel-editbox-open')) {
panelTitle.text(panelEditBox.children('input').val());
methods.updateSettings(options);
}
});
};
// If editbox not found, create one and attach handlers
if (!panel.find('.panel-editbox').length) {
var editBox = '<div class="panel-editbox"><input type="text" class="form-control" value="' + panelTitle.text() + '"></div>';
panelHeading.after(editBox);
// New editbox container
var panelEditBox = panel.find('.panel-editbox');
// Update panel title on key up
panelEditBox.children('input').on('keyup', function() {
panelTitle.text(panelEditBox.children('input').val());
});
// Save panel title on enter key press
panelEditBox.children('input').on('keypress', function(e) {
if (e.which == 13) {
toggleBox();
}
});
// Toggle editbox
toggleBox();
} else {
// If found simply toggle the menu
toggleBox();
}
};
// Panel color definition
var panelColor = function() {
// Create an editbox if one is not found
if (!panel.find('.panel-colorbox').length) {
var colorBox = '<div class="panel-colorbox"> <span class="bg-white" data-panel-color="panel-default"></span> <span class="bg-primary" data-panel-color="panel-primary"></span> <span class="bg-info" data-panel-color="panel-info"></span> <span class="bg-success" data-panel-color="panel-success"></span> <span class="bg-warning" data-panel-color="panel-warning"></span> <span class="bg-danger" data-panel-color="panel-danger"></span> <span class="bg-alert" data-panel-color="panel-alert"></span> <span class="bg-system" data-panel-color="panel-system"></span> <span class="bg-dark" data-panel-color="panel-dark"></span> </div>'
panelHeading.after(colorBox);
}
// Editbox container
var panelColorBox = panel.find('.panel-colorbox');
// Update panel contextual color on click
panelColorBox.on('click', '> span', function(e) {
var dataColor = $(this).data('panel-color');
var altColors = 'panel-primary panel-info panel-success panel-warning panel-danger panel-alert panel-system panel-dark panel-default panel-white';
panel.removeClass(altColors).addClass(dataColor).data('panel-color', dataColor)
methods.updateSettings(options);
});
// Toggle elements visability and '.panel-editbox' class
// If the box is being closed update settings key
panelColorBox.slideToggle('fast', function() {
panel.toggleClass('panel-colorbox-open');
});
};
// Collapse definition
var panelCollapse = function() {
// Toggle class
panel.toggleClass('panel-collapsed');
// Toggle elements visability
panel.children('.panel-body, .panel-menu, .panel-footer').slideToggle('fast', function() {
methods.updateSettings(options);
});
};
// Fullscreen definition
var panelFullscreen = function() {
// If fullscreen mode is active, remove class and enable panel sorting
if ($('body.panel-fullscreen-active').length) {
$('body').removeClass('panel-fullscreen-active');
panel.removeClass('panel-fullscreen');
if (dragSetting === true) {
plugin.sortable("enable");
}
}
// if not active add fullscreen classes and disable panel sorting
else {
$('body').addClass('panel-fullscreen-active');
panel.addClass('panel-fullscreen');
if (dragSetting === true) {
plugin.sortable("disable");
}
}
// Hide any open mobile menus or popovers
$('.panel-controls').removeClass('panel-controls-open');
$('.popover').popover('hide');
// Trigger a global window resize to resize any plugins
// the fullscreened content might contain.
setTimeout(function() {
$(window).trigger('resize');
}, 100);
};
// Remove definition
var panelRemove = function() {
// check for Bootbox plugin - should be in core
if (bootbox.confirm) {
bootbox.confirm("Are You Sure?!", function(e) {
// e returns true if user clicks "accept"
// false if "cancel" or dismiss icon are clicked
if (e) {
// Timeout simply gives the user a second for the modal to
// fade away so they can visibly see the panel disappear
setTimeout(function() {
panel.addClass('panel-removed').hide();
methods.updateSettings(options);
}, 200);
}
});
} else {
panel.addClass('panel-removed').hide();
methods.updateSettings(options);
}
};
// Remove definition
var panelCallback = function() {
if (typeof options.onPanel == 'function') {
options.onPanel();
}
};
// Expose.js definition
var panelExpose = function() {
// Code removed, feature will be added to next update
// once all of the dynamic/responsive aspects of resizing
// an exposed panel are worked out
};
// Responses
if ($(this).hasClass('panel-control-collapse')) {
panelCollapse();
}
if ($(this).hasClass('panel-control-title')) {
panelEditTitle();
}
if ($(this).hasClass('panel-control-color')) {
panelColor();
}
if ($(this).hasClass('panel-control-fullscreen')) {
panelFullscreen();
}
if ($(this).hasClass('panel-control-remove')) {
panelRemove();
}
if ($(this).hasClass('panel-control-callback')) {
panelCallback();
}
if ($(this).hasClass('panel-control-expose')) {
panelExpose();
}
if ($(this).hasClass('panel-control-dockable')) {
return
}
if ($(this).hasClass('panel-control-loader')) {
return;
}
// Toggle Loader indicator in response to action
methods.toggleLoader.call(this);
},
toggleLoader: function(options) {
var This = $(this);
var panel = This.parents('.panel');
// Add loader to panel
panel.addClass('panel-loader-active');
// Remove loader after specified duration
setTimeout(function() {
panel.removeClass('panel-loader-active');
}, 650);
},
modifySettings: function(options) {
// Settings obj
var settingsArr = [];
// Determine settings of each panel.
panels.each(function(i, e) {
var This = $(e);
var panelObj = {};
// Settings variables.
var panelID = This.attr('id');
var panelTitle = This.children('.panel-heading').find('.panel-title').text();
var panelCollapsed = (This.hasClass('panel-collapsed') ? 1 : 0);
var panelHidden = (This.is(':hidden') ? 1 : 0);
var panelColor = This.data('panel-color');
panelObj['id'] = This.attr('id');
panelObj['title'] = This.children('.panel-heading').find('.panel-title').text();
panelObj['collapsed'] = (This.hasClass('panel-collapsed') ? 1 : 0);
panelObj['hidden'] = (This.is(':hidden') ? 1 : 0);
panelObj['color'] = (panelColor ? panelColor : null);
settingsArr.push({
'panel': panelObj
});
});
var checkedSettings = JSON.stringify(settingsArr);
// Log Results
// console.log('Key contains: ', checkedSettings);
// return panel positions array
return checkedSettings;
},
findPositions: function(options) {
var grids = plugin.find(pluginGrid);
var gridsArr = [];
// Determine panels present.
grids.each(function(index, ele) {
var panels = $(ele).find('.panel');
var panelArr = [];
$(ele).attr('id', 'grid-' + index);
panels.each(function(i, e) {
var panelID = $(e).attr('id');
panelArr.push(panelID);
});
gridsArr[index] = panelArr;
});
var checkedPosition = JSON.stringify(gridsArr);
// return panel positions array
return checkedPosition;
},
setPositions: function(options) {
// Variables
var obj = this;
var localPositions = localStorage.getItem(positionsKey);
var parsePosition = JSON.parse(localPositions);
// Pull localstorage obj, parse the data, and then loop
// through each panel and set its position
$(pluginGrid).each(function(i, e) {
var rowID = $(e)
$.each(parsePosition[i], function(i, ele) {
$('#' + ele).appendTo(rowID);
});
});
},
updatePositions: function(options) {
localStorage.setItem(positionsKey, methods.findPositions());
// onSave callback
if (typeof options.onSave == 'function') {
options.onSave();
}
},
updateSettings: function(options) {
localStorage.setItem(settingsKey, methods.modifySettings());
// onSave callback
if (typeof options.onSave == 'function') {
options.onSave();
}
}
}
// Plugin implementation
return this.each(function() {
methods.init.call(plugin, options);
});
};
})(jQuery, window, document);

View File

@@ -0,0 +1,927 @@
/**
* bootbox.js [master branch]
*
* http://bootboxjs.com/license.txt
*/
// @see https://github.com/makeusabrew/bootbox/issues/180
// @see https://github.com/makeusabrew/bootbox/issues/186
(function (root, factory) {
"use strict";
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define(["jquery"], factory);
} else if (typeof exports === "object") {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require("jquery"));
} else {
// Browser globals (root is window)
root.bootbox = factory(root.jQuery);
}
}(this, function init($, undefined) {
"use strict";
// the base DOM structure needed to create a modal
var templates = {
dialog:
"<div class='bootbox modal' tabindex='-1' role='dialog'>" +
"<div class='modal-dialog'>" +
"<div class='modal-content'>" +
"<div class='modal-body'><div class='bootbox-body'></div></div>" +
"</div>" +
"</div>" +
"</div>",
header:
"<div class='modal-header'>" +
"<h4 class='modal-title'></h4>" +
"</div>",
footer:
"<div class='modal-footer'></div>",
closeButton:
"<button type='button' class='bootbox-close-button close' data-dismiss='modal' aria-hidden='true'>&times;</button>",
form:
"<form class='bootbox-form'></form>",
inputs: {
text:
"<input class='bootbox-input bootbox-input-text form-control' autocomplete=off type=text />",
textarea:
"<textarea class='bootbox-input bootbox-input-textarea form-control'></textarea>",
email:
"<input class='bootbox-input bootbox-input-email form-control' autocomplete='off' type='email' />",
select:
"<select class='bootbox-input bootbox-input-select form-control'></select>",
checkbox:
"<div class='checkbox'><label><input class='bootbox-input bootbox-input-checkbox' type='checkbox' /></label></div>",
date:
"<input class='bootbox-input bootbox-input-date form-control' autocomplete=off type='date' />",
time:
"<input class='bootbox-input bootbox-input-time form-control' autocomplete=off type='time' />",
number:
"<input class='bootbox-input bootbox-input-number form-control' autocomplete=off type='number' />",
password:
"<input class='bootbox-input bootbox-input-password form-control' autocomplete='off' type='password' />"
}
};
var defaults = {
// default language
locale: "en",
// show backdrop or not
backdrop: true,
// animate the modal in/out
animate: true,
// additional class string applied to the top level dialog
className: null,
// whether or not to enable keyboard binding
keyboard: false,
// whether or not to include a close button
closeButton: true,
// show the dialog immediately by default
show: true,
// dialog container
container: "body"
};
// our public object; augmented after our private API
var exports = {};
/**
* @private
*/
function _t(key) {
var locale = locales[defaults.locale];
return locale ? locale[key] : locales.en[key];
}
function processCallback(e, dialog, callback) {
e.stopPropagation();
e.preventDefault();
// by default we assume a callback will get rid of the dialog,
// although it is given the opportunity to override this
// so, if the callback can be invoked and it *explicitly returns false*
// then we'll set a flag to keep the dialog active...
var preserveDialog = $.isFunction(callback) && callback(e) === false;
// ... otherwise we'll bin it
if (!preserveDialog) {
dialog.modal("hide");
}
}
function getKeyLength(obj) {
// @TODO defer to Object.keys(x).length if available?
var k, t = 0;
for (k in obj) {
t ++;
}
return t;
}
function each(collection, iterator) {
var index = 0;
$.each(collection, function(key, value) {
iterator(key, value, index++);
});
}
function sanitize(options) {
var buttons;
var total;
if (typeof options !== "object") {
throw new Error("Please supply an object of options");
}
if (!options.message) {
throw new Error("Please specify a message");
}
// make sure any supplied options take precedence over defaults
options = $.extend({}, defaults, options);
if (!options.buttons) {
options.buttons = {};
}
// we only support Bootstrap's "static" and false backdrop args
// supporting true would mean you could dismiss the dialog without
// explicitly interacting with it
options.backdrop = options.backdrop ? "static" : false;
buttons = options.buttons;
total = getKeyLength(buttons);
each(buttons, function(key, button, index) {
if ($.isFunction(button)) {
// short form, assume value is our callback. Since button
// isn't an object it isn't a reference either so re-assign it
button = buttons[key] = {
callback: button
};
}
// before any further checks make sure by now button is the correct type
if ($.type(button) !== "object") {
throw new Error("button with key " + key + " must be an object");
}
if (!button.label) {
// the lack of an explicit label means we'll assume the key is good enough
button.label = key;
}
if (!button.className) {
if (total <= 2 && index === total-1) {
// always add a primary to the main option in a two-button dialog
button.className = "btn-primary";
} else {
button.className = "btn-default";
}
}
});
return options;
}
/**
* map a flexible set of arguments into a single returned object
* if args.length is already one just return it, otherwise
* use the properties argument to map the unnamed args to
* object properties
* so in the latter case:
* mapArguments(["foo", $.noop], ["message", "callback"])
* -> { message: "foo", callback: $.noop }
*/
function mapArguments(args, properties) {
var argn = args.length;
var options = {};
if (argn < 1 || argn > 2) {
throw new Error("Invalid argument length");
}
if (argn === 2 || typeof args[0] === "string") {
options[properties[0]] = args[0];
options[properties[1]] = args[1];
} else {
options = args[0];
}
return options;
}
/**
* merge a set of default dialog options with user supplied arguments
*/
function mergeArguments(defaults, args, properties) {
return $.extend(
// deep merge
true,
// ensure the target is an empty, unreferenced object
{},
// the base options object for this type of dialog (often just buttons)
defaults,
// args could be an object or array; if it's an array properties will
// map it to a proper options object
mapArguments(
args,
properties
)
);
}
/**
* this entry-level method makes heavy use of composition to take a simple
* range of inputs and return valid options suitable for passing to bootbox.dialog
*/
function mergeDialogOptions(className, labels, properties, args) {
// build up a base set of dialog properties
var baseOptions = {
className: "bootbox-" + className,
buttons: createLabels.apply(null, labels)
};
// ensure the buttons properties generated, *after* merging
// with user args are still valid against the supplied labels
return validateButtons(
// merge the generated base properties with user supplied arguments
mergeArguments(
baseOptions,
args,
// if args.length > 1, properties specify how each arg maps to an object key
properties
),
labels
);
}
/**
* from a given list of arguments return a suitable object of button labels
* all this does is normalise the given labels and translate them where possible
* e.g. "ok", "confirm" -> { ok: "OK, cancel: "Annuleren" }
*/
function createLabels() {
var buttons = {};
for (var i = 0, j = arguments.length; i < j; i++) {
var argument = arguments[i];
var key = argument.toLowerCase();
var value = argument.toUpperCase();
buttons[key] = {
label: _t(value)
};
}
return buttons;
}
function validateButtons(options, buttons) {
var allowedButtons = {};
each(buttons, function(key, value) {
allowedButtons[value] = true;
});
each(options.buttons, function(key) {
if (allowedButtons[key] === undefined) {
throw new Error("button key " + key + " is not allowed (options are " + buttons.join("\n") + ")");
}
});
return options;
}
exports.defineLocale = function (name, values) {
if (values) {
locales[name] = {
OK: values.OK,
CANCEL: values.CANCEL,
CONFIRM: values.CONFIRM
};
return locales[name];
} else {
delete locales[name];
return null;
}
};
exports.alert = function() {
var options;
options = mergeDialogOptions("alert", ["ok"], ["message", "callback"], arguments);
if (options.callback && !$.isFunction(options.callback)) {
throw new Error("alert requires callback property to be a function when provided");
}
/**
* overrides
*/
options.buttons.ok.callback = options.onEscape = function() {
if ($.isFunction(options.callback)) {
return options.callback();
}
return true;
};
return exports.dialog(options);
};
exports.confirm = function() {
var options;
options = mergeDialogOptions("confirm", ["cancel", "confirm"], ["message", "callback"], arguments);
/**
* overrides; undo anything the user tried to set they shouldn't have
*/
options.buttons.cancel.callback = options.onEscape = function() {
return options.callback(false);
};
options.buttons.confirm.callback = function() {
return options.callback(true);
};
// confirm specific validation
if (!$.isFunction(options.callback)) {
throw new Error("confirm requires a callback");
}
return exports.dialog(options);
};
exports.prompt = function() {
var options;
var defaults;
var dialog;
var form;
var input;
var shouldShow;
var inputOptions;
// we have to create our form first otherwise
// its value is undefined when gearing up our options
// @TODO this could be solved by allowing message to
// be a function instead...
form = $(templates.form);
// prompt defaults are more complex than others in that
// users can override more defaults
// @TODO I don't like that prompt has to do a lot of heavy
// lifting which mergeDialogOptions can *almost* support already
// just because of 'value' and 'inputType' - can we refactor?
defaults = {
className: "bootbox-prompt",
buttons: createLabels("cancel", "confirm"),
value: "",
inputType: "text"
};
options = validateButtons(
mergeArguments(defaults, arguments, ["title", "callback"]),
["cancel", "confirm"]
);
// capture the user's show value; we always set this to false before
// spawning the dialog to give us a chance to attach some handlers to
// it, but we need to make sure we respect a preference not to show it
shouldShow = (options.show === undefined) ? true : options.show;
/**
* overrides; undo anything the user tried to set they shouldn't have
*/
options.message = form;
options.buttons.cancel.callback = options.onEscape = function() {
return options.callback(null);
};
options.buttons.confirm.callback = function() {
var value;
switch (options.inputType) {
case "text":
case "textarea":
case "email":
case "select":
case "date":
case "time":
case "number":
case "password":
value = input.val();
break;
case "checkbox":
var checkedItems = input.find("input:checked");
// we assume that checkboxes are always multiple,
// hence we default to an empty array
value = [];
each(checkedItems, function(_, item) {
value.push($(item).val());
});
break;
}
return options.callback(value);
};
options.show = false;
// prompt specific validation
if (!options.title) {
throw new Error("prompt requires a title");
}
if (!$.isFunction(options.callback)) {
throw new Error("prompt requires a callback");
}
if (!templates.inputs[options.inputType]) {
throw new Error("invalid prompt type");
}
// create the input based on the supplied type
input = $(templates.inputs[options.inputType]);
switch (options.inputType) {
case "text":
case "textarea":
case "email":
case "date":
case "time":
case "number":
case "password":
input.val(options.value);
break;
case "select":
var groups = {};
inputOptions = options.inputOptions || [];
if (!inputOptions.length) {
throw new Error("prompt with select requires options");
}
each(inputOptions, function(_, option) {
// assume the element to attach to is the input...
var elem = input;
if (option.value === undefined || option.text === undefined) {
throw new Error("given options in wrong format");
}
// ... but override that element if this option sits in a group
if (option.group) {
// initialise group if necessary
if (!groups[option.group]) {
groups[option.group] = $("<optgroup/>").attr("label", option.group);
}
elem = groups[option.group];
}
elem.append("<option value='" + option.value + "'>" + option.text + "</option>");
});
each(groups, function(_, group) {
input.append(group);
});
// safe to set a select's value as per a normal input
input.val(options.value);
break;
case "checkbox":
var values = $.isArray(options.value) ? options.value : [options.value];
inputOptions = options.inputOptions || [];
if (!inputOptions.length) {
throw new Error("prompt with checkbox requires options");
}
if (!inputOptions[0].value || !inputOptions[0].text) {
throw new Error("given options in wrong format");
}
// checkboxes have to nest within a containing element, so
// they break the rules a bit and we end up re-assigning
// our 'input' element to this container instead
input = $("<div/>");
each(inputOptions, function(_, option) {
var checkbox = $(templates.inputs[options.inputType]);
checkbox.find("input").attr("value", option.value);
checkbox.find("label").append(option.text);
// we've ensured values is an array so we can always iterate over it
each(values, function(_, value) {
if (value === option.value) {
checkbox.find("input").prop("checked", true);
}
});
input.append(checkbox);
});
break;
}
if (options.placeholder) {
input.attr("placeholder", options.placeholder);
}
if(options.pattern){
input.attr("pattern", options.pattern);
}
// now place it in our form
form.append(input);
form.on("submit", function(e) {
e.preventDefault();
// Fix for SammyJS (or similar JS routing library) hijacking the form post.
e.stopPropagation();
// @TODO can we actually click *the* button object instead?
// e.g. buttons.confirm.click() or similar
dialog.find(".btn-primary").click();
});
dialog = exports.dialog(options);
// clear the existing handler focusing the submit button...
dialog.off("shown.bs.modal");
// ...and replace it with one focusing our input, if possible
dialog.on("shown.bs.modal", function() {
input.focus();
});
if (shouldShow === true) {
dialog.modal("show");
}
return dialog;
};
exports.dialog = function(options) {
options = sanitize(options);
var dialog = $(templates.dialog);
var innerDialog = dialog.find(".modal-dialog");
var body = dialog.find(".modal-body");
var buttons = options.buttons;
var buttonStr = "";
var callbacks = {
onEscape: options.onEscape
};
if ($.fn.modal === undefined) {
throw new Error(
"$.fn.modal is not defined; please double check you have included " +
"the Bootstrap JavaScript library. See http://getbootstrap.com/javascript/ " +
"for more details."
);
}
each(buttons, function(key, button) {
// @TODO I don't like this string appending to itself; bit dirty. Needs reworking
// can we just build up button elements instead? slower but neater. Then button
// can just become a template too
buttonStr += "<button data-bb-handler='" + key + "' type='button' class='btn " + button.className + "'>" + button.label + "</button>";
callbacks[key] = button.callback;
});
body.find(".bootbox-body").html(options.message);
if (options.animate === true) {
dialog.addClass("fade");
}
if (options.className) {
dialog.addClass(options.className);
}
if (options.size === "large") {
innerDialog.addClass("modal-lg");
}
if (options.size === "small") {
innerDialog.addClass("modal-sm");
}
if (options.title) {
body.before(templates.header);
}
if (options.closeButton) {
var closeButton = $(templates.closeButton);
if (options.title) {
dialog.find(".modal-header").prepend(closeButton);
} else {
closeButton.css("margin-top", "-10px").prependTo(body);
}
}
if (options.title) {
dialog.find(".modal-title").html(options.title);
}
if (buttonStr.length) {
body.after(templates.footer);
dialog.find(".modal-footer").html(buttonStr);
}
/**
* Bootstrap event listeners; used handle extra
* setup & teardown required after the underlying
* modal has performed certain actions
*/
dialog.on("hidden.bs.modal", function(e) {
// ensure we don't accidentally intercept hidden events triggered
// by children of the current dialog. We shouldn't anymore now BS
// namespaces its events; but still worth doing
if (e.target === this) {
dialog.remove();
}
});
/*
dialog.on("show.bs.modal", function() {
// sadly this doesn't work; show is called *just* before
// the backdrop is added so we'd need a setTimeout hack or
// otherwise... leaving in as would be nice
if (options.backdrop) {
dialog.next(".modal-backdrop").addClass("bootbox-backdrop");
}
});
*/
dialog.on("shown.bs.modal", function() {
dialog.find(".btn-primary:first").focus();
});
/**
* Bootbox event listeners; experimental and may not last
* just an attempt to decouple some behaviours from their
* respective triggers
*/
dialog.on("escape.close.bb", function(e) {
if (callbacks.onEscape) {
processCallback(e, dialog, callbacks.onEscape);
}
});
/**
* Standard jQuery event listeners; used to handle user
* interaction with our dialog
*/
dialog.on("click", ".modal-footer button", function(e) {
var callbackKey = $(this).data("bb-handler");
processCallback(e, dialog, callbacks[callbackKey]);
});
dialog.on("click", ".bootbox-close-button", function(e) {
// onEscape might be falsy but that's fine; the fact is
// if the user has managed to click the close button we
// have to close the dialog, callback or not
processCallback(e, dialog, callbacks.onEscape);
});
dialog.on("keyup", function(e) {
if (e.which === 27) {
dialog.trigger("escape.close.bb");
}
});
// the remainder of this method simply deals with adding our
// dialogent to the DOM, augmenting it with Bootstrap's modal
// functionality and then giving the resulting object back
// to our caller
$(options.container).append(dialog);
dialog.modal({
backdrop: options.backdrop,
keyboard: options.keyboard || false,
show: false
});
if (options.show) {
dialog.modal("show");
}
// @TODO should we return the raw element here or should
// we wrap it in an object on which we can expose some neater
// methods, e.g. var d = bootbox.alert(); d.hide(); instead
// of d.modal("hide");
/*
function BBDialog(elem) {
this.elem = elem;
}
BBDialog.prototype = {
hide: function() {
return this.elem.modal("hide");
},
show: function() {
return this.elem.modal("show");
}
};
*/
return dialog;
};
exports.setDefaults = function() {
var values = {};
if (arguments.length === 2) {
// allow passing of single key/value...
values[arguments[0]] = arguments[1];
} else {
// ... and as an object too
values = arguments[0];
}
$.extend(defaults, values);
};
exports.hideAll = function() {
$(".bootbox").modal("hide");
return exports;
};
/**
* standard locales. Please add more according to ISO 639-1 standard. Multiple language variants are
* unlikely to be required. If this gets too large it can be split out into separate JS files.
*/
var locales = {
br : {
OK : "OK",
CANCEL : "Cancelar",
CONFIRM : "Sim"
},
cs : {
OK : "OK",
CANCEL : "Zrušit",
CONFIRM : "Potvrdit"
},
da : {
OK : "OK",
CANCEL : "Annuller",
CONFIRM : "Accepter"
},
de : {
OK : "OK",
CANCEL : "Abbrechen",
CONFIRM : "Akzeptieren"
},
el : {
OK : "Εντάξει",
CANCEL : "Ακύρωση",
CONFIRM : "Επιβεβαίωση"
},
en : {
OK : "OK",
CANCEL : "Cancel",
CONFIRM : "OK"
},
es : {
OK : "OK",
CANCEL : "Cancelar",
CONFIRM : "Aceptar"
},
et : {
OK : "OK",
CANCEL : "Katkesta",
CONFIRM : "OK"
},
fi : {
OK : "OK",
CANCEL : "Peruuta",
CONFIRM : "OK"
},
fr : {
OK : "OK",
CANCEL : "Annuler",
CONFIRM : "D'accord"
},
he : {
OK : "אישור",
CANCEL : "ביטול",
CONFIRM : "אישור"
},
hu : {
OK : "OK",
CANCEL : "Mégsem",
CONFIRM : "Megerősít"
},
hr : {
OK : "OK",
CANCEL : "Odustani",
CONFIRM : "Potvrdi"
},
id : {
OK : "OK",
CANCEL : "Batal",
CONFIRM : "OK"
},
it : {
OK : "OK",
CANCEL : "Annulla",
CONFIRM : "Conferma"
},
ja : {
OK : "OK",
CANCEL : "キャンセル",
CONFIRM : "確認"
},
lt : {
OK : "Gerai",
CANCEL : "Atšaukti",
CONFIRM : "Patvirtinti"
},
lv : {
OK : "Labi",
CANCEL : "Atcelt",
CONFIRM : "Apstiprināt"
},
nl : {
OK : "OK",
CANCEL : "Annuleren",
CONFIRM : "Accepteren"
},
no : {
OK : "OK",
CANCEL : "Avbryt",
CONFIRM : "OK"
},
pl : {
OK : "OK",
CANCEL : "Anuluj",
CONFIRM : "Potwierdź"
},
pt : {
OK : "OK",
CANCEL : "Cancelar",
CONFIRM : "Confirmar"
},
ru : {
OK : "OK",
CANCEL : "Отмена",
CONFIRM : "Применить"
},
sv : {
OK : "OK",
CANCEL : "Avbryt",
CONFIRM : "OK"
},
tr : {
OK : "Tamam",
CANCEL : "İptal",
CONFIRM : "Onayla"
},
zh_CN : {
OK : "OK",
CANCEL : "取消",
CONFIRM : "确认"
},
zh_TW : {
OK : "OK",
CANCEL : "取消",
CONFIRM : "確認"
}
};
exports.init = function(_$) {
return init(_$ || $);
};
return exports;
}));

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,142 @@
/* ========================================================================
* Bootstrap: affix.js v3.2.0
* http://getbootstrap.com/javascript/#affix
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// AFFIX CLASS DEFINITION
// ======================
var Affix = function (element, options) {
this.options = $.extend({}, Affix.DEFAULTS, options)
this.$target = $(this.options.target)
.on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
.on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))
this.$element = $(element)
this.affixed =
this.unpin =
this.pinnedOffset = null
this.checkPosition()
}
Affix.VERSION = '3.2.0'
Affix.RESET = 'affix affix-top affix-bottom'
Affix.DEFAULTS = {
offset: 0,
target: window
}
Affix.prototype.getPinnedOffset = function () {
if (this.pinnedOffset) return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
return (this.pinnedOffset = position.top - scrollTop)
}
Affix.prototype.checkPositionWithEventLoop = function () {
setTimeout($.proxy(this.checkPosition, this), 1)
}
Affix.prototype.checkPosition = function () {
if (!this.$element.is(':visible')) return
var scrollHeight = $(document).height()
var scrollTop = this.$target.scrollTop()
var position = this.$element.offset()
var offset = this.options.offset
var offsetTop = offset.top
var offsetBottom = offset.bottom
if (typeof offset != 'object') offsetBottom = offsetTop = offset
if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)
if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)
var affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false :
offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' :
offsetTop != null && (scrollTop <= offsetTop) ? 'top' : false
if (this.affixed === affix) return
if (this.unpin != null) this.$element.css('top', '')
var affixType = 'affix' + (affix ? '-' + affix : '')
var e = $.Event(affixType + '.bs.affix')
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
this.affixed = affix
this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null
this.$element
.removeClass(Affix.RESET)
.addClass(affixType)
.trigger($.Event(affixType.replace('affix', 'affixed')))
if (affix == 'bottom') {
this.$element.offset({
top: scrollHeight - this.$element.height() - offsetBottom
})
}
}
// AFFIX PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.affix')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.affix
$.fn.affix = Plugin
$.fn.affix.Constructor = Affix
// AFFIX NO CONFLICT
// =================
$.fn.affix.noConflict = function () {
$.fn.affix = old
return this
}
// AFFIX DATA-API
// ==============
$(window).on('load', function () {
$('[data-spy="affix"]').each(function () {
var $spy = $(this)
var data = $spy.data()
data.offset = data.offset || {}
if (data.offsetBottom) data.offset.bottom = data.offsetBottom
if (data.offsetTop) data.offset.top = data.offsetTop
Plugin.call($spy, data)
})
})
}(jQuery);

View File

@@ -0,0 +1,92 @@
/* ========================================================================
* Bootstrap: alert.js v3.2.0
* http://getbootstrap.com/javascript/#alerts
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// ALERT CLASS DEFINITION
// ======================
var dismiss = '[data-dismiss="alert"]'
var Alert = function (el) {
$(el).on('click', dismiss, this.close)
}
Alert.VERSION = '3.2.0'
Alert.prototype.close = function (e) {
var $this = $(this)
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = $(selector)
if (e) e.preventDefault()
if (!$parent.length) {
$parent = $this.hasClass('alert') ? $this : $this.parent()
}
$parent.trigger(e = $.Event('close.bs.alert'))
if (e.isDefaultPrevented()) return
$parent.removeClass('in')
function removeElement() {
// detach from parent, fire event then clean up data
$parent.detach().trigger('closed.bs.alert').remove()
}
$.support.transition && $parent.hasClass('fade') ?
$parent
.one('bsTransitionEnd', removeElement)
.emulateTransitionEnd(150) :
removeElement()
}
// ALERT PLUGIN DEFINITION
// =======================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.alert')
if (!data) $this.data('bs.alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.alert
$.fn.alert = Plugin
$.fn.alert.Constructor = Alert
// ALERT NO CONFLICT
// =================
$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}
// ALERT DATA-API
// ==============
$(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)
}(jQuery);

View File

@@ -0,0 +1,110 @@
/* ========================================================================
* Bootstrap: button.js v3.2.0
* http://getbootstrap.com/javascript/#buttons
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// BUTTON PUBLIC CLASS DEFINITION
// ==============================
var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Button.DEFAULTS, options)
this.isLoading = false
}
Button.VERSION = '3.2.0'
Button.DEFAULTS = {
loadingText: 'loading...'
}
Button.prototype.setState = function (state) {
var d = 'disabled'
var $el = this.$element
var val = $el.is('input') ? 'val' : 'html'
var data = $el.data()
state = state + 'Text'
if (data.resetText == null) $el.data('resetText', $el[val]())
$el[val](data[state] == null ? this.options[state] : data[state])
// push to event loop to allow forms to submit
setTimeout($.proxy(function () {
if (state == 'loadingText') {
this.isLoading = true
$el.addClass(d).attr(d, d)
} else if (this.isLoading) {
this.isLoading = false
$el.removeClass(d).removeAttr(d)
}
}, this), 0)
}
Button.prototype.toggle = function () {
var changed = true
var $parent = this.$element.closest('[data-toggle="buttons"]')
if ($parent.length) {
var $input = this.$element.find('input')
if ($input.prop('type') == 'radio') {
if ($input.prop('checked') && this.$element.hasClass('active')) changed = false
else $parent.find('.active').removeClass('active')
}
if (changed) $input.prop('checked', !this.$element.hasClass('active')).trigger('change')
}
if (changed) this.$element.toggleClass('active')
}
// BUTTON PLUGIN DEFINITION
// ========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.button')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}
var old = $.fn.button
$.fn.button = Plugin
$.fn.button.Constructor = Button
// BUTTON NO CONFLICT
// ==================
$.fn.button.noConflict = function () {
$.fn.button = old
return this
}
// BUTTON DATA-API
// ===============
$(document).on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
Plugin.call($btn, 'toggle')
e.preventDefault()
})
}(jQuery);

View File

@@ -0,0 +1,223 @@
/* ========================================================================
* Bootstrap: carousel.js v3.2.0
* http://getbootstrap.com/javascript/#carousel
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CAROUSEL CLASS DEFINITION
// =========================
var Carousel = function (element, options) {
this.$element = $(element).on('keydown.bs.carousel', $.proxy(this.keydown, this))
this.$indicators = this.$element.find('.carousel-indicators')
this.options = options
this.paused =
this.sliding =
this.interval =
this.$active =
this.$items = null
this.options.pause == 'hover' && this.$element
.on('mouseenter.bs.carousel', $.proxy(this.pause, this))
.on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
}
Carousel.VERSION = '3.2.0'
Carousel.DEFAULTS = {
interval: 5000,
pause: 'hover',
wrap: true
}
Carousel.prototype.keydown = function (e) {
switch (e.which) {
case 37: this.prev(); break
case 39: this.next(); break
default: return
}
e.preventDefault()
}
Carousel.prototype.cycle = function (e) {
e || (this.paused = false)
this.interval && clearInterval(this.interval)
this.options.interval
&& !this.paused
&& (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
return this
}
Carousel.prototype.getItemIndex = function (item) {
this.$items = item.parent().children('.item')
return this.$items.index(item || this.$active)
}
Carousel.prototype.to = function (pos) {
var that = this
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
if (pos > (this.$items.length - 1) || pos < 0) return
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos]))
}
Carousel.prototype.pause = function (e) {
e || (this.paused = true)
if (this.$element.find('.next, .prev').length && $.support.transition) {
this.$element.trigger($.support.transition.end)
this.cycle(true)
}
this.interval = clearInterval(this.interval)
return this
}
Carousel.prototype.next = function () {
if (this.sliding) return
return this.slide('next')
}
Carousel.prototype.prev = function () {
if (this.sliding) return
return this.slide('prev')
}
Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active')
var $next = next || $active[type]()
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
var fallback = type == 'next' ? 'first' : 'last'
var that = this
if (!$next.length) {
if (!this.options.wrap) return
$next = this.$element.find('.item')[fallback]()
}
if ($next.hasClass('active')) return (this.sliding = false)
var relatedTarget = $next[0]
var slideEvent = $.Event('slide.bs.carousel', {
relatedTarget: relatedTarget,
direction: direction
})
this.$element.trigger(slideEvent)
if (slideEvent.isDefaultPrevented()) return
this.sliding = true
isCycling && this.pause()
if (this.$indicators.length) {
this.$indicators.find('.active').removeClass('active')
var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
$nextIndicator && $nextIndicator.addClass('active')
}
var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
if ($.support.transition && this.$element.hasClass('slide')) {
$next.addClass(type)
$next[0].offsetWidth // force reflow
$active.addClass(direction)
$next.addClass(direction)
$active
.one('bsTransitionEnd', function () {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function () {
that.$element.trigger(slidEvent)
}, 0)
})
.emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000)
} else {
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger(slidEvent)
}
isCycling && this.cycle()
return this
}
// CAROUSEL PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.carousel')
var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
var action = typeof option == 'string' ? option : options.slide
if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
if (typeof option == 'number') data.to(option)
else if (action) data[action]()
else if (options.interval) data.pause().cycle()
})
}
var old = $.fn.carousel
$.fn.carousel = Plugin
$.fn.carousel.Constructor = Carousel
// CAROUSEL NO CONFLICT
// ====================
$.fn.carousel.noConflict = function () {
$.fn.carousel = old
return this
}
// CAROUSEL DATA-API
// =================
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
var href
var $this = $(this)
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
if (!$target.hasClass('carousel')) return
var options = $.extend({}, $target.data(), $this.data())
var slideIndex = $this.attr('data-slide-to')
if (slideIndex) options.interval = false
Plugin.call($target, options)
if (slideIndex) {
$target.data('bs.carousel').to(slideIndex)
}
e.preventDefault()
})
$(window).on('load', function () {
$('[data-ride="carousel"]').each(function () {
var $carousel = $(this)
Plugin.call($carousel, $carousel.data())
})
})
}(jQuery);

View File

@@ -0,0 +1,170 @@
/* ========================================================================
* Bootstrap: collapse.js v3.2.0
* http://getbootstrap.com/javascript/#collapse
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// COLLAPSE PUBLIC CLASS DEFINITION
// ================================
var Collapse = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, Collapse.DEFAULTS, options)
this.transitioning = null
if (this.options.parent) this.$parent = $(this.options.parent)
if (this.options.toggle) this.toggle()
}
Collapse.VERSION = '3.2.0'
Collapse.DEFAULTS = {
toggle: true
}
Collapse.prototype.dimension = function () {
var hasWidth = this.$element.hasClass('width')
return hasWidth ? 'width' : 'height'
}
Collapse.prototype.show = function () {
if (this.transitioning || this.$element.hasClass('in')) return
var startEvent = $.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
var actives = this.$parent && this.$parent.find('> .panel > .in')
if (actives && actives.length) {
var hasData = actives.data('bs.collapse')
if (hasData && hasData.transitioning) return
Plugin.call(actives, 'hide')
hasData || actives.data('bs.collapse', null)
}
var dimension = this.dimension()
this.$element
.removeClass('collapse')
.addClass('collapsing')[dimension](0)
this.transitioning = 1
var complete = function () {
this.$element
.removeClass('collapsing')
.addClass('collapse in')[dimension]('')
this.transitioning = 0
this.$element
.trigger('shown.bs.collapse')
}
if (!$.support.transition) return complete.call(this)
var scrollSize = $.camelCase(['scroll', dimension].join('-'))
this.$element
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])
}
Collapse.prototype.hide = function () {
if (this.transitioning || !this.$element.hasClass('in')) return
var startEvent = $.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if (startEvent.isDefaultPrevented()) return
var dimension = this.dimension()
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
this.$element
.addClass('collapsing')
.removeClass('collapse')
.removeClass('in')
this.transitioning = 1
var complete = function () {
this.transitioning = 0
this.$element
.trigger('hidden.bs.collapse')
.removeClass('collapsing')
.addClass('collapse')
}
if (!$.support.transition) return complete.call(this)
this.$element
[dimension](0)
.one('bsTransitionEnd', $.proxy(complete, this))
.emulateTransitionEnd(350)
}
Collapse.prototype.toggle = function () {
this[this.$element.hasClass('in') ? 'hide' : 'show']()
}
// COLLAPSE PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.collapse')
var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data && options.toggle && option == 'show') option = !option
if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.collapse
$.fn.collapse = Plugin
$.fn.collapse.Constructor = Collapse
// COLLAPSE NO CONFLICT
// ====================
$.fn.collapse.noConflict = function () {
$.fn.collapse = old
return this
}
// COLLAPSE DATA-API
// =================
$(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
var href
var $this = $(this)
var target = $this.attr('data-target')
|| e.preventDefault()
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
var $target = $(target)
var data = $target.data('bs.collapse')
var option = data ? 'toggle' : $this.data()
var parent = $this.attr('data-parent')
var $parent = parent && $(parent)
if (!data || !data.transitioning) {
if ($parent) $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed')
$this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed')
}
Plugin.call($target, option)
})
}(jQuery);

View File

@@ -0,0 +1,151 @@
/* ========================================================================
* Bootstrap: dropdown.js v3.2.0
* http://getbootstrap.com/javascript/#dropdowns
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// DROPDOWN CLASS DEFINITION
// =========================
var backdrop = '.dropdown-backdrop'
var toggle = '[data-toggle="dropdown"]'
var Dropdown = function (element) {
$(element).on('click.bs.dropdown', this.toggle)
}
Dropdown.VERSION = '3.2.0'
Dropdown.prototype.toggle = function (e) {
var $this = $(this)
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
clearMenus()
if (!isActive) {
if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
// if mobile we use a backdrop because click events don't delegate
$('<div class="dropdown-backdrop"/>').insertAfter($(this)).on('click', clearMenus)
}
var relatedTarget = { relatedTarget: this }
$parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$this.trigger('focus')
$parent
.toggleClass('open')
.trigger('shown.bs.dropdown', relatedTarget)
}
return false
}
Dropdown.prototype.keydown = function (e) {
if (!/(38|40|27)/.test(e.keyCode)) return
var $this = $(this)
e.preventDefault()
e.stopPropagation()
if ($this.is('.disabled, :disabled')) return
var $parent = getParent($this)
var isActive = $parent.hasClass('open')
if (!isActive || (isActive && e.keyCode == 27)) {
if (e.which == 27) $parent.find(toggle).trigger('focus')
return $this.trigger('click')
}
var desc = ' li:not(.divider):visible a'
var $items = $parent.find('[role="menu"]' + desc + ', [role="listbox"]' + desc)
if (!$items.length) return
var index = $items.index($items.filter(':focus'))
if (e.keyCode == 38 && index > 0) index-- // up
if (e.keyCode == 40 && index < $items.length - 1) index++ // down
if (!~index) index = 0
$items.eq(index).trigger('focus')
}
function clearMenus(e) {
if (e && e.which === 3) return
$(backdrop).remove()
$(toggle).each(function () {
var $parent = getParent($(this))
var relatedTarget = { relatedTarget: this }
if (!$parent.hasClass('open')) return
$parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))
if (e.isDefaultPrevented()) return
$parent.removeClass('open').trigger('hidden.bs.dropdown', relatedTarget)
})
}
function getParent($this) {
var selector = $this.attr('data-target')
if (!selector) {
selector = $this.attr('href')
selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
var $parent = selector && $(selector)
return $parent && $parent.length ? $parent : $this.parent()
}
// DROPDOWN PLUGIN DEFINITION
// ==========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.dropdown')
if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
if (typeof option == 'string') data[option].call($this)
})
}
var old = $.fn.dropdown
$.fn.dropdown = Plugin
$.fn.dropdown.Constructor = Dropdown
// DROPDOWN NO CONFLICT
// ====================
$.fn.dropdown.noConflict = function () {
$.fn.dropdown = old
return this
}
// APPLY TO STANDARD DROPDOWN ELEMENTS
// ===================================
$(document)
.on('click.bs.dropdown.data-api', clearMenus)
.on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
.on('keydown.bs.dropdown.data-api', toggle + ', [role="menu"], [role="listbox"]', Dropdown.prototype.keydown)
}(jQuery);

View File

@@ -0,0 +1,280 @@
/* ========================================================================
* Bootstrap: modal.js v3.2.0
* http://getbootstrap.com/javascript/#modals
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// MODAL CLASS DEFINITION
// ======================
var Modal = function (element, options) {
this.options = options
this.$body = $(document.body)
this.$element = $(element)
this.$backdrop =
this.isShown = null
this.scrollbarWidth = 0
if (this.options.remote) {
this.$element
.find('.modal-content')
.load(this.options.remote, $.proxy(function () {
this.$element.trigger('loaded.bs.modal')
}, this))
}
}
Modal.VERSION = '3.2.0'
Modal.DEFAULTS = {
backdrop: true,
keyboard: true,
show: true
}
Modal.prototype.toggle = function (_relatedTarget) {
return this.isShown ? this.hide() : this.show(_relatedTarget)
}
Modal.prototype.show = function (_relatedTarget) {
var that = this
var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.checkScrollbar()
this.$body.addClass('modal-open')
this.setScrollbar()
this.escape()
this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(that.$body) // don't move modals dom position
}
that.$element
.show()
.scrollTop(0)
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })
transition ?
that.$element.find('.modal-dialog') // wait for modal to slide in
.one('bsTransitionEnd', function () {
that.$element.trigger('focus').trigger(e)
})
.emulateTransitionEnd(300) :
that.$element.trigger('focus').trigger(e)
})
}
Modal.prototype.hide = function (e) {
if (e) e.preventDefault()
e = $.Event('hide.bs.modal')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
this.$body.removeClass('modal-open')
this.resetScrollbar()
this.escape()
$(document).off('focusin.bs.modal')
this.$element
.removeClass('in')
.attr('aria-hidden', true)
.off('click.dismiss.bs.modal')
$.support.transition && this.$element.hasClass('fade') ?
this.$element
.one('bsTransitionEnd', $.proxy(this.hideModal, this))
.emulateTransitionEnd(300) :
this.hideModal()
}
Modal.prototype.enforceFocus = function () {
$(document)
.off('focusin.bs.modal') // guard against infinite focus loop
.on('focusin.bs.modal', $.proxy(function (e) {
if (this.$element[0] !== e.target && !this.$element.has(e.target).length) {
this.$element.trigger('focus')
}
}, this))
}
Modal.prototype.escape = function () {
if (this.isShown && this.options.keyboard) {
this.$element.on('keyup.dismiss.bs.modal', $.proxy(function (e) {
e.which == 27 && this.hide()
}, this))
} else if (!this.isShown) {
this.$element.off('keyup.dismiss.bs.modal')
}
}
Modal.prototype.hideModal = function () {
var that = this
this.$element.hide()
this.backdrop(function () {
that.$element.trigger('hidden.bs.modal')
})
}
Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove()
this.$backdrop = null
}
Modal.prototype.backdrop = function (callback) {
var that = this
var animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(this.$body)
this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
if (e.target !== e.currentTarget) return
this.options.backdrop == 'static'
? this.$element[0].focus.call(this.$element[0])
: this.hide.call(this)
}, this))
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
if (!callback) return
doAnimate ?
this.$backdrop
.one('bsTransitionEnd', callback)
.emulateTransitionEnd(150) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
var callbackRemove = function () {
that.removeBackdrop()
callback && callback()
}
$.support.transition && this.$element.hasClass('fade') ?
this.$backdrop
.one('bsTransitionEnd', callbackRemove)
.emulateTransitionEnd(150) :
callbackRemove()
} else if (callback) {
callback()
}
}
Modal.prototype.checkScrollbar = function () {
if (document.body.clientWidth >= window.innerWidth) return
this.scrollbarWidth = this.scrollbarWidth || this.measureScrollbar()
}
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
if (this.scrollbarWidth) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
}
Modal.prototype.resetScrollbar = function () {
this.$body.css('padding-right', '')
}
Modal.prototype.measureScrollbar = function () { // thx walsh
var scrollDiv = document.createElement('div')
scrollDiv.className = 'modal-scrollbar-measure'
this.$body.append(scrollDiv)
var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
this.$body[0].removeChild(scrollDiv)
return scrollbarWidth
}
// MODAL PLUGIN DEFINITION
// =======================
function Plugin(option, _relatedTarget) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.modal')
var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option](_relatedTarget)
else if (options.show) data.show(_relatedTarget)
})
}
var old = $.fn.modal
$.fn.modal = Plugin
$.fn.modal.Constructor = Modal
// MODAL NO CONFLICT
// =================
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
// MODAL DATA-API
// ==============
$(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
var href = $this.attr('href')
var $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) // strip for ie7
var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())
if ($this.is('a')) e.preventDefault()
$target.one('show.bs.modal', function (showEvent) {
if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
$target.one('hidden.bs.modal', function () {
$this.is(':visible') && $this.trigger('focus')
})
})
Plugin.call($target, option, this)
})
}(jQuery);

View File

@@ -0,0 +1,113 @@
/* ========================================================================
* Bootstrap: popover.js v3.2.0
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// POPOVER PUBLIC CLASS DEFINITION
// ===============================
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.2.0'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
Popover.prototype.getDefaults = function () {
return Popover.DEFAULTS
}
Popover.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
var content = this.getContent()
$tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
$tip.find('.popover-content').empty()[ // we use append for html objects to maintain js events
this.options.html ? (typeof content == 'string' ? 'html' : 'append') : 'text'
](content)
$tip.removeClass('fade top bottom left right in')
// IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
// this manually by checking the contents.
if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
}
Popover.prototype.hasContent = function () {
return this.getTitle() || this.getContent()
}
Popover.prototype.getContent = function () {
var $e = this.$element
var o = this.options
return $e.attr('data-content')
|| (typeof o.content == 'function' ?
o.content.call($e[0]) :
o.content)
}
Popover.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
}
Popover.prototype.tip = function () {
if (!this.$tip) this.$tip = $(this.options.template)
return this.$tip
}
// POPOVER PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.popover')
var options = typeof option == 'object' && option
if (!data && option == 'destroy') return
if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.popover
$.fn.popover = Plugin
$.fn.popover.Constructor = Popover
// POPOVER NO CONFLICT
// ===================
$.fn.popover.noConflict = function () {
$.fn.popover = old
return this
}
}(jQuery);

View File

@@ -0,0 +1,170 @@
/* ========================================================================
* Bootstrap: scrollspy.js v3.2.0
* http://getbootstrap.com/javascript/#scrollspy
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// SCROLLSPY CLASS DEFINITION
// ==========================
function ScrollSpy(element, options) {
var process = $.proxy(this.process, this)
this.$body = $('body')
this.$scrollElement = $(element).is('body') ? $(window) : $(element)
this.options = $.extend({}, ScrollSpy.DEFAULTS, options)
this.selector = (this.options.target || '') + ' .nav li > a'
this.offsets = []
this.targets = []
this.activeTarget = null
this.scrollHeight = 0
this.$scrollElement.on('scroll.bs.scrollspy', process)
this.refresh()
this.process()
}
ScrollSpy.VERSION = '3.2.0'
ScrollSpy.DEFAULTS = {
offset: 10
}
ScrollSpy.prototype.getScrollHeight = function () {
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
}
ScrollSpy.prototype.refresh = function () {
var offsetMethod = 'offset'
var offsetBase = 0
if (!$.isWindow(this.$scrollElement[0])) {
offsetMethod = 'position'
offsetBase = this.$scrollElement.scrollTop()
}
this.offsets = []
this.targets = []
this.scrollHeight = this.getScrollHeight()
var self = this
this.$body
.find(this.selector)
.map(function () {
var $el = $(this)
var href = $el.data('target') || $el.attr('href')
var $href = /^#./.test(href) && $(href)
return ($href
&& $href.length
&& $href.is(':visible')
&& [[$href[offsetMethod]().top + offsetBase, href]]) || null
})
.sort(function (a, b) { return a[0] - b[0] })
.each(function () {
self.offsets.push(this[0])
self.targets.push(this[1])
})
}
ScrollSpy.prototype.process = function () {
var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
var scrollHeight = this.getScrollHeight()
var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()
var offsets = this.offsets
var targets = this.targets
var activeTarget = this.activeTarget
var i
if (this.scrollHeight != scrollHeight) {
this.refresh()
}
if (scrollTop >= maxScroll) {
return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
}
if (activeTarget && scrollTop <= offsets[0]) {
return activeTarget != (i = targets[0]) && this.activate(i)
}
for (i = offsets.length; i--;) {
activeTarget != targets[i]
&& scrollTop >= offsets[i]
&& (!offsets[i + 1] || scrollTop <= offsets[i + 1])
&& this.activate(targets[i])
}
}
ScrollSpy.prototype.activate = function (target) {
this.activeTarget = target
$(this.selector)
.parentsUntil(this.options.target, '.active')
.removeClass('active')
var selector = this.selector +
'[data-target="' + target + '"],' +
this.selector + '[href="' + target + '"]'
var active = $(selector)
.parents('li')
.addClass('active')
if (active.parent('.dropdown-menu').length) {
active = active
.closest('li.dropdown')
.addClass('active')
}
active.trigger('activate.bs.scrollspy')
}
// SCROLLSPY PLUGIN DEFINITION
// ===========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.scrollspy')
var options = typeof option == 'object' && option
if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.scrollspy
$.fn.scrollspy = Plugin
$.fn.scrollspy.Constructor = ScrollSpy
// SCROLLSPY NO CONFLICT
// =====================
$.fn.scrollspy.noConflict = function () {
$.fn.scrollspy = old
return this
}
// SCROLLSPY DATA-API
// ==================
$(window).on('load.bs.scrollspy.data-api', function () {
$('[data-spy="scroll"]').each(function () {
var $spy = $(this)
Plugin.call($spy, $spy.data())
})
})
}(jQuery);

View File

@@ -0,0 +1,128 @@
/* ========================================================================
* Bootstrap: tab.js v3.2.0
* http://getbootstrap.com/javascript/#tabs
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TAB CLASS DEFINITION
// ====================
var Tab = function (element) {
this.element = $(element)
}
Tab.VERSION = '3.2.0'
Tab.prototype.show = function () {
var $this = this.element
var $ul = $this.closest('ul:not(.dropdown-menu)')
var selector = $this.data('target')
if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
}
if ($this.parent('li').hasClass('active')) return
var previous = $ul.find('.active:last a')[0]
var e = $.Event('show.bs.tab', {
relatedTarget: previous
})
$this.trigger(e)
if (e.isDefaultPrevented()) return
var $target = $(selector)
this.activate($this.closest('li'), $ul)
this.activate($target, $target.parent(), function () {
$this.trigger({
type: 'shown.bs.tab',
relatedTarget: previous
})
})
}
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& $active.hasClass('fade')
function next() {
$active
.removeClass('active')
.find('> .dropdown-menu > .active')
.removeClass('active')
element.addClass('active')
if (transition) {
element[0].offsetWidth // reflow for transition
element.addClass('in')
} else {
element.removeClass('fade')
}
if (element.parent('.dropdown-menu')) {
element.closest('li.dropdown').addClass('active')
}
callback && callback()
}
transition ?
$active
.one('bsTransitionEnd', next)
.emulateTransitionEnd(150) :
next()
$active.removeClass('in')
}
// TAB PLUGIN DEFINITION
// =====================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tab')
if (!data) $this.data('bs.tab', (data = new Tab(this)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tab
$.fn.tab = Plugin
$.fn.tab.Constructor = Tab
// TAB NO CONFLICT
// ===============
$.fn.tab.noConflict = function () {
$.fn.tab = old
return this
}
// TAB DATA-API
// ============
$(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
e.preventDefault()
Plugin.call($(this), 'show')
})
}(jQuery);

View File

@@ -0,0 +1,457 @@
/* ========================================================================
* Bootstrap: tooltip.js v3.2.0
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// TOOLTIP PUBLIC CLASS DEFINITION
// ===============================
var Tooltip = function (element, options) {
this.type =
this.options =
this.enabled =
this.timeout =
this.hoverState =
this.$element = null
this.init('tooltip', element, options)
}
Tooltip.VERSION = '3.2.0'
Tooltip.DEFAULTS = {
animation: true,
placement: 'top',
selector: false,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
container: false,
viewport: {
selector: 'body',
padding: 0
}
}
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $(this.options.viewport.selector || this.options.viewport)
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()
}
Tooltip.prototype.getDefaults = function () {
return Tooltip.DEFAULTS
}
Tooltip.prototype.getOptions = function (options) {
options = $.extend({}, this.getDefaults(), this.$element.data(), options)
if (options.delay && typeof options.delay == 'number') {
options.delay = {
show: options.delay,
hide: options.delay
}
}
return options
}
Tooltip.prototype.getDelegateOptions = function () {
var options = {}
var defaults = this.getDefaults()
this._options && $.each(this._options, function (key, value) {
if (defaults[key] != value) options[key] = value
})
return options
}
Tooltip.prototype.enter = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState = 'in'
if (!self.options.delay || !self.options.delay.show) return self.show()
self.timeout = setTimeout(function () {
if (self.hoverState == 'in') self.show()
}, self.options.delay.show)
}
Tooltip.prototype.leave = function (obj) {
var self = obj instanceof this.constructor ?
obj : $(obj.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
$(obj.currentTarget).data('bs.' + this.type, self)
}
clearTimeout(self.timeout)
self.hoverState = 'out'
if (!self.options.delay || !self.options.delay.hide) return self.hide()
self.timeout = setTimeout(function () {
if (self.hoverState == 'out') self.hide()
}, self.options.delay.hide)
}
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
var inDom = $.contains(document.documentElement, this.$element[0])
if (e.isDefaultPrevented() || !inDom) return
var that = this
var $tip = this.tip()
var tipId = this.getUID(this.type)
this.setContent()
$tip.attr('id', tipId)
this.$element.attr('aria-describedby', tipId)
if (this.options.animation) $tip.addClass('fade')
var placement = typeof this.options.placement == 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement
var autoToken = /\s?auto?\s?/i
var autoPlace = autoToken.test(placement)
if (autoPlace) placement = placement.replace(autoToken, '') || 'top'
$tip
.detach()
.css({ top: 0, left: 0, display: 'block' })
.addClass(placement)
.data('bs.' + this.type, this)
this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element)
var pos = this.getPosition()
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (autoPlace) {
var orgPlacement = placement
var $parent = this.$element.parent()
var parentDim = this.getPosition($parent)
placement = placement == 'bottom' && pos.top + pos.height + actualHeight - parentDim.scroll > parentDim.height ? 'top' :
placement == 'top' && pos.top - parentDim.scroll - actualHeight < 0 ? 'bottom' :
placement == 'right' && pos.right + actualWidth > parentDim.width ? 'left' :
placement == 'left' && pos.left - actualWidth < parentDim.left ? 'right' :
placement
$tip
.removeClass(orgPlacement)
.addClass(placement)
}
var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)
this.applyPlacement(calculatedOffset, placement)
var complete = function () {
that.$element.trigger('shown.bs.' + that.type)
that.hoverState = null
}
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(150) :
complete()
}
}
Tooltip.prototype.applyPlacement = function (offset, placement) {
var $tip = this.tip()
var width = $tip[0].offsetWidth
var height = $tip[0].offsetHeight
// manually read margins because getBoundingClientRect includes difference
var marginTop = parseInt($tip.css('margin-top'), 10)
var marginLeft = parseInt($tip.css('margin-left'), 10)
// we must check for NaN for ie 8/9
if (isNaN(marginTop)) marginTop = 0
if (isNaN(marginLeft)) marginLeft = 0
offset.top = offset.top + marginTop
offset.left = offset.left + marginLeft
// $.fn.offset doesn't round pixel values
// so we use setOffset directly with our own function B-0
$.offset.setOffset($tip[0], $.extend({
using: function (props) {
$tip.css({
top: Math.round(props.top),
left: Math.round(props.left)
})
}
}, offset), 0)
$tip.addClass('in')
// check to see if placing tip in new offset caused the tip to resize itself
var actualWidth = $tip[0].offsetWidth
var actualHeight = $tip[0].offsetHeight
if (placement == 'top' && actualHeight != height) {
offset.top = offset.top + height - actualHeight
}
var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)
if (delta.left) offset.left += delta.left
else offset.top += delta.top
var arrowDelta = delta.left ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
var arrowPosition = delta.left ? 'left' : 'top'
var arrowOffsetPosition = delta.left ? 'offsetWidth' : 'offsetHeight'
$tip.offset(offset)
this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], arrowPosition)
}
Tooltip.prototype.replaceArrow = function (delta, dimension, position) {
this.arrow().css(position, delta ? (50 * (1 - delta / dimension) + '%') : '')
}
Tooltip.prototype.setContent = function () {
var $tip = this.tip()
var title = this.getTitle()
$tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title)
$tip.removeClass('fade in top bottom left right')
}
Tooltip.prototype.hide = function () {
var that = this
var $tip = this.tip()
var e = $.Event('hide.bs.' + this.type)
this.$element.removeAttr('aria-describedby')
function complete() {
if (that.hoverState != 'in') $tip.detach()
that.$element.trigger('hidden.bs.' + that.type)
}
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$tip.removeClass('in')
$.support.transition && this.$tip.hasClass('fade') ?
$tip
.one('bsTransitionEnd', complete)
.emulateTransitionEnd(150) :
complete()
this.hoverState = null
return this
}
Tooltip.prototype.fixTitle = function () {
var $e = this.$element
if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
$e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
}
}
Tooltip.prototype.hasContent = function () {
return this.getTitle()
}
Tooltip.prototype.getPosition = function ($element) {
$element = $element || this.$element
var el = $element[0]
var isBody = el.tagName == 'BODY'
return $.extend({}, (typeof el.getBoundingClientRect == 'function') ? el.getBoundingClientRect() : null, {
scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop(),
width: isBody ? $(window).width() : $element.outerWidth(),
height: isBody ? $(window).height() : $element.outerHeight()
}, isBody ? { top: 0, left: 0 } : $element.offset())
}
Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
/* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }
}
Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
var delta = { top: 0, left: 0 }
if (!this.$viewport) return delta
var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
var viewportDimensions = this.getPosition(this.$viewport)
if (/right|left/.test(placement)) {
var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll
var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
if (topEdgeOffset < viewportDimensions.top) { // top overflow
delta.top = viewportDimensions.top - topEdgeOffset
} else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
}
} else {
var leftEdgeOffset = pos.left - viewportPadding
var rightEdgeOffset = pos.left + viewportPadding + actualWidth
if (leftEdgeOffset < viewportDimensions.left) { // left overflow
delta.left = viewportDimensions.left - leftEdgeOffset
} else if (rightEdgeOffset > viewportDimensions.width) { // right overflow
delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
}
}
return delta
}
Tooltip.prototype.getTitle = function () {
var title
var $e = this.$element
var o = this.options
title = $e.attr('data-original-title')
|| (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
return title
}
Tooltip.prototype.getUID = function (prefix) {
do prefix += ~~(Math.random() * 1000000)
while (document.getElementById(prefix))
return prefix
}
Tooltip.prototype.tip = function () {
return (this.$tip = this.$tip || $(this.options.template))
}
Tooltip.prototype.arrow = function () {
return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
}
Tooltip.prototype.validate = function () {
if (!this.$element[0].parentNode) {
this.hide()
this.$element = null
this.options = null
}
}
Tooltip.prototype.enable = function () {
this.enabled = true
}
Tooltip.prototype.disable = function () {
this.enabled = false
}
Tooltip.prototype.toggleEnabled = function () {
this.enabled = !this.enabled
}
Tooltip.prototype.toggle = function (e) {
var self = this
if (e) {
self = $(e.currentTarget).data('bs.' + this.type)
if (!self) {
self = new this.constructor(e.currentTarget, this.getDelegateOptions())
$(e.currentTarget).data('bs.' + this.type, self)
}
}
self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
}
Tooltip.prototype.destroy = function () {
clearTimeout(this.timeout)
this.hide().$element.off('.' + this.type).removeData('bs.' + this.type)
}
// TOOLTIP PLUGIN DEFINITION
// =========================
function Plugin(option) {
return this.each(function () {
var $this = $(this)
var data = $this.data('bs.tooltip')
var options = typeof option == 'object' && option
if (!data && option == 'destroy') return
if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
if (typeof option == 'string') data[option]()
})
}
var old = $.fn.tooltip
$.fn.tooltip = Plugin
$.fn.tooltip.Constructor = Tooltip
// TOOLTIP NO CONFLICT
// ===================
$.fn.tooltip.noConflict = function () {
$.fn.tooltip = old
return this
}
}(jQuery);

View File

@@ -0,0 +1,59 @@
/* ========================================================================
* Bootstrap: transition.js v3.2.0
* http://getbootstrap.com/javascript/#transitions
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: http://www.modernizr.com/)
// ============================================================
function transitionEnd() {
var el = document.createElement('bootstrap')
var transEndEventNames = {
WebkitTransition : 'webkitTransitionEnd',
MozTransition : 'transitionend',
OTransition : 'oTransitionEnd otransitionend',
transition : 'transitionend'
}
for (var name in transEndEventNames) {
if (el.style[name] !== undefined) {
return { end: transEndEventNames[name] }
}
}
return false // explicit for ie8 ( ._.)
}
// http://blog.alexmaccaw.com/css-transitions
$.fn.emulateTransitionEnd = function (duration) {
var called = false
var $el = this
$(this).one('bsTransitionEnd', function () { called = true })
var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
setTimeout(callback, duration)
return this
}
$(function () {
$.support.transition = transitionEnd()
if (!$.support.transition) return
$.event.special.bsTransitionEnd = {
bindType: $.support.transition.end,
delegateType: $.support.transition.end,
handle: function (e) {
if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
}
}
})
}(jQuery);

View File

@@ -0,0 +1,275 @@
/*
* jQuery.fullscreen library v0.4.2
* Copyright (c) 2013 Vladimir Zhuravlev
*
* @license https://github.com/private-face/jquery.fullscreen/blob/master/LICENSE
*
* Date: Tue Jul 22 11:54:54 CDT 2014
**/
;
(function($) {
function defined(a) {
return typeof a !== 'undefined';
}
function extend(child, parent, prototype) {
var F = function() {};
F.prototype = parent.prototype;
child.prototype = new F();
child.prototype.constructor = child;
parent.prototype.constructor = parent;
child._super = parent.prototype;
if (prototype) {
$.extend(child.prototype, prototype);
}
}
var SUBST = [
['', ''], // spec
['exit', 'cancel'], // firefox & old webkits expect cancelFullScreen instead of exitFullscreen
['screen', 'Screen'] // firefox expects FullScreen instead of Fullscreen
];
var VENDOR_PREFIXES = ['', 'o', 'ms', 'moz', 'webkit', 'webkitCurrent'];
function native(obj, name) {
var prefixed;
if (typeof obj === 'string') {
name = obj;
obj = document;
}
for (var i = 0; i < SUBST.length; ++i) {
name = name.replace(SUBST[i][0], SUBST[i][1]);
for (var j = 0; j < VENDOR_PREFIXES.length; ++j) {
prefixed = VENDOR_PREFIXES[j];
prefixed += j === 0 ? name : name.charAt(0).toUpperCase() + name.substr(1);
if (defined(obj[prefixed])) {
return obj[prefixed];
}
}
}
return void 0;
}var ua = navigator.userAgent;
var fsEnabled = native('fullscreenEnabled');
var IS_ANDROID_CHROME = ua.indexOf('Android') !== -1 && ua.indexOf('Chrome') !== -1;
var IS_NATIVELY_SUPPORTED =
!IS_ANDROID_CHROME &&
defined(native('fullscreenElement')) &&
(!defined(fsEnabled) || fsEnabled === true);
var version = $.fn.jquery.split('.');
var JQ_LT_17 = (parseInt(version[0]) < 2 && parseInt(version[1]) < 7);
var FullScreenAbstract = function() {
this.__options = null;
this._fullScreenElement = null;
this.__savedStyles = {};
};
FullScreenAbstract.prototype = {
_DEFAULT_OPTIONS: {
styles: {
'boxSizing': 'border-box',
'MozBoxSizing': 'border-box',
'WebkitBoxSizing': 'border-box'
},
toggleClass: null
},
__documentOverflow: 'visible',
__htmlOverflow: 'visible',
_preventDocumentScroll: function() {
// Disabled ability
this.__documentOverflow = $('body')[0].style.overflow;
this.__htmlOverflow = $('html')[0].style.overflow;
},
_allowDocumentScroll: function() {
$('body')[0].style.overflow = this.__documentOverflow;
$('html')[0].style.overflow = this.__htmlOverflow;
},
_fullScreenChange: function() {
if (!this.__options)
return; // only process fullscreenchange events caused by this plugin
if (!this.isFullScreen()) {
this._allowDocumentScroll();
this._revertStyles();
this._triggerEvents();
this._fullScreenElement = null;
} else {
this._preventDocumentScroll();
this._triggerEvents();
}
},
_fullScreenError: function(e) {
if (!this.__options)
return; // only process fullscreenchange events caused by this plugin
this._revertStyles();
this._fullScreenElement = null;
if (e) {
$(document).trigger('fscreenerror', [e]);
}
},
_triggerEvents: function() {
$(this._fullScreenElement).trigger(this.isFullScreen() ? 'fscreenopen' : 'fscreenclose');
$(document).trigger('fscreenchange', [this.isFullScreen(), this._fullScreenElement]);
},
_saveAndApplyStyles: function() {
var $elem = $(this._fullScreenElement);
this.__savedStyles = {};
for (var property in this.__options.styles) {
// save
this.__savedStyles[property] = this._fullScreenElement.style[property];
// apply
this._fullScreenElement.style[property] = this.__options.styles[property];
}
if (this.__options.toggleClass) {
$elem.addClass(this.__options.toggleClass);
}
},
_revertStyles: function() {
var $elem = $(this._fullScreenElement);
for (var property in this.__options.styles) {
this._fullScreenElement.style[property] = this.__savedStyles[property];
}
if (this.__options.toggleClass) {
$elem.removeClass(this.__options.toggleClass);
}
},
open: function(elem, options) {
// do nothing if request is for already fullscreened element
if (elem === this._fullScreenElement) {
return;
}
// exit active fullscreen before opening another one
if (this.isFullScreen()) {
this.exit();
}
// save fullscreened element
this._fullScreenElement = elem;
// apply options, if any
this.__options = $.extend(true, {}, this._DEFAULT_OPTIONS, options);
// save current element styles and apply new
this._saveAndApplyStyles();
},
exit: null,
isFullScreen: null,
isNativelySupported: function() {
return IS_NATIVELY_SUPPORTED;
}
};
var FullScreenNative = function() {
FullScreenNative._super.constructor.apply(this, arguments);
this.exit = $.proxy(native('exitFullscreen'), document);
this._DEFAULT_OPTIONS = $.extend(true, {}, this._DEFAULT_OPTIONS, {
'styles': {
'width': '100%',
'height': '100%'
}
});
$(document)
.bind(this._prefixedString('fullscreenchange') + ' MSFullscreenChange', $.proxy(this._fullScreenChange, this))
.bind(this._prefixedString('fullscreenerror') + ' MSFullscreenError', $.proxy(this._fullScreenError, this));
};
extend(FullScreenNative, FullScreenAbstract, {
VENDOR_PREFIXES: ['', 'o', 'moz', 'webkit'],
_prefixedString: function(str) {
return $.map(this.VENDOR_PREFIXES, function(s) {
return s + str;
}).join(' ');
},
open: function(elem, options) {
FullScreenNative._super.open.apply(this, arguments);
var requestFS = native(elem, 'requestFullscreen');
requestFS.call(elem);
},
exit: $.noop,
isFullScreen: function() {
return native('fullscreenElement') !== null;
},
element: function() {
return native('fullscreenElement');
}
});
var FullScreenFallback = function() {
FullScreenFallback._super.constructor.apply(this, arguments);
this._DEFAULT_OPTIONS = $.extend({}, this._DEFAULT_OPTIONS, {
'styles': {
'position': 'fixed',
'zIndex': '2147483647',
'left': 0,
'top': 0,
'bottom': 0,
'right': 0
}
});
this.__delegateKeydownHandler();
};
extend(FullScreenFallback, FullScreenAbstract, {
__isFullScreen: false,
__delegateKeydownHandler: function() {
var $doc = $(document);
$doc.delegate('*', 'keydown.fullscreen', $.proxy(this.__keydownHandler, this));
var data = JQ_LT_17 ? $doc.data('events') : $._data(document).events;
var events = data['keydown'];
if (!JQ_LT_17) {
events.splice(0, 0, events.splice(events.delegateCount - 1, 1)[0]);
} else {
data.live.unshift(data.live.pop());
}
},
__keydownHandler: function(e) {
if (this.isFullScreen() && e.which === 27) {
this.exit();
return false;
}
return true;
},
_revertStyles: function() {
FullScreenFallback._super._revertStyles.apply(this, arguments);
// force redraw (fixes bug in IE7 with content dissapearing)
this._fullScreenElement.offsetHeight;
},
open: function(elem) {
FullScreenFallback._super.open.apply(this, arguments);
this.__isFullScreen = true;
this._fullScreenChange();
},
exit: function() {
this.__isFullScreen = false;
this._fullScreenChange();
},
isFullScreen: function() {
return this.__isFullScreen;
},
element: function() {
return this.__isFullScreen ? this._fullScreenElement : null;
}
});$.fullscreen = IS_NATIVELY_SUPPORTED
? new FullScreenNative()
: new FullScreenFallback();
$.fn.fullscreen = function(options) {
var elem = this[0];
options = $.extend({
toggleClass: null,
overflow: 'hidden'
}, options);
options.styles = {
overflow: options.overflow
};
delete options.overflow;
if (elem) {
$.fullscreen.open(elem, options);
}
return this;
};
})(jQuery);

View File

@@ -0,0 +1,43 @@
/*!
* hoverIntent v1.8.0 - Copyright 2014 Brian Cherne
* http://cherne.net/brian/resources/jquery.hoverIntent.html
* You are free to use hoverIntent as long as this header is left intact.
*/
;
(function($){$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var cfg={interval:100,sensitivity:6,timeout:0};if(typeof handlerIn==="object"){cfg=$.extend(cfg,handlerIn)}else{if($.isFunction(handlerOut)){cfg=$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector})}else{cfg=$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut})}}var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(Math.sqrt((pX-cX)*(pX-cX)+(pY-cY)*(pY-cY))<cfg.sensitivity){$(ob).off("mousemove.hoverIntent",track);ob.hoverIntent_s=true;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=false;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=$.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type==="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).on("mousemove.hoverIntent",track);if(!ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).off("mousemove.hoverIntent",track);if(ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}})(jQuery);
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
* Version: 3.0.6
*/
;
!function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,void 0!==c.axis&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),void 0!==c.wheelDeltaY&&(h=c.wheelDeltaY/120),void 0!==c.wheelDeltaX&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}(jQuery);
/*!
* jQuery Smooth Scroll - v1.5.4 - 2014-11-17
* https://github.com/kswedberg/jquery-smooth-scroll
* Copyright (c) 2014 Karl Swedberg
* Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT)
*/
;
(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){return t.replace(/(:|\.|\/)/g,"\\$1")}var l="1.5.4",o={},n={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0},s=function(e){var l=[],o=!1,n=e.dir&&"left"===e.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!==document&&this!==window){var e=t(this);e[n]()>0?l.push(this):(e[n](1),o=e[n]()>0,o&&l.push(this),e[n](0))}}),l.length||this.each(function(){"BODY"===this.nodeName&&(l=[this])}),"first"===e.el&&l.length>1&&(l=[l[0]]),l};t.fn.extend({scrollable:function(t){var e=s.call(this,{dir:t});return this.pushStack(e)},firstScrollable:function(t){var e=s.call(this,{el:"first",dir:t});return this.pushStack(e)},smoothScroll:function(l,o){if(l=l||{},"options"===l)return o?this.each(function(){var e=t(this),l=t.extend(e.data("ssOpts")||{},o);t(this).data("ssOpts",l)}):this.first().data("ssOpts");var n=t.extend({},t.fn.smoothScroll.defaults,l),s=t.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(l){var o=this,r=t(this),i=t.extend({},n,r.data("ssOpts")||{}),c=n.exclude,a=i.excludeWithin,f=0,h=0,u=!0,d={},p=location.hostname===o.hostname||!o.hostname,m=i.scrollTarget||t.smoothScroll.filterPath(o.pathname)===s,S=e(o.hash);if(i.scrollTarget||p&&m&&S){for(;u&&c.length>f;)r.is(e(c[f++]))&&(u=!1);for(;u&&a.length>h;)r.closest(a[h++]).length&&(u=!1)}else u=!1;u&&(i.preventDefault&&l.preventDefault(),t.extend(d,i,{scrollTarget:i.scrollTarget||S,link:o}),t.smoothScroll(d))}),this}}),t.smoothScroll=function(e,l){if("options"===e&&"object"==typeof l)return t.extend(o,l);var n,s,r,i,c,a=0,f="offset",h="scrollTop",u={},d={};"number"==typeof e?(n=t.extend({link:null},t.fn.smoothScroll.defaults,o),r=e):(n=t.extend({link:null},t.fn.smoothScroll.defaults,e||{},o),n.scrollElement&&(f="position","static"===n.scrollElement.css("position")&&n.scrollElement.css("position","relative"))),h="left"===n.direction?"scrollLeft":h,n.scrollElement?(s=n.scrollElement,/^(?:HTML|BODY)$/.test(s[0].nodeName)||(a=s[h]())):s=t("html, body").firstScrollable(n.direction),n.beforeScroll.call(s,n),r="number"==typeof e?e:l||t(n.scrollTarget)[f]()&&t(n.scrollTarget)[f]()[n.direction]||0,u[h]=r+a+n.offset,i=n.speed,"auto"===i&&(c=u[h]-s.scrollTop(),0>c&&(c*=-1),i=c/n.autoCoefficient),d={duration:i,easing:n.easing,complete:function(){n.afterScroll.call(n.link,n)}},n.step&&(d.step=n.step),s.length?s.stop().animate(u,d):n.afterScroll.call(n.link,n)},t.smoothScroll.version=l,t.smoothScroll.filterPath=function(t){return t=t||"",t.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},t.fn.smoothScroll.defaults=n});
/*
* jQuery UI Touch Punch 0.2.3
*/
;
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
/*
* https://github.com/douglascrockford/JSON-js/blob/master/json2.js
*/
;
var JSON;if(!JSON){JSON={}}(function(){function f(a){return a<10?"0"+a:a}function quote(a){escapable.lastIndex=0;return escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b==="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];if(i&&typeof i==="object"&&typeof i.toJSON==="function"){i=i.toJSON(a)}if(typeof rep==="function"){i=rep.call(b,a,i)}switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i){return"null"}gap+=indent;h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1){h[c]=str(c,i)||"null"}e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]";gap=g;return e}if(rep&&typeof rep==="object"){f=rep.length;for(c=0;c<f;c+=1){if(typeof rep[c]==="string"){d=rep[c];e=str(d,i);if(e){h.push(quote(d)+(gap?": ":":")+e)}}}}else{for(d in i){if(Object.prototype.hasOwnProperty.call(i,d)){e=str(d,i);if(e){h.push(quote(d)+(gap?": ":":")+e)}}}}e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}";gap=g;return e}}"use strict";if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;if(typeof JSON.stringify!=="function"){JSON.stringify=function(a,b,c){var d;gap="";indent="";if(typeof c==="number"){for(d=0;d<c;d+=1){indent+=" "}}else if(typeof c==="string"){indent=c}rep=b;if(b&&typeof b!=="function"&&(typeof b!=="object"||typeof b.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":a})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e==="object"){for(c in e){if(Object.prototype.hasOwnProperty.call(e,c)){d=walk(e,c);if(d!==undefined){e[c]=d}else{delete e[c]}}}}return reviver.call(a,b,e)}var j;text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})();
/*!
* Scroll Lock v1.1.1
* https://github.com/MohammadYounes/jquery-scrollLock
*
*/
;
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function e(a){var b=a.prop("clientWidth"),c=a.prop("offsetWidth"),d=parseInt(a.css("border-right-width"),10),e=parseInt(a.css("border-left-width"),10);return c>b+e+d}var b="onmousewheel"in window?"ActiveXObject"in window?"wheel":"mousewheel":"DOMMouseScroll",c=".scrollLock",d=a.fn.scrollLock;a.fn.scrollLock=function(d,f,g){return"string"!=typeof f&&(f=null),void 0!==d&&!d||"off"===d?this.each(function(){a(this).off(c)}):this.each(function(){a(this).on(b+c,f,function(b){if(!b.ctrlKey){var c=a(this);if(g===!0||e(c)){b.stopPropagation();var d=c.scrollTop(),f=c.prop("scrollHeight"),h=c.prop("clientHeight"),i=b.originalEvent.wheelDelta||-1*b.originalEvent.detail||-1*b.originalEvent.deltaY,j=0;if("wheel"===b.type){var k=c.height()/a(window).height();j=b.originalEvent.deltaY*k}(i>0&&0>=d+j||0>i&&d+j>=f-h)&&(b.preventDefault(),j&&c.scrollTop(d+j))}}})})},a.fn.scrollLock.noConflict=function(){return a.fn.scrollLock=d,this}});

View File

@@ -0,0 +1 @@
Utility.js contains many core plugins and libraries which provide helper functions and utilities to other plugins. To save on HTTP request these small core files have been compressed and combined into a single file.

View File

@@ -0,0 +1,74 @@
/*!
* Scroll Lock v1.1.1
* https://github.com/MohammadYounes/jquery-scrollLock
*
* Copyright (c) 2014 Mohammad Younes
* Licensed under the MIT license.
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var eventName = "onmousewheel" in window ? (("ActiveXObject" in window) ? "wheel" : "mousewheel") : "DOMMouseScroll";
var eventNamespace = ".scrollLock";
var old = $.fn.scrollLock;
$.fn.scrollLock = function (toggle, selector, force) {
if (typeof selector !== 'string')
selector = null;
if ((toggle !== undefined && !toggle) || toggle === 'off')
return this.each(function () {
$(this).off(eventNamespace);
});
else
return this.each(function () {
$(this).on(eventName + eventNamespace, selector, function (event) {
//allow zooming
if (!event.ctrlKey) {
var $this = $(this);
if (force === true || hasVerticalScroll($this)) {
//Support for nested scrollable blocks (see https://github.com/MohammadYounes/jquery-scrollLock/issues/4)
event.stopPropagation();
var scrollTop = $this.scrollTop(),
scrollHeight = $this.prop('scrollHeight'),
clientHeight = $this.prop('clientHeight'),
delta = event.originalEvent.wheelDelta || (-1 * event.originalEvent.detail) || (-1 * event.originalEvent.deltaY),
deltaY = 0
;
if (event.type === "wheel") {
var ratio = $this.height() / $(window).height();
deltaY = event.originalEvent.deltaY * ratio;
}
if (delta > 0 && scrollTop + deltaY <= 0 || delta < 0 && scrollTop + deltaY >= scrollHeight - clientHeight) {
event.preventDefault();
if (deltaY)
$this.scrollTop(scrollTop + deltaY);
}
}
}
});
});
};
function hasVerticalScroll($element) {
var clientWidth = $element.prop('clientWidth'),
offsetWidth = $element.prop('offsetWidth'),
borderRightWidth = parseInt($element.css('border-right-width'), 10),
borderLeftWidth = parseInt($element.css('border-left-width'), 10)
;
return clientWidth + borderLeftWidth + borderRightWidth < offsetWidth;
}
// no conflict
$.fn.scrollLock.noConflict = function () {
$.fn.scrollLock = old;
return this;
};
}));

View File

@@ -0,0 +1 @@
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function e(a){var b=a.prop("clientWidth"),c=a.prop("offsetWidth"),d=parseInt(a.css("border-right-width"),10),e=parseInt(a.css("border-left-width"),10);return c>b+e+d}var b="onmousewheel"in window?"ActiveXObject"in window?"wheel":"mousewheel":"DOMMouseScroll",c=".scrollLock",d=a.fn.scrollLock;a.fn.scrollLock=function(d,f,g){return"string"!=typeof f&&(f=null),void 0!==d&&!d||"off"===d?this.each(function(){a(this).off(c)}):this.each(function(){a(this).on(b+c,f,function(b){if(!b.ctrlKey){var c=a(this);if(g===!0||e(c)){b.stopPropagation();var d=c.scrollTop(),f=c.prop("scrollHeight"),h=c.prop("clientHeight"),i=b.originalEvent.wheelDelta||-1*b.originalEvent.detail||-1*b.originalEvent.deltaY,j=0;if("wheel"===b.type){var k=c.height()/a(window).height();j=b.originalEvent.deltaY*k}(i>0&&0>=d+j||0>i&&d+j>=f-h)&&(b.preventDefault(),j&&c.scrollTop(d+j))}}})})},a.fn.scrollLock.noConflict=function(){return a.fn.scrollLock=d,this}});

View File

@@ -0,0 +1,5 @@
/*
* jQuery UI Touch Punch 0.2.3
*/
;
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);

View File

@@ -0,0 +1,7 @@
/*!
* hoverIntent v1.8.0 - Copyright 2014 Brian Cherne
* http://cherne.net/brian/resources/jquery.hoverIntent.html
* You are free to use hoverIntent as long as this header is left intact.
*/
;
(function($){$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var cfg={interval:100,sensitivity:6,timeout:0};if(typeof handlerIn==="object"){cfg=$.extend(cfg,handlerIn)}else{if($.isFunction(handlerOut)){cfg=$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector})}else{cfg=$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut})}}var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if(Math.sqrt((pX-cX)*(pX-cX)+(pY-cY)*(pY-cY))<cfg.sensitivity){$(ob).off("mousemove.hoverIntent",track);ob.hoverIntent_s=true;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=false;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=$.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type==="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).on("mousemove.hoverIntent",track);if(!ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).off("mousemove.hoverIntent",track);if(ob.hoverIntent_s){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}})(jQuery);

View File

@@ -0,0 +1,6 @@
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
* Version: 3.0.6
*/
;
!function(a){function d(b){var c=b||window.event,d=[].slice.call(arguments,1),e=0,g=0,h=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(e=c.wheelDelta/120),c.detail&&(e=-c.detail/3),h=e,void 0!==c.axis&&c.axis===c.HORIZONTAL_AXIS&&(h=0,g=-1*e),void 0!==c.wheelDeltaY&&(h=c.wheelDeltaY/120),void 0!==c.wheelDeltaX&&(g=-1*c.wheelDeltaX/120),d.unshift(b,e,g,h),(a.event.dispatch||a.event.handle).apply(this,d)}var b=["DOMMouseScroll","mousewheel"];if(a.event.fixHooks)for(var c=b.length;c;)a.event.fixHooks[b[--c]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=b.length;a;)this.addEventListener(b[--a],d,!1);else this.onmousewheel=d},teardown:function(){if(this.removeEventListener)for(var a=b.length;a;)this.removeEventListener(b[--a],d,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}(jQuery);

View File

@@ -0,0 +1,8 @@
/*!
* jQuery Smooth Scroll - v1.5.4 - 2014-11-17
* https://github.com/kswedberg/jquery-smooth-scroll
* Copyright (c) 2014 Karl Swedberg
* Licensed MIT (https://github.com/kswedberg/jquery-smooth-scroll/blob/master/LICENSE-MIT)
*/
;
(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){function e(t){return t.replace(/(:|\.|\/)/g,"\\$1")}var l="1.5.4",o={},n={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0},s=function(e){var l=[],o=!1,n=e.dir&&"left"===e.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!==document&&this!==window){var e=t(this);e[n]()>0?l.push(this):(e[n](1),o=e[n]()>0,o&&l.push(this),e[n](0))}}),l.length||this.each(function(){"BODY"===this.nodeName&&(l=[this])}),"first"===e.el&&l.length>1&&(l=[l[0]]),l};t.fn.extend({scrollable:function(t){var e=s.call(this,{dir:t});return this.pushStack(e)},firstScrollable:function(t){var e=s.call(this,{el:"first",dir:t});return this.pushStack(e)},smoothScroll:function(l,o){if(l=l||{},"options"===l)return o?this.each(function(){var e=t(this),l=t.extend(e.data("ssOpts")||{},o);t(this).data("ssOpts",l)}):this.first().data("ssOpts");var n=t.extend({},t.fn.smoothScroll.defaults,l),s=t.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(l){var o=this,r=t(this),i=t.extend({},n,r.data("ssOpts")||{}),c=n.exclude,a=i.excludeWithin,f=0,h=0,u=!0,d={},p=location.hostname===o.hostname||!o.hostname,m=i.scrollTarget||t.smoothScroll.filterPath(o.pathname)===s,S=e(o.hash);if(i.scrollTarget||p&&m&&S){for(;u&&c.length>f;)r.is(e(c[f++]))&&(u=!1);for(;u&&a.length>h;)r.closest(a[h++]).length&&(u=!1)}else u=!1;u&&(i.preventDefault&&l.preventDefault(),t.extend(d,i,{scrollTarget:i.scrollTarget||S,link:o}),t.smoothScroll(d))}),this}}),t.smoothScroll=function(e,l){if("options"===e&&"object"==typeof l)return t.extend(o,l);var n,s,r,i,c,a=0,f="offset",h="scrollTop",u={},d={};"number"==typeof e?(n=t.extend({link:null},t.fn.smoothScroll.defaults,o),r=e):(n=t.extend({link:null},t.fn.smoothScroll.defaults,e||{},o),n.scrollElement&&(f="position","static"===n.scrollElement.css("position")&&n.scrollElement.css("position","relative"))),h="left"===n.direction?"scrollLeft":h,n.scrollElement?(s=n.scrollElement,/^(?:HTML|BODY)$/.test(s[0].nodeName)||(a=s[h]())):s=t("html, body").firstScrollable(n.direction),n.beforeScroll.call(s,n),r="number"==typeof e?e:l||t(n.scrollTarget)[f]()&&t(n.scrollTarget)[f]()[n.direction]||0,u[h]=r+a+n.offset,i=n.speed,"auto"===i&&(c=u[h]-s.scrollTop(),0>c&&(c*=-1),i=c/n.autoCoefficient),d={duration:i,easing:n.easing,complete:function(){n.afterScroll.call(n.link,n)}},n.step&&(d.step=n.step),s.length?s.stop().animate(u,d):n.afterScroll.call(n.link,n)},t.smoothScroll.version=l,t.smoothScroll.filterPath=function(t){return t=t||"",t.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},t.fn.smoothScroll.defaults=n});

View File

@@ -0,0 +1,5 @@
/*
* https://github.com/douglascrockford/JSON-js/blob/master/json2.js
*/
;
var JSON;if(!JSON){JSON={}}(function(){function f(a){return a<10?"0"+a:a}function quote(a){escapable.lastIndex=0;return escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b==="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];if(i&&typeof i==="object"&&typeof i.toJSON==="function"){i=i.toJSON(a)}if(typeof rep==="function"){i=rep.call(b,a,i)}switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i){return"null"}gap+=indent;h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1){h[c]=str(c,i)||"null"}e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]";gap=g;return e}if(rep&&typeof rep==="object"){f=rep.length;for(c=0;c<f;c+=1){if(typeof rep[c]==="string"){d=rep[c];e=str(d,i);if(e){h.push(quote(d)+(gap?": ":":")+e)}}}}else{for(d in i){if(Object.prototype.hasOwnProperty.call(i,d)){e=str(d,i);if(e){h.push(quote(d)+(gap?": ":":")+e)}}}}e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}";gap=g;return e}}"use strict";if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;if(typeof JSON.stringify!=="function"){JSON.stringify=function(a,b,c){var d;gap="";indent="";if(typeof c==="number"){for(d=0;d<c;d+=1){indent+=" "}}else if(typeof c==="string"){indent=c}rep=b;if(b&&typeof b!=="function"&&(typeof b!=="object"||typeof b.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":a})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e==="object"){for(c in e){if(Object.prototype.hasOwnProperty.call(e,c)){d=walk(e,c);if(d!==undefined){e[c]=d}else{delete e[c]}}}}return reviver.call(a,b,e)}var j;text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})();

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,345 @@
/*!
* nanoScrollerJS - v0.8.4
* (c) 2014 James Florentino; Licensed MIT
*/
! function(a) {
return "function" == typeof define && define.amd ? define(["jquery"],
function(b) {
return a(b, window, document)
}) : a(jQuery, window, document)
}(function(a, b, c) {
"use strict";
var d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z,
A, B, C, D, E, F, G, H;
z = {
paneClass: "nano-pane",
sliderClass: "nano-slider",
contentClass: "nano-content",
iOSNativeScrolling: !1,
preventPageScrolling: !1,
disableResize: !1,
alwaysVisible: !1,
flashDelay: 1500,
sliderMinHeight: 20,
sliderMaxHeight: null,
documentContext: null,
windowContext: null
}, u = "scrollbar", t = "scroll", l = "mousedown", m = "mouseenter",
n = "mousemove", p = "mousewheel", o = "mouseup", s = "resize", h =
"drag", i = "enter", w = "up", r = "panedown", f = "DOMMouseScroll",
g = "down", x = "wheel", j = "keydown", k = "keyup", v =
"touchmove", d = "Microsoft Internet Explorer" === b.navigator.appName &&
/msie 7./i.test(b.navigator.appVersion) && b.ActiveXObject, e =
null, D = b.requestAnimationFrame, y = b.cancelAnimationFrame, F =
c.createElement("div").style, H = function() {
var a, b, c, d, e, f;
for (d = ["t", "webkitT", "MozT", "msT", "OT"], a = e = 0, f =
d.length; f > e; a = ++e)
if (c = d[a], b = d[a] + "ransform", b in F) return d[a].substr(
0, d[a].length - 1);
return !1
}(), G = function(a) {
return H === !1 ? !1 : "" === H ? a : H + a.charAt(0).toUpperCase() +
a.substr(1)
}, E = G("transform"), B = E !== !1, A = function() {
var a, b, d;
return a = c.createElement("div"), b = a.style, b.position =
"absolute", b.width = "100px", b.height = "100px", b.overflow =
t, b.top = "-9999px", c.body.appendChild(a), d = a.offsetWidth -
a.clientWidth, c.body.removeChild(a), d
}, C = function() {
var a, c, d;
return c = b.navigator.userAgent, (a =
/(?=.+Mac OS X)(?=.+Firefox)/.test(c)) ? (d =
/Firefox\/\d{2}\./.exec(c), d && (d = d[0].replace(
/\D+/g, "")), a && +d > 23) : !1
}, q = function() {
function j(d, f) {
this.el = d, this.options = f, e || (e = A()), this.$el =
a(this.el), this.doc = a(this.options.documentContext ||
c), this.win = a(this.options.windowContext ||
b), this.body = this.doc.find("body"), this.$content =
this.$el.children("." + f.contentClass), this.$content
.attr("tabindex", this.options.tabIndex || 0), this
.content = this.$content[0], this.previousPosition =
0, this.options.iOSNativeScrolling && null != this.el
.style.WebkitOverflowScrolling ? this.nativeScrolling() :
this.generate(), this.createEvents(), this.addEvents(),
this.reset()
}
return j.prototype.preventScrolling = function(a, b) {
if (this.isActive)
if (a.type === f)(b === g && a.originalEvent.detail >
0 || b === w && a.originalEvent.detail < 0) &&
a.preventDefault();
else if (a.type === p) {
if (!a.originalEvent || !a.originalEvent.wheelDelta)
return;
(b === g && a.originalEvent.wheelDelta < 0 || b ===
w && a.originalEvent.wheelDelta > 0) && a.preventDefault()
}
}, j.prototype.nativeScrolling = function() {
this.$content.css({
WebkitOverflowScrolling: "touch"
}), this.iOSNativeScrolling = !0, this.isActive = !
0
}, j.prototype.updateScrollValues = function() {
var a, b;
a = this.content, this.maxScrollTop = a.scrollHeight -
a.clientHeight, this.prevScrollTop = this.contentScrollTop ||
0, this.contentScrollTop = a.scrollTop, b = this.contentScrollTop >
this.previousPosition ? "down" : this.contentScrollTop <
this.previousPosition ? "up" : "same", this.previousPosition =
this.contentScrollTop, "same" !== b && this.$el.trigger(
"update", {
position: this.contentScrollTop,
maximum: this.maxScrollTop,
direction: b
}), this.iOSNativeScrolling || (this.maxSliderTop =
this.paneHeight - this.sliderHeight, this.sliderTop =
0 === this.maxScrollTop ? 0 : this.contentScrollTop *
this.maxSliderTop / this.maxScrollTop)
}, j.prototype.setOnScrollStyles = function() {
var a;
B ? (a = {}, a[E] = "translate(0, " + this.sliderTop +
"px)") : a = {
top: this.sliderTop
}, D ? (y && this.scrollRAF && y(this.scrollRAF),
this.scrollRAF = D(function(b) {
return function() {
return b.scrollRAF = null, b.slider
.css(a)
}
}(this))) : this.slider.css(a)
}, j.prototype.createEvents = function() {
this.events = {
down: function(a) {
return function(b) {
return a.isBeingDragged = !0, a
.offsetY = b.pageY - a.slider
.offset().top, a.slider.is(
b.target) || (a.offsetY =
0), a.pane.addClass(
"active"), a.doc.bind(n,
a.events[h]).bind(o, a.events[
w]), a.body.bind(m, a.events[
i]), !1
}
}(this),
drag: function(a) {
return function(b) {
return a.sliderY = b.pageY - a.$el
.offset().top - a.paneTop -
(a.offsetY || .5 * a.sliderHeight),
a.scroll(), a.contentScrollTop >=
a.maxScrollTop && a.prevScrollTop !==
a.maxScrollTop ? a.$el.trigger(
"scrollend") : 0 === a.contentScrollTop &&
0 !== a.prevScrollTop && a.$el
.trigger("scrolltop"), !1
}
}(this),
up: function(a) {
return function() {
return a.isBeingDragged = !1, a
.pane.removeClass("active"),
a.doc.unbind(n, a.events[h])
.unbind(o, a.events[w]), a.body
.unbind(m, a.events[i]), !1
}
}(this),
resize: function(a) {
return function() {
a.reset()
}
}(this),
panedown: function(a) {
return function(b) {
return a.sliderY = (b.offsetY ||
b.originalEvent.layerY) -
.5 * a.sliderHeight, a.scroll(),
a.events.down(b), !1
}
}(this),
scroll: function(a) {
return function(b) {
a.updateScrollValues(), a.isBeingDragged ||
(a.iOSNativeScrolling || (a
.sliderY = a.sliderTop,
a.setOnScrollStyles()
), null != b && (a.contentScrollTop >=
a.maxScrollTop ? (a
.options.preventPageScrolling &&
a.preventScrolling(
b, g), a.prevScrollTop !==
a.maxScrollTop &&
a.$el.trigger(
"scrollend"
)) : 0 === a.contentScrollTop &&
(a.options.preventPageScrolling &&
a.preventScrolling(
b, w), 0 !==
a.prevScrollTop &&
a.$el.trigger(
"scrolltop"
))))
}
}(this),
wheel: function(a) {
return function(b) {
var c;
if (null != b) return c = b.delta ||
b.wheelDelta || b.originalEvent &&
b.originalEvent.wheelDelta ||
-b.detail || b.originalEvent &&
-b.originalEvent.detail,
c && (a.sliderY += -c /
3), a.scroll(), !1
}
}(this),
enter: function(a) {
return function(b) {
var c;
if (a.isBeingDragged) return 1 !==
(b.buttons || b.which) ?
(c = a.events)[w].apply(
c, arguments) :
void 0
}
}(this)
}
}, j.prototype.addEvents = function() {
var a;
this.removeEvents(), a = this.events, this.options.disableResize ||
this.win.bind(s, a[s]), this.iOSNativeScrolling ||
(this.slider.bind(l, a[g]), this.pane.bind(l, a[r])
.bind("" + p + " " + f, a[x])), this.$content.bind(
"" + t + " " + p + " " + f + " " + v, a[t])
}, j.prototype.removeEvents = function() {
var a;
a = this.events, this.win.unbind(s, a[s]), this.iOSNativeScrolling ||
(this.slider.unbind(), this.pane.unbind()), this.$content
.unbind("" + t + " " + p + " " + f + " " + v, a[t])
}, j.prototype.generate = function() {
var a, c, d, f, g, h, i;
return f = this.options, h = f.paneClass, i = f.sliderClass,
a = f.contentClass, (g = this.$el.children("." + h))
.length || g.children("." + i).length || this.$el.append(
'<div class="' + h + '"><div class="' + i +
'" /></div>'), this.pane = this.$el.children(
"." + h), this.slider = this.pane.find("." + i),
0 === e && C() ? (d = b.getComputedStyle(this.content,
null).getPropertyValue("padding-right").replace(
/[^0-9.]+/g, ""), c = {
right: -14,
paddingRight: +d + 14
}) : e && (c = {
right: -e
}, this.$el.addClass("has-scrollbar")), null != c &&
this.$content.css(c), this
}, j.prototype.restore = function() {
this.stopped = !1, this.iOSNativeScrolling || this.pane
.show(), this.addEvents()
}, j.prototype.reset = function() {
var a, b, c, f, g, h, i, j, k, l, m, n;
return this.iOSNativeScrolling ? void(this.contentHeight =
this.content.scrollHeight) : (this.$el.find("." +
this.options.paneClass).length || this.generate()
.stop(), this.stopped && this.restore(), a =
this.content, f = a.style, g = f.overflowY, d &&
this.$content.css({
height: this.$content.height()
}), b = a.scrollHeight + e, l = parseInt(this.$el
.css("max-height"), 10), l > 0 && (this.$el
.height(""), this.$el.height(a.scrollHeight >
l ? l : a.scrollHeight)), i = this.pane
.outerHeight(!1), k = parseInt(this.pane.css(
"top"), 10), h = parseInt(this.pane.css(
"bottom"), 10), j = i + k + h, n = Math.round(
j / b * j), n < this.options.sliderMinHeight ?
n = this.options.sliderMinHeight : null != this
.options.sliderMaxHeight && n > this.options.sliderMaxHeight &&
(n = this.options.sliderMaxHeight), g === t &&
f.overflowX !== t && (n += e), this.maxSliderTop =
j - n, this.contentHeight = b, this.paneHeight =
i, this.paneOuterHeight = j, this.sliderHeight =
n, this.paneTop = k, this.slider.height(n),
this.events.scroll(), this.pane.show(), this.isActive = !
0, a.scrollHeight === a.clientHeight || this.pane
.outerHeight(!0) >= a.scrollHeight && g !== t ?
(this.pane.hide(), this.isActive = !1) : this.el
.clientHeight === a.scrollHeight && g === t ?
this.slider.hide() : this.slider.show(), this.pane
.css({
opacity: this.options.alwaysVisible ? 1 : "",
visibility: this.options.alwaysVisible ?
"visible" : ""
}), c = this.$content.css("position"), (
"static" === c || "relative" === c) && (m =
parseInt(this.$content.css("right"), 10), m &&
this.$content.css({
right: "",
marginRight: m
})), this)
}, j.prototype.scroll = function() {
return this.isActive ? (this.sliderY = Math.max(0, this
.sliderY), this.sliderY = Math.min(this.maxSliderTop,
this.sliderY), this.$content.scrollTop(this
.maxScrollTop * this.sliderY / this.maxSliderTop
), this.iOSNativeScrolling || (this.updateScrollValues(),
this.setOnScrollStyles()), this) : void 0
}, j.prototype.scrollBottom = function(a) {
return this.isActive ? (this.$content.scrollTop(this.contentHeight -
this.$content.height() - a).trigger(p),
this.stop().restore(), this) : void 0
}, j.prototype.scrollTop = function(a) {
return this.isActive ? (this.$content.scrollTop(+a).trigger(
p), this.stop().restore(), this) : void 0
}, j.prototype.scrollTo = function(a) {
return this.isActive ? (this.scrollTop(this.$el.find(a)
.get(0).offsetTop), this) : void 0
}, j.prototype.stop = function() {
return y && this.scrollRAF && (y(this.scrollRAF), this.scrollRAF =
null), this.stopped = !0, this.removeEvents(),
this.iOSNativeScrolling || this.pane.hide(), this
}, j.prototype.destroy = function() {
return this.stopped || this.stop(), !this.iOSNativeScrolling &&
this.pane.length && this.pane.remove(), d && this.$content
.height(""), this.$content.removeAttr("tabindex"),
this.$el.hasClass("has-scrollbar") && (this.$el.removeClass(
"has-scrollbar"), this.$content.css({
right: ""
})), this
}, j.prototype.flash = function() {
return !this.iOSNativeScrolling && this.isActive ? (
this.reset(), this.pane.addClass("flashed"),
setTimeout(function(a) {
return function() {
a.pane.removeClass("flashed")
}
}(this), this.options.flashDelay), this) : void 0
}, j
}(), a.fn.nanoScroller = function(b) {
return this.each(function() {
var c, d;
if ((d = this.nanoscroller) || (c = a.extend({}, z,
b), this.nanoscroller = d = new q(this,
c)), b && "object" == typeof b) {
if (a.extend(d.options, b), null != b.scrollBottom)
return d.scrollBottom(b.scrollBottom);
if (null != b.scrollTop) return d.scrollTop(b.scrollTop);
if (b.scrollTo) return d.scrollTo(b.scrollTo);
if ("bottom" === b.scroll) return d.scrollBottom(
0);
if ("top" === b.scroll) return d.scrollTop(0);
if (b.scroll && b.scroll instanceof a) return d
.scrollTo(b.scroll);
if (b.stop) return d.stop();
if (b.destroy) return d.destroy();
if (b.flash) return d.flash()
}
return d.reset()
})
}, a.fn.nanoScroller.Constructor = q
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,568 @@
/*
* Scroller v3.1.2 - 2014-12-08
* A jQuery plugin for replacing default browser scrollbars. Part of the Formstone Library.
* http://formstone.it/scroller/
*
* Copyright 2014 Ben Plum; MIT Licensed
*/
;(function ($, window) {
"use strict";
var namespace = "scroller",
$body = null,
classes = {
base: "scroller",
content: "scroller-content",
bar: "scroller-bar",
track: "scroller-track",
handle: "scroller-handle",
isHorizontal: "scroller-horizontal",
isSetup: "scroller-setup",
isActive: "scroller-active"
},
events = {
start: "touchstart." + namespace + " mousedown." + namespace,
move: "touchmove." + namespace + " mousemove." + namespace,
end: "touchend." + namespace + " mouseup." + namespace
};
/**
* @options
* @param customClass [string] <''> "Class applied to instance"
* @param duration [int] <0> "Scroll animation length"
* @param handleSize [int] <0> "Handle size; 0 to auto size"
* @param horizontal [boolean] <false> "Scroll horizontally"
* @param trackMargin [int] <0> "Margin between track and handle edge”
*/
var options = {
customClass: "",
duration: 0,
handleSize: 0,
horizontal: false,
trackMargin: 0
};
var pub = {
/**
* @method
* @name defaults
* @description Sets default plugin options
* @param opts [object] <{}> "Options object"
* @example $.scroller("defaults", opts);
*/
defaults: function(opts) {
options = $.extend(options, opts || {});
return (typeof this === 'object') ? $(this) : true;
},
/**
* @method
* @name destroy
* @description Removes instance of plugin
* @example $(".target").scroller("destroy");
*/
destroy: function() {
return $(this).each(function(i, el) {
var data = $(el).data(namespace);
if (data) {
data.$scroller.removeClass( [data.customClass, classes.base, classes.isActive].join(" ") );
data.$bar.remove();
data.$content.contents().unwrap();
data.$content.off( classify(namespace) );
data.$scroller.off( classify(namespace) )
.removeData(namespace);
}
});
},
/**
* @method
* @name scroll
* @description Scrolls instance of plugin to element or position
* @param pos [string || int] <null> "Target element selector or static position"
* @param duration [int] <null> "Optional scroll duration"
* @example $.scroller("scroll", pos, duration);
*/
scroll: function(pos, dur) {
return $(this).each(function(i) {
var data = $(this).data(namespace),
duration = dur || options.duration;
if (typeof pos !== "number") {
var $el = $(pos);
if ($el.length > 0) {
var offset = $el.position();
if (data.horizontal) {
pos = offset.left + data.$content.scrollLeft();
} else {
pos = offset.top + data.$content.scrollTop();
}
} else {
pos = data.$content.scrollTop();
}
}
var styles = data.horizontal ? { scrollLeft: pos } : { scrollTop: pos };
data.$content.stop().animate(styles, duration);
});
},
/**
* @method
* @name reset
* @description Resets layout on instance of plugin
* @example $.scroller("reset");
*/
reset: function() {
return $(this).each(function(i) {
var data = $(this).data(namespace);
if (data) {
data.$scroller.addClass(classes.isSetup);
var barStyles = {},
trackStyles = {},
handleStyles = {},
handlePosition = 0,
isActive = true;
if (data.horizontal) {
// Horizontal
data.barHeight = data.$content[0].offsetHeight - data.$content[0].clientHeight;
data.frameWidth = data.$content.outerWidth();
data.trackWidth = data.frameWidth - (data.trackMargin * 2);
data.scrollWidth = data.$content[0].scrollWidth;
data.ratio = data.trackWidth / data.scrollWidth;
data.trackRatio = data.trackWidth / data.scrollWidth;
data.handleWidth = (data.handleSize > 0) ? data.handleSize : data.trackWidth * data.trackRatio;
data.scrollRatio = (data.scrollWidth - data.frameWidth) / (data.trackWidth - data.handleWidth);
data.handleBounds = {
left: 0,
right: data.trackWidth - data.handleWidth
};
data.$content.css({
paddingBottom: data.barHeight + data.paddingBottom
});
var scrollLeft = data.$content.scrollLeft();
handlePosition = scrollLeft * data.ratio;
isActive = (data.scrollWidth <= data.frameWidth);
barStyles = {
width: data.frameWidth
};
trackStyles = {
width: data.trackWidth,
marginLeft: data.trackMargin,
marginRight: data.trackMargin
};
handleStyles = {
width: data.handleWidth
};
} else {
// Vertical
data.barWidth = data.$content[0].offsetWidth - data.$content[0].clientWidth;
data.frameHeight = data.$content.outerHeight();
data.trackHeight = data.frameHeight - (data.trackMargin * 2);
data.scrollHeight = data.$content[0].scrollHeight;
data.ratio = data.trackHeight / data.scrollHeight;
data.trackRatio = data.trackHeight / data.scrollHeight;
data.handleHeight = (data.handleSize > 0) ? data.handleSize : data.trackHeight * data.trackRatio;
data.scrollRatio = (data.scrollHeight - data.frameHeight) / (data.trackHeight - data.handleHeight);
data.handleBounds = {
top: 0,
bottom: data.trackHeight - data.handleHeight
};
var scrollTop = data.$content.scrollTop();
handlePosition = scrollTop * data.ratio;
isActive = (data.scrollHeight <= data.frameHeight);
barStyles = {
height: data.frameHeight
};
trackStyles = {
height: data.trackHeight,
marginBottom: data.trackMargin,
marginTop: data.trackMargin
};
handleStyles = {
height: data.handleHeight
};
}
// Updates
if (isActive) {
data.$scroller.removeClass(classes.isActive);
} else {
data.$scroller.addClass(classes.isActive);
}
data.$bar.css(barStyles);
data.$track.css(trackStyles);
data.$handle.css(handleStyles);
position(data, handlePosition);
data.$scroller.removeClass(classes.isSetup);
}
});
}
};
/**
* @method private
* @name init
* @description Initializes plugin
* @param opts [object] "Initialization options"
*/
function init(opts) {
// Local options
opts = $.extend({}, options, opts || {});
// Check for Body
if ($body === null) {
$body = $("body");
}
// Apply to each element
var $items = $(this);
for (var i = 0, count = $items.length; i < count; i++) {
build($items.eq(i), opts);
}
return $items;
}
/**
* @method private
* @name build
* @description Builds each instance
* @param $scroller [jQuery object] "Target jQuery object"
* @param opts [object] <{}> "Options object"
*/
function build($scroller, opts) {
if (!$scroller.hasClass(classes.base)) {
// EXTEND OPTIONS
opts = $.extend({}, opts, $scroller.data(namespace + "-options"));
var html = '';
html += '<div class="' + classes.bar + '">';
html += '<div class="' + classes.track + '">';
html += '<div class="' + classes.handle + '">';
html += '</div></div></div>';
opts.paddingRight = parseInt($scroller.css("padding-right"), 10);
opts.paddingBottom = parseInt($scroller.css("padding-bottom"), 10);
$scroller.addClass( [classes.base, opts.customClass].join(" ") )
.wrapInner('<div class="' + classes.content + '" />')
.prepend(html);
if (opts.horizontal) {
$scroller.addClass(classes.isHorizontal);
}
var data = $.extend({
$scroller: $scroller,
$content: $scroller.find( classify(classes.content) ),
$bar: $scroller.find( classify(classes.bar) ),
$track: $scroller.find( classify(classes.track) ),
$handle: $scroller.find( classify(classes.handle) )
}, opts);
data.trackMargin = parseInt(data.trackMargin, 10);
data.$content.on("scroll." + namespace, data, onScroll);
data.$scroller.on(events.start, classify(classes.track), data, onTrackDown)
.on(events.start, classify(classes.handle), data, onHandleDown)
.data(namespace, data);
pub.reset.apply($scroller);
$(window).one("load", function() {
pub.reset.apply($scroller);
});
}
}
/**
* @method private
* @name onScroll
* @description Handles scroll event
* @param e [object] "Event data"
*/
function onScroll(e) {
e.preventDefault();
e.stopPropagation();
var data = e.data,
handleStyles = {};
if (data.horizontal) {
// Horizontal
var scrollLeft = data.$content.scrollLeft();
if (scrollLeft < 0) {
scrollLeft = 0;
}
var handleLeft = scrollLeft / data.scrollRatio;
if (handleLeft > data.handleBounds.right) {
handleLeft = data.handleBounds.right;
}
handleStyles = {
left: handleLeft
};
} else {
// Vertical
var scrollTop = data.$content.scrollTop();
if (scrollTop < 0) {
scrollTop = 0;
}
var handleTop = scrollTop / data.scrollRatio;
if (handleTop > data.handleBounds.bottom) {
handleTop = data.handleBounds.bottom;
}
handleStyles = {
top: handleTop
};
}
data.$handle.css(handleStyles);
}
/**
* @method private
* @name onTrackDown
* @description Handles mousedown event on track
* @param e [object] "Event data"
*/
function onTrackDown(e) {
e.preventDefault();
e.stopPropagation();
var data = e.data,
oe = e.originalEvent,
offset = data.$track.offset(),
touch = (typeof oe.targetTouches !== "undefined") ? oe.targetTouches[0] : null,
pageX = (touch) ? touch.pageX : e.clientX,
pageY = (touch) ? touch.pageY : e.clientY;
if (data.horizontal) {
// Horizontal
data.mouseStart = pageX;
data.handleLeft = pageX - offset.left - (data.handleWidth / 2);
position(data, data.handleLeft);
} else {
// Vertical
data.mouseStart = pageY;
data.handleTop = pageY - offset.top - (data.handleHeight / 2);
position(data, data.handleTop);
}
onStart(data);
}
/**
* @method private
* @name onHandleDown
* @description Handles mousedown event on handle
* @param e [object] "Event data"
*/
function onHandleDown(e) {
e.preventDefault();
e.stopPropagation();
var data = e.data,
oe = e.originalEvent,
touch = (typeof oe.targetTouches !== "undefined") ? oe.targetTouches[0] : null,
pageX = (touch) ? touch.pageX : e.clientX,
pageY = (touch) ? touch.pageY : e.clientY;
if (data.horizontal) {
// Horizontal
data.mouseStart = pageX;
data.handleLeft = parseInt(data.$handle.css("left"), 10);
} else {
// Vertical
data.mouseStart = pageY;
data.handleTop = parseInt(data.$handle.css("top"), 10);
}
onStart(data);
}
/**
* @method private
* @name onStart
* @description Handles touch.mouse start
* @param data [object] "Instance data"
*/
function onStart(data) {
data.$content.off( classify(namespace) );
$body.on(events.move, data, onMouseMove)
.on(events.end, data, onMouseUp);
}
/**
* @method private
* @name onMouseMove
* @description Handles mousemove event
* @param e [object] "Event data"
*/
function onMouseMove(e) {
e.preventDefault();
e.stopPropagation();
var data = e.data,
oe = e.originalEvent,
pos = 0,
delta = 0,
touch = (typeof oe.targetTouches !== "undefined") ? oe.targetTouches[0] : null,
pageX = (touch) ? touch.pageX : e.clientX,
pageY = (touch) ? touch.pageY : e.clientY;
if (data.horizontal) {
// Horizontal
delta = data.mouseStart - pageX;
pos = data.handleLeft - delta;
} else {
// Vertical
delta = data.mouseStart - pageY;
pos = data.handleTop - delta;
}
position(data, pos);
}
/**
* @method private
* @name onMouseUp
* @description Handles mouseup event
* @param e [object] "Event data"
*/
function onMouseUp(e) {
e.preventDefault();
e.stopPropagation();
var data = e.data;
data.$content.on("scroll.scroller", data, onScroll);
$body.off(".scroller");
}
/**
* @method private
* @name onTouchEnd
* @description Handles mouseup event
* @param e [object] "Event data"
*/
function onTouchEnd(e) {
e.preventDefault();
e.stopPropagation();
var data = e.data;
data.$content.on("scroll.scroller", data, onScroll);
$body.off(".scroller");
}
/**
* @method private
* @name position
* @description Position handle based on scroll
* @param data [object] "Instance data"
* @param pos [int] "Scroll position"
*/
function position(data, pos) {
var handleStyles = {};
if (data.horizontal) {
// Horizontal
if (pos < data.handleBounds.left) {
pos = data.handleBounds.left;
}
if (pos > data.handleBounds.right) {
pos = data.handleBounds.right;
}
var scrollLeft = Math.round(pos * data.scrollRatio);
handleStyles = {
left: pos
};
data.$content.scrollLeft( scrollLeft );
} else {
// Vertical
if (pos < data.handleBounds.top) {
pos = data.handleBounds.top;
}
if (pos > data.handleBounds.bottom) {
pos = data.handleBounds.bottom;
}
var scrollTop = Math.round(pos * data.scrollRatio);
handleStyles = {
top: pos
};
data.$content.scrollTop( scrollTop );
}
data.$handle.css(handleStyles);
}
/**
* @method private
* @name classify
* @description Create class selector from text
* @param text [string] "Text to convert"
* @return [string] "New class name"
*/
function classify(text) {
return "." + text;
}
$.fn[namespace] = function(method) {
if (pub[method]) {
return pub[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return init.apply(this, arguments);
}
return this;
};
$[namespace] = function(method) {
if (method === "defaults") {
pub.defaults.apply(this, Array.prototype.slice.call(arguments, 1));
}
};
})(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long