Skip to content

Instantly share code, notes, and snippets.

@lukaszkorecki
Created July 23, 2010 12:40
Show Gist options
  • Save lukaszkorecki/487387 to your computer and use it in GitHub Desktop.
Save lukaszkorecki/487387 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name BillMonitor Admin
// @namespace http://userscripts.org/users/useridnumber
// @include http://192.168.1.7/results*
// @include http://192.168.1.7/mobile/results*
// ==/UserScript==
var UID;
var forms = document.getElementsByTagName('form');
for (i=0; i < forms.length; i++)
{
if (forms[i].id == 'filter_form')
{
UID = forms[i].action
}
}
UID = UID.split("/")[5]
var resultDivs = document.evaluate("//div[@class='result']", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
var priceSpans = document.evaluate("//div[@class='result']/table/tbody/tr[1]/td[4]/h5", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
var familySpans = document.evaluate("//div[@class='result']/table/tbody/tr[1]/td[1]/p[2]", document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
for (i=0; i < resultDivs.snapshotLength; i++)
{
div = resultDivs.snapshotItem(i)
var planID = div.id.split("_")[1];
var p = document.createElement('span');
p.innerHTML = " <form style='display: inline' action='http://192.168.1.7:3000/engine-debug' method='POST'><input name='session_id' type='hidden' value='"+UID+"'/><input type='hidden' name='plan_id' value='"+planID+"'/><input style='font-size: 10px' type='submit' value='DEBUG'/></form>"
priceSpans.snapshotItem(i).appendChild(p)
var p = document.createElement('span');
p.innerHTML = " - <a href=http://192.168.1.7:3000/plan?plan_id="+planID+">info</a>"
familySpans.snapshotItem(i).appendChild(p)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment