Last active
November 28, 2021 11:01
-
-
Save azman0101/bbd53a76849947dc3a074a75475ed280 to your computer and use it in GitHub Desktop.
A Greasemonkey/Tampermonkey script that expand all comment on Anaxago. Ease the text search within comments.
This file contains 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
// ==UserScript== | |
// @name Anaxago: expand, expand, expand | |
// @namespace http://azman0101.github.io/anaxago | |
// @version 0.6 | |
// @description Expand Anaxago comments pages to see all text. | |
// @author azman0101 | |
// @license MIT | |
// @match https://www.anaxago.com/* | |
// @grant none | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
console.log('Installing "Expand, expand"'); | |
// jQuery(document).ajaxStop(function () { | |
// console.log( "ready!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ); | |
// expandExpand(); | |
//}); | |
var checkExist = setInterval(function() { | |
if ($('.js-more-text').filter(function(index) { return jQuery(this).text() === "Lire plus"; }).length) { | |
console.log(".js-more-text Exists!"); | |
clearInterval(checkExist); | |
expandExpand(); | |
} | |
}, 100); // check every 100ms | |
function expandExpand() { | |
var loadMore = jQuery('.js-more-text').filter(function(index) { return jQuery(this).text() === "Lire plus"; }); | |
console.log("expand Lire plus triggered"); | |
if (loadMore.length !== 0) { | |
console.log('Clicking all these "Load more": ' + loadMore.length); | |
loadMore.click(); | |
setTimeout(expandExpand, 500); | |
return; | |
} | |
var loadMoreR = jQuery('.ax-chat__charger.js-chat-charger').filter(function(index) { return jQuery(this).text().trim() === "Voir toutes les réponses"; }); | |
console.log("expand Voir toutes les réponses triggered"); | |
if (loadMoreR.length !== 0) { | |
console.log('"Load more... " are loading: ' + loadMoreR.length); | |
loadMoreR.click(); | |
setTimeout(expandExpand, 500); | |
return; | |
} | |
console.log('I don\'t see any "Lire plus" nor "Voir toutes les réponses"'); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment