Skip to content

Commit

Permalink
1.2.0
Browse files Browse the repository at this point in the history
Added recently closed tabs bar. May be enabled in options.
  • Loading branch information
terron-kun committed Nov 29, 2016
1 parent cfefd1f commit 42073ce
Show file tree
Hide file tree
Showing 12 changed files with 219 additions and 16 deletions.
22 changes: 22 additions & 0 deletions public/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,20 @@
},


"option_recently_closed_label": {
"message": "Последние закрытые вкладки"
},
"option_recently_closed_hint": {
"message": "Отображение списка последних закрытых вкладок."
},
"option_recently_closed_display": {
"message": "Отображать"
},
"option_recently_closed_hide": {
"message": "Скрывать"
},



"back_to_questions": {
"message": "назад к вопросам"
Expand Down Expand Up @@ -247,6 +261,14 @@
},


"help_request_permissions_title": {
"message": "Почему расширение иногда запрашивает новые права доступа?"
},
"help_request_permissions_answer": {
"message": "Это необходимо для введения новых функций. Из-за реализации браузерных расширений, чтобы получить доступ к одной единственной некритичной функции, приходится запрашивать доступ сразу ко всему функционалу, который может даже не пригодиться. Например, чтобы получить доступ к последним закрытым вкладкам, приходится запрашивать доступ к функциям, которые работают с сессиями."
},


"help_change_theme_title": {
"message": "Можно ли изменить тему (дизайн)?"
},
Expand Down
20 changes: 20 additions & 0 deletions public/js/background.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/js/background.js.map

Large diffs are not rendered by default.

57 changes: 51 additions & 6 deletions public/js/newtab.js
Original file line number Diff line number Diff line change
Expand Up @@ -19348,6 +19348,20 @@ if (typeof browser === "undefined") {
"maxArgs": 1
}
},
"sessions": {
"getRecentlyClosed": {
"minArgs": 0,
"maxArgs": 1
},
"getDevices": {
"minArgs": 0,
"maxArgs": 1
},
"restore": {
"minArgs": 0,
"maxArgs": 0
}
},
"storage": {
"local": {
"clear": {
Expand Down Expand Up @@ -20050,21 +20064,40 @@ String.prototype.encodeHTML = function () {
*/

Promise.all([
browser.storage.local.get(),
browser.storage.sync.get(),
browser.storage.local.get(),
browser.storage.sync.get(),
browser.bookmarks.getTree(),
browser.management.getSelf(),
browser.topSites.get()
browser.topSites.get(),
browser.sessions.getRecentlyClosed()
])
.then(([local_storage, sync_storage, browserBookmarks, extensionInfo, topSites]) => {
.then(([local_storage, sync_storage, browserBookmarks, extensionInfo, topSites, recentlyClosed]) => {
let allBookmarks = browserBookmarks[0]['children'][0]['children'];
let columnsCount = local_storage['columns_count'];
let backgroundImage = local_storage['background_image'];
let openBookmarksInNewTab = local_storage['bookmarks_in_new_tab'];
let allTopSites = local_storage['top_sites'] === true ? topSites : [];

console.log(allBookmarks);
console.log(allTopSites);
//
// Preparing recently closed tabs
//

let allClosedTabs = [];

if (local_storage['recently_closed'] === true) {
recentlyClosed.forEach(closedTab => {
if ( typeof closedTab['tab'] !== 'undefined'
&& typeof closedTab['tab']['title'] !== 'undefined'
&& typeof closedTab['tab']['url'] !== 'undefined') {
allClosedTabs.push({
title: closedTab['tab']['title'],
url: closedTab['tab']['url']
});
}
});
}

console.log(allClosedTabs);

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -20106,6 +20139,8 @@ Promise.all([
chunkedBookmarks: allBookmarks.chunk(columnsCount, true),
allTopSites: allTopSites,
chunkedTopSites: allTopSites.chunk(columnsCount, true),
allClosedTabs: allClosedTabs,
chunkedClosedTabs: allClosedTabs.chunk(columnsCount, true),
openBookmarksInNewTab: openBookmarksInNewTab,
columnSize: Math.round(COLUMN_COUNT / columnsCount),

Expand All @@ -20115,6 +20150,13 @@ Promise.all([
};
},
template: `<main>
<ul class="bookmark-tree row pb-1"
v-if="allClosedTabs.length > 0">
<bookmark-column
v-for="site in chunkedClosedTabs"
:bookmarks="site"></bookmark-column>
</ul>

<ul class="bookmark-tree row pb-1"
v-if="allTopSites.length > 0">
<bookmark-column
Expand Down Expand Up @@ -20293,6 +20335,9 @@ Promise.all([
}, {
'title': browser.i18n.getMessage('help_why_permissions_title'),
'answer': browser.i18n.getMessage('help_why_permissions_answer')
}, {
'title': browser.i18n.getMessage('help_request_permissions_title'),
'answer': browser.i18n.getMessage('help_request_permissions_answer')
}, {
'title': browser.i18n.getMessage('help_change_theme_title'),
'answer': browser.i18n.getMessage('help_change_theme_answer')
Expand Down
2 changes: 1 addition & 1 deletion public/js/newtab.js.map

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions public/js/options.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/js/options.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_app_name__",
"version": "1.1.3",
"version": "1.2.0",
"author": "terron",
"homepage_url": "https://github.com/terron-kun/camellia",
"description": "__MSG_app_description__",
Expand All @@ -18,6 +18,7 @@
"storage",
"notifications",
"topSites",
"sessions",
"<all_urls>"
],

Expand Down
6 changes: 6 additions & 0 deletions resources/assets/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ browser.runtime.onInstalled.addListener(details => {
|| typeof local_storage['top_sites'] !== 'boolean') {
local_storage['top_sites'] = false;
}

// Display recently closed tabs
if (typeof local_storage['recently_closed'] === 'undefined'
|| typeof local_storage['recently_closed'] !== 'boolean') {
local_storage['recently_closed'] = false;
}

browser.storage.sync.set(sync_storage);
browser.storage.local.set(local_storage);
Expand Down
43 changes: 37 additions & 6 deletions resources/assets/js/newtab.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,40 @@
*/

Promise.all([
browser.storage.local.get(),
browser.storage.sync.get(),
browser.storage.local.get(),
browser.storage.sync.get(),
browser.bookmarks.getTree(),
browser.management.getSelf(),
browser.topSites.get()
browser.topSites.get(),
browser.sessions.getRecentlyClosed()
])
.then(([local_storage, sync_storage, browserBookmarks, extensionInfo, topSites]) => {
.then(([local_storage, sync_storage, browserBookmarks, extensionInfo, topSites, recentlyClosed]) => {
let allBookmarks = browserBookmarks[0]['children'][0]['children'];
let columnsCount = local_storage['columns_count'];
let backgroundImage = local_storage['background_image'];
let openBookmarksInNewTab = local_storage['bookmarks_in_new_tab'];
let allTopSites = local_storage['top_sites'] === true ? topSites : [];

console.log(allBookmarks);
console.log(allTopSites);
//
// Preparing recently closed tabs
//

let allClosedTabs = [];

if (local_storage['recently_closed'] === true) {
recentlyClosed.forEach(closedTab => {
if ( typeof closedTab['tab'] !== 'undefined'
&& typeof closedTab['tab']['title'] !== 'undefined'
&& typeof closedTab['tab']['url'] !== 'undefined') {
allClosedTabs.push({
title: closedTab['tab']['title'],
url: closedTab['tab']['url']
});
}
});
}

console.log(allClosedTabs);

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -65,6 +84,8 @@ Promise.all([
chunkedBookmarks: allBookmarks.chunk(columnsCount, true),
allTopSites: allTopSites,
chunkedTopSites: allTopSites.chunk(columnsCount, true),
allClosedTabs: allClosedTabs,
chunkedClosedTabs: allClosedTabs.chunk(columnsCount, true),
openBookmarksInNewTab: openBookmarksInNewTab,
columnSize: Math.round(COLUMN_COUNT / columnsCount),

Expand All @@ -74,6 +95,13 @@ Promise.all([
};
},
template: `<main>
<ul class="bookmark-tree row pb-1"
v-if="allClosedTabs.length > 0">
<bookmark-column
v-for="site in chunkedClosedTabs"
:bookmarks="site"></bookmark-column>
</ul>
<ul class="bookmark-tree row pb-1"
v-if="allTopSites.length > 0">
<bookmark-column
Expand Down Expand Up @@ -252,6 +280,9 @@ Promise.all([
}, {
'title': browser.i18n.getMessage('help_why_permissions_title'),
'answer': browser.i18n.getMessage('help_why_permissions_answer')
}, {
'title': browser.i18n.getMessage('help_request_permissions_title'),
'answer': browser.i18n.getMessage('help_request_permissions_answer')
}, {
'title': browser.i18n.getMessage('help_change_theme_title'),
'answer': browser.i18n.getMessage('help_change_theme_answer')
Expand Down
Loading

0 comments on commit 42073ce

Please sign in to comment.