Ticket #6569: 6569.js-only.02.patch
File 6569.js-only.02.patch, 24.6 KB (added by , 9 years ago) |
---|
-
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..0dbf04d 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 … … class BP_Legacy extends BP_Theme_Compat { 331 344 332 345 // Star private messages. 333 346 if ( bp_is_active( 'messages', 'star' ) && bp_is_user_messages() ) { 334 wp_localize_script( $ asset['handle'], 'BP_PM_Star', array(347 wp_localize_script( $js['handle'], 'BP_PM_Star', array( 335 348 'strings' => array( 336 349 'text_unstar' => __( 'Unstar', 'buddypress' ), 337 350 'text_star' => __( 'Star', 'buddypress' ), -
src/bp-templates/bp-legacy/css/buddypress-rtl.css
diff --git src/bp-templates/bp-legacy/css/buddypress-rtl.css src/bp-templates/bp-legacy/css/buddypress-rtl.css index afea7e9..0ad326b 100644
Hello, this is the BuddyPress Legacy stylesheet. 129 129 font-family: inherit; 130 130 font-size: medium; 131 131 height: 20px; 132 overflow: hidden; 132 133 padding: 6px; 134 resize: none; 133 135 width: 98%; 134 136 } 135 137 body.no-js #buddypress form#whats-new-form textarea { 136 138 height: 50px; 139 overflow: auto; 137 140 } 138 141 #buddypress form#whats-new-form #whats-new-options select { 139 142 max-width: 200px; … … body.no-js #buddypress form#whats-new-form textarea { 143 146 float: left; 144 147 margin-top: 12px; 145 148 } 146 #buddypress #whats-new-options { 147 overflow: auto; 148 height: 0; 149 #buddypress #whats-new-options:after { 150 clear: both; 151 content: ''; 152 display: table; 149 153 } 150 154 body.no-js #buddypress #whats-new-options { 151 155 height: auto; … … body.no-js #buddypress #whats-new-options { 155 159 outline-color: rgba(31, 179, 221, 0.9); 156 160 } 157 161 162 /* Autosize.js hack for IE10-11 - avoids jumpiness */ 163 @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { 164 #buddypress form#whats-new-form textarea { 165 padding-bottom: 22px; 166 } 167 } 168 158 169 /*-------------------------------------------------------------- 159 170 3.1.1 - Activity Listing 160 171 --------------------------------------------------------------*/ -
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 d0a4a01..d144b47 100644
Hello, this is the BuddyPress Legacy stylesheet. 129 129 font-family: inherit; 130 130 font-size: medium; 131 131 height: 20px; 132 overflow: hidden; 132 133 padding: 6px; 134 resize: none; 133 135 width: 98%; 134 136 } 135 137 body.no-js #buddypress form#whats-new-form textarea { 136 138 height: 50px; 139 overflow: auto; 137 140 } 138 141 #buddypress form#whats-new-form #whats-new-options select { 139 142 max-width: 200px; … … body.no-js #buddypress form#whats-new-form textarea { 143 146 float: right; 144 147 margin-top: 12px; 145 148 } 146 #buddypress #whats-new-options { 147 overflow: auto; 148 height: 0; 149 #buddypress #whats-new-options:after { 150 clear: both; 151 content: ''; 152 display: table; 149 153 } 150 154 body.no-js #buddypress #whats-new-options { 151 155 height: auto; … … body.no-js #buddypress #whats-new-options { 155 159 outline-color: rgba(31, 179, 221, 0.9); 156 160 } 157 161 162 /* Autosize.js hack for IE10-11 - avoids jumpiness */ 163 @media all and (-ms-high-contrast: none), (-ms-high-contrast: active) { 164 #buddypress form#whats-new-form textarea { 165 padding-bottom: 22px; 166 } 167 } 168 158 169 /*-------------------------------------------------------------- 159 170 3.1.1 - Activity Listing 160 171 --------------------------------------------------------------*/ -
src/bp-templates/bp-legacy/css/twentyfifteen-rtl.css
diff --git src/bp-templates/bp-legacy/css/twentyfifteen-rtl.css src/bp-templates/bp-legacy/css/twentyfifteen-rtl.css index 9410aa2..6a62884 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 493 493 } 494 494 } 495 495 496 #buddypress form#whats-new-form #whats-new-options[style] {497 min-height: 6rem;498 overflow: visible;499 }500 501 496 #buddypress form#whats-new-form #whats-new-options[style] #whats-new-post-in-box { 502 497 border: 1px solid rgba(153, 153, 153, 0.5); 503 498 float: right; -
src/bp-templates/bp-legacy/css/twentyfifteen.css
diff --git src/bp-templates/bp-legacy/css/twentyfifteen.css src/bp-templates/bp-legacy/css/twentyfifteen.css index c9908f8..092e348 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 493 493 } 494 494 } 495 495 496 #buddypress form#whats-new-form #whats-new-options[style] {497 min-height: 6rem;498 overflow: visible;499 }500 501 496 #buddypress form#whats-new-form #whats-new-options[style] #whats-new-post-in-box { 502 497 border: 1px solid rgba(153, 153, 153, 0.5); 503 498 float: left; -
src/bp-templates/bp-legacy/css/twentyfifteen.scss
diff --git src/bp-templates/bp-legacy/css/twentyfifteen.scss src/bp-templates/bp-legacy/css/twentyfifteen.scss index b1a0d57..d0fcf9c 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 686 686 } // close @media 687 687 688 688 #whats-new-options[style] { 689 min-height: 6rem;690 overflow: visible;691 692 689 #whats-new-post-in-box { 693 690 border: 1px solid rgba($border-color, 0.5); 694 691 float: left; -
src/bp-templates/bp-legacy/css/twentyfourteen-rtl.css
diff --git src/bp-templates/bp-legacy/css/twentyfourteen-rtl.css src/bp-templates/bp-legacy/css/twentyfourteen-rtl.css index 00803df..8dcb7ae 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 428 428 width: 100%; 429 429 } 430 430 431 #buddypress form#whats-new-form #whats-new-content #whats-new-options[style] {432 height: auto !important;433 }434 435 431 @media screen and (max-width: 594px) { 436 432 #buddypress form#whats-new-form #whats-new-content #whats-new-options { 437 433 display: flex; -
src/bp-templates/bp-legacy/css/twentyfourteen.css
diff --git src/bp-templates/bp-legacy/css/twentyfourteen.css src/bp-templates/bp-legacy/css/twentyfourteen.css index 833cbfa..5887722 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 428 428 width: 100%; 429 429 } 430 430 431 #buddypress form#whats-new-form #whats-new-content #whats-new-options[style] {432 height: auto !important;433 }434 435 431 @media screen and (max-width: 594px) { 436 432 #buddypress form#whats-new-form #whats-new-content #whats-new-options { 437 433 display: flex; -
src/bp-templates/bp-legacy/css/twentyfourteen.scss
diff --git src/bp-templates/bp-legacy/css/twentyfourteen.scss src/bp-templates/bp-legacy/css/twentyfourteen.scss index dcf6ed7..92103f1 100644
$nav-background-border: #bebebe; 677 677 } 678 678 679 679 #whats-new-content { 680 681 #whats-new-options[style] {682 // Have to override the BP fixed height683 height: auto !important;684 }685 686 680 @media screen and (max-width: 594px) { 687 681 #whats-new-options { 688 682 display: flex; -
src/bp-templates/bp-legacy/css/twentysixteen-rtl.css
diff --git src/bp-templates/bp-legacy/css/twentysixteen-rtl.css src/bp-templates/bp-legacy/css/twentysixteen-rtl.css index 76b87fa..bee3d12 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 582 582 } 583 583 } 584 584 585 #buddypress form#whats-new-form #whats-new-content.active #whats-new-options[style] {586 min-height: 6rem;587 overflow: visible;588 }589 590 585 #buddypress form#whats-new-form #whats-new-content.active #whats-new-options[style] #whats-new-post-in-box { 591 586 border: 1px solid rgba(212, 208, 186, 0.5); 592 587 float: right; -
src/bp-templates/bp-legacy/css/twentysixteen.css
diff --git src/bp-templates/bp-legacy/css/twentysixteen.css src/bp-templates/bp-legacy/css/twentysixteen.css index 9b5ce80..998e35f 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 582 582 } 583 583 } 584 584 585 #buddypress form#whats-new-form #whats-new-content.active #whats-new-options[style] {586 min-height: 6rem;587 overflow: visible;588 }589 590 585 #buddypress form#whats-new-form #whats-new-content.active #whats-new-options[style] #whats-new-post-in-box { 591 586 border: 1px solid rgba(212, 208, 186, 0.5); 592 587 float: left; -
src/bp-templates/bp-legacy/css/twentysixteen.scss
diff --git src/bp-templates/bp-legacy/css/twentysixteen.scss src/bp-templates/bp-legacy/css/twentysixteen.scss index c92798d..396e4a2 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 885 885 886 886 #whats-new-content.active { 887 887 #whats-new-options[style] { 888 min-height: 6rem; // unit open to debate px value might be better.889 overflow: visible;890 891 888 #whats-new-post-in-box { 892 889 border: 1px solid rgba($border-color, 0.5); 893 890 float: left; -
src/bp-templates/bp-legacy/css/twentythirteen-rtl.css
diff --git src/bp-templates/bp-legacy/css/twentythirteen-rtl.css src/bp-templates/bp-legacy/css/twentythirteen-rtl.css index 88393e5..5184c01 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 534 534 } 535 535 } 536 536 537 #buddypress form#whats-new-form #whats-new-content.active #whats-new-options[style] {538 min-height: 6rem;539 overflow: visible;540 }541 542 537 #buddypress form#whats-new-form #whats-new-content.active #whats-new-options[style] #whats-new-post-in-box { 543 538 border: 1px solid rgba(212, 208, 186, 0.5); 544 539 float: right; -
src/bp-templates/bp-legacy/css/twentythirteen.css
diff --git src/bp-templates/bp-legacy/css/twentythirteen.css src/bp-templates/bp-legacy/css/twentythirteen.css index 794a4c3..d06d861 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 534 534 } 535 535 } 536 536 537 #buddypress form#whats-new-form #whats-new-content.active #whats-new-options[style] {538 min-height: 6rem;539 overflow: visible;540 }541 542 537 #buddypress form#whats-new-form #whats-new-content.active #whats-new-options[style] #whats-new-post-in-box { 543 538 border: 1px solid rgba(212, 208, 186, 0.5); 544 539 float: left; -
src/bp-templates/bp-legacy/css/twentythirteen.scss
diff --git src/bp-templates/bp-legacy/css/twentythirteen.scss src/bp-templates/bp-legacy/css/twentythirteen.scss index 26d1e59..7485aa1 100644
http://codex.buddypress.org/themes/buddypress-companion-stylesheets/ 794 794 795 795 #whats-new-content.active { 796 796 #whats-new-options[style] { 797 min-height: 6rem; // unit open to debate px value might be better.798 overflow: visible;799 800 797 #whats-new-post-in-box { 801 798 border: 1px solid rgba($border-color, 0.5); 802 799 float: left; -
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..0597a47 100644
jq(document).ready( function() { 23 23 bp_init_activity(); 24 24 25 25 var objects = [ 'members', 'groups', 'blogs', 'forums', 'group_members' ], 26 $whats_new = jq('#whats-new') ;26 $whats_new = jq('#whats-new'), whats_new_height; 27 27 28 28 /* Object filter and scope set. */ 29 29 bp_init_objects( objects ); 30 30 31 /* Textarea defaults */ 32 $whats_new.attr( 'rows', '1' ); 33 whats_new_height = $whats_new.height(); 34 35 /* Textarea resize */ 36 autosize( $whats_new ); 37 31 38 /* @mention Compose Scrolling */ 32 39 if ( $whats_new.length && bp_get_querystring('r') ) { 33 40 var $member_nicename = $whats_new.val(); 34 41 35 jq('#whats-new-options').animate({ 36 height:'50px' 37 }); 38 39 $whats_new.animate({ 40 height:'50px' 41 }); 42 jq('#whats-new-options').slideDown(); 42 43 43 44 jq.scrollTo( $whats_new, 500, { 44 45 offset:-125, … … jq(document).ready( function() { 46 47 } ); 47 48 48 49 $whats_new.val('').focus().val( $member_nicename ); 50 } else { 51 jq('#whats-new-options').hide(); 49 52 } 50 53 51 54 /**** Activity Posting ********************************************************/ 52 55 53 56 /* Textarea focus */ 54 57 $whats_new.focus( function(){ 55 jq('#whats-new-options').animate({ 56 height:'50px' 57 }); 58 jq('#whats-new-form textarea').animate({ 59 height:'50px' 60 }); 58 jq( '#whats-new-options' ).slideDown(); 59 61 60 jq('#aw-whats-new-submit').prop('disabled', false); 62 61 62 jq( this ).parent().addClass( 'active' ); 63 63 jq( '#whats-new-content' ).addClass( 'active' ); 64 64 65 65 var $whats_new_form = jq('form#whats-new-form'), … … jq(document).ready( function() { 83 83 } 84 84 }); 85 85 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); 86 /* For the "What's New" form, do the following on focusout. */ 87 jq( '#whats-new-form' ).on( 'focusout', function( e ) { 88 var elem = jq( this ); 89 90 // Let child hover actions passthrough. 91 // This allows click events to go through without focusout. 92 setTimeout( function () { 93 if ( ! elem.find(':hover').length ) { 94 // Do not slide up if textarea has content. 95 if ( '' !== $whats_new.val() ) { 96 return; 97 } 98 99 jq( '#whats-new-options' ).slideUp(); 100 101 jq('#aw-whats-new-submit').prop( 'disabled', true ); 102 98 103 jq( '#whats-new-content' ).removeClass( 'active' ); 104 $whats_new.parent().removeClass( 'active' ); 99 105 } 100 } 101 } );106 }, 0 ); 107 } ); 102 108 103 109 /* New posts */ 104 110 jq('#aw-whats-new-submit').on( 'click', function() { 105 111 var last_date_recorded = 0, 106 112 button = jq(this), 107 form = button.closest('form#whats-new-form'); 113 form = button.closest('form#whats-new-form'), 114 inputs = {}, post_data; 115 116 // Get all inputs and organize them into an object {name: value} 117 jq.each( form.serializeArray(), function( key, input ) { 118 // Only include public extra data 119 if ( '_' !== input.name.substr( 0, 1 ) && 'whats-new' !== input.name.substr( 0, 9 ) ) { 120 if ( ! inputs[ input.name ] ) { 121 inputs[ input.name ] = input.value; 122 } else { 123 // Checkboxes/dropdown list can have multiple selected value 124 if ( ! jq.isArray( inputs[ input.name ] ) ) { 125 inputs[ input.name ] = new Array( inputs[ input.name ], input.value ); 126 } else { 127 inputs[ input.name ].push( input.value ); 128 } 129 } 130 } 131 } ); 108 132 109 form. children().each( function() {110 if ( jq.nodeName( this, 'textarea') || jq.nodeName(this, 'input') ) {133 form.find( '*' ).each( function() { 134 if ( jq.nodeName( this, 'textarea' ) || jq.nodeName( this, 'input' ) ) { 111 135 jq(this).prop( 'disabled', true ); 112 136 } 113 } );137 } ); 114 138 115 139 /* Remove any errors */ 116 140 jq('div.error').remove(); … … jq(document).ready( function() { 145 169 object = jq('#whats-new-post-object').val(); 146 170 } 147 171 148 jq.post( ajaxurl,{172 post_data = jq.extend( { 149 173 action: 'post_update', 150 174 'cookie': bp_get_cookies(), 151 175 '_wpnonce_post_update': jq('#_wpnonce_post_update').val(), … … jq(document).ready( function() { 154 178 'item_id': item_id, 155 179 'since': last_date_recorded, 156 180 '_bp_as_nonce': jq('#_bp_as_nonce').val() || '' 157 }, 158 function(response) { 181 }, inputs ); 159 182 160 form.children().each( function() { 161 if ( jq.nodeName(this, 'textarea') || jq.nodeName(this, 'input') ) { 183 jq.post( ajaxurl, post_data, function( response ) { 184 form.find( '*' ).each( function() { 185 if ( jq.nodeName( this, 'textarea' ) || jq.nodeName( this, 'input' ) ) { 162 186 jq(this).prop( 'disabled', false ); 163 187 } 164 188 }); … … jq(document).ready( function() { 205 229 jq('li.new-update').hide().slideDown( 300 ); 206 230 jq('li.new-update').removeClass( 'new-update' ); 207 231 jq('#whats-new').val(''); 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({ 215 height:'0px' 216 }); 239 jq('#whats-new-options').slideUp(); 217 240 jq('#whats-new-form textarea').animate({ 218 height: '20px'241 height: whats_new_height 219 242 }); 220 243 jq('#aw-whats-new-submit').prop('disabled', true).removeClass('loading'); 221 244 jq( '#whats-new-content' ).removeClass( 'active' );