Recent posts by Jasper de Vries
|
Mar 13, 2007
|
Topic: Ideas and script requests / Tab key moves to text input fields only? You can accidentally focus hidden fields this way. I think it's better to check for inputs of type text. XPath will do the job just fine:
See also xpathExec |
|
Feb 28, 2007
|
Topic: Script development / search through text? match documentation can be found at developer.mozilla.org: http://developer.mozilla.org/en/docs/Core_JavaS... Greasemonkey scripts can't read local files but they can create HTML that links to a local file. |
|
Feb 28, 2007
|
Topic: Script development / search through text? I agree that a preview function would be useful. Is there a way to contribute to this site? |
|
Feb 27, 2007
|
Topic: Script development / Standard Function Library xpathExec
function xpathExec(xpath, func) {
var result = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < result.snapshotLength; i++) {
if (result.snapshotLength == 1) return func(result.snapshotItem(i), arguments[2], arguments[3]);
else func(result.snapshotItem(i), arguments[2], arguments[3]);
}
}
// example
xpathExec("//td[@class='ebcPpl']", replaceInItem, "PayPal", "PP");
|
|
Feb 27, 2007
|
Topic: Script development / Adding up an array Or even shorter:
var totalgold = 0, tds = document.getElementByTagName("td");
for (var i = 40; i <= 160; i += 5) {
totalgold += parseInt(tds[i].textContent.replace(/[^0-9]/ig, ""), 10);
}
alert(totalgold);
|
