Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name LiveJournal autoexpand
- // @description Autoexpands LJ threads.
- // @include http://*livejournal.com*
- // @include https://*livejournal.com*
- // @namespace http://userscripts.org/scripts/show/112935
- // ==/UserScript==
- if (~window.location.href.indexOf('livejournal.com') && window.location.href.indexOf('__rpc_lj_times_string') === -1)
- document.addEventListener('DOMContentLoaded', function(){
- var EXPAND_CONTAINER_SELECTORS = '.b-tree-root>div>div>div>.b-leaf-footer>ul>.b-leaf-actions-expandchilds>a';
- var PLACER_SELECTOR = 'span.js-amount';
- var expandall = document.querySelectorAll(PLACER_SELECTOR)[0];
- expandall.innerHTML += '<span style="color:tomato">[Click here to expand all...]</span>';
- expandall.onclick = function (){
- var commentboxes = document.querySelectorAll(EXPAND_CONTAINER_SELECTORS);
- if (!commentboxes.length) alert('No comments to expand...');
- for (var z = commentboxes.length; z--;)
- if (~commentboxes[z].innerText.indexOf('Expand'))
- setTimeout(function(commentbox){ commentbox.click(); }(commentboxes[z]), 1000);
- }
- }, false);
Add Comment
Please, Sign In to add comment