Skip to content
Browse files

:q

  • Loading branch information...
1 parent 0dd89fb commit f819cc50fbc83b89bbfe395c484c7484f19ffa26 Fan Yu committed Aug 7, 2012
Showing with 30 additions and 1 deletion.
  1. +30 −1 contentscript.js
View
31 contentscript.js
@@ -1,2 +1,31 @@
console.log("content script loaded");
-$("img").css("border", "5px solid orange");
+ var imges = [];
+ imges.contains = function (arr) {
+ for (var i = 0; i < this.length; i++) {
+ if (this[i] == arr)
+ return true;
+ }
+ return false;
+ }
+
+ function addborder(event) {
+ $(this).css("border", "5px solid orange");
+ }
+ function removeborder(event) {
+ if (!imges.contains(this)) {
+ $(this).css("border", "");
+ }
+ }
+ $("img").hover(addborder, removeborder);
+
+ $("img").bind("click", function (event) {
+ if (!imges.contains(this)) {
+ imges.push(this);
+ $(this).css("border", "5px solid orange");
+ }
+ else {
+ imges.splice($.inArray(this, imges), 1);
+ $(this).css("border", "");
+ }
+ });
+

0 comments on commit f819cc5

Please sign in to comment.
Something went wrong with that request. Please try again.