Skip to content

Instantly share code, notes, and snippets.

@abdulhannanali
Created May 30, 2015 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abdulhannanali/73e29826ea5a6b239079 to your computer and use it in GitHub Desktop.
Save abdulhannanali/73e29826ea5a6b239079 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/domeso
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
// TODO IIFE To don't pollute the global scope
// My Bot for different Ask.fm tasks performing
// Shows all answers by simulating a click event on show more
// button. Waits for a few second to simulate the next click
// event.
function showAllAnswers(){
var i = 1;
var intervalShowMore = setInterval(function(){
var showMore = $(".submit-button-more");
console.log("Showing more execution " + i + " times");
if (!showMore){
alert("No more answers to show");
clearInterval(intervalShowMore);
}
i++;
showMore.click();
}, Math.random() + 1000);
}
// Liking random answers which are not liked before
function likeRandomAnswers(){
var likeBoxes = $(".likeBox");
var delay = (Math.random() * 1000) + 3000;
// Filers only those which has not been liked before based on
// the Css property of the span in the likeBox which if set to
// display:block the element is omitted otherwise it's not
var toLikeBoxes = likeBoxes.filter(function(index){
return $("span", this).css("display") !== "block";
}, delay);
return toLikeBoxes;
}
</script>
<script id="jsbin-source-javascript" type="text/javascript">// TODO IIFE To don't pollute the global scope
// My Bot for different Ask.fm tasks performing
// Shows all answers by simulating a click event on show more
// button. Waits for a few second to simulate the next click
// event.
function showAllAnswers(){
var i = 1;
var intervalShowMore = setInterval(function(){
var showMore = $(".submit-button-more");
console.log("Showing more execution " + i + " times");
if (!showMore){
alert("No more answers to show");
clearInterval(intervalShowMore);
}
i++;
showMore.click();
}, Math.random() + 1000);
}
// Liking random answers which are not liked before
function likeRandomAnswers(){
var likeBoxes = $(".likeBox");
var delay = (Math.random() * 1000) + 3000;
// Filers only those which has not been liked before based on
// the Css property of the span in the likeBox which if set to
// display:block the element is omitted otherwise it's not
var toLikeBoxes = likeBoxes.filter(function(index){
return $("span", this).css("display") !== "block";
}, delay);
return toLikeBoxes;
}</script></body>
</html>
// TODO IIFE To don't pollute the global scope
// My Bot for different Ask.fm tasks performing
// Shows all answers by simulating a click event on show more
// button. Waits for a few second to simulate the next click
// event.
function showAllAnswers(){
var i = 1;
var intervalShowMore = setInterval(function(){
var showMore = $(".submit-button-more");
console.log("Showing more execution " + i + " times");
if (!showMore){
alert("No more answers to show");
clearInterval(intervalShowMore);
}
i++;
showMore.click();
}, Math.random() + 1000);
}
// Liking random answers which are not liked before
function likeRandomAnswers(){
var likeBoxes = $(".likeBox");
var delay = (Math.random() * 1000) + 3000;
// Filers only those which has not been liked before based on
// the Css property of the span in the likeBox which if set to
// display:block the element is omitted otherwise it's not
var toLikeBoxes = likeBoxes.filter(function(index){
return $("span", this).css("display") !== "block";
}, delay);
return toLikeBoxes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment