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 distanceToMoveFriendsPicker_container;
28 var friendsPickerNavigationWidth = 0;
32 container.each(
function(
i) {
34 $(
this).before(
"<div class='friends-picker-navigation-l' id='friends-picker-navigation-l" + iterator +
"'><a href='#'>Left</a><\/div>");
35 $(
this).after(
"<div class='friends-picker-navigation-r' id='friends-picker-navigation-r" + iterator +
"'><a href='#'>Right</a><\/div>");
38 $(
this).before(
"<div class='friends-picker-navigation' id='friends-picker-navigation" + iterator +
"'><ul><\/ul><\/div>");
39 $(
this).find(
"div.panel").each(
function(individualTabItemNumber) {
40 $(
"div#friends-picker-navigation" + iterator +
" ul").append(
"<li class='tab" + (individualTabItemNumber+1) +
"'><a href='#" + (individualTabItemNumber+1) +
"'>" + $(
this).attr(
"title") +
"<\/a><\/li>");
44 $(
"div#friends-picker-navigation" + iterator +
" a").each(
function(individualTabItemNumber) {
46 friendsPickerNavigationWidth += $(
this).parent().width();
48 $(
this).bind(
"click",
function() {
49 $(
this).addClass(
"current").parent().parent().find(
"a").not($(
this)).removeClass(
"current");
50 distanceToMoveFriendsPicker_container = - (panelWidth*individualTabItemNumber);
51 currentPanel = individualTabItemNumber + 1;
52 $(
this).parent().parent().parent().next().find(
"div.friends-picker-container").animate({
left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc);
57 $(
"div#friends-picker-navigation-r" + iterator +
" a").
click(
function() {
58 if (currentPanel == panelCount) {
59 distanceToMoveFriendsPicker_container = 0;
61 $(
this).parent().parent().find(
"div.friends-picker-navigation a.current").removeClass(
"current").parent().parent().find(
"a:eq(0)").addClass(
"current");
63 distanceToMoveFriendsPicker_container = - (panelWidth*currentPanel);
65 $(
this).parent().parent().find(
"div.friends-picker-navigation a.current").removeClass(
"current").parent().next().find(
"a").addClass(
"current");
67 $(
this).parent().parent().find(
"div.friends-picker-container").animate({
left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc);
72 $(
"div#friends-picker-navigation-l" + iterator +
" a").
click(
function() {
73 if (currentPanel == 1) {
74 distanceToMoveFriendsPicker_container = - (panelWidth*(panelCount - 1));
75 currentPanel = panelCount;
76 $(
this).parent().parent().find(
"div.friends-picker-navigation a.current").removeClass(
"current").parent().parent().find(
"li:last a").addClass(
"current");
79 distanceToMoveFriendsPicker_container = - (panelWidth*(currentPanel - 1));
80 $(
this).parent().parent().find(
"div.friends-picker-navigation a.current").removeClass(
"current").parent().prev().find(
"a").addClass(
"current");
82 $(
this).parent().parent().find(
"div.friends-picker-container").animate({
left: distanceToMoveFriendsPicker_container}, settings.easeTime, settings.easeFunc);
87 $(
"div#friends-picker-navigation" + iterator +
" a:eq(0)").addClass(
"current");
90 $(
"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