From 0bd140006801077b33577c8b07bb6851fa548e6b Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 23 Apr 2020 02:26:08 +0200 Subject: [PATCH 1/4] added README --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..bbdb2cb --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +[![Build Status](https://drone.srv.kapelle.org/api/badges/niklas/startpage/status.svg?ref=refs/heads/master)](https://drone.srv.kapelle.org/niklas/startpage) + +# How to set the new Tab +## Firefox + +[Reddit thread](https://www.reddit.com/r/startpages/comments/g3qndt/psa_how_to_set_a_custom_new_tab_page_in_firefox/) + +Create 2 files inside of the firefox install directory. + +`${installDir}/defaults/pref/autoconfig.js` +```js +pref("general.config.filename", "autoconfig.cfg"); +pref("general.config.obscure_value", 0); +pref("general.config.sandbox_enabled", false); +``` + +`${installDir}/autoconfig.cfg` +``` +// first line is a comment +var {classes:Cc,interfaces:Ci,utils:Cu} = Components; +var newTabURL = "http://localhost:8080"; +aboutNewTabService = Cc["@mozilla.org/browser/aboutnewtab-service;1"].getService(Ci.nsIAboutNewTabService); +aboutNewTabService.newTabURL = newTabURL; +``` + +Replace the "localhost" line in `autoconfig.cfg` with your URL. +Also you can set the homepage via your normal settings. + +Alternatively you can use a extentions called [New Tab override](https://addons.mozilla.org/en-US/firefox/addon/new-tab-override/). + +## Chrome + +Maybe [this](https://chrome.google.com/webstore/detail/custom-new-tab-url/mmjbdbjnoablegbkcklggeknkfcjkjia) extention. Not tested yet. -- 2.45.2 From 9a84a041573bcbad5fccef55bfbf3be3dfd2f583 Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 23 Apr 2020 02:56:19 +0200 Subject: [PATCH 2/4] added serach component --- src/components/App.tsx | 2 ++ src/components/Search.tsx | 43 +++++++++++++++++++++++++++++++++++++++ src/style/search.scss | 12 +++++++++++ 3 files changed, 57 insertions(+) create mode 100644 src/components/Search.tsx create mode 100644 src/style/search.scss diff --git a/src/components/App.tsx b/src/components/App.tsx index 02d415b..be5ba27 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -4,6 +4,7 @@ import Quick from "./Quick"; import QuickItem from "./QuickItem"; import QuickCategory from "./QuickCategory"; import Clock from "./Clock"; +import Search from "./Search"; class App extends React.Component { constructor(props) { @@ -14,6 +15,7 @@ class App extends React.Component { return
+ diff --git a/src/components/Search.tsx b/src/components/Search.tsx new file mode 100644 index 0000000..e8c88ff --- /dev/null +++ b/src/components/Search.tsx @@ -0,0 +1,43 @@ +import * as React from "react"; + +import "../style/search.scss"; + +class Search extends React.Component { + + private searchInput = React.createRef() + + constructor(props) { + super(props); + } + + handleQuery(query: string) { + this.search(query); + } + + search(query: string){ + const url = new URL("https://duckduckgo.com/"); + const param = new URLSearchParams(); + param.append("q",query); + url.search = param.toString(); + window.location.href = url.toString(); + } + + onKeyDown(event: React.KeyboardEvent) { + if (event.key === 'Enter') { + this.handleQuery(this.searchInput.current.value); + } + } + + render(): JSX.Element { + return
+ this.onKeyDown(e)} + ref={this.searchInput} + /> +
; + } + +} + +export default Search; diff --git a/src/style/search.scss b/src/style/search.scss new file mode 100644 index 0000000..5b0c9a6 --- /dev/null +++ b/src/style/search.scss @@ -0,0 +1,12 @@ +.search-component{ + + text-align: center; + margin-top: 2em; + margin-bottom: 2em; + + input[type=text]{ + width: 40%; + border: none; + padding: 0.5em 1.5em; + } +} \ No newline at end of file -- 2.45.2 From 9191aee44936722c4e5d7ab585d4a43e2b6bed04 Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 23 Apr 2020 14:03:09 +0200 Subject: [PATCH 3/4] fixed missing link --- src/components/App.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index be5ba27..3c7a9d6 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -18,8 +18,8 @@ class App extends React.Component { - - + + @@ -30,7 +30,7 @@ class App extends React.Component {
- +
-- 2.45.2 From ae289bf75b759f7ab75cba850d2e7b38e5e124d0 Mon Sep 17 00:00:00 2001 From: Niklas Date: Thu, 23 Apr 2020 14:09:37 +0200 Subject: [PATCH 4/4] fixed typo in quick url --- src/components/App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/App.tsx b/src/components/App.tsx index 3c7a9d6..c48eb76 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -30,7 +30,7 @@ class App extends React.Component { - +
-- 2.45.2