PageRenderTime 55ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/wordpress/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/global.js

http://ownerpress.googlecode.com/
JavaScript | 1259 lines | 923 code | 247 blank | 89 comment | 219 complexity | a30b96bf2fdefc02ad6a6b30ef2b66fb MD5 | raw file
Possible License(s): Apache-2.0, AGPL-1.0, GPL-2.0, GPL-3.0, LGPL-2.1
  1. // AJAX Functions
  2. var jq = jQuery;
  3. // Global variable to prevent multiple AJAX requests
  4. var bp_ajax_request = null;
  5. jq(document).ready( function() {
  6. /**** Page Load Actions *******************************************************/
  7. /* Hide Forums Post Form */
  8. if ( jq('div.forums').length )
  9. jq('div#new-topic-post').hide();
  10. /* Activity filter and scope set */
  11. bp_init_activity();
  12. /* Object filter and scope set. */
  13. var objects = [ 'members', 'groups', 'blogs', 'forums' ];
  14. bp_init_objects( objects );
  15. /* @mention Compose Scrolling */
  16. if ( jq.query.get('r') ) {
  17. if ( jq('textarea#whats-new').length ) {
  18. jq.scrollTo( jq('textarea#whats-new'), 500, { offset:-125, easing:'easeout' } );
  19. jq('textarea#whats-new').focus();
  20. }
  21. }
  22. /* @mention username help button display */
  23. if ( jq( 'span.highlight span' ).length )
  24. jq( 'span.highlight span' ).toggle();
  25. /**** Activity Posting ********************************************************/
  26. /* New posts */
  27. jq("input#aw-whats-new-submit").click( function() {
  28. var button = jq(this);
  29. var form = button.parent().parent().parent().parent();
  30. form.children().each( function() {
  31. if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") )
  32. jq(this).attr( 'disabled', 'disabled' );
  33. });
  34. jq( 'form#' + form.attr('id') + ' span.ajax-loader' ).show();
  35. /* Remove any errors */
  36. jq('div.error').remove();
  37. button.attr('disabled','disabled');
  38. /* Default POST values */
  39. var object = '';
  40. var item_id = jq("#whats-new-post-in").val();
  41. var content = jq("textarea#whats-new").val();
  42. /* Set object for non-profile posts */
  43. if ( item_id > 0 ) {
  44. object = jq("#whats-new-post-object").val();
  45. }
  46. jq.post( ajaxurl, {
  47. action: 'post_update',
  48. 'cookie': encodeURIComponent(document.cookie),
  49. '_wpnonce_post_update': jq("input#_wpnonce_post_update").val(),
  50. 'content': content,
  51. 'object': object,
  52. 'item_id': item_id
  53. },
  54. function(response)
  55. {
  56. jq( 'form#' + form.attr('id') + ' span.ajax-loader' ).hide();
  57. form.children().each( function() {
  58. if ( jq.nodeName(this, "textarea") || jq.nodeName(this, "input") )
  59. jq(this).attr( 'disabled', '' );
  60. });
  61. /* Check for errors and append if found. */
  62. if ( response[0] + response[1] == '-1' ) {
  63. form.prepend( response.substr( 2, response.length ) );
  64. jq( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
  65. button.attr("disabled", '');
  66. } else {
  67. if ( 0 == jq("ul.activity-list").length ) {
  68. jq("div.error").slideUp(100).remove();
  69. jq("div#message").slideUp(100).remove();
  70. jq("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
  71. }
  72. jq("ul.activity-list").prepend(response);
  73. jq("ul.activity-list li:first").addClass('new-update');
  74. jq("li.new-update").hide().slideDown( 300 );
  75. jq("li.new-update").removeClass( 'new-update' );
  76. jq("textarea#whats-new").val('');
  77. /* Re-enable the submit button after 8 seconds. */
  78. setTimeout( function() { button.attr("disabled", ''); }, 8000 );
  79. }
  80. });
  81. return false;
  82. });
  83. /* List tabs event delegation */
  84. jq('div.activity-type-tabs').click( function(event) {
  85. var target = jq(event.target).parent();
  86. if ( event.target.nodeName == 'STRONG' || event.target.nodeName == 'SPAN' )
  87. target = target.parent();
  88. else if ( event.target.nodeName != 'A' )
  89. return false;
  90. /* Reset the page */
  91. jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
  92. /* Activity Stream Tabs */
  93. var scope = target.attr('id').substr( 9, target.attr('id').length );
  94. var filter = jq("#activity-filter-select select").val();
  95. if ( scope == 'mentions' )
  96. jq( 'li#' + target.attr('id') + ' a strong' ).remove();
  97. bp_activity_request(scope, filter, target);
  98. return false;
  99. });
  100. /* Activity filter select */
  101. jq('#activity-filter-select select').change( function() {
  102. var selected_tab = jq( 'div.activity-type-tabs li.selected' );
  103. if ( !selected_tab.length )
  104. var scope = null;
  105. else
  106. var scope = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length );
  107. var filter = jq(this).val();
  108. bp_activity_request(scope, filter);
  109. return false;
  110. });
  111. /* Stream event delegation */
  112. jq('div.activity').click( function(event) {
  113. var target = jq(event.target);
  114. /* Favoriting activity stream items */
  115. if ( target.attr('class') == 'fav' || target.attr('class') == 'unfav' ) {
  116. var type = target.attr('class')
  117. var parent = target.parent().parent().parent();
  118. var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
  119. target.addClass('loading');
  120. jq.post( ajaxurl, {
  121. action: 'activity_mark_' + type,
  122. 'cookie': encodeURIComponent(document.cookie),
  123. 'id': parent_id
  124. },
  125. function(response) {
  126. target.removeClass('loading');
  127. target.fadeOut( 100, function() {
  128. jq(this).html(response);
  129. jq(this).fadeIn(100);
  130. });
  131. if ( 'fav' == type ) {
  132. if ( !jq('div.item-list-tabs li#activity-favorites').length )
  133. jq('div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + BP_DTheme.my_favs + ' (<span>0</span>)</a></li>');
  134. target.removeClass('fav');
  135. target.addClass('unfav');
  136. jq('div.item-list-tabs ul li#activity-favorites span').html( Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) + 1 );
  137. } else {
  138. target.removeClass('unfav');
  139. target.addClass('fav');
  140. jq('div.item-list-tabs ul li#activity-favorites span').html( Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) - 1 );
  141. if ( !Number( jq('div.item-list-tabs ul li#activity-favorites span').html() ) ) {
  142. if ( jq('div.item-list-tabs ul li#activity-favorites').hasClass('selected') )
  143. bp_activity_request( null, null );
  144. jq('div.item-list-tabs ul li#activity-favorites').remove();
  145. }
  146. }
  147. if ( 'activity-favorites' == jq( 'div.item-list-tabs li.selected').attr('id') )
  148. target.parent().parent().parent().slideUp(100);
  149. });
  150. return false;
  151. }
  152. /* Delete activity stream items */
  153. if ( target.hasClass('delete-activity') ) {
  154. var li = target.parents('div.activity ul li');
  155. var id = li.attr('id').substr( 9, li.attr('id').length );
  156. var link_href = target.attr('href');
  157. var nonce = link_href.split('_wpnonce=');
  158. nonce = nonce[1];
  159. target.addClass('loading');
  160. jq.post( ajaxurl, {
  161. action: 'delete_activity',
  162. 'cookie': encodeURIComponent(document.cookie),
  163. 'id': id,
  164. '_wpnonce': nonce
  165. },
  166. function(response) {
  167. target.removeClass('loading');
  168. if ( response[0] + response[1] == '-1' ) {
  169. li.prepend( response.substr( 2, response.length ) );
  170. li.children('div#message').hide().fadeIn(200);
  171. } else {
  172. li.slideUp(200);
  173. }
  174. });
  175. return false;
  176. }
  177. /* Load more updates at the end of the page */
  178. if ( target.parent().attr('class') == 'load-more' ) {
  179. jq("#content li.load-more").addClass('loading');
  180. if ( null == jq.cookie('bp-activity-oldestpage') )
  181. jq.cookie('bp-activity-oldestpage', 1, {path: '/'} );
  182. var oldest_page = ( jq.cookie('bp-activity-oldestpage') * 1 ) + 1;
  183. jq.post( ajaxurl, {
  184. action: 'activity_get_older_updates',
  185. 'cookie': encodeURIComponent(document.cookie),
  186. 'page': oldest_page
  187. },
  188. function(response)
  189. {
  190. jq("#content li.load-more").removeClass('loading');
  191. jq.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} );
  192. jq("#content ul.activity-list").append(response.contents);
  193. target.parent().hide();
  194. }, 'json' );
  195. return false;
  196. }
  197. });
  198. /**** Activity Comments *******************************************************/
  199. /* Hide all activity comment forms */
  200. jq('form.ac-form').hide();
  201. /* Hide excess comments */
  202. if ( jq('div.activity-comments').length )
  203. bp_dtheme_hide_comments();
  204. /* Activity list event delegation */
  205. jq('div.activity').click( function(event) {
  206. var target = jq(event.target);
  207. /* Comment / comment reply links */
  208. if ( target.attr('class') == 'acomment-reply' || target.parent().attr('class') == 'acomment-reply' ) {
  209. if ( target.parent().attr('class') == 'acomment-reply' )
  210. target = target.parent();
  211. var id = target.attr('id');
  212. ids = id.split('-');
  213. var a_id = ids[2]
  214. var c_id = target.attr('href').substr( 10, target.attr('href').length );
  215. var form = jq( '#ac-form-' + a_id );
  216. var form = jq( '#ac-form-' + ids[2] );
  217. form.css( 'display', 'none' );
  218. form.removeClass('root');
  219. jq('.ac-form').hide();
  220. /* Hide any error messages */
  221. form.children('div').each( function() {
  222. if ( jq(this).hasClass( 'error' ) )
  223. jq(this).hide();
  224. });
  225. if ( ids[1] != 'comment' ) {
  226. jq('div.activity-comments li#acomment-' + c_id).append( form );
  227. } else {
  228. jq('li#activity-' + a_id + ' div.activity-comments').append( form );
  229. }
  230. if ( form.parent().attr( 'class' ) == 'activity-comments' )
  231. form.addClass('root');
  232. form.slideDown( 200 );
  233. jq.scrollTo( form, 500, { offset:-100, easing:'easeout' } );
  234. jq('#ac-form-' + ids[2] + ' textarea').focus();
  235. return false;
  236. }
  237. /* Activity comment posting */
  238. if ( target.attr('name') == 'ac_form_submit' ) {
  239. var form = target.parent().parent();
  240. var form_parent = form.parent();
  241. var form_id = form.attr('id').split('-');
  242. if ( 'activity-comments' !== form_parent.attr('class') ) {
  243. var tmp_id = form_parent.attr('id').split('-');
  244. var comment_id = tmp_id[1];
  245. } else {
  246. var comment_id = form_id[2];
  247. }
  248. /* Hide any error messages */
  249. jq( 'form#' + form + ' div.error').hide();
  250. form.addClass('loading');
  251. target.css('disabled', 'disabled');
  252. jq.post( ajaxurl, {
  253. action: 'new_activity_comment',
  254. 'cookie': encodeURIComponent(document.cookie),
  255. '_wpnonce_new_activity_comment': jq("input#_wpnonce_new_activity_comment").val(),
  256. 'comment_id': comment_id,
  257. 'form_id': form_id[2],
  258. 'content': jq('form#' + form.attr('id') + ' textarea').val()
  259. },
  260. function(response)
  261. {
  262. form.removeClass('loading');
  263. /* Check for errors and append if found. */
  264. if ( response[0] + response[1] == '-1' ) {
  265. form.append( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
  266. target.attr("disabled", '');
  267. } else {
  268. form.fadeOut( 200,
  269. function() {
  270. if ( 0 == form.parent().children('ul').length ) {
  271. if ( form.parent().attr('class') == 'activity-comments' )
  272. form.parent().prepend('<ul></ul>');
  273. else
  274. form.parent().append('<ul></ul>');
  275. }
  276. form.parent().children('ul').append(response).hide().fadeIn( 200 );
  277. form.children('textarea').val('');
  278. form.parent().parent().addClass('has-comments');
  279. }
  280. );
  281. jq( 'form#' + form + ' textarea').val('');
  282. /* Increase the "Reply (X)" button count */
  283. jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( jq('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
  284. /* Re-enable the submit button after 5 seconds. */
  285. setTimeout( function() { target.attr("disabled", ''); }, 5000 );
  286. }
  287. });
  288. return false;
  289. }
  290. /* Deleting an activity comment */
  291. if ( target.hasClass('acomment-delete') ) {
  292. var link_href = target.attr('href');
  293. var comment_li = target.parent().parent();
  294. var form = comment_li.parents('div.activity-comments').children('form');
  295. var nonce = link_href.split('_wpnonce=');
  296. nonce = nonce[1];
  297. var comment_id = link_href.split('cid=');
  298. comment_id = comment_id[1].split('&');
  299. comment_id = comment_id[0];
  300. target.addClass('loading');
  301. /* Remove any error messages */
  302. jq('div.activity-comments ul div.error').remove();
  303. /* Reset the form position */
  304. comment_li.parents('div.activity-comments').append(form);
  305. jq.post( ajaxurl, {
  306. action: 'delete_activity_comment',
  307. 'cookie': encodeURIComponent(document.cookie),
  308. '_wpnonce': nonce,
  309. 'id': comment_id
  310. },
  311. function(response)
  312. {
  313. /* Check for errors and append if found. */
  314. if ( response[0] + response[1] == '-1' ) {
  315. comment_li.prepend( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
  316. } else {
  317. var children = jq( 'li#' + comment_li.attr('id') + ' ul' ).children('li');
  318. var child_count = 0;
  319. jq(children).each( function() {
  320. if ( !jq(this).is(':hidden') )
  321. child_count++;
  322. });
  323. comment_li.fadeOut(200);
  324. /* Decrease the "Reply (X)" button count */
  325. var parent_li = comment_li.parents('ul#activity-stream > li');
  326. jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html( jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html() - ( 1 + child_count ) );
  327. }
  328. });
  329. return false;
  330. }
  331. /* Showing hidden comments - pause for half a second */
  332. if ( target.parent().hasClass('show-all') ) {
  333. target.parent().addClass('loading');
  334. setTimeout( function() {
  335. target.parent().parent().children('li').fadeIn(200, function() {
  336. target.parent().remove();
  337. });
  338. }, 600 );
  339. return false;
  340. }
  341. });
  342. /* Escape Key Press for cancelling comment forms */
  343. jq(document).keydown( function(e) {
  344. e = e || window.event;
  345. if (e.target)
  346. element = e.target;
  347. else if (e.srcElement)
  348. element = e.srcElement;
  349. if( element.nodeType == 3)
  350. element = element.parentNode;
  351. if( e.ctrlKey == true || e.altKey == true || e.metaKey == true )
  352. return;
  353. var keyCode = (e.keyCode) ? e.keyCode : e.which;
  354. if ( keyCode == 27 ) {
  355. if (element.tagName == 'TEXTAREA') {
  356. if ( jq(element).attr('class') == 'ac-input' )
  357. jq(element).parent().parent().parent().slideUp( 200 );
  358. }
  359. }
  360. });
  361. /**** @mention username help tooltip **************************************/
  362. jq('span.highlight span').click( function() {
  363. if ( !jq('div.help').length ) {
  364. jq(this).parent().after( '<div id="message" class="info help"><p>' + BP_DTheme.mention_explain + '</p></div>' );
  365. jq('div.help').hide().slideDown(200);
  366. } else {
  367. jq('div.help').hide().remove();
  368. }
  369. })
  370. /**** Directory Search ****************************************************/
  371. /* The search form on all directory pages */
  372. jq('div.dir-search').click( function(event) {
  373. if ( jq(this).hasClass('no-ajax') )
  374. return;
  375. var target = jq(event.target);
  376. if ( target.attr('type') == 'submit' ) {
  377. var css_id = jq('div.item-list-tabs li.selected').attr('id').split( '-' );
  378. var object = css_id[0];
  379. bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, jq.cookie('bp-' + object + '-extras') );
  380. return false;
  381. }
  382. });
  383. /**** Tabs and Filters ****************************************************/
  384. /* When a navigation tab is clicked - e.g. | All Groups | My Groups | */
  385. jq('div.item-list-tabs').click( function(event) {
  386. if ( jq(this).hasClass('no-ajax') )
  387. return;
  388. var target = jq(event.target).parent();
  389. if ( 'LI' == event.target.parentNode.nodeName && !target.hasClass('last') ) {
  390. var css_id = target.attr('id').split( '-' );
  391. var object = css_id[0];
  392. if ( 'activity' == object )
  393. return false;
  394. var scope = css_id[1];
  395. var filter = jq("#" + object + "-order-select select").val();
  396. var search_terms = jq("#" + object + "_search").val();
  397. bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
  398. return false;
  399. }
  400. });
  401. /* When the filter select box is changed re-query */
  402. jq('li.filter select').change( function() {
  403. if ( jq('div.item-list-tabs li.selected').length )
  404. var el = jq('div.item-list-tabs li.selected');
  405. else
  406. var el = jq(this);
  407. var css_id = el.attr('id').split('-');
  408. var object = css_id[0];
  409. var scope = css_id[1];
  410. var filter = jq(this).val();
  411. var search_terms = false;
  412. if ( jq('div.dir-search input').length )
  413. search_terms = jq('div.dir-search input').val();
  414. if ( 'friends' == object )
  415. object = 'members';
  416. bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, jq.cookie('bp-' + object + '-extras') );
  417. return false;
  418. });
  419. /* All pagination links run through this function */
  420. jq('div#content').click( function(event) {
  421. var target = jq(event.target);
  422. if ( target.hasClass('button') )
  423. return true;
  424. if ( target.parent().parent().hasClass('pagination') && !target.parent().parent().hasClass('no-ajax') ) {
  425. if ( target.hasClass('dots') || target.hasClass('current') )
  426. return false;
  427. if ( jq('div.item-list-tabs li.selected').length )
  428. var el = jq('div.item-list-tabs li.selected');
  429. else
  430. var el = jq('li.filter select');
  431. var page_number = 1;
  432. var css_id = el.attr('id').split( '-' );
  433. var object = css_id[0];
  434. var search_terms = false;
  435. if ( jq('div.dir-search input').length )
  436. search_terms = jq('div.dir-search input').val();
  437. if ( jq(target).hasClass('next') )
  438. var page_number = Number( jq('div.pagination span.current').html() ) + 1;
  439. else if ( jq(target).hasClass('prev') )
  440. var page_number = Number( jq('div.pagination span.current').html() ) - 1;
  441. else
  442. var page_number = Number( jq(target).html() );
  443. bp_filter_request( object, jq.cookie('bp-' + object + '-filter'), jq.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, jq.cookie('bp-' + object + '-extras') );
  444. return false;
  445. }
  446. });
  447. /**** New Forum Directory Post **************************************/
  448. /* Hit the "New Topic" button on the forums directory page */
  449. jq('a#new-topic-button').click( function() {
  450. if ( !jq('div#new-topic-post').length )
  451. return false;
  452. if ( jq('div#new-topic-post').is(":visible") )
  453. jq('div#new-topic-post').slideUp(200);
  454. else
  455. jq('div#new-topic-post').slideDown(200);
  456. return false;
  457. });
  458. /* Cancel the posting of a new forum topic */
  459. jq('input#submit_topic_cancel').click( function() {
  460. if ( !jq('div#new-topic-post').length )
  461. return false;
  462. jq('div#new-topic-post').slideUp(200);
  463. return false;
  464. });
  465. /* Clicking a forum tag */
  466. jq('div#forum-directory-tags a').click( function() {
  467. bp_filter_request( 'forums', 'tags', jq.cookie('bp-forums-scope'), 'div.forums', jq(this).html().replace( /&nbsp;/g, '-' ), 1, jq.cookie('bp-forums-extras') );
  468. return false;
  469. });
  470. /** Invite Friends Interface ****************************************/
  471. /* Select a user from the list of friends and add them to the invite list */
  472. jq("div#invite-list input").click( function() {
  473. jq('.ajax-loader').toggle();
  474. var friend_id = jq(this).val();
  475. if ( jq(this).attr('checked') == true )
  476. var friend_action = 'invite';
  477. else
  478. var friend_action = 'uninvite';
  479. jq('div.item-list-tabs li.selected').addClass('loading');
  480. jq.post( ajaxurl, {
  481. action: 'groups_invite_user',
  482. 'friend_action': friend_action,
  483. 'cookie': encodeURIComponent(document.cookie),
  484. '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(),
  485. 'friend_id': friend_id,
  486. 'group_id': jq("input#group_id").val()
  487. },
  488. function(response)
  489. {
  490. if ( jq("#message") )
  491. jq("#message").hide();
  492. jq('.ajax-loader').toggle();
  493. if ( friend_action == 'invite' ) {
  494. jq('#friend-list').append(response);
  495. } else if ( friend_action == 'uninvite' ) {
  496. jq('#friend-list li#uid-' + friend_id).remove();
  497. }
  498. jq('div.item-list-tabs li.selected').removeClass('loading');
  499. });
  500. });
  501. /* Remove a user from the list of users to invite to a group */
  502. jq("#friend-list li a.remove").live('click', function() {
  503. jq('.ajax-loader').toggle();
  504. var friend_id = jq(this).attr('id');
  505. friend_id = friend_id.split('-');
  506. friend_id = friend_id[1];
  507. jq.post( ajaxurl, {
  508. action: 'groups_invite_user',
  509. 'friend_action': 'uninvite',
  510. 'cookie': encodeURIComponent(document.cookie),
  511. '_wpnonce': jq("input#_wpnonce_invite_uninvite_user").val(),
  512. 'friend_id': friend_id,
  513. 'group_id': jq("input#group_id").val()
  514. },
  515. function(response)
  516. {
  517. jq('.ajax-loader').toggle();
  518. jq('#friend-list li#uid-' + friend_id).remove();
  519. jq('#invite-list input#f-' + friend_id).attr('checked', false);
  520. });
  521. return false;
  522. });
  523. /** Friendship Requests **************************************/
  524. /* Accept and Reject friendship request buttons */
  525. jq("ul#friend-list a.accept, ul#friend-list a.reject").click( function() {
  526. var button = jq(this);
  527. var li = jq(this).parents('ul#friend-list li');
  528. var action_div = jq(this).parents('li div.action');
  529. var id = li.attr('id').substr( 11, li.attr('id').length );
  530. var link_href = button.attr('href');
  531. var nonce = link_href.split('_wpnonce=');
  532. nonce = nonce[1];
  533. if ( jq(this).hasClass('accepted') || jq(this).hasClass('rejected') )
  534. return false;
  535. if ( jq(this).hasClass('accept') ) {
  536. var action = 'accept_friendship';
  537. action_div.children('a.reject').css( 'visibility', 'hidden' );
  538. } else {
  539. var action = 'reject_friendship';
  540. action_div.children('a.accept').css( 'visibility', 'hidden' );
  541. }
  542. button.addClass('loading');
  543. jq.post( ajaxurl, {
  544. action: action,
  545. 'cookie': encodeURIComponent(document.cookie),
  546. 'id': id,
  547. '_wpnonce': nonce
  548. },
  549. function(response) {
  550. button.removeClass('loading');
  551. if ( response[0] + response[1] == '-1' ) {
  552. li.prepend( response.substr( 2, response.length ) );
  553. li.children('div#message').hide().fadeIn(200);
  554. } else {
  555. button.fadeOut( 100, function() {
  556. if ( jq(this).hasClass('accept') ) {
  557. jq(this).html( BP_DTheme.accepted ).fadeIn(50);
  558. jq(this).addClass('accepted');
  559. } else {
  560. jq(this).html( BP_DTheme.rejected ).fadeIn(50);
  561. jq(this).addClass('rejected');
  562. }
  563. });
  564. }
  565. });
  566. return false;
  567. });
  568. /* Add / Remove friendship buttons */
  569. jq("div.friendship-button a").live('click', function() {
  570. jq(this).parent().addClass('loading');
  571. var fid = jq(this).attr('id');
  572. fid = fid.split('-');
  573. fid = fid[1];
  574. var nonce = jq(this).attr('href');
  575. nonce = nonce.split('?_wpnonce=');
  576. nonce = nonce[1].split('&');
  577. nonce = nonce[0];
  578. var thelink = jq(this);
  579. jq.post( ajaxurl, {
  580. action: 'addremove_friend',
  581. 'cookie': encodeURIComponent(document.cookie),
  582. 'fid': fid,
  583. '_wpnonce': nonce
  584. },
  585. function(response)
  586. {
  587. var action = thelink.attr('rel');
  588. var parentdiv = thelink.parent();
  589. if ( action == 'add' ) {
  590. jq(parentdiv).fadeOut(200,
  591. function() {
  592. parentdiv.removeClass('add_friend');
  593. parentdiv.removeClass('loading');
  594. parentdiv.addClass('pending');
  595. parentdiv.fadeIn(200).html(response);
  596. }
  597. );
  598. } else if ( action == 'remove' ) {
  599. jq(parentdiv).fadeOut(200,
  600. function() {
  601. parentdiv.removeClass('remove_friend');
  602. parentdiv.removeClass('loading');
  603. parentdiv.addClass('add');
  604. parentdiv.fadeIn(200).html(response);
  605. }
  606. );
  607. }
  608. });
  609. return false;
  610. } );
  611. /** Group Join / Leave Buttons **************************************/
  612. jq("div.group-button a").live('click', function() {
  613. var gid = jq(this).parent().attr('id');
  614. gid = gid.split('-');
  615. gid = gid[1];
  616. var nonce = jq(this).attr('href');
  617. nonce = nonce.split('?_wpnonce=');
  618. nonce = nonce[1].split('&');
  619. nonce = nonce[0];
  620. var thelink = jq(this);
  621. jq.post( ajaxurl, {
  622. action: 'joinleave_group',
  623. 'cookie': encodeURIComponent(document.cookie),
  624. 'gid': gid,
  625. '_wpnonce': nonce
  626. },
  627. function(response)
  628. {
  629. var parentdiv = thelink.parent();
  630. if ( !jq('body.directory').length )
  631. location.href = location.href;
  632. else {
  633. jq(parentdiv).fadeOut(200,
  634. function() {
  635. parentdiv.fadeIn(200).html(response);
  636. }
  637. );
  638. }
  639. });
  640. return false;
  641. } );
  642. /** Button disabling ************************************************/
  643. jq('div.pending').click(function() {
  644. return false;
  645. });
  646. /** Alternate Highlighting ******************************************/
  647. jq('body#bp-default table.zebra tbody tr').mouseover( function() {
  648. jq(this).addClass('over');
  649. }).mouseout( function() {
  650. jq(this).removeClass('over');
  651. });
  652. jq('body#bp-default table.zebra tbody tr:odd').addClass('alt');
  653. jq('div.message-box').each( function(i) {
  654. if ( i % 2 == 1 )
  655. jq(this).addClass('alt');
  656. });
  657. /** Private Messaging ******************************************/
  658. /* AJAX send reply functionality */
  659. jq("input#send_reply_button").click(
  660. function() {
  661. jq('form#send-reply span.ajax-loader').toggle();
  662. jq.post( ajaxurl, {
  663. action: 'messages_send_reply',
  664. 'cookie': encodeURIComponent(document.cookie),
  665. '_wpnonce': jq("input#send_message_nonce").val(),
  666. 'content': jq("#message_content").val(),
  667. 'send_to': jq("input#send_to").val(),
  668. 'subject': jq("input#subject").val(),
  669. 'thread_id': jq("input#thread_id").val()
  670. },
  671. function(response)
  672. {
  673. if ( response[0] + response[1] == "-1" ) {
  674. jq('form#send-reply').prepend( response.substr( 2, response.length ) );
  675. } else {
  676. jq('form#send-reply div#message').remove();
  677. jq("#message_content").val('');
  678. jq('form#send-reply').before( response );
  679. jq("div.new-message").hide().slideDown( 200, function() {
  680. jq('div.new-message').removeClass('new-message');
  681. });
  682. jq('div.message-box').each( function(i) {
  683. jq(this).removeClass('alt');
  684. if ( i % 2 != 1 )
  685. jq(this).addClass('alt');
  686. });
  687. }
  688. jq('form#send-reply span.ajax-loader').toggle();
  689. });
  690. return false;
  691. }
  692. );
  693. /* Marking private messages as read and unread */
  694. jq("a#mark_as_read, a#mark_as_unread").click(function() {
  695. var checkboxes_tosend = '';
  696. var checkboxes = jq("#message-threads tr td input[type='checkbox']");
  697. if ( 'mark_as_unread' == jq(this).attr('id') ) {
  698. var currentClass = 'read'
  699. var newClass = 'unread'
  700. var unreadCount = 1;
  701. var inboxCount = 0;
  702. var unreadCountDisplay = 'inline';
  703. var action = 'messages_markunread';
  704. } else {
  705. var currentClass = 'unread'
  706. var newClass = 'read'
  707. var unreadCount = 0;
  708. var inboxCount = 1;
  709. var unreadCountDisplay = 'none';
  710. var action = 'messages_markread';
  711. }
  712. checkboxes.each( function(i) {
  713. if(jq(this).is(':checked')) {
  714. if ( jq('tr#m-' + jq(this).attr('value')).hasClass(currentClass) ) {
  715. checkboxes_tosend += jq(this).attr('value');
  716. jq('tr#m-' + jq(this).attr('value')).removeClass(currentClass);
  717. jq('tr#m-' + jq(this).attr('value')).addClass(newClass);
  718. var thread_count = jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').html();
  719. jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').html(unreadCount);
  720. jq('tr#m-' + jq(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
  721. var inboxcount = jq('a#user-messages strong').html().substr( 1, jq('a#user-messages strong').html().length );
  722. var inboxcount = inboxcount.substr( 0, inboxcount.length - 1 );
  723. if ( !inboxcount.length )
  724. inboxcount = 0;
  725. if ( parseInt(inboxcount) == inboxCount ) {
  726. jq('a#user-messages strong').css('display', unreadCountDisplay);
  727. jq('a#user-messages strong').html( '(' + unreadCount + ')' );
  728. } else {
  729. if ( 'read' == currentClass )
  730. jq('a#user-messages strong').html('(' + ( parseInt(inboxcount) + 1 ) + ')');
  731. else
  732. jq('a#user-messages strong').html('(' + ( parseInt(inboxcount) - thread_count ) + ')');
  733. }
  734. if ( i != checkboxes.length - 1 ) {
  735. checkboxes_tosend += ','
  736. }
  737. }
  738. }
  739. });
  740. jq.post( ajaxurl, {
  741. action: action,
  742. 'thread_ids': checkboxes_tosend
  743. });
  744. return false;
  745. });
  746. /* Selecting unread and read messages in inbox */
  747. jq("select#message-type-select").change(
  748. function() {
  749. var selection = jq("select#message-type-select").val();
  750. var checkboxes = jq("td input[type='checkbox']");
  751. checkboxes.each( function(i) {
  752. checkboxes[i].checked = "";
  753. });
  754. switch(selection) {
  755. case 'unread':
  756. var checkboxes = jq("tr.unread td input[type='checkbox']");
  757. break;
  758. case 'read':
  759. var checkboxes = jq("tr.read td input[type='checkbox']");
  760. break;
  761. }
  762. if ( selection != '' ) {
  763. checkboxes.each( function(i) {
  764. checkboxes[i].checked = "checked";
  765. });
  766. } else {
  767. checkboxes.each( function(i) {
  768. checkboxes[i].checked = "";
  769. });
  770. }
  771. }
  772. );
  773. /* Bulk delete messages */
  774. jq("a#delete_inbox_messages, a#delete_sentbox_messages").click( function() {
  775. checkboxes_tosend = '';
  776. checkboxes = jq("#message-threads tr td input[type='checkbox']");
  777. jq('div#message').remove();
  778. jq(this).addClass('loading');
  779. jq(checkboxes).each( function(i) {
  780. if( jq(this).is(':checked') )
  781. checkboxes_tosend += jq(this).attr('value') + ',';
  782. });
  783. if ( '' == checkboxes_tosend ) {
  784. jq(this).removeClass('loading');
  785. return false;
  786. }
  787. jq.post( ajaxurl, {
  788. action: 'messages_delete',
  789. 'thread_ids': checkboxes_tosend
  790. }, function(response) {
  791. if ( response[0] + response[1] == "-1" ) {
  792. jq('#message-threads').prepend( response.substr( 2, response.length ) );
  793. } else {
  794. jq('#message-threads').before( '<div id="message" class="updated"><p>' + response + '</p></div>' );
  795. jq(checkboxes).each( function(i) {
  796. if( jq(this).is(':checked') )
  797. jq(this).parent().parent().fadeOut(150);
  798. });
  799. }
  800. jq('div#message').hide().slideDown(150);
  801. jq("a#delete_inbox_messages, a#delete_sentbox_messages").removeClass('loading');
  802. });
  803. return false;
  804. });
  805. /* Close site wide notices in the sidebar */
  806. jq("a#close-notice").click( function() {
  807. jq(this).addClass('loading');
  808. jq('div#sidebar div.error').remove();
  809. jq.post( ajaxurl, {
  810. action: 'messages_close_notice',
  811. 'notice_id': jq('.notice').attr('rel').substr( 2, jq('.notice').attr('rel').length )
  812. },
  813. function(response) {
  814. jq("a#close-notice").removeClass('loading');
  815. if ( response[0] + response[1] == '-1' ) {
  816. jq('.notice').prepend( response.substr( 2, response.length ) );
  817. jq( 'div#sidebar div.error').hide().fadeIn( 200 );
  818. } else {
  819. jq('.notice').slideUp( 100 );
  820. }
  821. });
  822. return false;
  823. });
  824. /* Admin Bar Javascript */
  825. jq("#wp-admin-bar ul.main-nav li").mouseover( function() {
  826. jq(this).addClass('sfhover');
  827. });
  828. jq("#wp-admin-bar ul.main-nav li").mouseout( function() {
  829. jq(this).removeClass('sfhover');
  830. });
  831. /* Clear BP cookies on logout */
  832. jq('a.logout').click( function() {
  833. jq.cookie('bp-activity-scope', null, {path: '/'});
  834. jq.cookie('bp-activity-filter', null, {path: '/'});
  835. jq.cookie('bp-activity-oldestpage', null, {path: '/'});
  836. var objects = [ 'members', 'groups', 'blogs', 'forums' ];
  837. jq(objects).each( function(i) {
  838. jq.cookie('bp-' + objects[i] + '-scope', null, {path: '/'} );
  839. jq.cookie('bp-' + objects[i] + '-filter', null, {path: '/'} );
  840. jq.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} );
  841. });
  842. });
  843. });
  844. /* Setup activity scope and filter based on the current cookie settings. */
  845. function bp_init_activity() {
  846. /* Reset the page */
  847. jq.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
  848. if ( null != jq.cookie('bp-activity-filter') && jq('#activity-filter-select').length )
  849. jq('#activity-filter-select select option[value=' + jq.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
  850. /* Activity Tab Set */
  851. if ( null != jq.cookie('bp-activity-scope') && jq('div.activity-type-tabs').length ) {
  852. jq('div.activity-type-tabs li').each( function() {
  853. jq(this).removeClass('selected');
  854. });
  855. jq('li#activity-' + jq.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
  856. }
  857. }
  858. /* Setup object scope and filter based on the current cookie settings for the object. */
  859. function bp_init_objects(objects) {
  860. jq(objects).each( function(i) {
  861. if ( null != jq.cookie('bp-' + objects[i] + '-filter') && jq('li#' + objects[i] + '-order-select select').length )
  862. jq('li#' + objects[i] + '-order-select select option[value=' + jq.cookie('bp-' + objects[i] + '-filter') + ']').attr( 'selected', 'selected' );
  863. if ( null != jq.cookie('bp-' + objects[i] + '-scope') && jq('div.' + objects[i]).length ) {
  864. jq('div.item-list-tabs li').each( function() {
  865. jq(this).removeClass('selected');
  866. });
  867. jq('div.item-list-tabs li#' + objects[i] + '-' + jq.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');
  868. }
  869. });
  870. }
  871. /* Filter the current content list (groups/members/blogs/topics) */
  872. function bp_filter_request( object, filter, scope, target, search_terms, page, extras ) {
  873. if ( 'activity' == object )
  874. return false;
  875. if ( jq.query.get('s') && !search_terms )
  876. search_terms = jq.query.get('s');
  877. if ( null == scope )
  878. scope = 'all';
  879. /* Save the settings we want to remain persistent to a cookie */
  880. jq.cookie( 'bp-' + object + '-scope', scope, {path: '/'} );
  881. jq.cookie( 'bp-' + object + '-filter', filter, {path: '/'} );
  882. jq.cookie( 'bp-' + object + '-extras', extras, {path: '/'} );
  883. /* Set the correct selected nav and filter */
  884. jq('div.item-list-tabs li').each( function() {
  885. jq(this).removeClass('selected');
  886. });
  887. jq('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');
  888. jq('div.item-list-tabs li.selected').addClass('loading');
  889. jq('div.item-list-tabs select option[value=' + filter + ']').attr( 'selected', 'selected' );
  890. if ( 'friends' == object )
  891. object = 'members';
  892. if ( bp_ajax_request )
  893. bp_ajax_request.abort();
  894. bp_ajax_request = jq.post( ajaxurl, {
  895. action: object + '_filter',
  896. 'cookie': encodeURIComponent(document.cookie),
  897. 'object': object,
  898. 'filter': filter,
  899. 'search_terms': search_terms,
  900. 'scope': scope,
  901. 'page': page,
  902. 'extras': extras
  903. },
  904. function(response)
  905. {
  906. jq(target).fadeOut( 100, function() {
  907. jq(this).html(response);
  908. jq(this).fadeIn(100);
  909. });
  910. jq('div.item-list-tabs li.selected').removeClass('loading');
  911. });
  912. }
  913. /* Activity Loop Requesting */
  914. function bp_activity_request(scope, filter) {
  915. /* Save the type and filter to a session cookie */
  916. jq.cookie( 'bp-activity-scope', scope, {path: '/'} );
  917. jq.cookie( 'bp-activity-filter', filter, {path: '/'} );
  918. jq.cookie( 'bp-activity-oldestpage', 1 );
  919. /* Remove selected and loading classes from tabs */
  920. jq('div.item-list-tabs li').each( function() {
  921. jq(this).removeClass('selected loading');
  922. });
  923. /* Set the correct selected nav and filter */
  924. jq('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected');
  925. jq('div#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading');
  926. jq('#activity-filter-select select option[value=' + filter + ']').attr( 'selected', 'selected' );
  927. /* Reload the activity stream based on the selection */
  928. jq('.widget_bp_activity_widget h2 span.ajax-loader').show();
  929. if ( bp_ajax_request )
  930. bp_ajax_request.abort();
  931. bp_ajax_request = jq.post( ajaxurl, {
  932. action: 'activity_widget_filter',
  933. 'cookie': encodeURIComponent(document.cookie),
  934. '_wpnonce_activity_filter': jq("input#_wpnonce_activity_filter").val(),
  935. 'scope': scope,
  936. 'filter': filter
  937. },
  938. function(response)
  939. {
  940. jq('.widget_bp_activity_widget h2 span.ajax-loader').hide();
  941. jq('div.activity').fadeOut( 100, function() {
  942. jq(this).html(response.contents);
  943. jq(this).fadeIn(100);
  944. /* Selectively hide comments */
  945. bp_dtheme_hide_comments();
  946. });
  947. /* Update the feed link */
  948. if ( null != response.feed_url )
  949. jq('.directory div#subnav li.feed a, .home-page div#subnav li.feed a').attr('href', response.feed_url);
  950. jq('div.item-list-tabs li.selected').removeClass('loading');
  951. }, 'json' );
  952. }
  953. /* Hide long lists of activity comments, only show the latest five root comments. */
  954. function bp_dtheme_hide_comments() {
  955. var comments_divs = jq('div.activity-comments');
  956. if ( !comments_divs.length )
  957. return false;
  958. comments_divs.each( function() {
  959. if ( jq(this).children('ul').children('li').length < 5 ) return;
  960. var comments_div = jq(this);
  961. var parent_li = comments_div.parents('ul#activity-stream > li');
  962. var comment_lis = jq(this).children('ul').children('li');
  963. var comment_count = ' ';
  964. if ( jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').length )
  965. var comment_count = jq('li#' + parent_li.attr('id') + ' a.acomment-reply span').html();
  966. comment_lis.each( function(i) {
  967. /* Show the latest 5 root comments */
  968. if ( i < comment_lis.length - 5 ) {
  969. jq(this).addClass('hidden');
  970. jq(this).toggle();
  971. if ( !i )
  972. jq(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + BP_DTheme.show_all_comments + '">' + BP_DTheme.show_all + ' ' + comment_count + ' ' + BP_DTheme.comments + '</a></li>' );
  973. }
  974. });
  975. });
  976. }
  977. /* Helper Functions */
  978. function checkAll() {
  979. var checkboxes = document.getElementsByTagName("input");
  980. for(var i=0; i<checkboxes.length; i++) {
  981. if(checkboxes[i].type == "checkbox") {
  982. if($("check_all").checked == "") {
  983. checkboxes[i].checked = "";
  984. }
  985. else {
  986. checkboxes[i].checked = "checked";
  987. }
  988. }
  989. }
  990. }
  991. function clear(container) {
  992. if( !document.getElementById(container) ) return;
  993. var container = document.getElementById(container);
  994. if ( radioButtons = container.getElementsByTagName('INPUT') ) {
  995. for(var i=0; i<radioButtons.length; i++) {
  996. radioButtons[i].checked = '';
  997. }
  998. }
  999. if ( options = container.getElementsByTagName('OPTION') ) {
  1000. for(var i=0; i<options.length; i++) {
  1001. options[i].selected = false;
  1002. }
  1003. }
  1004. return;
  1005. }
  1006. /* ScrollTo plugin - just inline and minified */
  1007. ;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
  1008. jQuery.extend({easing:{easein:function(x,t,b,c,d){return c*(t/=d)*t+b},easeinout:function(x,t,b,c,d){if(t<d/2)return 2*c*t*t/(d*d)+b;var ts=t-d/2;return-2*c*ts*ts/(d*d)+2*c*ts/d+c/2+b},easeout:function(x,t,b,c,d){return-c*t*t/(d*d)+2*c*t/d+b},expoin:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}return flip*(Math.exp(Math.log(c)/d*t))+b},expoout:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}return flip*(-Math.exp(-Math.log(c)/d*(t-d))+c+1)+b},expoinout:function(x,t,b,c,d){var flip=1;if(c<0){flip*=-1;c*=-1}if(t<d/2)return flip*(Math.exp(Math.log(c/2)/(d/2)*t))+b;return flip*(-Math.exp(-2*Math.log(c/2)/d*(t-d))+c+1)+b},bouncein:function(x,t,b,c,d){return c-jQuery.easing['bounceout'](x,d-t,0,c,d)+b},bounceout:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},bounceinout:function(x,t,b,c,d){if(t<d/2)return jQuery.easing['bouncein'](x,t*2,0,c,d)*.5+b;return jQuery.easing['bounceout'](x,t*2-d,0,c,d)*.5+c*.5+b},elasin:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},elasout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},elasinout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},backin:function(x,t,b,c,d){var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},backout:function(x,t,b,c,d){var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},backinout:function(x,t,b,c,d){var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},linear:function(x,t,b,c,d){return c*t/d+b}}});
  1009. /* jQuery Cookie plugin */
  1010. jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};
  1011. /* jQuery querystring plugin */
  1012. eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('M 6(A){4 $11=A.11||\'&\';4 $V=A.V===r?r:j;4 $1p=A.1p===r?\'\':\'[]\';4 $13=A.13===r?r:j;4 $D=$13?A.D===j?"#":"?":"";4 $15=A.15===r?r:j;v.1o=M 6(){4 f=6(o,t){8 o!=1v&&o!==x&&(!!t?o.1t==t:j)};4 14=6(1m){4 m,1l=/\\[([^[]*)\\]/g,T=/^([^[]+)(\\[.*\\])?$/.1r(1m),k=T[1],e=[];19(m=1l.1r(T[2]))e.u(m[1]);8[k,e]};4 w=6(3,e,7){4 o,y=e.1b();b(I 3!=\'X\')3=x;b(y===""){b(!3)3=[];b(f(3,L)){3.u(e.h==0?7:w(x,e.z(0),7))}n b(f(3,1a)){4 i=0;19(3[i++]!=x);3[--i]=e.h==0?7:w(3[i],e.z(0),7)}n{3=[];3.u(e.h==0?7:w(x,e.z(0),7))}}n b(y&&y.T(/^\\s*[0-9]+\\s*$/)){4 H=1c(y,10);b(!3)3=[];3[H]=e.h==0?7:w(3[H],e.z(0),7)}n b(y){4 H=y.B(/^\\s*|\\s*$/g,"");b(!3)3={};b(f(3,L)){4 18={};1w(4 i=0;i<3.h;++i){18[i]=3[i]}3=18}3[H]=e.h==0?7:w(3[H],e.z(0),7)}n{8 7}8 3};4 C=6(a){4 p=d;p.l={};b(a.C){v.J(a.Z(),6(5,c){p.O(5,c)})}n{v.J(1u,6(){4 q=""+d;q=q.B(/^[?#]/,\'\');q=q.B(/[;&]$/,\'\');b($V)q=q.B(/[+]/g,\' \');v.J(q.Y(/[&;]/),6(){4 5=1e(d.Y(\'=\')[0]||"");4 c=1e(d.Y(\'=\')[1]||"");b(!5)8;b($15){b(/^[+-]?[0-9]+\\.[0-9]*$/.1d(c))c=1A(c);n b(/^[+-]?[0-9]+$/.1d(c))c=1c(c,10)}c=(!c&&c!==0)?j:c;b(c!==r&&c!==j&&I c!=\'1g\')c=c;p.O(5,c)})})}8 p};C.1H={C:j,1G:6(5,1f){4 7=d.Z(5);8 f(7,1f)},1h:6(5){b(!f(5))8 d.l;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];19(3!=x&&e.h!=0){3=3[e.1b()]}8 I 3==\'1g\'?3:3||""},Z:6(5){4 3=d.1h(5);b(f(3,1a))8 v.1E(j,{},3);n b(f(3,L))8 3.z(0);8 3},O:6(5,c){4 7=!f(c)?x:c;4 K=14(5),k=K[0],e=K[1];4 3=d.l[k];d.l[k]=w(3,e.z(0),7);8 d},w:6(5,c){8 d.N().O(5,c)},1s:6(5){8 d.O(5,x).17()},1z:6(5){8 d.N().1s(5)},1j:6(){4 p=d;v.J(p.l,6(5,7){1y p.l[5]});8 p},1F:6(Q){4 D=Q.B(/^.*?[#](.+?)(?:\\?.+)?$/,"$1");4 S=Q.B(/^.*?[?](.+?)(?:#.+)?$/,"$1");8 M C(Q.h==S.h?\'\':S,Q.h==D.h?\'\':D)},1x:6(){8 d.N().1j()},N:6(){8 M C(d)},17:6(){6 F(G){4 R=I G=="X"?f(G,L)?[]:{}:G;b(I G==\'X\'){6 1k(o,5,7){b(f(o,L))o.u(7);n o[5]=7}v.J(G,6(5,7){b(!f(7))8 j;1k(R,5,F(7))})}8 R}d.l=F(d.l);8 d},1B:6(){8 d.N().17()},1D:6(){4 i=0,U=[],W=[],p=d;4 16=6(E){E=E+"";b($V)E=E.B(/ /g,"+");8 1C(E)};4 1n=6(1i,5,7){b(!f(7)||7===r)8;4 o=[16(5)];b(7!==j){o.u("=");o.u(16(7))}1i.u(o.P(""))};4 F=6(R,k){4 12=6(5){8!k||k==""?[5].P(""):[k,"[",5,"]"].P("")};v.J(R,6(5,7){b(I 7==\'X\')F(7,12(5));n 1n(W,12(5),7)})};F(d.l);b(W.h>0)U.u($D);U.u(W.P($11));8 U.P("")}};8 M C(1q.S,1q.D)}}(v.1o||{});',62,106,'|||target|var|key|function|value|return|||if|val|this|tokens|is||length||true|base|keys||else||self||false|||push|jQuery|set|null|token|slice|settings|replace|queryObject|hash|str|build|orig|index|typeof|each|parsed|Array|new|copy|SET|join|url|obj|search|match|queryString|spaces|chunks|object|split|get||separator|newKey|prefix|parse|numbers|encode|COMPACT|temp|while|Object|shift|parseInt|test|decodeURIComponent|type|number|GET|arr|EMPTY|add|rx|path|addFields|query|suffix|location|exec|REMOVE|constructor|arguments|undefined|for|empty|delete|remove|parseFloat|compact|encodeURIComponent|toString|extend|load|has|prototype'.split('|'),0,{}))