Skip to content

Commit

Permalink
fix: removed broken enlarge button
Browse files Browse the repository at this point in the history
  • Loading branch information
Acorn221 committed Nov 5, 2022
1 parent 2066072 commit aa06b04
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 42 deletions.
10 changes: 1 addition & 9 deletions src/assets/injectedCss.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,4 @@
border-color: #000000;
border-width: 5px;
margin: 5px;
}
/*
.button .search {
}
.button .enlarge {
}
*/
}
3 changes: 1 addition & 2 deletions src/background/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Background {
this.showSettings = {
overlayButton: true,
searchButton: true,
enlargeButton: true,
};

this.aiSettings = {
Expand Down Expand Up @@ -183,7 +182,7 @@ class Background {
if (!result.showSettings) {
// set the default settings
if (debug) console.log("No 'showSettings' Found, Setting To Default!");
this.setShowSettings({ overlayButton: true, searchButton: true, enlargeButton: true }, false);
this.setShowSettings({ overlayButton: true, searchButton: true }, false);
} else {
// else set it to the default value
if (debug) console.log(`'showSettings' Found: ${JSON.stringify(result.showSettings)}`);
Expand Down
3 changes: 1 addition & 2 deletions src/background/injected/LighterFuel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,7 @@ class LighterFuel {
styleElem.textContent = `
.overlayBox { ${this.showSettings.overlayButton ? '' : 'display: none'} }
.topBox { ${this.showSettings.overlayButton ? '' : 'display: none'} }
.buttonLF .search { ${this.showSettings.searchButton ? '' : 'display: none'} }
.buttonLF .enlarge { ${this.showSettings.enlargeButton ? '' : 'display: none'} }`;
.buttonLF .search { ${this.showSettings.searchButton ? '' : 'display: none'} }`;
this.consoleOut(this.showSettings);
}

Expand Down
22 changes: 0 additions & 22 deletions src/background/injected/Misc.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
import {debug} from '@/config';
import { ImageType, ProfileImage } from '@/types';

/**
* Transfers the input image to the "full quality" tinder ones
* Highly likely to break soon
*
* @param {String} url
* @returns {String}
*/
export const getFullQualityImage = (url: string) => {
return url.replace(url.split('/')[4].split('_')[0], 'original').replace('.jpg', '.jpeg');
};

/**
* Used to genereate the buttons
*
Expand All @@ -25,7 +14,6 @@ import { ImageType, ProfileImage } from '@/types';
// * Let's just only allow this on matches for now
if (!data.url.startsWith('https://images-ssl.gotinder.com/u/')) {
const searchButton = document.createElement('div');
const enlargedUrl = getFullQualityImage(data.url);
const reverseImageUrl = `https://www.bing.com/images/search?view=detailv2&iss=sbi&form=SBIIDP&sbisrc=UrlPaste&q=imgurl:${encodeURIComponent(data.url)}&exph=800&expw=640&vt=2&sim=15`;
searchButton.classList.add('buttonLF');
searchButton.classList.add('search');
Expand All @@ -36,16 +24,6 @@ import { ImageType, ProfileImage } from '@/types';
if(newTab) newTab.focus();
};
parent.appendChild(searchButton);

const enlargeButton = document.createElement('div');
enlargeButton.classList.add('buttonLF');
enlargeButton.classList.add('enlarge');
enlargeButton.innerText = 'Enlarge';
enlargeButton.onclick = () => {
const newTab = window.open(enlargedUrl, '_blank');
if(newTab) newTab.focus();
};
parent.appendChild(enlargeButton);
}
return parent;
};
Expand Down
1 change: 0 additions & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const languageTexts = {
},
enableOverlay: "Enable overlay",
enableSearchButton: "Enable search button",
enableEnlargeButton: "Enable enlarge button",
info: {
title: "Info",
text: "Lighterfuel allows you to see when profile images were uploaded to get an idea of when they made their account, reverse image search your matches photos and get the maximum resolution photos!",
Expand Down
7 changes: 2 additions & 5 deletions src/popup/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class App extends React.Component {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(props: any) {
super(props);
this.state = { overlayButton: true, searchButton: true, enlargeButton: true };
this.state = { overlayButton: true, searchButton: true };
if (!chrome.runtime) throw new Error("This extension doesn't support the current browser");
this.port = chrome.runtime.connect();
this.port.onMessage.addListener((msg) => {
Expand All @@ -43,8 +43,6 @@ class App extends React.Component {
case 'search':
this.setState({ searchButton: event.target.checked }, () => this.sendState());
break;
case 'enlarge':
this.setState({ enlargeButton: event.target.checked }, () => this.sendState());
break;
default:
console.error('no handle change ID given :(');
Expand All @@ -62,7 +60,7 @@ class App extends React.Component {
}

render() {
const { overlayButton, searchButton, enlargeButton } = this.state;
const { overlayButton, searchButton } = this.state;
return (
<div className="App text-center w-[280px] font['Roboto', sans-serif] text-2xl font-light">
<header className="App-header">
Expand Down Expand Up @@ -90,7 +88,6 @@ class App extends React.Component {
</Collapsible>
<ToggleSwitch text={text.enableOverlay} id="overlay" state={overlayButton} onChange={this.handleChange} />
<ToggleSwitch text={text.enableSearchButton} id="search" state={searchButton} onChange={this.handleChange} />
<ToggleSwitch text={text.enableEnlargeButton} id="enlarge" state={enlargeButton} onChange={this.handleChange} />
<Collapsible trigger={text.info.title} easing="ease-in" transitionTime={200}>
<p className={styles.description}>{text.info.text}</p>
</Collapsible>
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export type ProfileImage = {
export type ShowSettings = {
overlayButton: boolean;
searchButton: boolean;
enlargeButton: boolean;
};

export type TabMessage = {
Expand Down

0 comments on commit aa06b04

Please sign in to comment.