Changeset 3477
- Timestamp:
- 11/22/2010 08:45:14 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
-
bp-core/admin/bp-core-admin.php (modified) (1 diff)
-
bp-core/admin/bp-core-upgrade.php (modified) (1 diff)
-
bp-core/bp-core-widgets.php (modified) (1 diff)
-
bp-core/css/admin.css (modified) (1 diff)
-
bp-core/js/widget-members.js (modified) (1 diff)
-
bp-groups/bp-groups-widgets.php (modified) (1 diff)
-
bp-groups/js/widget-groups.js (modified) (1 diff)
-
bp-messages/bp-messages-cssjs.php (modified) (2 diffs)
-
bp-messages/css/autocomplete/jquery.autocompletefb.css (modified) (1 diff)
-
bp-messages/js/autocomplete/jquery.autocomplete.js (modified) (2 diffs)
-
bp-messages/js/autocomplete/jquery.autocompletefb.js (modified) (2 diffs)
-
bp-messages/js/autocomplete/jquery.dimensions.js (modified) (2 diffs)
-
bp-xprofile/admin/css/admin.css (modified) (1 diff)
-
bp-xprofile/admin/js/admin.js (modified) (1 diff)
-
bp-xprofile/bp-xprofile-cssjs.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/admin/bp-core-admin.php
r3443 r3477 262 262 263 263 function bp_core_add_admin_menu_styles() { 264 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', BP_PLUGIN_URL . '/bp-core/css/admin.css' ) ); 264 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 265 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', BP_PLUGIN_URL . '/bp-core/css/admin.dev.css' ) ); 266 else 267 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', BP_PLUGIN_URL . '/bp-core/css/admin.css' ) ); 268 265 269 wp_enqueue_script( 'thickbox' ); 266 270 wp_enqueue_style( 'thickbox' ); -
trunk/bp-core/admin/bp-core-upgrade.php
r3464 r3477 1276 1276 1277 1277 function bp_core_add_admin_menu_styles() { 1278 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( $path = '/buddypress' ) . '/bp-core/css/admin.css' ) ); 1278 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 1279 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( $path = '/buddypress' ) . '/bp-core/css/admin.dev.css' ) ); 1280 else 1281 wp_enqueue_style( 'bp-admin-css', apply_filters( 'bp_core_admin_css', plugins_url( $path = '/buddypress' ) . '/bp-core/css/admin.css' ) ); 1282 1279 1283 wp_enqueue_script( 'thickbox' ); 1280 1284 wp_enqueue_style( 'thickbox' ); -
trunk/bp-core/bp-core-widgets.php
r3426 r3477 16 16 parent::WP_Widget( false, $name = __( 'Members', 'buddypress' ), $widget_ops ); 17 17 18 if ( is_active_widget( false, false, $this->id_base ) ) 19 wp_enqueue_script( 'bp_core_widget_members-js', BP_PLUGIN_URL . '/bp-core/js/widget-members.js', array('jquery') ); 18 if ( is_active_widget( false, false, $this->id_base ) ) { 19 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 20 wp_enqueue_script( 'bp_core_widget_members-js', BP_PLUGIN_URL . '/bp-core/js/widget-members.dev.js', array( 'jquery' ) ); 21 else 22 wp_enqueue_script( 'bp_core_widget_members-js', BP_PLUGIN_URL . '/bp-core/js/widget-members.js', array( 'jquery' ) ); 23 } 20 24 } 21 25 -
trunk/bp-core/css/admin.css
r2863 r3477 1 div#bp-admin { 2 background: #fff; 3 margin: 25px 15px 25px 0; 4 padding: 20px; 5 -moz-border-radius: 6px; 6 -webkit-border-radius: 6px; 7 border-radius: 6px; 8 -moz-box-shadow: #eee 0 -1px 4px; 9 -webkit-box-shadow: #eee 0 -1px 4px; 10 -khtml-box-shadow: #eee 0 -1px 4px; 11 box-shadow: #eee 0 -1px 4px; 12 font-family: helvetica, arial, tahoma, sans-serif; 13 color: #555; 14 overflow: hidden; 15 min-width: 680px; 16 } 17 div#bp-admin p { line-height: 170%; } 18 19 div#bp-admin div#bp-admin-header { 20 height: 60px; 21 } 22 23 div#bp-admin h3, div#bp-admin h4 { 24 margin: 0; 25 } 26 div#bp-admin h2 { 27 font-family: helvetica, arial, tahoma, sans-serif; 28 color: #555; 29 font-style: normal; 30 font-weight: bold; 31 font-size: 22px; 32 } 33 34 div#bp-admin h3 { 35 text-indent: -999em; 36 overflow: hidden; 37 width: 212px; 38 height: 49px; 39 background: url( ../images/logo.gif ) top left no-repeat; 40 border-right: 1px solid #eee; 41 padding-right: 20px; 42 float: left; 43 } 44 45 div#bp-admin h4 { 46 padding-left: 20px; 47 font-size: 28px; 48 float: left; 49 margin: 17px 0 0 0; 50 } 51 52 div#bp-admin-nav { 53 background: #f0f0f0; 54 margin: 15px -19px 10px -19px; 55 padding: 8px 19px 0 19px; 56 height: 30px; 57 } 58 div#bp-admin-nav ol { 59 list-style-type: decimal; 60 margin: 0; 61 padding: 0; 62 } 63 div#bp-admin-nav ol li { 64 float: left; 65 margin: 0 10px 0 0; 66 color: #bbb; 67 } 68 div#bp-admin-nav ol li { 69 padding: 8px 12px; 70 display: block; 71 -moz-border-radius: 3px; 72 -webkit-border-radius: 3px; 73 border-radius: 3px; 74 text-decoration: none; 75 } 76 div#bp-admin-nav ol li.current { 77 background: #fff; 78 color: #555; 79 } 80 div#bp-admin-nav ol li span.complete { 81 background: url( ../images/completed.gif ) center left no-repeat; 82 padding: 6px; 83 } 84 85 div#bp-admin div.left-col, div#bp-admin div.right-col { 86 width: 323px; 87 float: left; 88 margin: 15px 30px 0 0; 89 } 90 div#bp-admin div.right-col { margin-right: 0; } 91 92 div.component { 93 width: 323px; 94 margin: 10px 0 40px 0; 95 } 96 div.component div.radio { 97 position: relative; 98 background: #f4f4f4; 99 padding: 5px 10px; 100 -moz-border-radius: 3px; 101 -webkit-border-radius: 3px; 102 border-radius: 3px; 103 top: -6px; 104 right: 10px; 105 } 106 107 div.component img { 108 margin-top: 2px; 109 } 110 111 div.component p { 112 margin-left: 4px; 113 } 114 115 div.component h5 { 116 font-size: 15px; 117 float: left; 118 margin: 0 0 0 4px; 119 } 120 121 div.component div.radio { 122 font-size: 11px; 123 float: right; 124 } 125 126 div#bp-admin div.prev-next, div#bp-admin div.prev-next p, 127 div#bp-admin div.submit, div#bp-admin div.submit p { 128 margin: 0; 129 padding: 0; 130 } 131 div#bp-admin div.submit { margin-top: 30px; } 132 div#bp-admin div.prev-next { text-align: right; margin-top: 0; } 133 134 div#bp-admin div.prev-next { 135 border-bottom: 1px solid #f0f0f0; 136 margin: 0 -20px; 137 padding: 0 20px 10px; 138 } 139 140 div#bp-admin table td { 141 font-family: helvetica, arial, tahoma, sans-serif; 142 } 143 144 div#bp-admin table.form-table th { 145 border-right: 1px solid #eee; 146 width: 208px; 147 padding: 15px 25px 15px 0; 148 color: #555; 149 } 150 div#bp-admin table.form-table tr { 151 border-bottom: 1px dotted #f0f0f0; 152 } 153 div#bp-admin table.form-table td { padding-left: 25px; font-size: 12px; } 154 155 div#bp-admin table.form-table th h5 { 156 font-size: 14px; 157 margin: 0; 158 line-height: 150%; 159 } 160 161 div#bp-admin table.form-table th img { 162 margin-top: 5px; 163 } 164 165 div#bp-admin table.form-table th p { margin: 3px 0 0 0; } 166 167 div#bp-admin code, div#bp-admin kbd { 168 font-size: 12px; 169 background: #f0f0f0; 170 } 171 172 div#bp-admin div#message code, div#bp-admin div#message kbd { 173 background: #ffe293; 174 } 175 176 a.button { 177 padding-top: 4px; 178 } 179 180 a.installed, a.installed:hover, a.installed:active { 181 padding-left: 15px; 182 color: #888; 183 border-color: #ccc; 184 cursor: default; 185 } 186 187 a.installed span { 188 background: url( ../images/installed.gif) left center no-repeat; 189 padding: 6px 10px 7px 6px; 190 margin-left: -5px; 191 } 1 div#bp-admin{background:#fff;margin:25px 15px 25px 0;padding:20px;-moz-border-radius:6px;-webkit-border-radius:6px;border-radius:6px;-moz-box-shadow:#eee 0 -1px 4px;-webkit-box-shadow:#eee 0 -1px 4px;-khtml-box-shadow:#eee 0 -1px 4px;box-shadow:#eee 0 -1px 4px;font-family:helvetica,arial,tahoma,sans-serif;color:#555;overflow:hidden;min-width:680px;}div#bp-admin p{line-height:170%;}div#bp-admin div#bp-admin-header{height:60px;}div#bp-admin h3,div#bp-admin h4{margin:0;}div#bp-admin h2{font-family:helvetica,arial,tahoma,sans-serif;color:#555;font-style:normal;font-weight:bold;font-size:22px;}div#bp-admin h3{text-indent:-999em;overflow:hidden;width:212px;height:49px;background:url(../images/logo.gif) top left no-repeat;border-right:1px solid #eee;padding-right:20px;float:left;}div#bp-admin h4{padding-left:20px;font-size:28px;float:left;margin:17px 0 0 0;}div#bp-admin-nav{background:#f0f0f0;margin:15px -19px 10px -19px;padding:8px 19px 0 19px;height:30px;}div#bp-admin-nav ol{list-style-type:decimal;margin:0;padding:0;}div#bp-admin-nav ol li{float:left;margin:0 10px 0 0;color:#bbb;}div#bp-admin-nav ol li{padding:8px 12px;display:block;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;text-decoration:none;}div#bp-admin-nav ol li.current{background:#fff;color:#555;}div#bp-admin-nav ol li span.complete{background:url(../images/completed.gif) center left no-repeat;padding:6px;}div#bp-admin div.left-col,div#bp-admin div.right-col{width:323px;float:left;margin:15px 30px 0 0;}div#bp-admin div.right-col{margin-right:0;}div.component{width:323px;margin:10px 0 40px 0;}div.component div.radio{position:relative;background:#f4f4f4;padding:5px 10px;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;top:-6px;right:10px;}div.component img{margin-top:2px;}div.component p{margin-left:4px;}div.component h5{font-size:15px;float:left;margin:0 0 0 4px;}div.component div.radio{font-size:11px;float:right;}div#bp-admin div.prev-next,div#bp-admin div.prev-next p,div#bp-admin div.submit,div#bp-admin div.submit p{margin:0;padding:0;}div#bp-admin div.submit{margin-top:30px;}div#bp-admin div.prev-next{text-align:right;margin-top:0;}div#bp-admin div.prev-next{border-bottom:1px solid #f0f0f0;margin:0 -20px;padding:0 20px 10px;}div#bp-admin table td{font-family:helvetica,arial,tahoma,sans-serif;}div#bp-admin table.form-table th{border-right:1px solid #eee;width:208px;padding:15px 25px 15px 0;color:#555;}div#bp-admin table.form-table tr{border-bottom:1px dotted #f0f0f0;}div#bp-admin table.form-table td{padding-left:25px;font-size:12px;}div#bp-admin table.form-table th h5{font-size:14px;margin:0;line-height:150%;}div#bp-admin table.form-table th img{margin-top:5px;}div#bp-admin table.form-table th p{margin:3px 0 0 0;}div#bp-admin code,div#bp-admin kbd{font-size:12px;background:#f0f0f0;}div#bp-admin div#message code,div#bp-admin div#message kbd{background:#ffe293;}a.button{padding-top:4px;}a.installed,a.installed:hover,a.installed:active{padding-left:15px;color:#888;border-color:#ccc;cursor:default;}a.installed span{background:url(../images/installed.gif) left center no-repeat;padding:6px 10px 7px 6px;margin-left:-5px;} -
trunk/bp-core/js/widget-members.js
r2444 r3477 1 jQuery(document).ready( function() { 2 jQuery(".widget div#members-list-options a").live('click', 3 function() { 4 jQuery('#ajax-loader-members').toggle(); 5 6 jQuery(".widget div#members-list-options a").removeClass("selected"); 7 jQuery(this).addClass('selected'); 8 9 jQuery.post( ajaxurl, { 10 action: 'widget_members', 11 'cookie': encodeURIComponent(document.cookie), 12 '_wpnonce': jQuery("input#_wpnonce-members").val(), 13 'max-members': jQuery("input#members_widget_max").val(), 14 'filter': jQuery(this).attr('id') 15 }, 16 function(response) 17 { 18 jQuery('#ajax-loader-members').toggle(); 19 member_wiget_response(response); 20 }); 21 22 return false; 23 } 24 ); 25 }); 26 27 function member_wiget_response(response) { 28 response = response.substr(0, response.length-1); 29 response = response.split('[[SPLIT]]'); 30 31 if ( response[0] != "-1" ) { 32 jQuery(".widget ul#members-list").fadeOut(200, 33 function() { 34 jQuery(".widget ul#members-list").html(response[1]); 35 jQuery(".widget ul#members-list").fadeIn(200); 36 } 37 ); 38 39 } else { 40 jQuery(".widget ul#members-list").fadeOut(200, 41 function() { 42 var message = '<p>' + response[1] + '</p>'; 43 jQuery(".widget ul#members-list").html(message); 44 jQuery(".widget ul#members-list").fadeIn(200); 45 } 46 ); 47 } 48 } 1 jQuery(document).ready(function(){jQuery(".widget div#members-list-options a").live("click",function(){jQuery("#ajax-loader-members").toggle();jQuery(".widget div#members-list-options a").removeClass("selected");jQuery(this).addClass("selected");jQuery.post(ajaxurl,{action:"widget_members",cookie:encodeURIComponent(document.cookie),_wpnonce:jQuery("input#_wpnonce-members").val(),"max-members":jQuery("input#members_widget_max").val(),filter:jQuery(this).attr("id")},function(a){jQuery("#ajax-loader-members").toggle();member_wiget_response(a)});return false})});function member_wiget_response(a){a=a.substr(0,a.length-1);a=a.split("[[SPLIT]]");if(a[0]!="-1"){jQuery(".widget ul#members-list").fadeOut(200,function(){jQuery(".widget ul#members-list").html(a[1]);jQuery(".widget ul#members-list").fadeIn(200)})}else{jQuery(".widget ul#members-list").fadeOut(200,function(){var b="<p>"+a[1]+"</p>";jQuery(".widget ul#members-list").html(b);jQuery(".widget ul#members-list").fadeIn(200)})}}; -
trunk/bp-groups/bp-groups-widgets.php
r3426 r3477 14 14 parent::WP_Widget( false, $name = __( 'Groups', 'buddypress' ), $widget_ops ); 15 15 16 if ( is_active_widget( false, false, $this->id_base ) ) 17 wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array('jquery') ); 16 if ( is_active_widget( false, false, $this->id_base ) ) { 17 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 18 wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.dev.js', array( 'jquery' ) ); 19 else 20 wp_enqueue_script( 'groups_widget_groups_list-js', BP_PLUGIN_URL . '/bp-groups/js/widget-groups.js', array( 'jquery' ) ); 21 } 18 22 } 19 23 -
trunk/bp-groups/js/widget-groups.js
r2444 r3477 1 jQuery(document).ready( function() { 2 jQuery(".widget div#groups-list-options a").live('click', 3 function() { 4 jQuery('#ajax-loader-groups').toggle(); 5 6 jQuery(".widget div#groups-list-options a").removeClass("selected"); 7 jQuery(this).addClass('selected'); 8 9 jQuery.post( ajaxurl, { 10 action: 'widget_groups_list', 11 'cookie': encodeURIComponent(document.cookie), 12 '_wpnonce': jQuery("input#_wpnonce-groups").val(), 13 'max_groups': jQuery("input#groups_widget_max").val(), 14 'filter': jQuery(this).attr('id') 15 }, 16 function(response) 17 { 18 jQuery('#ajax-loader-groups').toggle(); 19 groups_wiget_response(response); 20 }); 21 22 return false; 23 } 24 ); 25 }); 26 27 function groups_wiget_response(response) { 28 response = response.substr(0, response.length-1); 29 response = response.split('[[SPLIT]]'); 30 31 if ( response[0] != "-1" ) { 32 jQuery(".widget ul#groups-list").fadeOut(200, 33 function() { 34 jQuery(".widget ul#groups-list").html(response[1]); 35 jQuery(".widget ul#groups-list").fadeIn(200); 36 } 37 ); 38 39 } else { 40 jQuery(".widget ul#groups-list").fadeOut(200, 41 function() { 42 var message = '<p>' + response[1] + '</p>'; 43 jQuery(".widget ul#groups-list").html(message); 44 jQuery(".widget ul#groups-list").fadeIn(200); 45 } 46 ); 47 } 48 } 1 jQuery(document).ready(function(){jQuery(".widget div#groups-list-options a").live("click",function(){jQuery("#ajax-loader-groups").toggle();jQuery(".widget div#groups-list-options a").removeClass("selected");jQuery(this).addClass("selected");jQuery.post(ajaxurl,{action:"widget_groups_list",cookie:encodeURIComponent(document.cookie),_wpnonce:jQuery("input#_wpnonce-groups").val(),max_groups:jQuery("input#groups_widget_max").val(),filter:jQuery(this).attr("id")},function(a){jQuery("#ajax-loader-groups").toggle();groups_wiget_response(a)});return false})});function groups_wiget_response(a){a=a.substr(0,a.length-1);a=a.split("[[SPLIT]]");if(a[0]!="-1"){jQuery(".widget ul#groups-list").fadeOut(200,function(){jQuery(".widget ul#groups-list").html(a[1]);jQuery(".widget ul#groups-list").fadeIn(200)})}else{jQuery(".widget ul#groups-list").fadeOut(200,function(){var b="<p>"+a[1]+"</p>";jQuery(".widget ul#groups-list").html(b);jQuery(".widget ul#groups-list").fadeIn(200)})}}; -
trunk/bp-messages/bp-messages-cssjs.php
r3300 r3477 8 8 add_action( 'wp_head', 'messages_autocomplete_init_jsblock' ); 9 9 10 wp_enqueue_script( 'bp-jquery-autocomplete', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocomplete.js', array( 'jquery' ) ); 11 wp_enqueue_script( 'bp-jquery-autocomplete-fb', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocompletefb.js' ); 12 wp_enqueue_script( 'bp-jquery-bgiframe', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.bgiframe.min.js' ); 13 wp_enqueue_script( 'bp-jquery-dimensions', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.dimensions.js' ); 10 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) { 11 wp_enqueue_script( 'bp-jquery-autocomplete', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocomplete.dev.js', array( 'jquery' ) ); 12 wp_enqueue_script( 'bp-jquery-autocomplete-fb', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocompletefb.dev.js' ); 13 wp_enqueue_script( 'bp-jquery-bgiframe', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.bgiframe.min.js' ); 14 wp_enqueue_script( 'bp-jquery-dimensions', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.dimensions.dev.js' ); 15 16 } else { 17 wp_enqueue_script( 'bp-jquery-autocomplete', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocomplete.js', array( 'jquery' ) ); 18 wp_enqueue_script( 'bp-jquery-autocomplete-fb', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.autocompletefb.js' ); 19 wp_enqueue_script( 'bp-jquery-bgiframe', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.bgiframe.min.js' ); 20 wp_enqueue_script( 'bp-jquery-dimensions', BP_PLUGIN_URL . '/bp-messages/js/autocomplete/jquery.dimensions.js' ); 21 } 14 22 } 15 16 23 } 17 24 add_action( 'wp', 'messages_add_autocomplete_js', 2 ); … … 21 28 22 29 if ( $bp->current_component == $bp->messages->slug && 'compose' == $bp->current_action ) { 23 wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . '/bp-messages/css/autocomplete/jquery.autocompletefb.css' ); 30 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 31 wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . '/bp-messages/css/autocomplete/jquery.autocompletefb.dev.css' ); 32 else 33 wp_enqueue_style( 'bp-messages-autocomplete', BP_PLUGIN_URL . '/bp-messages/css/autocomplete/jquery.autocompletefb.css' ); 34 24 35 wp_print_styles(); 25 36 } -
trunk/bp-messages/css/autocomplete/jquery.autocompletefb.css
r3300 r3477 1 .ac_results { 2 padding: 0px; 3 overflow: hidden; 4 z-index: 99999; 5 background: #fff; 6 border: 1px solid #ccc; 7 -moz-border-radius-bottomleft: 3px; 8 -khtml-border-bottom-left-radius: 3px; 9 -webkit-border-bottom-left-radius: 3px; 10 border-bottom-left-radius: 3px; 11 -moz-border-radius-bottomright: 3px; 12 -khtml-border-bottom-right-radius: 3px; 13 -webkit-border-bottom-right-radius: 3px; 14 border-bottom-right-radius: 3px; 15 } 16 .ac_results ul { 17 width: 100%; 18 list-style-position: outside; 19 list-style: none; 20 padding: 0; 21 margin: 0; 22 } 23 24 .ac_results li { 25 margin: 0px; 26 padding: 5px 10px; 27 cursor: pointer; 28 display: block; 29 font-size: 1em; 30 line-height: 16px; 31 overflow: hidden; 32 } 33 .ac_results li img { 34 margin-right: 5px; 35 } 36 37 .ac_loading { 38 background : url('../../../bp-themes/bp-default/_inc/images/ajax-loader.gif') right center no-repeat; 39 } 40 41 .ac_odd { 42 background-color: #f0f0f0; 43 } 44 45 .ac_over { 46 background-color: #888; 47 color: #fff; 48 } 49 50 ul.acfb-holder { 51 margin : 0; 52 height : auto !important; 53 height : 1%; 54 overflow: hidden; 55 padding: 0; 56 list-style: none; 57 } 58 ul.acfb-holder li { 59 float : left; 60 margin : 0 5px 4px 0; 61 list-style-type: none; 62 } 63 64 ul.acfb-holder li.friend-tab { 65 border-radius : 3px; 66 -moz-border-radius : 3px; 67 -webkit-border-radius : 3px; 68 border : 1px solid #ffe7c7; 69 padding : 2px 7px 2px; 70 background : #FFF9DF; 71 font-size: 1em; 72 } 73 li.friend-tab img.avatar { 74 border-width: 2px !important; 75 vertical-align: middle; 76 } 77 78 li.friend-tab span.p { 79 padding-left: 5px; 80 font-size: 0.8em; 81 cursor: pointer; 82 } 83 84 input#send-to-input { width: 275px !important; } 85 1 .ac_results{padding:0;overflow:hidden;z-index:99999;background:#fff;border:1px solid #ccc;-moz-border-radius-bottomleft:3px;-khtml-border-bottom-left-radius:3px;-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-moz-border-radius-bottomright:3px;-khtml-border-bottom-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;}.ac_results ul{width:100%;list-style-position:outside;list-style:none;padding:0;margin:0;}.ac_results li{margin:0;padding:5px 10px;cursor:pointer;display:block;font-size:1em;line-height:16px;overflow:hidden;}.ac_results li img{margin-right:5px;}.ac_loading{background:url('../../../bp-themes/bp-default/_inc/images/ajax-loader.gif') right center no-repeat;}.ac_odd{background-color:#f0f0f0;}.ac_over{background-color:#888;color:#fff;}ul.acfb-holder{margin:0;height:auto!important;height:1%;overflow:hidden;padding:0;list-style:none;}ul.acfb-holder li{float:left;margin:0 5px 4px 0;list-style-type:none;}ul.acfb-holder li.friend-tab{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;border:1px solid #ffe7c7;padding:2px 7px 2px;background:#FFF9DF;font-size:1em;}li.friend-tab img.avatar{border-width:2px!important;vertical-align:middle;}li.friend-tab span.p{padding-left:5px;font-size:.8em;cursor:pointer;}input#send-to-input{width:275px!important;} -
trunk/bp-messages/js/autocomplete/jquery.autocomplete.js
r3476 r3477 1 /* !1 /* 2 2 * Autocomplete - jQuery plugin 1.0 Beta 3 3 * … … 11 11 * 12 12 */ 13 14 ;(function($) { 15 16 $.fn.extend({ 17 autocomplete: function(urlOrData, options) { 18 var isUrl = typeof urlOrData == "string"; 19 options = $.extend({}, $.Autocompleter.defaults, { 20 url: isUrl ? urlOrData : null, 21 data: isUrl ? null : urlOrData, 22 delay: isUrl ? $.Autocompleter.defaults.delay : 10, 23 max: options && !options.scroll ? 10 : 150 24 }, options); 25 26 // if highlight is set to false, replace it with a do-nothing function 27 options.highlight = options.highlight || function(value) { return value; }; 28 29 return this.each(function() { 30 new $.Autocompleter(this, options); 31 }); 32 }, 33 result: function(handler) { 34 return this.bind("result", handler); 35 }, 36 search: function(handler) { 37 return this.trigger("search", [handler]); 38 }, 39 flushCache: function() { 40 return this.trigger("flushCache"); 41 }, 42 setOptions: function(options){ 43 return this.trigger("setOptions", [options]); 44 }, 45 unautocomplete: function() { 46 return this.trigger("unautocomplete"); 47 } 48 }); 49 50 $.Autocompleter = function(input, options) { 51 52 var KEY = { 53 UP: 38, 54 DOWN: 40, 55 DEL: 46, 56 TAB: 9, 57 RETURN: 13, 58 ESC: 27, 59 COMMA: 188, 60 PAGEUP: 33, 61 PAGEDOWN: 34 62 }; 63 64 // Create $ object for input element 65 var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass); 66 67 var timeout; 68 var previousValue = ""; 69 var cache = $.Autocompleter.Cache(options); 70 var hasFocus = 0; 71 var lastKeyPressCode; 72 var config = { 73 mouseDownOnSelect: false 74 }; 75 var select = $.Autocompleter.Select(options, input, selectCurrent, config); 76 77 $input.keydown(function(event) { 78 // track last key pressed 79 lastKeyPressCode = event.keyCode; 80 switch(event.keyCode) { 81 82 case KEY.UP: 83 event.preventDefault(); 84 if ( select.visible() ) { 85 select.prev(); 86 } else { 87 onChange(0, true); 88 } 89 break; 90 91 case KEY.DOWN: 92 event.preventDefault(); 93 if ( select.visible() ) { 94 select.next(); 95 } else { 96 onChange(0, true); 97 } 98 break; 99 100 case KEY.PAGEUP: 101 event.preventDefault(); 102 if ( select.visible() ) { 103 select.pageUp(); 104 } else { 105 onChange(0, true); 106 } 107 break; 108 109 case KEY.PAGEDOWN: 110 event.preventDefault(); 111 if ( select.visible() ) { 112 select.pageDown(); 113 } else { 114 onChange(0, true); 115 } 116 break; 117 118 // matches also semicolon 119 case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA: 120 case KEY.TAB: 121 case KEY.RETURN: 122 if( selectCurrent() ){ 123 // make sure to blur off the current field 124 if( !options.multiple ) 125 $input.blur(); 126 event.preventDefault(); 127 $input.focus(); 128 } 129 break; 130 131 case KEY.ESC: 132 select.hide(); 133 break; 134 135 default: 136 clearTimeout(timeout); 137 timeout = setTimeout(onChange, options.delay); 138 break; 139 } 140 }).keypress(function() { 141 // having fun with opera - remove this binding and Opera submits the form when we select an entry via return 142 }).focus(function(){ 143 // track whether the field has focus, we shouldn't process any 144 // results if the field no longer has focus 145 hasFocus++; 146 }).blur(function() { 147 hasFocus = 0; 148 if (!config.mouseDownOnSelect) { 149 hideResults(); 150 } 151 }).click(function() { 152 // show select when clicking in a focused field 153 if ( hasFocus++ > 1 && !select.visible() ) { 154 onChange(0, true); 155 } 156 }).bind("search", function() { 157 // TODO why not just specifying both arguments? 158 var fn = (arguments.length > 1) ? arguments[1] : null; 159 function findValueCallback(q, data) { 160 var result; 161 if( data && data.length ) { 162 for (var i=0; i < data.length; i++) { 163 if( data[i].result.toLowerCase() == q.toLowerCase() ) { 164 result = data[i]; 165 break; 166 } 167 } 168 } 169 if( typeof fn == "function" ) fn(result); 170 else $input.trigger("result", result && [result.data, result.value]); 171 } 172 $.each(trimWords($input.val()), function(i, value) { 173 request(value, findValueCallback, findValueCallback); 174 }); 175 }).bind("flushCache", function() { 176 cache.flush(); 177 }).bind("setOptions", function() { 178 $.extend(options, arguments[1]); 179 // if we've updated the data, repopulate 180 if ( "data" in arguments[1] ) 181 cache.populate(); 182 }).bind("unautocomplete", function() { 183 select.unbind(); 184 $input.unbind(); 185 }); 186 187 188 function selectCurrent() { 189 var selected = select.selected(); 190 if( !selected ) 191 return false; 192 193 var v = selected.result; 194 previousValue = v; 195 196 if ( options.multiple ) { 197 var words = trimWords($input.val()); 198 if ( words.length > 1 ) { 199 v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v; 200 } 201 v += options.multipleSeparator; 202 } 203 204 $input.val(v); 205 hideResultsNow(); 206 $input.trigger("result", [selected.data, selected.value]); 207 return true; 208 } 209 210 function onChange(crap, skipPrevCheck) { 211 if( lastKeyPressCode == KEY.DEL ) { 212 select.hide(); 213 return; 214 } 215 216 var currentValue = $input.val(); 217 218 if ( !skipPrevCheck && currentValue == previousValue ) 219 return; 220 221 previousValue = currentValue; 222 223 currentValue = lastWord(currentValue); 224 if ( currentValue.length >= options.minChars) { 225 $input.addClass(options.loadingClass); 226 jQuery('.ajax-loader').show(); 227 if (!options.matchCase) 228 currentValue = currentValue.toLowerCase(); 229 request(currentValue, receiveData, hideResultsNow); 230 } else { 231 stopLoading(); 232 select.hide(); 233 } 234 }; 235 236 function trimWords(value) { 237 if ( !value ) { 238 return [""]; 239 } 240 var words = value.split( $.trim( options.multipleSeparator ) ); 241 var result = []; 242 $.each(words, function(i, value) { 243 if ( $.trim(value) ) 244 result[i] = $.trim(value); 245 }); 246 return result; 247 } 248 249 function lastWord(value) { 250 if ( !options.multiple ) 251 return value; 252 var words = trimWords(value); 253 return words[words.length - 1]; 254 } 255 256 // fills in the input box w/the first match (assumed to be the best match) 257 function autoFill(q, sValue){ 258 // autofill in the complete box w/the first match as long as the user hasn't entered in more data 259 // if the last user key pressed was backspace, don't autofill 260 if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != 8 ) { 261 // fill in the value (keep the case the user has typed) 262 $input.val($input.val() + sValue.substring(lastWord(previousValue).length)); 263 // select the portion of the value not typed by the user (so the next character will erase) 264 $.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length); 265 } 266 }; 267 268 function hideResults() { 269 clearTimeout(timeout); 270 timeout = setTimeout(hideResultsNow, 200); 271 }; 272 273 function hideResultsNow() { 274 select.hide(); 275 clearTimeout(timeout); 276 stopLoading(); 277 if (options.mustMatch) { 278 // call search and run callback 279 $input.search( 280 function (result){ 281 // if no value found, clear the input box 282 if( !result ) $input.val(""); 283 } 284 ); 285 } 286 }; 287 288 function receiveData(q, data) { 289 if ( data && data.length && hasFocus ) { 290 stopLoading(); 291 select.display(data, q); 292 293 var newData = data[0].value.split(';'); 294 data.value = newData[0]; 295 296 autoFill(q, data.value); 297 select.show(); 298 } else { 299 hideResultsNow(); 300 } 301 }; 302 303 function request(term, success, failure) { 304 if (!options.matchCase) 305 term = term.toLowerCase(); 306 var data = cache.load(term); 307 // recieve the cached data 308 if (data && data.length) { 309 success(term, data); 310 // if an AJAX url has been supplied, try loading the data now 311 } else if( (typeof options.url == "string") && (options.url.length > 0) ){ 312 313 var extraParams = {}; 314 $.each(options.extraParams, function(key, param) { 315 extraParams[key] = typeof param == "function" ? param() : param; 316 }); 317 318 $.ajax({ 319 // try to leverage ajaxQueue plugin to abort previous requests 320 mode: "abort", 321 // limit abortion to this input 322 port: "autocomplete" + input.name, 323 dataType: options.dataType, 324 url: options.url, 325 data: $.extend({ 326 q: lastWord(term), 327 limit: options.max, 328 action: 'messages_autocomplete_results', 329 'cookie': encodeURIComponent(document.cookie) 330 }, extraParams), 331 success: function(data) { 332 var parsed = options.parse && options.parse(data) || parse(data); 333 cache.add(term, parsed); 334 success(term, parsed); 335 } 336 }); 337 } else { 338 failure(term); 339 } 340 }; 341 342 function parse(data) { 343 var parsed = []; 344 var rows = data.split("\n"); 345 for (var i=0; i < rows.length; i++) { 346 var row = $.trim(rows[i]); 347 if (row) { 348 row = row.split("|"); 349 parsed[parsed.length] = { 350 data: row, 351 value: row[0], 352 result: options.formatResult && options.formatResult(row, row[0]) || row[0] 353 }; 354 } 355 } 356 return parsed; 357 }; 358 359 function stopLoading() { 360 $input.removeClass(options.loadingClass); 361 jQuery('.ajax-loader').hide(); 362 }; 363 364 }; 365 366 $.Autocompleter.defaults = { 367 inputClass: "ac_input", 368 resultsClass: "ac_results", 369 loadingClass: "ac_loading", 370 minChars: 1, 371 delay: 400, 372 matchCase: false, 373 matchSubset: true, 374 matchContains: false, 375 cacheLength: 10, 376 max: 100, 377 mustMatch: false, 378 extraParams: {}, 379 selectFirst: true, 380 formatItem: function(row) { return row[0]; }, 381 autoFill: false, 382 width: 0, 383 multiple: false, 384 multipleSeparator: ", ", 385 highlight: function(value, term) { 386 return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>"); 387 }, 388 scroll: true, 389 scrollHeight: 250, 390 attachTo: 'body' 391 }; 392 393 $.Autocompleter.Cache = function(options) { 394 395 var data = {}; 396 var length = 0; 397 398 function matchSubset(s, sub) { 399 if (!options.matchCase) 400 s = s.toLowerCase(); 401 var i = s.indexOf(sub); 402 if (i == -1) return false; 403 return i == 0 || options.matchContains; 404 }; 405 406 function add(q, value) { 407 if (length > options.cacheLength){ 408 flush(); 409 } 410 if (!data[q]){ 411 length++; 412 } 413 data[q] = value; 414 } 415 416 function populate(){ 417 if( !options.data ) return false; 418 // track the matches 419 var stMatchSets = {}, 420 nullData = 0; 421 422 // no url was specified, we need to adjust the cache length to make sure it fits the local data store 423 if( !options.url ) options.cacheLength = 1; 424 425 // track all options for minChars = 0 426 stMatchSets[""] = []; 427 428 // loop through the array and create a lookup structure 429 for ( var i = 0, ol = options.data.length; i < ol; i++ ) { 430 var rawValue = options.data[i]; 431 // if rawValue is a string, make an array otherwise just reference the array 432 rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue; 433 434 var value = options.formatItem(rawValue, i+1, options.data.length); 435 if ( value === false ) 436 continue; 437 438 var firstChar = value.charAt(0).toLowerCase(); 439 // if no lookup array for this character exists, look it up now 440 if( !stMatchSets[firstChar] ) 441 stMatchSets[firstChar] = []; 442 443 // if the match is a string 444 var row = { 445 value: value, 446 data: rawValue, 447 result: options.formatResult && options.formatResult(rawValue) || value 448 }; 449 450 // push the current match into the set list 451 stMatchSets[firstChar].push(row); 452 453 // keep track of minChars zero items 454 if ( nullData++ < options.max ) { 455 stMatchSets[""].push(row); 456 } 457 }; 458 459 // add the data items to the cache 460 $.each(stMatchSets, function(i, value) { 461 // increase the cache size 462 options.cacheLength++; 463 // add to the cache 464 add(i, value); 465 }); 466 } 467 468 // populate any existing data 469 setTimeout(populate, 25); 470 471 function flush(){ 472 data = {}; 473 length = 0; 474 } 475 476 return { 477 flush: flush, 478 add: add, 479 populate: populate, 480 load: function(q) { 481 if (!options.cacheLength || !length) 482 return null; 483 /* 484 * if dealing w/local data and matchContains than we must make sure 485 * to loop through all the data collections looking for matches 486 */ 487 if( !options.url && options.matchContains ){ 488 // track all matches 489 var csub = []; 490 // loop through all the data grids for matches 491 for( var k in data ){ 492 // don't search through the stMatchSets[""] (minChars: 0) cache 493 // this prevents duplicates 494 if( k.length > 0 ){ 495 var c = data[k]; 496 $.each(c, function(i, x) { 497 // if we've got a match, add it to the array 498 if (matchSubset(x.value, q)) { 499 csub.push(x); 500 } 501 }); 502 } 503 } 504 return csub; 505 } else 506 // if the exact item exists, use it 507 if (data[q]){ 508 return data[q]; 509 } else 510 if (options.matchSubset) { 511 for (var i = q.length - 1; i >= options.minChars; i--) { 512 var c = data[q.substr(0, i)]; 513 if (c) { 514 var csub = []; 515 $.each(c, function(i, x) { 516 if (matchSubset(x.value, q)) { 517 csub[csub.length] = x; 518 } 519 }); 520 return csub; 521 } 522 } 523 } 524 return null; 525 } 526 }; 527 }; 528 529 $.Autocompleter.Select = function (options, input, select, config) { 530 var CLASSES = { 531 ACTIVE: "ac_over" 532 }; 533 534 var listItems, 535 active = -1, 536 data, 537 term = "", 538 needsInit = true, 539 element, 540 list; 541 542 // Create results 543 function init() { 544 if (!needsInit) 545 return; 546 element = $("<div/>") 547 .hide() 548 .addClass(options.resultsClass) 549 .css("position", "absolute") 550 .appendTo(options.attachTo); 551 552 list = $("<ul>").appendTo(element).mouseover( function(event) { 553 if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { 554 active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event)); 555 $(target(event)).addClass(CLASSES.ACTIVE); 556 } 557 }).click(function(event) { 558 $(target(event)).addClass(CLASSES.ACTIVE); 559 select(); 560 input.focus(); 561 return false; 562 }).mousedown(function() { 563 config.mouseDownOnSelect = true; 564 }).mouseup(function() { 565 config.mouseDownOnSelect = false; 566 }); 567 568 if( options.width > 0 ) 569 element.css("width", options.width); 570 571 needsInit = false; 572 } 573 574 function target(event) { 575 var element = event.target; 576 while(element && element.tagName != "LI") 577 element = element.parentNode; 578 // more fun with IE, sometimes event.target is empty, just ignore it then 579 if(!element) 580 return []; 581 return element; 582 } 583 584 function moveSelect(step) { 585 listItems.slice(active, active + 1).removeClass(); 586 movePosition(step); 587 var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE); 588 if(options.scroll) { 589 var offset = 0; 590 listItems.slice(0, active).each(function() { 591 offset += this.offsetHeight; 592 }); 593 if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) { 594 list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight()); 595 } else if(offset < list.scrollTop()) { 596 list.scrollTop(offset); 597 } 598 } 599 }; 600 601 function movePosition(step) { 602 active += step; 603 if (active < 0) { 604 active = listItems.size() - 1; 605 } else if (active >= listItems.size()) { 606 active = 0; 607 } 608 } 609 610 function limitNumberOfItems(available) { 611 return options.max && options.max < available 612 ? options.max 613 : available; 614 } 615 616 function fillList() { 617 list.empty(); 618 var max = limitNumberOfItems(data.length); 619 for (var i=0; i < max; i++) { 620 if (!data[i]) 621 continue; 622 var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term); 623 if ( formatted === false ) 624 continue; 625 var li = $("<li>").html( options.highlight(formatted, term) ).addClass(i%2 == 0 ? "ac_event" : "ac_odd").appendTo(list)[0]; 626 $.data(li, "ac_data", data[i]); 627 } 628 listItems = list.find("li"); 629 if ( options.selectFirst ) { 630 listItems.slice(0, 1).addClass(CLASSES.ACTIVE); 631 active = 0; 632 } 633 list.bgiframe(); 634 } 635 636 return { 637 display: function(d, q) { 638 init(); 639 data = d; 640 term = q; 641 fillList(); 642 }, 643 next: function() { 644 moveSelect(1); 645 }, 646 prev: function() { 647 moveSelect(-1); 648 }, 649 pageUp: function() { 650 if (active != 0 && active - 8 < 0) { 651 moveSelect( -active ); 652 } else { 653 moveSelect(-8); 654 } 655 }, 656 pageDown: function() { 657 if (active != listItems.size() - 1 && active + 8 > listItems.size()) { 658 moveSelect( listItems.size() - 1 - active ); 659 } else { 660 moveSelect(8); 661 } 662 }, 663 hide: function() { 664 element && element.hide(); 665 active = -1; 666 }, 667 visible : function() { 668 return element && element.is(":visible"); 669 }, 670 current: function() { 671 return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]); 672 }, 673 show: function() { 674 var offset = $(input).offset(); 675 element.css({ 676 width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).width(), 677 top: offset.top + input.offsetHeight, 678 left: offset.left 679 }).show(); 680 if(options.scroll) { 681 list.scrollTop(0); 682 list.css({ 683 maxHeight: options.scrollHeight, 684 overflow: 'auto' 685 }); 686 687 if($.browser.msie && typeof document.body.style.maxHeight === "undefined") { 688 var listHeight = 0; 689 listItems.each(function() { 690 listHeight += this.offsetHeight; 691 }); 692 var scrollbarsVisible = listHeight > options.scrollHeight; 693 list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight ); 694 if (!scrollbarsVisible) { 695 // IE doesn't recalculate width when scrollbar disappears 696 listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) ); 697 } 698 } 699 700 } 701 }, 702 selected: function() { 703 var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE); 704 return selected && selected.length && $.data(selected[0], "ac_data"); 705 }, 706 unbind: function() { 707 element && element.remove(); 708 } 709 }; 710 }; 711 712 $.Autocompleter.Selection = function(field, start, end) { 713 if( field.createTextRange ){ 714 var selRange = field.createTextRange(); 715 selRange.collapse(true); 716 selRange.moveStart("character", start); 717 selRange.moveEnd("character", end); 718 selRange.select(); 719 } else if( field.setSelectionRange ){ 720 field.setSelectionRange(start, end); 721 } else { 722 if( field.selectionStart ){ 723 field.selectionStart = start; 724 field.selectionEnd = end; 725 } 726 } 727 field.focus(); 728 }; 729 730 })(jQuery); 13 (function(a){a.fn.extend({autocomplete:function(b,c){var d=typeof b=="string";c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:10,max:c&&!c.scroll?10:150},c);c.highlight=c.highlight||function(e){return e};return this.each(function(){new a.Autocompleter(this,c)})},result:function(b){return this.bind("result",b)},search:function(b){return this.trigger("search",[b])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(b){return this.trigger("setOptions",[b])},unautocomplete:function(){return this.trigger("unautocomplete")}});a.Autocompleter=function(l,g){var c={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34};var b=a(l).attr("autocomplete","off").addClass(g.inputClass);var j;var p="";var m=a.Autocompleter.Cache(g);var e=0;var u;var w={mouseDownOnSelect:false};var r=a.Autocompleter.Select(g,l,d,w);b.keydown(function(x){u=x.keyCode;switch(x.keyCode){case c.UP:x.preventDefault();if(r.visible()){r.prev()}else{t(0,true)}break;case c.DOWN:x.preventDefault();if(r.visible()){r.next()}else{t(0,true)}break;case c.PAGEUP:x.preventDefault();if(r.visible()){r.pageUp()}else{t(0,true)}break;case c.PAGEDOWN:x.preventDefault();if(r.visible()){r.pageDown()}else{t(0,true)}break;case g.multiple&&a.trim(g.multipleSeparator)==","&&c.COMMA:case c.TAB:case c.RETURN:if(d()){if(!g.multiple){b.blur()}x.preventDefault();b.focus()}break;case c.ESC:r.hide();break;default:clearTimeout(j);j=setTimeout(t,g.delay);break}}).keypress(function(){}).focus(function(){e++}).blur(function(){e=0;if(!w.mouseDownOnSelect){s()}}).click(function(){if(e++>1&&!r.visible()){t(0,true)}}).bind("search",function(){var x=(arguments.length>1)?arguments[1]:null;function y(C,B){var z;if(B&&B.length){for(var A=0;A<B.length;A++){if(B[A].result.toLowerCase()==C.toLowerCase()){z=B[A];break}}}if(typeof x=="function"){x(z)}else{b.trigger("result",z&&[z.data,z.value])}}a.each(h(b.val()),function(z,A){f(A,y,y)})}).bind("flushCache",function(){m.flush()}).bind("setOptions",function(){a.extend(g,arguments[1]);if("data" in arguments[1]){m.populate()}}).bind("unautocomplete",function(){r.unbind();b.unbind()});function d(){var y=r.selected();if(!y){return false}var x=y.result;p=x;if(g.multiple){var z=h(b.val());if(z.length>1){x=z.slice(0,z.length-1).join(g.multipleSeparator)+g.multipleSeparator+x}x+=g.multipleSeparator}b.val(x);v();b.trigger("result",[y.data,y.value]);return true}function t(z,y){if(u==c.DEL){r.hide();return}var x=b.val();if(!y&&x==p){return}p=x;x=i(x);if(x.length>=g.minChars){b.addClass(g.loadingClass);jQuery(".ajax-loader").show();if(!g.matchCase){x=x.toLowerCase()}f(x,k,v)}else{n();r.hide()}}function h(y){if(!y){return[""]}var z=y.split(a.trim(g.multipleSeparator));var x=[];a.each(z,function(A,B){if(a.trim(B)){x[A]=a.trim(B)}});return x}function i(x){if(!g.multiple){return x}var y=h(x);return y[y.length-1]}function q(x,y){if(g.autoFill&&(i(b.val()).toLowerCase()==x.toLowerCase())&&u!=8){b.val(b.val()+y.substring(i(p).length));a.Autocompleter.Selection(l,p.length,p.length+y.length)}}function s(){clearTimeout(j);j=setTimeout(v,200)}function v(){r.hide();clearTimeout(j);n();if(g.mustMatch){b.search(function(x){if(!x){b.val("")}})}}function k(z,y){if(y&&y.length&&e){n();r.display(y,z);var x=y[0].value.split(";");y.value=x[0];q(z,y.value);r.show()}else{v()}}function f(y,A,x){if(!g.matchCase){y=y.toLowerCase()}var z=m.load(y);if(z&&z.length){A(y,z)}else{if((typeof g.url=="string")&&(g.url.length>0)){var B={};a.each(g.extraParams,function(C,D){B[C]=typeof D=="function"?D():D});a.ajax({mode:"abort",port:"autocomplete"+l.name,dataType:g.dataType,url:g.url,data:a.extend({q:i(y),limit:g.max,action:"messages_autocomplete_results",cookie:encodeURIComponent(document.cookie)},B),success:function(D){var C=g.parse&&g.parse(D)||o(D);m.add(y,C);A(y,C)}})}else{x(y)}}}function o(A){var x=[];var z=A.split("\n");for(var y=0;y<z.length;y++){var B=a.trim(z[y]);if(B){B=B.split("|");x[x.length]={data:B,value:B[0],result:g.formatResult&&g.formatResult(B,B[0])||B[0]}}}return x}function n(){b.removeClass(g.loadingClass);jQuery(".ajax-loader").hide()}};a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(b){return b[0]},autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:250,attachTo:"body"};a.Autocompleter.Cache=function(c){var f={};var d=0;function h(l,k){if(!c.matchCase){l=l.toLowerCase()}var j=l.indexOf(k);if(j==-1){return false}return j==0||c.matchContains}function g(j,i){if(d>c.cacheLength){b()}if(!f[j]){d++}f[j]=i}function e(){if(!c.data){return false}var k={},j=0;if(!c.url){c.cacheLength=1}k[""]=[];for(var m=0,l=c.data.length;m<l;m++){var p=c.data[m];p=(typeof p=="string")?[p]:p;var o=c.formatItem(p,m+1,c.data.length);if(o===false){continue}var n=o.charAt(0).toLowerCase();if(!k[n]){k[n]=[]}var q={value:o,data:p,result:c.formatResult&&c.formatResult(p)||o};k[n].push(q);if(j++<c.max){k[""].push(q)}}a.each(k,function(r,s){c.cacheLength++;g(r,s)})}setTimeout(e,25);function b(){f={};d=0}return{flush:b,add:g,populate:e,load:function(n){if(!c.cacheLength||!d){return null}if(!c.url&&c.matchContains){var m=[];for(var j in f){if(j.length>0){var o=f[j];a.each(o,function(p,k){if(h(k.value,n)){m.push(k)}})}}return m}else{if(f[n]){return f[n]}else{if(c.matchSubset){for(var l=n.length-1;l>=c.minChars;l--){var o=f[n.substr(0,l)];if(o){var m=[];a.each(o,function(p,k){if(h(k.value,n)){m[m.length]=k}});return m}}}}}return null}}};a.Autocompleter.Select=function(e,j,l,p){var i={ACTIVE:"ac_over"};var k,f=-1,r,m="",s=true,c,o;function n(){if(!s){return}c=a("<div/>").hide().addClass(e.resultsClass).css("position","absolute").appendTo(e.attachTo);o=a("<ul>").appendTo(c).mouseover(function(t){if(q(t).nodeName&&q(t).nodeName.toUpperCase()=="LI"){f=a("li",o).removeClass(i.ACTIVE).index(q(t));a(q(t)).addClass(i.ACTIVE)}}).click(function(t){a(q(t)).addClass(i.ACTIVE);l();j.focus();return false}).mousedown(function(){p.mouseDownOnSelect=true}).mouseup(function(){p.mouseDownOnSelect=false});if(e.width>0){c.css("width",e.width)}s=false}function q(u){var t=u.target;while(t&&t.tagName!="LI"){t=t.parentNode}if(!t){return[]}return t}function h(t){k.slice(f,f+1).removeClass();g(t);var v=k.slice(f,f+1).addClass(i.ACTIVE);if(e.scroll){var u=0;k.slice(0,f).each(function(){u+=this.offsetHeight});if((u+v[0].offsetHeight-o.scrollTop())>o[0].clientHeight){o.scrollTop(u+v[0].offsetHeight-o.innerHeight())}else{if(u<o.scrollTop()){o.scrollTop(u)}}}}function g(t){f+=t;if(f<0){f=k.size()-1}else{if(f>=k.size()){f=0}}}function b(t){return e.max&&e.max<t?e.max:t}function d(){o.empty();var u=b(r.length);for(var v=0;v<u;v++){if(!r[v]){continue}var w=e.formatItem(r[v].data,v+1,u,r[v].value,m);if(w===false){continue}var t=a("<li>").html(e.highlight(w,m)).addClass(v%2==0?"ac_event":"ac_odd").appendTo(o)[0];a.data(t,"ac_data",r[v])}k=o.find("li");if(e.selectFirst){k.slice(0,1).addClass(i.ACTIVE);f=0}o.bgiframe()}return{display:function(u,t){n();r=u;m=t;d()},next:function(){h(1)},prev:function(){h(-1)},pageUp:function(){if(f!=0&&f-8<0){h(-f)}else{h(-8)}},pageDown:function(){if(f!=k.size()-1&&f+8>k.size()){h(k.size()-1-f)}else{h(8)}},hide:function(){c&&c.hide();f=-1},visible:function(){return c&&c.is(":visible")},current:function(){return this.visible()&&(k.filter("."+i.ACTIVE)[0]||e.selectFirst&&k[0])},show:function(){var v=a(j).offset();c.css({width:typeof e.width=="string"||e.width>0?e.width:a(j).width(),top:v.top+j.offsetHeight,left:v.left}).show();if(e.scroll){o.scrollTop(0);o.css({maxHeight:e.scrollHeight,overflow:"auto"});if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var t=0;k.each(function(){t+=this.offsetHeight});var u=t>e.scrollHeight;o.css("height",u?e.scrollHeight:t);if(!u){k.width(o.width()-parseInt(k.css("padding-left"))-parseInt(k.css("padding-right")))}}}},selected:function(){var t=k&&k.filter("."+i.ACTIVE).removeClass(i.ACTIVE);return t&&t.length&&a.data(t[0],"ac_data")},unbind:function(){c&&c.remove()}}};a.Autocompleter.Selection=function(d,e,c){if(d.createTextRange){var b=d.createTextRange();b.collapse(true);b.moveStart("character",e);b.moveEnd("character",c);b.select()}else{if(d.setSelectionRange){d.setSelectionRange(e,c)}else{if(d.selectionStart){d.selectionStart=e;d.selectionEnd=c}}}d.focus()}})(jQuery); -
trunk/bp-messages/js/autocomplete/jquery.autocompletefb.js
r3476 r3477 1 /* !1 /* 2 2 * jQuery plugin: autoCompletefb(AutoComplete Facebook) 3 3 * @requires jQuery v1.2.2 or later … … 14 14 * http://www.gnu.org/licenses/gpl.html 15 15 */ 16 17 jQuery.fn.autoCompletefb = function(options) 18 { 19 var tmp = this; 20 var settings = 21 { 22 ul : tmp, 23 urlLookup : [""], 24 acOptions : {}, 25 foundClass : ".friend-tab", 26 inputClass : ".send-to-input" 27 } 28 29 if(options) jQuery.extend(settings, options); 30 31 var acfb = 32 { 33 params : settings, 34 removeFind : function(o){ 35 acfb.removeUsername(o); 36 jQuery(o).unbind('click').parent().remove(); 37 jQuery(settings.inputClass,tmp).focus(); 38 return tmp.acfb; 39 }, 40 removeUsername: function(o){ 41 var newID = o.parentNode.id.split('-'); 42 jQuery('#send-to-usernames').removeClass(newID[1]); 43 } 44 } 45 46 jQuery(settings.foundClass+" img.p").click(function(){ 47 acfb.removeFind(this); 48 }); 49 50 jQuery(settings.inputClass,tmp).autocomplete(settings.urlLookup,settings.acOptions); 51 jQuery(settings.inputClass,tmp).result(function(e,d,f){ 52 var f = settings.foundClass.replace(/\./,''); 53 var d = String(d).split(' ('); 54 var un = d[1].substr(0, d[1].length-1); 55 var ln = '#link-' + un; 56 var l = jQuery(ln).attr('value'); 57 var v = '<li class="'+f+'" id="un-'+un+'"><span><a href="'+l+'">'+d[0]+'</a></span> <span class="p">X</span></li>'; 58 var x = jQuery(settings.inputClass,tmp).before(v); 59 60 jQuery('#send-to-usernames').addClass(un); 61 62 jQuery('.p',x[0].previousSibling).click(function(){ 63 acfb.removeFind(this); 64 }); 65 jQuery(settings.inputClass,tmp).val(''); 66 }); 67 68 jQuery(settings.inputClass,tmp).focus(); 69 return acfb; 70 } 16 jQuery.fn.autoCompletefb=function(b){var c=this;var d={ul:c,urlLookup:[""],acOptions:{},foundClass:".friend-tab",inputClass:".send-to-input"};if(b){jQuery.extend(d,b)}var a={params:d,removeFind:function(e){a.removeUsername(e);jQuery(e).unbind("click").parent().remove();jQuery(d.inputClass,c).focus();return c.acfb},removeUsername:function(f){var e=f.parentNode.id.split("-");jQuery("#send-to-usernames").removeClass(e[1])}};jQuery(d.foundClass+" img.p").click(function(){a.removeFind(this)});jQuery(d.inputClass,c).autocomplete(d.urlLookup,d.acOptions);jQuery(d.inputClass,c).result(function(n,o,m){var m=d.foundClass.replace(/\./,"");var o=String(o).split(" (");var j=o[1].substr(0,o[1].length-1);var k="#link-"+j;var h=jQuery(k).attr("value");var i='<li class="'+m+'" id="un-'+j+'"><span><a href="'+h+'">'+o[0]+'</a></span> <span class="p">X</span></li>';var g=jQuery(d.inputClass,c).before(i);jQuery("#send-to-usernames").addClass(j);jQuery(".p",g[0].previousSibling).click(function(){a.removeFind(this)});jQuery(d.inputClass,c).val("")});jQuery(d.inputClass,c).focus();return a}; -
trunk/bp-messages/js/autocomplete/jquery.dimensions.js
r3476 r3477 1 /* !1 /* 2 2 * Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) 3 3 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) … … 11 11 * Requires: jQuery 1.2+ 12 12 */ 13 14 (function($){ 15 16 $.dimensions = { 17 version: '@VERSION' 18 }; 19 20 // Create innerHeight, innerWidth, outerHeight and outerWidth methods 21 $.each( [ 'Height', 'Width' ], function(i, name){ 22 23 // innerHeight and innerWidth 24 $.fn[ 'inner' + name ] = function() { 25 if (!this[0]) return; 26 27 var torl = name == 'Height' ? 'Top' : 'Left', // top or left 28 borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right 29 30 return this[ name.toLowerCase() ]() + num(this, 'padding' + torl) + num(this, 'padding' + borr); 31 }; 32 33 // outerHeight and outerWidth 34 $.fn[ 'outer' + name ] = function(options) { 35 if (!this[0]) return; 36 37 var torl = name == 'Height' ? 'Top' : 'Left', // top or left 38 borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right 39 40 options = $.extend({ margin: false }, options || {}); 41 42 return this[ name.toLowerCase() ]() 43 + num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width') 44 + num(this, 'padding' + torl) + num(this, 'padding' + borr) 45 + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0); 46 }; 47 }); 48 49 // Create scrollLeft and scrollTop methods 50 $.each( ['Left', 'Top'], function(i, name) { 51 $.fn[ 'scroll' + name ] = function(val) { 52 if (!this[0]) return; 53 54 return val != undefined ? 55 56 // Set the scroll offset 57 this.each(function() { 58 this == window || this == document ? 59 window.scrollTo( 60 name == 'Left' ? val : $(window)[ 'scrollLeft' ](), 61 name == 'Top' ? val : $(window)[ 'scrollTop' ]() 62 ) : 63 this[ 'scroll' + name ] = val; 64 }) : 65 66 // Return the scroll offset 67 this[0] == window || this[0] == document ? 68 self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] || 69 $.boxModel && document.documentElement[ 'scroll' + name ] || 70 document.body[ 'scroll' + name ] : 71 this[0][ 'scroll' + name ]; 72 }; 73 }); 74 75 $.fn.extend({ 76 position: function() { 77 var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results; 78 79 if (elem) { 80 // Get *real* offsetParent 81 offsetParent = this.offsetParent(); 82 83 // Get correct offsets 84 offset = this.offset(); 85 parentOffset = offsetParent.offset(); 86 87 // Subtract element margins 88 offset.top -= num(elem, 'marginTop'); 89 offset.left -= num(elem, 'marginLeft'); 90 91 // Add offsetParent borders 92 parentOffset.top += num(offsetParent, 'borderTopWidth'); 93 parentOffset.left += num(offsetParent, 'borderLeftWidth'); 94 95 // Subtract the two offsets 96 results = { 97 top: offset.top - parentOffset.top, 98 left: offset.left - parentOffset.left 99 }; 100 } 101 102 return results; 103 }, 104 105 offsetParent: function() { 106 var offsetParent = this[0].offsetParent; 107 while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') ) 108 offsetParent = offsetParent.offsetParent; 109 return $(offsetParent); 110 } 111 }); 112 113 var num = function(el, prop) { 114 return parseInt($.css(el.jquery?el[0]:el,prop))||0; 115 }; 116 117 })(jQuery); 13 (function(b){b.dimensions={version:"@VERSION"};b.each(["Height","Width"],function(d,c){b.fn["inner"+c]=function(){if(!this[0]){return}var f=c=="Height"?"Top":"Left",e=c=="Height"?"Bottom":"Right";return this[c.toLowerCase()]()+a(this,"padding"+f)+a(this,"padding"+e)};b.fn["outer"+c]=function(f){if(!this[0]){return}var g=c=="Height"?"Top":"Left",e=c=="Height"?"Bottom":"Right";f=b.extend({margin:false},f||{});return this[c.toLowerCase()]()+a(this,"border"+g+"Width")+a(this,"border"+e+"Width")+a(this,"padding"+g)+a(this,"padding"+e)+(f.margin?(a(this,"margin"+g)+a(this,"margin"+e)):0)}});b.each(["Left","Top"],function(d,c){b.fn["scroll"+c]=function(e){if(!this[0]){return}return e!=undefined?this.each(function(){this==window||this==document?window.scrollTo(c=="Left"?e:b(window)["scrollLeft"](),c=="Top"?e:b(window)["scrollTop"]()):this["scroll"+c]=e}):this[0]==window||this[0]==document?self[(c=="Left"?"pageXOffset":"pageYOffset")]||b.boxModel&&document.documentElement["scroll"+c]||document.body["scroll"+c]:this[0]["scroll"+c]}});b.fn.extend({position:function(){var h=0,g=0,f=this[0],i,c,e,d;if(f){e=this.offsetParent();i=this.offset();c=e.offset();i.top-=a(f,"marginTop");i.left-=a(f,"marginLeft");c.top+=a(e,"borderTopWidth");c.left+=a(e,"borderLeftWidth");d={top:i.top-c.top,left:i.left-c.left}}return d},offsetParent:function(){var c=this[0].offsetParent;while(c&&(!/^body|html$/i.test(c.tagName)&&b.css(c,"position")=="static")){c=c.offsetParent}return b(c)}});var a=function(c,d){return parseInt(b.css(c.jquery?c[0]:c,d))||0}})(jQuery); -
trunk/bp-xprofile/admin/css/admin.css
r3300 r3477 1 /* Profile field group main admin page */ 2 #tabs { 3 position: relative; 4 } 5 p.nofields { 6 margin-top: 20px; 7 } 8 9 /* Field group tabs */ 10 ul#field-group-tabs { 11 float: left; 12 padding: 0 0 0 15px; 13 display: none; 14 } 15 ul#field-group-tabs li { 16 float: left; 17 margin-bottom: -1px; 18 background-color: #F7F6F1; 19 margin-right: 8px; 20 } 21 ul#field-group-tabs li.ui-state-hover { 22 background-color: #fafafa; 23 } 24 ul#field-group-tabs li.ui-state-hover a.ui-tab { 25 border-color: #bbb #bbb #ccc #bbb; 26 color: #888; 27 } 28 ul#field-group-tabs li.ui-state-acceptable a.ui-tab { 29 border-color: #5a5 #5a5 #ccc #5a5; 30 color: #8a8; 31 background-image: url(../images/plus.gif); 32 background-color: #efe; 33 } 34 ul#field-group-tabs li.ui-tabs-selected.ui-state-acceptable a.ui-tab { 35 background-color: #fff; 36 background-image: url(../images/cross.gif); 37 } 38 ul#field-group-tabs li.drop-candidate a.ui-tab { 39 background-color: #ffc; 40 border-color: #aa5 #aa5 #ccc #aa5; 41 color: #aa8; 42 } 43 ul#field-group-tabs li a.ui-tab { 44 display: block; 45 margin-top: 3px; 46 padding: 8px 10px 8px 28px; 47 border: 1px solid #ccc; 48 border-bottom: none; 49 -moz-border-radius: 5px 5px 0 0; 50 -khtml-border-radius: 5px 5px 0 0; 51 -webkit-border-radius: 5px 5px 0 0; 52 border-radius: 5px 5px 0 0; 53 text-decoration: none; 54 background: url(../images/move-x.gif) 7px 55% no-repeat; 55 color: #888; 56 } 57 58 /* Selected tab */ 59 ul#field-group-tabs li.ui-tabs-selected { 60 background-color: #fff; 61 } 62 ul#field-group-tabs li.ui-tabs-selected a.ui-tab { 63 margin-top: -1px; 64 padding: 10px 10px 10px 28px; 65 border: 1px solid #bbb; 66 border-bottom: 1px solid transparent; 67 color: #000; 68 font-weight: bold; 69 } 70 71 /* Toolbar */ 72 .tab-toolbar { 73 margin-top: 1px; 74 clear: left; 75 background-color: #fff; 76 padding: 10px; 77 border: 1px solid #bbb; 78 } 79 80 div.tab-wrapper { 81 clear: left; 82 margin-bottom: 20px; 83 } 84 85 .tab-wrapper fieldset { 86 border: 1px solid #ddd; 87 -moz-border-radius: 5px; 88 -khtml-border-radius: 5px; 89 -webkit-border-radius: 5px; 90 border-radius: 5px; 91 padding: 0 10px 10px; 92 margin: 10px 0 0 0; 93 position: relative; 94 background-color: #fff; 95 } 96 .tab-wrapper fieldset fieldset { 97 padding: 10px 10px 20px 10px; 98 background-color: #fcfcfc; 99 } 100 .field-group fieldset:hover { 101 background-color: #fafafa; 102 border-color: #ccc; 103 } 104 fieldset div.field-wrapper { 105 padding-left: 30px; 106 background: url(../images/move.gif) 0px 3px no-repeat transparent; 107 } 108 fieldset.radio div div, 109 fieldset.checkbox div div { 110 float: left; 111 } 112 fieldset.radio div div label, 113 fieldset.checkbox div div label { 114 margin-right: 20px; 115 } 116 117 fieldset.clear-value { 118 margin-left: 10px; 119 } 120 .field-group div.actions { 121 display: none; 122 position: absolute; 123 right: 20px; 124 top: 0; 125 } 126 .field-group fieldset:hover div.actions { 127 display: block; 128 } 129 .field-group fieldset.ui-sortable-placeholder { 130 border: 1px dashed #999; 131 background-color: #eee; 132 visibility: visible !important; 133 } 134 135 ul.forTab { 136 list-style: none; 137 padding: 0; 138 margin: 0 0 0 1em; 139 } 140 ul.forTab li { 141 margin: 0 0 1em 0; 142 } 143 144 ul.forTab li label { 145 display: block; 146 } 147 148 ul.forTab li input { 149 font-size: 1.4em; 150 } 151 152 p.success { background: green;} 153 p.err { 154 border-top: 2px solid red; 155 border-bottom: 2px solid red; 156 color: red; 157 padding: 5px 0; 158 width: 40%; 159 } 160 161 span.desc, span.signup-description { 162 display: block; 163 font-size: 11px; 164 color: #555; 165 } 166 167 select.multi-select { 168 width:90%; 169 height:10em !important; 170 } 171 172 ul.multi-checkbox { 173 margin: 0 5px 0 0px; 174 padding: .5em .9em; 175 height: 10em; 176 overflow: auto; 177 list-style: none; 178 border: solid 1px #ccc; 179 width: 90%; 180 } 181 182 ul.multi-checkbox li { 183 padding: 0; 184 margin: 0; 185 } 186 187 div.options-box { 188 margin-left: 20px !important; 189 margin-right: 10px !important; 190 border-left: 4px solid #EAF3FA; 191 padding-left: 15px; 192 } 193 194 th a { 195 background: #fff; 196 padding: 2px 5px; 197 -moz-border-radius: 3px; 198 -khtml-border-radius: 3px; 199 -webkit-border-radius: 3px; 200 border-radius: 3px; 201 top: -2px; 202 } 203 204 textarea#description { 205 border: 1px solid #ddd; 206 width: 85%; 207 } 1 #tabs{position:relative;}p.nofields{margin-top:20px;}ul#field-group-tabs{float:left;padding:0 0 0 15px;display:none;}ul#field-group-tabs li{float:left;margin-bottom:-1px;background-color:#F7F6F1;margin-right:8px;}ul#field-group-tabs li.ui-state-hover{background-color:#fafafa;}ul#field-group-tabs li.ui-state-hover a.ui-tab{border-color:#bbb #bbb #ccc #bbb;color:#888;}ul#field-group-tabs li.ui-state-acceptable a.ui-tab{border-color:#5a5 #5a5 #ccc #5a5;color:#8a8;background-image:url(../images/plus.gif);background-color:#efe;}ul#field-group-tabs li.ui-tabs-selected.ui-state-acceptable a.ui-tab{background-color:#fff;background-image:url(../images/cross.gif);}ul#field-group-tabs li.drop-candidate a.ui-tab{background-color:#ffc;border-color:#aa5 #aa5 #ccc #aa5;color:#aa8;}ul#field-group-tabs li a.ui-tab{display:block;margin-top:3px;padding:8px 10px 8px 28px;border:1px solid #ccc;border-bottom:none;-moz-border-radius:5px 5px 0 0;-khtml-border-radius:5px 5px 0 0;-webkit-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0;text-decoration:none;background:url(../images/move-x.gif) 7px 55% no-repeat;color:#888;}ul#field-group-tabs li.ui-tabs-selected{background-color:#fff;}ul#field-group-tabs li.ui-tabs-selected a.ui-tab{margin-top:-1px;padding:10px 10px 10px 28px;border:1px solid #bbb;border-bottom:1px solid transparent;color:#000;font-weight:bold;}.tab-toolbar{margin-top:1px;clear:left;background-color:#fff;padding:10px;border:1px solid #bbb;}div.tab-wrapper{clear:left;margin-bottom:20px;}.tab-wrapper fieldset{border:1px solid #ddd;-moz-border-radius:5px;-khtml-border-radius:5px;-webkit-border-radius:5px;border-radius:5px;padding:0 10px 10px;margin:10px 0 0 0;position:relative;background-color:#fff;}.tab-wrapper fieldset fieldset{padding:10px 10px 20px 10px;background-color:#fcfcfc;}.field-group fieldset:hover{background-color:#fafafa;border-color:#ccc;}fieldset div.field-wrapper{padding-left:30px;background:url(../images/move.gif) 0 3px no-repeat transparent;}fieldset.radio div div,fieldset.checkbox div div{float:left;}fieldset.radio div div label,fieldset.checkbox div div label{margin-right:20px;}fieldset.clear-value{margin-left:10px;}.field-group div.actions{display:none;position:absolute;right:20px;top:0;}.field-group fieldset:hover div.actions{display:block;}.field-group fieldset.ui-sortable-placeholder{border:1px dashed #999;background-color:#eee;visibility:visible!important;}ul.forTab{list-style:none;padding:0;margin:0 0 0 1em;}ul.forTab li{margin:0 0 1em 0;}ul.forTab li label{display:block;}ul.forTab li input{font-size:1.4em;}p.success{background:green;}p.err{border-top:2px solid red;border-bottom:2px solid red;color:red;padding:5px 0;width:40%;}span.desc,span.signup-description{display:block;font-size:11px;color:#555;}select.multi-select{width:90%;height:10em!important;}ul.multi-checkbox{margin:0 5px 0 0;padding:.5em .9em;height:10em;overflow:auto;list-style:none;border:solid 1px #ccc;width:90%;}ul.multi-checkbox li{padding:0;margin:0;}div.options-box{margin-left:20px!important;margin-right:10px!important;border-left:4px solid #EAF3FA;padding-left:15px;}th a{background:#fff;padding:2px 5px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;top:-2px;}textarea#description{border:1px solid #ddd;width:85%;} -
trunk/bp-xprofile/admin/js/admin.js
r3300 r3477 1 function add_option(forWhat) { 2 var holder = document.getElementById(forWhat + "_more"); 3 var theId = document.getElementById(forWhat + '_option_number').value; 4 5 var newDiv = document.createElement('p'); 6 newDiv.setAttribute('id', forWhat + '_div' + theId); 7 8 var newOption = document.createElement('input'); 9 newOption.setAttribute('type', 'text'); 10 newOption.setAttribute('name', forWhat + '_option[' + theId + ']'); 11 newOption.setAttribute('id', forWhat + '_option' + theId); 12 13 var label = document.createElement('label'); 14 label.setAttribute('for', forWhat + '_option' + theId); 15 16 var txt = document.createTextNode("Option " + theId + ": "); 17 label.appendChild(txt); 18 19 var isDefault = document.createElement('input'); 20 21 if(forWhat == 'checkbox' || forWhat == 'multiselectbox') { 22 isDefault.setAttribute('type', 'checkbox'); 23 isDefault.setAttribute('name', 'isDefault_' + forWhat + '_option[' + theId + ']'); 24 } else { 25 isDefault.setAttribute('type', 'radio'); 26 isDefault.setAttribute('name', 'isDefault_' + forWhat + '_option'); 27 } 28 29 isDefault.setAttribute('value', theId); 30 31 var label1 = document.createElement('label'); 32 var txt1 = document.createTextNode(" Default Value "); 33 34 label1.appendChild(txt1); 35 label1.setAttribute('for', 'isDefault_' + forWhat + '_option[]'); 36 toDelete = document.createElement('a'); 37 38 toDeleteText = document.createTextNode('[x]'); 39 toDelete.setAttribute('href',"javascript:hide('" + forWhat + '_div' + theId + "')"); 40 41 toDelete.setAttribute('class','delete'); 42 43 toDelete.appendChild(toDeleteText); 44 45 newDiv.appendChild(label); 46 newDiv.appendChild(newOption); 47 newDiv.appendChild(document.createTextNode(" ")); 48 newDiv.appendChild(isDefault); 49 newDiv.appendChild(label1); 50 newDiv.appendChild(toDelete); 51 holder.appendChild(newDiv); 52 53 54 theId++ 55 document.getElementById(forWhat + "_option_number").value = theId; 56 } 57 58 function show_options(forWhat) { 59 document.getElementById("radio").style.display = "none"; 60 document.getElementById("selectbox").style.display = "none"; 61 document.getElementById("multiselectbox").style.display = "none"; 62 document.getElementById("checkbox").style.display = "none"; 63 64 if(forWhat == "radio") 65 document.getElementById("radio").style.display = ""; 66 67 if(forWhat == "selectbox") 68 document.getElementById("selectbox").style.display = ""; 69 70 if(forWhat == "multiselectbox") 71 document.getElementById("multiselectbox").style.display = ""; 72 73 if(forWhat == "checkbox") 74 document.getElementById("checkbox").style.display = ""; 75 } 76 77 function hide(id) { 78 if ( !document.getElementById(id) ) return false; 79 80 document.getElementById(id).style.display = "none"; 81 document.getElementById(id).value = ''; 82 } 83 84 // Set up deleting options ajax 85 jQuery(document).ready( function() { 86 87 jQuery("a.ajax-option-delete").click( 88 function() { 89 var theId = this.id.split('-'); 90 theId = theId[1]; 91 92 jQuery.post( ajaxurl, { 93 action: 'xprofile_delete_option', 94 'cookie': encodeURIComponent(document.cookie), 95 '_wpnonce': jQuery("input#_wpnonce").val(), 96 97 'option_id': theId 98 }, 99 function(response) 100 {}); 101 } 102 ); 103 }); 104 105 var fixHelper = function(e, ui) { 106 ui.children().each(function() { 107 jQuery(this).width( jQuery(this).width() ); 108 }); 109 return ui; 110 }; 111 112 // Main XProfile behavior layer 113 jQuery(document).ready( function() { 114 /* Show object if JS is enabled */ 115 jQuery( "ul#field-group-tabs" ).show(); 116 117 /* Allow reordering of field group tabs */ 118 jQuery( "ul#field-group-tabs" ).sortable( { 119 cursor: 'move', 120 axis: 'x', 121 opacity: 0.6, 122 items: 'li', 123 tolerance: 'pointer', 124 125 update: function() { 126 jQuery.post( ajaxurl, { 127 action: 'xprofile_reorder_groups', 128 'cookie': encodeURIComponent(document.cookie), 129 '_wpnonce_reorder_groups': jQuery( "input#_wpnonce_reorder_groups" ).val(), 130 'group_order': jQuery(this).sortable( 'serialize' ) 131 }, 132 function(response){}); 133 } 134 }).disableSelection(); 135 136 /* Allow reordering of fields within groups */ 137 jQuery( "fieldset.field-group" ).sortable({ 138 cursor: 'move', 139 opacity: 0.3, 140 items: 'fieldset', 141 tolerance: 'pointer', 142 143 update: function() { 144 jQuery.post( ajaxurl, { 145 action: 'xprofile_reorder_fields', 146 'cookie': encodeURIComponent(document.cookie), 147 '_wpnonce_reorder_fields': jQuery( "input#_wpnonce_reorder_fields" ).val(), 148 'field_order': jQuery(this).sortable( 'serialize' ), 149 'field_group_id': jQuery(this).attr( 'id' ) 150 }, 151 function(response) 152 {}); 153 } 154 }) 155 156 /* Disallow text selection */ 157 .disableSelection() 158 159 /* Change cursor to move if JS is enabled */ 160 .css( 'cursor', 'move' ); 161 162 /* tabs init with a custom tab template and an "add" callback filling in the content */ 163 var $tab_items; 164 var $tabs = jQuery( "#tabs" ).tabs(); 165 set_tab_items( $tabs ); 166 167 function set_tab_items( $tabs ) { 168 $tab_items = jQuery( "ul:first li", $tabs ).droppable({ 169 accept: ".connectedSortable fieldset", 170 hoverClass: "ui-state-hover", 171 activeClass: "ui-state-acceptable", 172 touch: "pointer", 173 tolerance: "pointer", 174 175 /* When field is dropped on tab */ 176 drop: function( ev, ui ) { 177 /* The tab */ 178 var $item = jQuery(this); 179 180 /* The tab body */ 181 var $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); 182 183 /* Remove helper class */ 184 jQuery($item).removeClass( 'drop-candidate' ); 185 186 /* Hide field, change selected tab, and show new placement */ 187 ui.draggable.hide( 'slow', function() { 188 189 /* Select new tab as current */ 190 $tabs.tabs( 'select', $tab_items.index( $item ) ); 191 192 /* Show new placement */ 193 jQuery(this).appendTo($list).show( 'slow' ).animate( {opacity: "1"}, 500 ); 194 195 /* Refresh $list variable */ 196 $list = jQuery( $item.find( 'a' ).attr( 'href' ) ).find( '.connectedSortable' ); 197 jQuery($list).find( 'p.nofields' ).hide( 'slow' ); 198 199 /* Ajax update field locations and orders */ 200 jQuery.post( ajaxurl, { 201 action: 'xprofile_reorder_fields', 202 'cookie': encodeURIComponent(document.cookie), 203 '_wpnonce_reorder_fields': jQuery( "input#_wpnonce_reorder_fields" ).val(), 204 'field_order': jQuery( $list ).sortable( 'serialize' ), 205 'field_group_id': jQuery( $list ).attr( 'id' ) 206 }, 207 function(response){}); 208 }); 209 }, 210 over: function( event, ui ) { 211 jQuery(this).addClass( 'drop-candidate' ); 212 }, 213 out: function( event, ui ) { 214 jQuery(this).removeClass( 'drop-candidate' ); 215 } 216 }); 217 } 218 }); 1 function add_option(f){var h=document.getElementById(f+"_more");var j=document.getElementById(f+"_option_number").value;var a=document.createElement("p");a.setAttribute("id",f+"_div"+j);var g=document.createElement("input");g.setAttribute("type","text");g.setAttribute("name",f+"_option["+j+"]");g.setAttribute("id",f+"_option"+j);var i=document.createElement("label");i.setAttribute("for",f+"_option"+j);var e=document.createTextNode("Option "+j+": ");i.appendChild(e);var b=document.createElement("input");if(f=="checkbox"||f=="multiselectbox"){b.setAttribute("type","checkbox");b.setAttribute("name","isDefault_"+f+"_option["+j+"]")}else{b.setAttribute("type","radio");b.setAttribute("name","isDefault_"+f+"_option")}b.setAttribute("value",j);var d=document.createElement("label");var c=document.createTextNode(" Default Value ");d.appendChild(c);d.setAttribute("for","isDefault_"+f+"_option[]");toDelete=document.createElement("a");toDeleteText=document.createTextNode("[x]");toDelete.setAttribute("href","javascript:hide('"+f+"_div"+j+"')");toDelete.setAttribute("class","delete");toDelete.appendChild(toDeleteText);a.appendChild(i);a.appendChild(g);a.appendChild(document.createTextNode(" "));a.appendChild(b);a.appendChild(d);a.appendChild(toDelete);h.appendChild(a);j++;document.getElementById(f+"_option_number").value=j}function show_options(a){document.getElementById("radio").style.display="none";document.getElementById("selectbox").style.display="none";document.getElementById("multiselectbox").style.display="none";document.getElementById("checkbox").style.display="none";if(a=="radio"){document.getElementById("radio").style.display=""}if(a=="selectbox"){document.getElementById("selectbox").style.display=""}if(a=="multiselectbox"){document.getElementById("multiselectbox").style.display=""}if(a=="checkbox"){document.getElementById("checkbox").style.display=""}}function hide(a){if(!document.getElementById(a)){return false}document.getElementById(a).style.display="none";document.getElementById(a).value=""}jQuery(document).ready(function(){jQuery("a.ajax-option-delete").click(function(){var a=this.id.split("-");a=a[1];jQuery.post(ajaxurl,{action:"xprofile_delete_option",cookie:encodeURIComponent(document.cookie),_wpnonce:jQuery("input#_wpnonce").val(),option_id:a},function(b){})})});var fixHelper=function(b,a){a.children().each(function(){jQuery(this).width(jQuery(this).width())});return a};jQuery(document).ready(function(){jQuery("ul#field-group-tabs").show();jQuery("ul#field-group-tabs").sortable({cursor:"move",axis:"x",opacity:0.6,items:"li",tolerance:"pointer",update:function(){jQuery.post(ajaxurl,{action:"xprofile_reorder_groups",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_groups:jQuery("input#_wpnonce_reorder_groups").val(),group_order:jQuery(this).sortable("serialize")},function(d){})}}).disableSelection();jQuery("fieldset.field-group").sortable({cursor:"move",opacity:0.3,items:"fieldset",tolerance:"pointer",update:function(){jQuery.post(ajaxurl,{action:"xprofile_reorder_fields",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_fields:jQuery("input#_wpnonce_reorder_fields").val(),field_order:jQuery(this).sortable("serialize"),field_group_id:jQuery(this).attr("id")},function(d){})}}).disableSelection().css("cursor","move");var b;var a=jQuery("#tabs").tabs();c(a);function c(d){b=jQuery("ul:first li",d).droppable({accept:".connectedSortable fieldset",hoverClass:"ui-state-hover",activeClass:"ui-state-acceptable",touch:"pointer",tolerance:"pointer",drop:function(g,h){var e=jQuery(this);var f=jQuery(e.find("a").attr("href")).find(".connectedSortable");jQuery(e).removeClass("drop-candidate");h.draggable.hide("slow",function(){d.tabs("select",b.index(e));jQuery(this).appendTo(f).show("slow").animate({opacity:"1"},500);f=jQuery(e.find("a").attr("href")).find(".connectedSortable");jQuery(f).find("p.nofields").hide("slow");jQuery.post(ajaxurl,{action:"xprofile_reorder_fields",cookie:encodeURIComponent(document.cookie),_wpnonce_reorder_fields:jQuery("input#_wpnonce_reorder_fields").val(),field_order:jQuery(f).sortable("serialize"),field_group_id:jQuery(f).attr("id")},function(i){})})},over:function(e,f){jQuery(this).addClass("drop-candidate")},out:function(e,f){jQuery(this).removeClass("drop-candidate")}})}}); -
trunk/bp-xprofile/bp-xprofile-cssjs.php
r3365 r3477 1 1 <?php 2 3 2 function xprofile_add_admin_css() { 4 wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . '/bp-xprofile/admin/css/admin.css' ); 3 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 4 wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . '/bp-xprofile/admin/css/admin.dev.css' ); 5 else 6 wp_enqueue_style( 'xprofile-admin-css', BP_PLUGIN_URL . '/bp-xprofile/admin/css/admin.css' ); 5 7 } 6 8 add_action( 'admin_menu', 'xprofile_add_admin_css' ); 7 9 8 10 function xprofile_add_admin_js() { 9 if ( isset( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) {11 if ( !empty( $_GET['page'] ) && strpos( $_GET['page'], 'bp-profile-setup' ) !== false ) { 10 12 wp_enqueue_script( 'jquery-ui-core' ); 11 13 wp_enqueue_script( 'jquery-ui-tabs' ); … … 14 16 wp_enqueue_script( 'jquery-ui-droppable' ); 15 17 wp_enqueue_script( 'jquery-ui-sortable' ); 16 wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.js', array( 'jquery', 'jquery-ui-sortable' ) ); 18 19 if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) 20 wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.dev.js', array( 'jquery', 'jquery-ui-sortable' ) ); 21 else 22 wp_enqueue_script( 'xprofile-admin-js', BP_PLUGIN_URL . '/bp-xprofile/admin/js/admin.js', array( 'jquery', 'jquery-ui-sortable' ) ); 17 23 } 18 24 } 19 25 add_action( 'admin_menu', 'xprofile_add_admin_js', 1 ); 20 21 26 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)