Add gh/gH to open home page
This commit is contained in:
parent
b735317c60
commit
1f89464e42
8 changed files with 65 additions and 13 deletions
|
@ -37,6 +37,8 @@ export default class OperationController {
|
|||
return this.operationInteractor.duplicate();
|
||||
case operations.PAGE_SOURCE:
|
||||
return this.operationInteractor.openPageSource();
|
||||
case operations.PAGE_HOME:
|
||||
return this.operationInteractor.openHome(operation.newTab);
|
||||
case operations.ZOOM_IN:
|
||||
return this.operationInteractor.zoomIn();
|
||||
case operations.ZOOM_OUT:
|
||||
|
|
|
@ -120,6 +120,6 @@ export default class CommandIndicator {
|
|||
|
||||
async urlOrSearch(keywords) {
|
||||
let settings = await this.settingRepository.get();
|
||||
return urls.normalizeUrl(keywords, settings.search);
|
||||
return urls.searchUrl(keywords, settings.search);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import TabPresenter from '../presenters/tab';
|
||||
import ConsolePresenter from '../presenters/console';
|
||||
import * as urls from '../../shared/urls';
|
||||
|
||||
const ZOOM_SETTINGS = [
|
||||
0.33, 0.50, 0.66, 0.75, 0.80, 0.90, 1.00,
|
||||
|
@ -172,5 +173,17 @@ export default class OperationInteractor {
|
|||
let tab = await this.tabPresenter.getCurrent();
|
||||
return this.consolePresenter.hide(tab.id);
|
||||
}
|
||||
|
||||
async openHome(newTab) {
|
||||
let tab = await this.tabPresenter.getCurrent();
|
||||
let result = await browser.browserSettings.homepageOverride.get({});
|
||||
let us = urls.homepageUrls(result.value);
|
||||
if (us.length === 1 && !newTab) {
|
||||
return this.tabPresenter.open(us[0], tab.id);
|
||||
}
|
||||
for (let u of us) {
|
||||
this.tabPresenter.create(u, { openerTabId: tab.id });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue