Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function HideCategory(id) {
- $j("div#category_" + id).hide();
- $j.cookie('hide_category_' + id, 'yes', { expires: 180 });
- $j('span#hide_category_' + id).attr("onclick", "ShowCategory(" + id + ")");
- $j('span#hide_category_' + id).text("[+]");
- };
- function ShowCategory(id) {
- $j("div#category_" + id).show();
- $j.cookie('hide_category_' + id, 'no', { expires: 180 });
- $j('span#hide_category_' + id).attr("onclick", "HideCategory(" + id + ")");
- $j('span#hide_category_' + id).text("[-]");
- };
- // Get current url
- var s_url = window.location.pathname;
- var s_urlparts = s_url.split('/');
- var s_section = s_urlparts[1];
- // Run if we in the "forums" section
- if (s_section == 'forums' || s_section == 'home') {
- // Get all sections from page
- var cat_headers = $j("div.category-header");
- $j.each(cat_headers, function () {
- var base = $j(this).children("div.category-name");
- if (base.length == 0) {
- // Is non agent if that
- base = $j(this);
- }
- var child = base.children("h2").children("a");
- if (child.length != 0) {
- // "0" means No Category Section
- var id = child.attr("href")
- var id_splitted = id.split("/");
- if (id_splitted.length == 3) {
- var id_value = id_splitted[2].split("-")[0];
- base.children('h2').append(" <span style='font-size: 13pt; cursor: hand; cursor: pointer;' id='hide_category_" + id_value + "' href='#' onclick='HideCategory(" + id_value + ")'>[-]</span>");
- if ($j.cookie('hide_category_' + id_value) == 'yes') {
- HideCategory(id_value);
- }
- }
- }
- });
- }
Add Comment
Please, Sign In to add comment