Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fan Yu
committed
Aug 7, 2012
1 parent
0dd89fb
commit f819cc5
Showing
1 changed file
with
30 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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", ""); | |||
} | |||
}); | |||
|