Ticket #6569: 6569.04.patch
File 6569.04.patch, 23.0 KB (added by , 9 years ago) |
---|
-
src/bp-activity/bp-activity-template.php
diff --git src/bp-activity/bp-activity-template.php src/bp-activity/bp-activity-template.php index 4eadba0..d6b8230 100644
function bp_activity_per_page() { 994 994 } 995 995 996 996 /** 997 * Output the activity post form textarea placeholder. 998 * 999 * @since 2.4.0 1000 * 1001 * @uses bp_get_activity_whats_new_placeholder() 1002 */ 1003 function bp_activity_whats_new_placeholder() { 1004 echo bp_get_activity_whats_new_placeholder(); 1005 } 1006 1007 /** 1008 * Return the activity post form textarea placeholder. 1009 * 1010 * @since 2.4.0 1011 * 1012 * @uses apply_filters() To call the 'bp_get_activity_per_page' hook. 1013 * 1014 * @return string The activity post form textarea placeholder. 1015 */ 1016 function bp_get_activity_whats_new_placeholder() { 1017 $placeholder = sprintf( __( "What's new, %s?", 'buddypress' ), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) ); 1018 1019 if ( bp_is_group() ) { 1020 $placeholder = sprintf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) ); 1021 } 1022 1023 /** 1024 * Filters the activity post form textarea placeholder. 1025 * 1026 * @since 2.4.0 1027 * 1028 * @param string $placeholder the activity post form textarea placeholder. 1029 */ 1030 return apply_filters( 'bp_get_activity_whats_new_placeholder', $placeholder ); 1031 } 1032 1033 /** 997 1034 * Output the activities title. 998 1035 * 999 1036 * @since 1.0.0 -
src/bp-templates/bp-legacy/buddypress-functions.php
diff --git src/bp-templates/bp-legacy/buddypress-functions.php src/bp-templates/bp-legacy/buddypress-functions.php index 28d2c22..041ec92 100644
class BP_Legacy extends BP_Theme_Compat { 278 278 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; 279 279 280 280 // Locate the BP JS file. 281 $ asset= $this->locate_asset_in_stack( "buddypress{$min}.js", 'js' );281 $js = $this->locate_asset_in_stack( "buddypress{$min}.js", 'js' ); 282 282 283 283 // Enqueue the global JS, if found - AJAX will not work 284 284 // without it. 285 if ( isset( $ asset['location'], $asset['handle'] ) ) {286 wp_enqueue_script( $ asset['handle'], $asset['location'], bp_core_get_js_dependencies(), $this->version );285 if ( isset( $js['location'], $js['handle'] ) ) { 286 wp_enqueue_script( $js['handle'], $js['location'], bp_core_get_js_dependencies(), $this->version ); 287 287 } 288 288 289 289 /** … … class BP_Legacy extends BP_Theme_Compat { 308 308 'unsaved_changes' => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ), 309 309 'view' => __( 'View', 'buddypress' ), 310 310 ) ); 311 wp_localize_script( $ asset['handle'], 'BP_DTheme', $params );311 wp_localize_script( $js['handle'], 'BP_DTheme', $params ); 312 312 313 313 // Maybe enqueue comment reply JS. 314 314 if ( is_singular() && bp_is_blog_page() && get_option( 'thread_comments' ) ) { 315 315 wp_enqueue_script( 'comment-reply' ); 316 316 } 317 317 318 /** 319 * Enqueues Autosize 3.0.13. 320 * 321 * @link https://github.com/jackmoore/autosize 322 * @license MIT 323 */ 324 if ( bp_is_active( 'activity' ) ) { 325 // @todo locate_asset_in_stack() should allow us to omit child theme checks... 326 $asset = $this->locate_asset_in_stack( "autosize{$min}.js", 'js', 'bp-legacy-autosize' ); 327 328 wp_enqueue_script( $asset['handle'], $asset['location'], array( $js['handle'] ), '3.0.13' ); 329 } 330 318 331 // Maybe enqueue password verify JS (register page or user settings page). 319 332 if ( bp_is_register_page() || ( function_exists( 'bp_is_user_settings_general' ) && bp_is_user_settings_general() ) ) { 320 333 -
src/bp-templates/bp-legacy/buddypress/activity/post-form.php
diff --git src/bp-templates/bp-legacy/buddypress/activity/post-form.php src/bp-templates/bp-legacy/buddypress/activity/post-form.php index 5632973..5aa93d2 100644
25 25 </a> 26 26 </div> 27 27 28 <p class="activity-greeting"><?php if ( bp_is_group() )29 printf( __( "What's new in %s, %s?", 'buddypress' ), bp_get_group_name(), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) );30 else31 printf( __( "What's new, %s?", 'buddypress' ), bp_get_user_firstname( bp_get_loggedin_user_fullname() ) );32 ?></p>33 34 28 <div id="whats-new-content"> 29 35 30 <div id="whats-new-textarea"> 36 <label for="whats-new" class="bp-screen-reader-text"><?php _e( 'Post what\'s new', 'buddypress' ); ?></label> 37 <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="10" 31 <textarea class="bp-suggestions" name="whats-new" id="whats-new" cols="50" rows="1" 38 32 <?php if ( bp_is_group() ) : ?>data-suggestions-group-id="<?php echo esc_attr( (int) bp_get_current_group_id() ); ?>" <?php endif; ?> 39 ><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea>33 placeholder="<?php echo esc_attr( bp_get_activity_whats_new_placeholder() ) ;?>"><?php if ( isset( $_GET['r'] ) ) : ?>@<?php echo esc_textarea( $_GET['r'] ); ?> <?php endif; ?></textarea> 40 34 </div> 41 35 42 <div id="whats-new-options"> 43 <div id="whats-new-submit"> 44 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php esc_attr_e( 'Post Update', 'buddypress' ); ?>" /> 45 </div> 36 <div id="whats-new-actions"> 37 <?php 38 /** 39 * Fires before the activity post form options. 40 * 41 * @since BuddyPress (2.4.0) 42 */ 43 do_action( 'bp_activity_post_form_before_options' ); ?> 46 44 47 < ?php if ( bp_is_active( 'groups' ) && !bp_is_my_profile() && !bp_is_group() ) : ?>45 <div id="whats-new-options"> 48 46 49 < div id="whats-new-post-in-box">47 <?php if ( bp_is_active( 'groups' ) && !bp_is_my_profile() && !bp_is_group() ) : ?> 50 48 51 < ?php _e( 'Post in', 'buddypress' ); ?>:49 <div id="whats-new-post-in-box"> 52 50 53 <label for="whats-new-post-in" class="bp-screen-reader-text"><?php _e( 'Post in', 'buddypress' ); ?></label> 54 <select id="whats-new-post-in" name="whats-new-post-in"> 55 <option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ); ?></option> 51 <?php _e( 'Post in', 'buddypress' ); ?>: 56 52 57 < ?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0&update_meta_cache=0' ) ) :58 while ( bp_groups() ) : bp_the_group(); ?>53 <select id="whats-new-post-in" name="whats-new-post-in"> 54 <option selected="selected" value="0"><?php _e( 'My Profile', 'buddypress' ); ?></option> 59 55 60 <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> 56 <?php if ( bp_has_groups( 'user_id=' . bp_loggedin_user_id() . '&type=alphabetical&max=100&per_page=100&populate_extras=0&update_meta_cache=0' ) ) : 57 while ( bp_groups() ) : bp_the_group(); ?> 61 58 62 <?php endwhile; 63 endif; ?> 59 <option value="<?php bp_group_id(); ?>"><?php bp_group_name(); ?></option> 64 60 65 </select> 66 </div> 67 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 61 <?php endwhile; 62 endif; ?> 68 63 69 <?php elseif ( bp_is_group_activity() ) : ?> 64 </select> 65 </div> 66 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 70 67 71 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 72 <input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id(); ?>" /> 68 <?php elseif ( bp_is_group_home() ) : ?> 73 69 74 <?php endif; ?> 70 <input type="hidden" id="whats-new-post-object" name="whats-new-post-object" value="groups" /> 71 <input type="hidden" id="whats-new-post-in" name="whats-new-post-in" value="<?php bp_group_id(); ?>" /> 75 72 76 <?php73 <?php endif; ?> 77 74 75 <?php 76 77 /** 78 * Fires at the end of the activity post form options. 79 * 80 * @since BuddyPress (1.2.0) 81 */ 82 do_action( 'bp_activity_post_form_options' ); ?> 83 84 </div><!-- #whats-new-options --> 85 86 <?php 78 87 /** 79 * Fires at the end of the activity post form markup.88 * Fires before the activity post form submit. 80 89 * 81 * @since 1.2.090 * @since BuddyPress (2.4.0) 82 91 */ 83 do_action( 'bp_activity_post_form_options' ); ?> 92 do_action( 'bp_activity_post_form_before_submit' ); ?> 93 94 <div id="whats-new-submit"> 95 96 <input type="reset" name="aw-whats-new-reset" id="aw-whats-new-reset" value="<?php esc_attr_e( 'Cancel', 'buddypress' ); ?>" /> 97 <input type="submit" name="aw-whats-new-submit" id="aw-whats-new-submit" value="<?php esc_attr_e( 'Post Update', 'buddypress' ); ?>" /> 84 98 85 </div><!-- #whats-new-options --> 99 <?php 100 /** 101 * Fires at the end of the activity post form submit. 102 * 103 * @since BuddyPress (2.4.0) 104 */ 105 do_action( 'bp_activity_post_form_submit' ); ?> 106 </div><!-- #whats-new-submit --> 107 </div><!-- #whats-new-actions --> 86 108 </div><!-- #whats-new-content --> 87 109 88 110 <?php wp_nonce_field( 'post_update', '_wpnonce_post_update' ); ?> -
src/bp-templates/bp-legacy/css/buddypress.css
diff --git src/bp-templates/bp-legacy/css/buddypress.css src/bp-templates/bp-legacy/css/buddypress.css index 77b8e3a..29617ea 100644
Hello, this is the BuddyPress Legacy stylesheet. 128 128 color: #555; 129 129 font-family: inherit; 130 130 font-size: medium; 131 height: 20px;132 131 padding: 6px; 133 width: 98%; 132 width: 97.5%; 133 height: auto; 134 resize: none; 135 overflow: hidden; 134 136 } 135 137 body.no-js #buddypress form#whats-new-form textarea { 136 138 height: 50px; 139 resize: vertical; 140 overflow: auto; 137 141 } 138 142 #buddypress form#whats-new-form #whats-new-options select { 139 143 max-width: 200px; … … body.no-js #buddypress form#whats-new-form textarea { 143 147 float: right; 144 148 margin-top: 12px; 145 149 } 150 146 151 #buddypress #whats-new-options { 147 152 overflow: auto; 153 height: auto; 154 float:left; 155 } 156 157 #buddypress #whats-new-content #whats-new-actions { 148 158 height: 0; 149 159 } 160 161 #buddypress #whats-new-content.active #whats-new-actions { 162 width: auto; 163 } 164 150 165 body.no-js #buddypress #whats-new-options { 151 166 height: auto; 152 167 } … … body.no-js #buddypress #whats-new-options { 155 170 outline-color: rgba(31, 179, 221, 0.9); 156 171 } 157 172 173 #buddypress #whats-new-content, #buddypress #whats-new-actions { 174 overflow: hidden; 175 } 176 177 #buddypress #whats-new-textarea { 178 position: relative; 179 } 180 181 #buddypress #whats-new-textarea:before, 182 #buddypress #whats-new-textarea:after { 183 border-color: transparent; 184 border-style: solid; 185 content: ' '; 186 height: 0; 187 position: absolute; 188 right: 99.8%; 189 width: 0; 190 } 191 192 #buddypress #whats-new-textarea:before { 193 border-width: 10px; 194 border-right-color: #ccc; 195 top: 8px; 196 } 197 198 #buddypress #whats-new-textarea:after { 199 border-width: 9px; 200 border-right-color: #fff; 201 top: 9px; 202 } 203 204 #buddypress #whats-new-textarea.active:before { 205 border-right-color: rgba(31, 179, 221, 0.9) !important; 206 } 207 158 208 /*-------------------------------------------------------------- 159 209 3.1.1 - Activity Listing 160 210 --------------------------------------------------------------*/ -
new file src/bp-templates/bp-legacy/js/autosize.js
diff --git src/bp-templates/bp-legacy/js/autosize.js src/bp-templates/bp-legacy/js/autosize.js new file mode 100644 index 0000000..70dd07c
- + 1 /*! 2 Autosize 3.0.13 3 license: MIT 4 http://www.jacklmoore.com/autosize 5 */ 6 (function (global, factory) { 7 if (typeof define === 'function' && define.amd) { 8 define(['exports', 'module'], factory); 9 } else if (typeof exports !== 'undefined' && typeof module !== 'undefined') { 10 factory(exports, module); 11 } else { 12 var mod = { 13 exports: {} 14 }; 15 factory(mod.exports, mod); 16 global.autosize = mod.exports; 17 } 18 })(this, function (exports, module) { 19 'use strict'; 20 21 var set = typeof Set === 'function' ? new Set() : (function () { 22 var list = []; 23 24 return { 25 has: function has(key) { 26 return Boolean(list.indexOf(key) > -1); 27 }, 28 add: function add(key) { 29 list.push(key); 30 }, 31 'delete': function _delete(key) { 32 list.splice(list.indexOf(key), 1); 33 } }; 34 })(); 35 36 function assign(ta) { 37 var _ref = arguments[1] === undefined ? {} : arguments[1]; 38 39 var _ref$setOverflowX = _ref.setOverflowX; 40 var setOverflowX = _ref$setOverflowX === undefined ? true : _ref$setOverflowX; 41 var _ref$setOverflowY = _ref.setOverflowY; 42 var setOverflowY = _ref$setOverflowY === undefined ? true : _ref$setOverflowY; 43 44 if (!ta || !ta.nodeName || ta.nodeName !== 'TEXTAREA' || set.has(ta)) return; 45 46 var heightOffset = null; 47 var overflowY = null; 48 var clientWidth = ta.clientWidth; 49 50 function init() { 51 var style = window.getComputedStyle(ta, null); 52 53 overflowY = style.overflowY; 54 55 if (style.resize === 'vertical') { 56 ta.style.resize = 'none'; 57 } else if (style.resize === 'both') { 58 ta.style.resize = 'horizontal'; 59 } 60 61 if (style.boxSizing === 'content-box') { 62 heightOffset = -(parseFloat(style.paddingTop) + parseFloat(style.paddingBottom)); 63 } else { 64 heightOffset = parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth); 65 } 66 // Fix when a textarea is not on document body and heightOffset is Not a Number 67 if (isNaN(heightOffset)) { 68 heightOffset = 0; 69 } 70 71 update(); 72 } 73 74 function changeOverflow(value) { 75 { 76 // Chrome/Safari-specific fix: 77 // When the textarea y-overflow is hidden, Chrome/Safari do not reflow the text to account for the space 78 // made available by removing the scrollbar. The following forces the necessary text reflow. 79 var width = ta.style.width; 80 ta.style.width = '0px'; 81 // Force reflow: 82 /* jshint ignore:start */ 83 ta.offsetWidth; 84 /* jshint ignore:end */ 85 ta.style.width = width; 86 } 87 88 overflowY = value; 89 90 if (setOverflowY) { 91 ta.style.overflowY = value; 92 } 93 94 resize(); 95 } 96 97 function resize() { 98 var htmlTop = window.pageYOffset; 99 var bodyTop = document.body.scrollTop; 100 var originalHeight = ta.style.height; 101 102 ta.style.height = 'auto'; 103 104 var endHeight = ta.scrollHeight + heightOffset; 105 106 if (ta.scrollHeight === 0) { 107 // If the scrollHeight is 0, then the element probably has display:none or is detached from the DOM. 108 ta.style.height = originalHeight; 109 return; 110 } 111 112 ta.style.height = endHeight + 'px'; 113 114 // used to check if an update is actually necessary on window.resize 115 clientWidth = ta.clientWidth; 116 117 // prevents scroll-position jumping 118 document.documentElement.scrollTop = htmlTop; 119 document.body.scrollTop = bodyTop; 120 } 121 122 function update() { 123 var startHeight = ta.style.height; 124 125 resize(); 126 127 var style = window.getComputedStyle(ta, null); 128 129 if (style.height !== ta.style.height) { 130 if (overflowY !== 'visible') { 131 changeOverflow('visible'); 132 } 133 } else { 134 if (overflowY !== 'hidden') { 135 changeOverflow('hidden'); 136 } 137 } 138 139 if (startHeight !== ta.style.height) { 140 var evt = document.createEvent('Event'); 141 evt.initEvent('autosize:resized', true, false); 142 ta.dispatchEvent(evt); 143 } 144 } 145 146 var pageResize = function pageResize() { 147 if (ta.clientWidth !== clientWidth) { 148 update(); 149 } 150 }; 151 152 var destroy = (function (style) { 153 window.removeEventListener('resize', pageResize); 154 ta.removeEventListener('input', update); 155 ta.removeEventListener('keyup', update); 156 ta.removeEventListener('autosize:destroy', destroy); 157 set['delete'](ta); 158 159 Object.keys(style).forEach(function (key) { 160 ta.style[key] = style[key]; 161 }); 162 }).bind(ta, { 163 height: ta.style.height, 164 resize: ta.style.resize, 165 overflowY: ta.style.overflowY, 166 overflowX: ta.style.overflowX, 167 wordWrap: ta.style.wordWrap }); 168 169 ta.addEventListener('autosize:destroy', destroy); 170 171 // IE9 does not fire onpropertychange or oninput for deletions, 172 // so binding to onkeyup to catch most of those events. 173 // There is no way that I know of to detect something like 'cut' in IE9. 174 if ('onpropertychange' in ta && 'oninput' in ta) { 175 ta.addEventListener('keyup', update); 176 } 177 178 window.addEventListener('resize', pageResize); 179 ta.addEventListener('input', update); 180 ta.addEventListener('autosize:update', update); 181 set.add(ta); 182 183 if (setOverflowX) { 184 ta.style.overflowX = 'hidden'; 185 ta.style.wordWrap = 'break-word'; 186 } 187 188 init(); 189 } 190 191 function destroy(ta) { 192 if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return; 193 var evt = document.createEvent('Event'); 194 evt.initEvent('autosize:destroy', true, false); 195 ta.dispatchEvent(evt); 196 } 197 198 function update(ta) { 199 if (!(ta && ta.nodeName && ta.nodeName === 'TEXTAREA')) return; 200 var evt = document.createEvent('Event'); 201 evt.initEvent('autosize:update', true, false); 202 ta.dispatchEvent(evt); 203 } 204 205 var autosize = null; 206 207 // Do nothing in Node.js environment and IE8 (or lower) 208 if (typeof window === 'undefined' || typeof window.getComputedStyle !== 'function') { 209 autosize = function (el) { 210 return el; 211 }; 212 autosize.destroy = function (el) { 213 return el; 214 }; 215 autosize.update = function (el) { 216 return el; 217 }; 218 } else { 219 autosize = function (el, options) { 220 if (el) { 221 Array.prototype.forEach.call(el.length ? el : [el], function (x) { 222 return assign(x, options); 223 }); 224 } 225 return el; 226 }; 227 autosize.destroy = function (el) { 228 if (el) { 229 Array.prototype.forEach.call(el.length ? el : [el], destroy); 230 } 231 return el; 232 }; 233 autosize.update = function (el) { 234 if (el) { 235 Array.prototype.forEach.call(el.length ? el : [el], update); 236 } 237 return el; 238 }; 239 } 240 241 module.exports = autosize; 242 }); 243 No newline at end of file -
src/bp-templates/bp-legacy/js/buddypress.js
diff --git src/bp-templates/bp-legacy/js/buddypress.js src/bp-templates/bp-legacy/js/buddypress.js index d0eb3d2..a79fc82 100644
jq(document).ready( function() { 32 32 if ( $whats_new.length && bp_get_querystring('r') ) { 33 33 var $member_nicename = $whats_new.val(); 34 34 35 jq('#whats-new-options').animate({ 36 height:'50px' 37 }); 38 39 $whats_new.animate({ 40 height:'50px' 35 jq('#whats-new-actions').animate({ 36 height:'100%' 41 37 }); 42 38 43 39 jq.scrollTo( $whats_new, 500, { … … jq(document).ready( function() { 52 48 53 49 /* Textarea focus */ 54 50 $whats_new.focus( function(){ 55 jq('#whats-new-options').animate({ 56 height:'50px' 57 }); 58 jq('#whats-new-form textarea').animate({ 59 height:'50px' 51 jq('#whats-new-actions').animate({ 52 height:'100%' 60 53 }); 54 61 55 jq('#aw-whats-new-submit').prop('disabled', false); 62 56 57 jq( this ).parent().addClass( 'active' ); 63 58 jq( '#whats-new-content' ).addClass( 'active' ); 64 59 65 60 var $whats_new_form = jq('form#whats-new-form'), … … jq(document).ready( function() { 83 78 } 84 79 }); 85 80 86 /* On blur, shrink if it's empty */ 87 $whats_new.blur( function(){ 88 if ( document.activeElement !== this ) { 89 if (!this.value.match(/\S+/)) { 90 this.value = ''; 91 jq('#whats-new-options').animate({ 92 height:'0' 93 }); 94 jq('form#whats-new-form textarea').animate({ 95 height:'20px' 96 }); 97 jq('#aw-whats-new-submit').prop('disabled', true); 98 jq( '#whats-new-content' ).removeClass( 'active' ); 99 } 81 /* For the "What's New" form, do something on reset or focusout. */ 82 jq( '#whats-new-form' ).on( 'reset focusout', function( e ) { 83 // Reset only 84 if ( 'reset' === e.type ) { 85 // Make sure the textarea has been emptied 86 // When ?r=@username it's not the case 87 jq( '#whats-new-form textarea').text( '' ); 88 89 jq( '#whats-new-actions' ).animate( { 90 height:'0' 91 } ); 92 93 jq( '#whats-new-form textarea').css( { 94 height:'auto' 95 } ); 96 97 jq( '#aw-whats-new-submit').prop( 'disabled', true ); 100 98 } 101 }); 99 jq( '#whats-new-content' ).removeClass( 'active' ); 100 $whats_new.parent().removeClass( 'active' ); 101 } ); 102 103 /* Texarea auto-resize */ 104 autosize( $whats_new ); 102 105 103 106 /* New posts */ 104 107 jq('#aw-whats-new-submit').on( 'click', function() { 105 108 var last_date_recorded = 0, 106 109 button = jq(this), 107 form = button.closest('form#whats-new-form'); 110 form = button.closest('form#whats-new-form'), 111 inputs = {}, post_data; 112 113 // Get all inputs and organize them into an object {name: value} 114 jq.each( form.serializeArray(), function( key, input ) { 115 // Only include public extra data 116 if ( '_' !== input.name.substr( 0, 1 ) && 'whats-new' !== input.name.substr( 0, 9 ) ) { 117 if ( ! inputs[ input.name ] ) { 118 inputs[ input.name ] = input.value; 119 } else { 120 // Checkboxes/dropdown list can have multiple selected value 121 if ( ! jq.isArray( inputs[ input.name ] ) ) { 122 inputs[ input.name ] = new Array( inputs[ input.name ], input.value ); 123 } else { 124 inputs[ input.name ].push( input.value ); 125 } 126 } 127 } 128 } ); 108 129 109 form. children().each( function() {110 if ( jq.nodeName( this, 'textarea') || jq.nodeName(this, 'input') ) {130 form.find( '*' ).each( function() { 131 if ( jq.nodeName( this, 'textarea') || jq.nodeName( this, 'input' ) ) { 111 132 jq(this).prop( 'disabled', true ); 112 133 } 113 } );134 } ); 114 135 115 136 /* Remove any errors */ 116 137 jq('div.error').remove(); … … jq(document).ready( function() { 145 166 object = jq('#whats-new-post-object').val(); 146 167 } 147 168 148 jq.post( ajaxurl, {149 action: 'post_update',150 'cookie': bp_get_cookies(),151 ' _wpnonce_post_update': jq('#_wpnonce_post_update').val(),152 ' content': content,153 ' object': object,154 ' item_id': item_id,155 ' since': last_date_recorded,156 ' _bp_as_nonce': jq('#_bp_as_nonce').val() || ''157 },158 function(response) {169 // Include the public data to the post data 170 post_data = jq.extend( { 171 action : 'post_update', 172 'cookie' : bp_get_cookies(), 173 '_wpnonce_post_update' : jq('#_wpnonce_post_update').val(), 174 'content' : content, 175 'object' : object, 176 'item_id' : item_id, 177 'since' : last_date_recorded, 178 '_bp_as_nonce' : jq('#_bp_as_nonce').val() || '', 179 }, inputs ); 159 180 160 form.children().each( function() { 161 if ( jq.nodeName(this, 'textarea') || jq.nodeName(this, 'input') ) { 162 jq(this).prop( 'disabled', false ); 181 jq.post( ajaxurl, post_data, function( response ) { 182 183 form.find( '*' ).each( function() { 184 if ( jq.nodeName( this, 'textarea') || jq.nodeName( this, 'input' ) ) { 185 jq( this ).prop( 'disabled', false ); 163 186 } 164 } );187 } ); 165 188 166 189 /* Check for errors and append if found. */ 167 190 if ( response[0] + response[1] === '-1' ) { … … jq(document).ready( function() { 204 227 205 228 jq('li.new-update').hide().slideDown( 300 ); 206 229 jq('li.new-update').removeClass( 'new-update' ); 207 jq('#whats-new').val(''); 230 231 // Reset the form 232 form.get(0).reset(); 208 233 209 234 // reset vars to get newest activities 210 235 newest_activities = ''; 211 236 activity_last_recorded = 0; 212 237 } 213 238 214 jq('#whats-new- options').animate({239 jq('#whats-new-actions').animate({ 215 240 height:'0px' 216 241 }); 217 jq('#whats-new-form textarea').animate({ 218 height:'20px' 219 }); 242 220 243 jq('#aw-whats-new-submit').prop('disabled', true).removeClass('loading'); 221 244 jq( '#whats-new-content' ).removeClass( 'active' ); 222 } );245 } ); 223 246 224 247 return false; 225 248 });