Changeset 6940
- Timestamp:
- 04/22/2013 05:01:53 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-templates/bp-legacy/js/buddypress.js
r6894 r6940 76 76 jq.post( ajaxurl, { 77 77 action: 'post_update', 78 'cookie': encodeURIComponent(document.cookie),78 'cookie': bp_get_cookies(), 79 79 '_wpnonce_post_update': jq("#_wpnonce_post_update").val(), 80 80 'content': content, … … 196 196 jq.post( ajaxurl, { 197 197 action: 'activity_mark_' + type, 198 'cookie': encodeURIComponent(document.cookie),198 'cookie': bp_get_cookies(), 199 199 'id': parent_id 200 200 }, … … 253 253 jq.post( ajaxurl, { 254 254 action: 'delete_activity', 255 'cookie': encodeURIComponent(document.cookie),255 'cookie': bp_get_cookies(), 256 256 'id': id, 257 257 '_wpnonce': nonce … … 307 307 jq.post( ajaxurl, { 308 308 action: 'activity_get_older_updates', 309 'cookie': encodeURIComponent(document.cookie),309 'cookie': bp_get_cookies(), 310 310 'page': oldest_page 311 311 }, … … 423 423 var ajaxdata = { 424 424 action: 'new_activity_comment', 425 'cookie': encodeURIComponent(document.cookie),425 'cookie': bp_get_cookies(), 426 426 '_wpnonce_new_activity_comment': jq("#_wpnonce_new_activity_comment").val(), 427 427 'comment_id': comment_id, … … 496 496 jq.post( ajaxurl, { 497 497 action: 'delete_activity_comment', 498 'cookie': encodeURIComponent(document.cookie),498 'cookie': bp_get_cookies(), 499 499 '_wpnonce': nonce, 500 500 'id': comment_id … … 773 773 action: 'groups_invite_user', 774 774 'friend_action': friend_action, 775 'cookie': encodeURIComponent(document.cookie),775 'cookie': bp_get_cookies(), 776 776 '_wpnonce': jq("#_wpnonce_invite_uninvite_user").val(), 777 777 'friend_id': friend_id, … … 806 806 action: 'groups_invite_user', 807 807 'friend_action': 'uninvite', 808 'cookie': encodeURIComponent(document.cookie),808 'cookie': bp_get_cookies(), 809 809 '_wpnonce': jq("#_wpnonce_invite_uninvite_user").val(), 810 810 'friend_id': friend_id, … … 873 873 jq.post( ajaxurl, { 874 874 action: action, 875 'cookie': encodeURIComponent(document.cookie),875 'cookie': bp_get_cookies(), 876 876 'id': id, 877 877 '_wpnonce': nonce … … 915 915 jq.post( ajaxurl, { 916 916 action: 'addremove_friend', 917 'cookie': encodeURIComponent(document.cookie),917 'cookie': bp_get_cookies(), 918 918 'fid': fid, 919 919 '_wpnonce': nonce … … 964 964 jq.post( ajaxurl, { 965 965 action: 'joinleave_group', 966 'cookie': encodeURIComponent(document.cookie),966 'cookie': bp_get_cookies(), 967 967 'gid': gid, 968 968 '_wpnonce': nonce … … 1021 1021 jq.post( ajaxurl, { 1022 1022 action: 'messages_send_reply', 1023 'cookie': encodeURIComponent(document.cookie),1023 'cookie': bp_get_cookies(), 1024 1024 '_wpnonce': jq("#send_message_nonce").val(), 1025 1025 … … 1307 1307 bp_ajax_request = jq.post( ajaxurl, { 1308 1308 action: object + '_filter', 1309 'cookie': encodeURIComponent(document.cookie),1309 'cookie': bp_get_cookies(), 1310 1310 'object': object, 1311 1311 'filter': filter, … … 1355 1355 bp_ajax_request = jq.post( ajaxurl, { 1356 1356 action: 'activity_widget_filter', 1357 'cookie': encodeURIComponent(document.cookie),1357 'cookie': bp_get_cookies(), 1358 1358 '_wpnonce_activity_filter': jq("#_wpnonce_activity_filter").val(), 1359 1359 'scope': scope, … … 1449 1449 } 1450 1450 1451 /* Returns a querystring of BP cookies (cookies beginning with 'bp-') */ 1452 function bp_get_cookies() { 1453 // get all cookies and split into an array 1454 var allCookies = document.cookie.split(";"); 1455 1456 var bpCookies = {}; 1457 var cookiePrefix = 'bp-'; 1458 1459 // loop through cookies 1460 for (var i = 0; i < allCookies.length; i++) { 1461 var cookie = allCookies[i]; 1462 var delimiter = cookie.indexOf("="); 1463 var name = unescape( cookie.slice(0, delimiter) ).trim(); 1464 var value = unescape( cookie.slice(delimiter + 1) ); 1465 1466 // if BP cookie, store it 1467 if ( name.indexOf(cookiePrefix) == 0 ) { 1468 bpCookies[name] = value; 1469 } 1470 } 1471 1472 // returns BP cookies as querystring 1473 return encodeURIComponent( jq.param(bpCookies) ); 1474 } 1475 1451 1476 /* ScrollTo plugin - just inline and minified */ 1452 1477 ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery); -
trunk/bp-themes/bp-default/_inc/global.js
r6922 r6940 76 76 jq.post( ajaxurl, { 77 77 action: 'post_update', 78 'cookie': encodeURIComponent(document.cookie),78 'cookie': bp_get_cookies(), 79 79 '_wpnonce_post_update': jq("input#_wpnonce_post_update").val(), 80 80 'content': content, … … 196 196 jq.post( ajaxurl, { 197 197 action: 'activity_mark_' + type, 198 'cookie': encodeURIComponent(document.cookie),198 'cookie': bp_get_cookies(), 199 199 'id': parent_id 200 200 }, … … 250 250 jq.post( ajaxurl, { 251 251 action: 'delete_activity', 252 'cookie': encodeURIComponent(document.cookie),252 'cookie': bp_get_cookies(), 253 253 'id': id, 254 254 '_wpnonce': nonce … … 304 304 jq.post( ajaxurl, { 305 305 action: 'activity_get_older_updates', 306 'cookie': encodeURIComponent(document.cookie),306 'cookie': bp_get_cookies(), 307 307 'page': oldest_page 308 308 }, … … 417 417 var ajaxdata = { 418 418 action: 'new_activity_comment', 419 'cookie': encodeURIComponent(document.cookie),419 'cookie': bp_get_cookies(), 420 420 '_wpnonce_new_activity_comment': jq("input#_wpnonce_new_activity_comment").val(), 421 421 'comment_id': comment_id, … … 489 489 jq.post( ajaxurl, { 490 490 action: 'delete_activity_comment', 491 'cookie': encodeURIComponent(document.cookie),491 'cookie': bp_get_cookies(), 492 492 '_wpnonce': nonce, 493 493 'id': comment_id … … 761 761 action: 'groups_invite_user', 762 762 'friend_action': friend_action, 763 'cookie': encodeURIComponent(document.cookie),763 'cookie': bp_get_cookies(), 764 764 '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(), 765 765 'friend_id': friend_id, … … 794 794 action: 'groups_invite_user', 795 795 'friend_action': 'uninvite', 796 'cookie': encodeURIComponent(document.cookie),796 'cookie': bp_get_cookies(), 797 797 '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(), 798 798 'friend_id': friend_id, … … 861 861 jq.post( ajaxurl, { 862 862 action: action, 863 'cookie': encodeURIComponent(document.cookie),863 'cookie': bp_get_cookies(), 864 864 'id': id, 865 865 '_wpnonce': nonce … … 903 903 jq.post( ajaxurl, { 904 904 action: 'addremove_friend', 905 'cookie': encodeURIComponent(document.cookie),905 'cookie': bp_get_cookies(), 906 906 'fid': fid, 907 907 '_wpnonce': nonce … … 952 952 jq.post( ajaxurl, { 953 953 action: 'joinleave_group', 954 'cookie': encodeURIComponent(document.cookie),954 'cookie': bp_get_cookies(), 955 955 'gid': gid, 956 956 '_wpnonce': nonce … … 1009 1009 jq.post( ajaxurl, { 1010 1010 action: 'messages_send_reply', 1011 'cookie': encodeURIComponent(document.cookie),1011 'cookie': bp_get_cookies(), 1012 1012 '_wpnonce': jq("input#send_message_nonce").val(), 1013 1013 … … 1290 1290 bp_ajax_request = jq.post( ajaxurl, { 1291 1291 action: object + '_filter', 1292 'cookie': encodeURIComponent(document.cookie),1292 'cookie': bp_get_cookies(), 1293 1293 'object': object, 1294 1294 'filter': filter, … … 1338 1338 bp_ajax_request = jq.post( ajaxurl, { 1339 1339 action: 'activity_widget_filter', 1340 'cookie': encodeURIComponent(document.cookie),1340 'cookie': bp_get_cookies(), 1341 1341 '_wpnonce_activity_filter': jq("input#_wpnonce_activity_filter").val(), 1342 1342 'scope': scope, … … 1432 1432 } 1433 1433 1434 /* Returns a querystring of BP cookies (cookies beginning with 'bp-') */ 1435 function bp_get_cookies() { 1436 // get all cookies and split into an array 1437 var allCookies = document.cookie.split(";"); 1438 1439 var bpCookies = {}; 1440 var cookiePrefix = 'bp-'; 1441 1442 // loop through cookies 1443 for (var i = 0; i < allCookies.length; i++) { 1444 var cookie = allCookies[i]; 1445 var delimiter = cookie.indexOf("="); 1446 var name = unescape( cookie.slice(0, delimiter) ).trim(); 1447 var value = unescape( cookie.slice(delimiter + 1) ); 1448 1449 // if BP cookie, store it 1450 if ( name.indexOf(cookiePrefix) == 0 ) { 1451 bpCookies[name] = value; 1452 } 1453 } 1454 1455 // returns BP cookies as querystring 1456 return encodeURIComponent( jq.param(bpCookies) ); 1457 } 1458 1434 1459 /* ScrollTo plugin - just inline and minified */ 1435 1460 ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
Note: See TracChangeset
for help on using the changeset viewer.