Commit 6211e856 authored by karol@jagiello.it's avatar karol@jagiello.it
Browse files

1.7.2 - 1. Added one option for new tabs from toolbar 2. Added hints in...

1.7.2 - 1. Added one option for new tabs from toolbar 2. Added hints in options page 3. New tabs in background are added in queue, so order is always correct 4. Changed visual style for tab counters
parent ef57faa7
{"ToolbarShow":true,"ColorsSet":{"attention_background":"#cf4010","attention_border":"#cf4010","button_background":"#323234","button_border":"#323234","button_hover_background":"#7f7f80","button_hover_border":"#7f7f80","button_icons":"#bebebe","button_icons_hover":"#bebebe","button_on_background":"#4a4a4f","button_on_icons":"#bebebe","button_shelf_background":"#4a4a4f","button_shelf_border":"#4a4a4f","button_shelf_hover_background":"#7f7f80","button_shelf_hover_border":"#7f7f80","button_shelf_icons":"#bebebe","button_shelf_icons_hover":"#bebebe","children_padding_left":"11px","close_hover_background":"#454547","close_hover_border":"#454547","close_hover_x":"#f9f9fa","close_x":"#f9f9fa","drag_indicator":"#b5b5b5","expand_closed_background":"#a8a8a8","expand_hover_background":"#dcdcdc","expand_open_background":"#0a84ff","filter_box_background":"#474749","filter_box_border":"#29292a","filter_box_font":"#e4e4e4","filter_clear_icon":"#bebebe","folder_icon_closed":"#a8a8a8","folder_icon_hover":"#dcdcdc","folder_icon_open":"#0a84ff","group_list_background":"#18181b","group_list_borders":"#0c0c0d","group_list_button_hover_background":"#252526","group_list_default_font_color":"#b1b1b1","pin_list_background":"#323234","pin_list_border_bottom":"#0c0c0d","scrollbar_height":"11px","scrollbar_thumb":"#525049","scrollbar_thumb_hover":"#2b2a26","scrollbar_track":"#45443f","scrollbar_width":"12px","tab_active_background":"#4a4a4f","tab_active_border":"#0a84ff","tab_active_hover_background":"#3a3a3f","tab_active_hover_border":"#0a84ff","tab_active_hover_title_font_color":"#e5e5e5","tab_active_hover_title_font_weight":"bold","tab_active_selected_background":"#3f7ebe","tab_active_selected_border":"#0a84ff","tab_active_selected_title_font_color":"#e8e8e8","tab_active_selected_title_font_weight":"normal","tab_active_title_font_color":"#e5e5e5","tab_active_title_font_weight":"bold","tab_background":"#323234","tab_border":"#323234","tab_discarded_background":"#323234","tab_discarded_border":"#323234","tab_discarded_hover_background":"#252526","tab_discarded_hover_border":"#515151","tab_discarded_hover_title_font_color":"#9e9e9e","tab_filtered":"#827e00","tab_filtered_active_border":"#d2cb00","tab_filtered_active_highlighted_search_border":"#ed9900","tab_filtered_active_highlighted_search_hover_border":"#ea9800","tab_filtered_active_hover_border":"#d2cb00","tab_filtered_active_hover_title_font_color":"#919191","tab_filtered_active_hover_title_font_weight":"normal","tab_filtered_active_title_font_color":"#919191","tab_filtered_active_title_font_weight":"normal","tab_filtered_border":"#e8e000","tab_filtered_highlighted":"#b37400","tab_filtered_highlighted_search_border":"#ed9900","tab_filtered_highlighted_search_hover_border":"#ea9800","tab_filtered_hover_border":"#d2cb00","tab_filtered_selected":"#0f8079","tab_filtered_selected_active":"#1299a9","tab_filtered_selected_active_border":"#0f8079","tab_filtered_selected_active_highlighted_search_border":"#ed9900","tab_filtered_selected_active_highlighted_search_hover_background":"#c68100","tab_filtered_selected_active_highlighted_search_hover_border":"#ea9800","tab_filtered_selected_active_hover_border":"#0d6d67","tab_filtered_selected_active_hover_title_font_color":"#cfcfcf","tab_filtered_selected_active_hover_title_font_weight":"normal","tab_filtered_selected_active_title_font_color":"#cfcfcf","tab_filtered_selected_active_title_font_weight":"normal","tab_filtered_selected_border":"#0f8079","tab_filtered_selected_highlighted_search_border":"#ed9900","tab_filtered_selected_highlighted_search_hover_border":"#ea9800","tab_filtered_selected_hover_border":"#0d6d67","tab_header_border_radius":"0px","tab_hover_background":"#252526","tab_hover_border":"#515151","tab_hover_title_font_color":"#c1c1c1","tab_hover_title_font_weight":"normal","tab_list_background":"#323234","tab_selected_active_hover_background":"#356a9f","tab_selected_active_hover_border":"#359aff","tab_selected_active_hover_title_font_color":"#e8e8e8","tab_selected_active_hover_title_font_weight":"normal","tab_selected_background":"#3f7ebe","tab_selected_border":"#3f7ebe","tab_selected_discarded_background":"#2e5c8b","tab_selected_discarded_border":"#2e5c8b","tab_selected_discarded_hover_background":"#25496d","tab_selected_discarded_hover_border":"#336699","tab_selected_discarded_title_font_color":"#9e9e9e","tab_selected_hover_background":"#356a9f","tab_selected_hover_border":"#4d88c4","tab_selected_hover_title_font_color":"#c7c7c7","tab_selected_hover_title_font_weight":"normal","tab_selected_title_font_color":"#c1c1c1","tab_selected_title_font_weight":"normal","tab_title":"#adadad","tab_title_active":"#cacaca","tab_title_discarded":"#7e7e7e","tab_title_font_color":"#c1c1c1","tab_title_font_style":"normal","tab_title_font_weight":"normal","tabs_menu_background":"#4a4a4f","tabs_menu_border":"#27272b","tabs_menu_font":"#efefef","tabs_menu_hover_background":"#727275","tabs_menu_hover_border":"#727275","tabs_menu_separator":"#6b6b6e","toolbar_background":"#323234","toolbar_border_bottom":"#0c0c0d","toolbar_shelf_background":"#4a4a4f"},"TabsSizeSetNumber":2,"TabsMargins":"1","theme_name":"Quantum dark","theme_version":4}
\ No newline at end of file
......@@ -48,5 +48,5 @@
"page": "options.html",
"open_in_tab": true
},
"version": "1.7.1"
"version": "1.7.2"
}
\ No newline at end of file
......@@ -31,5 +31,5 @@
"description": "close tree"
}
},
"version": "1.6.1"
"version": "1.7.2"
}
......@@ -25,5 +25,5 @@
"description": "close tree"
}
},
"version": "1.7.0"
"version": "1.7.2"
}
// Copyright (c) 2017 kroppy. All rights reserved.
// Use of this source code is governed by a Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0) license
// that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/
if (localStorage.getItem("t0") != null){
LoadV015(0);
}
function OldHashTab(tab){
if (tabs[tab.id] == undefined){
tabs[tab.id] = {ttid: "", hash: 0, h: 0, parent: tab.pinned ? "pin_list" : "tab_list", index: tab.index, expand: ""};
}
var hash = 0;
if (tab.url.length === 0){
return 0;
}
for (var i = 0; i < tab.url.length; i++){
hash = (hash << 5)-hash;
hash = hash+tab.url.charCodeAt(i);
hash |= 0;
}
tabs[tab.id].h = hash;
}
function LoadV015(retry){
var loaded_options = {};
for (var parameter in DefaultPreferences) {
opt[parameter] = DefaultPreferences[parameter];
}
// set loaded options
if (localStorage.getItem("current_options") !== null){
loaded_options = JSON.parse(localStorage["current_options"]);
}
for (var parameter in opt) {
if (loaded_options[parameter] != undefined && opt[parameter] != undefined){
opt[parameter] = loaded_options[parameter];
}
}
SavePreferences();
if (localStorage.getItem("current_options") !== null){
localStorage.removeItem("current_options");
}
chrome.tabs.query({windowType: "normal"}, function(qtabs){
// create current tabs object
qtabs.forEach(function(Tab){
OldHashTab(Tab);
});
var reference_tabs = {};
var tabs_to_save = [];
var tabs_matched = 0;
// compare saved tabs from storage to current session tabs, but can be skipped if set in options
qtabs.forEach(function(Tab){
for (var t = 0; t < 9999; t++){
if (localStorage.getItem("t"+t) !== null){
var LoadedTab = JSON.parse(localStorage["t"+t]);
if (LoadedTab[1] === tabs[Tab.id].h && reference_tabs[LoadedTab[0]] == undefined){
reference_tabs[LoadedTab[0]] = Tab.id;
tabs[Tab.id].parent = LoadedTab[2];
tabs[Tab.id].index = LoadedTab[3];
tabs[Tab.id].expand = LoadedTab[4];
tabs_matched++;
break;
}
} else {
break;
}
}
});
// replace parents tabIds to new ones, for that purpose reference_tabs was made before
for (var tabId in tabs){
if (reference_tabs[tabs[tabId].parent] != undefined){
tabs[tabId].parent = reference_tabs[tabs[tabId].parent];
}
}
// create new hashes
qtabs.forEach(function(Tab){
ChromeHashURL(Tab);
});
qtabs.forEach(function(Tab){
tabs_to_save.push({id: Tab.id, hash: tabs[Tab.id].hash, parent: tabs[Tab.id].parent, index: tabs[Tab.id].index, expand: tabs[Tab.id].expand});
});
localStorage["t_count"] = JSON.stringify(qtabs.length);
localStorage["tabs"] = JSON.stringify(tabs_to_save);
for (var t = 0; t < 9999; t++){
if (localStorage.getItem("t"+t) !== null){
localStorage.removeItem("t"+t);
}
}
ConvertLegacyStorage();
});
}
function ConvertLegacyStorage() {
if (localStorage.getItem("current_theme") != null || localStorage.getItem("preferences") != null || localStorage.getItem("tabs") != null || localStorage.getItem("windows") != null) {
let current_theme = "";
if (localStorage.getItem("current_theme") != null) {
current_theme = localStorage["current_theme"];
}
let LSthemes = [];
if (localStorage.getItem("themes") != null) {
LSthemes = LoadData("themes", []);
}
SLThemes = {};
LSthemes.forEach(function(themeName) {
let them = LoadData("theme"+themeName, {"TabsSizeSetNumber": 2, "ToolbarShow": true, "toolbar": DefaultToolbar});
SLThemes[themeName] = them;
});
let LSpreferences = Object.assign({}, DefaultPreferences);
if (localStorage.getItem("preferences") != null) {
LSpreferences = LoadData("preferences", {});
}
let LStabs = {};
if (localStorage.getItem("tabs") != null) {
LStabs = LoadData("tabs", {});
}
let LSwindows = {};
if (localStorage.getItem("windows") != null) {
LSwindows = LoadData("windows", {});
}
let LStabs_BAK1 = {};
if (localStorage.getItem("tabs_BAK1") != null) {
LStabs_BAK1 = LoadData("tabs_BAK1", {});
}
let LStabs_BAK2 = {};
if (localStorage.getItem("tabs_BAK2") != null) {
LStabs_BAK2 = LoadData("tabs_BAK2", {});
}
let LStabs_BAK3 = {};
if (localStorage.getItem("tabs_BAK3") != null) {
LStabs_BAK3 = LoadData("tabs_BAK3", {});
}
let LSwindows_BAK1 = {};
if (localStorage.getItem("windows_BAK1") != null) {
LSwindows_BAK1 = LoadData("windows_BAK1", {});
}
let LSwindows_BAK2 = {};
if (localStorage.getItem("windows_BAK2") != null) {
LSwindows_BAK2 = LoadData("windows_BAK2", {});
}
let LSwindows_BAK3 = {};
if (localStorage.getItem("windows_BAK3") != null) {
LSwindows_BAK3 = LoadData("windows_BAK3", {});
}
let LSt_count = 0;
if (localStorage.getItem("t_count") != null) {
LSt_count = LoadData("t_count", {});
}
let LSw_count = 0;
if (localStorage.getItem("w_count") != null) {
LSw_count = LoadData("w_count", {});
}
chrome.storage.local.set({tabs: LStabs});
chrome.storage.local.set({windows: LSwindows});
chrome.storage.local.set({tabs_BAK1: LStabs_BAK1});
chrome.storage.local.set({tabs_BAK2: LStabs_BAK2});
chrome.storage.local.set({tabs_BAK3: LStabs_BAK3});
chrome.storage.local.set({windows_BAK1: LSwindows_BAK1});
chrome.storage.local.set({windows_BAK2: LSwindows_BAK2});
chrome.storage.local.set({windows_BAK3: LSwindows_BAK3});
chrome.storage.local.set({t_count: LSt_count});
chrome.storage.local.set({w_count: LSw_count});
chrome.storage.local.set({preferences: LSpreferences});
chrome.storage.local.set({current_theme: current_theme});
chrome.storage.local.set({themes: SLThemes});
localStorage.clear();
window.location.reload();
}
}
function LoadData(KeyName, ExpectReturnDefaultType) {
var data = ExpectReturnDefaultType;
try {
data = JSON.parse(localStorage[KeyName]);
return data;
} catch(e) {
return ExpectReturnDefaultType;
}
}
......@@ -245,6 +245,9 @@
"menu_groups_hibernate": {
"message": "Hibernate"
},
"menu_group_tabs_close": {
"message": "Close tabs"
},
......@@ -400,25 +403,37 @@
"message": " at the bottom"
},
"options_append_child_tab_after": {
"message": "after parent (no automatic tree)"
"message": "after parent tab (no automatic tree)"
},
"options_append_orphan_tab": {
"message": "Append orphan tabs (new tabs, tabs opened from shortcuts or from bookmarks)"
"message": "Append orphan tabs"
},
"options_append_orphan_tab_top": {
"message": "at the top"
"message": "at the top of the group"
},
"options_append_orphan_tab_after_active": {
"message": "after active"
"message": "after active tab"
},
"options_append_orphan_tab_bottom": {
"message": "at the bottom"
"message": "at the bottom of the group"
},
"options_append_orphan_tab_as_child": {
"message": "treat as active's tab child"
},
"options_toolbar_new_tab": {
"message": "Toolbar + (new tab button) should append tab"
},
"options_toolbar_new_tab_as_regular_orphan": {
"message": "as a regular orphan tab (option above)"
},
"options_toolbar_new_tab_root_of_group": {
"message": "at the bottom of the group"
},
"options_after_closing_active_tab": {
"message": "After closing active tab,"
},
......@@ -590,15 +605,37 @@
},
"options_toolbar_look": {
"message": " Toolbar's look "
},
"hint_orphan_tab": {
"message": "Orphan tab is a tab opened from an external source, which can be:"
},
"hint_ctrl_t": {
"message": "ctrl+t shortcut"
},
"hint_from_pin": {
"message": "link that opens new tab from pinned tab"
},
"hint_from_bookmark": {
"message": "bookmark"
},
"hint_from_external_link": {
"message": "external link"
},
"hint_from_popup": {
"message": "popup opened as a tab (settings in browser, popup blocker or similar)"
},
"hint_explained_new_tab_settings": {
"message": "+ button in Tree Tabs toolbar, places new tabs in the root of the active group, unless set differently."
},
"hint_explained_orphan_after_active_settings": {
"message": "If 'Append orphan tabs' is set to 'after active' and active tab is not in active group, tab will append to the root of the active group instead. But only if sidebar is open."
},
"button_background": {
"message": "Toolbar buttons background"
......
......@@ -260,9 +260,7 @@ function QuantumLoadTabs(retry) {
QuantumAppendWinTTId(winId);
}
if (b.windows[winId].activeTabId == undefined) { // legacy
b.windows[winId].activeTabId = [0,0]; // legacy
} // legacy
b.windows[winId].activeTabId = 0; // legacy
for (let tIndex = 0; tIndex < tabsCount; tIndex++) {
......@@ -272,8 +270,7 @@ function QuantumLoadTabs(retry) {
let tabPinned = w[winIndex].tabs[tabIndex].pinned;
if (tab.active) {
b.windows[winId].activeTabId[0] = tabId;
b.windows[winId].activeTabId[1] = tabId;
b.windows[winId].activeTabId = tabId;
}
// LOAD TTID FROM FIREFOX GET TAB VALUE
......@@ -404,7 +401,7 @@ function QuantumAppendWinTTId(windowId) {
if (b.windows[windowId] != undefined) {
b.windows[windowId].ttid = NewTTWindowId;
} else {
b.windows[windowId] = {activeTabId: [0,0], ttid: NewTTWindowId, group_bar: opt.groups_toolbar_default, search_filter: "url", active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, active_tab: 0, active_tab_ttid: "", prev_active_tab: 0, prev_active_tab_ttid: "", name: labels.ungrouped_group, font: ""}}, folders: {}};
b.windows[windowId] = {activeTabId: 0, ttid: NewTTWindowId, group_bar: opt.groups_toolbar_default, search_filter: "url", active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, active_tab: 0, active_tab_ttid: "", prev_active_tab: 0, prev_active_tab_ttid: "", name: labels.ungrouped_group, font: ""}}, folders: {}};
}
// if (b.schedule_save > 0) browser.sessions.setWindowValue( windowId, "TTdata", b.windows[windowId] );
}
......@@ -493,8 +490,7 @@ function ChromiumLoadTabs(retry) {
ChromiumHashURL(w[wIndex].tabs[tabIndex]);
if (w[wIndex].tabs[tabIndex].active) {
b.windows[w[wIndex].id].activeTabId[0] = w[wIndex].tabs[tabIndex].id;
b.windows[w[wIndex].id].activeTabId[1] = w[wIndex].tabs[tabIndex].id;
b.windows[w[wIndex].id].activeTabId = w[wIndex].tabs[tabIndex].id;
}
}
......@@ -607,7 +603,7 @@ async function ChromiumAutoSaveData(BAK, LoopTimer) {
}
function ChromiumAddWindowData(winId) {
b.windows[winId] = {activeTabId: [0,0], group_bar: opt.groups_toolbar_default, search_filter: "url", active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, active_tab: 0, prev_active_tab: 0, name: labels.ungrouped_group, font: ""}}, folders: {}};
b.windows[winId] = {activeTabId: 0, group_bar: opt.groups_toolbar_default, search_filter: "url", active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, active_tab: 0, prev_active_tab: 0, name: labels.ungrouped_group, font: ""}}, folders: {}};
}
function ChromiumHashURL(tab) {
......
This diff is collapsed.
......@@ -14,7 +14,8 @@
"19": "icons/16.png",
"16": "icons/16.png"
},
"permissions": [ "tabs", "sessions", "storage", "unlimitedStorage", "bookmarks", "tabHide" ],
"permissions": [ "<all_urls>", "tabs", "sessions", "storage", "unlimitedStorage", "bookmarks", "tabHide" ],
"sidebar_action": {
"default_icon": {
"16": "icons/16.png",
......@@ -28,16 +29,6 @@
"browser_action": {
"default_icon": "icons/24.png"
},
"commands": {
"_execute_browser_action": {
"suggested_key": { "default": "F1" },
"description": "toggle Tree Tabs"
},
"close_tree": {
"suggested_key": { "default": "Alt+W" },
"description": "close tree"
}
},
"applications": {
"gecko": {
"id": "TreeTabs@jagiello.it",
......@@ -48,5 +39,11 @@
"page": "options.html",
"open_in_tab": true
},
"version": "1.7.1"
"commands": {
"close_tree": {
"suggested_key": { "default": "Alt+W" },
"description": "close tree"
}
},
"version": "100"
}
\ No newline at end of file
......@@ -221,6 +221,13 @@
<option class="bg_opt_drop_down_menu" id="options_append_orphan_tab_as_child" value="as_child"></option>
</select>
</li>
<li>
<label class="label" id="options_toolbar_new_tab"></label>
<select id="append_tab_from_toolbar">
<option class="bg_opt_drop_down_menu" id="options_toolbar_new_tab_as_regular_orphan" value="as_regular_orphan"></option>
<option class="bg_opt_drop_down_menu" id="options_toolbar_new_tab_root_of_group" value="group_root"></option>
</select>
</li>
<li>
<label class="label" id="options_after_closing_active_tab"></label>
<select id="after_closing_active_tab">
......@@ -270,6 +277,21 @@
</tr>
</table>
<br>
<p style="font-size:11px; color: red;" class="hint_explanation" id="hint_orphan_tab"></p>
<ul style="list-style-type:disc; font-size:11px;">
<li class="hint_explanation" id="hint_ctrl_t"></li>
<li class="hint_explanation" id="hint_from_pin"></li>
<li class="hint_explanation" id="hint_from_bookmark"></li>
<li class="hint_explanation" id="hint_from_external_link"></li>
<li class="hint_explanation" id="hint_from_popup"></li>
</ul>
<span style="display:block; font-size:11px; color: red;" class="hint_explanation" id="hint_explained_new_tab_settings"></span>
<span style="display:block; font-size:11px; color: red;" class="hint_explanation" id="hint_explained_orphan_after_active_settings"></span>
<br>
</fieldset>
......
......@@ -10,7 +10,7 @@ var SelectedTheme = Object.assign({}, DefaultTheme);
var dragged_button = {id: ""};
// options for all drop down menus
let DropDownList = ["dbclick_folder", "midclick_folder", "midclick_tab", "dbclick_group", "midclick_group", "dbclick_tab", "append_child_tab", "append_child_tab_after_limit", "append_orphan_tab", "after_closing_active_tab", "move_tabs_on_url_change"];
let DropDownList = ["dbclick_folder", "midclick_folder", "midclick_tab", "dbclick_group", "midclick_group", "dbclick_tab", "append_child_tab", "append_child_tab_after_limit", "append_orphan_tab", "append_tab_from_toolbar", "after_closing_active_tab", "move_tabs_on_url_change"];
document.addEventListener("DOMContentLoaded", function() {
document.title = "Tree Tabs";
......@@ -102,7 +102,7 @@ function AddRegexPair() {
// document events
function GetOptions(storage) {
// get language labels
document.querySelectorAll(".label, .set_button, .bg_opt_drop_down_menu").forEach(function(s){
document.querySelectorAll(".label, .set_button, .bg_opt_drop_down_menu, .hint_explanation").forEach(function(s){
s.textContent = chrome.i18n.getMessage(s.id);
});
......
......@@ -5,9 +5,9 @@
function AppendSampleTabs() {
// folders
AddNewFolder("f_folder1", "cftab_list", labels.noname_group, 0, "o", "o", false);
AddNewFolder("f_folder2", "f_folder1", labels.noname_group, 0, "c", "c", false);
AddNewFolder("f_folder3", "f_folder1", labels.noname_group, 0, "c", "c", false);
AddNewFolder({folderId: "f_folder1", ParentId: "cftab_list", Name: labels.noname_group, Index: 0, ExpandState: "o", AdditionalClass: "o"});
AddNewFolder({folderId: "f_folder2", ParentId: "f_folder1", Name: labels.noname_group, Index: 0, ExpandState: "c", AdditionalClass: "c"});
AddNewFolder({folderId: "f_folder3", ParentId: "f_folder1", Name: labels.noname_group, Index: 0, ExpandState: "c", AdditionalClass: "c"});
// pins
......
......@@ -567,7 +567,7 @@ function StartAutoSaveSession() {
let newName = d.toLocaleString().replace("/", ".").replace("/", ".").replace(":", "").replace(":", "");
ExportSession(newName, false, false, true);
ShowStatusBar({show: true, spinner: false, message: "Autosave: "+newName, hideTimeout: 1000});
ShowStatusBar({show: true, spinner: false, message: "Autosave: "+newName, hideTimeout: 1500});
if (document.getElementById("manager_window").style.top != "-500px") {
chrome.storage.local.get(null, function(storage) {
......
......@@ -22,6 +22,7 @@ let b = {
windows: {},
tabs: {},
tt_ids: {},
NewTabsQueue: [],
EmptyTabs: [],
newTabUrl: browserId == "F" ? "about:newtab" : "chrome://startpage/"
};
......@@ -57,6 +58,7 @@ const DefaultPreferences = {
append_child_tab_after_limit: "after",
append_orphan_tab: "bottom",
after_closing_active_tab: "below_seek_in_parent",
append_tab_from_toolbar: "group_root",
collapse_other_trees: false,
open_tree_on_hover: true,
promote_children: true,
......
......@@ -26,12 +26,24 @@ function SetEvents() {
}
}
}
document.oncontextmenu = function(event){
document.oncontextmenu = function (event) {
if (!event.ctrlKey && event.target.classList.contains("text_input") == false) {
event.preventDefault();
event.stopPropagation();
return false;
}
}
};
window.addEventListener('contextmenu', function (event) {
if (!event.ctrlKey && event.target.classList.contains("text_input") == false) {
event.preventDefault();
event.stopPropagation();
return false;
}
}, false);
document.body.onresize = function(event) {
RefreshGUI();
}
......@@ -197,10 +209,10 @@ function SetEvents() {
}
// new folder
// if (event.which == 91 && event.which == 71) {
// let FolderId = AddNewFolder({SetEvents: true});
// ShowRenameFolderDialog(FolderId);
// }
if (event.which == 192 && event.which == 70 && event.which == 69) {
let FolderId = AddNewFolder({SetEvents: true});
ShowRenameFolderDialog(FolderId);
}
RefreshGUI();
}
......
......@@ -27,6 +27,10 @@ function AppendFolder(folderId, Name, ParentId, Expand, SetEvents, AdditionalCla
let fd = document.createElement("div"); fd.className = ClassList; if (Expand) { fd.className += Expand } fd.id = folderId; // FOLDER
let fh = document.createElement("div"); fh.className = (opt.always_show_close && !opt.never_show_close) ? "folder_header close_show" : "folder_header"; fh.id = "folder_header"+folderId; if (SetEvents) {fh.draggable = true;} fd.appendChild(fh); // HEADER
let ex = document.createElement("div"); ex.className = "folder_icon"; ex.id = "fop"+folderId; fh.appendChild(ex);
let ftbc = document.createElement("div"); ftbc.className = "folder_counter"; ftbc.id = "folder_counter"+folderId; fh.appendChild(ftbc); // TABS COUNTER
let fbcn = document.createElement("div"); fbcn.className = "counter_number"; fbcn.id = "counter_number"+folderId; ftbc.appendChild(fbcn); // TABS COUNTER NUMBER
let ft = document.createElement("div"); ft.className = "folder_title"; ft.id = "folder_title"+folderId; ft.textContent = Name; fh.appendChild(ft); // TITLE
let cf = document.createElement("div"); cf.className = "children_folders"; cf.id = "cf"+folderId; fd.appendChild(cf);
let ct = document.createElement("div"); ct.className = "children_tabs"; ct.id = "ct"+folderId; fd.appendChild(ct);
......
......@@ -138,6 +138,13 @@ function StartSidebarListeners() {
}
if (message.command == "tab_created") {
if (message.InsertAfterId && document.querySelectorAll("#"+tt.active_group+" .tab").length == 0) {
message.InsertAfterId = undefined;
message.ParentId = tt.active_group;
}
AppendTab({tab: message.tab, ParentId: message.ParentId, InsertAfterId: message.InsertAfterId, Append: message.Append, Scroll: true});
RefreshExpandStates();
......
......@@ -108,7 +108,7 @@ function ShowFGroupMenu(GroupNode, event) {
HideMenus();
tt.menuItemNode = GroupNode;
document.querySelectorAll("#menu_new_group, #menu_rename_group, #menu_delete_group, #menu_delete_group_tabs_close, #separator_gunlo, #menu_groups_unload, #separator_gbk, #separator_tts, #menu_bookmark_group, #separator_tts, #menu_groups_hibernate, #menu_manager_window, #menu_treetabs_settings"</