-
Notifications
You must be signed in to change notification settings - Fork 0
/
Selector.js
65 lines (46 loc) · 1.57 KB
/
Selector.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
if($("body").attr("hooked")=="false")
{ chrome.runtime.sendMessage({switcher: "ony"}, function(response) {});
hookedfalse();
$("body").attr("hooked","true")
}
else{
chrome.runtime.sendMessage({switcher: "offy"}, function(response) {});
hookedtrue();
$("body").attr("hooked","false")
}
function hookedfalse(){
$("#items").find("ytd-compact-video-renderer").each(function(){
if($(this).parent().attr("class")!="hooked")
{
$(this).css({"pointer-events" : "none"});
$(this).wrap("<div class='hooked' ></div>");
$(this).parent().css({ "border": "6px solid #C8E6C9"}).hover(function(){
$(this).css({"border": "12px solid #66BB6A"});
},function(){
$(this).css({"border": "6px solid #C8E6C9"});
});
$(this).parent().click(function(e){
var node=this;
chrome.storage.local.get('max',function(value){
if(value.max==undefined){
var key="a"+0;
chrome.storage.local.set({ ["a"+0]: $(node).find("#byline").text() });
chrome.storage.local.set({ 'max': 1 });
}
else{
var key="a"+value.max;
chrome.storage.local.set({ ["a"+value.max]: $(node).find("#byline").text() });
chrome.storage.local.set({ 'max': value.max+1 });
}});
this.parentNode.removeChild(this);});}
});
}
function hookedtrue(){
$("#items").find("ytd-compact-video-renderer").each(function(){
if($(this).parent().attr("class")=="hooked")
{ $(this).css({"pointer-events" : "auto"});
$(this).unwrap();
i=0;
}
});
}