Skip to content

Commit

Permalink
:q
Browse files Browse the repository at this point in the history
  • Loading branch information
Fan Yu committed Aug 7, 2012
1 parent 0dd89fb commit f819cc5
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion contentscript.js
@@ -1,2 +1,31 @@
console.log("content script loaded"); 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.