mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-10 07:16:08 +01:00
local initial checkin
This commit is contained in:
153
theme-old/js/addons/jquery.mmenu.counters.js
Executable file
153
theme-old/js/addons/jquery.mmenu.counters.js
Executable file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* jQuery mmenu counters addon
|
||||
* @requires mmenu 4.0.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var _PLUGIN_ = 'mmenu',
|
||||
_ADDON_ = 'counters';
|
||||
|
||||
|
||||
$[ _PLUGIN_ ].prototype[ '_addon_' + _ADDON_ ] = function()
|
||||
{
|
||||
var that = this,
|
||||
opts = this.opts[ _ADDON_ ];
|
||||
|
||||
var _c = $[ _PLUGIN_ ]._c,
|
||||
_d = $[ _PLUGIN_ ]._d,
|
||||
_e = $[ _PLUGIN_ ]._e;
|
||||
|
||||
_c.add( 'counter noresults' );
|
||||
_e.add( 'updatecounters' );
|
||||
|
||||
|
||||
// Extend options
|
||||
if ( typeof opts == 'boolean' )
|
||||
{
|
||||
opts = {
|
||||
add : opts,
|
||||
update : opts
|
||||
};
|
||||
}
|
||||
if ( typeof opts != 'object' )
|
||||
{
|
||||
opts = {};
|
||||
}
|
||||
opts = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
|
||||
|
||||
|
||||
// DEPRECATED
|
||||
if ( opts.count )
|
||||
{
|
||||
$[ _PLUGIN_ ].deprecated( 'the option "count" for counters, the option "update"' );
|
||||
opts.update = opts.count;
|
||||
}
|
||||
// /DEPRECATED
|
||||
|
||||
|
||||
// Refactor counter class
|
||||
this.__refactorClass( $('em.' + this.conf.counterClass, this.$menu), 'counter' );
|
||||
|
||||
var $panels = $('.' + _c.panel, this.$menu);
|
||||
|
||||
// Add the counters
|
||||
if ( opts.add )
|
||||
{
|
||||
$panels.each(
|
||||
function()
|
||||
{
|
||||
var $t = $(this),
|
||||
$p = $t.data( _d.parent );
|
||||
|
||||
if ( $p )
|
||||
{
|
||||
var $c = $( '<em class="' + _c.counter + '" />' ),
|
||||
$a = $p.find( '> a.' + _c.subopen );
|
||||
|
||||
if ( !$a.parent().find( 'em.' + _c.counter ).length )
|
||||
{
|
||||
$a.before( $c );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Bind custom events
|
||||
if ( opts.update )
|
||||
{
|
||||
var $counters = $('em.' + _c.counter, this.$menu);
|
||||
|
||||
$counters
|
||||
.off( _e.updatecounters )
|
||||
.on( _e.updatecounters,
|
||||
function( e )
|
||||
{
|
||||
e.stopPropagation();
|
||||
}
|
||||
)
|
||||
.each(
|
||||
function()
|
||||
{
|
||||
var $counter = $(this),
|
||||
$sublist = $($counter.next().attr( 'href' ), that.$menu);
|
||||
|
||||
if ( !$sublist.is( '.' + _c.list ) )
|
||||
{
|
||||
$sublist = $sublist.find( '> .' + _c.list );
|
||||
}
|
||||
|
||||
if ( $sublist.length )
|
||||
{
|
||||
$counter
|
||||
.on( _e.updatecounters,
|
||||
function( e )
|
||||
{
|
||||
var $lis = $sublist.children()
|
||||
.not( '.' + _c.label )
|
||||
.not( '.' + _c.subtitle )
|
||||
.not( '.' + _c.hidden )
|
||||
.not( '.' + _c.noresults );
|
||||
|
||||
$counter.html( $lis.length );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
)
|
||||
.trigger( _e.updatecounters );
|
||||
|
||||
// Update with menu-update
|
||||
this.$menu
|
||||
.on( _e.update,
|
||||
function( e )
|
||||
{
|
||||
$counters.trigger( _e.updatecounters );
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
$[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
|
||||
add : false,
|
||||
update : false
|
||||
};
|
||||
$[ _PLUGIN_ ].configuration.counterClass = 'Counter';
|
||||
|
||||
|
||||
// Add to plugin
|
||||
$[ _PLUGIN_ ].addons = $[ _PLUGIN_ ].addons || [];
|
||||
$[ _PLUGIN_ ].addons.push( _ADDON_ );
|
||||
|
||||
})( jQuery );
|
||||
14
theme-old/js/addons/jquery.mmenu.counters.min.js
vendored
Executable file
14
theme-old/js/addons/jquery.mmenu.counters.min.js
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* jQuery mmenu counters addon
|
||||
* @requires mmenu 4.0.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
!function(t){var e="mmenu",n="counters";t[e].prototype["_addon_"+n]=function(){var o=this,u=this.opts[n],a=t[e]._c,r=t[e]._d,d=t[e]._e;a.add("counter noresults"),d.add("updatecounters"),"boolean"==typeof u&&(u={add:u,update:u}),"object"!=typeof u&&(u={}),u=t.extend(!0,{},t[e].defaults[n],u),u.count&&(t[e].deprecated('the option "count" for counters, the option "update"'),u.update=u.count),this.__refactorClass(t("em."+this.conf.counterClass,this.$menu),"counter");var s=t("."+a.panel,this.$menu);if(u.add&&s.each(function(){var e=t(this),n=e.data(r.parent);if(n){var o=t('<em class="'+a.counter+'" />'),u=n.find("> a."+a.subopen);u.parent().find("em."+a.counter).length||u.before(o)}}),u.update){var c=t("em."+a.counter,this.$menu);c.off(d.updatecounters).on(d.updatecounters,function(t){t.stopPropagation()}).each(function(){var e=t(this),n=t(e.next().attr("href"),o.$menu);n.is("."+a.list)||(n=n.find("> ."+a.list)),n.length&&e.on(d.updatecounters,function(){var t=n.children().not("."+a.label).not("."+a.subtitle).not("."+a.hidden).not("."+a.noresults);e.html(t.length)})}).trigger(d.updatecounters),this.$menu.on(d.update,function(){c.trigger(d.updatecounters)})}},t[e].defaults[n]={add:!1,update:!1},t[e].configuration.counterClass="Counter",t[e].addons=t[e].addons||[],t[e].addons.push(n)}(jQuery);
|
||||
296
theme-old/js/addons/jquery.mmenu.dragopen.js
Executable file
296
theme-old/js/addons/jquery.mmenu.dragopen.js
Executable file
@@ -0,0 +1,296 @@
|
||||
/*
|
||||
* jQuery mmenu dragOpen addon
|
||||
* @requires mmenu 4.0.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var _PLUGIN_ = 'mmenu',
|
||||
_ADDON_ = 'dragOpen';
|
||||
|
||||
|
||||
$[ _PLUGIN_ ].prototype[ '_addon_' + _ADDON_ ] = function()
|
||||
{
|
||||
var that = this,
|
||||
opts = this.opts[ _ADDON_ ];
|
||||
|
||||
if ( !$.fn.hammer )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var _c = $[ _PLUGIN_ ]._c,
|
||||
_d = $[ _PLUGIN_ ]._d,
|
||||
_e = $[ _PLUGIN_ ]._e;
|
||||
|
||||
_c.add( 'dragging' );
|
||||
_e.add( 'dragleft dragright dragup dragdown dragend' );
|
||||
|
||||
var glbl = $[ _PLUGIN_ ].glbl;
|
||||
|
||||
// Extend options
|
||||
if ( typeof opts == 'boolean' )
|
||||
{
|
||||
opts = {
|
||||
open: opts
|
||||
};
|
||||
}
|
||||
if ( typeof opts != 'object' )
|
||||
{
|
||||
opts = {};
|
||||
}
|
||||
if ( typeof opts.maxStartPos != 'number' )
|
||||
{
|
||||
opts.maxStartPos = this.opts.position == 'left' || this.opts.position == 'right'
|
||||
? 150
|
||||
: 75;
|
||||
}
|
||||
opts = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
|
||||
|
||||
if ( opts.open )
|
||||
{
|
||||
var _stage = 0,
|
||||
_direction = false,
|
||||
_distance = 0,
|
||||
_maxDistance = 0,
|
||||
_dimension = 'width';
|
||||
|
||||
switch( this.opts.position )
|
||||
{
|
||||
case 'left':
|
||||
case 'right':
|
||||
_dimension = 'width';
|
||||
break;
|
||||
default:
|
||||
_dimension = 'height';
|
||||
break;
|
||||
}
|
||||
|
||||
// Set up variables
|
||||
switch( this.opts.position )
|
||||
{
|
||||
case 'left':
|
||||
var drag = {
|
||||
events : _e.dragleft + ' ' + _e.dragright,
|
||||
open_dir : 'right',
|
||||
close_dir : 'left',
|
||||
delta : 'deltaX',
|
||||
page : 'pageX',
|
||||
negative : false
|
||||
};
|
||||
break;
|
||||
|
||||
case 'right':
|
||||
var drag = {
|
||||
events : _e.dragleft + ' ' + _e.dragright,
|
||||
open_dir : 'left',
|
||||
close_dir : 'right',
|
||||
delta : 'deltaX',
|
||||
page : 'pageX',
|
||||
negative : true
|
||||
};
|
||||
break;
|
||||
|
||||
case 'top':
|
||||
var drag = {
|
||||
events : _e.dragup + ' ' + _e.dragdown,
|
||||
open_dir : 'down',
|
||||
close_dir : 'up',
|
||||
delta : 'deltaY',
|
||||
page : 'pageY',
|
||||
negative : false
|
||||
};
|
||||
break;
|
||||
|
||||
case 'bottom':
|
||||
var drag = {
|
||||
events : _e.dragup + ' ' + _e.dragdown,
|
||||
open_dir : 'up',
|
||||
close_dir : 'down',
|
||||
delta : 'deltaY',
|
||||
page : 'pageY',
|
||||
negative : true
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
var $dragNode = this.__valueOrFn( opts.pageNode, this.$menu, glbl.$page );
|
||||
if ( typeof $dragNode == 'string' )
|
||||
{
|
||||
$dragNode = $($dragNode);
|
||||
}
|
||||
|
||||
var $fixed = glbl.$page.find( '.' + _c.mm( 'fixed-top' ) + ', .' + _c.mm( 'fixed-bottom' ) ),
|
||||
$dragg = glbl.$page;
|
||||
|
||||
switch ( that.opts.zposition )
|
||||
{
|
||||
case 'back':
|
||||
$dragg = $dragg.add( $fixed );
|
||||
break;
|
||||
|
||||
case 'front':
|
||||
$dragg = that.$menu;
|
||||
break;
|
||||
|
||||
case 'next':
|
||||
$dragg = $dragg.add( that.$menu ).add( $fixed );
|
||||
break;
|
||||
};
|
||||
|
||||
// Bind events
|
||||
$dragNode
|
||||
.hammer()
|
||||
.on( _e.touchstart + ' ' + _e.mousedown,
|
||||
function( e )
|
||||
{
|
||||
if ( e.type == 'touchstart' )
|
||||
{
|
||||
var tch = e.originalEvent.touches[ 0 ] || e.originalEvent.changedTouches[ 0 ],
|
||||
pos = tch[ drag.page ];
|
||||
}
|
||||
else if ( e.type == 'mousedown' )
|
||||
{
|
||||
var pos = e[ drag.page ];
|
||||
}
|
||||
|
||||
switch( that.opts.position )
|
||||
{
|
||||
case 'right':
|
||||
case 'bottom':
|
||||
if ( pos >= glbl.$wndw[ _dimension ]() - opts.maxStartPos )
|
||||
{
|
||||
_stage = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( pos <= opts.maxStartPos )
|
||||
{
|
||||
_stage = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
)
|
||||
.on( drag.events + ' ' + _e.dragend,
|
||||
function( e )
|
||||
{
|
||||
if ( _stage > 0 )
|
||||
{
|
||||
e.gesture.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
}
|
||||
)
|
||||
.on( drag.events,
|
||||
function( e )
|
||||
{
|
||||
var new_distance = drag.negative
|
||||
? -e.gesture[ drag.delta ]
|
||||
: e.gesture[ drag.delta ];
|
||||
|
||||
_direction = ( new_distance > _distance )
|
||||
? drag.open_dir
|
||||
: drag.close_dir;
|
||||
|
||||
_distance = new_distance;
|
||||
|
||||
if ( _distance > opts.threshold )
|
||||
{
|
||||
if ( _stage == 1 )
|
||||
{
|
||||
if ( glbl.$html.hasClass( _c.opened ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
_stage = 2;
|
||||
that._openSetup();
|
||||
glbl.$html.addClass( _c.dragging );
|
||||
|
||||
_maxDistance = minMax(
|
||||
glbl.$wndw[ _dimension ]() * that.conf[ _ADDON_ ][ _dimension ].perc,
|
||||
that.conf[ _ADDON_ ][ _dimension ].min,
|
||||
that.conf[ _ADDON_ ][ _dimension ].max
|
||||
);
|
||||
}
|
||||
}
|
||||
if ( _stage == 2 )
|
||||
{
|
||||
$dragg.css( that.opts.position, minMax( _distance, 10, _maxDistance ) - ( that.opts.zposition == 'front' ? _maxDistance : 0 ) );
|
||||
}
|
||||
}
|
||||
)
|
||||
.on( _e.dragend,
|
||||
function( e )
|
||||
{
|
||||
if ( _stage == 2 )
|
||||
{
|
||||
glbl.$html.removeClass( _c.dragging );
|
||||
$dragg.css( that.opts.position, '' );
|
||||
|
||||
if ( _direction == drag.open_dir )
|
||||
{
|
||||
that._openFinish();
|
||||
}
|
||||
else
|
||||
{
|
||||
that.close();
|
||||
}
|
||||
}
|
||||
_stage = 0;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
$[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
|
||||
open : false,
|
||||
// pageNode : null,
|
||||
// maxStartPos : null,
|
||||
threshold : 50
|
||||
};
|
||||
$[ _PLUGIN_ ].configuration[ _ADDON_ ] = {
|
||||
width : {
|
||||
perc : 0.8,
|
||||
min : 140,
|
||||
max : 440
|
||||
},
|
||||
height : {
|
||||
perc : 0.8,
|
||||
min : 140,
|
||||
max : 880
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Add to plugin
|
||||
$[ _PLUGIN_ ].addons = $[ _PLUGIN_ ].addons || [];
|
||||
$[ _PLUGIN_ ].addons.push( _ADDON_ );
|
||||
|
||||
|
||||
// Functions
|
||||
function minMax( val, min, max )
|
||||
{
|
||||
if ( val < min )
|
||||
{
|
||||
val = min;
|
||||
}
|
||||
if ( val > max )
|
||||
{
|
||||
val = max;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
14
theme-old/js/addons/jquery.mmenu.dragopen.min.js
vendored
Executable file
14
theme-old/js/addons/jquery.mmenu.dragopen.min.js
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* jQuery mmenu dragOpen addon
|
||||
* @requires mmenu 4.0.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
!function(e){function t(e,t,a){return t>e&&(e=t),e>a&&(e=a),e}var a="mmenu",o="dragOpen";e[a].prototype["_addon_"+o]=function(){var n=this,r=this.opts[o];if(e.fn.hammer){var i=e[a]._c,s=(e[a]._d,e[a]._e);i.add("dragging"),s.add("dragleft dragright dragup dragdown dragend");var d=e[a].glbl;if("boolean"==typeof r&&(r={open:r}),"object"!=typeof r&&(r={}),"number"!=typeof r.maxStartPos&&(r.maxStartPos="left"==this.opts.position||"right"==this.opts.position?150:75),r=e.extend(!0,{},e[a].defaults[o],r),r.open){var p=0,g=!1,c=0,h=0,l="width";switch(this.opts.position){case"left":case"right":l="width";break;default:l="height"}switch(this.opts.position){case"left":var f={events:s.dragleft+" "+s.dragright,open_dir:"right",close_dir:"left",delta:"deltaX",page:"pageX",negative:!1};break;case"right":var f={events:s.dragleft+" "+s.dragright,open_dir:"left",close_dir:"right",delta:"deltaX",page:"pageX",negative:!0};break;case"top":var f={events:s.dragup+" "+s.dragdown,open_dir:"down",close_dir:"up",delta:"deltaY",page:"pageY",negative:!1};break;case"bottom":var f={events:s.dragup+" "+s.dragdown,open_dir:"up",close_dir:"down",delta:"deltaY",page:"pageY",negative:!0}}var u=this.__valueOrFn(r.pageNode,this.$menu,d.$page);"string"==typeof u&&(u=e(u));var m=d.$page.find("."+i.mm("fixed-top")+", ."+i.mm("fixed-bottom")),v=d.$page;switch(n.opts.zposition){case"back":v=v.add(m);break;case"front":v=n.$menu;break;case"next":v=v.add(n.$menu).add(m)}u.hammer().on(s.touchstart+" "+s.mousedown,function(e){if("touchstart"==e.type)var t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a=t[f.page];else if("mousedown"==e.type)var a=e[f.page];switch(n.opts.position){case"right":case"bottom":a>=d.$wndw[l]()-r.maxStartPos&&(p=1);break;default:a<=r.maxStartPos&&(p=1)}}).on(f.events+" "+s.dragend,function(e){p>0&&(e.gesture.preventDefault(),e.stopPropagation())}).on(f.events,function(e){var a=f.negative?-e.gesture[f.delta]:e.gesture[f.delta];if(g=a>c?f.open_dir:f.close_dir,c=a,c>r.threshold&&1==p){if(d.$html.hasClass(i.opened))return;p=2,n._openSetup(),d.$html.addClass(i.dragging),h=t(d.$wndw[l]()*n.conf[o][l].perc,n.conf[o][l].min,n.conf[o][l].max)}2==p&&v.css(n.opts.position,t(c,10,h)-("front"==n.opts.zposition?h:0))}).on(s.dragend,function(){2==p&&(d.$html.removeClass(i.dragging),v.css(n.opts.position,""),g==f.open_dir?n._openFinish():n.close()),p=0})}}},e[a].defaults[o]={open:!1,threshold:50},e[a].configuration[o]={width:{perc:.8,min:140,max:440},height:{perc:.8,min:140,max:880}},e[a].addons=e[a].addons||[],e[a].addons.push(o)}(jQuery);
|
||||
169
theme-old/js/addons/jquery.mmenu.header.js
Executable file
169
theme-old/js/addons/jquery.mmenu.header.js
Executable file
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* jQuery mmenu header addon
|
||||
* @requires mmenu 4.0.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var _PLUGIN_ = 'mmenu',
|
||||
_ADDON_ = 'header';
|
||||
|
||||
|
||||
$[ _PLUGIN_ ].prototype[ '_addon_' + _ADDON_ ] = function()
|
||||
{
|
||||
var that = this,
|
||||
opts = this.opts[ _ADDON_ ],
|
||||
conf = this.conf[ _ADDON_ ];
|
||||
|
||||
var _c = $[ _PLUGIN_ ]._c,
|
||||
_d = $[ _PLUGIN_ ]._d,
|
||||
_e = $[ _PLUGIN_ ]._e;
|
||||
|
||||
_c.add( 'header hasheader prev next title titletext' );
|
||||
_e.add( 'updateheader' );
|
||||
|
||||
var glbl = $[ _PLUGIN_ ].glbl;
|
||||
|
||||
|
||||
// Extend options
|
||||
if ( typeof opts == 'boolean' )
|
||||
{
|
||||
opts = {
|
||||
add : opts,
|
||||
update : opts
|
||||
};
|
||||
}
|
||||
if ( typeof opts != 'object' )
|
||||
{
|
||||
opts = {};
|
||||
}
|
||||
opts = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
|
||||
|
||||
|
||||
// Add the HTML
|
||||
if ( opts.add )
|
||||
{
|
||||
var content = opts.content
|
||||
? opts.content
|
||||
: '<a class="' + _c.prev + '" href="#"></a><span class="' + _c.title + '"></span><a class="' + _c.next + '" href="#"></a>';
|
||||
|
||||
$( '<div class="' + _c.header + '" />' )
|
||||
.prependTo( this.$menu )
|
||||
.append( content );
|
||||
}
|
||||
|
||||
var $header = $('div.' + _c.header, this.$menu);
|
||||
if ( $header.length )
|
||||
{
|
||||
this.$menu.addClass( _c.hasheader );
|
||||
}
|
||||
|
||||
if ( opts.update )
|
||||
{
|
||||
if ( $header.length )
|
||||
{
|
||||
var $titl = $header.find( '.' + _c.title ),
|
||||
$prev = $header.find( '.' + _c.prev ),
|
||||
$next = $header.find( '.' + _c.next ),
|
||||
_page = '#' + glbl.$page.attr( 'id' );
|
||||
|
||||
$prev.add( $next ).on( _e.click,
|
||||
function( e )
|
||||
{
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
var href = $(this).attr( 'href' );
|
||||
if ( href !== '#' )
|
||||
{
|
||||
if ( href == _page )
|
||||
{
|
||||
that.$menu.trigger( _e.close );
|
||||
}
|
||||
else
|
||||
{
|
||||
$(href, that.$menu).trigger( _e.open );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
$('.' + _c.panel, this.$menu)
|
||||
.each(
|
||||
function()
|
||||
{
|
||||
var $t = $(this);
|
||||
|
||||
// Find title, prev and next
|
||||
var titl = $('.' + conf.panelHeaderClass, $t).text(),
|
||||
prev = $('.' + conf.panelPrevClass, $t).attr( 'href' ),
|
||||
next = $('.' + conf.panelNextClass, $t).attr( 'href' );
|
||||
|
||||
if ( !titl )
|
||||
{
|
||||
titl = $('.' + _c.subclose, $t).text();
|
||||
}
|
||||
if ( !titl )
|
||||
{
|
||||
titl = opts.title;
|
||||
}
|
||||
if ( !prev )
|
||||
{
|
||||
prev = $('.' + _c.subclose, $t).attr( 'href' );
|
||||
}
|
||||
|
||||
// Update header info
|
||||
$t.off( _e.updateheader )
|
||||
.on( _e.updateheader,
|
||||
function( e )
|
||||
{
|
||||
e.stopPropagation();
|
||||
|
||||
$titl[ titl ? 'show' : 'hide' ]().text( titl );
|
||||
$prev[ prev ? 'show' : 'hide' ]().attr( 'href', prev );
|
||||
$next[ next ? 'show' : 'hide' ]().attr( 'href', next );
|
||||
}
|
||||
);
|
||||
|
||||
$t.on( _e.open,
|
||||
function( e )
|
||||
{
|
||||
$(this).trigger( _e.updateheader );
|
||||
}
|
||||
);
|
||||
}
|
||||
)
|
||||
.filter( '.' + _c.current )
|
||||
.trigger( _e.updateheader );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
|
||||
add : false,
|
||||
content : false,
|
||||
update : false,
|
||||
title : 'Menu',
|
||||
};
|
||||
$[ _PLUGIN_ ].configuration[ _ADDON_ ] = {
|
||||
panelHeaderClass : 'Header',
|
||||
panelNextClass : 'Next',
|
||||
panelPrevClass : 'Prev'
|
||||
}
|
||||
|
||||
|
||||
// Add to plugin
|
||||
$[ _PLUGIN_ ].addons = $[ _PLUGIN_ ].addons || [];
|
||||
$[ _PLUGIN_ ].addons.push( _ADDON_ );
|
||||
|
||||
})( jQuery );
|
||||
14
theme-old/js/addons/jquery.mmenu.header.min.js
vendored
Executable file
14
theme-old/js/addons/jquery.mmenu.header.min.js
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* jQuery mmenu header addon
|
||||
* @requires mmenu 4.0.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
!function(e){var t="mmenu",a="header";e[t].prototype["_addon_"+a]=function(){var n=this,r=this.opts[a],d=this.conf[a],s=e[t]._c,i=(e[t]._d,e[t]._e);s.add("header hasheader prev next title titletext"),i.add("updateheader");var o=e[t].glbl;if("boolean"==typeof r&&(r={add:r,update:r}),"object"!=typeof r&&(r={}),r=e.extend(!0,{},e[t].defaults[a],r),r.add){var h=r.content?r.content:'<a class="'+s.prev+'" href="#"></a><span class="'+s.title+'"></span><a class="'+s.next+'" href="#"></a>';e('<div class="'+s.header+'" />').prependTo(this.$menu).append(h)}var p=e("div."+s.header,this.$menu);if(p.length&&this.$menu.addClass(s.hasheader),r.update&&p.length){var l=p.find("."+s.title),u=p.find("."+s.prev),f=p.find("."+s.next),c="#"+o.$page.attr("id");u.add(f).on(i.click,function(t){t.preventDefault(),t.stopPropagation();var a=e(this).attr("href");"#"!==a&&(a==c?n.$menu.trigger(i.close):e(a,n.$menu).trigger(i.open))}),e("."+s.panel,this.$menu).each(function(){var t=e(this),a=e("."+d.panelHeaderClass,t).text(),n=e("."+d.panelPrevClass,t).attr("href"),o=e("."+d.panelNextClass,t).attr("href");a||(a=e("."+s.subclose,t).text()),a||(a=r.title),n||(n=e("."+s.subclose,t).attr("href")),t.off(i.updateheader).on(i.updateheader,function(e){e.stopPropagation(),l[a?"show":"hide"]().text(a),u[n?"show":"hide"]().attr("href",n),f[o?"show":"hide"]().attr("href",o)}),t.on(i.open,function(){e(this).trigger(i.updateheader)})}).filter("."+s.current).trigger(i.updateheader)}},e[t].defaults[a]={add:!1,content:!1,update:!1,title:"Menu"},e[t].configuration[a]={panelHeaderClass:"Header",panelNextClass:"Next",panelPrevClass:"Prev"},e[t].addons=e[t].addons||[],e[t].addons.push(a)}(jQuery);
|
||||
252
theme-old/js/addons/jquery.mmenu.labels.js
Executable file
252
theme-old/js/addons/jquery.mmenu.labels.js
Executable file
@@ -0,0 +1,252 @@
|
||||
/*
|
||||
* jQuery mmenu labels addon
|
||||
* @requires mmenu 4.1.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var _PLUGIN_ = 'mmenu',
|
||||
_ADDON_ = 'labels';
|
||||
|
||||
|
||||
$[ _PLUGIN_ ].prototype[ '_addon_' + _ADDON_ ] = function()
|
||||
{
|
||||
var that = this,
|
||||
opts = this.opts[ _ADDON_ ];
|
||||
|
||||
var _c = $[ _PLUGIN_ ]._c,
|
||||
_d = $[ _PLUGIN_ ]._d,
|
||||
_e = $[ _PLUGIN_ ]._e;
|
||||
|
||||
_c.add( 'collapsed' );
|
||||
|
||||
_c.add( 'fixedlabels original clone' );
|
||||
_e.add( 'updatelabels position scroll' );
|
||||
if ( $[ _PLUGIN_ ].support.touch )
|
||||
{
|
||||
_e.scroll += ' ' + _e.mm( 'touchmove' );
|
||||
}
|
||||
|
||||
|
||||
// Extend options
|
||||
if ( typeof opts == 'boolean' )
|
||||
{
|
||||
opts = {
|
||||
collapse: opts
|
||||
};
|
||||
}
|
||||
if ( typeof opts != 'object' )
|
||||
{
|
||||
opts = {};
|
||||
}
|
||||
opts = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
|
||||
|
||||
|
||||
// Toggle collapsed labels
|
||||
if ( opts.collapse )
|
||||
{
|
||||
|
||||
// Refactor collapsed class
|
||||
this.__refactorClass( $('li.' + this.conf.collapsedClass, this.$menu), 'collapsed' );
|
||||
|
||||
var $labels = $('.' + _c.label, this.$menu);
|
||||
|
||||
$labels
|
||||
.each(
|
||||
function()
|
||||
{
|
||||
var $label = $(this),
|
||||
$expan = $label.nextUntil( '.' + _c.label, ( opts.collapse == 'all' ) ? null : '.' + _c.collapsed );
|
||||
|
||||
if ( opts.collapse == 'all' )
|
||||
{
|
||||
$label.addClass( _c.opened );
|
||||
$expan.removeClass( _c.collapsed );
|
||||
}
|
||||
|
||||
if ( $expan.length )
|
||||
{
|
||||
$label.wrapInner( '<span />' );
|
||||
|
||||
$('<a href="#" class="' + _c.subopen + ' ' + _c.fullsubopen + '" />')
|
||||
.prependTo( $label )
|
||||
.on(
|
||||
_e.click,
|
||||
function( e )
|
||||
{
|
||||
e.preventDefault();
|
||||
|
||||
$label.toggleClass( _c.opened );
|
||||
$expan[ $label.hasClass( _c.opened ) ? 'removeClass' : 'addClass' ]( _c.collapsed );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Fixed labels
|
||||
else if ( opts.fixed )
|
||||
{
|
||||
if ( this.direction != 'horizontal' )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.$menu.addClass( _c.fixedlabels );
|
||||
|
||||
var $panels = $('.' + _c.panel, this.$menu),
|
||||
$labels = $('.' + _c.label, this.$menu);
|
||||
|
||||
$panels.add( $labels )
|
||||
.off( _e.updatelabels + ' ' + _e.position + ' ' + _e.scroll )
|
||||
.on( _e.updatelabels + ' ' + _e.position + ' ' + _e.scroll,
|
||||
function( e )
|
||||
{
|
||||
e.stopPropagation();
|
||||
}
|
||||
);
|
||||
|
||||
var offset = getPanelsOffset();
|
||||
|
||||
$panels.each(
|
||||
function()
|
||||
{
|
||||
var $panel = $(this),
|
||||
$labels = $panel.find( '.' + _c.label );
|
||||
|
||||
if ( $labels.length )
|
||||
{
|
||||
var scrollTop = $panel.scrollTop();
|
||||
|
||||
$labels.each(
|
||||
function()
|
||||
{
|
||||
var $label = $(this);
|
||||
|
||||
// Add extra markup
|
||||
$label
|
||||
.wrapInner( '<div />' )
|
||||
.wrapInner( '<div />' );
|
||||
|
||||
var $inner = $label.find( '> div' ),
|
||||
$next = $();
|
||||
|
||||
var top, bottom, height;
|
||||
|
||||
// Update appearences
|
||||
$label
|
||||
.on( _e.updatelabels,
|
||||
function( e )
|
||||
{
|
||||
scrollTop = $panel.scrollTop();
|
||||
|
||||
if ( !$label.hasClass( _c.hidden ) )
|
||||
{
|
||||
$next = $label.nextAll( '.' + _c.label ).not( '.' + _c.hidden ).first();
|
||||
top = $label.offset().top + scrollTop;
|
||||
bottom = $next.length ? $next.offset().top + scrollTop : false;
|
||||
height = $inner.height();
|
||||
|
||||
$label.trigger( _e.position );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Set position
|
||||
$label
|
||||
.on( _e.position,
|
||||
function( e )
|
||||
{
|
||||
var _top = 0;
|
||||
if ( bottom && scrollTop + offset > bottom - height )
|
||||
{
|
||||
_top = bottom - top - height;
|
||||
}
|
||||
else if ( scrollTop + offset > top )
|
||||
{
|
||||
_top = scrollTop - top + offset;
|
||||
}
|
||||
$inner.css( 'top', _top );
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
// Bind update and scrolling events
|
||||
$panel
|
||||
.on( _e.updatelabels,
|
||||
function( e )
|
||||
{
|
||||
scrollTop = $panel.scrollTop();
|
||||
offset = getPanelsOffset();
|
||||
$labels.trigger( _e.position );
|
||||
}
|
||||
)
|
||||
.on( _e.scroll,
|
||||
function( e )
|
||||
{
|
||||
$labels.trigger( _e.updatelabels );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Update with menu-update
|
||||
this.$menu
|
||||
.on( _e.update,
|
||||
function( e )
|
||||
{
|
||||
$panels
|
||||
.trigger( _e.updatelabels );
|
||||
}
|
||||
)
|
||||
.on( _e.opening,
|
||||
function( e )
|
||||
{
|
||||
$panels
|
||||
.trigger( _e.updatelabels )
|
||||
.trigger( _e.scroll );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function getPanelsOffset()
|
||||
{
|
||||
var hassearch = _c.hassearch && that.$menu.hasClass( _c.hassearch ),
|
||||
hasheader = _c.hasheader && that.$menu.hasClass( _c.hasheader );
|
||||
|
||||
return hassearch
|
||||
? hasheader
|
||||
? 100
|
||||
: 50
|
||||
: hasheader
|
||||
? 60
|
||||
: 0;
|
||||
}
|
||||
};
|
||||
|
||||
$[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
|
||||
fixed : false,
|
||||
collapse : false
|
||||
};
|
||||
$[ _PLUGIN_ ].configuration.collapsedClass = 'Collapsed';
|
||||
|
||||
|
||||
// Add to plugin
|
||||
$[ _PLUGIN_ ].addons = $[ _PLUGIN_ ].addons || [];
|
||||
$[ _PLUGIN_ ].addons.push( _ADDON_ );
|
||||
|
||||
|
||||
})( jQuery );
|
||||
14
theme-old/js/addons/jquery.mmenu.labels.min.js
vendored
Executable file
14
theme-old/js/addons/jquery.mmenu.labels.min.js
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* jQuery mmenu labels addon
|
||||
* @requires mmenu 4.1.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
!function(e){var l="mmenu",s="labels";e[l].prototype["_addon_"+s]=function(){function a(){var e=t.hassearch&&o.$menu.hasClass(t.hassearch),l=t.hasheader&&o.$menu.hasClass(t.hasheader);return e?l?100:50:l?60:0}var o=this,n=this.opts[s],t=e[l]._c,i=(e[l]._d,e[l]._e);if(t.add("collapsed"),t.add("fixedlabels original clone"),i.add("updatelabels position scroll"),e[l].support.touch&&(i.scroll+=" "+i.mm("touchmove")),"boolean"==typeof n&&(n={collapse:n}),"object"!=typeof n&&(n={}),n=e.extend(!0,{},e[l].defaults[s],n),n.collapse){this.__refactorClass(e("li."+this.conf.collapsedClass,this.$menu),"collapsed");var d=e("."+t.label,this.$menu);d.each(function(){var l=e(this),s=l.nextUntil("."+t.label,"all"==n.collapse?null:"."+t.collapsed);"all"==n.collapse&&(l.addClass(t.opened),s.removeClass(t.collapsed)),s.length&&(l.wrapInner("<span />"),e('<a href="#" class="'+t.subopen+" "+t.fullsubopen+'" />').prependTo(l).on(i.click,function(e){e.preventDefault(),l.toggleClass(t.opened),s[l.hasClass(t.opened)?"removeClass":"addClass"](t.collapsed)}))})}else if(n.fixed){if("horizontal"!=this.direction)return;this.$menu.addClass(t.fixedlabels);var r=e("."+t.panel,this.$menu),d=e("."+t.label,this.$menu);r.add(d).off(i.updatelabels+" "+i.position+" "+i.scroll).on(i.updatelabels+" "+i.position+" "+i.scroll,function(e){e.stopPropagation()});var p=a();r.each(function(){var l=e(this),s=l.find("."+t.label);if(s.length){var o=l.scrollTop();s.each(function(){var s=e(this);s.wrapInner("<div />").wrapInner("<div />");var a,n,d,r=s.find("> div"),c=e();s.on(i.updatelabels,function(){o=l.scrollTop(),s.hasClass(t.hidden)||(c=s.nextAll("."+t.label).not("."+t.hidden).first(),a=s.offset().top+o,n=c.length?c.offset().top+o:!1,d=r.height(),s.trigger(i.position))}),s.on(i.position,function(){var e=0;n&&o+p>n-d?e=n-a-d:o+p>a&&(e=o-a+p),r.css("top",e)})}),l.on(i.updatelabels,function(){o=l.scrollTop(),p=a(),s.trigger(i.position)}).on(i.scroll,function(){s.trigger(i.updatelabels)})}}),this.$menu.on(i.update,function(){r.trigger(i.updatelabels)}).on(i.opening,function(){r.trigger(i.updatelabels).trigger(i.scroll)})}},e[l].defaults[s]={fixed:!1,collapse:!1},e[l].configuration.collapsedClass="Collapsed",e[l].addons=e[l].addons||[],e[l].addons.push(s)}(jQuery);
|
||||
229
theme-old/js/addons/jquery.mmenu.searchfield.js
Executable file
229
theme-old/js/addons/jquery.mmenu.searchfield.js
Executable file
@@ -0,0 +1,229 @@
|
||||
/*
|
||||
* jQuery mmenu searchfield addon
|
||||
* @requires mmenu 4.0.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var _PLUGIN_ = 'mmenu',
|
||||
_ADDON_ = 'searchfield';
|
||||
|
||||
|
||||
$[ _PLUGIN_ ].prototype[ '_addon_' + _ADDON_ ] = function()
|
||||
{
|
||||
var that = this,
|
||||
opts = this.opts[ _ADDON_ ];
|
||||
|
||||
var _c = $[ _PLUGIN_ ]._c,
|
||||
_d = $[ _PLUGIN_ ]._d,
|
||||
_e = $[ _PLUGIN_ ]._e;
|
||||
|
||||
_c.add( 'search hassearch noresults nosubresults counter' );
|
||||
_e.add( 'search reset change' );
|
||||
|
||||
|
||||
// Extend options
|
||||
if ( typeof opts == 'boolean' )
|
||||
{
|
||||
opts = {
|
||||
add : opts,
|
||||
search : opts
|
||||
};
|
||||
}
|
||||
if ( typeof opts != 'object' )
|
||||
{
|
||||
opts = {};
|
||||
}
|
||||
opts = $.extend( true, {}, $[ _PLUGIN_ ].defaults[ _ADDON_ ], opts );
|
||||
|
||||
|
||||
// Add the field
|
||||
if ( opts.add )
|
||||
{
|
||||
$( '<div class="' + _c.search + '" />' )
|
||||
.prependTo( this.$menu )
|
||||
.append( '<input placeholder="' + opts.placeholder + '" type="text" autocomplete="off" />' );
|
||||
|
||||
if ( opts.noResults )
|
||||
{
|
||||
$('ul, ol', this.$menu)
|
||||
.first()
|
||||
.append( '<li class="' + _c.noresults + '">' + opts.noResults + '</li>' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $('div.' + _c.search, this.$menu).length )
|
||||
{
|
||||
this.$menu.addClass( _c.hassearch );
|
||||
}
|
||||
|
||||
// Bind custom events
|
||||
if ( opts.search )
|
||||
{
|
||||
var $input = $('div.' + _c.search, this.$menu).find( 'input' );
|
||||
if ( $input.length )
|
||||
{
|
||||
var $panels = $('.' + _c.panel, this.$menu),
|
||||
$labels = $('.' + _c.list + '> li.' + _c.label, this.$menu),
|
||||
$items = $('.' + _c.list + '> li', this.$menu)
|
||||
.not( '.' + _c.subtitle )
|
||||
.not( '.' + _c.label )
|
||||
.not( '.' + _c.noresults );
|
||||
|
||||
var _searchText = '> a';
|
||||
if ( !opts.showLinksOnly )
|
||||
{
|
||||
_searchText += ', > span';
|
||||
}
|
||||
|
||||
$input
|
||||
.off( _e.keyup + ' ' + _e.change )
|
||||
.on( _e.keyup,
|
||||
function( e )
|
||||
{
|
||||
if ( !preventKeypressSearch( e.keyCode ) )
|
||||
{
|
||||
that.$menu.trigger( _e.search );
|
||||
}
|
||||
}
|
||||
)
|
||||
.on( _e.change,
|
||||
function( e )
|
||||
{
|
||||
that.$menu.trigger( _e.search );
|
||||
}
|
||||
);
|
||||
|
||||
this.$menu
|
||||
.off( _e.reset + ' ' + _e.search )
|
||||
.on( _e.reset + ' ' + _e.search,
|
||||
function( e )
|
||||
{
|
||||
e.stopPropagation();
|
||||
}
|
||||
)
|
||||
.on( _e.reset,
|
||||
function( e )
|
||||
{
|
||||
that.$menu.trigger( _e.search, [ '' ] );
|
||||
}
|
||||
)
|
||||
.on( _e.search,
|
||||
function( e, query )
|
||||
{
|
||||
if ( typeof query == 'string' )
|
||||
{
|
||||
$input.val( query );
|
||||
}
|
||||
else
|
||||
{
|
||||
query = $input.val();
|
||||
}
|
||||
query = query.toLowerCase();
|
||||
|
||||
// Scroll to top
|
||||
$panels.scrollTop( 0 );
|
||||
|
||||
// Search through items
|
||||
$items
|
||||
.add( $labels )
|
||||
.addClass( _c.hidden );
|
||||
|
||||
$items
|
||||
.each(
|
||||
function()
|
||||
{
|
||||
var $t = $(this);
|
||||
if ( $(_searchText, $t).text().toLowerCase().indexOf( query ) > -1 )
|
||||
{
|
||||
$t.add( $t.prevAll( '.' + _c.label ).first() ).removeClass( _c.hidden );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Update parent for submenus
|
||||
$( $panels.get().reverse() ).each(
|
||||
function()
|
||||
{
|
||||
var $t = $(this),
|
||||
$p = $t.data( _d.parent );
|
||||
|
||||
if ( $p )
|
||||
{
|
||||
var $i = $t.add( $t.find( '> .' + _c.list ) ).find( '> li' )
|
||||
.not( '.' + _c.subtitle )
|
||||
.not( '.' + _c.label )
|
||||
.not( '.' + _c.hidden );
|
||||
|
||||
if ( $i.length )
|
||||
{
|
||||
$p.removeClass( _c.hidden )
|
||||
.removeClass( _c.nosubresults )
|
||||
.prevAll( '.' + _c.label ).first().removeClass( _c.hidden );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $t.hasClass( _c.current ) )
|
||||
{
|
||||
$p.trigger( _e.open );
|
||||
}
|
||||
$p.addClass( _c.nosubresults );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Show/hide no results message
|
||||
that.$menu[ $items.not( '.' + _c.hidden ).length ? 'removeClass' : 'addClass' ]( _c.noresults );
|
||||
|
||||
// Update for other addons
|
||||
that.$menu.trigger( _e.update );
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$[ _PLUGIN_ ].defaults[ _ADDON_ ] = {
|
||||
add : false,
|
||||
search : false,
|
||||
showLinksOnly : true,
|
||||
placeholder : 'Search',
|
||||
noResults : 'No results found.'
|
||||
};
|
||||
|
||||
|
||||
// Add to plugin
|
||||
$[ _PLUGIN_ ].addons = $[ _PLUGIN_ ].addons || [];
|
||||
$[ _PLUGIN_ ].addons.push( _ADDON_ );
|
||||
|
||||
|
||||
// Functions
|
||||
function preventKeypressSearch( c )
|
||||
{
|
||||
switch( c )
|
||||
{
|
||||
case 9: // tab
|
||||
case 16: // shift
|
||||
case 17: // control
|
||||
case 18: // alt
|
||||
case 37: // left
|
||||
case 38: // top
|
||||
case 39: // right
|
||||
case 40: // bottom
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
14
theme-old/js/addons/jquery.mmenu.searchfield.min.js
vendored
Executable file
14
theme-old/js/addons/jquery.mmenu.searchfield.min.js
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* jQuery mmenu searchfield addon
|
||||
* @requires mmenu 4.0.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
!function(e){function s(e){switch(e){case 9:case 16:case 17:case 18:case 37:case 38:case 39:case 40:return!0}return!1}var n="mmenu",t="searchfield";e[n].prototype["_addon_"+t]=function(){var a=this,r=this.opts[t],o=e[n]._c,l=e[n]._d,d=e[n]._e;if(o.add("search hassearch noresults nosubresults counter"),d.add("search reset change"),"boolean"==typeof r&&(r={add:r,search:r}),"object"!=typeof r&&(r={}),r=e.extend(!0,{},e[n].defaults[t],r),r.add&&(e('<div class="'+o.search+'" />').prependTo(this.$menu).append('<input placeholder="'+r.placeholder+'" type="text" autocomplete="off" />'),r.noResults&&e("ul, ol",this.$menu).first().append('<li class="'+o.noresults+'">'+r.noResults+"</li>")),e("div."+o.search,this.$menu).length&&this.$menu.addClass(o.hassearch),r.search){var i=e("div."+o.search,this.$menu).find("input");if(i.length){var u=e("."+o.panel,this.$menu),h=e("."+o.list+"> li."+o.label,this.$menu),c=e("."+o.list+"> li",this.$menu).not("."+o.subtitle).not("."+o.label).not("."+o.noresults),f="> a";r.showLinksOnly||(f+=", > span"),i.off(d.keyup+" "+d.change).on(d.keyup,function(e){s(e.keyCode)||a.$menu.trigger(d.search)}).on(d.change,function(){a.$menu.trigger(d.search)}),this.$menu.off(d.reset+" "+d.search).on(d.reset+" "+d.search,function(e){e.stopPropagation()}).on(d.reset,function(){a.$menu.trigger(d.search,[""])}).on(d.search,function(s,n){"string"==typeof n?i.val(n):n=i.val(),n=n.toLowerCase(),u.scrollTop(0),c.add(h).addClass(o.hidden),c.each(function(){var s=e(this);e(f,s).text().toLowerCase().indexOf(n)>-1&&s.add(s.prevAll("."+o.label).first()).removeClass(o.hidden)}),e(u.get().reverse()).each(function(){var s=e(this),n=s.data(l.parent);if(n){var t=s.add(s.find("> ."+o.list)).find("> li").not("."+o.subtitle).not("."+o.label).not("."+o.hidden);t.length?n.removeClass(o.hidden).removeClass(o.nosubresults).prevAll("."+o.label).first().removeClass(o.hidden):(s.hasClass(o.current)&&n.trigger(d.open),n.addClass(o.nosubresults))}}),a.$menu[c.not("."+o.hidden).length?"removeClass":"addClass"](o.noresults),a.$menu.trigger(d.update)})}}},e[n].defaults[t]={add:!1,search:!1,showLinksOnly:!0,placeholder:"Search",noResults:"No results found."},e[n].addons=e[n].addons||[],e[n].addons.push(t)}(jQuery);
|
||||
193
theme-old/js/dynfields/array.js
Normal file
193
theme-old/js/dynfields/array.js
Normal file
@@ -0,0 +1,193 @@
|
||||
(function($){
|
||||
String.prototype.capitalize = function() {
|
||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
};
|
||||
|
||||
var GROUP = -1;
|
||||
|
||||
var DynFields2 = {
|
||||
init: function () {
|
||||
var container = $('[data-grav-array]'), blockParent, options;
|
||||
DynFields2.container = container;
|
||||
container.parent().on('click', '[data-grav-addfield]', DynFields2.addField.bind(DynFields2));
|
||||
container.on('click', '[data-grav-remfield]', DynFields2.remField.bind(DynFields2));
|
||||
|
||||
$.each(DynFields2.container, function(index, block){
|
||||
block = $(block);
|
||||
blockParent = $(block.parents('.grav-array'));
|
||||
options = DynFields2.getOptions(block);
|
||||
|
||||
if (options && options.sortable_root){
|
||||
blockParent.nestable({
|
||||
rootClass: 'grav-array',
|
||||
handleClass: 'dd-root-handle',
|
||||
maxDepth: 1,
|
||||
expandBtnHTML: false,
|
||||
collapseBtnHTML: false,
|
||||
group: ++GROUP
|
||||
});
|
||||
|
||||
blockParent.on('change', function(){
|
||||
DynFields2.updateNames(block);
|
||||
});
|
||||
} else {
|
||||
block.find('.dd-root-handle').remove();
|
||||
}
|
||||
|
||||
|
||||
if (options && options.sortable_children){
|
||||
$.each(block.find('.dd3-content'), function(index, content){
|
||||
DynFields2.makeSortable(content);
|
||||
});
|
||||
} else {
|
||||
block.find('.dd3-content .dd-grav-handle').remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getOptions: function(container){
|
||||
var data = container.data('grav-array'),
|
||||
options;
|
||||
|
||||
$.each(data, function(name, values){
|
||||
options = values.options;
|
||||
});
|
||||
|
||||
return options;
|
||||
},
|
||||
|
||||
getSchema: function(container){
|
||||
var data = container.data('grav-array'),
|
||||
schema;
|
||||
|
||||
$.each(data, function(name, values){
|
||||
schema = values.schema;
|
||||
});
|
||||
|
||||
return schema;
|
||||
},
|
||||
|
||||
addField: function(event){
|
||||
var element = $(event.target),
|
||||
location = 'insertAfter',
|
||||
container = element.parents('[data-grav-array]'),
|
||||
parents = element.parents('li');
|
||||
|
||||
if (!container.length) {
|
||||
container = element.next('[data-grav-array]');
|
||||
location = 'appendTo';
|
||||
}
|
||||
if (!parents.length) parents = container.last();
|
||||
|
||||
var schema = DynFields2.buildSchema(container),
|
||||
li = $('<li class="dd-item dd3-item" />').html(schema)[location](parents);
|
||||
|
||||
DynFields2.updateNames(container);
|
||||
DynFields2.makeSortable(li.find('.dd3-content'));
|
||||
},
|
||||
|
||||
remField: function(event){
|
||||
var element = $(event.target),
|
||||
container = element.parents('[data-grav-array]');
|
||||
|
||||
element.parents('li').remove();
|
||||
|
||||
DynFields2.updateNames(container);
|
||||
},
|
||||
|
||||
updateNames: function(container){
|
||||
var items, name;
|
||||
|
||||
$.each(container.children(), function(index, item){
|
||||
items = $(item).find('[name]');
|
||||
|
||||
$.each(items, function(key, input){
|
||||
input = $(input);
|
||||
input.attr('name', input.attr('name').replace(/\[\w\]/, '[' + index + ']'));
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
makeSortable: function(context){
|
||||
context = $(context);
|
||||
context.nestable({
|
||||
maxDepth: 1,
|
||||
expandBtnHTML: false,
|
||||
collapseBtnHTML: false,
|
||||
listClass: 'dd-grav-list',
|
||||
itemClass: 'dd-grav-item',
|
||||
rootClass: 'dd3-content',
|
||||
handleClass: 'dd-grav-handle',
|
||||
group: ++GROUP
|
||||
});
|
||||
|
||||
context.on('change', function(){
|
||||
DynFields2.updateNames(context.parents('[data-grav-array]'));
|
||||
});
|
||||
},
|
||||
|
||||
buildSchema: function(container){
|
||||
var data = container.data('grav-array'),
|
||||
options = DynFields2.getOptions(container),
|
||||
html = [],
|
||||
input = '',
|
||||
inputName = '',
|
||||
index;
|
||||
|
||||
if (options && options.sortable_root) html.push(' <div class="dd-handle dd3-handle dd-root-handle"></div>');
|
||||
html.push(' <div class="dd-grav-actions">');
|
||||
html.push(' <span data-grav-remfield class="button fa fa-minus"></span>');
|
||||
html.push(' <span data-grav-addfield class="button fa fa-plus"></span></span>');
|
||||
html.push(' </div>');
|
||||
html.push(' <ol class="dd3-content dd-grav-list">');
|
||||
|
||||
$.each(DynFields2.getSchema(container), function(key, value){
|
||||
html.push('<li class="dd-grav-item">');
|
||||
if (options && options.sortable_children) html.push(' <div class="dd-handle dd3-handle dd-grav-handle"></div>');
|
||||
html.push(' <span class="label">' + (value.label || key.capitalize()) + '</span>');
|
||||
|
||||
inputName = name + '[X]' + '[' + key + ']';
|
||||
switch(value.type || 'input'){
|
||||
case 'text': case 'hidden':
|
||||
input = '<input type="' + (value.type || 'input') + '" placeholder="' + (value.placeholder || '') + '" name="' + inputName + '" />';
|
||||
break;
|
||||
|
||||
case 'textarea':
|
||||
input = '<textarea placeholder="' + (value.placeholder || '') + '" name="' + inputName + '"></textarea>';
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
input = '<select name="' + inputName + '">';
|
||||
$.each(value.options || [], function(sValue, sLabel){
|
||||
input += '<option value="' + sValue + '">' + sLabel + '</option>';
|
||||
});
|
||||
input += '</select>';
|
||||
break;
|
||||
|
||||
case 'radio':
|
||||
input = '';
|
||||
index = 0;
|
||||
$.each(value.options || [], function(sValue, sLabel){
|
||||
input += '<label>';
|
||||
input += ' <input type="' + value.type + '" name="' + inputName + '" value="' + sValue + '" ' + (!index ? 'checked' : '') + '/> ';
|
||||
input += sLabel;
|
||||
input += '</label> ';
|
||||
index++;
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
html.push(input);
|
||||
html.push('</li>');
|
||||
});
|
||||
|
||||
html.push(' </ol>');
|
||||
|
||||
return html.join("\n");
|
||||
}
|
||||
};
|
||||
|
||||
$(DynFields2.init);
|
||||
|
||||
})(jQuery);
|
||||
36
theme-old/js/dynfields/dynfields.js
Normal file
36
theme-old/js/dynfields/dynfields.js
Normal file
@@ -0,0 +1,36 @@
|
||||
(function($){
|
||||
|
||||
var DynFields = {
|
||||
init: function () {
|
||||
var container = $('[data-grav-dynfields]');
|
||||
DynFields.container = container;
|
||||
container.on('click', '[data-grav-addfield]', DynFields.addField.bind(DynFields));
|
||||
container.on('click', '[data-grav-remfield]', DynFields.remField.bind(DynFields));
|
||||
container.on('keyup', 'input:not([name])', DynFields.updateFields.bind(DynFields));
|
||||
},
|
||||
addField: function (event, element) {
|
||||
element = $(event.target);
|
||||
var div = $('<div />').html(this.layout());
|
||||
div.insertAfter(element.parent('div'));
|
||||
},
|
||||
remField: function (event, element) {
|
||||
element = $(event.target);
|
||||
element.parent('div').remove();
|
||||
},
|
||||
updateFields: function (event, element) {
|
||||
element = $(event.target);
|
||||
var sibling = element.next();
|
||||
sibling.attr('name', this.getName() + '[' + element.val() + ']');
|
||||
},
|
||||
getName: function () {
|
||||
return this.container.data('grav-dynfields') || 'generic';
|
||||
},
|
||||
layout: function () {
|
||||
var name = this.getName();
|
||||
return '' + ' <input type="text" value="" placeholder="/Your/Alias" />' + ' <input type="text" name="' + name + '[]" value="" placeholder="/Your/Real/Route" />' + ' <span data-grav-remfield class="button fa fa-minus"></span> <span data-grav-addfield class="button fa fa-plus"></span>' + '';
|
||||
}
|
||||
};
|
||||
|
||||
$(DynFields.init);
|
||||
|
||||
})(jQuery);
|
||||
1
theme-old/js/dynfields/dynfields.min.js
vendored
Normal file
1
theme-old/js/dynfields/dynfields.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
(function(e){var t={init:function(){var n=e("[data-grav-dynfields]");t.container=n;n.on("click","[data-grav-addfield]",t.addField.bind(t));n.on("click","[data-grav-remfield]",t.remField.bind(t));n.on("keyup","input:not([name])",t.updateFields.bind(t))},addField:function(t,n){n=e(t.target);var r=e("<div />").html(this.layout());r.insertAfter(n.parent("div"))},remField:function(t,n){n=e(t.target);n.parent("div").remove()},updateFields:function(t,n){n=e(t.target);var r=n.next();r.attr("name",this.getName()+"["+n.val()+"]")},getName:function(){return this.container.data("grav-dynfields")||"generic"},layout:function(){var e=this.getName();return""+' <input type="text" value="" placeholder="/Your/Alias" />'+' <input type="text" name="'+e+'[]" value="" placeholder="/Your/Real/Route" />'+" <span data-grav-remfield>[ - ]</span> <span data-grav-addfield>[ + ]</span>"+""}};e(t.init)})(jQuery);
|
||||
4
theme-old/js/jquery-2.1.0.min.js
vendored
Normal file
4
theme-old/js/jquery-2.1.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
theme-old/js/jquery.astooltip.min.js
vendored
Normal file
1
theme-old/js/jquery.astooltip.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
976
theme-old/js/jquery.mmenu.js
Executable file
976
theme-old/js/jquery.mmenu.js
Executable file
@@ -0,0 +1,976 @@
|
||||
/*
|
||||
* jQuery mmenu v4.2.3
|
||||
* @requires jQuery 1.7.0 or later
|
||||
*
|
||||
* mmenu.frebsite.nl
|
||||
*
|
||||
* Copyright (c) Fred Heusschen
|
||||
* www.frebsite.nl
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
* http://en.wikipedia.org/wiki/MIT_License
|
||||
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
||||
*/
|
||||
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
var _PLUGIN_ = 'mmenu',
|
||||
_VERSION_ = '4.2.3';
|
||||
|
||||
|
||||
// Plugin already excists
|
||||
if ( $[ _PLUGIN_ ] )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Global variables
|
||||
var glbl = {
|
||||
$wndw: null,
|
||||
$html: null,
|
||||
$body: null,
|
||||
$page: null,
|
||||
$blck: null,
|
||||
|
||||
$allMenus: null
|
||||
};
|
||||
|
||||
var _c = {}, _d = {}, _e = {},
|
||||
_serialnr = 0,
|
||||
_strollTop = 0;
|
||||
|
||||
|
||||
$[ _PLUGIN_ ] = function( $menu, opts, conf )
|
||||
{
|
||||
glbl.$allMenus = glbl.$allMenus.add( $menu );
|
||||
|
||||
this.$menu = $menu;
|
||||
this.opts = opts
|
||||
this.conf = conf;
|
||||
|
||||
this.serialnr = _serialnr++;
|
||||
|
||||
this._init();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
$[ _PLUGIN_ ].prototype = {
|
||||
|
||||
open: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
this._openSetup();
|
||||
|
||||
// For some reason, some browsers need a (pretty long) delay before the .mm-opened class sets the needed styles
|
||||
// Without it, the page isn't animated
|
||||
setTimeout(
|
||||
function()
|
||||
{
|
||||
that._openFinish();
|
||||
}, 50
|
||||
);
|
||||
|
||||
return 'open';
|
||||
},
|
||||
_openSetup: function()
|
||||
{
|
||||
_strollTop = glbl.$wndw.scrollTop();
|
||||
|
||||
// Set opened
|
||||
this.$menu.addClass( _c.current );
|
||||
|
||||
// Close others
|
||||
glbl.$allMenus.not( this.$menu ).trigger( _e.close );
|
||||
|
||||
// Store style and position
|
||||
glbl.$page.data( _d.style, glbl.$page.attr( 'style' ) || '' );
|
||||
|
||||
// Trigger window-resize to measure height
|
||||
glbl.$wndw.trigger( _e.resize, [ true ] );
|
||||
|
||||
// Add options
|
||||
if ( this.opts.modal )
|
||||
{
|
||||
glbl.$html.addClass( _c.modal );
|
||||
}
|
||||
if ( this.opts.moveBackground )
|
||||
{
|
||||
glbl.$html.addClass( _c.background );
|
||||
}
|
||||
if ( this.opts.position != 'left' )
|
||||
{
|
||||
glbl.$html.addClass( _c.mm( this.opts.position ) );
|
||||
}
|
||||
if ( this.opts.zposition != 'back' )
|
||||
{
|
||||
glbl.$html.addClass( _c.mm( this.opts.zposition ) );
|
||||
}
|
||||
if ( this.opts.classes )
|
||||
{
|
||||
glbl.$html.addClass( this.opts.classes );
|
||||
}
|
||||
|
||||
// Open
|
||||
glbl.$html.addClass( _c.opened );
|
||||
this.$menu.addClass( _c.opened );
|
||||
},
|
||||
_openFinish: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
// Callback
|
||||
transitionend( glbl.$page,
|
||||
function()
|
||||
{
|
||||
that.$menu.trigger( _e.opened );
|
||||
}, this.conf.transitionDuration
|
||||
);
|
||||
|
||||
// Opening
|
||||
glbl.$html.addClass( _c.opening );
|
||||
this.$menu.trigger( _e.opening );
|
||||
},
|
||||
close: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
// Callback
|
||||
transitionend( glbl.$page,
|
||||
function()
|
||||
{
|
||||
that.$menu
|
||||
.removeClass( _c.current )
|
||||
.removeClass( _c.opened );
|
||||
|
||||
glbl.$html
|
||||
.removeClass( _c.opened )
|
||||
.removeClass( _c.modal )
|
||||
.removeClass( _c.background )
|
||||
.removeClass( _c.mm( that.opts.position ) )
|
||||
.removeClass( _c.mm( that.opts.zposition ) );
|
||||
|
||||
if ( that.opts.classes )
|
||||
{
|
||||
glbl.$html.removeClass( that.opts.classes );
|
||||
}
|
||||
|
||||
// Restore style and position
|
||||
glbl.$page.attr( 'style', glbl.$page.data( _d.style ) );
|
||||
|
||||
// Closed
|
||||
that.$menu.trigger( _e.closed );
|
||||
|
||||
}, this.conf.transitionDuration
|
||||
);
|
||||
|
||||
// Closing
|
||||
glbl.$html.removeClass( _c.opening );
|
||||
this.$menu.trigger( _e.closing );
|
||||
|
||||
return 'close';
|
||||
},
|
||||
|
||||
_init: function()
|
||||
{
|
||||
this.opts = extendOptions( this.opts, this.conf, this.$menu );
|
||||
this.direction = ( this.opts.slidingSubmenus ) ? 'horizontal' : 'vertical';
|
||||
|
||||
// INIT PAGE & MENU
|
||||
this._initPage( glbl.$page );
|
||||
this._initMenu();
|
||||
this._initBlocker();
|
||||
this._initPanles();
|
||||
this._initLinks();
|
||||
this._initOpenClose();
|
||||
this._bindCustomEvents();
|
||||
|
||||
if ( $[ _PLUGIN_ ].addons )
|
||||
{
|
||||
for ( var a = 0; a < $[ _PLUGIN_ ].addons.length; a++ )
|
||||
{
|
||||
if ( typeof this[ '_addon_' + $[ _PLUGIN_ ].addons[ a ] ] == 'function' )
|
||||
{
|
||||
this[ '_addon_' + $[ _PLUGIN_ ].addons[ a ] ]();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_bindCustomEvents: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
this.$menu
|
||||
.off( _e.open + ' ' + _e.close + ' ' + _e.setPage+ ' ' + _e.update )
|
||||
.on( _e.open + ' ' + _e.close + ' ' + _e.setPage+ ' ' + _e.update,
|
||||
function( e )
|
||||
{
|
||||
e.stopPropagation();
|
||||
}
|
||||
);
|
||||
|
||||
// Menu-events
|
||||
this.$menu
|
||||
.on( _e.open,
|
||||
function( e )
|
||||
{
|
||||
if ( $(this).hasClass( _c.current ) )
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
return that.open();
|
||||
}
|
||||
)
|
||||
.on( _e.close,
|
||||
function( e )
|
||||
{
|
||||
if ( !$(this).hasClass( _c.current ) )
|
||||
{
|
||||
e.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
return that.close();
|
||||
}
|
||||
)
|
||||
.on( _e.setPage,
|
||||
function( e, $p )
|
||||
{
|
||||
that._initPage( $p );
|
||||
that._initOpenClose();
|
||||
}
|
||||
);
|
||||
|
||||
// Panel-events
|
||||
var $panels = this.$menu.find( this.opts.isMenu && this.direction != 'horizontal' ? 'ul, ol' : '.' + _c.panel );
|
||||
$panels
|
||||
.off( _e.toggle + ' ' + _e.open + ' ' + _e.close )
|
||||
.on( _e.toggle + ' ' + _e.open + ' ' + _e.close,
|
||||
function( e )
|
||||
{
|
||||
e.stopPropagation();
|
||||
}
|
||||
);
|
||||
|
||||
if ( this.direction == 'horizontal' )
|
||||
{
|
||||
$panels
|
||||
.on( _e.open,
|
||||
function( e )
|
||||
{
|
||||
return openSubmenuHorizontal( $(this), that.$menu );
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$panels
|
||||
.on( _e.toggle,
|
||||
function( e )
|
||||
{
|
||||
var $t = $(this);
|
||||
return $t.triggerHandler( $t.parent().hasClass( _c.opened ) ? _e.close : _e.open );
|
||||
}
|
||||
)
|
||||
.on( _e.open,
|
||||
function( e )
|
||||
{
|
||||
$(this).parent().addClass( _c.opened );
|
||||
return 'open';
|
||||
}
|
||||
)
|
||||
.on( _e.close,
|
||||
function( e )
|
||||
{
|
||||
$(this).parent().removeClass( _c.opened );
|
||||
return 'close';
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
_initBlocker: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
if ( !glbl.$blck )
|
||||
{
|
||||
glbl.$blck = $( '<div id="' + _c.blocker + '" />' )
|
||||
.appendTo( glbl.$body );
|
||||
}
|
||||
|
||||
glbl.$blck
|
||||
.off( _e.touchstart )
|
||||
.on( _e.touchstart,
|
||||
function( e )
|
||||
{
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
glbl.$blck.trigger( _e.mousedown );
|
||||
}
|
||||
)
|
||||
.on( _e.mousedown,
|
||||
function( e )
|
||||
{
|
||||
e.preventDefault();
|
||||
if ( !glbl.$html.hasClass( _c.modal ) )
|
||||
{
|
||||
that.$menu.trigger( _e.close );
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
_initPage: function( $p )
|
||||
{
|
||||
if ( !$p )
|
||||
{
|
||||
$p = $(this.conf.pageSelector, glbl.$body);
|
||||
if ( $p.length > 1 )
|
||||
{
|
||||
$[ _PLUGIN_ ].debug( 'Multiple nodes found for the page-node, all nodes are wrapped in one <' + this.conf.pageNodetype + '>.' );
|
||||
$p = $p.wrapAll( '<' + this.conf.pageNodetype + ' />' ).parent();
|
||||
}
|
||||
}
|
||||
|
||||
$p.addClass( _c.page );
|
||||
glbl.$page = $p;
|
||||
},
|
||||
_initMenu: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
// Clone if needed
|
||||
if ( this.conf.clone )
|
||||
{
|
||||
this.$menu = this.$menu.clone( true );
|
||||
this.$menu.add( this.$menu.find( '*' ) ).filter( '[id]' ).each(
|
||||
function()
|
||||
{
|
||||
$(this).attr( 'id', _c.mm( $(this).attr( 'id' ) ) );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Strip whitespace
|
||||
this.$menu.contents().each(
|
||||
function()
|
||||
{
|
||||
if ( $(this)[ 0 ].nodeType == 3 )
|
||||
{
|
||||
$(this).remove();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Inject to body
|
||||
this.$menu[ this.conf.menuInjectMethod + 'To' ]( this.conf.menuWrapperSelector )
|
||||
.addClass( _c.menu );
|
||||
|
||||
// Add direction class
|
||||
this.$menu.addClass( _c.mm( this.direction ) );
|
||||
|
||||
// Add options classes
|
||||
if ( this.opts.classes )
|
||||
{
|
||||
this.$menu.addClass( this.opts.classes );
|
||||
}
|
||||
if ( this.opts.isMenu )
|
||||
{
|
||||
this.$menu.addClass( _c.ismenu );
|
||||
}
|
||||
if ( this.opts.position != 'left' )
|
||||
{
|
||||
this.$menu.addClass( _c.mm( this.opts.position ) );
|
||||
}
|
||||
if ( this.opts.zposition != 'back' )
|
||||
{
|
||||
this.$menu.addClass( _c.mm( this.opts.zposition ) );
|
||||
}
|
||||
},
|
||||
_initPanles: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
|
||||
// Refactor List class
|
||||
this.__refactorClass( $('.' + this.conf.listClass, this.$menu), 'list' );
|
||||
|
||||
// Add List class
|
||||
if ( this.opts.isMenu )
|
||||
{
|
||||
$('ul, ol', this.$menu)
|
||||
.not( '.mm-nolist' )
|
||||
.addClass( _c.list );
|
||||
}
|
||||
|
||||
var $lis = $('.' + _c.list + ' > li', this.$menu);
|
||||
|
||||
// Refactor Selected class
|
||||
this.__refactorClass( $lis.filter( '.' + this.conf.selectedClass ), 'selected' );
|
||||
|
||||
// Refactor Label class
|
||||
this.__refactorClass( $lis.filter( '.' + this.conf.labelClass ), 'label' );
|
||||
|
||||
// Refactor Spacer class
|
||||
this.__refactorClass( $lis.filter( '.' + this.conf.spacerClass ), 'spacer' );
|
||||
|
||||
// setSelected-event
|
||||
$lis
|
||||
.off( _e.setSelected )
|
||||
.on( _e.setSelected,
|
||||
function( e, selected )
|
||||
{
|
||||
e.stopPropagation();
|
||||
|
||||
$lis.removeClass( _c.selected );
|
||||
if ( typeof selected != 'boolean' )
|
||||
{
|
||||
selected = true;
|
||||
}
|
||||
if ( selected )
|
||||
{
|
||||
$(this).addClass( _c.selected );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Refactor Panel class
|
||||
this.__refactorClass( $('.' + this.conf.panelClass, this.$menu), 'panel' );
|
||||
|
||||
// Add Panel class
|
||||
this.$menu
|
||||
.children()
|
||||
.filter( this.conf.panelNodetype )
|
||||
.add( this.$menu.find( '.' + _c.list ).children().children().filter( this.conf.panelNodetype ) )
|
||||
.addClass( _c.panel );
|
||||
|
||||
var $panels = $('.' + _c.panel, this.$menu);
|
||||
|
||||
// Add an ID to all panels
|
||||
$panels
|
||||
.each(
|
||||
function( i )
|
||||
{
|
||||
var $t = $(this),
|
||||
id = $t.attr( 'id' ) || _c.mm( 'm' + that.serialnr + '-p' + i );
|
||||
|
||||
$t.attr( 'id', id );
|
||||
}
|
||||
);
|
||||
|
||||
// Add open and close links to menu items
|
||||
$panels
|
||||
.find( '.' + _c.panel )
|
||||
.each(
|
||||
function( i )
|
||||
{
|
||||
var $t = $(this),
|
||||
$u = $t.is( 'ul, ol' ) ? $t : $t.find( 'ul ,ol' ).first(),
|
||||
$l = $t.parent(),
|
||||
$a = $l.find( '> a, > span' ),
|
||||
$p = $l.closest( '.' + _c.panel );
|
||||
|
||||
$t.data( _d.parent, $l );
|
||||
|
||||
if ( $l.parent().is( '.' + _c.list ) )
|
||||
{
|
||||
var $btn = $( '<a class="' + _c.subopen + '" href="#' + $t.attr( 'id' ) + '" />' ).insertBefore( $a );
|
||||
if ( !$a.is( 'a' ) )
|
||||
{
|
||||
$btn.addClass( _c.fullsubopen );
|
||||
}
|
||||
if ( that.direction == 'horizontal' )
|
||||
{
|
||||
$u.prepend( '<li class="' + _c.subtitle + '"><a class="' + _c.subclose + '" href="#' + $p.attr( 'id' ) + '">' + $a.text() + '</a></li>' );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Link anchors to panels
|
||||
var evt = this.direction == 'horizontal' ? _e.open : _e.toggle;
|
||||
$panels
|
||||
.each(
|
||||
function( i )
|
||||
{
|
||||
var $opening = $(this),
|
||||
id = $opening.attr( 'id' );
|
||||
|
||||
$('a[href="#' + id + '"]', that.$menu)
|
||||
.off( _e.click )
|
||||
.on( _e.click,
|
||||
function( e )
|
||||
{
|
||||
e.preventDefault();
|
||||
$opening.trigger( evt );
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if ( this.direction == 'horizontal' )
|
||||
{
|
||||
// Add opened-classes
|
||||
var $selected = $('.' + _c.list + ' > li.' + _c.selected, this.$menu);
|
||||
$selected
|
||||
.add( $selected.parents( 'li' ) )
|
||||
.parents( 'li' ).removeClass( _c.selected )
|
||||
.end().each(
|
||||
function()
|
||||
{
|
||||
var $t = $(this),
|
||||
$u = $t.find( '> .' + _c.panel );
|
||||
|
||||
if ( $u.length )
|
||||
{
|
||||
$t.parents( '.' + _c.panel ).addClass( _c.subopened );
|
||||
$u.addClass( _c.opened );
|
||||
}
|
||||
}
|
||||
)
|
||||
.closest( '.' + _c.panel ).addClass( _c.opened )
|
||||
.parents( '.' + _c.panel ).addClass( _c.subopened );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Replace Selected-class with opened-class in parents from .Selected
|
||||
$('li.' + _c.selected, this.$menu)
|
||||
.addClass( _c.opened )
|
||||
.parents( '.' + _c.selected ).removeClass( _c.selected );
|
||||
}
|
||||
|
||||
// Set current opened
|
||||
var $current = $panels.filter( '.' + _c.opened );
|
||||
if ( !$current.length )
|
||||
{
|
||||
$current = $panels.first();
|
||||
}
|
||||
$current
|
||||
.addClass( _c.opened )
|
||||
.last()
|
||||
.addClass( _c.current );
|
||||
|
||||
// Rearrange markup
|
||||
if ( this.direction == 'horizontal' )
|
||||
{
|
||||
$panels.find( '.' + _c.panel ).appendTo( this.$menu );
|
||||
}
|
||||
},
|
||||
_initLinks: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
$('.' + _c.list + ' > li > a', this.$menu)
|
||||
.not( '.' + _c.subopen )
|
||||
.not( '.' + _c.subclose )
|
||||
.not( '[rel="external"]' )
|
||||
.not( '[target="_blank"]' )
|
||||
.off( _e.click )
|
||||
.on( _e.click,
|
||||
function( e )
|
||||
{
|
||||
var $t = $(this),
|
||||
href = $t.attr( 'href' );
|
||||
|
||||
// Set selected item
|
||||
if ( that.__valueOrFn( that.opts.onClick.setSelected, $t ) )
|
||||
{
|
||||
$t.parent().trigger( _e.setSelected );
|
||||
}
|
||||
|
||||
// Prevent default / don't follow link. Default: false
|
||||
var preventDefault = that.__valueOrFn( that.opts.onClick.preventDefault, $t, href.slice( 0, 1 ) == '#' );
|
||||
if ( preventDefault )
|
||||
{
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
// Block UI. Default: false if preventDefault, true otherwise
|
||||
if ( that.__valueOrFn( that.opts.onClick.blockUI, $t, !preventDefault ) )
|
||||
{
|
||||
glbl.$html.addClass( _c.blocking );
|
||||
}
|
||||
|
||||
// Close menu. Default: true if preventDefault, false otherwise
|
||||
if ( that.__valueOrFn( that.opts.onClick.close, $t, preventDefault ) )
|
||||
{
|
||||
that.$menu.triggerHandler( _e.close );
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
_initOpenClose: function()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
// Open menu
|
||||
var id = this.$menu.attr( 'id' );
|
||||
if ( id && id.length )
|
||||
{
|
||||
if ( this.conf.clone )
|
||||
{
|
||||
id = _c.umm( id );
|
||||
}
|
||||
|
||||
$('a[href="#' + id + '"]')
|
||||
.off( _e.click )
|
||||
.on( _e.click,
|
||||
function( e )
|
||||
{
|
||||
e.preventDefault();
|
||||
that.$menu.trigger( _e.open );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Close menu
|
||||
var id = glbl.$page.attr( 'id' );
|
||||
if ( id && id.length )
|
||||
{
|
||||
$('a[href="#' + id + '"]')
|
||||
.off( _e.click )
|
||||
.on( _e.click,
|
||||
function( e )
|
||||
{
|
||||
e.preventDefault();
|
||||
that.$menu.trigger( _e.close );
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
__valueOrFn: function( o, $e, d )
|
||||
{
|
||||
if ( typeof o == 'function' )
|
||||
{
|
||||
return o.call( $e[ 0 ] );
|
||||
}
|
||||
if ( typeof o == 'undefined' && typeof d != 'undefined' )
|
||||
{
|
||||
return d;
|
||||
}
|
||||
return o;
|
||||
},
|
||||
|
||||
__refactorClass: function( $e, c )
|
||||
{
|
||||
$e.removeClass( this.conf[ c + 'Class' ] ).addClass( _c[ c ] );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$.fn[ _PLUGIN_ ] = function( opts, conf )
|
||||
{
|
||||
// First time plugin is fired
|
||||
if ( !glbl.$wndw )
|
||||
{
|
||||
_initPlugin();
|
||||
}
|
||||
|
||||
// Extend options
|
||||
opts = extendOptions( opts, conf );
|
||||
conf = extendConfiguration( conf );
|
||||
|
||||
return this.each(
|
||||
function()
|
||||
{
|
||||
var $menu = $(this);
|
||||
if ( $menu.data( _PLUGIN_ ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
$menu.data( _PLUGIN_, new $[ _PLUGIN_ ]( $menu, opts, conf ) );
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
$[ _PLUGIN_ ].version = _VERSION_;
|
||||
|
||||
$[ _PLUGIN_ ].defaults = {
|
||||
position : 'left',
|
||||
zposition : 'back',
|
||||
moveBackground : true,
|
||||
slidingSubmenus : true,
|
||||
modal : false,
|
||||
classes : '',
|
||||
onClick : {
|
||||
// close : true,
|
||||
// blockUI : null,
|
||||
// preventDefault : null,
|
||||
setSelected : true
|
||||
}
|
||||
};
|
||||
$[ _PLUGIN_ ].configuration = {
|
||||
panelClass : 'Panel',
|
||||
listClass : 'List',
|
||||
selectedClass : 'Selected',
|
||||
labelClass : 'Label',
|
||||
spacerClass : 'Spacer',
|
||||
pageNodetype : 'div',
|
||||
panelNodetype : 'ul, ol, div',
|
||||
pageSelector : null,
|
||||
menuWrapperSelector : 'body',
|
||||
menuInjectMethod : 'prepend',
|
||||
transitionDuration : 400
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
SUPPORT
|
||||
*/
|
||||
(function() {
|
||||
|
||||
var wd = window.document,
|
||||
ua = window.navigator.userAgent,
|
||||
ds = document.createElement( 'div' ).style;
|
||||
|
||||
var _touch = 'ontouchstart' in wd,
|
||||
_overflowscrolling = 'WebkitOverflowScrolling' in wd.documentElement.style,
|
||||
_oldAndroidBrowser = (function() {
|
||||
if ( ua.indexOf( 'Android' ) >= 0 )
|
||||
{
|
||||
return 2.4 > parseFloat( ua.slice( ua.indexOf( 'Android' ) +8 ) );
|
||||
}
|
||||
return false;
|
||||
})();
|
||||
|
||||
$[ _PLUGIN_ ].support = {
|
||||
|
||||
touch: _touch,
|
||||
oldAndroidBrowser: _oldAndroidBrowser,
|
||||
overflowscrolling: (function() {
|
||||
if ( !_touch )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( _overflowscrolling )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if ( _oldAndroidBrowser )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})()
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
/*
|
||||
DEBUG
|
||||
*/
|
||||
$[ _PLUGIN_ ].debug = function( msg ) {};
|
||||
$[ _PLUGIN_ ].deprecated = function( depr, repl )
|
||||
{
|
||||
if ( typeof console != 'undefined' && typeof console.warn != 'undefined' )
|
||||
{
|
||||
console.warn( 'MMENU: ' + depr + ' is deprecated, use ' + repl + ' instead.' );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function extendOptions( o, c, $m )
|
||||
{
|
||||
|
||||
if ( $m )
|
||||
{
|
||||
if ( typeof o != 'object' )
|
||||
{
|
||||
o = {};
|
||||
}
|
||||
if ( typeof o.isMenu != 'boolean' )
|
||||
{
|
||||
var $c = $m.children();
|
||||
o.isMenu = ( $c.length == 1 && $c.is( c.panelNodetype ) );
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
// Extend from defaults
|
||||
o = $.extend( true, {}, $[ _PLUGIN_ ].defaults, o );
|
||||
|
||||
|
||||
// DEPRECATED
|
||||
if ( o.position == 'top' || o.position == 'bottom' )
|
||||
{
|
||||
if ( o.zposition == 'back' || o.zposition == 'next' )
|
||||
{
|
||||
$[ _PLUGIN_ ].deprecated( 'Using position "' + o.position + '" in combination with zposition "' + o.zposition + '"', 'zposition "front"' );
|
||||
o.zposition = 'front';
|
||||
}
|
||||
}
|
||||
// /DEPRECATED
|
||||
|
||||
return o;
|
||||
}
|
||||
function extendConfiguration( c )
|
||||
{
|
||||
c = $.extend( true, {}, $[ _PLUGIN_ ].configuration, c )
|
||||
|
||||
// Set pageSelector
|
||||
if ( typeof c.pageSelector != 'string' )
|
||||
{
|
||||
c.pageSelector = '> ' + c.pageNodetype;
|
||||
}
|
||||
|
||||
// Restrict injectMethod
|
||||
if ( c.menuInjectMethod != 'append' )
|
||||
{
|
||||
c.menuInjectMethod = 'prepend';
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
function _initPlugin()
|
||||
{
|
||||
glbl.$wndw = $(window);
|
||||
glbl.$html = $('html');
|
||||
glbl.$body = $('body');
|
||||
|
||||
glbl.$allMenus = $();
|
||||
|
||||
|
||||
// Classnames, Datanames, Eventnames
|
||||
$.each( [ _c, _d, _e ],
|
||||
function( i, o )
|
||||
{
|
||||
o.add = function( c )
|
||||
{
|
||||
c = c.split( ' ' );
|
||||
for ( var d in c )
|
||||
{
|
||||
o[ c[ d ] ] = o.mm( c[ d ] );
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
// Classnames
|
||||
_c.mm = function( c ) { return 'mm-' + c; };
|
||||
_c.add( 'menu ismenu panel list subtitle selected label spacer current highest hidden page blocker modal background opened opening subopened subopen fullsubopen subclose' );
|
||||
_c.umm = function( c )
|
||||
{
|
||||
if ( c.slice( 0, 3 ) == 'mm-' )
|
||||
{
|
||||
c = c.slice( 3 );
|
||||
}
|
||||
return c;
|
||||
};
|
||||
|
||||
// Datanames
|
||||
_d.mm = function( d ) { return 'mm-' + d; };
|
||||
_d.add( 'parent style' );
|
||||
|
||||
// Eventnames
|
||||
_e.mm = function( e ) { return e + '.mm'; };
|
||||
_e.add( 'toggle open opening opened close closing closed update setPage setSelected transitionend webkitTransitionEnd mousedown touchstart mouseup touchend scroll touchmove click keydown keyup resize' );
|
||||
|
||||
|
||||
// Prevent tabbing
|
||||
glbl.$wndw
|
||||
.on( _e.keydown,
|
||||
function( e )
|
||||
{
|
||||
if ( glbl.$html.hasClass( _c.opened ) )
|
||||
{
|
||||
if ( e.keyCode == 9 )
|
||||
{
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Set page min-height to window height
|
||||
var _h = 0;
|
||||
glbl.$wndw
|
||||
.on( _e.resize,
|
||||
function( e, force )
|
||||
{
|
||||
if ( force || glbl.$html.hasClass( _c.opened ) )
|
||||
{
|
||||
var nh = glbl.$wndw.height();
|
||||
if ( force || nh != _h )
|
||||
{
|
||||
_h = nh;
|
||||
glbl.$page.css( 'minHeight', nh );
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
$[ _PLUGIN_ ]._c = _c;
|
||||
$[ _PLUGIN_ ]._d = _d;
|
||||
$[ _PLUGIN_ ]._e = _e;
|
||||
|
||||
$[ _PLUGIN_ ].glbl = glbl;
|
||||
}
|
||||
|
||||
function openSubmenuHorizontal( $opening, $m )
|
||||
{
|
||||
if ( $opening.hasClass( _c.current ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var $panels = $('.' + _c.panel, $m),
|
||||
$current = $panels.filter( '.' + _c.current );
|
||||
|
||||
$panels
|
||||
.removeClass( _c.highest )
|
||||
.removeClass( _c.current )
|
||||
.not( $opening )
|
||||
.not( $current )
|
||||
.addClass( _c.hidden );
|
||||
|
||||
if ( $opening.hasClass( _c.opened ) )
|
||||
{
|
||||
$current
|
||||
.addClass( _c.highest )
|
||||
.removeClass( _c.opened )
|
||||
.removeClass( _c.subopened );
|
||||
}
|
||||
else
|
||||
{
|
||||
$opening
|
||||
.addClass( _c.highest );
|
||||
|
||||
$current
|
||||
.addClass( _c.subopened );
|
||||
}
|
||||
|
||||
$opening
|
||||
.removeClass( _c.hidden )
|
||||
.removeClass( _c.subopened )
|
||||
.addClass( _c.current )
|
||||
.addClass( _c.opened );
|
||||
|
||||
return 'open';
|
||||
}
|
||||
|
||||
function transitionend( $e, fn, duration )
|
||||
{
|
||||
var _ended = false,
|
||||
_fn = function()
|
||||
{
|
||||
if ( !_ended )
|
||||
{
|
||||
fn.call( $e[ 0 ] );
|
||||
}
|
||||
_ended = true;
|
||||
};
|
||||
|
||||
$e.one( _e.transitionend, _fn );
|
||||
$e.one( _e.webkitTransitionEnd, _fn );
|
||||
setTimeout( _fn, duration * 1.1 );
|
||||
}
|
||||
|
||||
})( jQuery );
|
||||
84
theme-old/js/jquery.mmenu.min.all.js
Executable file
84
theme-old/js/jquery.mmenu.min.all.js
Executable file
File diff suppressed because one or more lines are too long
14
theme-old/js/jquery.mmenu.min.js
vendored
Executable file
14
theme-old/js/jquery.mmenu.min.js
vendored
Executable file
File diff suppressed because one or more lines are too long
633
theme-old/js/jquery.nestable.js
Normal file
633
theme-old/js/jquery.nestable.js
Normal file
@@ -0,0 +1,633 @@
|
||||
/*!
|
||||
* Nestable jQuery Plugin - Copyright (c) 2012 David Bushell - http://dbushell.com/
|
||||
* Dual-licensed under the BSD or MIT licenses
|
||||
*/
|
||||
;(function($, window, document, undefined)
|
||||
{
|
||||
var hasTouch = 'ontouchstart' in window;
|
||||
var nestableCopy;
|
||||
|
||||
/**
|
||||
* Detect CSS pointer-events property
|
||||
* events are normally disabled on the dragging element to avoid conflicts
|
||||
* https://github.com/ausi/Feature-detection-technique-for-pointer-events/blob/master/modernizr-pointerevents.js
|
||||
*/
|
||||
var hasPointerEvents = (function()
|
||||
{
|
||||
var el = document.createElement('div'),
|
||||
docEl = document.documentElement;
|
||||
if (!('pointerEvents' in el.style)) {
|
||||
return false;
|
||||
}
|
||||
el.style.pointerEvents = 'auto';
|
||||
el.style.pointerEvents = 'x';
|
||||
docEl.appendChild(el);
|
||||
var supports = window.getComputedStyle && window.getComputedStyle(el, '').pointerEvents === 'auto';
|
||||
docEl.removeChild(el);
|
||||
return !!supports;
|
||||
})();
|
||||
|
||||
var eStart = hasTouch ? 'touchstart' : 'mousedown',
|
||||
eMove = hasTouch ? 'touchmove' : 'mousemove',
|
||||
eEnd = hasTouch ? 'touchend' : 'mouseup',
|
||||
eCancel = hasTouch ? 'touchcancel' : 'mouseup';
|
||||
|
||||
var defaults = {
|
||||
listNodeName : 'ol',
|
||||
itemNodeName : 'li',
|
||||
rootClass : 'dd',
|
||||
listClass : 'dd-list',
|
||||
itemClass : 'dd-item',
|
||||
dragClass : 'dd-dragel',
|
||||
handleClass : 'dd-handle',
|
||||
collapsedClass : 'dd-collapsed',
|
||||
placeClass : 'dd-placeholder',
|
||||
noDragClass : 'dd-nodrag',
|
||||
noChildrenClass : 'dd-nochildren',
|
||||
emptyClass : 'dd-empty',
|
||||
expandBtnHTML : '<button data-action="expand" type="button">Expand</button>',
|
||||
collapseBtnHTML : '<button data-action="collapse" type="button">Collapse</button>',
|
||||
group : 0,
|
||||
maxDepth : 5,
|
||||
threshold : 20,
|
||||
reject : [],
|
||||
//method for call when an item has been successfully dropped
|
||||
//method has 1 argument in which sends an object containing all
|
||||
//necessary details
|
||||
dropCallback : null,
|
||||
// When a node is dragged it is moved to its new location.
|
||||
// You can set the next option to true to create a copy of the node that is dragged.
|
||||
cloneNodeOnDrag : false,
|
||||
// When the node is dragged and released outside its list delete it.
|
||||
dragOutsideToDelete : false
|
||||
};
|
||||
|
||||
function Plugin(element, options)
|
||||
{
|
||||
this.w = $(document);
|
||||
this.el = $(element);
|
||||
this.options = $.extend({}, defaults, options);
|
||||
this.init();
|
||||
}
|
||||
|
||||
Plugin.prototype = {
|
||||
|
||||
init: function()
|
||||
{
|
||||
var list = this;
|
||||
|
||||
list.reset();
|
||||
|
||||
list.el.data('nestable-group', this.options.group);
|
||||
|
||||
list.placeEl = $('<div class="' + list.options.placeClass + '"/>');
|
||||
|
||||
$.each(this.el.find(list.options.itemNodeName), function(k, el) {
|
||||
list.setParent($(el));
|
||||
});
|
||||
|
||||
list.el.on('click', 'button', function(e)
|
||||
{
|
||||
if (list.dragEl || (!hasTouch && e.button !== 0)) {
|
||||
return;
|
||||
}
|
||||
var target = $(e.currentTarget),
|
||||
action = target.data('action'),
|
||||
item = target.parent(list.options.itemNodeName);
|
||||
if (action === 'collapse') {
|
||||
list.collapseItem(item);
|
||||
}
|
||||
if (action === 'expand') {
|
||||
list.expandItem(item);
|
||||
}
|
||||
});
|
||||
|
||||
var onStartEvent = function(e)
|
||||
{
|
||||
var handle = $(e.target);
|
||||
|
||||
list.nestableCopy = handle.closest('.'+list.options.rootClass).clone(true);
|
||||
|
||||
if (!handle.hasClass(list.options.handleClass)) {
|
||||
if (handle.closest('.' + list.options.noDragClass).length) {
|
||||
return;
|
||||
}
|
||||
handle = handle.closest('.' + list.options.handleClass);
|
||||
}
|
||||
if (!handle.length || list.dragEl || (!hasTouch && e.which !== 1) || (hasTouch && e.touches.length !== 1)) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
list.dragStart(hasTouch ? e.touches[0] : e);
|
||||
};
|
||||
|
||||
var onMoveEvent = function(e)
|
||||
{
|
||||
if (list.dragEl) {
|
||||
e.preventDefault();
|
||||
list.dragMove(hasTouch ? e.touches[0] : e);
|
||||
}
|
||||
};
|
||||
|
||||
var onEndEvent = function(e)
|
||||
{
|
||||
if (list.dragEl) {
|
||||
e.preventDefault();
|
||||
list.dragStop(hasTouch ? e.touches[0] : e);
|
||||
}
|
||||
};
|
||||
|
||||
if (hasTouch) {
|
||||
list.el[0].addEventListener(eStart, onStartEvent, false);
|
||||
window.addEventListener(eMove, onMoveEvent, false);
|
||||
window.addEventListener(eEnd, onEndEvent, false);
|
||||
window.addEventListener(eCancel, onEndEvent, false);
|
||||
} else {
|
||||
list.el.on(eStart, onStartEvent);
|
||||
list.w.on(eMove, onMoveEvent);
|
||||
list.w.on(eEnd, onEndEvent);
|
||||
}
|
||||
|
||||
var destroyNestable = function()
|
||||
{
|
||||
if (hasTouch) {
|
||||
list.el[0].removeEventListener(eStart, onStartEvent, false);
|
||||
window.removeEventListener(eMove, onMoveEvent, false);
|
||||
window.removeEventListener(eEnd, onEndEvent, false);
|
||||
window.removeEventListener(eCancel, onEndEvent, false);
|
||||
} else {
|
||||
list.el.off(eStart, onStartEvent);
|
||||
list.w.off(eMove, onMoveEvent);
|
||||
list.w.off(eEnd, onEndEvent);
|
||||
}
|
||||
|
||||
list.el.off('click');
|
||||
list.el.unbind('destroy-nestable');
|
||||
|
||||
list.el.data("nestable", null);
|
||||
|
||||
var buttons = list.el[0].getElementsByTagName('button');
|
||||
|
||||
$(buttons).remove();
|
||||
};
|
||||
|
||||
list.el.bind('destroy-nestable', destroyNestable);
|
||||
},
|
||||
|
||||
destroy: function ()
|
||||
{
|
||||
this.expandAll();
|
||||
this.el.trigger('destroy-nestable');
|
||||
},
|
||||
|
||||
serialize: function()
|
||||
{
|
||||
var data,
|
||||
depth = 0,
|
||||
list = this;
|
||||
step = function(level, depth)
|
||||
{
|
||||
var array = [ ],
|
||||
items = level.children(list.options.itemNodeName);
|
||||
items.each(function()
|
||||
{
|
||||
var li = $(this),
|
||||
item = $.extend({}, li.data()),
|
||||
sub = li.children(list.options.listNodeName);
|
||||
if (sub.length) {
|
||||
item.children = step(sub, depth + 1);
|
||||
}
|
||||
array.push(item);
|
||||
});
|
||||
return array;
|
||||
};
|
||||
data = step(list.el.find(list.options.listNodeName).first(), depth);
|
||||
return data;
|
||||
},
|
||||
|
||||
reset: function()
|
||||
{
|
||||
this.mouse = {
|
||||
offsetX : 0,
|
||||
offsetY : 0,
|
||||
startX : 0,
|
||||
startY : 0,
|
||||
lastX : 0,
|
||||
lastY : 0,
|
||||
nowX : 0,
|
||||
nowY : 0,
|
||||
distX : 0,
|
||||
distY : 0,
|
||||
dirAx : 0,
|
||||
dirX : 0,
|
||||
dirY : 0,
|
||||
lastDirX : 0,
|
||||
lastDirY : 0,
|
||||
distAxX : 0,
|
||||
distAxY : 0
|
||||
};
|
||||
this.moving = false;
|
||||
this.dragEl = null;
|
||||
this.dragRootEl = null;
|
||||
this.dragDepth = 0;
|
||||
this.dragItem = null;
|
||||
this.hasNewRoot = false;
|
||||
this.pointEl = null;
|
||||
this.sourceRoot = null;
|
||||
this.isOutsideRoot = false;
|
||||
},
|
||||
|
||||
expandItem: function(li)
|
||||
{
|
||||
li.removeClass(this.options.collapsedClass);
|
||||
li.children('[data-action="expand"]').hide();
|
||||
li.children('[data-action="collapse"]').show();
|
||||
li.children(this.options.listNodeName).show();
|
||||
this.el.trigger('expand', [li]);
|
||||
li.trigger('expand');
|
||||
},
|
||||
|
||||
collapseItem: function(li)
|
||||
{
|
||||
var lists = li.children(this.options.listNodeName);
|
||||
if (lists.length) {
|
||||
li.addClass(this.options.collapsedClass);
|
||||
li.children('[data-action="collapse"]').hide();
|
||||
li.children('[data-action="expand"]').show();
|
||||
li.children(this.options.listNodeName).hide();
|
||||
}
|
||||
this.el.trigger('collapse', [li]);
|
||||
li.trigger('collapse');
|
||||
},
|
||||
|
||||
expandAll: function()
|
||||
{
|
||||
var list = this;
|
||||
list.el.find(list.options.itemNodeName).each(function() {
|
||||
list.expandItem($(this));
|
||||
});
|
||||
},
|
||||
|
||||
collapseAll: function()
|
||||
{
|
||||
var list = this;
|
||||
list.el.find(list.options.itemNodeName).each(function() {
|
||||
list.collapseItem($(this));
|
||||
});
|
||||
},
|
||||
|
||||
setParent: function(li)
|
||||
{
|
||||
if (li.children(this.options.listNodeName).length) {
|
||||
li.prepend($(this.options.expandBtnHTML));
|
||||
li.prepend($(this.options.collapseBtnHTML));
|
||||
}
|
||||
if( (' ' + li[0].className + ' ').indexOf(' ' + defaults.collapsedClass + ' ') > -1 )
|
||||
{
|
||||
li.children('[data-action="collapse"]').hide();
|
||||
} else {
|
||||
li.children('[data-action="expand"]').hide();
|
||||
}
|
||||
},
|
||||
|
||||
unsetParent: function(li)
|
||||
{
|
||||
li.removeClass(this.options.collapsedClass);
|
||||
li.children('[data-action]').remove();
|
||||
li.children(this.options.listNodeName).remove();
|
||||
},
|
||||
|
||||
dragStart: function(e)
|
||||
{
|
||||
var mouse = this.mouse,
|
||||
target = $(e.target),
|
||||
dragItem = target.closest('.' + this.options.handleClass).closest(this.options.itemNodeName);
|
||||
|
||||
this.sourceRoot = target.closest('.' + this.options.rootClass);
|
||||
|
||||
this.dragItem = dragItem;
|
||||
|
||||
this.placeEl.css('height', dragItem.height());
|
||||
|
||||
mouse.offsetX = e.offsetX !== undefined ? e.offsetX : e.pageX - target.offset().left;
|
||||
mouse.offsetY = e.offsetY !== undefined ? e.offsetY : e.pageY - target.offset().top;
|
||||
mouse.startX = mouse.lastX = e.pageX;
|
||||
mouse.startY = mouse.lastY = e.pageY;
|
||||
|
||||
this.dragRootEl = this.el;
|
||||
|
||||
this.dragEl = $(document.createElement(this.options.listNodeName)).addClass(this.options.listClass + ' ' + this.options.dragClass);
|
||||
this.dragEl.css('width', dragItem.width());
|
||||
|
||||
// fix for zepto.js
|
||||
//dragItem.after(this.placeEl).detach().appendTo(this.dragEl);
|
||||
if(this.options.cloneNodeOnDrag) {
|
||||
dragItem.after(dragItem.clone());
|
||||
} else {
|
||||
dragItem.after(this.placeEl);
|
||||
}
|
||||
dragItem[0].parentNode.removeChild(dragItem[0]);
|
||||
dragItem.appendTo(this.dragEl);
|
||||
|
||||
$(document.body).append(this.dragEl);
|
||||
this.dragEl.css({
|
||||
'left' : e.pageX - mouse.offsetX,
|
||||
'top' : e.pageY - mouse.offsetY
|
||||
});
|
||||
// total depth of dragging item
|
||||
var i, depth,
|
||||
items = this.dragEl.find(this.options.itemNodeName);
|
||||
for (i = 0; i < items.length; i++) {
|
||||
depth = $(items[i]).parents(this.options.listNodeName).length;
|
||||
if (depth > this.dragDepth) {
|
||||
this.dragDepth = depth;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
dragStop: function(e)
|
||||
{
|
||||
// fix for zepto.js
|
||||
//this.placeEl.replaceWith(this.dragEl.children(this.options.itemNodeName + ':first').detach());
|
||||
var el = this.dragEl.children(this.options.itemNodeName).first();
|
||||
el[0].parentNode.removeChild(el[0]);
|
||||
|
||||
if(this.isOutsideRoot && this.options.dragOutsideToDelete)
|
||||
{
|
||||
var parent = this.placeEl.parent();
|
||||
this.placeEl.remove();
|
||||
if (!parent.children().length) {
|
||||
this.unsetParent(parent.parent());
|
||||
}
|
||||
// If all nodes where deleted, create a placeholder element.
|
||||
if (!this.dragRootEl.find(this.options.itemNodeName).length)
|
||||
{
|
||||
this.dragRootEl.append('<div class="' + this.options.emptyClass + '"/>');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.placeEl.replaceWith(el);
|
||||
}
|
||||
|
||||
if (!this.moving)
|
||||
{
|
||||
$(this.dragItem).trigger('click');
|
||||
}
|
||||
|
||||
var i;
|
||||
var isRejected = false;
|
||||
for (i in this.options.reject)
|
||||
{
|
||||
var reject = this.options.reject[i];
|
||||
if (reject.rule.apply(this.dragRootEl))
|
||||
{
|
||||
var nestableDragEl = el.clone(true);
|
||||
this.dragRootEl.html(this.nestableCopy.children().clone(true));
|
||||
if (reject.action) {
|
||||
reject.action.apply(this.dragRootEl, [nestableDragEl]);
|
||||
}
|
||||
|
||||
isRejected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isRejected)
|
||||
{
|
||||
this.dragEl.remove();
|
||||
this.el.trigger('change');
|
||||
|
||||
//Let's find out new parent id
|
||||
var parentItem = el.parent().parent();
|
||||
var parentId = null;
|
||||
if(parentItem !== null && !parentItem.is('.' + this.options.rootClass))
|
||||
parentId = parentItem.data('id');
|
||||
|
||||
if($.isFunction(this.options.dropCallback))
|
||||
{
|
||||
var details = {
|
||||
sourceId : el.data('id'),
|
||||
destId : parentId,
|
||||
sourceEl : el,
|
||||
destParent : parentItem,
|
||||
destRoot : el.closest('.' + this.options.rootClass),
|
||||
sourceRoot : this.sourceRoot
|
||||
};
|
||||
this.options.dropCallback.call(this, details);
|
||||
}
|
||||
|
||||
if (this.hasNewRoot) {
|
||||
this.dragRootEl.trigger('change');
|
||||
}
|
||||
|
||||
this.reset();
|
||||
}
|
||||
},
|
||||
|
||||
dragMove: function(e)
|
||||
{
|
||||
var list, parent, prev, next, depth,
|
||||
opt = this.options,
|
||||
mouse = this.mouse;
|
||||
|
||||
this.dragEl.css({
|
||||
'left' : e.pageX - mouse.offsetX,
|
||||
'top' : e.pageY - mouse.offsetY
|
||||
});
|
||||
|
||||
// mouse position last events
|
||||
mouse.lastX = mouse.nowX;
|
||||
mouse.lastY = mouse.nowY;
|
||||
// mouse position this events
|
||||
mouse.nowX = e.pageX;
|
||||
mouse.nowY = e.pageY;
|
||||
// distance mouse moved between events
|
||||
mouse.distX = mouse.nowX - mouse.lastX;
|
||||
mouse.distY = mouse.nowY - mouse.lastY;
|
||||
// direction mouse was moving
|
||||
mouse.lastDirX = mouse.dirX;
|
||||
mouse.lastDirY = mouse.dirY;
|
||||
// direction mouse is now moving (on both axis)
|
||||
mouse.dirX = mouse.distX === 0 ? 0 : mouse.distX > 0 ? 1 : -1;
|
||||
mouse.dirY = mouse.distY === 0 ? 0 : mouse.distY > 0 ? 1 : -1;
|
||||
// axis mouse is now moving on
|
||||
var newAx = Math.abs(mouse.distX) > Math.abs(mouse.distY) ? 1 : 0;
|
||||
|
||||
// do nothing on first move
|
||||
if (!this.moving) {
|
||||
mouse.dirAx = newAx;
|
||||
this.moving = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// calc distance moved on this axis (and direction)
|
||||
if (mouse.dirAx !== newAx) {
|
||||
mouse.distAxX = 0;
|
||||
mouse.distAxY = 0;
|
||||
} else {
|
||||
mouse.distAxX += Math.abs(mouse.distX);
|
||||
if (mouse.dirX !== 0 && mouse.dirX !== mouse.lastDirX) {
|
||||
mouse.distAxX = 0;
|
||||
}
|
||||
mouse.distAxY += Math.abs(mouse.distY);
|
||||
if (mouse.dirY !== 0 && mouse.dirY !== mouse.lastDirY) {
|
||||
mouse.distAxY = 0;
|
||||
}
|
||||
}
|
||||
mouse.dirAx = newAx;
|
||||
|
||||
/**
|
||||
* move horizontal
|
||||
*/
|
||||
if (mouse.dirAx && mouse.distAxX >= opt.threshold) {
|
||||
// reset move distance on x-axis for new phase
|
||||
mouse.distAxX = 0;
|
||||
prev = this.placeEl.prev(opt.itemNodeName);
|
||||
// increase horizontal level if previous sibling exists and is not collapsed
|
||||
if (mouse.distX > 0 && prev.length && !prev.hasClass(opt.collapsedClass) && !prev.hasClass(opt.noChildrenClass)) {
|
||||
// cannot increase level when item above is collapsed
|
||||
list = prev.find(opt.listNodeName).last();
|
||||
// check if depth limit has reached
|
||||
depth = this.placeEl.parents(opt.listNodeName).length;
|
||||
if (depth + this.dragDepth <= opt.maxDepth) {
|
||||
// create new sub-level if one doesn't exist
|
||||
if (!list.length) {
|
||||
list = $('<' + opt.listNodeName + '/>').addClass(opt.listClass);
|
||||
list.append(this.placeEl);
|
||||
prev.append(list);
|
||||
this.setParent(prev);
|
||||
} else {
|
||||
// else append to next level up
|
||||
list = prev.children(opt.listNodeName).last();
|
||||
list.append(this.placeEl);
|
||||
}
|
||||
}
|
||||
}
|
||||
// decrease horizontal level
|
||||
if (mouse.distX < 0) {
|
||||
// we can't decrease a level if an item preceeds the current one
|
||||
next = this.placeEl.next(opt.itemNodeName);
|
||||
if (!next.length) {
|
||||
parent = this.placeEl.parent();
|
||||
this.placeEl.closest(opt.itemNodeName).after(this.placeEl);
|
||||
if (!parent.children().length) {
|
||||
this.unsetParent(parent.parent());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var isEmpty = false;
|
||||
|
||||
// find list item under cursor
|
||||
if (!hasPointerEvents) {
|
||||
this.dragEl[0].style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
this.pointEl = $(document.elementFromPoint(e.pageX - document.documentElement.scrollLeft, e.pageY - (window.pageYOffset || document.documentElement.scrollTop)));
|
||||
|
||||
// Check if the node is dragged outside of its list.
|
||||
if(this.dragRootEl.has(this.pointEl).length) {
|
||||
this.isOutsideRoot = false;
|
||||
this.dragEl[0].style.opacity = 1;
|
||||
} else {
|
||||
this.isOutsideRoot = true;
|
||||
this.dragEl[0].style.opacity = 0.5;
|
||||
}
|
||||
|
||||
// find parent list of item under cursor
|
||||
var pointElRoot = this.pointEl.closest('.' + opt.rootClass),
|
||||
isNewRoot = this.dragRootEl.data('nestable-id') !== pointElRoot.data('nestable-id');
|
||||
|
||||
this.isOutsideRoot = !pointElRoot.length;
|
||||
|
||||
if (!hasPointerEvents) {
|
||||
this.dragEl[0].style.visibility = 'visible';
|
||||
}
|
||||
if (this.pointEl.hasClass(opt.handleClass)) {
|
||||
this.pointEl = this.pointEl.closest( opt.itemNodeName );
|
||||
}
|
||||
if (this.pointEl.hasClass(opt.emptyClass)) {
|
||||
isEmpty = true;
|
||||
}
|
||||
else if (!this.pointEl.length || !this.pointEl.hasClass(opt.itemClass)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* move vertical
|
||||
*/
|
||||
if (!mouse.dirAx || isNewRoot || isEmpty) {
|
||||
// check if groups match if dragging over new root
|
||||
if (isNewRoot && opt.group !== pointElRoot.data('nestable-group')) {
|
||||
return;
|
||||
}
|
||||
// check depth limit
|
||||
depth = this.dragDepth - 1 + this.pointEl.parents(opt.listNodeName).length;
|
||||
if (depth > opt.maxDepth) {
|
||||
return;
|
||||
}
|
||||
var before = e.pageY < (this.pointEl.offset().top + this.pointEl.height() / 2);
|
||||
parent = this.placeEl.parent();
|
||||
// if empty create new list to replace empty placeholder
|
||||
if (isEmpty) {
|
||||
list = $(document.createElement(opt.listNodeName)).addClass(opt.listClass);
|
||||
list.append(this.placeEl);
|
||||
this.pointEl.replaceWith(list);
|
||||
}
|
||||
else if (before) {
|
||||
this.pointEl.before(this.placeEl);
|
||||
}
|
||||
else {
|
||||
this.pointEl.after(this.placeEl);
|
||||
}
|
||||
if (!parent.children().length) {
|
||||
this.unsetParent(parent.parent());
|
||||
}
|
||||
if (!this.dragRootEl.find(opt.itemNodeName).length) {
|
||||
this.dragRootEl.append('<div class="' + opt.emptyClass + '"/>');
|
||||
}
|
||||
// parent root list has changed
|
||||
this.dragRootEl = pointElRoot;
|
||||
if (isNewRoot) {
|
||||
this.hasNewRoot = this.el[0] !== this.dragRootEl[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.fn.nestable = function(params)
|
||||
{
|
||||
var lists = this,
|
||||
retval = this;
|
||||
|
||||
var generateUid = function (separator) {
|
||||
var delim = separator || "-";
|
||||
|
||||
function S4() {
|
||||
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
||||
}
|
||||
|
||||
return (S4() + S4() + delim + S4() + delim + S4() + delim + S4() + delim + S4() + S4() + S4());
|
||||
};
|
||||
|
||||
lists.each(function()
|
||||
{
|
||||
var plugin = $(this).data("nestable");
|
||||
|
||||
if (!plugin) {
|
||||
$(this).data("nestable", new Plugin(this, params));
|
||||
$(this).data("nestable-id", generateUid());
|
||||
} else {
|
||||
if (typeof params === 'string' && typeof plugin[params] === 'function') {
|
||||
retval = plugin[params]();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return retval || lists;
|
||||
};
|
||||
|
||||
})(window.jQuery || window.Zepto, window, document);
|
||||
2
theme-old/js/vendor/vex/vex.combined.min.js
vendored
Normal file
2
theme-old/js/vendor/vex/vex.combined.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
149
theme-old/js/vendor/vex/vex.dialog.js
vendored
Normal file
149
theme-old/js/vendor/vex/vex.dialog.js
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
(function() {
|
||||
var vexDialogFactory;
|
||||
|
||||
vexDialogFactory = function($, vex) {
|
||||
var $formToObject, dialog;
|
||||
if (vex == null) {
|
||||
return $.error('Vex is required to use vex.dialog');
|
||||
}
|
||||
$formToObject = function($form) {
|
||||
var object;
|
||||
object = {};
|
||||
$.each($form.serializeArray(), function() {
|
||||
if (object[this.name]) {
|
||||
if (!object[this.name].push) {
|
||||
object[this.name] = [object[this.name]];
|
||||
}
|
||||
return object[this.name].push(this.value || '');
|
||||
} else {
|
||||
return object[this.name] = this.value || '';
|
||||
}
|
||||
});
|
||||
return object;
|
||||
};
|
||||
dialog = {};
|
||||
dialog.buttons = {
|
||||
YES: {
|
||||
text: 'OK',
|
||||
type: 'submit',
|
||||
className: 'vex-dialog-button-primary'
|
||||
},
|
||||
NO: {
|
||||
text: 'Cancel',
|
||||
type: 'button',
|
||||
className: 'vex-dialog-button-secondary',
|
||||
click: function($vexContent, event) {
|
||||
$vexContent.data().vex.value = false;
|
||||
return vex.close($vexContent.data().vex.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
dialog.defaultOptions = {
|
||||
callback: function(value) {},
|
||||
afterOpen: function() {},
|
||||
message: 'Message',
|
||||
input: "<input name=\"vex\" type=\"hidden\" value=\"_vex-empty-value\" />",
|
||||
value: false,
|
||||
buttons: [dialog.buttons.YES, dialog.buttons.NO],
|
||||
showCloseButton: false,
|
||||
onSubmit: function(event) {
|
||||
var $form, $vexContent;
|
||||
$form = $(this);
|
||||
$vexContent = $form.parent();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$vexContent.data().vex.value = dialog.getFormValueOnSubmit($formToObject($form));
|
||||
return vex.close($vexContent.data().vex.id);
|
||||
},
|
||||
focusFirstInput: true
|
||||
};
|
||||
dialog.defaultAlertOptions = {
|
||||
message: 'Alert',
|
||||
buttons: [dialog.buttons.YES]
|
||||
};
|
||||
dialog.defaultConfirmOptions = {
|
||||
message: 'Confirm'
|
||||
};
|
||||
dialog.open = function(options) {
|
||||
var $vexContent;
|
||||
options = $.extend({}, vex.defaultOptions, dialog.defaultOptions, options);
|
||||
options.content = dialog.buildDialogForm(options);
|
||||
options.beforeClose = function($vexContent) {
|
||||
return options.callback($vexContent.data().vex.value);
|
||||
};
|
||||
$vexContent = vex.open(options);
|
||||
if (options.focusFirstInput) {
|
||||
$vexContent.find('input[type="submit"], textarea, input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="email"], input[type="month"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="time"], input[type="url"], input[type="week"]').first().focus();
|
||||
}
|
||||
return $vexContent;
|
||||
};
|
||||
dialog.alert = function(options) {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
message: options
|
||||
};
|
||||
}
|
||||
options = $.extend({}, dialog.defaultAlertOptions, options);
|
||||
return dialog.open(options);
|
||||
};
|
||||
dialog.confirm = function(options) {
|
||||
if (typeof options === 'string') {
|
||||
return $.error('dialog.confirm(options) requires options.callback.');
|
||||
}
|
||||
options = $.extend({}, dialog.defaultConfirmOptions, options);
|
||||
return dialog.open(options);
|
||||
};
|
||||
dialog.prompt = function(options) {
|
||||
var defaultPromptOptions;
|
||||
if (typeof options === 'string') {
|
||||
return $.error('dialog.prompt(options) requires options.callback.');
|
||||
}
|
||||
defaultPromptOptions = {
|
||||
message: "<label for=\"vex\">" + (options.label || 'Prompt:') + "</label>",
|
||||
input: "<input name=\"vex\" type=\"text\" class=\"vex-dialog-prompt-input\" placeholder=\"" + (options.placeholder || '') + "\" value=\"" + (options.value || '') + "\" />"
|
||||
};
|
||||
options = $.extend({}, defaultPromptOptions, options);
|
||||
return dialog.open(options);
|
||||
};
|
||||
dialog.buildDialogForm = function(options) {
|
||||
var $form, $input, $message;
|
||||
$form = $('<form class="vex-dialog-form" />');
|
||||
$message = $('<div class="vex-dialog-message" />');
|
||||
$input = $('<div class="vex-dialog-input" />');
|
||||
$form.append($message.append(options.message)).append($input.append(options.input)).append(dialog.buttonsToDOM(options.buttons)).bind('submit.vex', options.onSubmit);
|
||||
return $form;
|
||||
};
|
||||
dialog.getFormValueOnSubmit = function(formData) {
|
||||
if (formData.vex || formData.vex === '') {
|
||||
if (formData.vex === '_vex-empty-value') {
|
||||
return true;
|
||||
}
|
||||
return formData.vex;
|
||||
} else {
|
||||
return formData;
|
||||
}
|
||||
};
|
||||
dialog.buttonsToDOM = function(buttons) {
|
||||
var $buttons;
|
||||
$buttons = $('<div class="vex-dialog-buttons" />');
|
||||
$.each(buttons, function(index, button) {
|
||||
return $buttons.append($("<input type=\"" + button.type + "\" />").val(button.text).addClass(button.className + ' vex-dialog-button ' + (index === 0 ? 'vex-first ' : '') + (index === buttons.length - 1 ? 'vex-last ' : '')).bind('click.vex', function(e) {
|
||||
if (button.click) {
|
||||
return button.click($(this).parents("." + vex.baseClassNames.content), e);
|
||||
}
|
||||
}));
|
||||
});
|
||||
return $buttons;
|
||||
};
|
||||
return dialog;
|
||||
};
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery', 'vex'], vexDialogFactory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = vexDialogFactory(require('jquery'), require('vex'));
|
||||
} else {
|
||||
window.vex.dialog = vexDialogFactory(window.jQuery, window.vex);
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
2
theme-old/js/vendor/vex/vex.dialog.min.js
vendored
Normal file
2
theme-old/js/vendor/vex/vex.dialog.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/*! vex.dialog.js 2.1.1 */
|
||||
(function(){var a;a=function(a,b){var c,d;return null==b?a.error("Vex is required to use vex.dialog"):(c=function(b){var c;return c={},a.each(b.serializeArray(),function(){return c[this.name]?(c[this.name].push||(c[this.name]=[c[this.name]]),c[this.name].push(this.value||"")):c[this.name]=this.value||""}),c},d={},d.buttons={YES:{text:"OK",type:"submit",className:"vex-dialog-button-primary"},NO:{text:"Cancel",type:"button",className:"vex-dialog-button-secondary",click:function(a){return a.data().vex.value=!1,b.close(a.data().vex.id)}}},d.defaultOptions={callback:function(){},afterOpen:function(){},message:"Message",input:'<input name="vex" type="hidden" value="_vex-empty-value" />',value:!1,buttons:[d.buttons.YES,d.buttons.NO],showCloseButton:!1,onSubmit:function(e){var f,g;return f=a(this),g=f.parent(),e.preventDefault(),e.stopPropagation(),g.data().vex.value=d.getFormValueOnSubmit(c(f)),b.close(g.data().vex.id)},focusFirstInput:!0},d.defaultAlertOptions={message:"Alert",buttons:[d.buttons.YES]},d.defaultConfirmOptions={message:"Confirm"},d.open=function(c){var e;return c=a.extend({},b.defaultOptions,d.defaultOptions,c),c.content=d.buildDialogForm(c),c.beforeClose=function(a){return c.callback(a.data().vex.value)},e=b.open(c),c.focusFirstInput&&e.find('input[type="submit"], textarea, input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="email"], input[type="month"], input[type="number"], input[type="password"], input[type="search"], input[type="tel"], input[type="text"], input[type="time"], input[type="url"], input[type="week"]').first().focus(),e},d.alert=function(b){return"string"==typeof b&&(b={message:b}),b=a.extend({},d.defaultAlertOptions,b),d.open(b)},d.confirm=function(b){return"string"==typeof b?a.error("dialog.confirm(options) requires options.callback."):(b=a.extend({},d.defaultConfirmOptions,b),d.open(b))},d.prompt=function(b){var c;return"string"==typeof b?a.error("dialog.prompt(options) requires options.callback."):(c={message:'<label for="vex">'+(b.label||"Prompt:")+"</label>",input:'<input name="vex" type="text" class="vex-dialog-prompt-input" placeholder="'+(b.placeholder||"")+'" value="'+(b.value||"")+'" />'},b=a.extend({},c,b),d.open(b))},d.buildDialogForm=function(b){var c,e,f;return c=a('<form class="vex-dialog-form" />'),f=a('<div class="vex-dialog-message" />'),e=a('<div class="vex-dialog-input" />'),c.append(f.append(b.message)).append(e.append(b.input)).append(d.buttonsToDOM(b.buttons)).bind("submit.vex",b.onSubmit),c},d.getFormValueOnSubmit=function(a){return a.vex||""===a.vex?"_vex-empty-value"===a.vex?!0:a.vex:a},d.buttonsToDOM=function(c){var d;return d=a('<div class="vex-dialog-buttons" />'),a.each(c,function(e,f){return d.append(a('<input type="'+f.type+'" />').val(f.text).addClass(f.className+" vex-dialog-button "+(0===e?"vex-first ":"")+(e===c.length-1?"vex-last ":"")).bind("click.vex",function(c){return f.click?f.click(a(this).parents("."+b.baseClassNames.content),c):void 0}))}),d},d)},"function"==typeof define&&define.amd?define(["jquery","vex"],a):"object"==typeof exports?module.exports=a(require("jquery"),require("vex")):window.vex.dialog=a(window.jQuery,window.vex)}).call(this);
|
||||
190
theme-old/js/vendor/vex/vex.js
vendored
Normal file
190
theme-old/js/vendor/vex/vex.js
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
(function() {
|
||||
var vexFactory;
|
||||
|
||||
vexFactory = function($) {
|
||||
var animationEndSupport, vex;
|
||||
animationEndSupport = false;
|
||||
$(function() {
|
||||
var s;
|
||||
s = (document.body || document.documentElement).style;
|
||||
animationEndSupport = s.animation !== void 0 || s.WebkitAnimation !== void 0 || s.MozAnimation !== void 0 || s.MsAnimation !== void 0 || s.OAnimation !== void 0;
|
||||
return $(window).bind('keyup.vex', function(event) {
|
||||
if (event.keyCode === 27) {
|
||||
return vex.closeByEscape();
|
||||
}
|
||||
});
|
||||
});
|
||||
return vex = {
|
||||
globalID: 1,
|
||||
animationEndEvent: 'animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend',
|
||||
baseClassNames: {
|
||||
vex: 'vex',
|
||||
content: 'vex-content',
|
||||
overlay: 'vex-overlay',
|
||||
close: 'vex-close',
|
||||
closing: 'vex-closing',
|
||||
open: 'vex-open'
|
||||
},
|
||||
defaultOptions: {
|
||||
content: '',
|
||||
showCloseButton: true,
|
||||
escapeButtonCloses: true,
|
||||
overlayClosesOnClick: true,
|
||||
appendLocation: 'body',
|
||||
className: '',
|
||||
css: {},
|
||||
overlayClassName: '',
|
||||
overlayCSS: {},
|
||||
contentClassName: '',
|
||||
contentCSS: {},
|
||||
closeClassName: '',
|
||||
closeCSS: {}
|
||||
},
|
||||
open: function(options) {
|
||||
options = $.extend({}, vex.defaultOptions, options);
|
||||
options.id = vex.globalID;
|
||||
vex.globalID += 1;
|
||||
options.$vex = $('<div>').addClass(vex.baseClassNames.vex).addClass(options.className).css(options.css).data({
|
||||
vex: options
|
||||
});
|
||||
options.$vexOverlay = $('<div>').addClass(vex.baseClassNames.overlay).addClass(options.overlayClassName).css(options.overlayCSS).data({
|
||||
vex: options
|
||||
});
|
||||
if (options.overlayClosesOnClick) {
|
||||
options.$vexOverlay.bind('click.vex', function(e) {
|
||||
if (e.target !== this) {
|
||||
return;
|
||||
}
|
||||
return vex.close($(this).data().vex.id);
|
||||
});
|
||||
}
|
||||
options.$vex.append(options.$vexOverlay);
|
||||
options.$vexContent = $('<div>').addClass(vex.baseClassNames.content).addClass(options.contentClassName).css(options.contentCSS).append(options.content).data({
|
||||
vex: options
|
||||
});
|
||||
options.$vex.append(options.$vexContent);
|
||||
if (options.showCloseButton) {
|
||||
options.$closeButton = $('<div>').addClass(vex.baseClassNames.close).addClass(options.closeClassName).css(options.closeCSS).data({
|
||||
vex: options
|
||||
}).bind('click.vex', function() {
|
||||
return vex.close($(this).data().vex.id);
|
||||
});
|
||||
options.$vexContent.append(options.$closeButton);
|
||||
}
|
||||
$(options.appendLocation).append(options.$vex);
|
||||
vex.setupBodyClassName(options.$vex);
|
||||
if (options.afterOpen) {
|
||||
options.afterOpen(options.$vexContent, options);
|
||||
}
|
||||
setTimeout((function() {
|
||||
return options.$vexContent.trigger('vexOpen', options);
|
||||
}), 0);
|
||||
return options.$vexContent;
|
||||
},
|
||||
getAllVexes: function() {
|
||||
return $("." + vex.baseClassNames.vex + ":not(\"." + vex.baseClassNames.closing + "\") ." + vex.baseClassNames.content);
|
||||
},
|
||||
getVexByID: function(id) {
|
||||
return vex.getAllVexes().filter(function() {
|
||||
return $(this).data().vex.id === id;
|
||||
});
|
||||
},
|
||||
close: function(id) {
|
||||
var $lastVex;
|
||||
if (!id) {
|
||||
$lastVex = vex.getAllVexes().last();
|
||||
if (!$lastVex.length) {
|
||||
return false;
|
||||
}
|
||||
id = $lastVex.data().vex.id;
|
||||
}
|
||||
return vex.closeByID(id);
|
||||
},
|
||||
closeAll: function() {
|
||||
var ids;
|
||||
ids = vex.getAllVexes().map(function() {
|
||||
return $(this).data().vex.id;
|
||||
}).toArray();
|
||||
if (!(ids != null ? ids.length : void 0)) {
|
||||
return false;
|
||||
}
|
||||
$.each(ids.reverse(), function(index, id) {
|
||||
return vex.closeByID(id);
|
||||
});
|
||||
return true;
|
||||
},
|
||||
closeByID: function(id) {
|
||||
var $vex, $vexContent, beforeClose, close, options;
|
||||
$vexContent = vex.getVexByID(id);
|
||||
if (!$vexContent.length) {
|
||||
return;
|
||||
}
|
||||
$vex = $vexContent.data().vex.$vex;
|
||||
options = $.extend({}, $vexContent.data().vex);
|
||||
beforeClose = function() {
|
||||
if (options.beforeClose) {
|
||||
return options.beforeClose($vexContent, options);
|
||||
}
|
||||
};
|
||||
close = function() {
|
||||
$vexContent.trigger('vexClose', options);
|
||||
$vex.remove();
|
||||
$('body').trigger('vexAfterClose', options);
|
||||
if (options.afterClose) {
|
||||
return options.afterClose($vexContent, options);
|
||||
}
|
||||
};
|
||||
if (animationEndSupport) {
|
||||
beforeClose();
|
||||
$vex.unbind(vex.animationEndEvent).bind(vex.animationEndEvent, function() {
|
||||
return close();
|
||||
}).addClass(vex.baseClassNames.closing);
|
||||
} else {
|
||||
beforeClose();
|
||||
close();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
closeByEscape: function() {
|
||||
var $lastVex, id, ids;
|
||||
ids = vex.getAllVexes().map(function() {
|
||||
return $(this).data().vex.id;
|
||||
}).toArray();
|
||||
if (!(ids != null ? ids.length : void 0)) {
|
||||
return false;
|
||||
}
|
||||
id = Math.max.apply(Math, ids);
|
||||
$lastVex = vex.getVexByID(id);
|
||||
if ($lastVex.data().vex.escapeButtonCloses !== true) {
|
||||
return false;
|
||||
}
|
||||
return vex.closeByID(id);
|
||||
},
|
||||
setupBodyClassName: function($vex) {
|
||||
return $('body').bind('vexOpen.vex', function() {
|
||||
return $('body').addClass(vex.baseClassNames.open);
|
||||
}).bind('vexAfterClose.vex', function() {
|
||||
if (!vex.getAllVexes().length) {
|
||||
return $('body').removeClass(vex.baseClassNames.open);
|
||||
}
|
||||
});
|
||||
},
|
||||
hideLoading: function() {
|
||||
return $('.vex-loading-spinner').remove();
|
||||
},
|
||||
showLoading: function() {
|
||||
vex.hideLoading();
|
||||
return $('body').append("<div class=\"vex-loading-spinner " + vex.defaultOptions.className + "\"></div>");
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(['jquery'], vexFactory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = vexFactory(require('jquery'));
|
||||
} else {
|
||||
window.vex = vexFactory(jQuery);
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
2
theme-old/js/vendor/vex/vex.min.js
vendored
Normal file
2
theme-old/js/vendor/vex/vex.min.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/*! vex.js 2.1.1 */
|
||||
(function(){var a;a=function(a){var b,c;return b=!1,a(function(){var d;return d=(document.body||document.documentElement).style,b=void 0!==d.animation||void 0!==d.WebkitAnimation||void 0!==d.MozAnimation||void 0!==d.MsAnimation||void 0!==d.OAnimation,a(window).bind("keyup.vex",function(a){return 27===a.keyCode?c.closeByEscape():void 0})}),c={globalID:1,animationEndEvent:"animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend",baseClassNames:{vex:"vex",content:"vex-content",overlay:"vex-overlay",close:"vex-close",closing:"vex-closing",open:"vex-open"},defaultOptions:{content:"",showCloseButton:!0,escapeButtonCloses:!0,overlayClosesOnClick:!0,appendLocation:"body",className:"",css:{},overlayClassName:"",overlayCSS:{},contentClassName:"",contentCSS:{},closeClassName:"",closeCSS:{}},open:function(b){return b=a.extend({},c.defaultOptions,b),b.id=c.globalID,c.globalID+=1,b.$vex=a("<div>").addClass(c.baseClassNames.vex).addClass(b.className).css(b.css).data({vex:b}),b.$vexOverlay=a("<div>").addClass(c.baseClassNames.overlay).addClass(b.overlayClassName).css(b.overlayCSS).data({vex:b}),b.overlayClosesOnClick&&b.$vexOverlay.bind("click.vex",function(b){return b.target===this?c.close(a(this).data().vex.id):void 0}),b.$vex.append(b.$vexOverlay),b.$vexContent=a("<div>").addClass(c.baseClassNames.content).addClass(b.contentClassName).css(b.contentCSS).append(b.content).data({vex:b}),b.$vex.append(b.$vexContent),b.showCloseButton&&(b.$closeButton=a("<div>").addClass(c.baseClassNames.close).addClass(b.closeClassName).css(b.closeCSS).data({vex:b}).bind("click.vex",function(){return c.close(a(this).data().vex.id)}),b.$vexContent.append(b.$closeButton)),a(b.appendLocation).append(b.$vex),c.setupBodyClassName(b.$vex),b.afterOpen&&b.afterOpen(b.$vexContent,b),setTimeout(function(){return b.$vexContent.trigger("vexOpen",b)},0),b.$vexContent},getAllVexes:function(){return a("."+c.baseClassNames.vex+':not(".'+c.baseClassNames.closing+'") .'+c.baseClassNames.content)},getVexByID:function(b){return c.getAllVexes().filter(function(){return a(this).data().vex.id===b})},close:function(a){var b;if(!a){if(b=c.getAllVexes().last(),!b.length)return!1;a=b.data().vex.id}return c.closeByID(a)},closeAll:function(){var b;return b=c.getAllVexes().map(function(){return a(this).data().vex.id}).toArray(),(null!=b?b.length:void 0)?(a.each(b.reverse(),function(a,b){return c.closeByID(b)}),!0):!1},closeByID:function(d){var e,f,g,h,i;return f=c.getVexByID(d),f.length?(e=f.data().vex.$vex,i=a.extend({},f.data().vex),g=function(){return i.beforeClose?i.beforeClose(f,i):void 0},h=function(){return f.trigger("vexClose",i),e.remove(),a("body").trigger("vexAfterClose",i),i.afterClose?i.afterClose(f,i):void 0},b?(g(),e.unbind(c.animationEndEvent).bind(c.animationEndEvent,function(){return h()}).addClass(c.baseClassNames.closing)):(g(),h()),!0):void 0},closeByEscape:function(){var b,d,e;return e=c.getAllVexes().map(function(){return a(this).data().vex.id}).toArray(),(null!=e?e.length:void 0)?(d=Math.max.apply(Math,e),b=c.getVexByID(d),b.data().vex.escapeButtonCloses!==!0?!1:c.closeByID(d)):!1},setupBodyClassName:function(){return a("body").bind("vexOpen.vex",function(){return a("body").addClass(c.baseClassNames.open)}).bind("vexAfterClose.vex",function(){return c.getAllVexes().length?void 0:a("body").removeClass(c.baseClassNames.open)})},hideLoading:function(){return a(".vex-loading-spinner").remove()},showLoading:function(){return c.hideLoading(),a("body").append('<div class="vex-loading-spinner '+c.defaultOptions.className+'"></div>')}}},"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):window.vex=a(jQuery)}).call(this);
|
||||
Reference in New Issue
Block a user