Last active
November 22, 2019 21:06
-
-
Save isaaclw/c5eb279c5ddc929705dc to your computer and use it in GitHub Desktop.
Javascript
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
if (typeof String.prototype.startsWith != 'function') { | |
"use strict"; | |
String.prototype.startsWith = function (str){ | |
return this.slice(0, str.length) == str; | |
}; | |
} | |
var time_wait = 0, | |
string_check = '{I want to {', | |
action = 'decline', | |
forum_url = 'forum.amanikenya.com', | |
pause_time = 10000; | |
$('[type=checkbox]').each(function () { | |
"use strict"; | |
var curelem = $(this), | |
parent_group = curelem.parent().parent().children(), | |
request_text = $(parent_group[1]).children()[2].textContent, | |
key = $($(parent_group[2]).children()[0]).attr("href").split("/").reverse()[0]; | |
var user_call = function (id, action, time, key) { | |
console.log("val = " + id + ", time_wait = " + time); | |
window.setTimeout(function () { | |
$.ajax({ | |
url: 'http://' + forum_url + '/user/' + action + '/' + id + '/' + key, | |
type: 'POST', | |
}); | |
}, time); | |
}; | |
if (request_text.startsWith(string_check)) { | |
user_call(curelem.val(), action, time_wait, key); | |
time_wait = time_wait + pause_time; | |
} | |
}); |
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
// following is needed for twitter logging | |
//var i = document.createElement('iframe'); | |
//i.style.display = 'none'; | |
//document.body.appendChild(i); | |
//window.console = i.contentWindow.console; | |
function unfollow_twitter() { | |
var items = $('div.GridTimeline-items span:contains("Following")'); | |
if (items.length > 0) { | |
var a = $(items[0]); | |
a.click(); // click, doing the ajax call and unfollowing | |
a.closest('div.ProfileCard').remove(); // hack: remove the element so it's not clicked again. Checking 'is visible' doesn't seem to work | |
console.log("clicked"); | |
setTimeout(unfollow_twitter, 1000); | |
} else { | |
console.log("done"); | |
} | |
} | |
function delete_email_owa() { | |
var items = $('button[aria-label=delete]'); | |
if (items.length > 0) { | |
var a = $(items[0]); | |
a.click(); // click, doing the ajax call and unfollowing | |
console.log("clicked"); | |
setTimeout(delete_email_owa, 1000); | |
} else { | |
console.log("done"); | |
} | |
} | |
delete_email_owa(); |
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
$('td.desktopOnly div.single-row-button').each(function () { | |
qty = parseInt($(this).children('span span.auction-browse-quantity').text()); | |
bidelem = $(this).children('span span.auction-browse-bid'); | |
buyelem = $(this).children('span span.auction-browse-buyout'); | |
if (buyelem.text().indexOf('|') < 0) { | |
buy = buyelem.text().replace(/\D/g, ''); | |
if (buy.length > 0) { | |
buy = parseInt(buy); | |
buyelem.append(' | ' + (buy / qty).toFixed(2)); | |
} | |
} | |
if (bidelem.text().indexOf('|') < 0) { | |
bid = bidelem.text().replace(/\D/g, ''); | |
if (bid.length > 0) { | |
bid = parseInt(bid); | |
bidelem.append(' | ' + (bid / qty).toFixed(2)); | |
} | |
} | |
}); | |
return false; |
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
/*globals $, setTimeout*/ | |
function menuItem(select, not, menu) { | |
"use strict"; | |
var elemset = $(select).not(not); | |
if (elemset.length > 0) { | |
console.log(elemset.length); | |
var item = $(elemset[0]); | |
$('button.closeNotification').click(); | |
item.contextmenu(); | |
setTimeout(function () { | |
console.log("click menu"); | |
$("button:contains('" + menu + "')").click(); | |
setTimeout(function () { | |
console.log("click confirm"); | |
$("button:contains('Confirm')").click(); | |
setTimeout(function () { | |
var ok = $('button:contains("OK")'); | |
if (ok.length > 0) { | |
ok.click(); | |
setTimeout(function () { | |
console.log("initiating next iteration"); | |
menuItem(select, not, menu); | |
}, 1500); | |
} else { | |
console.log("initiating next iteration"); | |
menuItem(select, not, menu); | |
} | |
}, 1500); | |
}, 500); | |
}, 500); | |
} | |
} | |
function sellItem(select, not) { | |
"use strict"; | |
menuItem(select, not, 'Sell to Vendor'); | |
} | |
function openItem(select, not) { | |
"use strict"; | |
menuItem(select, not, 'Open'); | |
} | |
/* | |
Bronze -> Junk (normal) | |
Silver -> Green | |
Gold -> Blue | |
Special -> Purple | |
- | |
Gem -> Runestone or Enchantment | |
ProgressionFood -> Mark, for upgrading items | |
Upgrade -> Gear | |
Device -> Pots, assortments | |
Junk -> either an emtpty slot, or a junk item | |
RewardPack -> some sort of box? | |
*/ | |
/* RUN THESE MANUALLY: | |
// Sell non-blue, non-purple gear | |
sellItem('.Upgrade', '.Special,.Gold'); | |
sellItem('.Junk', '.empty'); | |
openItem('.RewardPack', '.Special,.disabled,:has(img[src$="Grimoire.png"])'); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment