Last active
December 4, 2017 13:11
-
-
Save Gummibeer/4b6bba72b822566253cf1f7f3a81a462 to your computer and use it in GitHub Desktop.
This script plants trees by botting Ecosia search
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
Array.prototype.random = function() { | |
return this[Math.floor(Math.random() * this.length)]; | |
}; | |
var properties = [ | |
'car', | |
'house', | |
'phone', | |
'money' | |
]; | |
var products = [ | |
'smartphone', | |
'computer', | |
'laptop', | |
'car', | |
'house', | |
'gaming console', | |
'bicycle', | |
'motorcycle' | |
]; | |
var activities = [ | |
'bike', | |
'swimm', | |
'cook', | |
'drive', | |
'dive', | |
'chill', | |
'party' | |
]; | |
var templates = [ | |
'where is my %property', | |
'how much costs a %product', | |
'best place to %activity' | |
]; | |
function generate(){ | |
return templates | |
.random() | |
.replace('%property', properties.random()) | |
.replace('%product', products.random()) | |
.replace('%activity', activities.random()); | |
} | |
setTimeout(function() { | |
document.getElementsByClassName('search-form-input')[0].value = generate(); | |
document.getElementsByClassName('search-form')[0].submit(); | |
}, 30 * 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment