Skip to content

Commit

Permalink
Merge branch 'master' of github.com:yfann/ImgCollector
Browse files Browse the repository at this point in the history
Conflicts:
	contentscript.js
  • Loading branch information
Fan Yu committed Aug 8, 2012
2 parents ddc895c + f819cc5 commit 7f8d6f5
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions contentscript.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
console.log("content script loaded");
//$("img").css("border", "5px solid orange");
function addborder(event) {
$(this).css("border", "5px solid orange");
}
function removeborder(event) {
$(this).css("border", "");
}
$("img").hover(addborder, removeborder);
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 7f8d6f5

Please sign in to comment.