PageRenderTime 65ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/global/js/global.js

https://github.com/wvianna/formacaogesac_wp
JavaScript | 1792 lines | 1302 code | 330 blank | 160 comment | 276 complexity | 2374b39fe3aa34bdc3a9e2dc6dfcfa1b MD5 | raw file
Possible License(s): AGPL-3.0
  1. // Cdigital Functions.js
  2. // functions.js
  3. /*var tabs = 0;
  4. var next_tab;*/
  5. jQuery(function()
  6. {
  7. /*jQuery('#header .menu a').click(function() {
  8. var url = jQuery(this).attr('href');
  9. jQuery(this).parent().siblings().removeClass('current_page_item');
  10. jQuery(this).parent().siblings().removeClass('current-menu-item');
  11. jQuery(this).parent().addClass('current_page_item');
  12. jQuery('#content div.middle').addClass('old').fadeOut('fast');
  13. jQuery('#content').addClass('loading');
  14. jQuery.ajax({
  15. url : url,
  16. success : function(response) {
  17. jQuery('#content div.middle.old').remove();
  18. jQuery('#content').removeClass('loading').append(jQuery(response).find('#content div.middle'));
  19. jQuery('#content div.middle').fadeIn('fast');
  20. }
  21. });
  22. return false;
  23. }); */
  24. //Função de expandir e retrair
  25. jQuery(document).ready(function(){
  26. jQuery('a#retrair_todos').click(function() {
  27. jQuery('ul.sub-menu', jQuery(this).parent()).slideUp('fast');
  28. jQuery('a#expandir').html("<span>+</span>");
  29. return false;
  30. });
  31. });
  32. jQuery(document).ready(function(){
  33. jQuery('a#expandir_todos').click(function() {
  34. jQuery('ul.sub-menu', jQuery(this).parent()).slideDown('fast');
  35. jQuery('a#expandir').html("<span>-</span>");
  36. return false;
  37. });
  38. });
  39. jQuery(document).ready(function(){
  40. jQuery('ul li.parent a').click(function() {
  41. jQuery('ul.sub-menu', jQuery(this).parent()).slideToggle('fast');
  42. return false;
  43. });
  44. });
  45. jQuery(document).ready(function(){
  46. jQuery("a#expandir").click(function() {
  47. var text = jQuery(this).text();
  48. if (text == "+") {
  49. jQuery(this).html("<span>-</span>");
  50. }
  51. else {
  52. jQuery(this).html("<span>+</span>");
  53. }
  54. });
  55. });
  56. //**********************************************************************************************
  57. //Funcionalidade de acessibilidade - Aumentar, normalizar e diminuir fonte, além de contraste
  58. jQuery(document).ready(function(){
  59. var fonte = 13;
  60. jQuery('#aumenta_fonte').click(function(){
  61. if (fonte<19){
  62. fonte = fonte+1;
  63. jQuery('body').css({'font-size' : fonte+'px'});
  64. }
  65. });
  66. jQuery('#normaliza_fonte').click(function(){
  67. fonte = 12.4167;
  68. jQuery('body').css({'font-size' : fonte+'px'});
  69. });
  70. jQuery('#diminui_fonte').click(function(){
  71. if (fonte>10){
  72. fonte = fonte-1;
  73. jQuery('body').css({'font-size' : fonte+'px'});
  74. }
  75. });
  76. jQuery('#habilita_contraste').click(function(){
  77. css = document.getElementById("contraste");
  78. if (css.href.search("style.css") != -1) {
  79. css.disable = true;
  80. css.href = css.href + "contraste.css";
  81. css.href = css.href.replace("style.css", "");
  82. css.disable = false;
  83. }
  84. });
  85. jQuery('#desabilita_contraste').click(function(){
  86. css = document.getElementById("contraste");
  87. if (css.href.search("contraste.css") != -1) {
  88. css.disable = true;
  89. css.href = css.href + "style.css";
  90. css.href = css.href.replace("contraste.css", "");
  91. css.disable = false;
  92. }
  93. });
  94. });
  95. // Ativa o plugin back to top
  96. jQuery('#top-link').topLink({
  97. min: 400,
  98. fadeSpeed: 500
  99. });
  100. jQuery('#top-link').click(function(e) {
  101. e.preventDefault();
  102. jQuery.scrollTo(0,300);
  103. });
  104. // Carrega o tamanho do texto
  105. var cdigital_fontSize = jQuery.cookie('cdigital_fontSize');
  106. var fontSize = 100;
  107. if(cdigital_fontSize)
  108. {
  109. jQuery('#content, div.navFooter').css('fontSize', cdigital_fontSize+'%');
  110. fontSize = parseInt(cdigital_fontSize);
  111. if( fontSize >= 120 ) {
  112. jQuery('#header div.menu').css('fontSize', '120%');
  113. }
  114. }
  115. // Carrega o layout dos diretorios
  116. var cdigital_directory_layout = jQuery.cookie('cdigital_directory_layout');
  117. if(cdigital_directory_layout)
  118. {
  119. if( jQuery('ul.posts').length )
  120. jQuery('ul.posts').removeClass('two-columns');
  121. }
  122. // Carrega o contraste
  123. var cdigital_contrast = jQuery.cookie('cdigital_contrast');
  124. if(cdigital_contrast)
  125. {
  126. jQuery('html').addClass(cdigital_contrast);
  127. jQuery('head').append('<link id="contrast_css" rel="stylesheet" media="screen" href="http://'+ window.location.host +'/wp-content/themes/NewCdigital/global/css/contrast.css" />');
  128. }
  129. // Carrega o jquery tabs
  130. jQuery('div.tabs').tabs();
  131. var destaque = jQuery('div.hlTabs').tabs().tabs('rotate', 12000, true);
  132. var totalSize = jQuery('div.hlTabs div.panel').size() -1;
  133. var next = 0;
  134. var prev = 0;
  135. for( $i = 0; $i <= totalSize; $i++ ) {
  136. prev = ($i != 0) ? $i : totalSize;
  137. next = ($i != totalSize) ? $i + 2 : 1;
  138. jQuery( jQuery('div.hlTabs div.panel')[$i] ).append('<a href="#" class="bt_prev" rel="'+ prev +'">Anterior</a>');
  139. jQuery( jQuery('div.hlTabs div.panel')[$i] ).append('<a href="#" class="bt_next" rel="'+ next +'">Proximo</a>');
  140. }
  141. jQuery('.bt_prev, .bt_next', 'div.hlTabs div.panel').click(function() {
  142. var tab = parseInt(jQuery(this).attr('rel')) - 1;
  143. console.debug(tab);
  144. destaque.tabs('select', tab);
  145. return false;
  146. });
  147. // Adiciona os bts next e prev
  148. /*jQuery('div.widget_destaque .bt_prev').unbind().bind('click', function() {
  149. tabs--;
  150. if( tabs < 0 ) {
  151. tabs = jQuery('div.widget_destaque div.panel').length - 1;
  152. }
  153. jQuery('div.hlTabs').tabs("select", tabs );
  154. return false;
  155. });
  156. jQuery('div.widget_destaque .bt_next').unbind().bind('click', function() {
  157. tabs++;
  158. if( tabs > jQuery('div.widget_destaque div.panel').length - 1 ) {
  159. tabs = 0;
  160. }
  161. jQuery('div.hlTabs').tabs("select", tabs );
  162. return false;
  163. });*/
  164. // Adciona um bullet no menu dropdown
  165. jQuery('div#header ul.nav li').each(function()
  166. {
  167. if(jQuery('> ul', jQuery(this)).length)
  168. {
  169. jQuery(this).addClass('dropdown');
  170. }
  171. });
  172. // Reset Value Default
  173. jQuery.fn.resetDefaultValue = function()
  174. {
  175. function _clearDefaultValue() {
  176. var _$ = jQuery(this);
  177. if ( _$.val() == this.defaultValue ) { _$.val(''); jQuery(this).addClass('active'); }
  178. };
  179. function _resetDefaultValue() {
  180. var _$ = jQuery(this);
  181. if ( _$.val() == '' ) { _$.val(this.defaultValue); jQuery(this).removeClass('active'); }
  182. };
  183. return this.click(_clearDefaultValue).focus(_clearDefaultValue).blur(_resetDefaultValue);
  184. }
  185. jQuery('div#header input:not(input.submitDefault), div.widget_login input:not(input.submitDefault), div.comments div.inputDefault *').resetDefaultValue();
  186. var formWhatsNew = (jQuery('form#whats-new-form textarea').val() === undefined ? '' : jQuery('form#whats-new-form textarea').val() );
  187. if( formWhatsNew.indexOf('O que há de novo ') != -1 ) jQuery('form#whats-new-form textarea').resetDefaultValue();
  188. // Jquery tooltip
  189. jQuery('.widget ul#members-list li, .widget ul#groups-list li').tooltip({
  190. delay: 0,
  191. track: true,
  192. showURL: false,
  193. bodyHandler: function() {
  194. var title = jQuery(this).find('div.item-title a').text();
  195. var membros = jQuery(this).find('div.item-meta span').text();
  196. return '<h3>'+ title +'</h3>' + '<p>' + membros + '</p>';
  197. }
  198. });
  199. // Ajax pagination
  200. jQuery('div.widget_customPosts .more').click(function()
  201. {
  202. var $this = jQuery(this);
  203. var url = $this.attr('href');
  204. $this.addClass('loading');
  205. jQuery('div.widget_customPosts ul').load(url + '#labblog li', function(response)
  206. {
  207. jQuery('div.widget_customPosts ul li').remove();
  208. jQuery(response).find('div.widget_customPosts ul li').appendTo('div.widget_customPosts ul');
  209. var paged = jQuery(response).find('div.widget_customPosts .more').attr('href');
  210. $this.attr('href', paged);
  211. $this.removeClass('loading');
  212. });
  213. return false;
  214. });
  215. // Widget Login Validation
  216. jQuery('div.widget_login .submitDefault').not('div.widget_register .submitDefault').click(function()
  217. {
  218. var $this = jQuery(this);
  219. var form = jQuery('div.widget_login form');
  220. var login = jQuery('div.widget_login div.login input').val();
  221. var pw = jQuery('div.widget_login div.pw input').val();
  222. var erro = 0;
  223. if(login == 'Nome do usuário' || !login || pw == 'Senha' || !pw)
  224. {
  225. if(!jQuery('div.widget_login div.error').length)
  226. {
  227. jQuery('div.widget_login').prepend('<div class="error" style="display:none">Preencha todos os campos!</div>');
  228. jQuery('div.widget_login div.error').slideDown('fast');
  229. }
  230. else
  231. {
  232. jQuery('div.widget_login div.error').remove();
  233. jQuery('div.widget_login').prepend('<div class="error" style="display:none">Preencha todos os campos!</div>');
  234. jQuery('div.widget_login div.error').slideDown('fast');
  235. }
  236. erro++;
  237. }
  238. else
  239. erro = 0;
  240. if(erro == 0)
  241. {
  242. $this.addClass('loading');
  243. jQuery.post(form.attr('action'), form.serialize(), function(response)
  244. {
  245. if(jQuery(response).find('div#login_error').length)
  246. {
  247. var erro = jQuery(response).find('div#login_error');
  248. if(!jQuery('div.widget_login div.error').length)
  249. {
  250. jQuery('div.widget_login').prepend('<div class="error" style="display:none">' + erro.html() + '</div>');
  251. jQuery('div.widget_login div.error').slideDown('fast');
  252. jQuery('div.widget_login div.login input').val('Nome do usuário');
  253. jQuery('div.widget_login div.pw input').val('Senha');
  254. }
  255. else
  256. {
  257. jQuery('div.widget_login div.error').remove();
  258. jQuery('div.widget_login').prepend('<div class="error" style="display:none">' + erro.html() + '</div>');
  259. jQuery('div.widget_login div.error').slideDown('fast');
  260. jQuery('div.widget_login div.login input').val('Nome do usuário');
  261. jQuery('div.widget_login div.pw input').val('Senha');
  262. }
  263. $this.removeClass('loading');
  264. }
  265. else
  266. {
  267. document.location.href = 'http://'+ document.location.host + '/members/' + jQuery('div.widget_login div.login input').val();
  268. }
  269. });
  270. }
  271. return false;
  272. });
  273. // Controle de fontes
  274. jQuery('div.acc a').click(function()
  275. {
  276. if(jQuery(this).hasClass('fontMinus'))
  277. {
  278. if( fontSize == 100 || fontSize <= 100 ) {
  279. return false;
  280. }
  281. fontSize -= 20;
  282. jQuery('#content, #footer div.navFooter').css('fontSize', fontSize + '%');
  283. if( fontSize == 100 ) {
  284. jQuery('#header div.menu').css('fontSize', '100%');
  285. }
  286. jQuery.cookie('cdigital_fontSize', fontSize);
  287. }
  288. if(jQuery(this).hasClass('fontPlus'))
  289. {
  290. if( fontSize == 140 || fontSize >= 140 ) {
  291. return false;
  292. }
  293. fontSize += 20;
  294. jQuery('#content, #footer div.navFooter').css('fontSize', fontSize + '%');
  295. jQuery('#header div.menu').css('fontSize', '120%');
  296. jQuery.cookie('cdigital_fontSize', fontSize);
  297. }
  298. return false;
  299. });
  300. // Controle de contraste
  301. jQuery('div#wp-admin-bar li.color a').click(function()
  302. {
  303. var $contrast = jQuery(this).attr('id');
  304. if($contrast == 'contrast')
  305. {
  306. jQuery('html').attr('class', '');
  307. jQuery('#contrast_css').remove();
  308. jQuery.cookie('cdigital_contrast', '');
  309. return false;
  310. }
  311. jQuery.cookie('cdigital_contrast', $contrast);
  312. jQuery('html').attr('class', '');
  313. jQuery('html').toggleClass($contrast);
  314. jQuery('head').append('<link id="contrast_css" rel="stylesheet" media="screen" href="http://'+ window.location.host +'/wp/wp-content/themes/NewCdigital/global/css/contrast.css" />');
  315. return false;
  316. });
  317. jQuery('div#loading').remove();
  318. jQuery('div#content, div.navFooter').fadeIn(300);
  319. // Controle de layout dos diretorios
  320. jQuery('div.layoutControl a').click(function() {
  321. if(jQuery(this).hasClass('one-column')) {
  322. jQuery('ul.posts').removeClass('two-columns');
  323. jQuery.cookie('cdigital_directory_layout', 'one-column');
  324. } else {
  325. jQuery('ul.posts').addClass('two-columns');
  326. jQuery.cookie('cdigital_directory_layout', '');
  327. }
  328. return false;
  329. });
  330. });
  331. // Buddypress functions.js
  332. // AJAX Functions
  333. var j = jQuery;
  334. // Global variable to prevent multiple AJAX requests
  335. var bp_ajax_request = null;
  336. j(document).ready( function() {
  337. /**** Page Load Actions *******************************************************/
  338. /* Adicionando ação para q os links customizados abram em novas abas*/
  339. j(".menu-item-type-custom a").attr('target','_blank');
  340. j("#menu-item-66 a").attr('target','_self');
  341. /* Hide Forums Post Form */
  342. if ( j('div.forums').length )
  343. j('div#new-topic-post').hide();
  344. /* Activity filter and scope set */
  345. bp_init_activity();
  346. /* Object filter and scope set. */
  347. var objects = [ 'members', 'groups', 'blogs', 'forums' ];
  348. bp_init_objects( objects );
  349. /* @mention Compose Scrolling */
  350. if ( j.query.get('r') ) {
  351. if ( j('textarea#whats-new').length ) {
  352. j.scrollTo( j('textarea#whats-new'), 500, { offset:-125, easing:'easeout' } );
  353. j('textarea#whats-new').focus();
  354. }
  355. }
  356. /* @mention username help button display */
  357. if ( j( 'span.highlight span' ).length )
  358. j( 'span.highlight span' ).toggle();
  359. /**** Activity Posting ********************************************************/
  360. /* New posts */
  361. j("input#aw-whats-new-submit").click( function() {
  362. var button = j(this);
  363. var form = button.parent().parent().parent().parent();
  364. form.children().each( function() {
  365. if ( j.nodeName(this, "textarea") || j.nodeName(this, "input") )
  366. j(this).attr( 'disabled', 'disabled' );
  367. });
  368. j( 'form#' + form.attr('id') + ' span.ajax-loader' ).show();
  369. /* Remove any errors */
  370. j('div.error').remove();
  371. button.attr('disabled','disabled');
  372. /* Default POST values */
  373. var object = '';
  374. var item_id = j("#whats-new-post-in").val();
  375. var content = j("textarea#whats-new").val();
  376. /* Set object for non-profile posts */
  377. if ( item_id > 0 ) {
  378. object = j("#whats-new-post-object").val();
  379. }
  380. j.post( ajaxurl, {
  381. action: 'post_update',
  382. 'cookie': encodeURIComponent(document.cookie),
  383. '_wpnonce_post_update': j("input#_wpnonce_post_update").val(),
  384. 'content': content,
  385. 'object': object,
  386. 'item_id': item_id
  387. },
  388. function(response)
  389. {
  390. j( 'form#' + form.attr('id') + ' span.ajax-loader' ).hide();
  391. form.children().each( function() {
  392. if ( j.nodeName(this, "textarea") || j.nodeName(this, "input") )
  393. j(this).attr( 'disabled', '' );
  394. });
  395. /* Check for errors and append if found. */
  396. if ( response[0] + response[1] == '-1' ) {
  397. form.prepend( response.substr( 2, response.length ) );
  398. j( 'form#' + form.attr('id') + ' div.error').hide().fadeIn( 200 );
  399. button.attr("disabled", '');
  400. } else {
  401. if ( 0 == j("ul.activity-list").length ) {
  402. j("div.error").slideUp(100).remove();
  403. j("div#message").slideUp(100).remove();
  404. j("div.activity").append( '<ul id="activity-stream" class="activity-list item-list">' );
  405. }
  406. j("ul.activity-list").prepend(response);
  407. j("ul.activity-list li:first").addClass('new-update');
  408. j("li.new-update").hide().slideDown( 300 );
  409. j("li.new-update").removeClass( 'new-update' );
  410. j("textarea#whats-new").val('');
  411. /* Re-enable the submit button after 8 seconds. */
  412. setTimeout( function() { button.attr("disabled", ''); }, 8000 );
  413. }
  414. });
  415. return false;
  416. });
  417. /* List tabs event delegation */
  418. j('div.activity-type-tabs').click( function(event) {
  419. var target = j(event.target).parent();
  420. if ( event.target.nodeName == 'STRONG' || event.target.nodeName == 'SPAN' )
  421. target = target.parent();
  422. else if ( event.target.nodeName != 'A' )
  423. return false;
  424. /* Reset the page */
  425. j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
  426. /* Activity Stream Tabs */
  427. var scope = target.attr('id').substr( 9, target.attr('id').length );
  428. var filter = j("#activity-filter-select select").val();
  429. if ( scope == 'mentions' )
  430. j( 'li#' + target.attr('id') + ' a strong' ).remove();
  431. bp_activity_request(scope, filter, target);
  432. return false;
  433. });
  434. /* Activity filter select */
  435. j('#activity-filter-select select').change( function() {
  436. var selected_tab = j( 'div.activity-type-tabs li.selected' );
  437. if ( !selected_tab.length )
  438. var scope = null;
  439. else
  440. var scope = selected_tab.attr('id').substr( 9, selected_tab.attr('id').length );
  441. var filter = j(this).val();
  442. bp_activity_request(scope, filter);
  443. return false;
  444. });
  445. /* Stream event delegation */
  446. j('div.activity').click( function(event) {
  447. var target = j(event.target);
  448. /* Favoriting activity stream items */
  449. if ( target.attr('class') == 'fav' || target.attr('class') == 'unfav' ) {
  450. var type = target.attr('class')
  451. var parent = target.parent().parent().parent();
  452. var parent_id = parent.attr('id').substr( 9, parent.attr('id').length );
  453. target.addClass('loading');
  454. j.post( ajaxurl, {
  455. action: 'activity_mark_' + type,
  456. 'cookie': encodeURIComponent(document.cookie),
  457. 'id': parent_id
  458. },
  459. function(response) {
  460. target.removeClass('loading');
  461. target.fadeOut( 100, function() {
  462. j(this).html(response);
  463. j(this).fadeIn(100);
  464. });
  465. if ( 'fav' == type ) {
  466. if ( !j('div.item-list-tabs li#activity-favorites').length )
  467. j('div.item-list-tabs ul li#activity-mentions').before( '<li id="activity-favorites"><a href="#">' + bp_terms_my_favs + ' (<span>0</span>)</a></li>');
  468. target.removeClass('fav');
  469. target.addClass('unfav');
  470. j('div.item-list-tabs ul li#activity-favorites span').html( Number( j('div.item-list-tabs ul li#activity-favorites span').html() ) + 1 );
  471. } else {
  472. target.removeClass('unfav');
  473. target.addClass('fav');
  474. j('div.item-list-tabs ul li#activity-favorites span').html( Number( j('div.item-list-tabs ul li#activity-favorites span').html() ) - 1 );
  475. if ( !Number( j('div.item-list-tabs ul li#activity-favorites span').html() ) ) {
  476. if ( j('div.item-list-tabs ul li#activity-favorites').hasClass('selected') )
  477. bp_activity_request( null, null );
  478. j('div.item-list-tabs ul li#activity-favorites').remove();
  479. }
  480. }
  481. if ( 'activity-favorites' == j( 'div.item-list-tabs li.selected').attr('id') )
  482. target.parent().parent().parent().slideUp(100);
  483. });
  484. return false;
  485. }
  486. /* Delete activity stream items */
  487. if ( target.hasClass('delete-activity') ) {
  488. var li = target.parents('div.activity ul li');
  489. var id = li.attr('id').substr( 9, li.attr('id').length );
  490. var link_href = target.attr('href');
  491. var nonce = link_href.split('_wpnonce=');
  492. nonce = nonce[1];
  493. target.addClass('loading');
  494. j.post( ajaxurl, {
  495. action: 'delete_activity',
  496. 'cookie': encodeURIComponent(document.cookie),
  497. 'id': id,
  498. '_wpnonce': nonce
  499. },
  500. function(response) {
  501. target.removeClass('loading');
  502. if ( response[0] + response[1] == '-1' ) {
  503. li.prepend( response.substr( 2, response.length ) );
  504. li.children('div#message').hide().fadeIn(200);
  505. } else {
  506. li.slideUp(200);
  507. }
  508. });
  509. return false;
  510. }
  511. /* Load more updates at the end of the page */
  512. if ( target.parent().attr('class') == 'load-more' ) {
  513. j("li.load-more").addClass('loading');
  514. if ( null == j.cookie('bp-activity-oldestpage') )
  515. j.cookie('bp-activity-oldestpage', 1, {path: '/'} );
  516. var oldest_page = ( j.cookie('bp-activity-oldestpage') * 1 ) + 1;
  517. j.post( ajaxurl, {
  518. action: 'activity_get_older_updates',
  519. 'cookie': encodeURIComponent(document.cookie),
  520. 'page': oldest_page
  521. },
  522. function(response)
  523. {
  524. j("li.load-more").removeClass('loading');
  525. j.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} );
  526. j("ul.activity-list").append(response.contents);
  527. target.parent().hide();
  528. }, 'json' );
  529. return false;
  530. }
  531. });
  532. /**** Activity Comments *******************************************************/
  533. /* Hide all activity comment forms */
  534. j('form.ac-form').hide();
  535. /* Hide excess comments */
  536. if ( j('div.activity-comments').length )
  537. bp_dtheme_hide_comments();
  538. /* Activity list event delegation */
  539. j('div.activity').click( function(event) {
  540. var target = j(event.target);
  541. /* Comment / comment reply links */
  542. if ( target.attr('class') == 'acomment-reply' || target.parent().attr('class') == 'acomment-reply' ) {
  543. if ( target.parent().attr('class') == 'acomment-reply' )
  544. target = target.parent();
  545. var id = target.attr('id');
  546. ids = id.split('-');
  547. var a_id = ids[2]
  548. var c_id = target.attr('href').substr( 10, target.attr('href').length );
  549. var form = j( '#ac-form-' + a_id );
  550. var form = j( '#ac-form-' + ids[2] );
  551. form.css( 'display', 'none' );
  552. form.removeClass('root');
  553. j('.ac-form').hide();
  554. /* Hide any error messages */
  555. form.children('div').each( function() {
  556. if ( j(this).hasClass( 'error' ) )
  557. j(this).hide();
  558. });
  559. if ( ids[1] != 'comment' ) {
  560. j('div.activity-comments li#acomment-' + c_id).append( form );
  561. } else {
  562. j('li#activity-' + a_id + ' div.activity-comments').append( form );
  563. }
  564. if ( form.parent().attr( 'class' ) == 'activity-comments' )
  565. form.addClass('root');
  566. form.slideDown( 200 );
  567. j.scrollTo( form, 500, { offset:-100, easing:'easeout' } );
  568. j('#ac-form-' + ids[2] + ' textarea').focus();
  569. return false;
  570. }
  571. /* Activity comment posting */
  572. if ( target.attr('name') == 'ac_form_submit' ) {
  573. var form = target.parent().parent();
  574. var form_parent = form.parent();
  575. var form_id = form.attr('id').split('-');
  576. if ( 'activity-comments' !== form_parent.attr('class') ) {
  577. var tmp_id = form_parent.attr('id').split('-');
  578. var comment_id = tmp_id[1];
  579. } else {
  580. var comment_id = form_id[2];
  581. }
  582. /* Hide any error messages */
  583. j( 'form#' + form + ' div.error').hide();
  584. form.addClass('loading');
  585. target.css('disabled', 'disabled');
  586. j.post( ajaxurl, {
  587. action: 'new_activity_comment',
  588. 'cookie': encodeURIComponent(document.cookie),
  589. '_wpnonce_new_activity_comment': j("input._wpnonce_new_activity_comment").val(),
  590. 'comment_id': comment_id,
  591. 'form_id': form_id[2],
  592. 'content': j('form#' + form.attr('id') + ' textarea').val()
  593. },
  594. function(response)
  595. {
  596. form.removeClass('loading');
  597. /* Check for errors and append if found. */
  598. if ( response[0] + response[1] == '-1' ) {
  599. form.append( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
  600. target.attr("disabled", '');
  601. } else {
  602. form.fadeOut( 200,
  603. function() {
  604. if ( 0 == form.parent().children('ul').length ) {
  605. if ( form.parent().attr('class') == 'activity-comments' )
  606. form.parent().prepend('<ul></ul>');
  607. else
  608. form.parent().append('<ul></ul>');
  609. }
  610. form.parent().children('ul').append(response).hide().fadeIn( 200 );
  611. form.children('textarea').val('');
  612. form.parent().parent().addClass('has-comments');
  613. }
  614. );
  615. j( 'form#' + form + ' textarea').val('');
  616. /* Increase the "Reply (X)" button count */
  617. j('li#activity-' + form_id[2] + ' a.acomment-reply span').html( Number( j('li#activity-' + form_id[2] + ' a.acomment-reply span').html() ) + 1 );
  618. /* Re-enable the submit button after 5 seconds. */
  619. setTimeout( function() { target.attr("disabled", ''); }, 5000 );
  620. }
  621. });
  622. return false;
  623. }
  624. /* Deleting an activity comment */
  625. if ( target.hasClass('acomment-delete') ) {
  626. var link_href = target.attr('href');
  627. var comment_li = target.parent().parent();
  628. var form = comment_li.parents('div.activity-comments').children('form');
  629. var nonce = link_href.split('_wpnonce=');
  630. nonce = nonce[1];
  631. var comment_id = link_href.split('cid=');
  632. comment_id = comment_id[1].split('&');
  633. comment_id = comment_id[0];
  634. target.addClass('loading');
  635. /* Remove any error messages */
  636. j('div.activity-comments ul div.error').remove();
  637. /* Reset the form position */
  638. comment_li.parents('div.activity-comments').append(form);
  639. j.post( ajaxurl, {
  640. action: 'delete_activity_comment',
  641. 'cookie': encodeURIComponent(document.cookie),
  642. '_wpnonce': nonce,
  643. 'id': comment_id
  644. },
  645. function(response)
  646. {
  647. /* Check for errors and append if found. */
  648. if ( response[0] + response[1] == '-1' ) {
  649. comment_li.prepend( response.substr( 2, response.length ) ).hide().fadeIn( 200 );
  650. } else {
  651. var children = j( 'li#' + comment_li.attr('id') + ' ul' ).children('li');
  652. var child_count = 0;
  653. j(children).each( function() {
  654. if ( !j(this).is(':hidden') )
  655. child_count++;
  656. });
  657. comment_li.fadeOut(200);
  658. /* Decrease the "Reply (X)" button count */
  659. var parent_li = comment_li.parents('ul#activity-stream > li');
  660. j('li#' + parent_li.attr('id') + ' a.acomment-reply span').html( j('li#' + parent_li.attr('id') + ' a.acomment-reply span').html() - ( 1 + child_count ) );
  661. }
  662. });
  663. return false;
  664. }
  665. /* Showing hidden comments - pause for half a second */
  666. if ( target.parent().hasClass('show-all') ) {
  667. target.parent().addClass('loading');
  668. setTimeout( function() {
  669. target.parent().parent().children('li').fadeIn(200, function() {
  670. target.parent().remove();
  671. });
  672. }, 600 );
  673. return false;
  674. }
  675. });
  676. /* Escape Key Press for cancelling comment forms */
  677. j(document).keydown( function(e) {
  678. e = e || window.event;
  679. if (e.target)
  680. element = e.target;
  681. else if (e.srcElement)
  682. element = e.srcElement;
  683. if( element.nodeType == 3)
  684. element = element.parentNode;
  685. if( e.ctrlKey == true || e.altKey == true || e.metaKey == true )
  686. return;
  687. var keyCode = (e.keyCode) ? e.keyCode : e.which;
  688. if ( keyCode == 27 ) {
  689. if (element.tagName == 'TEXTAREA') {
  690. if ( j(element).attr('class') == 'ac-input' )
  691. j(element).parent().parent().parent().slideUp( 200 );
  692. }
  693. }
  694. });
  695. /**** @mention username help tooltip **************************************/
  696. j('span.highlight span').click( function() {
  697. if ( !j('div.help').length ) {
  698. j(this).parent().after( '<div id="message" class="info help"><p>' + bp_terms_mention_explain + '</p></div>' );
  699. j('div.help').hide().slideDown(200);
  700. } else {
  701. j('div.help').hide().remove();
  702. }
  703. })
  704. /**** Directory Search ****************************************************/
  705. /* The search form on all directory pages */
  706. j('div.dir-search').click( function(event) {
  707. if ( j(this).hasClass('no-ajax') )
  708. return;
  709. var target = j(event.target);
  710. if ( target.attr('type') == 'submit' ) {
  711. var css_id = j('div.item-list-tabs li.selected').attr('id').split( '-' );
  712. var object = css_id[0];
  713. bp_filter_request( object, j.cookie('bp-' + object + '-filter'), j.cookie('bp-' + object + '-scope') , 'div.' + object, target.parent().children('label').children('input').val(), 1, j.cookie('bp-' + object + '-extras') );
  714. return false;
  715. }
  716. });
  717. /**** Tabs and Filters ****************************************************/
  718. /* When a navigation tab is clicked - e.g. | All Groups | My Groups | */
  719. j('div.item-list-tabs').click( function(event) {
  720. if ( j(this).hasClass('no-ajax') )
  721. return;
  722. var target = j(event.target).parent();
  723. if ( 'LI' == event.target.parentNode.nodeName && !target.hasClass('last') ) {
  724. var css_id = target.attr('id').split( '-' );
  725. var object = css_id[0];
  726. if ( 'activity' == object )
  727. return false;
  728. var scope = css_id[1];
  729. var filter = j("#" + object + "-order-select select").val();
  730. var search_terms = j("#" + object + "_search").val();
  731. bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, j.cookie('bp-' + object + '-extras') );
  732. return false;
  733. }
  734. });
  735. /* When the filter select box is changed re-query */
  736. j('li.filter select').change( function() {
  737. if ( j('div.item-list-tabs li.selected').length )
  738. var el = j('div.item-list-tabs li.selected');
  739. else
  740. var el = j(this);
  741. var css_id = el.attr('id').split('-');
  742. var object = css_id[0];
  743. var scope = css_id[1];
  744. var filter = j(this).val();
  745. var search_terms = false;
  746. if ( j('div.dir-search input').length )
  747. search_terms = j('div.dir-search input').val();
  748. if ( 'friends' == object )
  749. object = 'members';
  750. bp_filter_request( object, filter, scope, 'div.' + object, search_terms, 1, j.cookie('bp-' + object + '-extras') );
  751. return false;
  752. });
  753. /* All pagination links run through this function */
  754. j('div#content').click( function(event) {
  755. var target = j(event.target);
  756. if ( target.hasClass('button') )
  757. return true;
  758. if ( target.parent().parent().hasClass('pagination') && !target.parent().parent().hasClass('no-ajax') ) {
  759. if ( target.hasClass('dots') || target.hasClass('current') )
  760. return false;
  761. if ( j('div.item-list-tabs li.selected').length )
  762. var el = j('div.item-list-tabs li.selected');
  763. else
  764. var el = j('li.filter select');
  765. var page_number = 1;
  766. var css_id = el.attr('id').split( '-' );
  767. var object = css_id[0];
  768. var search_terms = false;
  769. if ( j('div.dir-search input').length )
  770. search_terms = j('div.dir-search input').val();
  771. if ( j(target).hasClass('next') )
  772. var page_number = Number( j('div.pagination span.current').html() ) + 1;
  773. else if ( j(target).hasClass('prev') )
  774. var page_number = Number( j('div.pagination span.current').html() ) - 1;
  775. else
  776. var page_number = Number( j(target).html() );
  777. bp_filter_request( object, j.cookie('bp-' + object + '-filter'), j.cookie('bp-' + object + '-scope'), 'div.' + object, search_terms, page_number, j.cookie('bp-' + object + '-extras') );
  778. return false;
  779. }
  780. });
  781. /**** New Forum Directory Post **************************************/
  782. /* Hit the "New Topic" button on the forums directory page */
  783. j('a#new-topic-button').click( function() {
  784. if ( !j('div#new-topic-post').length )
  785. return false;
  786. if ( j('div#new-topic-post').is(":visible") )
  787. j('div#new-topic-post').slideUp(200);
  788. else
  789. j('div#new-topic-post').slideDown(200);
  790. return false;
  791. });
  792. /* Cancel the posting of a new forum topic */
  793. j('input#submit_topic_cancel').click( function() {
  794. if ( !j('div#new-topic-post').length )
  795. return false;
  796. j('div#new-topic-post').slideUp(200);
  797. return false;
  798. });
  799. /* Clicking a forum tag */
  800. j('div#forum-directory-tags a').click( function() {
  801. bp_filter_request( 'forums', 'tags', j.cookie('bp-forums-scope'), 'div.forums', j(this).html().replace( /&nbsp;/g, '-' ), 1, j.cookie('bp-forums-extras') );
  802. return false;
  803. });
  804. /** Invite Friends Interface ****************************************/
  805. /* Select a user from the list of friends and add them to the invite list */
  806. j("div#invite-list input").click( function() {
  807. j('.ajax-loader').toggle();
  808. var friend_id = j(this).val();
  809. if ( j(this).attr('checked') == true )
  810. var friend_action = 'invite';
  811. else
  812. var friend_action = 'uninvite';
  813. j('div.item-list-tabs li.selected').addClass('loading');
  814. j.post( ajaxurl, {
  815. action: 'groups_invite_user',
  816. 'friend_action': friend_action,
  817. 'cookie': encodeURIComponent(document.cookie),
  818. '_wpnonce': j("input#_wpnonce_invite_uninvite_user").val(),
  819. 'friend_id': friend_id,
  820. 'group_id': j("input#group_id").val()
  821. },
  822. function(response)
  823. {
  824. if ( j("#message") )
  825. j("#message").hide();
  826. j('.ajax-loader').toggle();
  827. if ( friend_action == 'invite' ) {
  828. j('#friend-list').append(response);
  829. } else if ( friend_action == 'uninvite' ) {
  830. j('#friend-list li#uid-' + friend_id).remove();
  831. }
  832. j('div.item-list-tabs li.selected').removeClass('loading');
  833. });
  834. });
  835. /* Remove a user from the list of users to invite to a group */
  836. j("#friend-list li a.remove").live('click', function() {
  837. j('.ajax-loader').toggle();
  838. var friend_id = j(this).attr('id');
  839. friend_id = friend_id.split('-');
  840. friend_id = friend_id[1];
  841. j.post( ajaxurl, {
  842. action: 'groups_invite_user',
  843. 'friend_action': 'uninvite',
  844. 'cookie': encodeURIComponent(document.cookie),
  845. '_wpnonce': j("input#_wpnonce_invite_uninvite_user").val(),
  846. 'friend_id': friend_id,
  847. 'group_id': j("input#group_id").val()
  848. },
  849. function(response)
  850. {
  851. j('.ajax-loader').toggle();
  852. j('#friend-list li#uid-' + friend_id).remove();
  853. j('#invite-list input#f-' + friend_id).attr('checked', false);
  854. });
  855. return false;
  856. });
  857. /** Friendship Requests **************************************/
  858. /* Accept and Reject friendship request buttons */
  859. j("ul#friend-list a.accept, ul#friend-list a.reject").click( function() {
  860. var button = j(this);
  861. var li = j(this).parents('ul#friend-list li');
  862. var action_div = j(this).parents('li div.action');
  863. var id = li.attr('id').substr( 11, li.attr('id').length );
  864. var link_href = button.attr('href');
  865. var nonce = link_href.split('_wpnonce=');
  866. nonce = nonce[1];
  867. if ( j(this).hasClass('accepted') || j(this).hasClass('rejected') )
  868. return false;
  869. if ( j(this).hasClass('accept') ) {
  870. var action = 'accept_friendship';
  871. action_div.children('a.reject').css( 'visibility', 'hidden' );
  872. } else {
  873. var action = 'reject_friendship';
  874. action_div.children('a.accept').css( 'visibility', 'hidden' );
  875. }
  876. button.addClass('loading');
  877. j.post( ajaxurl, {
  878. action: action,
  879. 'cookie': encodeURIComponent(document.cookie),
  880. 'id': id,
  881. '_wpnonce': nonce
  882. },
  883. function(response) {
  884. button.removeClass('loading');
  885. if ( response[0] + response[1] == '-1' ) {
  886. li.prepend( response.substr( 2, response.length ) );
  887. li.children('div#message').hide().fadeIn(200);
  888. } else {
  889. button.fadeOut( 100, function() {
  890. if ( j(this).hasClass('accept') ) {
  891. j(this).html( bp_terms_accepted ).fadeIn(50);
  892. j(this).addClass('accepted');
  893. } else {
  894. j(this).html( bp_terms_rejected ).fadeIn(50);
  895. j(this).addClass('rejected');
  896. }
  897. });
  898. }
  899. });
  900. return false;
  901. });
  902. /* Add / Remove friendship buttons */
  903. j("div.friendship-button a").live('click', function() {
  904. j(this).parent().addClass('loading');
  905. var fid = j(this).attr('id');
  906. fid = fid.split('-');
  907. fid = fid[1];
  908. var nonce = j(this).attr('href');
  909. nonce = nonce.split('?_wpnonce=');
  910. nonce = nonce[1].split('&');
  911. nonce = nonce[0];
  912. var thelink = j(this);
  913. j.post( ajaxurl, {
  914. action: 'addremove_friend',
  915. 'cookie': encodeURIComponent(document.cookie),
  916. 'fid': fid,
  917. '_wpnonce': nonce
  918. },
  919. function(response)
  920. {
  921. var action = thelink.attr('rel');
  922. var parentdiv = thelink.parent();
  923. if ( action == 'add' ) {
  924. j(parentdiv).fadeOut(200,
  925. function() {
  926. parentdiv.removeClass('add_friend');
  927. parentdiv.removeClass('loading');
  928. parentdiv.addClass('pending');
  929. parentdiv.fadeIn(200).html(response);
  930. }
  931. );
  932. } else if ( action == 'remove' ) {
  933. j(parentdiv).fadeOut(200,
  934. function() {
  935. parentdiv.removeClass('remove_friend');
  936. parentdiv.removeClass('loading');
  937. parentdiv.addClass('add');
  938. parentdiv.fadeIn(200).html(response);
  939. }
  940. );
  941. }
  942. });
  943. return false;
  944. } );
  945. /** Group Join / Leave Buttons **************************************/
  946. j("div.group-button a").live('click', function() {
  947. var gid = j(this).parent().attr('id');
  948. gid = gid.split('-');
  949. gid = gid[1];
  950. var nonce = j(this).attr('href');
  951. nonce = nonce.split('?_wpnonce=');
  952. nonce = nonce[1].split('&');
  953. nonce = nonce[0];
  954. var thelink = j(this);
  955. j.post( ajaxurl, {
  956. action: 'joinleave_group',
  957. 'cookie': encodeURIComponent(document.cookie),
  958. 'gid': gid,
  959. '_wpnonce': nonce
  960. },
  961. function(response)
  962. {
  963. var parentdiv = thelink.parent();
  964. if ( !j('body.directory').length )
  965. location.href = location.href;
  966. else {
  967. j(parentdiv).fadeOut(200,
  968. function() {
  969. parentdiv.fadeIn(200).html(response);
  970. }
  971. );
  972. }
  973. });
  974. return false;
  975. } );
  976. /** Button disabling ************************************************/
  977. j('div.pending').click(function() {
  978. return false;
  979. });
  980. /** Alternate Highlighting ******************************************/
  981. j('table tr, div.message-box, ul#topic-post-list li').each( function(i) {
  982. if ( i % 2 != 1 )
  983. j(this).addClass('alt');
  984. });
  985. /** Private Messaging ******************************************/
  986. /* AJAX send reply functionality */
  987. j("input#send_reply_button").click(
  988. function() {
  989. j('form#send-reply span.ajax-loader').toggle();
  990. j.post( ajaxurl, {
  991. action: 'messages_send_reply',
  992. 'cookie': encodeURIComponent(document.cookie),
  993. '_wpnonce': j("input#send_message_nonce").val(),
  994. 'content': j("#message_content").val(),
  995. 'send_to': j("input#send_to").val(),
  996. 'subject': j("input#subject").val(),
  997. 'thread_id': j("input#thread_id").val()
  998. },
  999. function(response)
  1000. {
  1001. if ( response[0] + response[1] == "-1" ) {
  1002. j('form#send-reply').prepend( response.substr( 2, response.length ) );
  1003. } else {
  1004. j('form#send-reply div#message').remove();
  1005. j("#message_content").val('');
  1006. j('form#send-reply').before( response );
  1007. j("div.new-message").hide().slideDown( 200, function() {
  1008. j('div.new-message').removeClass('new-message');
  1009. });
  1010. j('div.message-box').each( function(i) {
  1011. j(this).removeClass('alt');
  1012. if ( i % 2 != 1 )
  1013. j(this).addClass('alt');
  1014. });
  1015. }
  1016. j('form#send-reply span.ajax-loader').toggle();
  1017. });
  1018. return false;
  1019. }
  1020. );
  1021. /* Marking private messages as read and unread */
  1022. j("a#mark_as_read, a#mark_as_unread").click(function() {
  1023. var checkboxes_tosend = '';
  1024. var checkboxes = j("#message-threads tr td input[type='checkbox']");
  1025. if ( 'mark_as_unread' == j(this).attr('id') ) {
  1026. var currentClass = 'read'
  1027. var newClass = 'unread'
  1028. var unreadCount = 1;
  1029. var inboxCount = 0;
  1030. var unreadCountDisplay = 'inline';
  1031. var action = 'messages_markunread';
  1032. } else {
  1033. var currentClass = 'unread'
  1034. var newClass = 'read'
  1035. var unreadCount = 0;
  1036. var inboxCount = 1;
  1037. var unreadCountDisplay = 'none';
  1038. var action = 'messages_markread';
  1039. }
  1040. checkboxes.each( function(i) {
  1041. if(j(this).is(':checked')) {
  1042. if ( j('tr#m-' + j(this).attr('value')).hasClass(currentClass) ) {
  1043. checkboxes_tosend += j(this).attr('value');
  1044. j('tr#m-' + j(this).attr('value')).removeClass(currentClass);
  1045. j('tr#m-' + j(this).attr('value')).addClass(newClass);
  1046. var thread_count = j('tr#m-' + j(this).attr('value') + ' td span.unread-count').html();
  1047. j('tr#m-' + j(this).attr('value') + ' td span.unread-count').html(unreadCount);
  1048. j('tr#m-' + j(this).attr('value') + ' td span.unread-count').css('display', unreadCountDisplay);
  1049. var inboxcount = j('a#user-messages strong').html().substr( 1, j('a#user-messages strong').html().length );
  1050. var inboxcount = inboxcount.substr( 0, inboxcount.length - 1 );
  1051. if ( !inboxcount.length )
  1052. inboxcount = 0;
  1053. if ( parseInt(inboxcount) == inboxCount ) {
  1054. j('a#user-messages strong').css('display', unreadCountDisplay);
  1055. j('a#user-messages strong').html( '(' + unreadCount + ')' );
  1056. } else {
  1057. if ( 'read' == currentClass )
  1058. j('a#user-messages strong').html('(' + ( parseInt(inboxcount) + 1 ) + ')');
  1059. else
  1060. j('a#user-messages strong').html('(' + ( parseInt(inboxcount) - thread_count ) + ')');
  1061. }
  1062. if ( i != checkboxes.length - 1 ) {
  1063. checkboxes_tosend += ','
  1064. }
  1065. }
  1066. }
  1067. });
  1068. j.post( ajaxurl, {
  1069. action: action,
  1070. 'thread_ids': checkboxes_tosend
  1071. });
  1072. return false;
  1073. });
  1074. /* Selecting unread and read messages in inbox */
  1075. j("select#message-type-select").change(
  1076. function() {
  1077. var selection = j("select#message-type-select").val();
  1078. var checkboxes = j("td input[type='checkbox']");
  1079. checkboxes.each( function(i) {
  1080. checkboxes[i].checked = "";
  1081. });
  1082. switch(selection) {
  1083. case 'unread':
  1084. var checkboxes = j("tr.unread td input[type='checkbox']");
  1085. break;
  1086. case 'read':
  1087. var checkboxes = j("tr.read td input[type='checkbox']");
  1088. break;
  1089. }
  1090. if ( selection != '' ) {
  1091. checkboxes.each( function(i) {
  1092. checkboxes[i].checked = "checked";
  1093. });
  1094. } else {
  1095. checkboxes.each( function(i) {
  1096. checkboxes[i].checked = "";
  1097. });
  1098. }
  1099. }
  1100. );
  1101. /* Bulk delete messages */
  1102. j("a#delete_inbox_messages").click( function() {
  1103. checkboxes_tosend = '';
  1104. checkboxes = j("#message-threads tr td input[type='checkbox']");
  1105. j('div#message').remove();
  1106. j(this).addClass('loading');
  1107. j(checkboxes).each( function(i) {
  1108. if( j(this).is(':checked') )
  1109. checkboxes_tosend += j(this).attr('value') + ',';
  1110. });
  1111. if ( '' == checkboxes_tosend ) {
  1112. j(this).removeClass('loading');
  1113. return false;
  1114. }
  1115. j.post( ajaxurl, {
  1116. action: 'messages_delete',
  1117. 'thread_ids': checkboxes_tosend
  1118. }, function(response) {
  1119. if ( response[0] + response[1] == "-1" ) {
  1120. j('#message-threads').prepend( response.substr( 2, response.length ) );
  1121. } else {
  1122. j('#message-threads').before( '<div id="message" class="updated"><p>' + response + '</p></div>' );
  1123. j(checkboxes).each( function(i) {
  1124. if( j(this).is(':checked') )
  1125. j(this).parent().parent().fadeOut(150);
  1126. });
  1127. }
  1128. j('div#message').hide().slideDown(150);
  1129. j("a#delete_inbox_messages").removeClass('loading');
  1130. });
  1131. return false;
  1132. });
  1133. /* Close site wide notices in the sidebar */
  1134. j("a#close-notice").click( function() {
  1135. j(this).addClass('loading');
  1136. j('div#sidebar div.error').remove();
  1137. j.post( ajaxurl, {
  1138. action: 'messages_close_notice',
  1139. 'notice_id': j('.notice').attr('rel').substr( 2, j('.notice').attr('rel').length )
  1140. },
  1141. function(response) {
  1142. j("a#close-notice").removeClass('loading');
  1143. if ( response[0] + response[1] == '-1' ) {
  1144. j('.notice').prepend( response.substr( 2, response.length ) );
  1145. j( 'div#sidebar div.error').hide().fadeIn( 200 );
  1146. } else {
  1147. j('.notice').slideUp( 100 );
  1148. }
  1149. });
  1150. return false;
  1151. });
  1152. /* Admin Bar Javascript */
  1153. j("#wp-admin-bar ul.main-nav li").mouseover( function() {
  1154. j(this).addClass('sfhover');
  1155. });
  1156. j("#wp-admin-bar ul.main-nav li").mouseout( function() {
  1157. j(this).removeClass('sfhover');
  1158. });
  1159. /* Clear BP cookies on logout */
  1160. j('a.logout').click( function() {
  1161. j.cookie('bp-activity-scope', null, {path: '/'});
  1162. j.cookie('bp-activity-filter', null, {path: '/'});
  1163. j.cookie('bp-activity-oldestpage', null, {path: '/'});
  1164. var objects = [ 'members', 'groups', 'blogs', 'forums' ];
  1165. j(objects).each( function(i) {
  1166. j.cookie('bp-' + objects[i] + '-scope', null, {path: '/'} );
  1167. j.cookie('bp-' + objects[i] + '-filter', null, {path: '/'} );
  1168. j.cookie('bp-' + objects[i] + '-extras', null, {path: '/'} );
  1169. });
  1170. });
  1171. jQuery(".widget div#members-list-options a").live('click',
  1172. function() {
  1173. jQuery('#ajax-loader-members').toggle();
  1174. jQuery(".widget div#members-list-options a").removeClass("selected");
  1175. jQuery(this).addClass('selected');
  1176. jQuery.post( ajaxurl, {
  1177. action: 'widget_members',
  1178. 'cookie': encodeURIComponent(document.cookie),
  1179. '_wpnonce': jQuery("input#_wpnonce-members").val(),
  1180. 'max-members': jQuery("input#members_widget_max").val(),
  1181. 'filter': jQuery(this).attr('id')
  1182. },
  1183. function(response)
  1184. {
  1185. jQuery('#ajax-loader-members').toggle();
  1186. member_wiget_response(response);
  1187. });
  1188. return false;
  1189. }
  1190. );
  1191. jQuery(".widget div#groups-list-options a").live('click',
  1192. function() {
  1193. jQuery('#ajax-loader-groups').toggle();
  1194. jQuery(".widget div#groups-list-options a").removeClass("selected");
  1195. jQuery(this).addClass('selected');
  1196. jQuery.post( ajaxurl, {
  1197. action: 'widget_groups_list',
  1198. 'cookie': encodeURIComponent(document.cookie),
  1199. '_wpnonce': jQuery("input#_wpnonce-groups").val(),
  1200. 'max_groups': jQuery("input#groups_widget_max").val(),
  1201. 'filter': jQuery(this).attr('id')
  1202. },
  1203. function(response)
  1204. {
  1205. jQuery('#ajax-loader-groups').toggle();
  1206. groups_wiget_response(response);
  1207. });
  1208. return false;
  1209. }
  1210. );
  1211. });
  1212. /* Setup activity scope and filter based on the current cookie settings. */
  1213. function bp_init_activity() {
  1214. /* Reset the page */
  1215. j.cookie( 'bp-activity-oldestpage', 1, {path: '/'} );
  1216. if ( null != j.cookie('bp-activity-filter') && j('#activity-filter-select').length )
  1217. j('#activity-filter-select select option[value=' + j.cookie('bp-activity-filter') + ']').attr( 'selected', 'selected' );
  1218. /* Activity Tab Set */
  1219. if ( null != j.cookie('bp-activity-scope') && j('div.activity-type-tabs').length ) {
  1220. j('div.activity-type-tabs li').each( function() {
  1221. j(this).removeClass('selected');
  1222. });
  1223. j('li#activity-' + j.cookie('bp-activity-scope') + ', div.item-list-tabs li.current').addClass('selected');
  1224. }
  1225. }
  1226. /* Setup object scope and filter based on the current cookie settings for the object. */
  1227. function bp_init_objects(objects) {
  1228. j(objects).each( function(i) {
  1229. if ( null != j.cookie('bp-' + objects[i] + '-filter') && j('li#' + objects[i] + '-order-select select').length )
  1230. j('li#' + objects[i] + '-order-select select option[value=' + j.cookie('bp-' + objects[i] + '-filter') + ']').attr( 'selected', 'selected' );
  1231. if ( null != j.cookie('bp-' + objects[i] + '-scope') && j('div.' + objects[i]).length ) {
  1232. j('div.item-list-tabs li').each( function() {
  1233. j(this).removeClass('selected');
  1234. });
  1235. j('div.item-list-tabs li#' + objects[i] + '-' + j.cookie('bp-' + objects[i] + '-scope') + ', div.item-list-tabs#object-nav li.current').addClass('selected');
  1236. }
  1237. });
  1238. }
  1239. /* Filter the current content list (groups/members/blogs/topics) */
  1240. function bp_filter_request( object, filter, scope, target, search_terms, page, extras ) {
  1241. if ( 'activity' == object )
  1242. return false;
  1243. if ( j.query.get('s') )
  1244. search_terms = j.query.get('s');
  1245. if ( null == scope )
  1246. scope = 'all';
  1247. /* Save the settings we want to remain persistent to a cookie */
  1248. j.cookie( 'bp-' + object + '-scope', scope, {path: '/'} );
  1249. j.cookie( 'bp-' + object + '-filter', filter, {path: '/'} );
  1250. j.cookie( 'bp-' + object + '-extras', extras, {path: '/'} );
  1251. /* Set the correct selected nav and filter */
  1252. j('div.item-list-tabs li').each( function() {
  1253. j(this).removeClass('selected');
  1254. });
  1255. j('div.item-list-tabs li#' + object + '-' + scope + ', div.item-list-tabs#object-nav li.current').addClass('selected');
  1256. j('div.item-list-tabs li.selected').addClass('loading');
  1257. j('div.item-list-tabs select option[value=' + filter + ']').attr( 'selected', 'selected' );
  1258. if ( 'friends' == object )
  1259. object = 'members';
  1260. if ( bp_ajax_request )
  1261. bp_ajax_request.abort();
  1262. bp_ajax_request = j.post( ajaxurl, {
  1263. action: object + '_filter',
  1264. 'cookie': encodeURIComponent(document.cookie),
  1265. 'object': object,
  1266. 'filter': filter,
  1267. 'search_terms': search_terms,
  1268. 'scope': scope,
  1269. 'page': page,
  1270. 'extras': extras
  1271. },
  1272. function(response)
  1273. {
  1274. j(target).fadeOut( 100, function() {
  1275. j(this).html(response);
  1276. j(this).fadeIn(100);
  1277. });
  1278. j('div.item-list-tabs li.selected').removeClass('loading');
  1279. });
  1280. }
  1281. /* Activity Loop Requesting */
  1282. function bp_activity_request(scope, filter) {
  1283. /* Save the type and filter to a session cookie */
  1284. j.cookie( 'bp-activity-scope', scope, {path: '/'} );
  1285. j.cookie( 'bp-activity-filter', filter, {path: '/'} );
  1286. j.cookie( 'bp-activity-oldestpage', 1 );
  1287. /* Remove selected and loading classes from tabs */
  1288. j('div.item-list-tabs li').each( function() {
  1289. j(this).removeClass('selected loading');
  1290. });
  1291. /* Set the correct selected nav and filter */
  1292. j('li#activity-' + scope + ', div.item-list-tabs li.current').addClass('selected');
  1293. j('div#object-nav.item-list-tabs li.selected, div.activity-type-tabs li.selected').addClass('loading');
  1294. j('#activity-filter-select select option[value=' + filter + ']').attr( 'selected', 'selected' );
  1295. /* Reload the activity stream based on the selection */
  1296. j('.widget_bp_activity_widget h2 span.ajax-loader').show();
  1297. if ( bp_ajax_request )
  1298. bp_ajax_request.abort();
  1299. bp_ajax_request = j.post( ajaxurl, {
  1300. action: 'activity_widget_filter',
  1301. 'cookie': encodeURIComponent(document.cookie),
  1302. '_wpnonce_activity_filter': j("input#_wpnonce_activity_filter").val(),
  1303. 'scope': scope,
  1304. 'filter': filter
  1305. },
  1306. function(response)
  1307. {
  1308. j('.widget_bp_activity_widget h2 span.ajax-loader').hide();
  1309. j('div.activity').fadeOut( 100, function() {
  1310. j(this).html(response.contents);
  1311. j(this).fadeIn(100);
  1312. });
  1313. /* Update the feed link */
  1314. if ( null != response.feed_url )
  1315. j('.directory div#subnav li.feed a, .home-page div#subnav li.feed a').attr('href', response.feed_url);
  1316. j('div.item-list-tabs li.selected').removeClass('loading');
  1317. /* Selectively hide comments */
  1318. bp_dtheme_hide_comments();
  1319. }, 'json' );
  1320. }
  1321. /* Hide long lists of activity comments, only show the latest five root comments. */
  1322. function bp_dtheme_hide_comments() {
  1323. var comments_divs = j('div.activity-comments');
  1324. if ( !comments_divs.length )
  1325. return false;
  1326. comments_divs.each( function() {
  1327. if ( j(this).children('ul').children('li').length < 5 ) return;
  1328. var comments_div = j(this);
  1329. var parent_li = comments_div.parents('ul#activity-stream > li');
  1330. var comment_lis = j(this).children('ul').children('li');
  1331. var comment_count = ' ';
  1332. if ( j('li#' + parent_li.attr('id') + ' a.acomment-reply span').length )
  1333. var comment_count = j('li#' + parent_li.attr('id') + ' a.acomment-reply span').html();
  1334. comment_lis.each( function(i) {
  1335. /* Show the latest 5 root comments */
  1336. if ( i < comment_lis.length - 5 ) {
  1337. j(this).addClass('hidden');
  1338. j(this).toggle();
  1339. if ( !i )
  1340. j(this).before( '<li class="show-all"><a href="#' + parent_li.attr('id') + '/show-all/" title="' + bp_terms_show_all_comments + '">' + bp_terms_show_all + ' ' + comment_count + ' ' + bp_terms_comments + '</a></li>' );
  1341. }
  1342. });
  1343. });
  1344. }
  1345. function member_wiget_response(response) {
  1346. response = response.substr(0, response.length-1);
  1347. response = response.split('[[SPLIT]]');
  1348. if ( response[0] != "-1" ) {
  1349. jQuery(".widget ul#members-list").fadeOut(200,
  1350. function() {
  1351. jQuery(".widget ul#members-list").html(response[1]);
  1352. jQuery(".widget ul#members-list").fadeIn(200);
  1353. jQuery(".widget ul#members-list li").tooltip({
  1354. delay: 0,
  1355. track: true,
  1356. showURL: false,
  1357. bodyHandler: function() {
  1358. var title = jQuery(this).find('div.item-title a').text();
  1359. var membros = jQuery(this).find('div.item-meta span').text();
  1360. return '<h3>'+ title +'</h3>' + '<p>' + membros + '</p>';
  1361. }
  1362. });
  1363. }
  1364. );
  1365. } else {
  1366. jQuery(".widget ul#members-list").fadeOut(200,
  1367. function() {
  1368. var message = '<p>' + response[1] + '</p>';
  1369. jQuery(".widget ul#members-list").html(message);
  1370. jQuery(".widget ul#members-list").fadeIn(200);
  1371. }
  1372. );
  1373. }
  1374. }
  1375. function groups_wiget_response(response) {
  1376. response = response.substr(0, response.length-1);
  1377. response = response.split('[[SPLIT]]');
  1378. if ( response[0] != "-1" ) {
  1379. jQuery(".widget ul#groups-list").fadeOut(200,
  1380. function() {
  1381. jQuery(".widget ul#groups-list").html(response[1]);
  1382. jQuery(".widget ul#groups-list").fadeIn(200);
  1383. jQuery(".widget ul#groups-list li").tooltip({
  1384. delay: 0,
  1385. track: true,
  1386. showURL: false,
  1387. bodyHandler: function() {
  1388. var title = jQuery(this).find('div.item-title a').text();
  1389. var membros = jQuery(this).find('div.item-meta span').text();
  1390. return '<h3>'+ title +'</h3>' + '<p>' + membros + '</p>';
  1391. }
  1392. });
  1393. }
  1394. );
  1395. } else {
  1396. jQuery(".widget ul#groups-list").fadeOut(200,
  1397. function() {
  1398. var message = '<p>' + response[1] + '</p>';
  1399. jQuery(".widget ul#groups-list").html(message);
  1400. jQuery(".widget ul#groups-list").fadeIn(200);
  1401. }
  1402. );
  1403. }
  1404. }
  1405. /* Helper Functions */
  1406. function checkAll() {
  1407. var checkboxes = document.getElementsByTagName("input");
  1408. for(var i=0; i<checkboxes.length; i++) {
  1409. if(checkboxes[i].type == "checkbox") {
  1410. if($("check_all").checked == "") {
  1411. checkboxes[i].checked = "";
  1412. }
  1413. else {
  1414. checkboxes[i].checked = "checked";
  1415. }
  1416. }
  1417. }
  1418. }
  1419. function clear(container) {
  1420. if( !document.getElementById(container) ) return;
  1421. var container = document.getElementById(container);
  1422. if ( radioButtons = container.getElementsByTagName('INPUT') ) {
  1423. for(var i=0; i<radioButtons.length; i++) {
  1424. radioButtons[i].checked = '';
  1425. }
  1426. }
  1427. if ( options = container.getElementsByTagName('OPTION') ) {
  1428. for(var i=0; i<options.length; i++) {
  1429. options[i].selected = false;
  1430. }
  1431. }
  1432. return;
  1433. }
  1434. /* Back to top plugin */
  1435. jQuery.fn.topLink=function(settings){settings=jQuery.extend({min:1,fadeSpeed:200,ieOffset:50},settings);return this.each(function(){var el=jQuery(this);el.css('display','none');jQuery(window).scroll(function(){if(!jQuery.support.hrefNormalized){el.css({'position':'absolute','top':jQuery(window).scrollTop()+jQuery(window).height()-settings.ieOffset});} if(jQuery(window).scrollTop()>=settings.min) {el.fadeIn(settings.fadeSpeed);} else {el.fadeOut(settings.fadeSpeed);}});});};
  1436. /* ScrollTo plugin - just inline and minified */
  1437. ;(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);
  1438. 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}}});
  1439. /* jQuery Cookie plugin */
  1440. jQuery.cookie=function(d,c,a){if(typeof c!="undefined"){a=a||{};if(c===null){c="";a.expires=-1}var b="";if(a.expires&&(typeof a.expires=="number"||a.expires.toUTCString)){if(typeof a.expires=="number"){b=new Date;b.setTime(b.getTime()+a.expires*24*60*60*1E3)}else b=a.expires;b="; expires="+b.toUTCString()}var e=a.path?"; path="+a.path:"",f=a.domain?"; domain="+a.domain:"";a=a.secure?"; secure":"";document.cookie=[d,"=",encodeURIComponent(c),b,e,f,a].join("")}else{c=null;if(document.cookie&&document.cookie!= ""){a=document.cookie.split(";");for(b=0;b<a.length;b++){e=jQuery.trim(a[b]);if(e.substring(0,d.length+1)==d+"="){c=decodeURIComponent(e.substring(d.length+1));break}}}return c}};
  1441. /* jQuery tooltip plugin */
  1442. ;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
  1443. show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
  1444. helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
  1445. helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
  1446. helper.parent.stop().fadeOut(tsettings.fade,complete);}else
  1447. complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery);
  1448. /* jQuery querystring plugin */
  1449. 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,{}))