Version 3.3.4
This commit is contained in:
1 parent
78706903a2
commit
fb6b5baabc
2206 files changed
+409828
-382984
No files matched your search
+378
-52
@@ -18,7 +18,7 @@ var ips = (function($){
|
||||
|
||||
jQ(document).ready(function() {
|
||||
ips.init();
|
||||
jQ("#app_menu").ipsMultiMenu();
|
||||
jQ("#app_menu").ipsMultiMenu( { keyboardTrigger: 77 } );
|
||||
sidebar.init();
|
||||
livesearch.init();
|
||||
});
|
||||
@@ -141,8 +141,10 @@ var livesearch = {}, sidebar = {};
|
||||
runSearch = function(){
|
||||
// Keep it going
|
||||
timeouts['show'] = setTimeout( runSearch, options.showDelay );
|
||||
|
||||
var curVal = $elem.val();
|
||||
|
||||
/* trim() is not chainable, throws error in IE8
|
||||
@link http://stackoverflow.com/questions/3439316/ie8-and-jquerys-trim */
|
||||
var curVal = $.trim( $elem.val() );
|
||||
var timeNow = new Date().getTime();
|
||||
|
||||
if ( options.lastPress && timeNow && ( ( timeNow - options.lastPress ) < 800 ) )
|
||||
@@ -174,7 +176,7 @@ var livesearch = {}, sidebar = {};
|
||||
else
|
||||
{
|
||||
$('#acp_loading').show();
|
||||
|
||||
|
||||
$.ajax( {
|
||||
url: ipb.vars['app_url'].replace( /&/g, '&' ) + "app=core&module=ajax§ion=livesearch&do=search&secure_key=" + ipb.vars['md5_hash'],
|
||||
type: 'POST',
|
||||
@@ -329,6 +331,66 @@ var livesearch = {}, sidebar = {};
|
||||
}
|
||||
}(jQuery);
|
||||
|
||||
/****************************************/
|
||||
/* Changes checkboxes into button toggles */
|
||||
/****************************************/
|
||||
$.fn.ipsToggler = function(options) {
|
||||
var $$ = $(this);
|
||||
|
||||
//----------------------------------------------
|
||||
// Prepares this checkbox
|
||||
//----------------------------------------------
|
||||
var setup = function( elem ){
|
||||
var newElem = $('<span/>')
|
||||
.attr('id', elem.id + '_toggler')
|
||||
.addClass( options.baseClass )
|
||||
.html('<span>Toggle</span>')
|
||||
.data('original', elem );
|
||||
|
||||
if( elem.checked ){
|
||||
newElem
|
||||
.addClass( options.on.cssClass )
|
||||
.attr('title', options.on.title );
|
||||
} else {
|
||||
newElem
|
||||
.addClass( options.off.cssClass )
|
||||
.attr('title', options.off.title );
|
||||
}
|
||||
|
||||
$( elem )
|
||||
.hide()
|
||||
.before( newElem );
|
||||
|
||||
$( newElem )
|
||||
.click( function(e){
|
||||
if( $( this ).hasClass('on') ){
|
||||
$( elem ).removeAttr('checked');
|
||||
$( this )
|
||||
.removeClass('on')
|
||||
.addClass('off')
|
||||
.attr('title', options.off.title);
|
||||
} else {
|
||||
$( elem ).attr('checked', 'checked');
|
||||
$( this )
|
||||
.removeClass('off')
|
||||
.addClass('on')
|
||||
.attr('title', options.off.title);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Event handler for the new toggle element
|
||||
//----------------------------------------------
|
||||
toggle = function(e){
|
||||
|
||||
};
|
||||
|
||||
return this.each(function(){
|
||||
setup( this );
|
||||
});
|
||||
};
|
||||
|
||||
/****************************************/
|
||||
/* Wizard bar (step by step) */
|
||||
/****************************************/
|
||||
@@ -447,61 +509,306 @@ var livesearch = {}, sidebar = {};
|
||||
};
|
||||
|
||||
/****************************************/
|
||||
/* Multi-level drop down menu */
|
||||
/* Multi-level drop down menu, with */
|
||||
/* keyboard navigation */
|
||||
/****************************************/
|
||||
$.fn.ipsMultiMenu = function(options) {
|
||||
$.fn.ipsMultiMenu = function(options) {
|
||||
var defaults = {
|
||||
speed: 'fast'
|
||||
},
|
||||
options = $.extend( defaults, options),
|
||||
useHoverIntent: true,
|
||||
},
|
||||
options = $.extend( defaults, options ),
|
||||
arrow = $("<span class='menu_arrow'>»</span>"),
|
||||
timeouts = {};
|
||||
|
||||
|
||||
// Private methods
|
||||
//----------------------------------------------
|
||||
// Mouse enter event
|
||||
//----------------------------------------------
|
||||
var mOver = function(e){
|
||||
if( $(this).data('timeout') ){
|
||||
clearTimeout( this.data('timeout') );
|
||||
$(this).data('timeout', false);
|
||||
clearTimeout( timeouts['menu'] );
|
||||
|
||||
if( !$(this).parent("ul").hasClass('root') && $(this).children('ul').length ){
|
||||
positionSubmenu( $(this) );
|
||||
}
|
||||
|
||||
var w = ($(this).outerWidth() - 5),
|
||||
children = $(this).children('ul:first'),
|
||||
docSize = $(window).width();
|
||||
|
||||
if( !$(this).parent("ul").hasClass('root') ){
|
||||
|
||||
children.css('left', w).css('top', -20);
|
||||
|
||||
// jQuery can't get offset from hidden elements, so show, measure, then hide.
|
||||
children.show();
|
||||
var childW = children.outerWidth();
|
||||
var realLeft = children.offset().left + childW + 5;
|
||||
children.hide();
|
||||
|
||||
if( realLeft >= docSize ){
|
||||
children.css('left', 5 - childW );
|
||||
}
|
||||
}
|
||||
|
||||
// Check if it's too far off the screen
|
||||
//children.fadeIn( options.speed );
|
||||
$(this).children('ul:first').show();
|
||||
//var _this = this;
|
||||
//setTimeout( function(){ $(_this).children('ul:first').show() }, 150 );
|
||||
|
||||
// Hide any submenus belonging to siblings, then show the submenu for this item
|
||||
$(this).children('ul:first').fadeIn('fast').end().siblings().find('ul').fadeOut('fast');
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Mouse leave event
|
||||
//----------------------------------------------
|
||||
mOut = function(e){
|
||||
//$(this).children('ul:first').fadeOut( options.speed );
|
||||
var _this = this;
|
||||
var timeout = setTimeout( function(){ $(_this).children('ul:first').hide() }, 250 );
|
||||
this.data('timeout', timeout);
|
||||
var self = this;
|
||||
timeouts['menu'] = setTimeout(
|
||||
function(){
|
||||
$(self).children('ul:first').fadeOut('fast');
|
||||
}, 800
|
||||
);
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Positions a menu according to its parent
|
||||
//----------------------------------------------
|
||||
positionSubmenu = function( menu ){
|
||||
var w = ( $(menu).outerWidth() - 5 ),
|
||||
children = $(menu).children('ul:first'),
|
||||
docSize = $(window).width();
|
||||
|
||||
children.css('left', w).css('top', -5);
|
||||
|
||||
// jQuery can't get offset from hidden elements, so show, measure, then hide.
|
||||
children.show();
|
||||
var childW = children.outerWidth();
|
||||
var realLeft = children.offset().left + childW + 5;
|
||||
children.hide();
|
||||
|
||||
if( realLeft >= docSize ){
|
||||
children.css('left', 5 - childW );
|
||||
}
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Main entry point for keydown event
|
||||
//----------------------------------------------
|
||||
kPress = function( e, menu ){
|
||||
e.preventDefault();
|
||||
|
||||
var active = findActiveItem( menu );
|
||||
|
||||
switch( e.keyCode ){
|
||||
case 37: // Left
|
||||
return move.left( $(active) );
|
||||
break;
|
||||
case 39: // Right
|
||||
return move.right( $(active) );
|
||||
break;
|
||||
case 38: // Up
|
||||
return move.up( $(active) );
|
||||
break;
|
||||
case 40: // Down
|
||||
return move.down( $(active) );
|
||||
break;
|
||||
case 32: // Space
|
||||
case 13: // Enter
|
||||
return move.select( $(active) );
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
move = {
|
||||
//----------------------------------------------
|
||||
// Handles selecting an item
|
||||
//----------------------------------------------
|
||||
select: function( active )
|
||||
{
|
||||
if( active.children('a').length ){
|
||||
window.location = active.children('a:first').attr('href');
|
||||
}
|
||||
else if( active.children('ul') ){
|
||||
window.location = active.children('ul').find('a:first').attr('href');
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Handles LEFT key
|
||||
//----------------------------------------------
|
||||
left: function( active ){
|
||||
|
||||
// If we're in a sub menu, pressing left should close the sub menu
|
||||
if( !active.parent('ul').is('.root') && !active.parent('ul').is('.root > li > ul') ){
|
||||
active
|
||||
.parent('ul')
|
||||
.find('.current')
|
||||
.removeClass('current')
|
||||
.end()
|
||||
.hide();
|
||||
}
|
||||
// If we're in an app menu, and there's a previous app, we'll show that one
|
||||
else if( active.parent('ul').is('.root > li > ul') && active.parent('ul').parent('li').prev().length ) {
|
||||
active
|
||||
.children('ul')
|
||||
.hide()
|
||||
.end()
|
||||
.removeClass('current')
|
||||
.prev()
|
||||
.addClass('current')
|
||||
.children('ul:first')
|
||||
.show();
|
||||
|
||||
}
|
||||
return false;
|
||||
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Handles RIGHT key
|
||||
//----------------------------------------------
|
||||
right: function( active ){
|
||||
|
||||
// If what we have highlighed has a sub menu, show that submenu
|
||||
if( !active.parent().is('.root') && active.has('ul:hidden').length ){
|
||||
positionSubmenu( active );
|
||||
active.children('ul').show().find('li:first').addClass('current');
|
||||
}
|
||||
else {
|
||||
// If we've got something highlighted, and it's in a root app menu, we
|
||||
// close the menu and show the next root app menu instead
|
||||
if( active.parent('ul').is('.root > li > ul') && active.parent('ul').parent('li').next().length ){
|
||||
active
|
||||
.parent('ul')
|
||||
.find('.current')
|
||||
.removeClass('current')
|
||||
.hide()
|
||||
.end()
|
||||
.hide()
|
||||
.parent('li')
|
||||
.removeClass('current')
|
||||
.next()
|
||||
.addClass('current')
|
||||
.children('ul:first')
|
||||
.show();
|
||||
}
|
||||
// If no menu is open but a root app menu is highlighted,
|
||||
// we'll show the next root app
|
||||
else if( active.parent('ul').is('.root') && active.next().length ){
|
||||
active
|
||||
.children('ul')
|
||||
.hide()
|
||||
.end()
|
||||
.removeClass('current')
|
||||
.next()
|
||||
.addClass('current')
|
||||
.children('ul:first')
|
||||
.show();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Handles UP key
|
||||
//----------------------------------------------
|
||||
up: function( active ){
|
||||
// Go up an item, if we can
|
||||
if( active.prev().length ){
|
||||
active.removeClass('current').prev().addClass('current');
|
||||
} else {
|
||||
// If not, and this is a root app menu, hide the menu and
|
||||
// make the root item active
|
||||
if( active.parent().is('.root > li > ul') ){
|
||||
active
|
||||
.removeClass('current')
|
||||
.parent()
|
||||
.hide();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Handles DOWN key
|
||||
//----------------------------------------------
|
||||
down: function( active ){
|
||||
// If this is a root app menu...
|
||||
if( active.is('.root > li') ){
|
||||
// ...check whether the menu is already shown, and select the first li
|
||||
if( active.children('ul:first').is(':visible') ){
|
||||
active.find('ul:first > li:first').addClass('current');
|
||||
} else {
|
||||
// ...if it isn't visible, show it
|
||||
active.find('>ul').show();
|
||||
}
|
||||
} else {
|
||||
if( active.next().length ){
|
||||
active.removeClass('current').next().addClass('current');
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Finds the deepest currently active menu item
|
||||
//----------------------------------------------
|
||||
findActiveItem = function( menu ){
|
||||
return $('.current:visible', menu).last();
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Hover event to highlight an item
|
||||
//----------------------------------------------
|
||||
highlight = function( e ){
|
||||
$(this)
|
||||
.addClass('current')
|
||||
.siblings()
|
||||
.removeClass('current')
|
||||
.parents('li')
|
||||
.addClass('current')
|
||||
.siblings()
|
||||
.find('li')
|
||||
.removeClass('current');
|
||||
},
|
||||
|
||||
//----------------------------------------------
|
||||
// Unhighlights an item
|
||||
//----------------------------------------------
|
||||
unhighlight = function( e ){
|
||||
$(this).removeClass('current');
|
||||
};
|
||||
|
||||
return this.each(function(){
|
||||
// Hide all UL
|
||||
$(this).addClass('root');
|
||||
$("ul", this).hide();
|
||||
$("li:has(ul)", this).hover(mOver, mOut).not('.root > li').addClass('has_sub').children("a,span").append(arrow.clone());
|
||||
});
|
||||
};
|
||||
|
||||
//----------------------------------------------
|
||||
// Main item loop
|
||||
//----------------------------------------------
|
||||
return this.each( function(elem){
|
||||
var self = this;
|
||||
|
||||
$(self).addClass('root');
|
||||
$("ul", self).hide();
|
||||
|
||||
$("li", self).hover( highlight, unhighlight );
|
||||
|
||||
$("li", self)[ ( $.fn.hoverIntent && options.useHoverIntent ) ? 'hoverIntent' : 'hover' ]( mOver, mOut )
|
||||
.filter(':has(ul)')
|
||||
.not('.root > li')
|
||||
.addClass('has_sub')
|
||||
.children("a,span")
|
||||
.append( arrow.clone() );
|
||||
|
||||
// Prepare event for keyboard navigation
|
||||
$(document).keydown( function(e){
|
||||
if( options.keyboardTrigger ){
|
||||
// If the user presses the trigger key & ctrl & alt
|
||||
if( e.keyCode == options.keyboardTrigger && e.ctrlKey && e.altKey ){
|
||||
// Show the first menu if nothing is open
|
||||
if( !$('.current', self).length ){
|
||||
$('.root > li:first')
|
||||
.addClass('current')
|
||||
.children('ul:first')
|
||||
.show()
|
||||
.children('li:first')
|
||||
.addClass('current');
|
||||
}
|
||||
// or close everything if something was open
|
||||
else {
|
||||
$( self )
|
||||
.find('.current')
|
||||
.removeClass('current')
|
||||
.end()
|
||||
.find('ul')
|
||||
.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle navigational keypresses
|
||||
if( $('.current', self).length ){
|
||||
kPress( e, self );
|
||||
}
|
||||
});
|
||||
})
|
||||
};
|
||||
|
||||
/****************************************/
|
||||
/* Sortable */
|
||||
@@ -572,6 +879,11 @@ var livesearch = {}, sidebar = {};
|
||||
{
|
||||
Debug.write("Sortable update successfully posted");
|
||||
}
|
||||
|
||||
if ( ! Object.isUndefined( o['postUpdateProcess'] ) )
|
||||
{
|
||||
o['postUpdateProcess']( data );
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
alert( ipb.lang['session_timed_out'] );
|
||||
@@ -614,9 +926,13 @@ var livesearch = {}, sidebar = {};
|
||||
.removeClass("active");
|
||||
|
||||
// Animate tab content
|
||||
$("#tab_" + curID + "_content").fadeOut();
|
||||
/*$("#tab_" + curID + "_content").fadeOut();
|
||||
$( options['tabWrap'] ).animate();
|
||||
$("#tab_" + newID + "_content").fadeIn();
|
||||
$("#tab_" + newID + "_content").fadeIn();*/
|
||||
|
||||
$("#tab_" + curID + "_content").hide();
|
||||
$( options['tabWrap'] ).animate();
|
||||
$("#tab_" + newID + "_content").show();
|
||||
},
|
||||
scrollTabs = function(e){
|
||||
var tar = $(e.target);
|
||||
@@ -703,3 +1019,13 @@ var livesearch = {}, sidebar = {};
|
||||
};
|
||||
|
||||
}(jQuery));
|
||||
|
||||
/**
|
||||
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
|
||||
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
|
||||
*
|
||||
* @param f onMouseOver function || An object with configuration options
|
||||
* @param g onMouseOut function || Nothing (use configuration options object)
|
||||
* @author Brian Cherne brian(at)cherne(dot)net
|
||||
*/
|
||||
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);
|
||||
Reference in new issue
Block a user