Separate file of personal URLs

This commit is contained in:
sienori 2019-02-23 22:43:22 +09:00
parent a90ef23f6a
commit e9de9f3d1e
3 changed files with 10 additions and 16 deletions

View file

@ -0,0 +1,6 @@
import browserInfo from "browser-info";
const browserName = browserInfo().name;
const suffix = browserName === "Chrome" ? "fc" : browserName === "Opera" ? "fo" : "";
export const email = `sienori.firefox+st${suffix}@gmail.com`;
export const paypalLink = `https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&no_shipping=1&business=sienori.firefox@gmail.com&item_name=Simple Translate for ${browserName} - Donation`;

View file

@ -3,17 +3,12 @@ import browser from "webextension-polyfill";
import browserInfo from "browser-info"; import browserInfo from "browser-info";
import queryString from "query-string"; import queryString from "query-string";
import OptionsContainer from "./OptionContainer"; import OptionsContainer from "./OptionContainer";
import { paypalLink, email } from "src/common/personalUrls";
import manifest from "src/manifest-chrome.json"; import manifest from "src/manifest-chrome.json";
export default props => { export default props => {
const query = queryString.parse(props.location.search); const query = queryString.parse(props.location.search);
const extensionVersion = manifest.version; const extensionVersion = manifest.version;
const isChrome = browserInfo().name == "Chrome";
const paypalLink = `https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&no_shipping=1&business=sienori.firefox@gmail.com&item_name=Simple Translate ${
isChrome ? "for Chrome " : ""
}- Donation`;
const email = `sienori.firefox+st${isChrome ? "fc" : ""}@gmail.com`;
return ( return (
<div> <div>
@ -83,9 +78,7 @@ export default props => {
} }
target="_blank" target="_blank"
> >
{browserInfo().name === "Firefox" {browser.i18n.getMessage("addonPageLabel")}
? browser.i18n.getMessage("addonPageLabel")
: browser.i18n.getMessage("extensionPageLabel")}
</a> </a>
<span> </span> <span> </span>
<a href="https://github.com/sienori/simple-translate" target="_blank"> <a href="https://github.com/sienori/simple-translate" target="_blank">

View file

@ -1,18 +1,13 @@
import React from "react"; import React from "react";
import browser from "webextension-polyfill"; import browser from "webextension-polyfill";
import browserInfo from "browser-info";
import openUrl from "src/common/openUrl"; import openUrl from "src/common/openUrl";
import { paypalLink } from "src/common/personalUrls";
import HeartIcon from "../icons/heart.svg"; import HeartIcon from "../icons/heart.svg";
import SettingsIcon from "../icons/settings.svg"; import SettingsIcon from "../icons/settings.svg";
import "../styles/header.scss"; import "../styles/header.scss";
//TODO: 次のタブで開く
const openPayPal = () => { const openPayPal = () => {
const isChrome = browserInfo().name === "Chrome"; openUrl(paypalLink);
const url = `https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&no_shipping=1&business=sienori.firefox@gmail.com&item_name=SimpleTranslate ${
isChrome ? "for Chrome " : ""
}- Donation`;
openUrl(url);
}; };
const openSettings = () => { const openSettings = () => {
const url = "../options/index.html#settings"; const url = "../options/index.html#settings";