-
Notifications
You must be signed in to change notification settings - Fork 9
/
style_facebook.js
158 lines (124 loc) · 3.67 KB
/
style_facebook.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
let fetch_on_focus_mode = true;
let minimal_mode = false;
setInterval(function () {
updateBackgroundSettings();
}, 1000);
///////////////////
//// Features ////
/////////////////
function fetchFocusBG() {
let quote = "Be yourself; everyone else is already taken.";
$(function () {
var baseUrl = "https://talaikis.com/api/quotes/random/";
$.ajax({
url: baseUrl,
type: "GET",
dataType: "json",
success: function (res) {
quote = res.quote;
author = res.author;
$("body").css("overflow", "hidden");
$("#contentArea").css("z-index", "200");
$("#bottomContent").html(
"\
<table > <tr><td></td>\
<td rowspan=2><img src='https://source.unsplash.com/random/" +
screen.width + "x" + screen.height +
"/?nature,night' \
style='margin-top:-180px;margin-left:-350px;z-index:-1;\
'></td> \
</tr > \
<tr>\
<td colspan=2 > <p style='margin-top:-400px;font-size:36px; \
font-weight:900;text-transform:uppercase;color:white ; \
line-height:55px;margin-left:-200px;max-width:800px;\
word-wrap:break-word;'>" +
quote +
"</p></td>\
</tr> \
</table > "
);
}
});
});
}
function removeLeftSideBar() {
$(".uiFutureSideNav").css("display", "none");
}
function removeRightSideBar() {
$(".home_right_column").css("display", "none");
}
function removeNotificationTray() {
$("._2t-f").css("display", "none");
}
function showNotificationTray(){
$("._2t-f").css("display", "inline");
}
function removeTimeline() {
$("._5pcb._dp7._4j3f").css("display", "none");
}
function showTimeline(){
$("._5pcb._dp7._4j3f").css("display", "inline");
}
function UIImprovements(){
//Remove Footer
$("._64b").css("display", "none");
}
/////////////////////////////
// Extensions main part xD //
//////////////////////////////
function updateBackgroundSettings() {
if ($("body").hasClass("UIPage_LoggedOut")) return;
chrome.extension.sendMessage({ method: "get_vars" }, function (response) {
/////////////////
// Focus Mode //
///////////////
chrome.storage.local.get(/* String or Array */["onoffswitch"], function (
items
) {
if (items.onoffswitch === "true") {
UIImprovements();
removeTimeline();
removeNotificationTray();
removeRightSideBar();
removeLeftSideBar();
if (fetch_on_focus_mode === true) {
// To ensure that request only goes once
// This fucntion returns quote and new background image
fetchFocusBG();
fetch_on_focus_mode = false;
}
} else if (items.onoffswitch === "false") {
showNotificationTray();
showTimeline();
if (fetch_on_focus_mode === false) {
location.reload();
fetch_on_focus_mode = true;
}
}
});
/////////////////
//Minimal mode //
///////////////////
chrome.storage.local.get(/* String or Array */["statusicon"], function (
items
) {
if (items.statusicon === "true") {
UIImprovements();
removeRightSideBar();
removeLeftSideBar();
minimal_mode = false;
updateBackgroundSettings();
}
else if (items.statusicon === "false") {
//when its not minimal mode (didnt decide what to do here )
// at the moment it is just realoading the website
if (minimal_mode === true) {
location.reload();
minimal_mode = false;
}
}
});
});
}
updateBackgroundSettings();