Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Signed-off-by: patlockley <patrick.lockley@googlemail.com>

  • Loading branch information...
commit f2497c2d614c29ae1c5942247ef27cff994db760 1 parent 6ee366d
@pgogy authored
View
BIN  chrome.xpi
Binary file not shown
View
8 content/browser.css
@@ -1,3 +1,7 @@
-#OA-Web-Button {
+#OpenAttributeLink {
list-style-image: url("chrome://openattribute_link/content/label.png");
-}
+}
+
+#OpenAttributeLinkCustom {
+ list-style-image: url("chrome://openattribute_link/content/customlabel.png");
+}
View
138 content/browser.js
@@ -1,83 +1,83 @@
-function contains(a, obj) {
- for (var i = 0; i < a.length; i++) {
- if (a[i] === obj) {
- return true;
- }
- }
- return false;
-}
+var open_attribute_link = new Object;
+open_attribute_link.document_node = "";
+open_attribute_link.urls_checked = new Array();
-function check_url(url,node_to_change){
+var page_process = new function page_process() {
- var xmlHttpRequest = new XMLHttpRequest();
+ this.contains = function(a, obj) {
+ for (var i = 0; i < a.length; i++) {
+ if (a[i] === obj) {
+ return true;
+ }
+ }
+ return false;
+ }
- xmlHttpRequest.open("GET",url, true);
- xmlHttpRequest.onreadystatechange=function(){
-
- if (xmlHttpRequest.readyState==4){
-
- var myregexp_fat = new RegExp('rel="license" href="http://creativecommons.org/licenses/',"i");
- var myregexp_thin = new RegExp("Creative Commons","i");
-
- if(node_to_change.innerHTML.indexOf("(&copy;")==-1){
-
- if(xmlHttpRequest.responseText.match(myregexp_fat)){
+ this.check_url = function(url,node_to_change){
+
+ var xmlHttpRequest = new XMLHttpRequest();
+
+ xmlHttpRequest.open("GET",url, true);
+ xmlHttpRequest.onreadystatechange=function(){
+
+ if (xmlHttpRequest.readyState==4){
+
+ var myregexp_fat = new RegExp('rel="license" href="http://creativecommons.org/licenses/',"i");
+ var myregexp_thin = new RegExp("Creative Commons","i");
+
+ if(node_to_change.innerHTML.indexOf("(&copy;")==-1){
+
+ if(xmlHttpRequest.responseText.match(myregexp_fat)){
+
+ node_to_change.style.color="#00FF00";
+ if(node_to_change.innerHTML.indexOf("<img")==-1){
+
+ node_to_change.innerHTML += " (&copy; &#10003;)";
+
+ }else{
+
+ node_to_change.style.border = "2px solid #00ff00";
+
+ }
- node_to_change.style.color="#00FF00";
- if(node_to_change.innerHTML.indexOf("<img")==-1){
-
- node_to_change.innerHTML += " (&copy; &#10003;)";
-
- }else{
-
- node_to_change.style.border = "2px solid #00ff00";
-
- }
+ }else if(xmlHttpRequest.responseText.match(myregexp_thin)){
+
+ node_to_change.style.color="#AAAA66";
+
+ if(node_to_change.innerHTML.indexOf("<img")==-1){
+
+ node_to_change.innerHTML += " (&copy; ?)";
- }else if(xmlHttpRequest.responseText.match(myregexp_thin)){
-
- node_to_change.style.color="#AAAA66";
-
- if(node_to_change.innerHTML.indexOf("<img")==-1){
-
- node_to_change.innerHTML += " (&copy; ?)";
+ }else{
+
+ node_to_change.style.border = "2px solid #00ff00";
+
+ }
- }else{
-
- node_to_change.style.border = "2px solid #00ff00";
-
- }
-
- }else{
-
- if(node_to_change.innerHTML.indexOf("<img")==-1){
-
- node_to_change.innerHTML += " (&copy;)";
+ }else{
+
+ if(node_to_change.innerHTML.indexOf("<img")==-1){
+
+ node_to_change.innerHTML += " (&copy;)";
+
+ }else{
+
+ node_to_change.style.border = "2px solid #00ff00";
+
+ }
- }else{
-
- node_to_change.style.border = "2px solid #00ff00";
+ }
}
-
+
}
- }
-
- }
-
-
- };
- xmlHttpRequest.send();
-
-}
-
-var open_attribute_link = new Object;
-open_attribute_link.document_node = "";
-open_attribute_link.urls_checked = new Array();
+ };
+
+ xmlHttpRequest.send();
-var page_process = new function page_process() {
+ }
this.init = function (content_passed) {
@@ -95,9 +95,9 @@ var page_process = new function page_process() {
if(n.href.indexOf("google")==-1){
- if(!contains(open_attribute_link.urls_checked,n.href)){
+ if(!this.contains(open_attribute_link.urls_checked,n.href)){
- check_url(n.href,n);
+ this.check_url(n.href,n);
open_attribute_link.urls_checked.push(n.href);
}
View
14 content/browser.xul
@@ -9,16 +9,22 @@
<script type="text/javascript"
src="chrome://openattribute_link/content/browser.js"></script>
- <toolbox id="navigator-toolbox">
+ <toolbox id="navigator-toolbox">
+ <toolbarpalette id="BrowserToolbarPalette">
+ <toolbarbutton id="OpenAttributeLinkCustom"
+ label="OpenAttribute"
+ oncommand="page_process.init(content.document);"
+ tooltiptext="Open Attribute Link Check"/>
+ </toolbarpalette>
- <toolbar id="OA-Toolbar" toolbarname="OA Toolbar" class="chromeclass-toolbar" context="toolbar-context-menu" hidden="false" persist="hidden">
+ <toolbar id="OpenAttribute-Toolbar" toolbarname="Open Attribute Link Toolbar" class="chromeclass-toolbar" context="toolbar-context-menu" hidden="false" persist="hidden">
- <toolbarbutton id="OA-Web-Button" tooltiptext="Open Attribute"
+ <toolbarbutton id="OpenAttributeLink" tooltiptext="Open Attribute"
oncommand="page_process.init(content.document);" />
</toolbar>
-
+
</toolbox>
</overlay>
View
BIN  content/customlabel.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
3  install.rdf
@@ -5,9 +5,10 @@
<Description about="urn:mozilla:install-manifest">
<em:id>pat@openattribute.com</em:id>
<em:name>Openattribute link</em:name>
- <em:version>0.2</em:version>
+ <em:version>0.4</em:version>
<em:type>2</em:type>
<em:creator>Open Attribute</em:creator>
+ <em:creator>Pgogy</em:creator>
<em:description>Searches links for licenced content</em:description>
<em:homepageURL>http://openattribute.com/</em:homepageURL>
<em:targetApplication>
View
BIN  oalink.xpi
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.