Last active
December 19, 2015 13:09
-
-
Save ysmood/5960040 to your computer and use it in GitHub Desktop.
A tool for G+ to remove all the loaded posts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # A tool for G+ to remove all the loaded posts. | |
| # This tool may be helpful when you have loaded lots of posts, and your browser is to slow to loading any more. | |
| # You can trigger it either by press "C" or click the "Clear Posts" button. | |
| # Jul 2013 ys | |
| init = -> | |
| stream_stage = document.querySelector('.wIa') | |
| if stream_stage == null | |
| return | |
| run_btn = document.createElement('div') | |
| run_btn.innerHTML = '<div class="c-b c-b-T" title="shortcut: C">Clear Posts</div>' | |
| run_btn.style.position = 'fixed' | |
| run_btn.style.bottom = '20px' | |
| run_btn.style.left = '20px' | |
| run_btn.zIndex = '10000' | |
| run_btn.addEventListener('mouseover', -> | |
| run_btn.firstChild.className = 'c-b c-b-T c-b-C' | |
| ) | |
| run_btn.addEventListener('mouseout', -> | |
| run_btn.firstChild.className = 'c-b c-b-T' | |
| ) | |
| run_btn.addEventListener('click', run) | |
| stream_stage.appendChild(run_btn) | |
| document.addEventListener('keypress', run_by_press) | |
| clear_posts = -> | |
| all_current_posts = document.querySelectorAll('.ChZ7Rc') | |
| for e in all_current_posts | |
| e.parentElement.removeChild(e) | |
| load_posts = -> | |
| load_more_btn = document.querySelector('.Op') | |
| load_more_btn.click() | |
| run = -> | |
| clear_posts() | |
| load_posts() | |
| run_by_press = (e) -> | |
| console.log(11) | |
| if e.keyCode == 99 and | |
| not document.activeElement.isContentEditable and | |
| document.activeElement.tagName != 'INPUT' | |
| run() | |
| init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment