Created
May 30, 2015 07:32
-
-
Save abdulhannanali/73e29826ea5a6b239079 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/domeso
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
<!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> |
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
// 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