| | 6 | |
| | 7 | // Hide spam from the news feed? |
| | 8 | hide_news_feed_spam = true; |
| | 9 | |
| | 10 | // If any news feed entries have been hidden, setting this to true will |
| | 11 | // show a count of the number of hidden feeds in the news feed heading. |
| | 12 | show_hidden_news_feed_entries_count = true; |
| | 13 | |
| | 14 | // Hide application notifications from the sidebar? |
| | 15 | hide_side_bar_spam = true; |
| | 16 | |
| | 17 | // If application notifications have been hidden, and there are no other |
| | 18 | // requests, setting this to true will show how many have been hidden. |
| | 19 | // Otherwise it will hide the entire requests section of the sidebar. |
| | 20 | keep_requests_when_all_hidden = false; |
| 51 | | spampattern = new RegExp("(^|\\s)(social_ad|ad_capsule|app_story)(\\s|$)"); |
| 52 | | bumperpattern = new RegExp("(^|\\s)bumper(\\s|$)"); |
| 53 | | classpattern = new RegExp("(^|\\s)(one_liner|one_liner_cluster)(\\s|$)"); |
| | 66 | |
| | 67 | // define regexps |
| | 68 | spam = new RegExp("(^|\\s)(social_ad|ad_capsule|app_story)(\\s|$)"); |
| | 69 | bumper = new RegExp("(^|\\s)bumper(\\s|$)"); |
| | 70 | oneliners = new RegExp("(^|\\s)(one_liner|one_liner_cluster)(\\s|$)"); |
| | 71 | requests = new RegExp("(^|\\s)requests(\\s|$)"); |
| | 72 | sidespam = new RegExp("(^|\\s)app_\\d+_sidebar(\\s|$)"); |
| | 73 | |
| | 74 | hiddenentries = 0; |
| 55 | | if (spampattern.test(divs[i].className)) { |
| 56 | | divs[i].style.display = "none"; |
| 57 | | if (bumperpattern.test(divs[i].previousSibling.lastChild.className)) { |
| 58 | | divs[i].previousSibling.lastChild.style.display = "none"; |
| | 76 | if (hide_news_feed_spam) { |
| | 77 | if (spam.test(divs[i].className)) { |
| | 78 | divs[i].style.display = "none"; |
| | 79 | hiddenentries ++; |
| | 80 | if (bumper.test(divs[i].previousSibling.lastChild.className) && oneliners.test(divs[i].nextSibling.className)) { |
| | 81 | divs[i].previousSibling.lastChild.style.display = "none"; |
| | 82 | divs[i].nextSibling.style.padding = 0; |
| | 83 | divs[i].nextSibling.className="clearfix"; |
| | 84 | } |
| | 85 | if (show_hidden_news_feed_entries_count) { |
| | 86 | divs[i].parentNode.firstChild.firstChild.innerHTML = "News Feed (" + hiddenentries + " hidden)"; |
| | 87 | } |
| 60 | | if (classpattern.test(divs[i].nextSibling.className)) { |
| 61 | | divs[i].nextSibling.style.padding = 0; |
| 62 | | divs[i].nextSibling.className="clearfix"; |
| | 89 | } |
| | 90 | if (hide_side_bar_spam) { |
| | 91 | if (requests.test(divs[i].className)) { |
| | 92 | spans = divs[i].lastChild.childNodes; |
| | 93 | hidden = 0; |
| | 94 | keeprequests = keep_requests_when_all_hidden; |
| | 95 | for (s = 0; spans && s < spans.length; s ++) { |
| | 96 | if (!sidespam.test(spans[s].id)) { |
| | 97 | keeprequests = true; |
| | 98 | } else { |
| | 99 | spans[s].style.display = "none"; |
| | 100 | hidden++; |
| | 101 | } |
| | 102 | } |
| | 103 | if (hidden > 0 && keeprequests) { |
| | 104 | if (hidden == 1) { |
| | 105 | plural = "request"; |
| | 106 | } else { |
| | 107 | plural = "requests"; |
| | 108 | } |
| | 109 | newspan = document.createElement('span'); |
| | 110 | newspan.innerHTML = '<a class="notifications" href="/reqs.php"><strong>' + hidden + '</strong> Hidden ' + plural + '</a>'; |
| | 111 | divs[i].lastChild.appendChild(newspan); |
| | 112 | } else if (!keeprequests) { |
| | 113 | divs[i].style.display = "none"; |
| | 114 | } |