7 jQuery.fn.friendsPicker =
function(iterator) {
10 settings = $.extend({ easeFunc:
"easeOutExpo", easeTime: 1000, toolTip:
false },
settings);
12 return this.each(
function() {
15 container.addClass(
"friends-picker");
20 var panelCount = container.find(
"div.panel").size();
22 var friendsPicker_containerWidth = panelWidth*panelCount;
24 container.find(
"div.friends-picker-container").css(
"width" , friendsPicker_containerWidth);
27 var friendsPickerNavigationWidth = 0;
31 container.each(
function(
i) {
33 $(
this).before(
"<div class='friends-picker-navigation-l' id='friends-picker-navigation-l" + iterator +
"'><a href='#'>Left</a><\/div>");
34 $(
this).after(
"<div class='friends-picker-navigation-r' id='friends-picker-navigation-r" + iterator +
"'><a href='#'>Right</a><\/div>");
37 $(
this).before(
"<div class='friends-picker-navigation' id='friends-picker-navigation" + iterator +
"'><ul><\/ul><\/div>");
38 $(
this).find(
"div.panel").each(
function(individualTabItemNumber) {
39 $(
"div#friends-picker-navigation" + iterator +
" ul").append(
"<li class='tab" + (individualTabItemNumber+1) +
"'><a href='#" + (individualTabItemNumber+1) +
"'>" + $(
this).attr(
"title") +
"<\/a><\/li>");
43 $(
"div#friends-picker-navigation" + iterator +
" a").each(
function(individualTabItemNumber) {
45 friendsPickerNavigationWidth += $(
this).parent().width();
47 $(
this).bind(
"click",
function() {
48 $(
this).addClass(
"current").parent().parent().find(
"a").not($(
this)).removeClass(
"current");
49 var distanceToMoveFriendsPicker_container = - (panelWidth*individualTabItemNumber);
50 currentPanel = individualTabItemNumber + 1;
51 $(
this).parent().parent().parent().next().find(
"div.friends-picker-container").animate({
left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc);
56 $(
"div#friends-picker-navigation-r" + iterator +
" a").
click(
function() {
57 if (currentPanel == panelCount) {
58 var distanceToMoveFriendsPicker_container = 0;
60 $(
this).parent().parent().find(
"div.friends-picker-navigation a.current").removeClass(
"current").parent().parent().find(
"a:eq(0)").addClass(
"current");
62 var distanceToMoveFriendsPicker_container = - (panelWidth*currentPanel);
64 $(
this).parent().parent().find(
"div.friends-picker-navigation a.current").removeClass(
"current").parent().next().find(
"a").addClass(
"current");
66 $(
this).parent().parent().find(
"div.friends-picker-container").animate({
left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc);
71 $(
"div#friends-picker-navigation-l" + iterator +
" a").
click(
function() {
72 if (currentPanel == 1) {
73 var distanceToMoveFriendsPicker_container = - (panelWidth*(panelCount - 1));
74 currentPanel = panelCount;
75 $(
this).parent().parent().find(
"div.friends-picker-navigation a.current").removeClass(
"current").parent().parent().find(
"li:last a").addClass(
"current");
78 var distanceToMoveFriendsPicker_container = - (panelWidth*(currentPanel - 1));
79 $(
this).parent().parent().find(
"div.friends-picker-navigation a.current").removeClass(
"current").parent().prev().find(
"a").addClass(
"current");
81 $(
this).parent().parent().find(
"div.friends-picker-container").animate({
left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc);
86 $(
"div#friends-picker-navigation" + iterator +
" a:eq(0)").addClass(
"current");
89 $(
"div#friends-picker-navigation" + iterator).append(
"<br />");
function elgg combo checkbox click(function(){if($(this).is(':checked')){$(this).prev().attr('disabled', true);$(this).prev().val('');}else{$(this).prev().attr('disabled', false);}})
friends picker friends picker container