Guest User

Untitled

a guest
Dec 10th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. function HideCategory(id) {
  2. $j("div#category_" + id).hide();
  3. $j.cookie('hide_category_' + id, 'yes', { expires: 180 });
  4. $j('span#hide_category_' + id).attr("onclick", "ShowCategory(" + id + ")");
  5. $j('span#hide_category_' + id).text("[+]");
  6.  
  7. };
  8.  
  9. function ShowCategory(id) {
  10. $j("div#category_" + id).show();
  11. $j.cookie('hide_category_' + id, 'no', { expires: 180 });
  12. $j('span#hide_category_' + id).attr("onclick", "HideCategory(" + id + ")");
  13. $j('span#hide_category_' + id).text("[-]");
  14. };
  15.  
  16.  
  17. // Get current url
  18. var s_url = window.location.pathname;
  19. var s_urlparts = s_url.split('/');
  20. var s_section = s_urlparts[1];
  21.  
  22. // Run if we in the "forums" section
  23. if (s_section == 'forums' || s_section == 'home') {
  24.  
  25. // Get all sections from page
  26. var cat_headers = $j("div.category-header");
  27. $j.each(cat_headers, function () {
  28.  
  29. var base = $j(this).children("div.category-name");
  30.  
  31. if (base.length == 0) {
  32. // Is non agent if that
  33. base = $j(this);
  34. }
  35.  
  36.  
  37. var child = base.children("h2").children("a");
  38.  
  39. if (child.length != 0) {
  40. // "0" means No Category Section
  41. var id = child.attr("href")
  42. var id_splitted = id.split("/");
  43. if (id_splitted.length == 3) {
  44. var id_value = id_splitted[2].split("-")[0];
  45.  
  46. base.children('h2').append("&nbsp;<span style='font-size: 13pt; cursor: hand; cursor: pointer;' id='hide_category_" + id_value + "' href='#' onclick='HideCategory(" + id_value + ")'>[-]</span>");
  47. if ($j.cookie('hide_category_' + id_value) == 'yes') {
  48. HideCategory(id_value);
  49. }
  50. }
  51. }
  52. });
  53. }
Add Comment
Please, Sign In to add comment