Skip to content

Instantly share code, notes, and snippets.

@ljepson
Created December 14, 2012 06:09
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 ljepson/4283066 to your computer and use it in GitHub Desktop.
Save ljepson/4283066 to your computer and use it in GitHub Desktop.
Automatically do the amount of searches necessary to get the maximum number of daily credits from bing.com.
var bing = {
credits: 0,
current_status: function() {
var current_credits = bing.credits;
jQuery.ajax({url: '/rewards/dashboard', success: function(d) {
var credits = jQuery(d).find('.title:contains("Search Bing")').closest('a').find('.progress').text();
if(!credits.match(/.*of.*/)) bing.settings['stop'] = true;
bing.credits = Number(credits.replace(/(\d+).*/,'$1'));
bing.total = Number(jQuery(d).find('.user-balance .data-value-text:first').text());
}, complete: function() {
if(!bing.settings.started && !bing.settings.stop) {
console.log('This session is starting with '+ bing.credits + (bing.credits === 1 ? ' credit' : ' credits') + ' earned today.');
bing.settings.started = true;
} else if(!bing.settings.stop) {
var credits = bing.credits - current_credits;
console.log('You have received '+ credits + (credits === 1 ? ' new credit.' : ' new credits.'));
console.log('Current total: ' + bing.total);
} else {
console.log('You have reached the maximum number of credits allowed by Microsoft today. Start again tomorrow. Total credits balance: '+ bing.total);
}
}});
},
farm: function() {
var random1 = Math.round(Math.random() * bing.settings.words.length);
var random2 = Math.round(Math.random() * bing.settings.words.length);
var selected = bing.settings.search + bing.settings.words[random1] +'+'+ bing.settings.words[random2];
jQuery('body').append('<iframe id="jiskiras" src="'+ selected +'" style="display:none;">');
jQuery('#jiskiras').one('load',function() {
jQuery(this).remove();
bing.ready();
});
},
init: function() {
if(typeof jQuery === 'undefined') {
var script = document.createElement('script');
script.src = '//ajax.googleapis.com/ajax/libs/jquery/'+ bing.settings.jquery_version +'/jquery.min.js';
script.onload = script.onreadystatechange = function() {
if(!bing.settings.loaded && (!this.readyState || this.readyState === 'loaded' || this.readyState === 'complete')) {
bing.settings.loaded = true;
bing.ready();
}
};
document.getElementsByTagName('head')[0].appendChild(script);
}
},
ready: function() {
var timer = (bing.settings.delay + Math.round(Math.random() * 10)) * 1000;
bing.current_status();
var interval = setInterval(function() {
if(typeof bing.settings.started !== 'undefined' && !bing.settings.stop) {
setTimeout(bing.farm,timer);
clearInterval(interval);
}
},300);
},
result: '',
settings: {
delay: 4,
jquery_version: '1.8.3',
loaded: false,
words: ['windows','mac','chrome','jquery','obama','facebook','info','help','plugins','create','different','America',
'between','important','children','without','mountain','banging','bathtub','blasted','blended','bobsled',
'camping','chipmunk','contest','crashing','dentist','disrupt','disrupted','drinking','expanded','finishing',
'himself','insisted','insisting','insulted','invented','jumping','lending','pinball','planted','plastic',
'problem','publishing','punishing','ringing','shifted','shrinking','sinking','splashing','squinted','standing',
'sunfish','swishing','talented','trusted','twisted','whiplash','nothing','caterpillar','complain','fishing',
'forever','granddad','grinned','perfect','Sanchez','sunburn','swimmer','umbrella','whisper','afternoon',
'applaud','ballplayer','basketball','begging','birthday','brainstorm','broiler','cheerful','collect','daylight',
'delight','doghouse','evergreen','everything','explore','faithful','flashlight','grasshopper','gumball','harmful',
'helpful','herself','highway','hopscotch','houseboat','hummingbird','jellyfish','kickball','kingfish','kneecap',
'knockout','lighthouse','lipstick','lunchbox','oatmeal','painful','popcorn','pretzel','quicksand','restful',
'sailboat','sandbox','Saturday','scratch','shipwreck','splendid','splotch','stiffer','stretch','sunblock',
'swimming','teacher','thankful','thinner','thinnest','Thursday','topcoat','traffic','treetop','trumpet','tugboat',
'visitor','weekend','wettest','whenever'],
search: '/search?q=',
started: false
},
total: 0
}; bing.init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment