Removed tracking/stats, anything non-embed related
This commit is contained in:
Binary file not shown.
@ -1,4 +0,0 @@
|
||||
body {
|
||||
margin-right: 40%;
|
||||
background: color 0;
|
||||
}
|
288
static/main.js
288
static/main.js
@ -1,288 +0,0 @@
|
||||
var tweetCount = 1,
|
||||
page = 0,
|
||||
loading = false,
|
||||
bigArray = [],
|
||||
isNSFWSHOW = false;
|
||||
const iosHeight = () => {
|
||||
document.documentElement.style.setProperty("--ios-height", window.innerHeight + "px");
|
||||
};
|
||||
window.addEventListener("resize", iosHeight);
|
||||
|
||||
window.onload = () => {
|
||||
//ios height
|
||||
iosHeight();
|
||||
const contwarn = document.querySelector("#contwarn");
|
||||
const notsafe = document.querySelector("#notsafe");
|
||||
if (document.cookie.includes("NSFW=true")) {
|
||||
notsafe.checked = true;
|
||||
isNSFWSHOW = true;
|
||||
}
|
||||
if (document.cookie.includes("always=true")) {
|
||||
contwarn.checked = true;
|
||||
forNow();
|
||||
}
|
||||
contwarn.addEventListener("change", () => {
|
||||
if (contwarn.checked)
|
||||
addCookie("always", true);
|
||||
else
|
||||
addCookie("always", false);
|
||||
})
|
||||
notsafe.addEventListener("change", () => {
|
||||
if (notsafe.checked) {
|
||||
document.querySelectorAll(".nsfw").forEach(e => e.classList.add("noff"));
|
||||
addCookie("NSFW", true);
|
||||
isNSFWSHOW = true;
|
||||
}
|
||||
else {
|
||||
document.querySelectorAll(".noff").forEach(e => e.classList.remove("noff"));
|
||||
isNSFWSHOW = false;
|
||||
addCookie("NSFW", false);
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function addCookie(name, state) {
|
||||
if (state)
|
||||
document.cookie = `${name}=${state}; max-age=15780000; SameSite=None; Secure`;
|
||||
else
|
||||
document.cookie = `${name}=`;
|
||||
}
|
||||
|
||||
function cookieTime() {
|
||||
document.querySelector("#contwarn").checked = true;
|
||||
addCookie("always", true);
|
||||
forNow();
|
||||
}
|
||||
function forNow() {
|
||||
document.querySelector("#block").style.display = "none";
|
||||
fetchNApply(page)
|
||||
page++;
|
||||
const tweetCont = document.querySelector(".tweetCont");
|
||||
tweetCont.onscroll = async () => {
|
||||
if (tweetCont.scrollTop > tweetCont.scrollHeight - tweetCont.offsetHeight - 100 && loading == false) {
|
||||
await fetchNApply(page);
|
||||
//console.log(page);
|
||||
page++;
|
||||
}
|
||||
};
|
||||
}
|
||||
function fetchNApply(page) {
|
||||
try {
|
||||
loading = true;
|
||||
fetch(`https://fxtwitter.com/api/latest/?tweets=10&page=${page}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
data.forEach(e => createTweet(e));
|
||||
})
|
||||
.then(setTimeout(() => loading = false, 500));
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
alert(error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function imgPrev(img) {
|
||||
const prevImgCont = document.querySelector('.previmgcont');
|
||||
img.addEventListener('click', () => {
|
||||
const clone = img.cloneNode(true);
|
||||
clone.removeAttribute("width");
|
||||
clone.removeAttribute("height");
|
||||
clone.className = "previmg";
|
||||
prevImgCont.innerHTML = "";
|
||||
prevImgCont.appendChild(clone);
|
||||
prevImgCont.style.display = '';
|
||||
});
|
||||
}
|
||||
/*
|
||||
cont ={
|
||||
inner: text
|
||||
src: link
|
||||
lazy: bool
|
||||
href: link
|
||||
video: link
|
||||
}
|
||||
*/
|
||||
function createEl(tag, cls, cont) {
|
||||
const el = document.createElement(tag);
|
||||
if (cls)
|
||||
el.className = cls;
|
||||
if (cont) {
|
||||
if (cont.inner)
|
||||
el.innerHTML = cont.inner;
|
||||
if (cont.src)
|
||||
el.src = cont.src;
|
||||
if (cont.lazy)
|
||||
el.setAttribute("loading", "lazy");
|
||||
if (cont.href)
|
||||
el.setAttribute("href", cont.href),
|
||||
el.setAttribute("rel", "noreferrer"),
|
||||
el.setAttribute("target", "_blank");
|
||||
if (cont.video) {
|
||||
el.setAttribute("preload", "auto");
|
||||
el.setAttribute("controls", "");
|
||||
el.setAttribute("disablePictureInPicture", "");
|
||||
el.setAttribute("webkit-playsinline", "");
|
||||
el.setAttribute("playsinline", "");
|
||||
const source = document.createElement("source");
|
||||
source.src = cont.video;
|
||||
source.setAttribute("type", "video/mp4");
|
||||
el.appendChild(source);
|
||||
}
|
||||
}
|
||||
return el;
|
||||
}
|
||||
|
||||
function createTweet(json) {
|
||||
if (!bigArray.includes(json["tweet"])) {
|
||||
const tweet = createEl("div", "tweet");
|
||||
tweet.id = "t" + tweetCount;
|
||||
|
||||
const auth = createEl("div", "auth");
|
||||
|
||||
const aimage = createEl("img", "aimage", {
|
||||
src: json["pfp"],
|
||||
lazy: true
|
||||
});
|
||||
|
||||
const aname = createEl("a", "aname", {
|
||||
href: `https://twitter.com/${json['screen_name']}`
|
||||
});
|
||||
|
||||
aname.appendChild(createEl("div", undefined, {
|
||||
inner: json['uploader']
|
||||
}));
|
||||
|
||||
aname.appendChild(createEl("div", undefined, {
|
||||
inner: "@" + json['screen_name']
|
||||
}));
|
||||
|
||||
const type = createEl("a", "type", { inner: json["type"], href: json["tweet"] });
|
||||
|
||||
auth.appendChild(aimage);
|
||||
auth.appendChild(aname);
|
||||
auth.appendChild(type);
|
||||
|
||||
tweet.appendChild(auth);
|
||||
|
||||
json["description"] = json["description"].replaceAll(/http.*t.co\S+/g, "");
|
||||
|
||||
|
||||
if (json["description"] != "") {
|
||||
const desc = createEl("div", "desc", { inner: json["description"] });
|
||||
tweet.appendChild(desc);
|
||||
}
|
||||
|
||||
if (json["nsfw"]) { //beware
|
||||
var nsfw = createEl("div", "nsfw");
|
||||
const ncont = createEl("div", "ncont");
|
||||
const ninfo = createEl("div", "ninfo", { inner: "This is a NSFW Tweet <br> Press \"Show me\" if you want to see it" });
|
||||
var nshow = createEl("div", "nshow", { inner: "Show me" });
|
||||
ncont.appendChild(ninfo);
|
||||
ncont.appendChild(nshow);
|
||||
nsfw.appendChild(ncont);
|
||||
if (isNSFWSHOW === true)
|
||||
nsfw.classList.add("noff");
|
||||
}
|
||||
|
||||
|
||||
switch (json["type"]) {
|
||||
case "Text":
|
||||
//so empty
|
||||
break;
|
||||
case "Image":
|
||||
if (json["images"][4] > "1" && json["images"][4]) { //multiple images!!??
|
||||
const grid = createEl("div", "imgCont");
|
||||
for (let i = 0; i < json["images"][4]; i++)
|
||||
grid.appendChild(createEl("img", "media", {
|
||||
src: json["images"][i],
|
||||
lazy: true
|
||||
}));
|
||||
//console.log(json["images"][4])
|
||||
if (nsfw)
|
||||
nsfw.appendChild(grid);
|
||||
else
|
||||
tweet.appendChild(grid);
|
||||
}
|
||||
else {
|
||||
const media = createEl("img", "media", {
|
||||
src: json["thumbnail"],
|
||||
lazy: true
|
||||
});
|
||||
if (nsfw)
|
||||
nsfw.appendChild(media);
|
||||
else
|
||||
tweet.appendChild(media);
|
||||
}
|
||||
|
||||
break;
|
||||
case "Video":
|
||||
const video = createEl("video", "media", {
|
||||
video: json["url"]
|
||||
});
|
||||
if (nsfw)
|
||||
nsfw.appendChild(video);
|
||||
else
|
||||
tweet.appendChild(video);
|
||||
break;
|
||||
default:
|
||||
const video2 = createEl("video", "media", {
|
||||
video: json["url"]
|
||||
});
|
||||
if (nsfw)
|
||||
nsfw.appendChild(video2);
|
||||
else
|
||||
tweet.appendChild(video2);
|
||||
//console.log("this should not happen!");
|
||||
break;
|
||||
}
|
||||
|
||||
if (nsfw) {
|
||||
tweet.appendChild(nsfw);
|
||||
nshow.addEventListener("click", () => {
|
||||
nsfw.classList.add("noff");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const qrtob = json["qrt"];
|
||||
|
||||
if ((Object.keys(qrtob).length === 0 && Object.getPrototypeOf(qrtob) === Object.prototype) == false) {
|
||||
//console.log(json["qrt"]);
|
||||
const qrt = createEl("div", "quote");
|
||||
const qname = createEl("div", "qname", { inner: `QRT of : ${qrtob.handle} (@${qrtob.screenname})` });
|
||||
json["qrt"]["desc"] = json["qrt"]["desc"].replaceAll(/http.*t.co\S+/g, "");
|
||||
const qdesc = createEl("div", "qdesc", { inner: qrtob.desc });
|
||||
qrt.appendChild(qname);
|
||||
qrt.appendChild(qdesc);
|
||||
tweet.appendChild(qrt);
|
||||
}
|
||||
|
||||
|
||||
const meta = createEl("div", "meta");
|
||||
|
||||
const rts = createEl("div", "cont", { inner: `${json["rts"]} Retweets` });
|
||||
const lks = createEl("div", "cont", { inner: `${json["likes"]} Likes` });
|
||||
|
||||
const share = createEl("img", "share", { src: "https://fxtwitter.com/copy.svg" });
|
||||
|
||||
meta.appendChild(rts);
|
||||
meta.appendChild(lks);
|
||||
meta.appendChild(share);
|
||||
tweet.appendChild(meta);
|
||||
bigArray.push(json["tweet"]);
|
||||
document.querySelector(".tweetCont").appendChild(tweet);
|
||||
document.querySelectorAll('img:not(.aimage,.share)').forEach(img => {
|
||||
imgPrev(img);
|
||||
});
|
||||
share.addEventListener("click", () =>
|
||||
navigator.clipboard.writeText(json["tweet"].replace("https://t", "https://fxt"))
|
||||
);
|
||||
|
||||
tweetCount++;
|
||||
} else {
|
||||
if (bigArray.length > 100) //pro memory management 😎
|
||||
bigArray = [];
|
||||
}
|
||||
}
|
429
static/style.css
429
static/style.css
@ -1,429 +0,0 @@
|
||||
@font-face {
|
||||
font-family: NotoColorEmojiLimited;
|
||||
unicode-range: U+1F1E6-1F1FF;
|
||||
src: url("https://fxtwitter.com/font.ttf");
|
||||
}
|
||||
|
||||
:root {
|
||||
--ios-height: 100vh;
|
||||
--top-height: calc(4.5vh + 1.25vw);
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
height: var(--ios-height);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
a {
|
||||
color: unset;
|
||||
text-decoration: unset;
|
||||
}
|
||||
|
||||
a,
|
||||
a:link,
|
||||
a:focus,
|
||||
a:visited,
|
||||
a:active,
|
||||
a:-webkit-any-link,
|
||||
:link {
|
||||
color: unset;
|
||||
text-decoration: unset;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #8ebf42;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 1vmin;
|
||||
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #171717;
|
||||
border-radius: .5vmin;
|
||||
margin: 2vmin 0 2vmin;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #e8e8e8;
|
||||
border-radius: .5vmin;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #8ebf42;
|
||||
}
|
||||
|
||||
::selection {
|
||||
color: #171717;
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
|
||||
.base {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-family: 'Paytone One', 'NotoColorEmojiLimited', sans-serif;
|
||||
background-color: #222222;
|
||||
color: #e8e8e8;
|
||||
}
|
||||
|
||||
.top {
|
||||
height: var(--top-height);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
font-size: 7vmin;
|
||||
padding: 1vmin 0 1vmin;
|
||||
/*margin: 0 20vw 0;
|
||||
border-bottom: #e8e8e8 .1vmin solid;*/
|
||||
box-shadow: rgba(0, 0, 0, 0.2) 0px 1px 2px 0px;
|
||||
}
|
||||
|
||||
.top:hover {
|
||||
color: #8ebf42;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.tweetCont {
|
||||
flex: 2;
|
||||
padding: calc(1vh + .25vw) 10% 0;
|
||||
|
||||
overflow-y: auto;
|
||||
max-height: calc(var(--ios-height) - var(--top-height) - calc(1vh + .25vw));
|
||||
}
|
||||
|
||||
.tweet {
|
||||
display: flex;
|
||||
position: relative;
|
||||
flex-direction: column;
|
||||
background-color: #171717;
|
||||
margin: 0 0 calc(2vh + .5vw);
|
||||
padding: 1vmin 0 1vmin;
|
||||
box-shadow: rgba(0, 0, 0, 0.4) 0px 4px 7px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.side {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
max-height: calc(var(--ios-height) - var(--top-height) - calc(1vh + .25vw));
|
||||
}
|
||||
|
||||
.by {
|
||||
color: #8ebf42;
|
||||
}
|
||||
|
||||
.by:hover {
|
||||
color: #F74843;
|
||||
}
|
||||
|
||||
/* Tweet */
|
||||
.desc {
|
||||
padding: 0 calc(1.5vh + .25vw) 0;
|
||||
}
|
||||
|
||||
.auth,
|
||||
.meta {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 1%;
|
||||
font-size: 1.2em;
|
||||
padding: 0 calc(.5vh + .125vw) 0;
|
||||
}
|
||||
|
||||
.aname {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.aname,
|
||||
.type {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.type {
|
||||
text-align: right;
|
||||
margin: auto 2% auto;
|
||||
}
|
||||
|
||||
.aimage {
|
||||
border-radius: 50%;
|
||||
border: #8ebf42 .3vmin solid;
|
||||
height: 100%;
|
||||
width: auto;
|
||||
margin: auto;
|
||||
/* No Drag */
|
||||
-webkit-user-drag: none;
|
||||
-khtml-user-drag: none;
|
||||
-moz-user-drag: none;
|
||||
-o-user-drag: none;
|
||||
}
|
||||
|
||||
.nsfw {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ncont {
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
bottom: 20%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: 2vmin;
|
||||
background-color: #17171788;
|
||||
border-radius: .5vmin;
|
||||
padding: 1vw;
|
||||
|
||||
}
|
||||
|
||||
.ninfo {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.nshow {
|
||||
padding: 1vh 1vw;
|
||||
background-color: #171717;
|
||||
border: solid .5vmin #8ebf42;
|
||||
color: #e8e8e8;
|
||||
border-radius: .5vmin;
|
||||
transition-duration: .2s;
|
||||
transition-timing-function: ease-in-out;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
|
||||
.nshow:hover {
|
||||
transform: scale(1.1);
|
||||
border: solid .5vmin #bf4242;
|
||||
}
|
||||
|
||||
.nshow:active {
|
||||
transform: scale(.98);
|
||||
}
|
||||
|
||||
.nsfw .media {
|
||||
filter: blur(30px);
|
||||
|
||||
}
|
||||
|
||||
.noff div:not(.imgCont) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.noff .media {
|
||||
display: unset;
|
||||
filter: unset;
|
||||
}
|
||||
|
||||
.imgCont {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
|
||||
}
|
||||
|
||||
.imgCont .media {
|
||||
max-width: 50%;
|
||||
max-height: 35vh;
|
||||
}
|
||||
|
||||
.media {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
max-height: 60vh;
|
||||
object-fit: scale-down;
|
||||
background-color: black;
|
||||
|
||||
}
|
||||
|
||||
.quote {
|
||||
margin: auto;
|
||||
width: 90%;
|
||||
border-radius: .5vmin;
|
||||
border: #222222 solid .5vmin;
|
||||
padding: .5vmin;
|
||||
}
|
||||
|
||||
.qname {
|
||||
color: #8ebf42;
|
||||
}
|
||||
|
||||
.cont,
|
||||
.date {
|
||||
margin: auto 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.date {
|
||||
margin-left: 2%;
|
||||
}
|
||||
|
||||
.share {
|
||||
margin-left: auto;
|
||||
height: 2em;
|
||||
transition-duration: .2s;
|
||||
transition-timing-function: ease-in-out;
|
||||
}
|
||||
|
||||
.share:hover {
|
||||
transform: scale(.8);
|
||||
}
|
||||
|
||||
.share:active {
|
||||
transform: scale(2);
|
||||
}
|
||||
|
||||
.auth,
|
||||
.desc,
|
||||
.quote {
|
||||
margin-bottom: 2vmin;
|
||||
}
|
||||
|
||||
/* Settings */
|
||||
.settings,
|
||||
.info {
|
||||
font-size: 35px;
|
||||
padding: 1vmin;
|
||||
}
|
||||
|
||||
.settings {
|
||||
user-select: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.opt {
|
||||
font-size: .49em;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.Iinner {
|
||||
font-size: .5em;
|
||||
}
|
||||
|
||||
/* Preview */
|
||||
|
||||
img:not(.previmg, .aimage) {
|
||||
cursor: pointer;
|
||||
transition-duration: .2s;
|
||||
transition-timing-function: ease-in-out;
|
||||
}
|
||||
|
||||
.previmgcont {
|
||||
position: fixed;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
top: 0%;
|
||||
left: 0%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 101;
|
||||
background-color: #171717b7;
|
||||
}
|
||||
|
||||
.previmg {
|
||||
margin: auto;
|
||||
cursor: zoom-out !important;
|
||||
max-width: 100vw;
|
||||
max-height: 100vh;
|
||||
min-width: 100vw;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
/* Block */
|
||||
|
||||
#block {
|
||||
position: fixed;
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 99;
|
||||
background: #222222;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(1.75vh + .25vw);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#block .warn {
|
||||
font-size: 2em;
|
||||
color: #F74843;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.boptions {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 1.5vmin;
|
||||
}
|
||||
|
||||
.boptions>div {
|
||||
padding: 2vh 2vw;
|
||||
border: solid .5vmin #c5c5c5;
|
||||
color: #e8e8e8;
|
||||
border-radius: .5vmin;
|
||||
transition-duration: .15s;
|
||||
transition-timing-function: ease-in-out;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
.boptions>div:hover {
|
||||
transform: scale(1.02);
|
||||
border: solid .5vmin #8ebf42;
|
||||
}
|
||||
|
||||
.boptions>div:active {
|
||||
transform: scale(.98);
|
||||
}
|
||||
|
||||
@media (max-aspect-ratio: 4/4),
|
||||
(max-height: 500px),
|
||||
(max-width: 1100px) {
|
||||
.side {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tweet {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tweetCont {
|
||||
padding: 0 5% 0;
|
||||
}
|
||||
|
||||
.boptions {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user