diff --git a/chrome.manifest b/chrome.manifest
index 9a3d1a2..73fadee 100644
--- a/chrome.manifest
+++ b/chrome.manifest
@@ -1,2 +1,3 @@
content siteannotator chrome/content/
+skin siteannotator classic/1.0 chrome/skin/
overlay chrome://browser/content/browser.xul chrome://siteannotator/content/siteannotator.xul
diff --git a/chrome/content/siteannotator.xul b/chrome/content/siteannotator.xul
index d7999ac..934112b 100644
--- a/chrome/content/siteannotator.xul
+++ b/chrome/content/siteannotator.xul
@@ -3,15 +3,19 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
+
+
+
+
-
-
-
+
+
+
diff --git a/chrome/content/validator.js b/chrome/content/validator.js
index f2e632a..70b2201 100644
--- a/chrome/content/validator.js
+++ b/chrome/content/validator.js
@@ -1,4 +1,4 @@
-var validator_URLlistener = {
+var validator_URLlistener = { // listens to changes in URL
QueryInterface: function(aIID)
{
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
@@ -11,7 +11,6 @@ var validator_URLlistener = {
{
validator.validate(aURI);
},
-
onStateChange: function() {},
onProgressChange: function() {},
onStatusChange: function() {},
@@ -22,85 +21,83 @@ var validator_URLlistener = {
var validator = {
curr_page_URL: null,
URL: "http://projectpossibility.org/projects/handicapannotate/dev/request.php",
+ //"http://169.232.161.6/dev/request.php",
init: function() {
// Listen for webpage loads
gBrowser.addProgressListener(validator_URLlistener,
Components.interfaces.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
- //var appcontent = document.getElementById("appcontent"); // browser
- //appcontent.addEventListener("DOMContentLoaded", function() { validator.onPageLoad(); }, false);
},
uninit: function() {
gBrowser.removeProgressListener(validator_URLlistener);
},
-// onLoad: function(e) { // initialization code
-// this.initialized = true; //do something with this later
-// //this.strings = document.getElementById("handicapannotator-strings");
-// },
- display_cb: function(responsetxt) {
- alert("display_cb got " + responsetxt);
- var panel = document.getElementById("siteannotate-panel");
- //panel.setAttribute("label", "Accessibility errors: " + responsetxt);
- panel.setAttribute("label", "bobobobAccessibility errors: " + responsetxt);
+ display_cb: function(responsetxt) { // callback to display to status bar
+ //alert("display_cb got " + responsetxt);
+ var panel = document.getElementById("siteannotator-panel");
+ var image = document.createElement("image");
+ image.setAttribute("width", "80");
+ image.setAttribute("height", "16");
+ if (responsetxt < 0) {
+ panel.setAttribute("label", "Unvalidated");
+ return;
+ }
+ else if (responsetxt <= 10)
+ image.setAttribute("src", "chrome://siteannotator/skin/img/star_16_5.png");
+ else if (responsetxt <= 25)
+ image.setAttribute("src", "chrome://siteannotator/skin/img/star_16_4.png");
+ else if (responsetxt <= 60)
+ image.setAttribute("src", "chrome://siteannotator/skin/img/star_16_3.png");
+ else if (responsetxt <= 200)
+ image.setAttribute("src", "chrome://siteannotator/skin/img/star_16_2.png");
+ else
+ image.setAttribute("src", "chrome://siteannotator/skin/img/star_16_1.png");
+ if (panel.hasChildNodes() ) {
+ while (panel.childNodes.length >= 1 )
+ panel.removeChild(panel.firstChild );
+ }
+ panel.removeAttribute("label");
+ panel.appendChild(image);
},
+
validate: function(aURI) {
if (aURI.spec == this.curr_page_URL //page did not change. don't re-validate
|| aURI.spec == "" //e.g. opened/switched to a new tab/window
|| ((aURI.spec.search(/http:\/\//) == -1)
- && (aURI.spec.search(/https:\/\//) == -1)))
+ && (aURI.spec.search(/https:\/\//) == -1))) {
return;
+ }
else {
var pos = aURI.spec.search(/\?/);
- if (pos > 0)
- this.curr_page_URL = aURI.spec.substr(0, pos);
- else
- this.curr_page_URL = aURI.spec;
+ this.curr_page_URL = pos > 0 ? aURI.spec.substr(0, pos) : aURI.spec;
+ var panel = document.getElementById("siteannotator-panel");
+ if (panel.hasChildNodes() ) {
+ while (panel.childNodes.length >= 1 ) panel.removeChild(panel.firstChild );
+ }
+ panel.setAttribute("label", "Unvalidated");
}
var xmlHttp = new XMLHttpRequest();
if (xmlHttp == null) {
- alert ("Your browser does not support AJAX!");
+ alert("Your browser does not support AJAX!");
return;
}
- alert("curr_page_URL == " + this.curr_page_URL);
- var curr;
-// if (doc) {
-// alert("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
-// curr = doc.location;
-// alert("aaa: "+curr);
-// }
-// else {
-// alert("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz");
-// curr = window.top.content.document.location;
-// alert("zzz: "+curr);
-// }
- curr = this.curr_page_URL;
- var param = "?url=" + curr + "&sid=" + Math.random();
+ //alert("curr_page_URL == " + this.curr_page_URL);
+ var param = "?url=" + this.curr_page_URL + "&sid=" + Math.random();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
- alert("status is 200");
+ //alert("status is 200");
validator.display_cb(xmlHttp.responseText);
- alert("status was 200");
}
else
- alert("2statechanged: " + xmlHttp.status);
+ alert("statechanged error status: " + xmlHttp.status);
}
};
- alert("about to open(" + this.URL + param + ")");
+ //alert("about to open(" + this.URL + param + ")");
xmlHttp.open("GET", this.URL + param, true);
xmlHttp.send(null);
- alert("2345");
},
-// onPageLoad: function(aEvent) {
-// alert("onpageload triggered");
-// var doc = aEvent.originalTarget; // doc is document that triggered "onload" event
-// alert(doc);
-// alert(doc.id);
-// validator.validate(doc);
-// },
};
-//window.addEventListener("load", function(e) { validator.onLoad(e); }, false);
window.addEventListener("load", function(e) { validator.init(e); }, false);
window.addEventListener("unload", function(e) { validator.uninit(e); }, false);
diff --git a/chrome/skin/img/check.png b/chrome/skin/img/check.png
new file mode 100644
index 0000000..309c8c7
Binary files /dev/null and b/chrome/skin/img/check.png differ
diff --git a/chrome/skin/img/cross.png b/chrome/skin/img/cross.png
new file mode 100644
index 0000000..d7f98c4
Binary files /dev/null and b/chrome/skin/img/cross.png differ
diff --git a/chrome/skin/img/star_16.png b/chrome/skin/img/star_16.png
new file mode 100644
index 0000000..14fef9e
Binary files /dev/null and b/chrome/skin/img/star_16.png differ
diff --git a/chrome/skin/img/star_16_0.png b/chrome/skin/img/star_16_0.png
new file mode 100644
index 0000000..5c5932e
Binary files /dev/null and b/chrome/skin/img/star_16_0.png differ
diff --git a/chrome/skin/img/star_16_1.png b/chrome/skin/img/star_16_1.png
new file mode 100644
index 0000000..ace0b32
Binary files /dev/null and b/chrome/skin/img/star_16_1.png differ
diff --git a/chrome/skin/img/star_16_2.png b/chrome/skin/img/star_16_2.png
new file mode 100644
index 0000000..23335f0
Binary files /dev/null and b/chrome/skin/img/star_16_2.png differ
diff --git a/chrome/skin/img/star_16_3.png b/chrome/skin/img/star_16_3.png
new file mode 100644
index 0000000..8137c3c
Binary files /dev/null and b/chrome/skin/img/star_16_3.png differ
diff --git a/chrome/skin/img/star_16_4.png b/chrome/skin/img/star_16_4.png
new file mode 100644
index 0000000..1368ccf
Binary files /dev/null and b/chrome/skin/img/star_16_4.png differ
diff --git a/chrome/skin/img/star_16_5.png b/chrome/skin/img/star_16_5.png
new file mode 100644
index 0000000..b2a3ac3
Binary files /dev/null and b/chrome/skin/img/star_16_5.png differ