Skip to content

Commit 49618d9

Browse files
committed
make unsplash image fit the screen size
1 parent 27769fd commit 49618d9

File tree

2 files changed

+38
-52
lines changed

2 files changed

+38
-52
lines changed

manifest.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Pelican Facebook",
3-
"version": "1.0.1",
3+
"version": "1.4.0",
44
"manifest_version": 2,
55
"description": "Minimal and Focused versison of Facebook!",
66
"icons": {
@@ -10,10 +10,7 @@
1010
},
1111
"permissions": [
1212
"tabs",
13-
"http://*.google.com/*",
14-
"storage",
15-
"unlimitedStorage",
16-
"contextMenus"
13+
"storage"
1714
],
1815
"background": {
1916
"scripts": [
@@ -38,6 +35,5 @@
3835
"js/on-off-switch-onload.js"
3936
]
4037
}
41-
],
42-
"content_security_policy": "script-src 'self' https://www.google.com https://checkout.google.com; object-src 'self'"
38+
]
4339
}

style_facebook.js

Lines changed: 35 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@ let a = 1;
22
let k = 1;
33

44
var userData = [];
5-
setInterval(function () {
5+
setInterval(function() {
66
updateBackgroundSettings();
77
}, 1000);
88

9-
10-
window.onresize = function () {
9+
window.onresize = function() {
1110
autoWidth();
1211
};
1312
autoWidth();
@@ -17,81 +16,79 @@ function autoWidth() {
1716
}
1817
}
1918

20-
2119
function updateBackgroundSettings() {
2220
if ($("body").hasClass("UIPage_LoggedOut")) return;
23-
chrome.extension.sendMessage({ method: "get_vars" }, function (response) {
21+
chrome.extension.sendMessage({ method: "get_vars" }, function(response) {
2422
userData = response.variables.split("~~~");
2523

2624
// Focus Mode
2725

28-
chrome.storage.local.get(/* String or Array */["onoffswitch"], function (
26+
chrome.storage.local.get(/* String or Array */ ["onoffswitch"], function(
2927
items
3028
) {
3129
if (items.onoffswitch === "true") {
32-
3330
$("._5pcb._dp7._4j3f").css("display", "none");
3431
$("._2t-f").css("display", "none");
3532
$(".bottomContent").css("color", "white");
36-
$('.home_right_column').css("display", "none");
33+
$(".home_right_column").css("display", "none");
3734

38-
$('.uiFutureSideNav').css("display", "none");
39-
$('._64b').css("display", "none");
40-
//Display Quotes begin
35+
$(".uiFutureSideNav").css("display", "none");
36+
$("._64b").css("display", "none");
37+
//Display Quotes begin
4138
if (a === 1) {
4239
let quote = "Be yourself; everyone else is already taken.";
4340
let author = " Oscar Wilde";
44-
$(function () {
41+
$(function() {
4542
if (k === 1) {
4643
var baseUrl = "https://talaikis.com/api/quotes/random/";
4744
$.ajax({
4845
url: baseUrl,
49-
type: 'GET',
50-
dataType: 'json',
51-
success: function (res) {
46+
type: "GET",
47+
dataType: "json",
48+
success: function(res) {
5249
// console.log(res.quote);
5350
// console.log(res.author);
5451
quote = res.quote;
5552
author = res.author;
56-
53+
// let height = $(window).height();
54+
// console.log(height)
55+
// let width = $(window).height();
5756

5857
$("body").css("overflow", "hidden");
5958
$("#contentArea").css("z-index", "200");
6059

61-
$('#bottomContent').html("\
62-
<table > \<tr>\<td></td>\
63-
<td rowspan=2><img src='https://source.unsplash.com/random/1500x800/?nature,night' \
64-
style='margin-left:-300px;margin-top:-180px;z-index:-1;\
65-
\
60+
$("#bottomContent").html(
61+
"\
62+
<table > <tr><td></td>\
63+
<td rowspan=2><img src='https://source.unsplash.com/random/" +
64+
screen.width +"x" +screen.height +
65+
"/?nature,night' \
66+
style='margin-top:-180px;margin-left:-350px;z-index:-1;\
6667
'></td> \
6768
</tr > \
6869
<tr>\
6970
<td colspan=2 > <p style='margin-top:-400px;font-size:36px; \
7071
font-weight:900;text-transform:uppercase;color:white ; \
7172
line-height:55px;margin-left:-200px;max-width:800px;\
72-
word-wrap:break-word;'>"+ quote + "</p></td>\
73+
word-wrap:break-word;'>" +
74+
quote +
75+
"</p></td>\
7376
</tr> \
74-
</table > ")
75-
76-
77-
77+
</table > "
78+
);
7879
}
7980
});
8081
k = 2;
81-
8282
}
8383

8484
//Disaply quotes end
8585
a = 2;
86-
8786
});
8887
}
89-
}
90-
else if (items.onoffswitch === "false") {
91-
88+
} else if (items.onoffswitch === "false") {
9289
$("._5pcb._dp7._4j3f").css("display", "inline");
9390
$("._2t-f").css("display", "inline");
94-
$('._2s25').css('color', 'white');
91+
$("._2s25").css("color", "white");
9592
if (a === 2) {
9693
location.reload();
9794
a = 1;
@@ -101,28 +98,21 @@ function updateBackgroundSettings() {
10198

10299
//minimal mode
103100

104-
chrome.storage.local.get(/* String or Array */["statusicon"], function (
101+
chrome.storage.local.get(/* String or Array */ ["statusicon"], function(
105102
items
106103
) {
107104
if (items.statusicon === "true") {
108-
$('.home_right_column').css("display", "none");
105+
$(".home_right_column").css("display", "none");
109106

110-
$('.fixed_elem').css("display", "none");
111-
$('._64b').css("display", "none");
107+
$(".fixed_elem").css("display", "none");
108+
$("._64b").css("display", "none");
112109

113110
updateBackgroundSettings();
114-
115-
}
116-
else if (items.statusicon === "false") {
117-
111+
} else if (items.statusicon === "false") {
118112
//when its not minimal mode (didnt decide what to do here )
119113
}
120114
});
121-
122-
123115
});
124116
}
125117

126-
127-
128-
updateBackgroundSettings();
118+
updateBackgroundSettings();

0 commit comments

Comments
 (0)