This repository has been archived by the owner on Jul 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.js
70 lines (65 loc) · 1.89 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
run = false;
var i = 0;
var images = [
'http://assets2.vice.com/images/articles/crops/2013/03/09/lil-bub-friendz-premieres-at-tribeca-1413323823460-crop_mobile_400.jpeg',
'http://i.ytimg.com/vi/p2H5YVfZVFw/hqdefault.jpg',
'http://dougleschan.com/the-recruitment-guru/wp-content/uploads/2014/07/spangles-the-crossed-eyed-cat-funny-photos1.jpg.pagespeed.ce_.nzeCTfywzf.jpg',
'http://images4.fanpop.com/image/photos/15200000/crazy-cats-LOL-cats-15202665-468-373.jpg',
'http://www.funnypica.com/wp-content/uploads/2013/01/Funny-Cats-05.jpg',
'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTvk3tnwO5Skb6YapKsIua0OsFJY2bWsFkiPdEMTROEKufeMsue',
'http://wondrouspics.com/wp-content/uploads/2013/02/Funny-Cats-1.jpg',
'http://petsbunch.com/wp-content/uploads/2013/12/more-funny-cat-pictures-54.jpg',
'http://www.funnypica.com/wp-content/uploads/2012/11/Funny-Cats-Big-Eyed-Cat.jpg',
'https://lh3.googleusercontent.com/-leY-3ckDs6M/AAAAAAAAAAI/AAAAAAAAAE4/KcQIvsD4FBE/photo.jpg'
]
var funHover1 = function(img){
console.log(run);
if(run){
$(img).height($(img).height() * 1.02);
$(img).width($(img).width() * 1.02);
$(img).css('border', 'solid 1px #59ACFF');
}
}
var funHover2 = function(img){
if(run){
$(img).height($(img).height() / 1.02);1
$(img).width($(img).width() / 1.02);
$(img).css('border', '0px');
}
}
function funClick(img) {
if(run){
event.preventDefault();
var oldImage = img;
oldImage.src = images[i++];
if (i >= 10) i = 0;
}
}
$(document).ready(function(){
$('img').hover(
function(){
funHover1(this);
},
function() {
funHover2(this);
}
);
$('img').click(
function(){
funClick(this);
}
);
});
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.text == "1") {
sendResponse({type: "1"});
console.log('on');
run = true;
}
else {
sendResponse({type: "0"});
console.log('off');
run = false;
}
});