Skip to content

Commit

Permalink
Tests and changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Barry Carter committed Aug 20, 2010
1 parent 321db6c commit cebc7da
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
5 changes: 4 additions & 1 deletion TEST/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ sel = sel.snapshotItem(0);

GM_log(sel);

sel.onchange = function(){alert("foo");}
/// sel.onchange = function(){alert("foo");}

sel.addEventListener("change", function(){alert("foo");}, false);



7 changes: 6 additions & 1 deletion TEST/test.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@

// generic test greasemonkey script

GM_log("Script called!");

sel = document.evaluate('//select',
document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
sel = sel.snapshotItem(0);

GM_log(sel);

sel.onchange = function(){alert("foo");}
/// sel.onchange = function(){alert("foo");}

sel.addEventListener("change", function(){alert("foo");}, false);



18 changes: 5 additions & 13 deletions bc-log-die-rolls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @namespace http://conquerclub.barrycarter.info/
// @description Logs all conquerclub.com die rolls to central server
// intentionally not putting http below, I want to match files too
// @include *conquerclub*
// @include *
// ==/UserScript==

// HACK: currently, conquerclub doesn't tell you if someone attacks
Expand All @@ -14,24 +14,14 @@
// TODO: how does auto-assault behave?
// only invoke this script when someone hits 'assault'

function alrt2() {alert('whee');}
function alrt(x) {alert(x);}

// test
sel = document.evaluate('//select',
document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
sel = sel.snapshotItem(0);

GM_log(sel);

sel.onchange = function(){alert("foo");}
GM_log("script called");

// find the button
button = document.evaluate('//input[@type="submit"][@value="Assault"]',
document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);

// and link it to function
// button.snapshotItem(0).addEventListener("click", function() {alert("whee");})
button.snapshotItem(0).addEventListener("click", logroll, false);

// TODO: production include is: http://www.conquerclub.com/game.php?game=*

Expand All @@ -43,6 +33,8 @@ button = document.evaluate('//input[@type="submit"][@value="Assault"]',

function logroll() {

GM_log("logroll called");

// TODO: change this URL
var url = "http://ns1.conquerdata.barrycarter.info/rec.php?v=1";

Expand Down
18 changes: 5 additions & 13 deletions bc-log-die-rolls.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// @namespace http://conquerclub.barrycarter.info/
// @description Logs all conquerclub.com die rolls to central server
// intentionally not putting http below, I want to match files too
// @include *conquerclub*
// @include *
// ==/UserScript==

// HACK: currently, conquerclub doesn't tell you if someone attacks
Expand All @@ -14,24 +14,14 @@
// TODO: how does auto-assault behave?
// only invoke this script when someone hits 'assault'

function alrt2() {alert('whee');}
function alrt(x) {alert(x);}

// test
sel = document.evaluate('//select',
document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
sel = sel.snapshotItem(0);

GM_log(sel);

sel.onchange = function(){alert("foo");}
GM_log("script called");

// find the button
button = document.evaluate('//input[@type="submit"][@value="Assault"]',
document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);

// and link it to function
// button.snapshotItem(0).addEventListener("click", function() {alert("whee");})
button.snapshotItem(0).addEventListener("click", logroll, false);

// TODO: production include is: http://www.conquerclub.com/game.php?game=*

Expand All @@ -43,6 +33,8 @@ button = document.evaluate('//input[@type="submit"][@value="Assault"]',

function logroll() {

GM_log("logroll called");

// TODO: change this URL
var url = "http://ns1.conquerdata.barrycarter.info/rec.php?v=1";

Expand Down

0 comments on commit cebc7da

Please sign in to comment.