[WIP] Working on uploader
This commit is contained in:
241
build/js/include/plugins/jquery.hcaptions.js
Normal file
241
build/js/include/plugins/jquery.hcaptions.js
Normal file
@@ -0,0 +1,241 @@
|
||||
(function($){
|
||||
|
||||
var Captions = function(el, opts) {
|
||||
var _this = this,
|
||||
$this = $(el),
|
||||
$el = $this.clone(),
|
||||
href = $this.attr('href'),
|
||||
$target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))), //strip for ie7
|
||||
_overlay_css = {};
|
||||
|
||||
if ( ! $target.length )
|
||||
{
|
||||
$target = $this.next(opts.data_selector);
|
||||
}
|
||||
if ($target.length) {
|
||||
|
||||
this.set_from_attr(el, opts);
|
||||
|
||||
$wrap = $('<div class="drop-panel" />',{position: 'relative', 'z-index': 1, display: 'block', overflow: 'hidden'})
|
||||
.append($el)
|
||||
.append($target);
|
||||
|
||||
|
||||
|
||||
$this.replaceWith($wrap);
|
||||
$target.hide();
|
||||
|
||||
$wrap.css({ 'position':'relative', 'overflow':'hidden', display: 'block', padding:'2px' });
|
||||
|
||||
if (opts.find_image && $this.not('img'))
|
||||
{
|
||||
var img = $wrap.find('img'),
|
||||
w = img.width(),
|
||||
h = img.height();
|
||||
}
|
||||
else {
|
||||
var w = $wrap.outerWidth(),
|
||||
h = $wrap.outerHeight();
|
||||
}
|
||||
|
||||
var overlay_w = opts.width || w,
|
||||
overlay_h = opts.height || h;
|
||||
|
||||
$target.css({ 'width':overlay_w, 'height':overlay_h, 'position':'absolute', 'z-index':33, overflow: 'hidden' });
|
||||
|
||||
var _overlay_css = {};
|
||||
|
||||
if (opts.overlay_bg) {
|
||||
_overlay_css.background = opts.overlay_bg;
|
||||
}
|
||||
if (opts.overlay_opacity<1) {
|
||||
_overlay_css.opacity = opts.overlay_opacity;
|
||||
}
|
||||
|
||||
// CSS: Overlay X Position
|
||||
_overlay_css.left = (opts.overlay_x == 'left')
|
||||
? 0
|
||||
: (opts.overlay_x == 'right')
|
||||
? w-overlay_w
|
||||
: (w - overlay_w) / 2 + 'px';
|
||||
|
||||
// CSS: Overlay Y Position
|
||||
_overlay_css.top = (opts.overlay_y == 'top')
|
||||
? 0
|
||||
: (opts.overlay_y == 'bottom')
|
||||
? h-overlay_h
|
||||
: (h - overlay_h) / 2 + 'px';
|
||||
|
||||
// CSS: Apply rules
|
||||
$target.css(_overlay_css);
|
||||
|
||||
// slide effect
|
||||
if (opts.effect=='slide') {
|
||||
|
||||
var slide_css = {};
|
||||
|
||||
switch (opts.direction) {
|
||||
case 'top':
|
||||
slide_css.top = '-'+overlay_h+'px';
|
||||
break;
|
||||
case 'bottom':
|
||||
slide_css.top = h+'px';
|
||||
break;
|
||||
case 'left':
|
||||
slide_css.left = '-'+overlay_w+'px';
|
||||
break;
|
||||
case 'right':
|
||||
default:
|
||||
slide_css.left = w+'px';
|
||||
break;
|
||||
}
|
||||
|
||||
// Apply Slide rules
|
||||
$target.css('z-index',opts.zindex+1).css(slide_css);
|
||||
|
||||
// Hover events
|
||||
$wrap.hover(function(){
|
||||
$target.show().stop(true, true).animate({ 'top': _overlay_css.top, 'left': _overlay_css.left }, +opts.speed, opts.onshow());
|
||||
}, function(){
|
||||
$target.show().stop(true, true).animate(slide_css, +opts.speed, opts.onhide());
|
||||
});
|
||||
|
||||
// fade effect
|
||||
} else if (opts.effect=='fade') {
|
||||
$target.css('z-index',opts.zindex+1).hide();
|
||||
$wrap.hover(function () {
|
||||
$target.stop(true, true).fadeIn(+opts.speed, opts.onshow());
|
||||
}, function () {
|
||||
$target.stop(true, true).fadeOut(+opts.speed, opts.onhide());
|
||||
});
|
||||
|
||||
// just show/hide
|
||||
} else {
|
||||
$target.css('z-index',opts.zindex+1).hide();
|
||||
$wrap.hover(function () {
|
||||
$target.show(0, opts.onshow());
|
||||
}, function () {
|
||||
$target.hide(0, opts.onhide());
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Captions.prototype = {
|
||||
|
||||
constructor: Captions,
|
||||
|
||||
set_from_attr: function(el, opt){
|
||||
var cfg={},
|
||||
attrs=el.attributes,
|
||||
l=attrs.length;
|
||||
|
||||
for (var i=0; i<l; i++)
|
||||
{
|
||||
attr = attrs.item(i);
|
||||
if (/cap-/i.test(attr.nodeName))
|
||||
{
|
||||
opt[attr.nodeName.replace('cap-', '')] = attr.nodeValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.hcaptions = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('captions')
|
||||
, options = $.extend({}, $.fn.hcaptions.defaults, $this.data(), typeof option == 'object' && option);
|
||||
if (!data) $this.data('captions', (data = new Captions(this, options)));
|
||||
if (typeof option == 'string') data[option]();
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.hcaptions.defaults = {
|
||||
|
||||
/**
|
||||
* Selector for caption content
|
||||
* @type {String}
|
||||
*/
|
||||
data_selector: '.cap-overlay',
|
||||
|
||||
/**
|
||||
* Overlay width
|
||||
* @default full width
|
||||
* @type {Number}
|
||||
*/
|
||||
width: 0,
|
||||
|
||||
/**
|
||||
* Overlay height
|
||||
* @type {Number}
|
||||
*/
|
||||
height: 0,
|
||||
|
||||
/**
|
||||
* Horizontal position for the overlay
|
||||
* @options [center, left, right]
|
||||
* @type {String}
|
||||
*/
|
||||
overlay_x: 'center',
|
||||
|
||||
/**
|
||||
* Vertical position for the overlay
|
||||
* @options [center, top, bottom]
|
||||
* @type {String}
|
||||
*/
|
||||
overlay_y: 'center',
|
||||
|
||||
/**
|
||||
* Background css for overlay
|
||||
* @type {String}
|
||||
*/
|
||||
overlay_bg: '',
|
||||
|
||||
/**
|
||||
* Opacity of overlay
|
||||
* @type {Number}
|
||||
*/
|
||||
overlay_opacity: 1,
|
||||
|
||||
/**
|
||||
* Effect of overlay
|
||||
* @options [fade, slide, show/hide]
|
||||
* @type {String}
|
||||
*/
|
||||
effect: 'slide',
|
||||
|
||||
/**
|
||||
* Animation speed in ms
|
||||
* @type {Number}
|
||||
*/
|
||||
speed: 400,
|
||||
|
||||
/**
|
||||
* Direction of overlay
|
||||
* @options [top, bottom, right, left]
|
||||
* @type {String}
|
||||
*/
|
||||
direction: 'top',
|
||||
|
||||
/**
|
||||
* Z-Index Base
|
||||
* @type {Number}
|
||||
*/
|
||||
zindex: 2,
|
||||
|
||||
find_image: false,
|
||||
|
||||
/**
|
||||
* On show callback
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
onshow: function(){},
|
||||
|
||||
/**
|
||||
* On hide callback
|
||||
* @return {[type]} [description]
|
||||
*/
|
||||
onhide: function(){}
|
||||
};
|
||||
})(jQuery);
|
||||
487
build/js/include/plugins/toolbar/jquery.toolbar.css
Normal file
487
build/js/include/plugins/toolbar/jquery.toolbar.css
Normal file
@@ -0,0 +1,487 @@
|
||||
.tool-container, .tool-item, .btn-toolbar {
|
||||
-webkit-box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.btn-toolbar {
|
||||
background: #364347;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
border-radius: 6px;
|
||||
display: block;
|
||||
transition: none;
|
||||
}
|
||||
.btn-toolbar > i {
|
||||
color: #02baf2;
|
||||
font-size: 16px;
|
||||
}
|
||||
.btn-toolbar:hover {
|
||||
background: #02baf2;
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn-toolbar:hover > i {
|
||||
color: white;
|
||||
}
|
||||
.btn-toolbar-primary {
|
||||
background-color: #009dcd;
|
||||
}
|
||||
.btn-toolbar-primary.pressed {
|
||||
background-color: #02baf2;
|
||||
}
|
||||
.btn-toolbar-primary:hover {
|
||||
background-color: #02baf2;
|
||||
}
|
||||
.btn-toolbar-primary > i {
|
||||
color: white;
|
||||
}
|
||||
.btn-toolbar-danger {
|
||||
background-color: #cc0000;
|
||||
}
|
||||
.btn-toolbar-danger.pressed {
|
||||
background-color: #f84545;
|
||||
}
|
||||
.btn-toolbar-danger:hover {
|
||||
background-color: #f84545;
|
||||
}
|
||||
.btn-toolbar-danger > i {
|
||||
color: white;
|
||||
}
|
||||
.btn-toolbar-warning {
|
||||
background-color: #f3bc65;
|
||||
}
|
||||
.btn-toolbar-warning.pressed {
|
||||
background-color: #fad46b;
|
||||
}
|
||||
.btn-toolbar-warning:hover {
|
||||
background-color: #fad46b;
|
||||
}
|
||||
.btn-toolbar-warning > i {
|
||||
color: white;
|
||||
}
|
||||
.btn-toolbar-info {
|
||||
background-color: #e96300;
|
||||
}
|
||||
.btn-toolbar-info.pressed {
|
||||
background-color: #f58410;
|
||||
}
|
||||
.btn-toolbar-info:hover {
|
||||
background-color: #f58410;
|
||||
}
|
||||
.btn-toolbar-info > i {
|
||||
color: white;
|
||||
}
|
||||
.btn-toolbar-success {
|
||||
background-color: #28948c;
|
||||
}
|
||||
.btn-toolbar-success.pressed {
|
||||
background-color: #3eb5ac;
|
||||
}
|
||||
.btn-toolbar-success:hover {
|
||||
background-color: #3eb5ac;
|
||||
}
|
||||
.btn-toolbar-success > i {
|
||||
color: white;
|
||||
}
|
||||
.btn-toolbar-info-o {
|
||||
background-color: #9175bd;
|
||||
}
|
||||
.btn-toolbar-info-o.pressed {
|
||||
background-color: #a88cd5;
|
||||
}
|
||||
.btn-toolbar-info-o:hover {
|
||||
background-color: #a88cd5;
|
||||
}
|
||||
.btn-toolbar-info-o > i {
|
||||
color: white;
|
||||
}
|
||||
.btn-toolbar-light {
|
||||
background-color: #b2c6cd;
|
||||
}
|
||||
.btn-toolbar-light.pressed {
|
||||
background-color: #d6e1e5;
|
||||
}
|
||||
.btn-toolbar-light:hover {
|
||||
background-color: #d6e1e5;
|
||||
}
|
||||
.btn-toolbar-light > i {
|
||||
color: white;
|
||||
}
|
||||
.btn-toolbar-dark {
|
||||
background-color: #364347;
|
||||
}
|
||||
.btn-toolbar-dark.pressed {
|
||||
background-color: #5e696d;
|
||||
}
|
||||
.btn-toolbar-dark:hover {
|
||||
background-color: #5e696d;
|
||||
}
|
||||
.btn-toolbar-dark > i {
|
||||
color: white;
|
||||
}
|
||||
.tool-container {
|
||||
background-color: #5e696d;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 6px;
|
||||
position: absolute;
|
||||
}
|
||||
.tool-container.tool-top,
|
||||
.tool-container.tool-bottom {
|
||||
height: 40px;
|
||||
border-bottom: 0px solid #beb8b8;
|
||||
}
|
||||
.tool-container.tool-top .tool-item,
|
||||
.tool-container.tool-bottom .tool-item {
|
||||
float: left;
|
||||
border-right: 0;
|
||||
border-left: 0;
|
||||
}
|
||||
.tool-item {
|
||||
height: 100%;
|
||||
display: block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
transition: none;
|
||||
}
|
||||
.tool-item > .fa {
|
||||
color: #b2c6cd;
|
||||
}
|
||||
.tool-item.selected,
|
||||
.tool-item:hover {
|
||||
background: #02baf2;
|
||||
}
|
||||
.tool-item.selected > .fa,
|
||||
.tool-item:hover > .fa {
|
||||
color: white;
|
||||
}
|
||||
.tool-top .tool-item:first-child:hover,
|
||||
.tool-bottom .tool-item:first-child:hover {
|
||||
border-top-left-radius: 6px;
|
||||
border-bottom-left-radius: 6px;
|
||||
}
|
||||
.tool-top .tool-item:last-child:hover,
|
||||
.tool-bottom .tool-item:last-child:hover {
|
||||
border-top-right-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
.tool-vertical-top .tool-item:first-child:hover,
|
||||
.tool-vertical-bottom .tool-item:first-child:hover,
|
||||
.tool-right .tool-item:first-child:hover,
|
||||
.tool-left .tool-item:first-child:hover {
|
||||
border-top-left-radius: 6px;
|
||||
border-top-right-radius: 6px;
|
||||
}
|
||||
.tool-vertical-top .tool-item:last-child:hover,
|
||||
.tool-vertical-bottom .tool-item:last-child:hover,
|
||||
.tool-right .tool-item:last-child:hover,
|
||||
.tool-left .tool-item:last-child:hover {
|
||||
border-bottom-left-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
.tool-container .arrow {
|
||||
width: 0;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
border-width: 7px;
|
||||
border-style: solid;
|
||||
}
|
||||
.tool-container.tool-top .arrow {
|
||||
border-color: #5e696d transparent transparent;
|
||||
left: 50%;
|
||||
bottom: -14px;
|
||||
margin-left: -7px;
|
||||
}
|
||||
.tool-container.tool-bottom .arrow {
|
||||
border-color: transparent transparent #5e696d;
|
||||
left: 50%;
|
||||
top: -14px;
|
||||
margin-left: -7px;
|
||||
}
|
||||
.tool-container.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #5e696d;
|
||||
top: 50%;
|
||||
right: -14px;
|
||||
margin-top: -7px;
|
||||
}
|
||||
.tool-container.tool-right .arrow {
|
||||
border-color: transparent #5e696d transparent transparent;
|
||||
top: 50%;
|
||||
left: -14px;
|
||||
margin-top: -7px;
|
||||
}
|
||||
.toolbar-primary {
|
||||
background-color: #02baf2;
|
||||
}
|
||||
.toolbar-primary.tool-top .arrow {
|
||||
border-color: #02baf2 transparent transparent;
|
||||
}
|
||||
.toolbar-primary.tool-bottom .arrow {
|
||||
border-color: transparent transparent #02baf2;
|
||||
}
|
||||
.toolbar-primary.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #02baf2;
|
||||
}
|
||||
.toolbar-primary.tool-right .arrow {
|
||||
border-color: transparent #02baf2 transparent transparent;
|
||||
}
|
||||
.toolbar-primary .tool-item > .fa {
|
||||
color: white;
|
||||
}
|
||||
.toolbar-primary .tool-item.selected,
|
||||
.toolbar-primary .tool-item:hover {
|
||||
background: #009dcd;
|
||||
color: white;
|
||||
}
|
||||
.toolbar-danger {
|
||||
background-color: #f84545;
|
||||
}
|
||||
.toolbar-danger.tool-top .arrow {
|
||||
border-color: #f84545 transparent transparent;
|
||||
}
|
||||
.toolbar-danger.tool-bottom .arrow {
|
||||
border-color: transparent transparent #f84545;
|
||||
}
|
||||
.toolbar-danger.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #f84545;
|
||||
}
|
||||
.toolbar-danger.tool-right .arrow {
|
||||
border-color: transparent #f84545 transparent transparent;
|
||||
}
|
||||
.toolbar-danger .tool-item > .fa {
|
||||
color: white;
|
||||
}
|
||||
.toolbar-danger .tool-item.selected,
|
||||
.toolbar-danger .tool-item:hover {
|
||||
background: #cc0000;
|
||||
color: white;
|
||||
}
|
||||
.toolbar-warning {
|
||||
background-color: #f3bc65;
|
||||
}
|
||||
.toolbar-warning.tool-top .arrow {
|
||||
border-color: #f3bc65 transparent transparent;
|
||||
}
|
||||
.toolbar-warning.tool-bottom .arrow {
|
||||
border-color: transparent transparent #f3bc65;
|
||||
}
|
||||
.toolbar-warning.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #f3bc65;
|
||||
}
|
||||
.toolbar-warning.tool-right .arrow {
|
||||
border-color: transparent #f3bc65 transparent transparent;
|
||||
}
|
||||
.toolbar-warning .tool-item > .fa {
|
||||
color: white;
|
||||
}
|
||||
.toolbar-warning .tool-item.selected,
|
||||
.toolbar-warning .tool-item:hover {
|
||||
background: #fad46b;
|
||||
color: white;
|
||||
}
|
||||
.toolbar-info {
|
||||
background-color: #e96300;
|
||||
}
|
||||
.toolbar-info.tool-top .arrow {
|
||||
border-color: #e96300 transparent transparent;
|
||||
}
|
||||
.toolbar-info.tool-bottom .arrow {
|
||||
border-color: transparent transparent #e96300;
|
||||
}
|
||||
.toolbar-info.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #e96300;
|
||||
}
|
||||
.toolbar-info.tool-right .arrow {
|
||||
border-color: transparent #e96300 transparent transparent;
|
||||
}
|
||||
.toolbar-info .tool-item > .fa {
|
||||
color: white;
|
||||
}
|
||||
.toolbar-info .tool-item.selected,
|
||||
.toolbar-info .tool-item:hover {
|
||||
background: #f58410;
|
||||
color: white;
|
||||
}
|
||||
.toolbar-success {
|
||||
background-color: #28948c;
|
||||
}
|
||||
.toolbar-success.tool-top .arrow {
|
||||
border-color: #28948c transparent transparent;
|
||||
}
|
||||
.toolbar-success.tool-bottom .arrow {
|
||||
border-color: transparent transparent #28948c;
|
||||
}
|
||||
.toolbar-success.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #28948c;
|
||||
}
|
||||
.toolbar-success.tool-right .arrow {
|
||||
border-color: transparent #28948c transparent transparent;
|
||||
}
|
||||
.toolbar-success .tool-item > .fa {
|
||||
color: white;
|
||||
}
|
||||
.toolbar-success .tool-item.selected,
|
||||
.toolbar-success .tool-item:hover {
|
||||
background: #3eb5ac;
|
||||
color: white;
|
||||
}
|
||||
.toolbar-info-o {
|
||||
background-color: #9175bd;
|
||||
}
|
||||
.toolbar-info-o.tool-top .arrow {
|
||||
border-color: #9175bd transparent transparent;
|
||||
}
|
||||
.toolbar-info-o.tool-bottom .arrow {
|
||||
border-color: transparent transparent #9175bd;
|
||||
}
|
||||
.toolbar-info-o.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #9175bd;
|
||||
}
|
||||
.toolbar-info-o.tool-right .arrow {
|
||||
border-color: transparent #9175bd transparent transparent;
|
||||
}
|
||||
.toolbar-info-o .tool-item > .fa {
|
||||
color: white;
|
||||
}
|
||||
.toolbar-info-o .tool-item.selected,
|
||||
.toolbar-info-o .tool-item:hover {
|
||||
background: #a88cd5;
|
||||
color: white;
|
||||
}
|
||||
.toolbar-light {
|
||||
background-color: #b2c6cd;
|
||||
}
|
||||
.toolbar-light.tool-top .arrow {
|
||||
border-color: #b2c6cd transparent transparent;
|
||||
}
|
||||
.toolbar-light.tool-bottom .arrow {
|
||||
border-color: transparent transparent #b2c6cd;
|
||||
}
|
||||
.toolbar-light.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #b2c6cd;
|
||||
}
|
||||
.toolbar-light.tool-right .arrow {
|
||||
border-color: transparent #b2c6cd transparent transparent;
|
||||
}
|
||||
.toolbar-light .tool-item > .fa {
|
||||
color: white;
|
||||
}
|
||||
.toolbar-light .tool-item.selected,
|
||||
.toolbar-light .tool-item:hover {
|
||||
background: #d6e1e5;
|
||||
color: white;
|
||||
}
|
||||
.toolbar-dark {
|
||||
background-color: #364347;
|
||||
}
|
||||
.toolbar-dark.tool-top .arrow {
|
||||
border-color: #364347 transparent transparent;
|
||||
}
|
||||
.toolbar-dark.tool-bottom .arrow {
|
||||
border-color: transparent transparent #364347;
|
||||
}
|
||||
.toolbar-dark.tool-left .arrow {
|
||||
border-color: transparent transparent transparent #364347;
|
||||
}
|
||||
.toolbar-dark.tool-right .arrow {
|
||||
border-color: transparent #364347 transparent transparent;
|
||||
}
|
||||
.toolbar-dark .tool-item > .fa {
|
||||
color: white;
|
||||
}
|
||||
.toolbar-dark .tool-item.selected,
|
||||
.toolbar-dark .tool-item:hover {
|
||||
background: #5e696d;
|
||||
color: white;
|
||||
}
|
||||
.animate-standard {
|
||||
-webkit-animation: standardAnimate 0.3s 1 ease;
|
||||
}
|
||||
.animate-flyin {
|
||||
-webkit-animation: rotateAnimate 0.5s 1 ease;
|
||||
}
|
||||
.animate-grow {
|
||||
-webkit-animation: growAnimate 0.4s 1 ease;
|
||||
}
|
||||
.animate-flip {
|
||||
-webkit-animation: flipAnimate 0.4s 1 ease;
|
||||
}
|
||||
.animate-bounce {
|
||||
-webkit-animation: bounceAnimate 0.4s 1 ease-out;
|
||||
}
|
||||
@-webkit-keyframes rotateAnimate {
|
||||
from {
|
||||
transform: rotate(180deg) translate(-120px);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: rotate(0deg) translate(0px);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes standardAnimate {
|
||||
from {
|
||||
transform: translateY(20px);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: translateY(0px);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes growAnimate {
|
||||
0% {
|
||||
transform: scale(0) translateY(40px);
|
||||
opacity: 0;
|
||||
}
|
||||
70% {
|
||||
transform: scale(1.5) translate(0px);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1) translate(0px);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes rotate2Animate {
|
||||
from {
|
||||
transform: rotate(-90deg);
|
||||
transform-origin: 0% 100%;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: rotate(0deg);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes flipAnimate {
|
||||
from {
|
||||
transform: rotate3d(2, 2, 2, 180deg);
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
transform: rotate3d(0, 0, 0, 0deg);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes bounceAnimate {
|
||||
0% {
|
||||
transform: translateY(40px);
|
||||
opacity: 0;
|
||||
}
|
||||
30% {
|
||||
transform: translateY(-40px);
|
||||
}
|
||||
70% {
|
||||
transform: translateY(20px);
|
||||
}
|
||||
100% {
|
||||
transform: translateY(0px);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
307
build/js/include/plugins/toolbar/jquery.toolbar.js
Normal file
307
build/js/include/plugins/toolbar/jquery.toolbar.js
Normal file
@@ -0,0 +1,307 @@
|
||||
/**
|
||||
* Toolbar.js
|
||||
*
|
||||
* @fileoverview jQuery plugin that creates tooltip style toolbars.
|
||||
* @link http://paulkinzett.github.com/toolbar/
|
||||
* @author Paul Kinzett (http://kinzett.co.nz/)
|
||||
* @version 1.1.0
|
||||
* @requires jQuery 1.7+
|
||||
*
|
||||
* @license jQuery Toolbar Plugin v1.1.0
|
||||
* http://paulkinzett.github.com/toolbar/
|
||||
* Copyright 2013 - 2015 Paul Kinzett (http://kinzett.co.nz/)
|
||||
* Released under the MIT license.
|
||||
* <https://raw.github.com/paulkinzett/toolbar/master/LICENSE.txt>
|
||||
*/
|
||||
|
||||
if ( typeof Object.create !== 'function' ) {
|
||||
Object.create = function( obj ) {
|
||||
function F() {}
|
||||
F.prototype = obj;
|
||||
return new F();
|
||||
};
|
||||
}
|
||||
|
||||
(function( $, window, document, undefined ) {
|
||||
|
||||
var ToolBar = {
|
||||
init: function( options, elem ) {
|
||||
var self = this;
|
||||
self.elem = elem;
|
||||
self.$elem = $( elem );
|
||||
self.options = $.extend( {}, $.fn.toolbar.options, options );
|
||||
self.metadata = self.$elem.data();
|
||||
self.overrideOptions();
|
||||
self.toolbar = $('<div class="tool-container" />')
|
||||
.addClass('tool-'+self.options.position)
|
||||
.addClass('toolbar-'+self.options.style)
|
||||
.append('<div class="tool-items" />')
|
||||
.append('<div class="arrow" />')
|
||||
.appendTo('body')
|
||||
.css('opacity', 0)
|
||||
.hide();
|
||||
self.toolbar_arrow = self.toolbar.find('.arrow');
|
||||
self.initializeToolbar();
|
||||
},
|
||||
|
||||
overrideOptions: function() {
|
||||
var self = this;
|
||||
$.each( self.options, function( $option ) {
|
||||
if (typeof(self.$elem.data('toolbar-'+$option)) != "undefined") {
|
||||
self.options[$option] = self.$elem.data('toolbar-'+$option);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
initializeToolbar: function() {
|
||||
var self = this;
|
||||
self.populateContent();
|
||||
self.setTrigger();
|
||||
self.toolbarWidth = self.toolbar.width();
|
||||
},
|
||||
|
||||
setTrigger: function() {
|
||||
var self = this;
|
||||
|
||||
if (self.options.event != 'click') {
|
||||
|
||||
var moveTime;
|
||||
function decideTimeout () {
|
||||
if (self.$elem.hasClass('pressed')) {
|
||||
moveTime = setTimeout(function() {
|
||||
self.hide();
|
||||
}, 150);
|
||||
} else {
|
||||
clearTimeout(moveTime);
|
||||
};
|
||||
};
|
||||
|
||||
self.$elem.on({
|
||||
mouseenter: function(event) {
|
||||
if (self.$elem.hasClass('pressed')) {
|
||||
clearTimeout(moveTime);
|
||||
} else {
|
||||
self.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self.$elem.parent().on({
|
||||
mouseleave: function(event){ decideTimeout(); }
|
||||
});
|
||||
|
||||
$('.tool-container').on({
|
||||
mouseenter: function(event){ clearTimeout(moveTime); },
|
||||
mouseleave: function(event){ decideTimeout(); }
|
||||
});
|
||||
}
|
||||
|
||||
if (self.options.event == 'click') {
|
||||
self.$elem.on('click', function(event) {
|
||||
event.preventDefault();
|
||||
if(self.$elem.hasClass('pressed')) {
|
||||
self.hide();
|
||||
} else {
|
||||
self.show();
|
||||
}
|
||||
});
|
||||
|
||||
if (self.options.hideOnClick) {
|
||||
$('html').on("click.toolbar", function ( event ) {
|
||||
if (event.target != self.elem &&
|
||||
self.$elem.has(event.target).length === 0 &&
|
||||
self.toolbar.has(event.target).length === 0 &&
|
||||
self.toolbar.is(":visible")) {
|
||||
self.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (self.options.hover) {
|
||||
var moveTime;
|
||||
|
||||
function decideTimeout () {
|
||||
if (self.$elem.hasClass('pressed')) {
|
||||
moveTime = setTimeout(function() {
|
||||
self.hide();
|
||||
}, 150);
|
||||
} else {
|
||||
clearTimeout(moveTime);
|
||||
};
|
||||
};
|
||||
|
||||
self.$elem.on({
|
||||
mouseenter: function(event) {
|
||||
if (self.$elem.hasClass('pressed')) {
|
||||
clearTimeout(moveTime);
|
||||
} else {
|
||||
self.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
self.$elem.parent().on({
|
||||
mouseleave: function(event){ decideTimeout(); }
|
||||
});
|
||||
|
||||
$('.tool-container').on({
|
||||
mouseenter: function(event){ clearTimeout(moveTime); },
|
||||
mouseleave: function(event){ decideTimeout(); }
|
||||
});
|
||||
}
|
||||
|
||||
$(window).resize(function( event ) {
|
||||
event.stopPropagation();
|
||||
if ( self.toolbar.is(":visible") ) {
|
||||
self.toolbarCss = self.getCoordinates(self.options.position, 20);
|
||||
self.collisionDetection();
|
||||
self.toolbar.css( self.toolbarCss );
|
||||
self.toolbar_arrow.css( self.arrowCss );
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
populateContent: function() {
|
||||
var self = this;
|
||||
var location = self.toolbar.find('.tool-items');
|
||||
var content = $(self.options.content).clone( true ).find('a').addClass('tool-item');
|
||||
location.html(content);
|
||||
location.find('.tool-item').on('click', function(event) {
|
||||
event.preventDefault();
|
||||
self.$elem.trigger('toolbarItemClick', this);
|
||||
});
|
||||
},
|
||||
|
||||
calculatePosition: function() {
|
||||
var self = this;
|
||||
self.arrowCss = {};
|
||||
self.toolbarCss = self.getCoordinates(self.options.position, self.options.adjustment);
|
||||
self.toolbarCss.position = 'absolute';
|
||||
self.toolbarCss.zIndex = self.options.zIndex;
|
||||
self.collisionDetection();
|
||||
self.toolbar.css(self.toolbarCss);
|
||||
self.toolbar_arrow.css(self.arrowCss);
|
||||
},
|
||||
|
||||
getCoordinates: function( position, adjustment ) {
|
||||
var self = this;
|
||||
self.coordinates = self.$elem.offset();
|
||||
|
||||
if (self.options.adjustment && self.options.adjustment[self.options.position]) {
|
||||
adjustment = self.options.adjustment[self.options.position] + adjustment;
|
||||
}
|
||||
|
||||
switch(self.options.position) {
|
||||
case 'top':
|
||||
return {
|
||||
left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2),
|
||||
top: self.coordinates.top-self.$elem.outerHeight()-adjustment,
|
||||
right: 'auto'
|
||||
};
|
||||
case 'left':
|
||||
return {
|
||||
left: self.coordinates.left-(self.toolbar.width()/2)-(self.$elem.outerWidth()/2)-adjustment,
|
||||
top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2),
|
||||
right: 'auto'
|
||||
};
|
||||
case 'right':
|
||||
return {
|
||||
left: self.coordinates.left+(self.toolbar.width()/2)+(self.$elem.outerWidth()/2)+adjustment,
|
||||
top: self.coordinates.top-(self.toolbar.height()/2)+(self.$elem.outerHeight()/2),
|
||||
right: 'auto'
|
||||
};
|
||||
case 'bottom':
|
||||
return {
|
||||
left: self.coordinates.left-(self.toolbar.width()/2)+(self.$elem.outerWidth()/2),
|
||||
top: self.coordinates.top+self.$elem.outerHeight()+adjustment,
|
||||
right: 'auto'
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
collisionDetection: function() {
|
||||
var self = this;
|
||||
var edgeOffset = 20;
|
||||
if(self.options.position == 'top' || self.options.position == 'bottom') {
|
||||
self.arrowCss = {left: '50%', right: '50%'};
|
||||
if( self.toolbarCss.left < edgeOffset ) {
|
||||
self.toolbarCss.left = edgeOffset;
|
||||
self.arrowCss.left = self.$elem.offset().left + self.$elem.width()/2-(edgeOffset);
|
||||
}
|
||||
else if(($(window).width() - (self.toolbarCss.left + self.toolbarWidth)) < edgeOffset) {
|
||||
self.toolbarCss.right = edgeOffset;
|
||||
self.toolbarCss.left = 'auto';
|
||||
self.arrowCss.left = 'auto';
|
||||
self.arrowCss.right = ($(window).width()-self.$elem.offset().left)-(self.$elem.width()/2)-(edgeOffset)-5;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
show: function() {
|
||||
var self = this;
|
||||
self.$elem.addClass('pressed');
|
||||
self.calculatePosition();
|
||||
self.toolbar.show().css({'opacity': 1}).addClass('animate-'+self.options.animation);
|
||||
self.$elem.trigger('toolbarShown');
|
||||
},
|
||||
|
||||
hide: function() {
|
||||
var self = this;
|
||||
var animation = {'opacity': 0};
|
||||
|
||||
self.$elem.removeClass('pressed');
|
||||
|
||||
switch(self.options.position) {
|
||||
case 'top':
|
||||
animation.top = '+=20';
|
||||
break;
|
||||
case 'left':
|
||||
animation.left = '+=20';
|
||||
break;
|
||||
case 'right':
|
||||
animation.left = '-=20';
|
||||
break;
|
||||
case 'bottom':
|
||||
animation.top = '-=20';
|
||||
break;
|
||||
}
|
||||
|
||||
self.toolbar.animate(animation, 200, function() {
|
||||
self.toolbar.hide();
|
||||
});
|
||||
|
||||
self.$elem.trigger('toolbarHidden');
|
||||
},
|
||||
|
||||
getToolbarElement: function () {
|
||||
return this.toolbar.find('.tool-items');
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.toolbar = function( options ) {
|
||||
if ($.isPlainObject( options )) {
|
||||
return this.each(function() {
|
||||
var toolbarObj = Object.create( ToolBar );
|
||||
toolbarObj.init( options, this );
|
||||
$(this).data('toolbarObj', toolbarObj);
|
||||
});
|
||||
} else if ( typeof options === 'string' && options.indexOf('_') !== 0 ) {
|
||||
var toolbarObj = $(this).data('toolbarObj');
|
||||
var method = toolbarObj[options];
|
||||
return method.apply(toolbarObj, $.makeArray(arguments).slice(1));
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.toolbar.options = {
|
||||
content: '#myContent',
|
||||
position: 'top',
|
||||
hideOnClick: false,
|
||||
zIndex: 120,
|
||||
hover: false,
|
||||
style: 'default',
|
||||
animation: 'standard',
|
||||
adjustment: 10
|
||||
};
|
||||
|
||||
}) ( jQuery, window, document );
|
||||
Reference in New Issue
Block a user