bumpt to v1.3

This commit is contained in:
karol@jagiello.it 2018-01-01 19:50:56 +01:00
parent 87b6ffa9a7
commit ac290a8319
97 changed files with 3717 additions and 2431 deletions

BIN
..Screenshots/001.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
..Screenshots/002.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
..Screenshots/003.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
..Screenshots/004.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
..Screenshots/005.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

BIN
..Screenshots/006.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 169 KiB

View File

Before

Width:  |  Height:  |  Size: 166 KiB

After

Width:  |  Height:  |  Size: 166 KiB

View File

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

View File

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

View File

@ -32,6 +32,7 @@ menu: copy urls of the selected tabs
menu: bookmark selected tabs/tree menu: bookmark selected tabs/tree
menu: select all menu: select all
menu: invert selection menu: invert selection
menu: close above/close below
options: Customising the context menu options: Customising the context menu

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@
"19": "icons/16.png", "19": "icons/16.png",
"16": "icons/16.png" "16": "icons/16.png"
}, },
"permissions": [ "tabs", "sessions", "<all_urls>" ], "permissions": [ "tabs", "sessions", "<all_urls>", "storage" ],
"sidebar_action": { "sidebar_action": {
"default_icon": { "default_icon": {
@ -39,5 +39,5 @@
"page": "options.html", "page": "options.html",
"open_in_tab": true "open_in_tab": true
}, },
"version": "1.1" "version": "100"
} }

View File

@ -3,6 +3,5 @@
<head><meta charset="utf-8"/></head> <head><meta charset="utf-8"/></head>
<body></body> <body></body>
<script type="text/javascript" src="../scripts/global.js"></script> <script type="text/javascript" src="../scripts/global.js"></script>
<script type="text/javascript" src="../legacy.js"></script>
<script type="text/javascript" src="../bg_ff.js"></script> <script type="text/javascript" src="../bg_ff.js"></script>
</html> </html>

View File

@ -14,8 +14,7 @@
"19": "icons/16.png", "19": "icons/16.png",
"16": "icons/16.png" "16": "icons/16.png"
}, },
"permissions": [ "tabs", "sessions", "<all_urls>" ], "permissions": [ "tabs", "sessions", "<all_urls>", "storage" ],
"sidebar_action": { "sidebar_action": {
"default_icon": { "default_icon": {
"16": "icons/16.png", "16": "icons/16.png",
@ -29,6 +28,12 @@
"browser_action": { "browser_action": {
"default_icon": "icons/24.png" "default_icon": "icons/24.png"
}, },
"commands": {
"_execute_browser_action": {
"suggested_key": { "default": "F2" },
"description": "toggle Tree Tabs"
}
},
"applications": { "applications": {
"gecko": { "gecko": {
"id": "TreeTabs@jagiello.it", "id": "TreeTabs@jagiello.it",
@ -39,5 +44,5 @@
"page": "options.html", "page": "options.html",
"open_in_tab": true "open_in_tab": true
}, },
"version": "0.0.16" "version": "1.3"
} }

View File

@ -15,7 +15,7 @@
"19": "icons/16.png", "19": "icons/16.png",
"16": "icons/16.png" "16": "icons/16.png"
}, },
"permissions": [ "tabs", "sessions", "<all_urls>" ], "permissions": [ "tabs", "sessions", "<all_urls>", "storage" ],
"sidebar_action": { "sidebar_action": {
"default_icon": { "default_icon": {
"19": "icons/16.png", "19": "icons/16.png",

View File

@ -14,7 +14,7 @@
"19": "icons/16.png", "19": "icons/16.png",
"16": "icons/16.png" "16": "icons/16.png"
}, },
"permissions": [ "tabs", "sessions", "<all_urls>" ], "permissions": [ "tabs", "sessions", "<all_urls>", "storage" ],
"options_ui": { "options_ui": {
"page": "options.html", "page": "options.html",
"open_in_tab": false "open_in_tab": false

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="16"
viewBox="0 0 24 16"
id="svg4216"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="expand_closed_0.svg">
<defs
id="defs4218">
<pattern
y="0"
x="0"
height="6"
width="6"
patternUnits="userSpaceOnUse"
id="EMFhbasepattern" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="6.5114579"
inkscape:cy="8.289342"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1028"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:object-paths="true"
inkscape:snap-intersection-paths="true"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true" />
<metadata
id="metadata4221">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1036.3622)">
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect4145"
width="4"
height="4"
x="1"
y="1042.3622" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

77
..theme/expand_open_0.svg Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg4216"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="expand_open_0.svg">
<defs
id="defs4218">
<pattern
y="0"
x="0"
height="6"
width="6"
patternUnits="userSpaceOnUse"
id="EMFhbasepattern" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="14.269042"
inkscape:cy="8.1175815"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1028"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:object-paths="true"
inkscape:snap-intersection-paths="true"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true" />
<metadata
id="metadata4221">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1028.3622)">
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect4145"
width="6"
height="6"
x="1"
y="1037.3622" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

File diff suppressed because one or more lines are too long

BIN
Tree Tabs.zip Normal file

Binary file not shown.

View File

@ -76,7 +76,7 @@
"message": "Remove group.\nHold shift key to close tabs from this group" "message": "Remove group.\nHold shift key to close tabs from this group"
}, },
"button_edit_group": { "button_edit_group": {
"message": "Edit group" "message": "Rename group"
}, },
"button_import_group": { "button_import_group": {
@ -109,6 +109,23 @@
}, },
"button_folders": {
"message": "Folders"
},
"button_new_folder": {
"message": "New folder"
},
"button_remove_folder": {
"message": "Remove selected folder/s"
},
"button_edit_folder": {
"message": "Rename folder"
},
"tabs_menu_expand_all": { "tabs_menu_expand_all": {
@ -168,6 +185,35 @@
"folders_menu_new_folder": {
"message": "New folder"
},
"folders_menu_rename_folder": {
"message": "Rename folder"
},
"folders_menu_delete": {
"message": "Delete"
},
"groups_menu_new_group": {
"message": "New group"
},
"groups_menu_rename": {
"message": "Rename group"
},
"groups_menu_delete": {
"message": "Delete group"
},
"groups_menu_delete_tabs_close": {
"message": "Delete group with tabs"
},
"groups_menu_unload": {
"message": "Unload group"
},
@ -183,49 +229,49 @@
"message": " Pinned tabs bar " "message": " Pinned tabs bar "
}, },
"options_pin_list_multi_row": { "options_pin_list_multi_row": {
"message": "multi row list" "message": "Multi row list"
}, },
"option_allow_pin_close": { "option_allow_pin_close": {
"message": "allow to close pinned tabs" "message": "Allow to close pinned tabs"
}, },
"options_tabs": { "options_tabs": {
"message": " Tabs " "message": " Tabs "
}, },
"options_syncro_tabbar_tabs_order": { "options_syncro_tabbar_tabs_order": {
"message": "synchronise browser tabs order with Tree Tabs, tabs can be unresponsive for a second after drag&drop, but this option is needed for correct ctrl+tab switching" "message": "Synchronize browser tabs order with Tree Tabs, tabs can be unresponsive for a second after drag&drop. This option is needed for correct ctrl+tab switching"
}, },
"options_switch_with_scroll": { "options_switch_with_scroll": {
"message": "switch tabs with mouse wheel" "message": "Switch tabs with mouse wheel"
}, },
"options_close_with_MMB": { "options_close_with_MMB": {
"message": "close tabs with middle mouse button" "message": "Close tabs with middle mouse button"
}, },
"options_always_show_close": { "options_always_show_close": {
"message": "show close button on all tabs" "message": "Show close button on all tabs"
}, },
"options_never_show_close": { "options_never_show_close": {
"message": "don't show close button (option above will be ignored)" "message": "Don't show close button (option above will be ignored)"
}, },
"options_close_other_trees": { "options_close_other_trees": {
"message": "automatically collapse other trees on expand" "message": "Automatically collapse other trees on expand"
}, },
"options_open_tree_on_hover": { "options_open_tree_on_hover": {
"message": "auto expand collapsed trees when dragging and holding for a second over them" "message": "Auto expand collapsed trees when dragging and holding for a second over them"
}, },
"options_promote_children": { "options_promote_children": {
"message": "promote children tabs on close, if disabled, when closing the parent of a tree structure, all tabs will be closed (be careful, because undo close tab will not recover the trees structure)" "message": "Promote children tabs on close, if disabled, when closing the parent of a tree structure, all tabs will be closed (be careful, because undo close tab will not recover the trees structure)"
}, },
"options_promote_children_in_first_child": { "options_promote_children_in_first_child": {
"message": "promote first child tab as a parent" "message": "Promote first child tab as a parent"
}, },
"options_skip_load": { "options_skip_load": {
"message": "discard tree structure after browser's restart, this option is for those who don't use browser's session. Basically it disables loading database at startup." "message": "Discard tree structure after browser's restart, this option is for those who don't use browser's session. Basically it disables loading database at startup."
}, },
"options_append_child_tab": { "options_append_child_tab": {
"message": "append children tabs at the" "message": "Append children tabs at the"
}, },
"options_append_child_tab_top": { "options_append_child_tab_top": {
"message": "top (reverse hierarchy)" "message": "top (reverse hierarchy)"
@ -233,9 +279,12 @@
"options_append_child_tab_bottom": { "options_append_child_tab_bottom": {
"message": "bottom" "message": "bottom"
}, },
"options_append_child_tab_after_active": {
"message": "after active"
},
"options_append_orphan_tab": { "options_append_orphan_tab": {
"message": "append orphan tabs (new tabs, tabs opened from shortcuts or from bookmarks)" "message": "Append orphan tabs (new tabs, tabs opened from shortcuts or from bookmarks)"
}, },
"options_append_orphan_tab_top": { "options_append_orphan_tab_top": {
"message": "at the top" "message": "at the top"
@ -251,7 +300,7 @@
}, },
"options_after_closing_active_tab": { "options_after_closing_active_tab": {
"message": "after closing active tab," "message": "After closing active tab,"
}, },
"options_after_closing_active_tab_go_up": { "options_after_closing_active_tab_go_up": {
"message": "activate tab above" "message": "activate tab above"
@ -259,12 +308,18 @@
"options_after_closing_active_tab_go_down": { "options_after_closing_active_tab_go_down": {
"message": "activate tab below" "message": "activate tab below"
}, },
"options_after_closing_active_tab_go_up_seek_in_parent": {
"message": "activate tab above if on the same level"
},
"options_after_closing_active_tab_go_down_seek_in_parent": {
"message": "activate tab below if on the same level"
},
"options_after_closing_active_tab_go_browser": { "options_after_closing_active_tab_go_browser": {
"message": "let browser handle which tab to activate" "message": "let browser activate tab"
}, },
"options_append_child_tab_after_limit": { "options_append_child_tab_after_limit": {
"message": "once reached tree depth, place tab on the same level, but" "message": "Once reached tree depth, place tab on the same level, but"
}, },
"options_append_child_tab_after_limit_top": { "options_append_child_tab_after_limit_top": {
"message": "at the top" "message": "at the top"
@ -276,17 +331,17 @@
"message": "at the bottom" "message": "at the bottom"
}, },
"options_max_tree_drag_drop": { "options_max_tree_drag_drop": {
"message": "limit Drag&Drop to tree's maximum depth as well" "message": "Limit Drag&Drop to tree's maximum depth as well"
}, },
"options_show_counter_tabs": { "options_show_counter_tabs": {
"message": "show children tabs count on tab's title" "message": "Show children tabs count on tab's title"
}, },
"options_show_counter_tabs_hints": { "options_show_counter_tabs_hints": {
"message": "show children tabs count in tab's hint" "message": "Show children tabs count in tab's hint"
}, },
"options_max_tree_depth": { "options_max_tree_depth": {
"message": "maximum tree depth: set it to -1 for unlimited branches, 0 for flat tabs placement (no trees), any number above 0 will be its maximum" "message": "Maximum tree depth: set it to -1 for unlimited branches, 0 for flat tabs placement (no trees), any number above 0 will be its maximum"
}, },
@ -296,11 +351,14 @@
}, },
"options_show_counter_groups": { "options_show_counter_groups": {
"message": "show tabs count on groups" "message": "Show tabs count on groups"
}, },
"options_groups_toolbar_default": { "options_groups_toolbar_default": {
"message": "show groups toolbar in new windows" "message": "Show groups toolbar in new windows"
},
"options_syncro_tabbar_groups_tabs_order": {
"message": "Synchronize browser tabs order after drag&drop of the group tabs. Tabs will sort for a long time, if browser has a lot of tabs open. This option is needed for correct ctrl+tab switching"
}, },
@ -334,6 +392,9 @@
"options_export_theme_button": { "options_export_theme_button": {
"message": "Export" "message": "Export"
}, },
"options_share_theme_link": {
"message": "Get more!"
},
@ -475,6 +536,12 @@
"message": "Clear search result x button color" "message": "Clear search result x button color"
}, },
"close_x": {
"message": "x inside the close button"
},
"close_hover_x": {
"message": "x inside the close button on hover"
},
"options_color_pick_hover": { "options_color_pick_hover": {
"message": "On hover" "message": "On hover"
}, },
@ -587,6 +654,14 @@
}, },
"options_development": {
"message": "Development"
},
"options_debug": {
"message": "Debug"
},
@ -606,10 +681,23 @@
"folder_edit_button_cancel": {
"message": "Cancel"
},
"folder_edit_button_confirm": {
"message": "Ok"
},
"warning_exporting_big_amount_of_tabs": {
"message": "Importing big amount of tabs can make your browser unresponsive even for hours! Consider dividing your tabs to groups and exporting each group separately."
},
"caption_ungrouped_group": { "caption_ungrouped_group": {
"message": "Ungrouped" "message": "Ungrouped"
}, },

View File

@ -5,5 +5,4 @@
<script type="text/javascript" src="../scripts/global.js"></script> <script type="text/javascript" src="../scripts/global.js"></script>
<script type="text/javascript" src="../legacy.js"></script> <script type="text/javascript" src="../legacy.js"></script>
<script type="text/javascript" src="../bg_ch.js"></script> <script type="text/javascript" src="../bg_ch.js"></script>
<script type="text/javascript" src="../bg_ff.js"></script>
</html> </html>

265
bg_ch.js
View File

@ -3,112 +3,118 @@
// that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/ // that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/
if (browserId != "F") { if (browserId != "F") {
ConvertLegacyStorage();
LoadPreferences(); LoadPreferences();
GetCurrentTheme();
ChromeLoadTabs(0); ChromeLoadTabs(0);
ChromeMessageListeners(); ChromeMessageListeners();
} }
function ChromeLoadTabs(retry) { function ChromeLoadTabs(retry) {
chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) { chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) {
var refTabs = {}; chrome.storage.local.get(null, function(storage) {
var tabs_matched = 0; var refTabs = {};
// load tabs and windows from hdd var tabs_matched = 0;
var w_count = LoadData("w_count", 0); // load tabs and windows from storage.local
var t_count = LoadData("t_count", 0); var w_count = storage.w_count ? storage.w_count : 0;
var LoadedWindows = LoadData("windows", []); var t_count = storage.t_count ? storage.t_count : 0;
var LoadedTabs = LoadData("tabs", []); var LoadedWindows = storage.windows ? storage.windows : [];
// if loaded tabs mismatch by 50%, then try to load back var LoadedTabs = storage.tabs ? storage.tabs : [];
if (LoadedTabs.length < t_count*0.5 || retry > 0) { // if loaded tabs mismatch by 50%, then try to load back
LoadedTabs = LoadData("tabs_BAK"+retry, []); if (LoadedTabs.length < t_count*0.5 || retry > 0) {
} LoadedTabs = storage["tabs_BAK"+retry] ? storage["tabs_BAK"+retry] : [];
// if loaded windows mismatch, then try to load back
if (LoadedWindows.length < w_count || retry > 0) {
LoadedWindows = LoadData("windows_BAK"+retry, []);
}
// CACHED COUNTS
var WinCount = w.length;
var LoadedWinCount = LoadedWindows.length;
var LoadedTabsCount = LoadedTabs.length;
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
if (w[wIndex].tabs[0].url != "chrome://videopopout/") { // this is for opera for their extra video popup, which is weirdly queried as a "normal" window
let winId = w[wIndex].id;
let url1 = w[wIndex].tabs[0].url;
let url2 = w[wIndex].tabs[w[wIndex].tabs.length-1].url;
windows[winId] = {group_bar: opt.groups_toolbar_default, search_filter: "url", active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, activetab: 0, name: caption_ungrouped_group, font: ""}}, folders: {}};
for (var LwIndex = 0; LwIndex < LoadedWinCount; LwIndex++) {
if (LoadedWindows[LwIndex].url1 == url1 || LoadedWindows[LwIndex].url2 == url2) {
if (LoadedWindows[LwIndex].group_bar) { windows[winId].group_bar = LoadedWindows[LwIndex].group_bar; }
if (LoadedWindows[LwIndex].search_filter) { windows[winId].search_filter = LoadedWindows[LwIndex].search_filter; }
if (LoadedWindows[LwIndex].active_shelf) { windows[winId].active_shelf = LoadedWindows[LwIndex].active_shelf; }
if (LoadedWindows[LwIndex].active_group) { windows[winId].active_group = LoadedWindows[LwIndex].active_group; }
if (Object.keys(LoadedWindows[LwIndex].groups).length > 0) { windows[winId].groups = Object.assign({}, LoadedWindows[LwIndex].groups); }
if (Object.keys(LoadedWindows[LwIndex].folders).length > 0) { windows[winId].folders = Object.assign({}, LoadedWindows[LwIndex].folders); }
LoadedWindows[LwIndex].url1 = "";
LoadedWindows[LwIndex].url2 = "";
break;
}
}
} }
} // if loaded windows mismatch, then try to load back
for (var wIndex = 0; wIndex < WinCount; wIndex++) { if (LoadedWindows.length < w_count || retry > 0) {
var TabsCount = w[wIndex].tabs.length; LoadedWindows = storage["windows_BAK"+retry] ? storage["windows_BAK"+retry] : [];
for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) {
ChromeHashURL(w[wIndex].tabs[tabIndex]);
} }
} // CACHED COUNTS
// compare saved tabs from storage to current session tabs, but can be skipped if set in options var WinCount = w.length;
if (opt.skip_load == false && LoadedTabs.length > 0) { var LoadedWinCount = LoadedWindows.length;
// match loaded tabs var LoadedTabsCount = LoadedTabs.length;
for (var wIndex = 0; wIndex < WinCount; wIndex++) { for (var wIndex = 0; wIndex < WinCount; wIndex++) {
var TabsCount = w[wIndex].tabs.length; if (w[wIndex].tabs[0].url != "chrome://videopopout/") { // this is for opera for their extra video popup, which is weirdly queried as a "normal" window
for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) { let winId = w[wIndex].id;
for (var LtabIndex = 0; LtabIndex < LoadedTabsCount; LtabIndex++) { let url1 = w[wIndex].tabs[0].url;
let tabId = w[wIndex].tabs[tabIndex].id; let url2 = w[wIndex].tabs[w[wIndex].tabs.length-1].url;
if (LoadedTabs[LtabIndex].hash == tabs[tabId].hash && refTabs[LoadedTabs[LtabIndex].id] == undefined) { windows[winId] = {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, name: caption_ungrouped_group, font: ""}}, folders: {}};
refTabs[LoadedTabs[LtabIndex].id] = tabId; for (var LwIndex = 0; LwIndex < LoadedWinCount; LwIndex++) {
if (LoadedTabs[LtabIndex].parent) { tabs[tabId].parent = LoadedTabs[LtabIndex].parent; } if (LoadedWindows[LwIndex].url1 == url1 || LoadedWindows[LwIndex].url2 == url2) {
if (LoadedTabs[LtabIndex].index) { tabs[tabId].index = LoadedTabs[LtabIndex].index; } if (LoadedWindows[LwIndex].group_bar) { windows[winId].group_bar = LoadedWindows[LwIndex].group_bar; }
if (LoadedTabs[LtabIndex].expand) { tabs[tabId].expand = LoadedTabs[LtabIndex].expand; } if (LoadedWindows[LwIndex].search_filter) { windows[winId].search_filter = LoadedWindows[LwIndex].search_filter; }
LoadedTabs[LtabIndex].hash = undefined; if (LoadedWindows[LwIndex].active_shelf) { windows[winId].active_shelf = LoadedWindows[LwIndex].active_shelf; }
tabs_matched++; if (LoadedWindows[LwIndex].active_group) { windows[winId].active_group = LoadedWindows[LwIndex].active_group; }
if (Object.keys(LoadedWindows[LwIndex].groups).length > 0) { windows[winId].groups = Object.assign({}, LoadedWindows[LwIndex].groups); }
if (Object.keys(LoadedWindows[LwIndex].folders).length > 0) { windows[winId].folders = Object.assign({}, LoadedWindows[LwIndex].folders); }
LoadedWindows[LwIndex].url1 = "";
LoadedWindows[LwIndex].url2 = "";
break; break;
} }
} }
} }
} }
// replace parents tabIds for new ones, for that purpose refTabs was made before for (var wIndex = 0; wIndex < WinCount; wIndex++) {
for (var tabId in tabs) { var TabsCount = w[wIndex].tabs.length;
if (refTabs[tabs[tabId].parent] != undefined) { for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) {
tabs[tabId].parent = refTabs[tabs[tabId].parent]; ChromeHashURL(w[wIndex].tabs[tabIndex]);
} }
} }
} if (opt.skip_load == false && LoadedTabs.length > 0) { // compare saved tabs from storage to current session tabs, but can be skipped if set in options
// replace active tab ids for each group using refTabs for (var wIndex = 0; wIndex < WinCount; wIndex++) { // match loaded tabs
for (var windowId in windows) { var TabsCount = w[wIndex].tabs.length;
for (var group in windows[windowId].groups) { for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) {
if (refTabs[windows[windowId].groups[group].activetab]) { for (var LtabIndex = 0; LtabIndex < LoadedTabsCount; LtabIndex++) {
windows[windowId].groups[group].activetab = refTabs[windows[windowId].groups[group].activetab]; let tabId = w[wIndex].tabs[tabIndex].id;
if (LoadedTabs[LtabIndex].hash == tabs[tabId].hash && refTabs[LoadedTabs[LtabIndex].id] == undefined) {
refTabs[LoadedTabs[LtabIndex].id] = tabId;
if (LoadedTabs[LtabIndex].parent) { tabs[tabId].parent = LoadedTabs[LtabIndex].parent; }
if (LoadedTabs[LtabIndex].index) { tabs[tabId].index = LoadedTabs[LtabIndex].index; }
if (LoadedTabs[LtabIndex].expand) { tabs[tabId].expand = LoadedTabs[LtabIndex].expand; }
LoadedTabs[LtabIndex].hash = undefined;
tabs_matched++;
break;
}
}
}
}
// replace parents tabIds for new ones, for that purpose refTabs was made before
for (var tabId in tabs) {
if (refTabs[tabs[tabId].parent] != undefined) {
tabs[tabId].parent = refTabs[tabs[tabId].parent];
}
} }
} }
} // replace active tab ids for each group using refTabs
// will try to find tabs for 3 times for (var windowId in windows) {
if (opt.skip_load == true || retry > 2 || (tabs_matched > t_count*0.5)) { for (var group in windows[windowId].groups) {
schedule_save++; if (refTabs[windows[windowId].groups[group].active_tab]) {
running = true; windows[windowId].groups[group].active_tab = refTabs[windows[windowId].groups[group].active_tab];
ChromeAutoSaveData("", 1000); }
ChromeAutoSaveData("_BAK1", 300000); }
ChromeAutoSaveData("_BAK2", 600000); }
ChromeAutoSaveData("_BAK3", 1800000); // will try to find tabs for 3 times
ChromeListeners(); if (opt.skip_load == true || retry > 2 || (tabs_matched > t_count*0.5)) {
} else { schedule_save = 1;
setTimeout(function() {ChromeLoadTabs(retry+1);}, 2000); running = true;
} ChromeAutoSaveData(0, 1000);
ChromeAutoSaveData(1, 300000);
ChromeAutoSaveData(2, 600000);
ChromeAutoSaveData(3, 1800000);
ChromeListeners();
} else {
setTimeout(function() {
ChromeLoadTabs(retry+1);
}, 2000);
}
});
}); });
} }
// You maybe are asking yourself why I save tabs in array? It's because, instead of, keeping 2 index numbers (one for browser tabs on top and one for my index in tree), it's easier to just arrange them in order and save it in localstorage. // You maybe are asking yourself why I save tabs in array? It's because, instead of, keeping 2 index numbers (one for browser tabs on top and one for my index in tree), it's easier to just arrange them in order and save it in localstorage.
// Another reason is that Object does not preserve order in chrome, I've been told that in Firefox it is. But I can't trust that. // Another reason is that Object does not preserve order in chrome, I've been told that in Firefox it is. But I can't trust that.
async function ChromeAutoSaveData(BackupName, LoopTimer) { async function ChromeAutoSaveData(BAK, LoopTimer) {
setInterval(function() { setInterval(function() {
if (schedule_save > 1 || BackupName != "") {schedule_save = 1;} if (schedule_save > 1 || BAK > 0) {
schedule_save = 1;
}
if (running && schedule_save > 0 && Object.keys(tabs).length > 1) { if (running && schedule_save > 0 && Object.keys(tabs).length > 1) {
chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) { chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) {
var WinCount = w.length; var WinCount = w.length;
@ -116,17 +122,14 @@ async function ChromeAutoSaveData(BackupName, LoopTimer) {
var counter = 0; var counter = 0;
var Windows = []; var Windows = [];
var Tabs = []; var Tabs = [];
for (var wIndex = 0; wIndex < WinCount; wIndex++) { for (var wIndex = 0; wIndex < WinCount; wIndex++) {
t_count += w[wIndex].tabs.length; t_count += w[wIndex].tabs.length;
} }
for (var wIndex = 0; wIndex < WinCount; wIndex++) { for (var wIndex = 0; wIndex < WinCount; wIndex++) {
let winId = w[wIndex].id; let winId = w[wIndex].id;
if (windows[winId] != undefined && windows[winId].group_bar != undefined && windows[winId].search_filter != undefined && windows[winId].active_shelf != undefined && windows[winId].active_group != undefined && windows[winId].groups != undefined && windows[winId].folders != undefined) { if (windows[winId] != undefined && windows[winId].group_bar != undefined && windows[winId].search_filter != undefined && windows[winId].active_shelf != undefined && windows[winId].active_group != undefined && windows[winId].groups != undefined && windows[winId].folders != undefined) {
Windows.push({url1: w[wIndex].tabs[0].url, url2: w[wIndex].tabs[w[wIndex].tabs.length-1].url, group_bar: windows[winId].group_bar, search_filter: windows[winId].search_filter, active_shelf: windows[winId].active_shelf, active_group: windows[winId].active_group, groups: windows[winId].groups, folders: windows[winId].folders}); Windows.push({url1: w[wIndex].tabs[0].url, url2: w[wIndex].tabs[w[wIndex].tabs.length-1].url, group_bar: windows[winId].group_bar, search_filter: windows[winId].search_filter, active_shelf: windows[winId].active_shelf, active_group: windows[winId].active_group, groups: windows[winId].groups, folders: windows[winId].folders});
} }
let TabsCount = w[wIndex].tabs.length; let TabsCount = w[wIndex].tabs.length;
for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) { for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) {
let tabId = w[wIndex].tabs[tabIndex].id; let tabId = w[wIndex].tabs[tabIndex].id;
@ -136,10 +139,28 @@ async function ChromeAutoSaveData(BackupName, LoopTimer) {
} }
} }
if (counter == t_count) { if (counter == t_count) {
localStorage["t_count"] = JSON.stringify(t_count); chrome.storage.local.set({t_count: t_count});
localStorage["w_count"] = JSON.stringify(WinCount); chrome.storage.local.set({w_count: WinCount});
localStorage["windows"+BackupName] = JSON.stringify(Windows);
localStorage["tabs"+BackupName] = JSON.stringify(Tabs); if (BAK == 0) {
chrome.storage.local.set({windows: Windows});
chrome.storage.local.set({tabs: Tabs});
}
if (BAK == 1) {
chrome.storage.local.set({windows_BAK1: Windows});
chrome.storage.local.set({tabs_BAK1: Tabs});
chrome.runtime.sendMessage({command: "backup_available", bak: 1});
}
if (BAK == 2) {
chrome.storage.local.set({windows_BAK2: Windows});
chrome.storage.local.set({tabs_BAK2: Tabs});
chrome.runtime.sendMessage({command: "backup_available", bak: 2});
}
if (BAK == 3) {
chrome.storage.local.set({windows_BAK3: Windows});
chrome.storage.local.set({tabs_BAK3: Tabs});
chrome.runtime.sendMessage({command: "backup_available", bak: 3});
}
} }
} }
schedule_save--; schedule_save--;
@ -147,53 +168,44 @@ async function ChromeAutoSaveData(BackupName, LoopTimer) {
} }
}, LoopTimer); }, LoopTimer);
} }
function ChromeHashURL(tab){ function ChromeHashURL(tab) {
if (tabs[tab.id] == undefined) { if (tabs[tab.id] == undefined) {
tabs[tab.id] = {hash: 0, parent: tab.pinned ? "pin_list" : "tab_list", index: tab.index, expand: "n"}; tabs[tab.id] = {hash: 0, parent: tab.pinned ? "pin_list" : "tab_list", index: tab.index, expand: "n"};
} }
var hash = 0; var hash = 0;
for (var charIndex = 0; charIndex < tab.url.length; charIndex++){ for (var charIndex = 0; charIndex < tab.url.length; charIndex++) {
hash += tab.url.charCodeAt(charIndex); hash += tab.url.charCodeAt(charIndex);
} }
tabs[tab.id].hash = hash; tabs[tab.id].hash = hash;
} }
function ReplaceParents(oldTabId, newTabId) { function ReplaceParents(oldTabId, newTabId) {
for (var tabId in tabs) { for (var tabId in tabs) {
if (tabs[tabId].parent == oldTabId) { if (tabs[tabId].parent == oldTabId) {
tabs[tabId].parent = newTabId; tabs[tabId].parent = newTabId;
} }
} }
// TO DO FOLDERS
} }
function ChromeListeners() { // start all listeners
// start all listeners
function ChromeListeners() {
chrome.tabs.onCreated.addListener(function(tab) { chrome.tabs.onCreated.addListener(function(tab) {
ChromeHashURL(tab); ChromeHashURL(tab);
chrome.runtime.sendMessage({command: "tab_created", windowId: tab.windowId, tab: tab, tabId: tab.id}); chrome.runtime.sendMessage({command: "tab_created", windowId: tab.windowId, tab: tab, tabId: tab.id});
schedule_save++; schedule_save++;
}); });
chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) { chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) {
setTimeout(function() { chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId}); },5); setTimeout(function() { chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId}); },5);
delete tabs[tabId]; delete tabs[tabId];
schedule_save++; schedule_save++;
}); });
chrome.tabs.onAttached.addListener(function(tabId, attachInfo) { chrome.tabs.onAttached.addListener(function(tabId, attachInfo) {
chrome.tabs.get(tabId, function(tab) { chrome.tabs.get(tabId, function(tab) {
chrome.runtime.sendMessage({command: "tab_attached", windowId: attachInfo.newWindowId, tab: tab, tabId: tabId, ParentId: tabs[tabId].parent}); chrome.runtime.sendMessage({command: "tab_attached", windowId: attachInfo.newWindowId, tab: tab, tabId: tabId, ParentId: tabs[tabId].parent});
}); });
schedule_save++; schedule_save++;
}); });
chrome.tabs.onDetached.addListener(function(tabId, detachInfo) { chrome.tabs.onDetached.addListener(function(tabId, detachInfo) {
chrome.runtime.sendMessage({command: "tab_detached", windowId: detachInfo.oldWindowId, tabId: tabId}); chrome.runtime.sendMessage({command: "tab_detached", windowId: detachInfo.oldWindowId, tabId: tabId});
schedule_save++; schedule_save++;
}); });
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (tabs[tabId] == undefined || changeInfo.url != undefined) { if (tabs[tabId] == undefined || changeInfo.url != undefined) {
ChromeHashURL(tab); ChromeHashURL(tab);
@ -209,11 +221,9 @@ function ChromeListeners() {
} }
chrome.runtime.sendMessage({command: "tab_updated", windowId: tab.windowId, tab: tab, tabId: tabId, changeInfo: changeInfo}); chrome.runtime.sendMessage({command: "tab_updated", windowId: tab.windowId, tab: tab, tabId: tabId, changeInfo: changeInfo});
}); });
chrome.tabs.onMoved.addListener(function(tabId, moveInfo) { chrome.tabs.onMoved.addListener(function(tabId, moveInfo) {
schedule_save++; schedule_save++;
}); });
chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) { chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) {
chrome.tabs.get(addedTabId, function(tab) { chrome.tabs.get(addedTabId, function(tab) {
if (addedTabId == removedTabId) { if (addedTabId == removedTabId) {
@ -232,35 +242,48 @@ function ChromeListeners() {
schedule_save++; schedule_save++;
}); });
}); });
chrome.tabs.onActivated.addListener(function(activeInfo) { chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.runtime.sendMessage({command: "tab_activated", windowId: activeInfo.windowId, tabId: activeInfo.tabId}); chrome.runtime.sendMessage({command: "tab_activated", windowId: activeInfo.windowId, tabId: activeInfo.tabId});
}); });
chrome.windows.onCreated.addListener(function(window) { chrome.windows.onCreated.addListener(function(window) {
windows[window.id] = {group_bar: opt.groups_toolbar_default, search_filter: "url", active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, activetab: 0, name: caption_ungrouped_group, font: ""}}, folders: {}}; windows[window.id] = {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, name: caption_ungrouped_group, font: ""}}, folders: {}};
schedule_save++; schedule_save++;
}); });
chrome.windows.onRemoved.addListener(function(windowId) { chrome.windows.onRemoved.addListener(function(windowId) {
delete windows[windowId]; delete windows[windowId];
schedule_save++; schedule_save++;
}); });
chrome.runtime.onSuspend.addListener(function() { chrome.runtime.onSuspend.addListener(function() {
running = false; running = false;
}); });
} }
function ChromeMessageListeners() { function ChromeMessageListeners() {
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
log("message to background: ");
log(message);
switch(message.command) { switch(message.command) {
case "reload": case "reload":
window.location.reload(); window.location.reload();
break; break;
case "get_preferences":
sendResponse(opt);
break;
case "save_preferences":
opt = Object.assign({}, message.opt);
chrome.storage.local.set({preferences: message.opt});
break;
case "get_windows": case "get_windows":
sendResponse(windows); sendResponse(windows);
break; break;
case "get_folders":
if (windows[message.windowId]) {
sendResponse(windows[message.windowId].folders);
}
break;
case "save_folders":
windows[message.windowId].folders = Object.assign({}, message.folders);
schedule_save++;
break;
case "get_groups": case "get_groups":
if (windows[message.windowId]) { if (windows[message.windowId]) {
sendResponse(windows[message.windowId].groups); sendResponse(windows[message.windowId].groups);
@ -270,7 +293,6 @@ function ChromeMessageListeners() {
windows[message.windowId].groups = Object.assign({}, message.groups); windows[message.windowId].groups = Object.assign({}, message.groups);
schedule_save++; schedule_save++;
break; break;
case "set_active_group": case "set_active_group":
windows[message.windowId].active_group = message.active_group; windows[message.windowId].active_group = message.active_group;
schedule_save++; schedule_save++;
@ -280,11 +302,6 @@ function ChromeMessageListeners() {
sendResponse(windows[message.windowId].active_group); sendResponse(windows[message.windowId].active_group);
} }
break; break;
case "set_search_filter": case "set_search_filter":
windows[message.windowId].search_filter = message.search_filter; windows[message.windowId].search_filter = message.search_filter;
schedule_save++; schedule_save++;
@ -294,10 +311,6 @@ function ChromeMessageListeners() {
sendResponse(windows[message.windowId].search_filter); sendResponse(windows[message.windowId].search_filter);
} }
break; break;
case "set_active_shelf": case "set_active_shelf":
windows[message.windowId].active_shelf = message.active_shelf; windows[message.windowId].active_shelf = message.active_shelf;
schedule_save++; schedule_save++;
@ -316,13 +329,13 @@ function ChromeMessageListeners() {
sendResponse(windows[message.windowId].group_bar); sendResponse(windows[message.windowId].group_bar);
} }
break; break;
case "console_log": // case "console_log":
console.log(message.m); // console.log(message.m);
break; // break;
case "get_browser_tabs": case "get_browser_tabs":
sendResponse(tabs); sendResponse(tabs);
break; break;
case "is_bg_running": case "is_bg_ready":
sendResponse(running); sendResponse(running);
break; break;
case "update_tab": case "update_tab":
@ -334,9 +347,11 @@ function ChromeMessageListeners() {
} }
break; break;
case "get_theme": case "get_theme":
let theme = LoadData(("theme"+localStorage["current_theme"]), {"TabsSizeSetNumber": 2, "ToolbarShow": true, "toolbar": DefaultToolbar});
sendResponse(theme); sendResponse(theme);
break; break;
case "reload_theme":
GetCurrentTheme();
break;
} }
}); });
} }

215
bg_ff.js
View File

@ -3,42 +3,29 @@
// that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/ // that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/
if (browserId == "F") { if (browserId == "F") {
ConvertLegacyStorage();
FirefoxStart(0);
LoadPreferences(); LoadPreferences();
FirefoxStart(); GetCurrentTheme();
FirefoxMessageListeners(); FirefoxMessageListeners();
} }
function FirefoxStart(retry) {
chrome.windows.getAll({windowTypes: ["normal"], populate: true}, function(w) {
function FirefoxStart() { FirefoxLoadTabs(0);
var SafeToRun = true; if (w[0].tabs.length == 1 && (w[0].tabs[0].url == "about:blank" || w[0].tabs[0].url == "about:sessionrestore")) {
chrome.tabs.query({}, function(t) { setTimeout(function() {
// will loop forever if session restore tab is found FirefoxStart(retry+1);
for (var tabIndex = 0; tabIndex < t.length; tabIndex++) { }, 2000);
if (t[tabIndex].url.match("about:sessionrestore") && t.length < 10) { } else {
SafeToRun = false; if (retry > 0) {
chrome.tabs.update(t[tabIndex].id, { active: true }); chrome.runtime.sendMessage({command: "reload_sidebar"});
}
if (tabIndex == t.length-1) {
if (SafeToRun) {
if (localStorage.getItem("t0") !== null){
LoadV015(0);
} else {
if (localStorage.getItem("tabs") !== null){
FirefoxLoadV100(0);
} else {
FirefoxLoadTabs(0);
}
}
} else {
setTimeout(function() {
FirefoxStart();
}, 1000);
}
} }
setTimeout(function() {
schedule_save = 0;
}, 2000);
} }
}); });
} }
function FirefoxLoadTabs(retry) { function FirefoxLoadTabs(retry) {
chrome.windows.getAll({windowTypes: ["normal"], populate: true}, function(w) { chrome.windows.getAll({windowTypes: ["normal"], populate: true}, function(w) {
var tt_ids = {}; var tt_ids = {};
@ -47,12 +34,10 @@ function FirefoxLoadTabs(retry) {
for (var wIndex = 0; wIndex < w.length; wIndex++) { for (var wIndex = 0; wIndex < w.length; wIndex++) {
tabs_count += w[wIndex].tabs.length; tabs_count += w[wIndex].tabs.length;
} }
// CACHED COUNTS AND STUFF // CACHED COUNTS AND STUFF
var lastWinId = w[w.length-1].id; var lastWinId = w[w.length-1].id;
var lastTabId = w[w.length-1].tabs[w[w.length-1].tabs.length-1].id; var lastTabId = w[w.length-1].tabs[w[w.length-1].tabs.length-1].id;
var WinCount = w.length; var WinCount = w.length;
for (var wIndex = 0; wIndex < WinCount; wIndex++) { for (var wIndex = 0; wIndex < WinCount; wIndex++) {
let winIndex = wIndex; let winIndex = wIndex;
let winId = w[winIndex].id; let winId = w[winIndex].id;
@ -60,18 +45,15 @@ function FirefoxLoadTabs(retry) {
// LOAD TTID FROM FIREFOX GET WINDOW VALUE // LOAD TTID FROM FIREFOX GET WINDOW VALUE
let win = Promise.resolve(browser.sessions.getWindowValue(winId, "TTdata")).then(function(WindowData) { let win = Promise.resolve(browser.sessions.getWindowValue(winId, "TTdata")).then(function(WindowData) {
if (opt.skip_load == false && WindowData != undefined) { if (opt.skip_load == false && WindowData != undefined) {
windows[winId] = Object.assign({}, WindowData); windows[winId] = Object.assign({}, WindowData);
} else { } else {
windows[winId] = {ttid: "", group_bar: opt.groups_toolbar_default, search_filter: "url", active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, activetab: 0, activetab_ttid: "", name: caption_ungrouped_group, font: ""}}, folders: {}}; windows[winId] = {ttid: "", 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: "", name: caption_ungrouped_group, font: ""}}, folders: {}};
} }
for (var tIndex = 0; tIndex < tabsCount; tIndex++) { for (var tIndex = 0; tIndex < tabsCount; tIndex++) {
let tabIndex = tIndex; let tabIndex = tIndex;
let tabId = w[winIndex].tabs[tabIndex].id; let tabId = w[winIndex].tabs[tabIndex].id;
let tabPinned = w[winIndex].tabs[tabIndex].pinned; let tabPinned = w[winIndex].tabs[tabIndex].pinned;
// LOAD TTID FROM FIREFOX GET TAB VALUE // LOAD TTID FROM FIREFOX GET TAB VALUE
let tab = Promise.resolve(browser.sessions.getTabValue(tabId, "TTdata")).then(function(TabData) { let tab = Promise.resolve(browser.sessions.getTabValue(tabId, "TTdata")).then(function(TabData) {
if (opt.skip_load == false && TabData != undefined) { if (opt.skip_load == false && TabData != undefined) {
@ -81,17 +63,16 @@ function FirefoxLoadTabs(retry) {
} else { } else {
tabs[tabId] = {ttid: "", parent_ttid: "", parent: tabPinned ? "pin_list" : "tab_list", index: tabIndex, expand: "n"}; tabs[tabId] = {ttid: "", parent_ttid: "", parent: tabPinned ? "pin_list" : "tab_list", index: tabIndex, expand: "n"};
} }
// IF ON LAST TAB AND LAST WINDOW, START MATCHING LOADED DATA // IF ON LAST TAB AND LAST WINDOW, START MATCHING LOADED DATA
if (tabId == lastTabId && winId == lastWinId) { if (tabId == lastTabId && winId == lastWinId) {
for (var ThisSessonWinId in windows) { for (var ThisSessonWinId in windows) {
if (windows[ThisSessonWinId].ttid == ""){ if (windows[ThisSessonWinId].ttid == "") {
AppendWinTTId(parseInt(ThisSessonWinId)); AppendWinTTId(parseInt(ThisSessonWinId));
} }
} }
// OK, DONE WITH WINDOWS, START TABS LOOP // OK, DONE WITH WINDOWS, START TABS LOOP
for (var ThisSessonTabId in tabs) { for (var ThisSessonTabId in tabs) {
if (tabs[ThisSessonTabId].ttid == ""){ if (tabs[ThisSessonTabId].ttid == "") {
AppendTabTTId(parseInt(ThisSessonTabId)); AppendTabTTId(parseInt(ThisSessonTabId));
} }
} }
@ -101,28 +82,26 @@ function FirefoxLoadTabs(retry) {
tabs[ThisSessonTabId].parent = tt_ids[tabs[ThisSessonTabId].parent_ttid]; tabs[ThisSessonTabId].parent = tt_ids[tabs[ThisSessonTabId].parent_ttid];
} }
} }
// OK, SAME THING FOR ACTIVE TABS IN GROUPS // OK, SAME THING FOR ACTIVE TABS IN GROUPS
for (var ThisSessonWinId in windows) { for (var ThisSessonWinId in windows) {
for (var group in windows[ThisSessonWinId].groups) { for (var group in windows[ThisSessonWinId].groups) {
if (tt_ids[windows[ThisSessonWinId].groups[group].activetab_ttid] != undefined) { if (tt_ids[windows[ThisSessonWinId].groups[group].active_tab_ttid] != undefined) {
windows[ThisSessonWinId].groups[group].activetab = tt_ids[windows[ThisSessonWinId].groups[group].activetab_ttid]; windows[ThisSessonWinId].groups[group].active_tab = tt_ids[windows[ThisSessonWinId].groups[group].active_tab_ttid];
} }
} }
} }
// TODO
// replace parent tab ids for each folder using reference_tabs, unless tabs will be nested ONLY in tabs and folders ONLY in folders, I did not decide yet
// will try to find tabs for 3 times // will try to find tabs for 3 times
if (opt.skip_load == true || retry > 2 || (tabs_matched > tabs_count*0.5)) { if (opt.skip_load == true || retry > 2 || (tabs_matched > tabs_count*0.5)) {
running = true; running = true;
// setInterval(function() {
FirefoxAutoSaveData(); FirefoxAutoSaveData();
// }, 10000);
FirefoxListeners(); FirefoxListeners();
} else { } else {
setTimeout(function() {FirefoxLoadTabs(retry+1);}, 2000); setTimeout(function() {
FirefoxLoadTabs(retry+1);
}, 2000);
} }
} }
}); });
} }
@ -130,11 +109,12 @@ function FirefoxLoadTabs(retry) {
} }
}); });
} }
// save every second if there is anything to save obviously // save every second if there is anything to save obviously
async function FirefoxAutoSaveData() { async function FirefoxAutoSaveData() {
setInterval(function() { setInterval(function() {
if (schedule_save > 1) {schedule_save = 1;} if (schedule_save > 1) {
schedule_save = 1;
}
if (running && schedule_save > 0 && Object.keys(tabs).length > 1) { if (running && schedule_save > 0 && Object.keys(tabs).length > 1) {
chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) { chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) {
var WinCount = w.length; var WinCount = w.length;
@ -156,8 +136,7 @@ async function FirefoxAutoSaveData() {
} }
}, 1000); }, 1000);
} }
function GenerateNewWindowID() {
function GenerateNewWindowID(){
var newID = "w_"+GenerateRandomID(); var newID = "w_"+GenerateRandomID();
var newIdAvailable = true; var newIdAvailable = true;
for (var windowId in windows) { for (var windowId in windows) {
@ -171,8 +150,7 @@ function GenerateNewWindowID(){
GenerateNewWindowID(); GenerateNewWindowID();
} }
} }
function GenerateNewTabID() {
function GenerateNewTabID(){
var newID = "t_"+GenerateRandomID(); var newID = "t_"+GenerateRandomID();
var newIdAvailable = true; var newIdAvailable = true;
for (var tabId in tabs) { for (var tabId in tabs) {
@ -186,97 +164,85 @@ function GenerateNewTabID(){
GenerateNewTabID(); GenerateNewTabID();
} }
} }
function AppendTabTTId(tabId) {
function AppendTabTTId(tabId){
let NewTTTabId = GenerateNewTabID(); let NewTTTabId = GenerateNewTabID();
if (tabs[tabId] != undefined) { if (tabs[tabId] != undefined) {
tabs[tabId].ttid = NewTTTabId; tabs[tabId].ttid = NewTTTabId;
} else { } else {
tabs[tabId] = {ttid: NewTTTabId, parent: "tab_list", parent_ttid: "", index: 0, expand: "n"}; tabs[tabId] = {ttid: NewTTTabId, parent: "tab_list", parent_ttid: "", index: 0, expand: "n"};
} }
browser.sessions.setTabValue( tabId, "TTdata", tabs[tabId] ); // if (schedule_save > 0) browser.sessions.setTabValue( tabId, "TTdata", tabs[tabId] );
} }
function AppendWinTTId(windowId){ function AppendWinTTId(windowId) {
let NewTTWindowId = GenerateNewWindowID(); let NewTTWindowId = GenerateNewWindowID();
if (windows[windowId] != undefined) { if (windows[windowId] != undefined) {
windows[windowId].ttid = NewTTWindowId; windows[windowId].ttid = NewTTWindowId;
} else { } else {
windows[windowId] = {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, activetab: 0, activetab_ttid: "", name: caption_ungrouped_group, font: ""}}, folders: {}}; windows[windowId] = {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: "", name: caption_ungrouped_group, font: ""}}, folders: {}};
} }
browser.sessions.setWindowValue( windowId, "TTdata", windows[windowId] ); // if (schedule_save > 0) browser.sessions.setWindowValue( windowId, "TTdata", windows[windowId] );
} }
function ReplaceParents(oldTabId, newTabId) { function ReplaceParents(oldTabId, newTabId) {
for (var tabId in tabs) { for (var tabId in tabs) {
if (tabs[tabId].parent == oldTabId) { if (tabs[tabId].parent == oldTabId) {
console.log("replaced tab id "+oldTabId+" with "+newTabId);
tabs[tabId].parent = newTabId; tabs[tabId].parent = newTabId;
} }
} }
// TO DO FOLDERS
} }
var DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA = {}; var DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA = {};
// start all listeners // start all listeners
function FirefoxListeners() { function FirefoxListeners() {
// browser.commands.onCommand.addListener(function(command) {
// if (command == "open_sidebar") {
// browser.sidebarAction.setPanel({panel: (browser.extension.getURL("/sidebar.html")) });
// browser.sidebarAction.open();
// }
// chrome.windows.getLastFocused({windowTypes: ["normal"]}, function(window) {
// if (CurrentWindowId == window.id) {
// if (command == "open_sidebar") {
// ActivatePrevTab();
// }
// }
// });
// });
browser.browserAction.onClicked.addListener(function() { browser.browserAction.onClicked.addListener(function() {
browser.sidebarAction.setPanel({panel: (browser.extension.getURL("/sidebar.html")) }); browser.sidebarAction.setPanel({panel: (browser.extension.getURL("/sidebar.html")) });
browser.sidebarAction.open(); browser.sidebarAction.open();
}); });
chrome.tabs.onCreated.addListener(function(tab) { chrome.tabs.onCreated.addListener(function(tab) {
AppendTabTTId(tab.id); let t = Promise.resolve(browser.sessions.getTabValue(tab.id, "TTdata")).then(function(TabData) {
if (TabData != undefined) {
tabs[tab.id] = Object.assign({}, TabData);
} else {
AppendTabTTId(tab.id);
}
schedule_save++;
});
chrome.runtime.sendMessage({command: "tab_created", windowId: tab.windowId, tab: tab, tabId: tab.id}); chrome.runtime.sendMessage({command: "tab_created", windowId: tab.windowId, tab: tab, tabId: tab.id});
schedule_save++; schedule_save++;
}); });
chrome.tabs.onAttached.addListener(function(tabId, attachInfo) { chrome.tabs.onAttached.addListener(function(tabId, attachInfo) {
chrome.tabs.get(tabId, function(tab) { let oldId = tabId;
ReplaceParents(tabId, tab.id); chrome.tabs.get(oldId, function(tab) {
DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId] = tab.id; ReplaceParents(oldId, tab.id);
tabs[tab.id] = tabs[tabId]; tabs[tab.id] = tabs[oldId];
AppendTabTTId(tab.id); DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[oldId] = tab.id;
// let ParentId = DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabs[tabId].parent] ? DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabs[tabId].parent] : tabs[tabId].parent; DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tab.id] = oldId;
// chrome.runtime.sendMessage({command: "tab_attached", windowId: attachInfo.newWindowId, tab: tab, tabId: tabId, ParentId: ParentId}); browser.sessions.setTabValue( tab.id, "TTdata", tabs[oldId] );
chrome.runtime.sendMessage({command: "tab_attached", windowId: attachInfo.newWindowId, tab: tab, tabId: tabId, ParentId: tabs[tabId].parent}); chrome.runtime.sendMessage({command: "tab_attached", windowId: attachInfo.newWindowId, tab: tab, tabId: tab.id, ParentId: tabs[tab.id].parent});
schedule_save++; schedule_save++;
}); });
}); });
chrome.tabs.onDetached.addListener(function(tabId, detachInfo) { chrome.tabs.onDetached.addListener(function(tabId, detachInfo) {
let detachTabId = tabId; chrome.runtime.sendMessage({command: "tab_detached", windowId: detachInfo.oldWindowId, tabId: tabId});
let detachTabId = tabId;
if (DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId] != undefined) { if (DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId] != undefined) {
detachTabId = DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId]; detachTabId = DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId];
setTimeout(function() { chrome.runtime.sendMessage({command: "tab_detached", windowId: detachInfo.oldWindowId, tabId: DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId]});
delete DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId];
},2000);
} }
chrome.runtime.sendMessage({command: "tab_detached", windowId: detachInfo.oldWindowId, tabId: detachTabId});
}); });
chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) { chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) {
setTimeout(function() { chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId}); },5); setTimeout(function() {
delete tabs[tabId]; if (DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId] != undefined) {
chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA[tabId]});
}
chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId});
}, 5);
// setTimeout(function() {
// delete tabs[tabId];
// },60000);
schedule_save++; schedule_save++;
}); });
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (changeInfo.pinned == true) { if (changeInfo.pinned == true) {
tabs[tabId].parent = "pin_list"; tabs[tabId].parent = "pin_list";
@ -288,7 +254,6 @@ function FirefoxListeners() {
} }
chrome.runtime.sendMessage({command: "tab_updated", windowId: tab.windowId, tab: tab, tabId: tabId, changeInfo: changeInfo}); chrome.runtime.sendMessage({command: "tab_updated", windowId: tab.windowId, tab: tab, tabId: tabId, changeInfo: changeInfo});
}); });
chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) { chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) {
chrome.tabs.get(addedTabId, function(tab) { chrome.tabs.get(addedTabId, function(tab) {
if (addedTabId == removedTabId) { if (addedTabId == removedTabId) {
@ -300,7 +265,7 @@ function FirefoxListeners() {
ReplaceParents(tabId, tab.id); ReplaceParents(tabId, tab.id);
chrome.runtime.sendMessage({command: "tab_removed", windowId: tab.windowId, tabId: removedTabId}); chrome.runtime.sendMessage({command: "tab_removed", windowId: tab.windowId, tabId: removedTabId});
chrome.runtime.sendMessage({command: "tab_attached", windowId: tab.windowId, tab: tab, tabId: addedTabId, ParentId: tabs[addedTabId].parent}); chrome.runtime.sendMessage({command: "tab_attached", windowId: tab.windowId, tab: tab, tabId: addedTabId, ParentId: tabs[addedTabId].parent});
delete tabs[removedTabId]; // delete tabs[removedTabId];
} }
setTimeout(function() { setTimeout(function() {
AppendTabTTId(addedTabId); AppendTabTTId(addedTabId);
@ -309,31 +274,51 @@ function FirefoxListeners() {
}); });
}); });
chrome.tabs.onActivated.addListener(function(activeInfo) { chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.runtime.sendMessage({command: "tab_activated", windowId: activeInfo.windowId, tabId: activeInfo.tabId}); chrome.runtime.sendMessage({command: "tab_activated", windowId: activeInfo.windowId, tabId: activeInfo.tabId});
}); });
chrome.windows.onCreated.addListener(function(window) { chrome.windows.onCreated.addListener(function(window) {
AppendWinTTId(window.id); let win = Promise.resolve(browser.sessions.getWindowValue(window.id, "TTdata")).then(function(WindowData) {
schedule_save++; if (WindowData != undefined) {
windows[winId] = Object.assign({}, WindowData);
} else {
AppendWinTTId(window.id);
}
schedule_save++;
});
}); });
chrome.windows.onRemoved.addListener(function(windowId) { chrome.windows.onRemoved.addListener(function(windowId) {
delete windows[windowId]; // delete windows[windowId];
schedule_save++; schedule_save++;
}); });
} }
function FirefoxMessageListeners() { function FirefoxMessageListeners() {
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
log("message to background: ");
log(message);
switch(message.command) { switch(message.command) {
case "reload": case "reload":
window.location.reload(); window.location.reload();
break; break;
case "get_preferences":
sendResponse(opt);
break;
case "save_preferences":
opt = Object.assign({}, message.opt);
chrome.storage.local.set({preferences: message.opt});
break;
case "get_windows": case "get_windows":
sendResponse(windows); sendResponse(windows);
break; break;
case "get_folders":
if (windows[message.windowId]) {
sendResponse(windows[message.windowId].folders);
}
break;
case "save_folders":
windows[message.windowId].folders = Object.assign({}, message.folders);
schedule_save++;
break;
case "get_groups": case "get_groups":
if (windows[message.windowId]) { if (windows[message.windowId]) {
sendResponse(windows[message.windowId].groups); sendResponse(windows[message.windowId].groups);
@ -342,8 +327,8 @@ function FirefoxMessageListeners() {
case "save_groups": case "save_groups":
windows[message.windowId].groups = Object.assign({}, message.groups); windows[message.windowId].groups = Object.assign({}, message.groups);
for (var group in windows[message.windowId].groups) { for (var group in windows[message.windowId].groups) {
if (tabs[windows[message.windowId].groups[group].activetab]) { if (tabs[windows[message.windowId].groups[group].active_tab]) {
windows[message.windowId].groups[group].activetab_ttid = tabs[windows[message.windowId].groups[group].activetab].ttid; windows[message.windowId].groups[group].active_tab_ttid = tabs[windows[message.windowId].groups[group].active_tab].ttid;
} }
} }
schedule_save++; schedule_save++;
@ -384,13 +369,13 @@ function FirefoxMessageListeners() {
sendResponse(windows[message.windowId].group_bar); sendResponse(windows[message.windowId].group_bar);
} }
break; break;
case "console_log": // case "console_log":
console.log(message.m); // console.log(message.m);
break; // break;
case "get_browser_tabs": case "get_browser_tabs":
sendResponse(tabs); sendResponse(tabs);
break; break;
case "is_bg_running": case "is_bg_ready":
sendResponse(running); sendResponse(running);
break; break;
case "update_tab": case "update_tab":
@ -413,9 +398,11 @@ function FirefoxMessageListeners() {
} }
break; break;
case "get_theme": case "get_theme":
let theme = LoadData(("theme"+localStorage["current_theme"]), {"TabsSizeSetNumber": 2, "ToolbarShow": true, "toolbar": DefaultToolbar});
sendResponse(theme); sendResponse(theme);
break; break;
case "reload_theme":
GetCurrentTheme();
break;
} }
}); });
} }

View File

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html>
<head><meta charset="utf-8"/></head>
<body></body>
<script type="text/javascript" src="../scripts/global.js"></script>
<script type="text/javascript" src="../bg_v015_to_v1.js"></script>
<script type="text/javascript" src="../bg_ch.js"></script>
</html>

View File

@ -1,341 +0,0 @@
// 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);
} else {
LoadPreferences();
ChromeLoadTabs(0);
ChromeMessageListeners();
}
function ChromeLoadTabs(retry) {
chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) {
var refTabs = {};
var tabs_matched = 0;
// load tabs and windows from hdd
var w_count = LoadData("w_count", 0);
var t_count = LoadData("t_count", 0);
var LoadedWindows = LoadData("windows", []);
var LoadedTabs = LoadData("tabs", []);
// if loaded tabs mismatch by 50%, then try to load back
if (LoadedTabs.length < t_count*0.5 || retry > 0) {
LoadedTabs = LoadData("tabs_BAK"+retry, []);
}
// if loaded windows mismatch, then try to load back
if (LoadedWindows.length < w_count || retry > 0) {
LoadedWindows = LoadData("windows_BAK"+retry, []);
}
// CACHED COUNTS
var WinCount = w.length;
var LoadedWinCount = LoadedWindows.length;
var LoadedTabsCount = LoadedTabs.length;
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
if (w[wIndex].tabs[0].url != "chrome://videopopout/") { // this is for opera for their extra video popup, which is weirdly queried as a "normal" window
let winId = w[wIndex].id;
let url1 = w[wIndex].tabs[0].url;
let url2 = w[wIndex].tabs[w[wIndex].tabs.length-1].url;
windows[winId] = {group_bar: true, active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, activetab: 0, name: caption_ungrouped_group, font: ""}}, folders: {}};
for (var LwIndex = 0; LwIndex < LoadedWinCount; LwIndex++) {
if (LoadedWindows[LwIndex].url1 == url1 || LoadedWindows[LwIndex].url2 == url2) {
windows[winId].group_bar = LoadedWindows[LwIndex].group_bar;
windows[winId].active_shelf = LoadedWindows[LwIndex].active_shelf;
windows[winId].active_group = LoadedWindows[LwIndex].active_group;
if (Object.keys(LoadedWindows[LwIndex].groups).length > 0) { windows[winId].groups = Object.assign({}, LoadedWindows[LwIndex].groups); }
if (Object.keys(LoadedWindows[LwIndex].folders).length > 0) { windows[winId].folders = Object.assign({}, LoadedWindows[LwIndex].folders); }
LoadedWindows[LwIndex].url1 = "";
LoadedWindows[LwIndex].url2 = "";
break;
}
}
}
}
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
var TabsCount = w[wIndex].tabs.length;
for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) {
ChromeHashURL(w[wIndex].tabs[tabIndex]);
}
}
// compare saved tabs from storage to current session tabs, but can be skipped if set in options
if (opt.skip_load == false && LoadedTabs.length > 0) {
// match loaded tabs
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
var TabsCount = w[wIndex].tabs.length;
for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) {
for (var LtabIndex = 0; LtabIndex < LoadedTabsCount; LtabIndex++) {
let tabId = w[wIndex].tabs[tabIndex].id;
if (LoadedTabs[LtabIndex].hash == tabs[tabId].hash && refTabs[LoadedTabs[LtabIndex].id] == undefined) {
refTabs[LoadedTabs[LtabIndex].id] = tabId;
tabs[tabId].parent = LoadedTabs[LtabIndex].parent;
tabs[tabId].index = LoadedTabs[LtabIndex].index;
tabs[tabId].expand = LoadedTabs[LtabIndex].expand;
LoadedTabs[LtabIndex].hash = undefined;
tabs_matched++;
break;
}
}
}
}
// replace parents tabIds for new ones, for that purpose refTabs was made before
for (var tabId in tabs) {
if (refTabs[tabs[tabId].parent] != undefined) {
tabs[tabId].parent = refTabs[tabs[tabId].parent];
}
}
}
// replace active tab ids for each group using refTabs
for (var windowId in windows) {
for (var group in windows[windowId].groups) {
if (refTabs[windows[windowId].groups[group].activetab]) {
windows[windowId].groups[group].activetab = refTabs[windows[windowId].groups[group].activetab];
}
}
}
// will try to find tabs for 3 times
if (opt.skip_load == true || retry > 2 || (tabs_matched > t_count*0.5)) {
schedule_save++;
hold = false;
ChromeAutoSaveData("", 1000);
ChromeAutoSaveData("_BAK1", 300000);
ChromeAutoSaveData("_BAK2", 600000);
ChromeAutoSaveData("_BAK3", 1800000);
ChromeListeners();
} else {
setTimeout(function() {ChromeLoadTabs(retry+1);}, 2000);
}
});
}
// You maybe are asking yourself why I save tabs in array? It's because, instead of, keeping 2 index numbers (one for browser tabs on top and one for my index in tree), it's easier to just arrange them in order and save it in localstorage.
// Another reason is that Object does not preserve order in chrome, I've been told that in Firefox it is. But I can't trust that.
async function ChromeAutoSaveData(BackupName, LoopTimer) {
setTimeout(function() {
ChromeAutoSaveData(BackupName, LoopTimer);
if (schedule_save > 1 || BackupName != "") {schedule_save = 1;}
if (!hold && schedule_save > 0 && Object.keys(tabs).length > 1) {
chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) {
var WinCount = w.length;
var t_count = 0;
var counter = 0;
var Windows = [];
var Tabs = [];
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
t_count += w[wIndex].tabs.length;
}
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
let winId = w[wIndex].id;
if (windows[winId] != undefined && windows[winId].group_bar != undefined && windows[winId].active_shelf != undefined && windows[winId].active_group != undefined && windows[winId].groups != undefined && windows[winId].folders != undefined) {
Windows.push({url1: w[wIndex].tabs[0].url, url2: w[wIndex].tabs[w[wIndex].tabs.length-1].url, group_bar: windows[winId].group_bar, active_shelf: windows[winId].active_shelf, active_group: windows[winId].active_group, groups: windows[winId].groups, folders: windows[winId].folders});
}
let TabsCount = w[wIndex].tabs.length;
for (var tabIndex = 0; tabIndex < TabsCount; tabIndex++) {
let tabId = w[wIndex].tabs[tabIndex].id;
if (tabs[tabId] != undefined && tabs[tabId].hash != undefined && tabs[tabId].parent != undefined && tabs[tabId].index != undefined && tabs[tabId].expand != undefined) {
Tabs.push({id: tabId, hash: tabs[tabId].hash, parent: tabs[tabId].parent, index: tabs[tabId].index, expand: tabs[tabId].expand});
counter++;
}
}
if (counter == t_count) {
localStorage["t_count"] = JSON.stringify(t_count);
localStorage["w_count"] = JSON.stringify(WinCount);
localStorage["windows"+BackupName] = JSON.stringify(Windows);
localStorage["tabs"+BackupName] = JSON.stringify(Tabs);
}
}
schedule_save--;
});
}
}, LoopTimer);
}
function ChromeHashURL(tab){
if (tabs[tab.id] == undefined) {
tabs[tab.id] = {hash: 0, parent: tab.pinned ? "pin_list" : "tab_list", index: tab.index, expand: "n"};
}
var hash = 0;
for (var charIndex = 0; charIndex < tab.url.length; charIndex++){
hash += tab.url.charCodeAt(charIndex);
}
tabs[tab.id].hash = hash;
}
function ReplaceParents(oldTabId, newTabId) {
for (var tabId in tabs) {
if (tabs[tabId].parent == oldTabId) {
tabs[tabId].parent = newTabId;
}
}
// TO DO FOLDERS
}
// start all listeners
function ChromeListeners() {
chrome.tabs.onCreated.addListener(function(tab) {
ChromeHashURL(tab);
chrome.runtime.sendMessage({command: "tab_created", windowId: tab.windowId, tab: tab, tabId: tab.id});
schedule_save++;
});
chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) {
chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId});
delete tabs[tabId];
schedule_save++;
});
chrome.tabs.onAttached.addListener(function(tabId, attachInfo) {
chrome.tabs.get(tabId, function(tab) {
chrome.runtime.sendMessage({command: "tab_attached", windowId: attachInfo.newWindowId, tab: tab, tabId: tabId, ParentId: tabs[tabId].parent});
});
schedule_save++;
});
chrome.tabs.onDetached.addListener(function(tabId, detachInfo) {
chrome.runtime.sendMessage({command: "tab_detached", windowId: detachInfo.oldWindowId, tabId: tabId});
schedule_save++;
});
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (tabs[tabId] == undefined || changeInfo.url != undefined) {
ChromeHashURL(tab);
}
if (changeInfo.pinned != undefined) {
schedule_save++;
}
if (changeInfo.pinned == true) {
tabs[tabId].parent = "pin_list";
}
if (changeInfo.title != undefined && !tab.active) {
chrome.runtime.sendMessage({command: "tab_attention", windowId: tab.windowId, tabId: tabId});
}
chrome.runtime.sendMessage({command: "tab_updated", windowId: tab.windowId, tab: tab, tabId: tabId, changeInfo: changeInfo});
});
chrome.tabs.onMoved.addListener(function(tabId, moveInfo) {
schedule_save++;
});
chrome.tabs.onReplaced.addListener(function(addedTabId, removedTabId) {
chrome.tabs.get(addedTabId, function(tab) {
if (addedTabId == removedTabId) {
chrome.runtime.sendMessage({command: "tab_updated", windowId: tab.windowId, tab: tab, tabId: tab.id, changeInfo: {status: tab.status, url: tab.url, title: tab.title, audible: tab.audible, mutedInfo: tab.mutedInfo}});
} else {
ReplaceParents(tabId, tab.id);
if (tabs[removedTabId]) {
tabs[addedTabId] = tabs[removedTabId];
} else {
ChromeHashURL(tab);
}
chrome.runtime.sendMessage({command: "tab_removed", windowId: tab.windowId, tabId: removedTabId});
chrome.runtime.sendMessage({command: "tab_attached", windowId: tab.windowId, tab: tab, tabId: addedTabId});
delete tabs[removedTabId];
}
schedule_save++;
});
});
chrome.tabs.onActivated.addListener(function(activeInfo) {
chrome.runtime.sendMessage({command: "tab_activated", windowId: activeInfo.windowId, tabId: activeInfo.tabId});
});
chrome.windows.onCreated.addListener(function(window) {
windows[window.id] = {group_bar: true, active_shelf: "", active_group: "tab_list", groups: {tab_list: {id: "tab_list", index: 0, activetab: 0, name: caption_ungrouped_group, font: ""}}, folders: {}};
schedule_save++;
});
chrome.windows.onRemoved.addListener(function(windowId) {
delete windows[windowId];
schedule_save++;
});
chrome.runtime.onSuspend.addListener(function() {
hold = true;
});
}
function ChromeMessageListeners() {
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
switch(message.command) {
case "reload":
window.location.reload();
break;
case "get_windows":
sendResponse(windows);
break;
case "get_groups":
if (windows[message.windowId]) {
sendResponse(windows[message.windowId].groups);
}
break;
case "save_groups":
windows[message.windowId].groups = Object.assign({}, message.groups);
schedule_save++;
break;
case "set_active_group":
windows[message.windowId].active_group = message.active_group;
schedule_save++;
break;
case "get_active_group":
if (windows[message.windowId]) {
sendResponse(windows[message.windowId].active_group);
}
break;
case "set_active_shelf":
windows[message.windowId].active_shelf = message.active_shelf;
schedule_save++;
break;
case "get_active_shelf":
if (windows[message.windowId]) {
sendResponse(windows[message.windowId].active_shelf);
}
break;
case "set_group_bar":
windows[message.windowId].group_bar = message.group_bar;
schedule_save++;
break;
case "get_group_bar":
if (windows[message.windowId]) {
sendResponse(windows[message.windowId].group_bar);
}
break;
case "console_log":
console.log(message.m);
break;
case "get_browser_tabs":
sendResponse(tabs);
break;
case "is_bg_busy":
sendResponse(hold);
break;
case "update_tab":
if (tabs[message.tabId]) {
for (var parameter in message.tab) {
tabs[message.tabId][parameter] = message.tab[parameter];
}
schedule_save++;
}
break;
}
});
}

View File

@ -105,8 +105,6 @@ function LoadV015(retry){
}); });
} }
function FirefoxLoadV100(retry) { function FirefoxLoadV100(retry) {
chrome.windows.getAll({windowTypes: ["normal"], populate: true}, function(w) { chrome.windows.getAll({windowTypes: ["normal"], populate: true}, function(w) {
@ -251,3 +249,99 @@ function FirefoxLoadV100(retry) {
} }
}); });
} }
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", {});
}
if (browserId != "F") {
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;
}
}

View File

@ -14,30 +14,10 @@
"19": "icons/16.png", "19": "icons/16.png",
"16": "icons/16.png" "16": "icons/16.png"
}, },
"permissions": [ "tabs", "sessions", "<all_urls>" ], "permissions": [ "tabs", "sessions", "<all_urls>", "storage" ],
"sidebar_action": {
"default_icon": {
"16": "icons/16.png",
"19": "icons/16.png",
"38": "icons/38.png"
},
"default_panel": "sidebar.html",
"default_title": "Tree Tabs",
"browser_style": false
},
"browser_action": {
"default_icon": "icons/24.png"
},
"applications": {
"gecko": {
"id": "TreeTabs@jagiello.it",
"strict_min_version": "57.0"
}
},
"options_ui": { "options_ui": {
"page": "options.html", "page": "options.html",
"open_in_tab": true "open_in_tab": false
}, },
"version": "1.1" "version": "1.0"
} }

View File

@ -67,6 +67,11 @@
<td style="position:relative;left:2px;width:3px;">-</td> <td style="position:relative;left:2px;width:3px;">-</td>
<td class="label" id="options_show_counter_groups"></td> <td class="label" id="options_show_counter_groups"></td>
</tr> </tr>
<tr>
<td><input type="checkbox" class="opt_checkbox bg_opt" id="syncro_tabbar_groups_tabs_order"></input></td>
<td style="position:relative;left:2px;width:3px;">-</td>
<td class="label" id="options_syncro_tabbar_groups_tabs_order"></td>
</tr>
</table> </table>
</fieldset> </fieldset>
@ -151,6 +156,7 @@
<select id="append_child_tab"> <select id="append_child_tab">
<option class="bg_opt_drop_down_menu" id="options_append_child_tab_top" value="top"></option> <option class="bg_opt_drop_down_menu" id="options_append_child_tab_top" value="top"></option>
<option class="bg_opt_drop_down_menu" id="options_append_child_tab_bottom" value="bottom"></option> <option class="bg_opt_drop_down_menu" id="options_append_child_tab_bottom" value="bottom"></option>
<option class="bg_opt_drop_down_menu" id="options_append_child_tab_after_active" value="after_active"></option>
</select> </select>
</li> </li>
<li> <li>
@ -167,6 +173,8 @@
<select id="after_closing_active_tab"> <select id="after_closing_active_tab">
<option class="bg_opt_drop_down_menu" id="options_after_closing_active_tab_go_up" value="above"></option> <option class="bg_opt_drop_down_menu" id="options_after_closing_active_tab_go_up" value="above"></option>
<option class="bg_opt_drop_down_menu" id="options_after_closing_active_tab_go_down" value="below"></option> <option class="bg_opt_drop_down_menu" id="options_after_closing_active_tab_go_down" value="below"></option>
<option class="bg_opt_drop_down_menu" id="options_after_closing_active_tab_go_up_seek_in_parent" value="above_seek_in_parent"></option>
<option class="bg_opt_drop_down_menu" id="options_after_closing_active_tab_go_down_seek_in_parent" value="below_seek_in_parent"></option>
<option class="bg_opt_drop_down_menu" id="options_after_closing_active_tab_go_browser" value="browser"></option> <option class="bg_opt_drop_down_menu" id="options_after_closing_active_tab_go_browser" value="browser"></option>
</select> </select>
</li> </li>
@ -197,12 +205,14 @@
<select id="theme_list" style="padding-right:6px;"></select> <select id="theme_list" style="padding-right:6px;"></select>
<input type="text" id="new_theme_name" name="untitled" value="untitled"></input> <input type="text" id="new_theme_name" name="untitled" value="untitled"></input>
<button class="set_button" type="button" id="options_rename_theme_button" style="margin:10px;">Rename</button> <button class="set_button" type="button" id="options_rename_theme_button" style="margin:6px;">Rename</button>
<button class="set_button" type="button" id="options_add_theme_button" style="margin:10px;">Add new</button> <button class="set_button" type="button" id="options_add_theme_button" style="margin:6px;">Add new</button>
<button class="set_button" type="button" id="options_remove_theme_button" style="margin:10px;">Remove</button> <button class="set_button" type="button" id="options_remove_theme_button" style="margin:6px;">Remove</button>
<button class="set_button" type="button" id="options_import_theme_button" style="margin:10px;">Import</button> <button class="set_button" type="button" id="options_import_theme_button" style="margin:6px;">Import</button>
<button class="set_button" type="button" id="options_export_theme_button" style="margin:10px;">Export</button> <button class="set_button" type="button" id="options_export_theme_button" style="margin:6px;">Export</button>
<button class="set_button" type="button" id="options_share_theme_link" style="margin:6px;">Export</button>
<br>
<br>
<fieldset class="field" id="field_show_toolbar" style="position: relative; width:816px;"> <fieldset class="field" id="field_show_toolbar" style="position: relative; width:816px;">
<legend id="toolbar_legend"> <legend id="toolbar_legend">
<input type="checkbox" style="position:relative; top:-1px;" id="show_toolbar"></input> <input type="checkbox" style="position:relative; top:-1px;" id="show_toolbar"></input>
@ -285,7 +295,10 @@
<div class="pick_col color_bucket" id="scrollbar_track"></div> <div class="pick_col color_bucket" id="scrollbar_track"></div>
<div class="pin_list" id="pin_list"></div> <div class="pin_list" id="pin_list"></div>
<div class="group" id="tab_list"></div> <div class="group" id="tab_list">
<div class="children_folders" id="cftab_list"></div>
<div class="children_tabs" id="chtab_list"></div>
</div>
<div id="pin_list_scrollbar"><div id="pin_list_scrollbar_thumb"></div></div> <div id="pin_list_scrollbar"><div id="pin_list_scrollbar_thumb"></div></div>
<div id="group_scrollbar"><div id="group_scrollbar_thumb"></div></div> <div id="group_scrollbar"><div id="group_scrollbar_thumb"></div></div>
@ -356,6 +369,18 @@
</fieldset> </fieldset>
</fieldset> </fieldset>
<fieldset class="field"">
<legend class="label" id="options_development"></legend>
<table style="display:inline-block;">
<tr>
<td><input type="checkbox" class="opt_checkbox bg_opt" id="debug"></input></td>
<td style="position:relative;left:2px;width:3px;">-</td>
<td class="label" id="options_debug"></td>
</tr>
</table>
</fieldset>
<button class="set_button" type="button" id="options_clear_data" style="margin:10px;"></button> <button class="set_button" type="button" id="options_clear_data" style="margin:10px;"></button>
<input type="color" id="color_picker" style="position:absolute; left:-500px; top:-500px; overflow:hidden; user-select: none; -moz-user-select: none;"> <input type="color" id="color_picker" style="position:absolute; left:-500px; top:-500px; overflow:hidden; user-select: none; -moz-user-select: none;">

View File

@ -88,11 +88,11 @@ body {
overflow: hidden; overflow: hidden;
margin-bottom:15px; margin-bottom:15px;
} }
ul:not(#tabs_menu) { ul:not(.menu) {
padding-left: 22px; padding-left: 22px;
} }
ul:not(#tabs_menu) li { ul:not(.menu) li {
margin: 5px; margin: 5px;
} }
.label { .label {

View File

@ -4,33 +4,37 @@
// ********** OPTIONS *************** // ********** OPTIONS ***************
var current_theme = "";
var themes = []; var themes = [];
var SelectedTheme = Object.assign({}, DefaultTheme); var SelectedTheme = Object.assign({}, DefaultTheme);
var dragged_button; var dragged_button;
active_group = "tab_list"; active_group = "tab_list";
document.addEventListener("DOMContentLoaded", function() { document.addEventListener("DOMContentLoaded", function() {
LoadPreferences();
document.title = "Tree Tabs"; document.title = "Tree Tabs";
chrome.runtime.sendMessage({command: "get_preferences"}, function(response) {
themes = LoadData("themes", []); opt = Object.assign({}, response);
if (localStorage.getItem("current_theme") != null) { chrome.storage.local.get(null, function(items) {
LoadTheme(localStorage["current_theme"]); if (items["themes"]) {
} for (var themeName in items["themes"]) {
themes.push(themeName);
GetOptions(); }
RefreshFields(); }
SetEvents(); if (items["current_theme"]) {
SetToolbarShelfToggle("click"); current_theme = items["current_theme"];
LoadTheme(items["current_theme"]);
AppendGroupToList("tab_list", caption_ungrouped_group, ""); }
AppendGroupToList("tab_list2", caption_ungrouped_group, ""); GetOptions();
RefreshFields();
AppendSampleTabs(); SetEvents();
SetToolbarShelfToggle("click");
AppendGroupToList("tab_list", caption_ungrouped_group, "");
AppendGroupToList("tab_list2", caption_noname_group, "");
AppendSampleTabs();
});
});
}); });
// document events // document events
function GetOptions() { function GetOptions() {
// get language labels // get language labels
@ -59,10 +63,10 @@ function GetOptions() {
$(this)[0].textContent = chrome.i18n.getMessage(this.id); $(this)[0].textContent = chrome.i18n.getMessage(this.id);
}); });
// get language for color pick labels // get language for color pick labels
$("#close_x, #close_hover_x").each(function() {
$(this).attr("title", chrome.i18n.getMessage(this.id));
});
$(".color_border").each(function() { $(".color_border").each(function() {
$(this).attr("title", chrome.i18n.getMessage("options_color_pick_border")); $(this).attr("title", chrome.i18n.getMessage("options_color_pick_border"));
}); });
@ -83,9 +87,6 @@ function GetOptions() {
$(this).attr("title", chrome.i18n.getMessage("options_color_pick_filter_clear_icon")); $(this).attr("title", chrome.i18n.getMessage("options_color_pick_filter_clear_icon"));
}); });
// get options for append child tab // get options for append child tab
for (var i = 0; i < $("#append_child_tab")[0].options.length; i++) { for (var i = 0; i < $("#append_child_tab")[0].options.length; i++) {
if ($("#append_child_tab")[0].options[i].value === opt.append_child_tab) { if ($("#append_child_tab")[0].options[i].value === opt.append_child_tab) {
@ -132,15 +133,13 @@ function GetOptions() {
// select current theme in dropdown list // select current theme in dropdown list
for (var i = 0; i < $("#theme_list")[0].options.length; i++) { for (var i = 0; i < $("#theme_list")[0].options.length; i++) {
if ($("#theme_list")[0].options[i].value == localStorage["current_theme"]) { if ($("#theme_list")[0].options[i].value == current_theme) {
$("#theme_list")[0].selectedIndex = i; $("#theme_list")[0].selectedIndex = i;
break; break;
} }
} }
} }
function RemoveRedPreview() { function RemoveRedPreview() {
if (document.styleSheets[document.styleSheets.length-1].cssRules.length) { if (document.styleSheets[document.styleSheets.length-1].cssRules.length) {
document.styleSheets[document.styleSheets.length-1].deleteRule(document.styleSheets[document.styleSheets.length-1].cssRules.length-1); document.styleSheets[document.styleSheets.length-1].deleteRule(document.styleSheets[document.styleSheets.length-1].cssRules.length-1);
@ -153,6 +152,10 @@ function SetEvents() {
// --------------------------------DONATIONS------------------------------------------------------------------------------ // --------------------------------DONATIONS------------------------------------------------------------------------------
// Donate // Donate
$(document).on("click", "#options_share_theme_link", function(event) {
chrome.tabs.create({url: "https://drive.google.com/drive/folders/0B3jXQpRtOfvSelFrTEVHZEx3Nms?usp=sharing"});
});
$(document).on("click", "#donate_paypal", function(event) { $(document).on("click", "#donate_paypal", function(event) {
chrome.tabs.create({url: "https://www.paypal.me/KarolJagiello/1"}); chrome.tabs.create({url: "https://www.paypal.me/KarolJagiello/1"});
}); });
@ -168,8 +171,6 @@ function SetEvents() {
}); });
// --------------------------------COPY VIVALDI LINK---------------------------------------------------------------------- // --------------------------------COPY VIVALDI LINK----------------------------------------------------------------------
$(document).on("click", "#copy_vivaldi_url_for_web_panel", function(event) { $(document).on("click", "#copy_vivaldi_url_for_web_panel", function(event) {
@ -239,7 +240,7 @@ function SetEvents() {
// filter_box_font // filter_box_font
$(document).on("mouseenter", "#options_tab_list_scrollbar_width_up, #options_tab_list_scrollbar_width_down", function(event) { $(document).on("mouseenter", "#options_tab_list_scrollbar_width_up, #options_tab_list_scrollbar_width_down", function(event) {
$("#group_scrollbar, #group_scrollbar_thumb").css({ "background-color": "red" }); $("#group_scrollbar, #group_scrollbar_thumb").css({ "background-color": "red" });
@ -279,7 +280,6 @@ function SetEvents() {
// show color picker // show color picker
$(document).on("click", ".pick_col", function(event) { $(document).on("click", ".pick_col", function(event) {
RemoveRedPreview(); RemoveRedPreview();
// if (event.shiftKey || event.ctrlKey) return;
event.stopPropagation(); event.stopPropagation();
PickColor = this.id; PickColor = this.id;
let bod = document.getElementById("body"); let bod = document.getElementById("body");
@ -295,8 +295,6 @@ function SetEvents() {
}); });
// ----------------------------------EVENTS FOR CHECKBOXES AND DROPDOWN MENUS--------------------------------------------- // ----------------------------------EVENTS FOR CHECKBOXES AND DROPDOWN MENUS---------------------------------------------
// set checkbox options on/off and save // set checkbox options on/off and save
$(document).on("click", ".bg_opt", function(event) { $(document).on("click", ".bg_opt", function(event) {
@ -305,7 +303,7 @@ function SetEvents() {
}); });
// options that need reload // options that need reload
$(document).on("click", "#syncro_tabbar_tabs_order, #allow_pin_close, #switch_with_scroll, #always_show_close, #never_show_close, #close_other_trees, #show_counter_tabs, #show_counter_tabs_hints", function(event) { $(document).on("click", "#syncro_tabbar_tabs_order, #allow_pin_close, #switch_with_scroll, #always_show_close, #never_show_close, #close_other_trees, #show_counter_tabs, #show_counter_tabs_hints, #syncro_tabbar_tabs_order, #syncro_tabbar_groups_tabs_order", function(event) {
chrome.runtime.sendMessage({command: "reload_sidebar"}); chrome.runtime.sendMessage({command: "reload_sidebar"});
}); });
@ -435,8 +433,8 @@ function SetEvents() {
// select theme from list // select theme from list
$("#theme_list").change(function() { $("#theme_list").change(function() {
localStorage["current_theme"] = $(this).val();
LoadTheme($(this).val()); LoadTheme($(this).val());
chrome.storage.local.set({current_theme: $(this).val()});
}); });
// import theme preset button // import theme preset button
@ -462,9 +460,6 @@ function SetEvents() {
}); });
// -------------------------------INDENTATION ADJUSTMENT------------------------------------------------------------------ // -------------------------------INDENTATION ADJUSTMENT------------------------------------------------------------------
// change tabs size preset(down) // change tabs size preset(down)
@ -595,43 +590,13 @@ function SetEvents() {
// ----------------------CLEAR DATA BUTTON-------------------------------------------------------------------------------- // ----------------------CLEAR DATA BUTTON--------------------------------------------------------------------------------
// clear data // clear data
$(document).on("click", "#options_clear_data", function(event) { $(document).on("click", "#options_clear_data", function(event) {
localStorage.clear(); chrome.storage.local.clear();
chrome.runtime.sendMessage({command: "reload"}); chrome.runtime.sendMessage({command: "reload"});
chrome.runtime.sendMessage({command: "reload_sidebar"}); chrome.runtime.sendMessage({command: "reload_sidebar"});
location.reload(); location.reload();
}); });
// THIIIIIIIIIIIS IS TO MOVE ICONS FOR SETUP OPTIONS PAGE
// $(document).bind("contextmenu", function(event) {
// if (event.ctrlKey || event.shiftKey) {
// event.preventDefault();
// }
// });
// $(document).on("mousedown", "*", function(event) {
// $(document).on("mousedown", ".pick_col", function(event) {
// event.stopPropagation();
// if (event.button == 0 && event.shiftKey) {
// $(this).css({ "left": $(this).position().left-1 });
// }
// if (event.button == 2 && event.shiftKey) {
// $(this).css({ "left": $(this).position().left+1 });
// }
// if (event.button == 0 && event.ctrlKey) {
// $(this).css({ "top": $(this).position().top-1 });
// }
// if (event.button == 2 && event.ctrlKey) {
// $(this).css({ "top": $(this).position().top+1 });
// }
// console.log(this.id + " top: " + $(this).position().top + "px; left: " + $(this).position().left + "px;");
// console.log(this.id);
// });
} }

View File

@ -9,16 +9,12 @@ function RefreshFields() {
} else { } else {
$("#field_theme").css({"height": ""}); $("#field_theme").css({"height": ""});
} }
if (browserId != "F") {
$("#faster_scroll_for_firefox").hide();
}
if (browserId == "F") { if (browserId == "F") {
$("#scrollbar_size_indicator").hide(); $("#scrollbar_size_indicator, #scrollbar_thumb, #scrollbar_thumb_hover, #scrollbar_track").hide();
} }
if (browserId == "V") { if (browserId == "V") {
$("#url_for_web_panel").val(chrome.runtime.getURL("sidebar.html")); $("#url_for_web_panel").val(chrome.runtime.getURL("sidebar.html"));
$("#url_for_web_panel").prop("readonly", true); $("#url_for_web_panel").prop("readonly", true);
// $("#url_for_web_panel").select();
} else{ } else{
$("#field_vivaldi").hide(); $("#field_vivaldi").hide();
} }

View File

@ -19,26 +19,26 @@ function AppendSampleTabs() {
$("#tab_title11")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_normal_hover"); $("#tab_title11")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_normal_hover");
$("#tab_header11").addClass("tab_header_hover").addClass("close_show"); $("#tab_header11").addClass("tab_header_hover").addClass("close_show");
AppendTab({tab: {id: 12, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "selected"}); AppendTab({tab: {id: 12, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "selected_tab"});
$("#tab_title12")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_normal_selected"); $("#tab_title12")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_normal_selected");
AppendTab({tab: {id: 13, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "selected"}); AppendTab({tab: {id: 13, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "selected_tab"});
$("#tab_title13")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_normal_selected_hover"); $("#tab_title13")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_normal_selected_hover");
$("#tab_header13").addClass("tab_header_hover").addClass("close_show"); $("#tab_header13").addClass("tab_header_hover").addClass("close_show");
$("#close13").addClass("close_hover"); $("#close13").addClass("close_hover");
// regular active tabs // regular active tabs
AppendTab({tab: {id: 3, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "active"}); AppendTab({tab: {id: 3, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "active_tab"});
$("#tab_title3")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_active"); $("#tab_title3")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_active");
AppendTab({tab: {id: 15, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "active"}); AppendTab({tab: {id: 15, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "active_tab"});
$("#tab_title15")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_active_hover"); $("#tab_title15")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_active_hover");
$("#tab_header15").addClass("tab_header_hover"); $("#tab_header15").addClass("tab_header_hover");
AppendTab({tab: {id: 14, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "c selected active"}); AppendTab({tab: {id: 14, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "c selected_tab active_tab"});
$("#tab_title14")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_active_selected"); $("#tab_title14")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_active_selected");
AppendTab({tab: {id: 16, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "c selected active"}); AppendTab({tab: {id: 16, pinned: false}, Append: true, ParentId: "2", AdditionalClass: "c selected_tab active_tab"});
$("#tab_title16")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_active_selected_hover"); $("#tab_title16")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_active_selected_hover");
$("#tab_header16").addClass("tab_header_hover"); $("#tab_header16").addClass("tab_header_hover");
$("#exp16").addClass("hover"); $("#exp16").addClass("hover");
@ -51,10 +51,10 @@ function AppendSampleTabs() {
$("#tab_title17")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_discarded_hover"); $("#tab_title17")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_discarded_hover");
$("#tab_header17").addClass("tab_header_hover"); $("#tab_header17").addClass("tab_header_hover");
AppendTab({tab: {id: 19, pinned: false, discarded: true}, Append: true, ParentId: "5", AdditionalClass: "selected"}); AppendTab({tab: {id: 19, pinned: false, discarded: true}, Append: true, ParentId: "5", AdditionalClass: "selected_tab"});
$("#tab_title19")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_discarded_selected"); $("#tab_title19")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_discarded_selected");
AppendTab({tab: {id: 20, pinned: false, discarded: true}, Append: true, ParentId: "5", AdditionalClass: "selected"}); AppendTab({tab: {id: 20, pinned: false, discarded: true}, Append: true, ParentId: "5", AdditionalClass: "selected_tab"});
$("#tab_title20")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_discarded_selected_hover"); $("#tab_title20")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_discarded_selected_hover");
$("#tab_header20").addClass("tab_header_hover"); $("#tab_header20").addClass("tab_header_hover");
@ -66,27 +66,27 @@ function AppendSampleTabs() {
$("#tab_title21")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_hover"); $("#tab_title21")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_hover");
$("#tab_header21").addClass("tab_header_hover"); $("#tab_header21").addClass("tab_header_hover");
AppendTab({tab: {id: 22, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "filtered active"}); AppendTab({tab: {id: 22, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "filtered active_tab"});
$("#tab_title22")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_active"); $("#tab_title22")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_active");
AppendTab({tab: {id: 23, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "filtered active"}); AppendTab({tab: {id: 23, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "filtered active_tab"});
$("#tab_title23")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_active_hover"); $("#tab_title23")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_active_hover");
$("#tab_header23").addClass("tab_header_hover"); $("#tab_header23").addClass("tab_header_hover");
// search result selected // search result selected
AppendTab({tab: {id: 8, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "selected filtered"}); AppendTab({tab: {id: 8, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "selected_tab filtered"});
$("#tab_title8")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_selected"); $("#tab_title8")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_selected");
AppendTab({tab: {id: 18, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "selected filtered"}); AppendTab({tab: {id: 18, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "selected_tab filtered"});
$("#tab_title18")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_selected_hover"); $("#tab_title18")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_selected_hover");
$("#tab_header18").addClass("tab_header_hover"); $("#tab_header18").addClass("tab_header_hover");
AppendTab({tab: {id: 25, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "selected filtered active"}); AppendTab({tab: {id: 25, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "selected_tab filtered active_tab"});
$("#tab_title25")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_selected_active"); $("#tab_title25")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_selected_active");
AppendTab({tab: {id: 26, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "selected filtered active"}); AppendTab({tab: {id: 26, pinned: false}, Append: true, ParentId: "6", AdditionalClass: "selected_tab filtered active_tab"});
$("#tab_title26")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_selected_active_hover"); $("#tab_title26")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_selected_active_hover");
$("#tab_header26").addClass("tab_header_hover"); $("#tab_header26").addClass("tab_header_hover");
@ -98,25 +98,25 @@ function AppendSampleTabs() {
$("#tab_title31")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_hover"); $("#tab_title31")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_hover");
$("#tab_header31").addClass("tab_header_hover"); $("#tab_header31").addClass("tab_header_hover");
AppendTab({tab: {id: 32, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "filtered highlighted_search active"}); AppendTab({tab: {id: 32, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "filtered highlighted_search active_tab"});
$("#tab_title32")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_active"); $("#tab_title32")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_active");
AppendTab({tab: {id: 33, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "filtered highlighted_search active"}); AppendTab({tab: {id: 33, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "filtered highlighted_search active_tab"});
$("#tab_title33")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_active_hover"); $("#tab_title33")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_active_hover");
$("#tab_header33").addClass("tab_header_hover"); $("#tab_header33").addClass("tab_header_hover");
AppendTab({tab: {id: 34, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "selected filtered highlighted_search"}); AppendTab({tab: {id: 34, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "selected_tab filtered highlighted_search"});
$("#tab_title34")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_selected"); $("#tab_title34")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_selected");
AppendTab({tab: {id: 35, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "selected filtered highlighted_search"}); AppendTab({tab: {id: 35, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "selected_tab filtered highlighted_search"});
$("#tab_title35")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_selected_hover"); $("#tab_title35")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_selected_hover");
$("#tab_header35").addClass("tab_header_hover"); $("#tab_header35").addClass("tab_header_hover");
AppendTab({tab: {id: 36, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "selected filtered highlighted_search active"}); AppendTab({tab: {id: 36, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "selected_tab filtered highlighted_search active_tab"});
$("#tab_title36")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_selected_active"); $("#tab_title36")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_selected_active");
AppendTab({tab: {id: 37, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "selected filtered highlighted_search active"}); AppendTab({tab: {id: 37, pinned: false}, Append: true, ParentId: "30", AdditionalClass: "selected_tab filtered highlighted_search active_tab"});
$("#tab_title37")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_selected_active_hover"); $("#tab_title37")[0].textContent = chrome.i18n.getMessage("options_theme_tabs_sample_text_search_result_highlighted_selected_active_hover");
$("#tab_header37").addClass("tab_header_hover"); $("#tab_header37").addClass("tab_header_hover");

View File

@ -3,115 +3,118 @@
// that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/ // that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/
function LoadTheme(themeName) { function LoadTheme(themeName) {
if (localStorage.getItem("theme"+themeName) != null) { chrome.storage.local.get(null, function(items) {
SelectedTheme = JSON.parse(localStorage["theme"+themeName]); if (items.themes[themeName]) {
$("#new_theme_name")[0].value = themeName; SelectedTheme = Object.assign({}, items.themes[themeName]);
current_theme = themeName;
} else {
SelectedTheme = Object.assign({}, DefaultTheme);
current_theme = "";
}
setTimeout(function() { setTimeout(function() {
ApplySizeSet(SelectedTheme["TabsSizeSetNumber"]); $("#new_theme_name")[0].value = themeName;
ApplyColorsSet(SelectedTheme["ColorsSet"]); setTimeout(function() {
ApplySizeOptionsSet(SelectedTheme["TabsSizeSetNumber"]); ApplySizeSet(SelectedTheme["TabsSizeSetNumber"]);
ApplyColorsSet(SelectedTheme["ColorsSet"]);
$("#toolbar").html(SelectedTheme.toolbar); ApplySizeOptionsSet(SelectedTheme["TabsSizeSetNumber"]);
$("#toolbar_unused_buttons").html(SelectedTheme.unused_buttons); $("#toolbar").html(SelectedTheme.toolbar);
$("#toolbar_unused_buttons").html(SelectedTheme.unused_buttons);
if (browserId == "F") { if (browserId == "F") {
$(".button#button_load_bak1, .button#button_load_bak2, .button#button_load_bak3").remove(); $(".button#button_load_bak1, .button#button_load_bak2, .button#button_load_bak3").remove();
} }
// expand toolbar options SelectedTheme.ToolbarShow = $("#show_toolbar")[0].checked = SelectedTheme.ToolbarShow;
SelectedTheme.ToolbarShow = $("#show_toolbar")[0].checked = SelectedTheme.ToolbarShow; $("#field_show_toolbar").css({"height": $("#show_toolbar")[0].checked ? "" : "6"});
$("#field_show_toolbar").css({"height": $("#show_toolbar")[0].checked ? "" : "6"}); SelectedTheme.ToolbarShow ? $("#options_available_buttons, #toolbar, #toolbar_colors").show() : $("#options_available_buttons, #toolbar, #toolbar_colors").hide();
SelectedTheme.ToolbarShow ? $("#options_available_buttons, #toolbar, #toolbar_colors").show() : $("#options_available_buttons, #toolbar, #toolbar_colors").hide(); $(".on").removeClass("on");
RefreshGUI();
$(".on").removeClass("on"); chrome.runtime.sendMessage({command: "reload_theme", themeName: "theme"+themeName});
RefreshGUI(); }, 200);
chrome.runtime.sendMessage({command: "reload_theme", themeName: "theme"+themeName});
}, 200); }, 200);
} });
} }
function SaveTheme(themeName) { function SaveTheme(themeName) {
localStorage["theme"+themeName] = JSON.stringify(SelectedTheme); chrome.storage.local.get(null, function(items) {
chrome.runtime.sendMessage({command: "reload_theme", themeName: "theme"+themeName}); let LSthemes = items.themes ? Object.assign({}, items.themes) : {};
return SelectedTheme; LSthemes[themeName] = Object.assign({}, SelectedTheme);
chrome.storage.local.set({themes: LSthemes});
chrome.runtime.sendMessage({command: "reload_theme", themeName: "theme"+themeName});
return SelectedTheme;
});
} }
function AddNewTheme() { function AddNewTheme() {
if (themes.indexOf($("#new_theme_name")[0].value) != -1) { if (themes.indexOf($("#new_theme_name")[0].value) != -1) {
alert(chrome.i18n.getMessage("options_there_is_a_theme_with_this_name")); alert(chrome.i18n.getMessage("options_there_is_a_theme_with_this_name"));
return; return;
} }
if ($("#new_theme_name")[0].value == "") { if ($("#new_theme_name")[0].value == "") {
alert(chrome.i18n.getMessage("options_theme_name_cannot_be_empty")); alert(chrome.i18n.getMessage("options_theme_name_cannot_be_empty"));
return; return;
} }
$("#toolbar").html(DefaultToolbar); $("#toolbar").html(DefaultToolbar);
SelectedTheme = Object.assign({}, DefaultTheme); SelectedTheme = Object.assign({}, DefaultTheme);
SelectedTheme["ColorsSet"] = {}; SelectedTheme["ColorsSet"] = {};
DefaultTheme["ColorsSet"] = {}; DefaultTheme["ColorsSet"] = {};
themes.push($("#new_theme_name")[0].value); themes.push($("#new_theme_name")[0].value);
var t_list = document.getElementById("theme_list"); var t_list = document.getElementById("theme_list");
var theme_name = document.createElement("option"); var theme_name = document.createElement("option");
theme_name.value = $("#new_theme_name")[0].value; theme_name.value = $("#new_theme_name")[0].value;
theme_name.text = theme_name.value; theme_name.text = theme_name.value;
t_list.add(theme_name); t_list.add(theme_name);
$("#theme_list")[0].selectedIndex = $("#theme_list")[0].options.length-1; $("#theme_list")[0].selectedIndex = $("#theme_list")[0].options.length-1;
SaveTheme(theme_name.value); SaveTheme(theme_name.value);
LoadTheme(theme_name.value); setTimeout(function() {
LoadTheme(theme_name.value);
localStorage["themes"] = JSON.stringify(themes); }, 500);
localStorage["current_theme"] = $("#theme_list").val(); chrome.storage.local.set({current_theme: $("#theme_list").val()});
RefreshFields(); RefreshFields();
} }
function DeleteSelectedTheme() { function DeleteSelectedTheme() {
if ($("#theme_list")[0].options.length == 0) { chrome.storage.local.get(null, function(items) {
localStorage["current_theme"] = "Default"; let LSthemes = items.themes ? Object.assign({}, items.themes) : {};
themes.splice(themes.indexOf($("#theme_list").val()), 1);
if (LSthemes[current_theme]) {
delete LSthemes[current_theme];
}
chrome.storage.local.set({themes: LSthemes});
var x = document.getElementById("theme_list");
x.remove(x.selectedIndex);
current_theme = ($("#theme_list")[0].options.length > 0) ? $("#theme_list").val() : "Default";
chrome.storage.local.set({current_theme: current_theme});
if ($("#theme_list")[0].options.length == 0) {
SelectedTheme = Object.assign({}, DefaultTheme);
SelectedTheme["ColorsSet"] = {};
chrome.storage.local.set({themes: {}});
setTimeout(function() {
chrome.runtime.sendMessage({command: "reload_theme", themeName: ""});
}, 500);
}
LoadTheme(current_theme);
RefreshFields();
});
}
function RenameSelectedTheme() {
if (themes.indexOf($("#new_theme_name")[0].value) != -1) {
alert(chrome.i18n.getMessage("options_there_is_a_theme_with_this_name"));
return; return;
} }
themes.splice(themes.indexOf($("#theme_list").val()), 1); if ($("#new_theme_name")[0].value == "") {
localStorage["themes"] = JSON.stringify(themes); alert(chrome.i18n.getMessage("options_theme_name_cannot_be_empty"));
return;
// localStorage.removeItem("theme"+($("#theme_list").val()));
localStorage.removeItem("theme"+SelectedTheme["theme_name"]);
var x = document.getElementById("theme_list");
x.remove(x.selectedIndex);
localStorage["current_theme"] = ($("#theme_list")[0].options.length > 0) ? $("#theme_list").val() : "Default";
LoadTheme(localStorage["current_theme"]);
RefreshFields();
if ($("#theme_list")[0].options.length == 0) {
SelectedTheme = Object.assign({}, DefaultTheme);
SelectedTheme["ColorsSet"] = {};
chrome.runtime.sendMessage({command: "reload_theme", themeName: "themeDefault"});
} }
} chrome.storage.local.get(null, function(items) {
let LSthemes = items.themes ? Object.assign({}, items.themes) : {};
function RenameSelectedTheme() {
if (themes.indexOf($("#new_theme_name")[0].value) != -1) {
alert(chrome.i18n.getMessage("options_there_is_a_theme_with_this_name"));
return;
}
if ($("#new_theme_name")[0].value == "") {
alert(chrome.i18n.getMessage("options_theme_name_cannot_be_empty"));
return;
}
var t_list = document.getElementById("theme_list");
localStorage.removeItem("theme"+SelectedTheme["theme_name"]);
SelectedTheme["theme_name"] = $("#new_theme_name")[0].value; SelectedTheme["theme_name"] = $("#new_theme_name")[0].value;
themes[themes.indexOf(t_list.options[t_list.selectedIndex].value)] = SelectedTheme["theme_name"]; let t_list = document.getElementById("theme_list");
t_list.options[t_list.selectedIndex].value = t_list.options[t_list.selectedIndex].text = SelectedTheme["theme_name"]; t_list.options[t_list.selectedIndex].value = t_list.options[t_list.selectedIndex].text = SelectedTheme["theme_name"];
localStorage["current_theme"] = SelectedTheme["theme_name"]; LSthemes[SelectedTheme["theme_name"]] = SelectedTheme;
localStorage["themes"] = JSON.stringify(themes); if (LSthemes[current_theme]) {
SaveTheme(SelectedTheme["theme_name"]); delete LSthemes[current_theme];
}
current_theme = SelectedTheme["theme_name"];
chrome.storage.local.set({themes: LSthemes});
chrome.storage.local.set({current_theme: current_theme});
});
} }
function ImportTheme() { function ImportTheme() {
var file = document.getElementById("import_theme"); var file = document.getElementById("import_theme");
var fr = new FileReader(); var fr = new FileReader();
@ -121,27 +124,21 @@ function ImportTheme() {
var data = fr.result; var data = fr.result;
file.remove(); file.remove();
var themeObj = JSON.parse(data); var themeObj = JSON.parse(data);
if (themeObj.theme_version > DefaultTheme["theme_version"]) { if (themeObj.theme_version > DefaultTheme["theme_version"]) {
alert(chrome.i18n.getMessage("options_loaded_theme_newer_version")); alert(chrome.i18n.getMessage("options_loaded_theme_newer_version"));
} }
if (themeObj.theme_version < DefaultTheme["theme_version"]) { if (themeObj.theme_version < DefaultTheme["theme_version"]) {
alert(chrome.i18n.getMessage("options_loaded_theme_older_version")); alert(chrome.i18n.getMessage("options_loaded_theme_older_version"));
} }
if (themeObj.theme_version <= DefaultTheme["theme_version"]) { if (themeObj.theme_version <= DefaultTheme["theme_version"]) {
SelectedTheme = Object.assign({}, DefaultTheme); SelectedTheme = Object.assign({}, DefaultTheme);
SelectedTheme["ColorsSet"] = {}; SelectedTheme["ColorsSet"] = {};
for (var val in themeObj.ColorsSet) { for (var val in themeObj.ColorsSet) {
SelectedTheme["ColorsSet"][val] = themeObj.ColorsSet[val]; SelectedTheme["ColorsSet"][val] = themeObj.ColorsSet[val];
} }
SelectedTheme["ToolbarShow"] = themeObj.ToolbarShow; SelectedTheme["ToolbarShow"] = themeObj.ToolbarShow;
SelectedTheme["TabsSizeSetNumber"] = themeObj.TabsSizeSetNumber; SelectedTheme["TabsSizeSetNumber"] = themeObj.TabsSizeSetNumber;
SelectedTheme["theme_version"] = DefaultTheme["theme_version"]; SelectedTheme["theme_version"] = DefaultTheme["theme_version"];
if (themeObj.theme_version == 1) { if (themeObj.theme_version == 1) {
SelectedTheme["ColorsSet"]["scrollbar_height"] = themeObj.ScrollbarPinList + "px"; SelectedTheme["ColorsSet"]["scrollbar_height"] = themeObj.ScrollbarPinList + "px";
SelectedTheme["ColorsSet"]["scrollbar_width"] = themeObj.ScrollbarTabList + "px"; SelectedTheme["ColorsSet"]["scrollbar_width"] = themeObj.ScrollbarTabList + "px";
@ -149,39 +146,30 @@ function ImportTheme() {
if (themeObj.theme_version == 2) { if (themeObj.theme_version == 2) {
SelectedTheme["unused_buttons"] = themeObj["unused_buttons"]; SelectedTheme["unused_buttons"] = themeObj["unused_buttons"];
} }
if (themes.indexOf(themeObj.theme_name) == -1) { if (themes.indexOf(themeObj.theme_name) == -1) {
SelectedTheme["theme_name"] = themeObj.theme_name; SelectedTheme["theme_name"] = themeObj.theme_name;
} else { } else {
SelectedTheme["theme_name"] = themeObj.theme_name + "(1)"; SelectedTheme["theme_name"] = themeObj.theme_name + "(1)";
} }
themes.push(SelectedTheme["theme_name"]); themes.push(SelectedTheme["theme_name"]);
SaveTheme(SelectedTheme["theme_name"]); SaveTheme(SelectedTheme["theme_name"]);
var t_list = document.getElementById("theme_list"); var t_list = document.getElementById("theme_list");
var theme_name = document.createElement("option"); var theme_name = document.createElement("option");
theme_name.value = SelectedTheme["theme_name"]; theme_name.value = SelectedTheme["theme_name"];
theme_name.text = theme_name.value; theme_name.text = theme_name.value;
t_list.add(theme_name); t_list.add(theme_name);
localStorage["themes"] = JSON.stringify(themes);
localStorage["current_theme"] = themeObj.theme_name;
$("#theme_list")[0].selectedIndex = $("#theme_list")[0].options.length-1; $("#theme_list")[0].selectedIndex = $("#theme_list")[0].options.length-1;
current_theme = SelectedTheme["theme_name"];
LoadTheme(SelectedTheme["theme_name"]); $("#new_theme_name")[0].value = current_theme;
setTimeout(function() {
LoadTheme(current_theme);
}, 500);
RefreshFields(); RefreshFields();
DefaultTheme["ColorsSet"] = {}; DefaultTheme["ColorsSet"] = {};
chrome.storage.local.set({current_theme: current_theme});
} }
} }
} }
function ApplySizeOptionsSet(size){ function ApplySizeOptionsSet(size){
for (let si = 0; si < document.styleSheets.length; si++) { for (let si = 0; si < document.styleSheets.length; si++) {
if ((document.styleSheets[si].ownerNode.id).match("size_settings") != null) { if ((document.styleSheets[si].ownerNode.id).match("size_settings") != null) {
@ -191,6 +179,5 @@ function ApplySizeOptionsSet(size){
document.styleSheets.item(si).disabled = true; document.styleSheets.item(si).disabled = true;
} }
} }
} }
} }

View File

@ -138,9 +138,9 @@
/* CLOSE TAB BUTTON OPTIONS */ /* CLOSE TAB BUTTON OPTIONS */
#expand_hover_background { top: 1px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_hover_background { top: 1px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_closed_background { top: 1px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_closed_background { top: 1px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_open_background { top: 1px; left: 4px; background-size: var(--row_image_size);} #expand_open_background { top: 1px; left: -12px; background-size: var(--row_image_size);}
#tab_list_background { top: 835px; left: 50px; } #tab_list_background { top: 835px; left: 50px; }

View File

@ -138,9 +138,9 @@
/* CLOSE TAB BUTTON OPTIONS */ /* CLOSE TAB BUTTON OPTIONS */
#expand_hover_background { top: 1px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_hover_background { top: 1px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_closed_background { top: 1px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_closed_background { top: 1px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_open_background { top: 1px; left: 4px; background-size: var(--row_image_size);} #expand_open_background { top: 1px; left: -12px; background-size: var(--row_image_size);}
#tab_list_background { top: 835px; left: 50px; } #tab_list_background { top: 835px; left: 50px; }

View File

@ -138,9 +138,9 @@
/* CLOSE TAB BUTTON OPTIONS */ /* CLOSE TAB BUTTON OPTIONS */
#expand_hover_background { top: 1px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_hover_background { top: 1px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_closed_background { top: 1px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_closed_background { top: 1px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_open_background { top: 1px; left: 4px; background-size: var(--row_image_size);} #expand_open_background { top: 1px; left: -12px; background-size: var(--row_image_size);}
#tab_list_background { top: 835px; left: 50px; } #tab_list_background { top: 835px; left: 50px; }

View File

@ -138,9 +138,9 @@
/* CLOSE TAB BUTTON OPTIONS */ /* CLOSE TAB BUTTON OPTIONS */
#expand_hover_background { top: 2px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_hover_background { top: 2px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_closed_background { top: 2px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_closed_background { top: 2px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_open_background { top: 2px; left: 4px; background-size: var(--row_image_size);} #expand_open_background { top: 2px; left: -12px; background-size: var(--row_image_size);}
#tab_list_background { top: 835px; left: 50px; } #tab_list_background { top: 835px; left: 50px; }

View File

@ -138,9 +138,9 @@
/* CLOSE TAB BUTTON OPTIONS */ /* CLOSE TAB BUTTON OPTIONS */
#expand_hover_background { top: 0px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_hover_background { top: 0px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_closed_background { top: 0px; left: calc(var(--children_padding_left) + 4px); background-size: var(--row_image_size);} #expand_closed_background { top: 0px; left: calc(var(--children_padding_left) - 18px); background-size: var(--row_image_size);}
#expand_open_background { top: 0px; left: 4px; background-size: var(--row_image_size);} #expand_open_background { top: 0px; left: -12px; background-size: var(--row_image_size);}
#tab_list_background { top: 835px; left: 50px; } #tab_list_background { top: 835px; left: 50px; }

View File

@ -40,21 +40,21 @@ function SetIOEvents() {
if (MouseHoverOver == "pin_list") { if (MouseHoverOver == "pin_list") {
// ctrl+a to select all // ctrl+a to select all
if (event.ctrlKey && event.which == 65) { if (event.ctrlKey && event.which == 65) {
$(".pin").addClass("selected"); $(".pin").addClass("selected_tab");
} }
// ctrl+i to invert selection // ctrl+i to invert selection
if (event.ctrlKey && event.which == 73) { if (event.ctrlKey && event.which == 73) {
$(".pin").toggleClass("selected"); $(".pin").toggleClass("selected_tab");
} }
} }
if (MouseHoverOver.match("g_|tab_list") !== null) { if (MouseHoverOver.match("g_|tab_list") !== null) {
// ctrl+a to select all // ctrl+a to select all
if (event.ctrlKey && event.which == 65) { if (event.ctrlKey && event.which == 65) {
$("#"+active_group).children(".tab:visible").addClass("selected"); $("#ch"+active_group).children(".tab:visible").addClass("selected_tab");
} }
// ctrl+i to invert selection // ctrl+i to invert selection
if (event.ctrlKey && event.which == 73) { if (event.ctrlKey && event.which == 73) {
$(".tab:visible").toggleClass("selected"); $(".tab:visible").toggleClass("selected_tab");
} }
} }
RefreshGUI(); RefreshGUI();

View File

@ -3,20 +3,32 @@
// that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/ // that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/
function ExportGroup(filename) { function ExportGroup(filename) {
let GroupToSave = [0,[]]; let GroupToSave = { group: bggroups[active_group], folders: {}, tabs: [] };
GroupToSave[0] = bggroups[active_group];
let lastId = parseInt($("#"+active_group+" .tab").last()[0].id); let lastId = parseInt($("#"+active_group+" .tab").last()[0].id);
$("#"+active_group+" .folder").each(function() {
if (bgfolders[this.id]) {
GroupToSave.folders[this.id] = bgfolders[this.id];
}
})
$("#"+active_group+" .tab").each(function() { $("#"+active_group+" .tab").each(function() {
chrome.tabs.get(parseInt(this.id), function(tab) { chrome.tabs.get(parseInt(this.id), function(tab) {
GroupToSave[1].push([tab.id, ($("#"+tab.id).parent(".group")[0] ? $("#"+tab.id).parent()[0].id : $("#"+tab.id).parent().parent(".tab")[0].id), $("#"+tab.id).index(), ($("#"+tab.id).is(".n") ? "n" : ($("#"+tab.id).is(".c") ? "c" : "o")), tab.url]); if ((tab.url).startsWith("www") || (tab.url).startsWith("http") || (tab.url).startsWith("ftp")) {
(GroupToSave.tabs).push(
{
id: tab.id,
parent: $("#"+tab.id).parent().parent()[0].id,
index: $("#"+tab.id).index(),
expand: ($("#"+tab.id).is(".n") ? "n" : ($("#"+tab.id).is(".c") ? "c" : "o")),
url: tab.url
}
);
}
if (tab.id == lastId) { if (tab.id == lastId) {
SaveFile(filename, GroupToSave); SaveFile(filename, GroupToSave);
} }
}); });
}) })
} }
function ImportGroup() { function ImportGroup() {
let file = document.getElementById("file_import_group"); let file = document.getElementById("file_import_group");
let fr = new FileReader(); let fr = new FileReader();
@ -26,69 +38,77 @@ function ImportGroup() {
let data = fr.result; let data = fr.result;
file.remove(); file.remove();
let LoadedGroup = JSON.parse(data); let LoadedGroup = JSON.parse(data);
let NewFolders = {};
let RefsTabs = {}; let RefsTabs = {};
let newTabs = {}; let NewTabs = [];
let lastId = LoadedGroup[1][LoadedGroup[1].length-1][0]; let NewGroupId = AddNewGroup({name: LoadedGroup.group.name, font: LoadedGroup.group.font});
let NewGroupId = AddNewGroup({name: LoadedGroup[0].name, font: LoadedGroup[0].font});
SetActiveGroup(NewGroupId, false, false); SetActiveGroup(NewGroupId, false, false);
LoadedGroup[1].forEach(function(LTab){ for (var folder in LoadedGroup.folders) {
chrome.tabs.create({url: LTab[4]}, function(tab) { let newId = GenerateNewFolderID();
RefsTabs[LTab[0]] = tab.id; NewFolders[folder] = { id: newId, parent: NewGroupId, index: (LoadedGroup.folders[folder].index), name: (LoadedGroup.folders[folder].name), expand: (LoadedGroup.folders[folder].expand) };
newTabs[tab.id] = {i: LTab[2]}; }
if (LTab[0] == lastId) { for (var folder in NewFolders) {
if (NewFolders[LoadedGroup.folders[folder].parent]) {
NewFolders[folder].parent = NewFolders[LoadedGroup.folders[folder].parent].id;
}
}
(LoadedGroup.tabs).forEach(function(Tab){
chrome.tabs.create({url: Tab.url, active: false}, function(new_tab) {
if (new_tab) {
RefsTabs[Tab.id] = new_tab.id;
Tab.id = new_tab.id;
NewTabs.push(Tab);
}
if (NewTabs.length == LoadedGroup.tabs.length-1) {
setTimeout(function() { setTimeout(function() {
LoadedGroup[1].forEach(function(LTab){ NewTabs.forEach(function(LTab) {
$("#"+NewGroupId).append($("#"+LTab[0])); if (LTab.parent == LoadedGroup.group.id) {
}); LTab.parent = NewGroupId;
}, 2000); }
setTimeout(function() { if (NewFolders[LTab.parent]) {
LoadedGroup[1].forEach(function(LTab){ LTab.parent = NewFolders[LTab.parent].id;
if ($("#"+RefsTabs[LTab[1]])[0] && $("#"+LTab[0])[0]) { }
$("#ch"+RefsTabs[LTab[1]]).append($("#"+LTab[0])); if (RefsTabs[LTab.parent]) {
LTab.parent = RefsTabs[LTab.parent];
} }
}); });
LoadedGroup[1].forEach(function(LTab){ RearrangeTreeStructure({}, NewFolders, NewTabs);
$("#"+LTab[0]).addClass(LTab[3]); }, 2000);
});
chrome.tabs.query({currentWindow: true}, function(tabs) {
RearrangeTreeTabs(tabs, newTabs, true);
RefreshExpandStates();
RefreshGUI();
});
}, 4000);
} }
LTab[0] = tab.id;
}); });
}); });
} }
} }
function ExportSession(filename) {
function ExportTabs(filename) {
chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) { chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) {
chrome.runtime.sendMessage({command: "get_browser_tabs"}, function(response) { chrome.runtime.sendMessage({command: "get_browser_tabs"}, function(response) {
let tabs = Object.assign({}, response); let tabs = Object.assign({}, response);
chrome.runtime.sendMessage({command: "get_windows"}, function(response) { chrome.runtime.sendMessage({command: "get_windows"}, function(response) {
let windows = Object.assign({}, response); let windows = Object.assign({}, response);
let WindowsToSave = []; let warn = true;
w.forEach(function(CWin){ let ExportWindows = [];
if (windows[CWin.id] != undefined && windows[CWin.id].group_bar != undefined && windows[CWin.id].active_shelf != undefined && windows[CWin.id].active_group != undefined && windows[CWin.id].groups != undefined && windows[CWin.id].folders != undefined) { w.forEach(function(CWin) {
WindowsToSave.push([[], CWin.id, CWin.tabs[0].url, CWin.tabs[CWin.tabs.length-1].url, windows[CWin.id].group_bar, windows[CWin.id].group_bar, windows[CWin.id].active_shelf, windows[CWin.id].active_group, windows[CWin.id].groups, windows[CWin.id].folders, 0]); if (CWin.tabs.length > 0) {
} if (CWin.tabs.length > 100 && warn) {
alert(chrome.i18n.getMessage("warning_exporting_big_amount_of_tabs"));
CWin.tabs.forEach(function(CTab){ warn = false;
if (tabs[CTab.id] != undefined && tabs[CTab.id].parent != undefined && tabs[CTab.id].index != undefined && tabs[CTab.id].expand != undefined) {
WindowsToSave[WindowsToSave.length-1][0].push([CTab.id, CTab.url, tabs[CTab.id].parent, tabs[CTab.id].index, tabs[CTab.id].expand]);
} }
}); windows[CWin.id]["id"] = CWin.id;
windows[CWin.id]["tabs"] = [];
CWin.tabs.forEach(function(CTab) {
if ((CTab.url).startsWith("www") || (CTab.url).startsWith("http") || (CTab.url).startsWith("ftp")) {
windows[CWin.id]["tabs"].push({id: CTab.id, url: CTab.url, parent: tabs[CTab.id].parent, index: tabs[CTab.id].index, expand: tabs[CTab.id].expand});
}
});
ExportWindows.push(windows[CWin.id]);
}
}); });
SaveFile(filename, WindowsToSave); SaveFile(filename, ExportWindows);
}); });
}); });
}); });
} }
function ImportSession() {
function ImportTabs() {
let file = document.getElementById("file_import_backup"); let file = document.getElementById("file_import_backup");
let fr = new FileReader(); let fr = new FileReader();
if (file.files[0] == undefined) return; if (file.files[0] == undefined) return;
@ -96,63 +116,80 @@ function ImportTabs() {
fr.onload = function() { fr.onload = function() {
let data = fr.result; let data = fr.result;
file.remove(); file.remove();
chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) { let LoadedWindows = JSON.parse(data);
let RefsTabs = {};
//make global variables log(LoadedWindows);
LoadedWindows = JSON.parse(data); LoadedWindows.forEach(function(LWin) {
RefsTabs = {}; let NewTabs = [];
TotalTabsCount = 0; let urls = [];
(LWin.tabs).forEach(function(Tab) {
LoadedWindows.forEach(function(LWin){ urls.push(Tab.url);
TotalTabsCount += LWin[0].length; NewTabs.push(Tab);
}); });
chrome.windows.create({url: urls}, function(new_window) {
LoadedWindows.forEach(function(LWin){ for (let tInd = 0; tInd < new_window.tabs.length; tInd++) {
chrome.windows.create({}, function(new_window) { RefsTabs[NewTabs[tInd].id] = new_window.tabs[tInd].id;
LWin[1] = new_window.id; NewTabs[tInd].id = new_window.tabs[tInd].id;
LWin[2] = ""; }
LWin[3] = ""; for (let tInd = 0; tInd < new_window.tabs.length; tInd++) {
if (RefsTabs[NewTabs[tInd].parent] != undefined) {
setTimeout(function() { NewTabs[tInd].parent = RefsTabs[NewTabs[tInd].parent];
chrome.runtime.sendMessage({command: "save_groups", groups: LWin[8], windowId: new_window.id}); }
}, 1000); }
let HaveResponse;
LWin[0].forEach(function(LTab){ let GiveUp = 0;
chrome.tabs.create({url: LTab[1], pinned: (LTab[2] == "pin_list" ? true : false), windowId: new_window.id}, function(tab) { var Append = setInterval(function() {
RefsTabs[LTab[0]] = tab.id; chrome.runtime.sendMessage({command: "remote_update", groups: LWin.groups, folders: LWin.folders, tabs: NewTabs, windowId: new_window.id}, function(response) {
LTab[0] = tab.id; HaveResponse = response;
LTab[1] = "";
TotalTabsCount--;
if (TotalTabsCount < 2) {
setTimeout(function() {
chrome.runtime.sendMessage({command: "get_windows"}, function(response) {
let windows = Object.assign({}, response);
LoadedWindows.forEach(function(LWin){
LWin[0].forEach(function(LTab){
schedule_update_data -= 2;
chrome.runtime.sendMessage({command: "update_tab", tabId: LTab[0], tab: {parent: (RefsTabs[LTab[2]] ? RefsTabs[LTab[2]] : LTab[2]), index: LTab[3], expand: LTab[4]}});
});
});
setTimeout(function() {
chrome.runtime.sendMessage({command: "reload_sidebar"});
location.reload();
}, 3000);
});
chrome.tabs.remove(new_window.tabs[0].id, null);
}, 1000);
}
});
}); });
}); if (HaveResponse || GiveUp > 900) {
clearInterval(Append);
}
GiveUp++;
}, 2000);
}); });
}); });
} }
} }
function RearrangeTreeStructure(groups, folders, tabs) { // groups and folders are in object, just like bggroups and bgfolders, but tabs are in array of bgtreetabs objects
log("function: RearrangeTreeStructure");
chrome.tabs.query({currentWindow: true}, function(ChromeTabs) {
if (Object.keys(groups).length > 0) {
for (var group in groups) {
bggroups[groups[group].id] = Object.assign({}, groups[group]);
}
AppendGroups(bggroups);
}
if (Object.keys(folders).length > 0) {
for (var folder in folders) {
bgfolders[folders[folder].id] = Object.assign({}, folders[folder]);
}
AppendFolders(bgfolders);
}
let bgtabs = {};
tabs.forEach(function(Tab) {
if (Tab.parent == "pin_list") {
chrome.tabs.update(Tab.id, {pinned: true});
}
if ($("#"+Tab.id)[0] && $("#ch"+Tab.parent)[0]) {
$("#ch"+Tab.parent).append($("#"+Tab.id));
$("#"+Tab.id).addClass(Tab.expand);
}
bgtabs[Tab.id] = {index: Tab.index, parent: Tab.parent, expand: Tab.expand};
});
RearrangeTreeTabs(ChromeTabs, bgtabs, true);
RearrangeFolders(true);
UpdateBgGroupsOrder();
setTimeout(function() {
RefreshExpandStates();
RefreshCounters();
schedule_update_data++;
SaveFolders();
}, 1000);
});
}
function ImportMergeTabs() { function ImportMergeTabs() {
log("function: ImportMergeTabs");
let file = document.getElementById("file_import_merge_backup"); let file = document.getElementById("file_import_merge_backup");
let fr = new FileReader(); let fr = new FileReader();
if (file.files[0] == undefined) return; if (file.files[0] == undefined) return;
@ -160,105 +197,107 @@ function ImportMergeTabs() {
fr.onload = function() { fr.onload = function() {
let data = fr.result; let data = fr.result;
file.remove(); file.remove();
let lw = JSON.parse(data);
//make global variables let RefsWins = {};
LoadedWindows = JSON.parse(data); let RefsTabs = {};
RefsTabs = {}; for (let LWI = 0; LWI < lw.length; LWI++) { // clear previous window ids
RefsWins = {}; lw[LWI].id = "";
TotalTabsCount = 0; }
LoadedWindows.forEach(function(LWin){ log(lw);
TotalTabsCount += LWin[0].length; chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(cw) {
}); for (let CWI = 0; CWI < cw.length; CWI++) { // loop Windows
for (let LWI = 0; LWI < lw.length; LWI++) { // loop Loaded Windows
chrome.windows.getAll({windowTypes: ['normal'], populate: true}, function(w) { let tabsMatch = 0;
w.forEach(function(CWin){ // loop Current Windows (CWin) for (let CTI = 0; CTI < cw[CWI].tabs.length; CTI++) { // loop Tabs of each Current Window
LoadedWindows.forEach(function(LWin){ // loop Loaded Windows (LWin) for (let LTI = 0; LTI < lw[LWI].tabs.length; LTI++) { // loop Tabs of each Loaded Window
CWin.tabs.forEach(function(CTab){ // loop Tabs of each Current Window if (cw[CWI].tabs[CTI].url == lw[LWI].tabs[LTI].url) {
schedule_update_data -= 2; RefsTabs[lw[LWI].tabs[LTI].id] = cw[CWI].tabs[CTI].id;
for (let LWinTabInd = 0; LWinTabInd < LWin[0].length; LWinTabInd++) { // loop Tabs of each Loaded Window lw[LWI].tabs[LTI].id = cw[CWI].tabs[CTI].id;
if (CTab.url == LWin[0][LWinTabInd][1]) { lw[LWI].tabs[LTI].url = "";
// TabsMatched++; tabsMatch++;
RefsTabs[LWin[0][LWinTabInd][0]] = CTab.id;
LWin[0][LWinTabInd][0] = CTab.id;
LWin[0][LWinTabInd][1] = "";
LWin[10]++;
TotalTabsCount--;
break; break;
} }
} }
});
if (CWin.tabs[0].url == LWin[2] && CWin.tabs[CWin.tabs.length-1].url == LWin[3] && LWin[10] > LWin[0].length*0.5) {
RefsWins[LWin[1]] = CWin.id;
LWin[1] = CWin.id;
LWin[2] = "";
LWin[3] = "";
} }
}); log(tabsMatch);
}); if (tabsMatch > lw[LWI].tabs.length*0.8) {
lw[LWI].id = cw[CWI].id;
LoadedWindows.forEach(function(LWin){ break;
if (LWin[2] != "" && LWin[3] != "") { // missing window, lets make one }
chrome.windows.create({}, function(new_window) { }
RefsWins[LWin[1]] = new_window.id; }
LWin[1] = new_window.id; log(lw);
lw.forEach(function(w) {
LWin[2] = ""; if (w.id == "") { // missing window, lets make one
LWin[3] = ""; log("missing window");
let NewTabs = [];
LWin[0].forEach(function(LTab){ let urls = [];
if (LTab[1] != "") { // missing tab of missing window, lets make one (w.tabs).forEach(function(Tab) {
chrome.tabs.create({url: LTab[1], windowId: new_window.id}, function(tab) { urls.push(Tab.url);
NewTabs.push(Tab);
// chrome.tabs.executeScript(tab.id, {code: "setTimeout(function() { window.stop(); }, 5000);", runAt: "document_start"}, function(){});
RefsTabs[LTab[0]] = tab.id;
LTab[0] = tab.id;
LTab[1] = "";
TotalTabsCount--;
});
}
});
chrome.tabs.remove(new_window.tabs[0].id, null);
}); });
} else { chrome.windows.create({url: urls}, function(new_window) {
LWin[0].forEach(function(LTab){ for (let tInd = 0; tInd < new_window.tabs.length; tInd++) {
if (LTab[1] != "") { // missing tab, lets make one RefsTabs[NewTabs[tInd].id] = new_window.tabs[tInd].id;
chrome.tabs.create({url: LTab[1], windowId: LWin[1]}, function(tab) { NewTabs[tInd].id = new_window.tabs[tInd].id;
RefsTabs[LTab[0]] = tab.id; }
LTab[0] = tab.id; for (let tInd = 0; tInd < new_window.tabs.length; tInd++) {
LTab[1] = ""; if (RefsTabs[NewTabs[tInd].parent] != undefined) {
TotalTabsCount--; NewTabs[tInd].parent = RefsTabs[NewTabs[tInd].parent];
}
if (TotalTabsCount < 2) { }
setTimeout(function() { let HaveResponse;
chrome.runtime.sendMessage({command: "get_windows"}, function(response) { let GiveUp = 0;
let windows = Object.assign({}, response); var Append = setInterval(function() {
chrome.runtime.sendMessage({command: "remote_update", groups: w.groups, folders: w.folders, tabs: NewTabs, windowId: new_window.id}, function(response) {
LoadedWindows.forEach(function(LWin){ HaveResponse = response;
for (let lGroup in LWin[8]) {
if (windows[LWin[1]] && windows[LWin[1]].groups[lGroup] == undefined) {
windows[LWin[1]].groups[lGroup] = Object.assign({}, LWin[8][lGroup]);
chrome.runtime.sendMessage({command: "save_groups", groups: windows[LWin[1]].groups, windowId: LWin[1]});
}
}
LWin[0].forEach(function(LTab){
schedule_update_data -= 2;
chrome.runtime.sendMessage({command: "update_tab", tabId: LTab[0], tab: {parent: (RefsTabs[LTab[2]] ? RefsTabs[LTab[2]] : LTab[2]), index: LTab[3], expand: LTab[4]}});
});
});
setTimeout(function() {
chrome.runtime.sendMessage({command: "reload_sidebar"});
location.reload();
}, 1000);
});
}, 1000);
}
}); });
if (HaveResponse || GiveUp > 900) {
clearInterval(Append);
}
GiveUp++;
}, 2000);
});
}
else
{ // window exists, lets add missing tabs
log("window exists");
let NewTabs = [];
(w.tabs).forEach(function(Tab) {
if (Tab.url != "") { // missing tab, lets make one
chrome.tabs.create({url: Tab.url, windowId: w.id}, function(tab) {
Tab.id = tab.id;
RefsTabs[tab.id] = tab.id;
NewTabs.push(Tab);
});
} else {
NewTabs.push(Tab);
} }
}); });
setTimeout(function() {
for (let tInd = 0; tInd < NewTabs.length; tInd++) {
if (RefsTabs[NewTabs[tInd].parent] != undefined) {
NewTabs[tInd].parent = RefsTabs[NewTabs[tInd].parent];
}
}
}, 4000);
setTimeout(function() {
if (w.id == CurrentWindowId) {
RearrangeTreeStructure(w.groups, w.folders, NewTabs);
} else {
let HaveResponse;
let GiveUp = 0;
var Append = setInterval(function() {
chrome.runtime.sendMessage({command: "remote_update", groups: w.groups, folders: w.folders, tabs: NewTabs, windowId: w.id}, function(response) {
HaveResponse = response;
});
if (HaveResponse || GiveUp > 900) {
clearInterval(Append);
}
GiveUp++;
}, 2000);
}
}, 6000);
} }
}); });
}); });

View File

@ -4,69 +4,90 @@
// ********** CHROME EVENTS *************** // ********** CHROME EVENTS ***************
function StartChromeListeners(){ function StartChromeListeners() {
if (browserId == "F") {
browser.browserAction.onClicked.addListener(function(tab) {
if (tab.windowId == CurrentWindowId) {
browser.sidebarAction.close();
}
});
}
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) { chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
log("message to sidebar "+CurrentWindowId+": ");
log(message);
if (message.command == "backup_available") {
$("#button_load_bak"+message.bak).removeClass("disabled");
}
if (message.command == "drag_drop") { if (message.command == "drag_drop") {
DragAndDrop.DragNodeClass = message.DragNodeClass;
DragAndDrop.SelectedTabsIds = message.SelectedTabsIds;
DragAndDrop.TabsIds = message.TabsIds;
DragAndDrop.Parents = message.Parents;
DragAndDrop.ComesFromWindowId = message.ComesFromWindowId; DragAndDrop.ComesFromWindowId = message.ComesFromWindowId;
DragAndDrop.DragNodeClass = message.DragNodeClass;
DragAndDrop.Depth = message.Depth; DragAndDrop.Depth = message.Depth;
DragAndDrop.Folders = Object.assign({}, message.Folders);
DragAndDrop.FoldersSelected = message.FoldersSelected;
DragAndDrop.TabsIds = message.TabsIds;
DragAndDrop.TabsIdsParents = message.TabsIdsParents;
DragAndDrop.TabsIdsSelected = message.TabsIdsSelected;
}
if (message.command == "dropped") {
DragAndDrop.DroppedToWindowId = message.DroppedToWindowId;
if (Object.keys(DragAndDrop.Folders).length > 0 && message.DroppedToWindowId != CurrentWindowId) {
for (var folder in DragAndDrop.Folders)
{
RemoveFolder(DragAndDrop.Folders[folder].id);
}
}
} }
if (message.command == "reload_sidebar") { if (message.command == "reload_sidebar") {
window.location.reload(); window.location.reload();
} }
if (message.command == "reload_options") { if (message.command == "reload_options") {
LoadPreferences(); chrome.runtime.sendMessage({command: "get_preferences"}, function(response) {
setTimeout(function() { opt = Object.assign({}, response);
RestorePinListRowSettings(); setTimeout(function() {
},200); RestorePinListRowSettings();
}, 200);
});
} }
if (message.command == "reload_theme") { if (message.command == "reload_theme") {
let theme = LoadData(message.themeName, DefaultTheme); setTimeout(function() {
ApplySizeSet(theme["TabsSizeSetNumber"]); chrome.runtime.sendMessage({command: "get_theme", windowId: CurrentWindowId}, function(response) {
ApplyColorsSet(theme["ColorsSet"]); RestorePinListRowSettings();
if (theme.ToolbarShow) { let theme = response;
$("#toolbar").html(theme.toolbar); ApplyTheme(theme);
} else { });
$("#toolbar").html(""); }, 300);
}
RestoreToolbarSearchFilter();
RestoreToolbarShelf();
} }
if (message.windowId == CurrentWindowId) { if (message.windowId == CurrentWindowId) {
switch(message.command) { switch(message.command) {
case "tab_created": case "tab_created": // if set to treat unparented tabs as active tab's child
// if set to treat unparented tabs as active tab's child if (opt.append_orphan_tab == "as_child" && message.tab.openerTabId == undefined && $("#"+active_group+" .active_tab")[0]) {
if (opt.append_orphan_tab == "as_child" && message.tab.openerTabId == undefined && $(".active:visible")[0]) { message.tab.openerTabId = $("#"+active_group+" .active_tab")[0].id;
message.tab.openerTabId = $(".active:visible")[0].id;
} }
// child case if (message.tab.openerTabId) { // child case
if (message.tab.openerTabId) { if (opt.append_child_tab == "after_active") {
// append to tree AppendTab({ tab: message.tab, InsertAfterId: $("#"+active_group+" .active_tab")[0] ? $("#"+active_group+" .active_tab")[0].id : undefined, Append: false, Scroll: true });
if (opt.max_tree_depth < 0 || (opt.max_tree_depth > 0 && $("#"+message.tab.openerTabId).parents(".tab").length < opt.max_tree_depth)) { } else {
if (opt.append_child_tab == "top") { if (opt.max_tree_depth < 0 || (opt.max_tree_depth > 0 && $("#"+message.tab.openerTabId).parents(".tab").length < opt.max_tree_depth)) { // append to tree
AppendTab({ tab: message.tab, ParentId: message.tab.openerTabId, Append: false, Scroll: true }); if (opt.append_child_tab == "top") {
AppendTab({ tab: message.tab, ParentId: message.tab.openerTabId, Append: false, Scroll: true });
}
if (opt.append_child_tab == "bottom") {
AppendTab({ tab: message.tab, ParentId: message.tab.openerTabId, Append: true, Scroll: true });
}
} }
if (opt.append_child_tab == "bottom") { if (opt.max_tree_depth > 0 && $("#"+message.tab.openerTabId).parents(".tab").length >= opt.max_tree_depth) { // if reached depth limit of the tree
AppendTab({ tab: message.tab, ParentId: message.tab.openerTabId, Append: true, Scroll: true }); if (opt.append_child_tab_after_limit == "after") {
AppendTab({ tab: message.tab, InsertAfterId: message.tab.openerTabId, Append: true, Scroll: true });
}
if (opt.append_child_tab_after_limit == "top") {
AppendTab({ tab: message.tab, ParentId: $("#"+message.tab.openerTabId).parent().parent()[0].id, Append: false, Scroll: true });
}
if (opt.append_child_tab_after_limit == "bottom") {
AppendTab({ tab: message.tab, ParentId: $("#"+message.tab.openerTabId).parent().parent()[0].id, Append: true, Scroll: true });
}
} }
} }
// if reached depth limit of the tree if (opt.max_tree_depth == 0) { // place tabs flat, (should I merge it with orphans case?)
if (opt.max_tree_depth > 0 && $("#"+message.tab.openerTabId).parents(".tab").length >= opt.max_tree_depth) {
if (opt.append_child_tab_after_limit == "after") {
AppendTab({ tab: message.tab, InsertAfterId: message.tab.openerTabId, Append: true, Scroll: true });
}
if (opt.append_child_tab_after_limit == "top") {
AppendTab({ tab: message.tab, ParentId: $("#"+message.tab.openerTabId).parent().parent()[0].id, Append: false, Scroll: true });
}
if (opt.append_child_tab_after_limit == "bottom") {
AppendTab({ tab: message.tab, ParentId: $("#"+message.tab.openerTabId).parent().parent()[0].id, Append: true, Scroll: true });
}
}
// place tabs flat, (should I merge it with orphans case?)
if (opt.max_tree_depth == 0) {
if (opt.append_child_tab_after_limit == "after") { if (opt.append_child_tab_after_limit == "after") {
AppendTab({ tab: message.tab, InsertAfterId: message.tab.openerTabId, Append: false, Scroll: true }); AppendTab({ tab: message.tab, InsertAfterId: message.tab.openerTabId, Append: false, Scroll: true });
} }
@ -77,10 +98,9 @@ function StartChromeListeners(){
AppendTab({ tab: message.tab, Append: true, Scroll: true }); AppendTab({ tab: message.tab, Append: true, Scroll: true });
} }
} }
// orphan case } else { // orphan case
} else {
if (opt.append_orphan_tab == "after_active") { if (opt.append_orphan_tab == "after_active") {
AppendTab({ tab: message.tab, InsertAfterId: $(".active:visible")[0] ? $(".active:visible")[0].id : undefined, Append: false }); AppendTab({ tab: message.tab, InsertAfterId: $("#"+active_group+" .active_tab")[0] ? $("#"+active_group+" .active_tab")[0].id : undefined, Append: false });
} }
if (opt.append_orphan_tab == "top") { if (opt.append_orphan_tab == "top") {
AppendTab({ tab: message.tab, Append: false }); AppendTab({ tab: message.tab, Append: false });
@ -92,12 +112,17 @@ function StartChromeListeners(){
if ($("#"+message.tab.openerTabId).is(".c")) { if ($("#"+message.tab.openerTabId).is(".c")) {
$("#"+message.tab.openerTabId).removeClass("c").addClass("o"); $("#"+message.tab.openerTabId).removeClass("c").addClass("o");
} }
if (opt.syncro_tabbar_tabs_order) {
let TTtabsIndexes = $(".pin, .tab").map(function(){return parseInt(this.id);}).toArray();
chrome.tabs.move(message.tab.id, {index: TTtabsIndexes.indexOf(message.tab.id)});
}
RefreshExpandStates(); RefreshExpandStates();
schedule_update_data++; schedule_update_data++;
RefreshGUI(); RefreshGUI();
RefreshCounters();
break; break;
case "tab_attached": case "tab_attached":
AppendTab({ tab: message.tab, ParentId: message.ParentId, Append: true}); AppendTab({tab: message.tab, ParentId: message.ParentId, Append: true});
RefreshGUI(); RefreshGUI();
break; break;
case "tab_detached": case "tab_detached":
@ -117,7 +142,9 @@ function StartChromeListeners(){
} }
} }
RemoveTabFromList(message.tabId); RemoveTabFromList(message.tabId);
setTimeout(function() { schedule_update_data++; },300); setTimeout(function() {
schedule_update_data++;
}, 300);
RefreshGUI(); RefreshGUI();
break; break;
case "tab_removed": case "tab_removed":
@ -138,11 +165,16 @@ function StartChromeListeners(){
} }
RemoveTabFromList(message.tabId); RemoveTabFromList(message.tabId);
RefreshExpandStates(); RefreshExpandStates();
setTimeout(function() { schedule_update_data++; },300); setTimeout(function() {
schedule_update_data++;
}, 300);
RefreshGUI(); RefreshGUI();
RefreshCounters();
break; break;
case "tab_activated": case "tab_activated":
setTimeout(function() { SetActiveTab(message.tabId); },100); setTimeout(function() {
SetActiveTab(message.tabId);
}, 200);
break; break;
case "tab_attention": case "tab_attention":
SetAttentionIcon(message.tabId); SetAttentionIcon(message.tabId);
@ -151,12 +183,12 @@ function StartChromeListeners(){
if (message.changeInfo.favIconUrl != undefined || message.changeInfo.url != undefined) { if (message.changeInfo.favIconUrl != undefined || message.changeInfo.url != undefined) {
setTimeout(function() { setTimeout(function() {
GetFaviconAndTitle(message.tabId, true); GetFaviconAndTitle(message.tabId, true);
},100); }, 100);
} }
if (message.changeInfo.title != undefined) { if (message.changeInfo.title != undefined) {
setTimeout(function() { setTimeout(function() {
GetFaviconAndTitle(message.tabId, true); GetFaviconAndTitle(message.tabId, true);
},1000); }, 1000);
} }
if (message.changeInfo.audible != undefined || message.changeInfo.mutedInfo != undefined) { if (message.changeInfo.audible != undefined || message.changeInfo.mutedInfo != undefined) {
RefreshMediaIcon(message.tabId); RefreshMediaIcon(message.tabId);
@ -172,6 +204,10 @@ function StartChromeListeners(){
RefreshExpandStates(); RefreshExpandStates();
} }
break; break;
case "remote_update":
RearrangeTreeStructure(message.groups, message.folders, message.tabs);
sendResponse(true);
break;
} }
} }

View File

@ -4,8 +4,43 @@
// ********** TABS EVENTS *************** // ********** TABS EVENTS ***************
function GetSelectedFolders() {
log("function: GetSelectedFolders");
let res = {Folders: {}, FoldersSelected: [], TabsIds: [], TabsIdsParents: []};
$("#"+active_group+" .selected_folder").each(function() {
res.FoldersSelected.push(this.id);
res.Folders[this.id] = Object.assign({}, bgfolders[this.id]);
if ($("#cf" + this.id).children().length > 0) {
$($("#cf" + this.id).find(".folder")).each(function() {
res.Folders[this.id] = Object.assign({}, bgfolders[this.id]);
});
}
$($(this).find(".tab")).each(function() {
res.TabsIds.push(parseInt(this.id));
res.TabsIdsParents.push($(this).parent()[0].id);
});
});
log(res);
return res;
}
function GetSelectedTabs() {
log("function: GetSelectedTabs");
let res = {TabsIds: [], TabsIdsParents: [], TabsIdsSelected: []};
$("#"+active_group+" .selected_tab").each(function() {
res.TabsIds.push(parseInt(this.id));
res.TabsIdsParents.push($(this).parent()[0].id);
res.TabsIdsSelected.push(parseInt(this.id));
if ($("#ch" + this.id).children().length > 0) {
$($("#ch" + this.id).find(".tab")).each(function() {
res.TabsIds.push(parseInt(this.id));
res.TabsIdsParents.push($(this).parent()[0].id);
});
}
});
log(res);
return res;
}
function SetDragAndDropEvents() { function SetDragAndDropEvents() {
$(document).on("mouseleave", window, function(event) { $(document).on("mouseleave", window, function(event) {
MouseHoverOver = ""; MouseHoverOver = "";
}); });
@ -18,145 +53,144 @@ function SetDragAndDropEvents() {
$(document).on("dragover", "#toolbar_groups, #toolbar, #pin_list, .group", function(event) { $(document).on("dragover", "#toolbar_groups, #toolbar, #pin_list, .group", function(event) {
MouseHoverOver = this.id; MouseHoverOver = this.id;
}); });
$(document).on("mouseover", "#toolbar_groups, #toolbar, #pin_list, .group", function(event) { // set mouse over id $(document).on("mouseover", "#toolbar_groups, #toolbar, #pin_list, .group", function(event) {
MouseHoverOver = this.id; MouseHoverOver = this.id;
}); });
$(document).bind("drop dragover", function(event) { // PREVENT THE DEFAULT BROWSER DROP ACTION
// PREVENT THE DEFAULT BROWSER DROP ACTION
$(document).bind("drop dragover", function(event) {
event.preventDefault(); event.preventDefault();
}); });
$(document).on("mousedown", ".drop_target", function(event) { // deny drag enter on drop_targets and allow clicks below them
$(".drop_target").css({"pointer-events": "none"});
// bring to front drop zones
$(document).on("dragenter", ".tab_header, .folder", function(event) {
DropTargetsSendToFront();
}); });
$(document).on("dragenter", ".tab_header, .folder_header", function(event) { // allow drag enter on drop_targets
$(".drop_target").css({"pointer-events": "all"});
});
// SET FOLDER DRAG SOURCE $(document).on("dragstart", ".tab_header, .folder_header", function(event) { // SET DRAG SOURCE
$(document).on("dragstart", ".folder_header", function(event) {
DragAndDrop.DragNodeClass = "folder";
event.stopPropagation(); event.stopPropagation();
event.originalEvent.dataTransfer.setDragImage(document.getElementById("DragImage"), 0, 0); event.originalEvent.dataTransfer.setDragImage(document.getElementById("DragImage"), 0, 0);
event.originalEvent.dataTransfer.setData("text", ""); event.originalEvent.dataTransfer.setData("text", "");
DragAndDrop.DroppedToWindowId = 0;
DragAndDrop.ComesFromWindowId = CurrentWindowId; DragAndDrop.ComesFromWindowId = CurrentWindowId;
DragAndDrop.SelectedTabsIds.splice(0, DragAndDrop.SelectedTabsIds.length);
DragAndDrop.TabsIds.splice(0, DragAndDrop.TabsIds.length);
DragAndDrop.Parents.splice(0, DragAndDrop.Parents.length);
});
// SET TAB DRAG SOURCE
$(document).on("dragstart", ".tab_header", function(event) {
DragAndDrop.DragNodeClass = "tab";
event.stopPropagation();
event.originalEvent.dataTransfer.setDragImage(document.getElementById("DragImage"), 0, 0);
event.originalEvent.dataTransfer.setData("text", "");
if ($(this).parent().is(".active")) {
$(this).parent().addClass("selected_temporarly").addClass("selected");
}
$(".close").removeClass("show");
$(".tab_header_hover").removeClass("tab_header_hover");
if ($(this).parent().is(":not(.selected)")) {
$(".selected").addClass("selected_frozen").removeClass("selected");
$(this).parent().addClass("selected_temporarly").addClass("selected");
}
$(".selected:not(:visible)").addClass("selected_frozen").removeClass("selected");
DragAndDrop.ComesFromWindowId = CurrentWindowId;
DragAndDrop.SelectedTabsIds.splice(0, DragAndDrop.SelectedTabsIds.length);
DragAndDrop.TabsIds.splice(0, DragAndDrop.TabsIds.length);
DragAndDrop.Parents.splice(0, DragAndDrop.Parents.length);
DragAndDrop.Depth = 0; DragAndDrop.Depth = 0;
$(".selected:visible").find(".pin, .tab").each(function() { if ($(this)[0].classList[0] == "folder_header") {
if ($(this).parents(".pin, .tab").length > DragAndDrop.Depth) { DragAndDrop.Depth = $(this).parents(".pin, .tab").length; } DragAndDrop.DragNodeClass = "folder";
}); if ($(this).parent().is(":not(.selected_folder)")) {
DragAndDrop.Depth -= $(this).parents(".pin, .tab").length-1; $(".selected_folder").addClass("selected_folder_frozen").removeClass("selected_folder");
if (DragAndDrop.Depth < 0) { $(this).parent().addClass("selected_folder_temporarly").addClass("selected_folder");
DragAndDrop.Depth = 0;
}
console.log(DragAndDrop.Depth);
$(".selected:visible").each(function() {
DragAndDrop.SelectedTabsIds.push(parseInt(this.id));
DragAndDrop.TabsIds.push(parseInt(this.id));
DragAndDrop.Parents.push($(this).parent()[0].id);
if ($("#ch" + this.id).children().length > 0) {
$($("#ch" + this.id).find(".tab")).each(function() {
DragAndDrop.TabsIds.push(parseInt(this.id));
DragAndDrop.Parents.push($(this).parent()[0].id);
});
} }
$(".selected_folder:not(:visible)").addClass("selected_folder_frozen").removeClass("selected_folder");
let Folders = GetSelectedFolders();
DragAndDrop.TabsIds = Object.assign([], Folders.TabsIds);
DragAndDrop.TabsIdsParents = Object.assign([], Folders.TabsIdsParents);
DragAndDrop.TabsIdsSelected = Object.assign([], []);
DragAndDrop.Folders = Object.assign({}, Folders.Folders);
DragAndDrop.FoldersSelected = Object.assign([], Folders.FoldersSelected);
}
if ($(this)[0].classList[0] == "tab_header") {
DragAndDrop.DragNodeClass = "tab";
if ($(this).parent().is(".active_tab")) {
$(this).parent().addClass("selected_temporarly").addClass("selected_tab");
}
$(".close").removeClass("show");
$(".tab_header_hover").removeClass("tab_header_hover");
if ($(this).parent().is(":not(.selected_tab)")) {
$(".selected_tab").addClass("selected_frozen").removeClass("selected_tab");
$(this).parent().addClass("selected_temporarly").addClass("selected_tab");
}
$(".selected_tab:not(:visible)").addClass("selected_frozen").removeClass("selected_tab");
$("#"+active_group+" .selected_tab").find(".pin, .tab").each(function() {
if ($(this).parents(".pin, .tab").length > DragAndDrop.Depth) {
DragAndDrop.Depth = $(this).parents(".pin, .tab").length;
}
});
DragAndDrop.Depth -= $(this).parents(".pin, .tab").length-1;
if (DragAndDrop.Depth < 0) {
DragAndDrop.Depth = 0;
}
let Tabs = GetSelectedTabs();
DragAndDrop.TabsIds = Object.assign([], Tabs.TabsIds);
DragAndDrop.TabsIdsParents = Object.assign([], Tabs.TabsIdsParents);
DragAndDrop.TabsIdsSelected = Object.assign([], Tabs.TabsIdsSelected);
DragAndDrop.Folders = Object.assign({}, {});
DragAndDrop.FoldersSelected = Object.assign([], []);
}
chrome.runtime.sendMessage({
command: "drag_drop",
DragNodeClass: DragAndDrop.DragNodeClass,
TabsIds: DragAndDrop.TabsIds,
TabsIdsParents: DragAndDrop.TabsIdsParents,
TabsIdsSelected: DragAndDrop.TabsIdsSelected,
ComesFromWindowId: CurrentWindowId,
Depth: DragAndDrop.Depth,
Folders: DragAndDrop.Folders,
FoldersSelected: DragAndDrop.FoldersSelected
}); });
chrome.runtime.sendMessage({command: "drag_drop", DragNodeClass: "tab", SelectedTabsIds: DragAndDrop.SelectedTabsIds, TabsIds: DragAndDrop.TabsIds, Parents: DragAndDrop.Parents, ComesFromWindowId: CurrentWindowId, Depth: DragAndDrop.Depth});
}); });
$(document).on("dragleave", ".highlighted_drop_target", function(event) { // REMOVE DROP TARGET WHEN DRAG LEAVES
// REMOVE DROP TARGET WHEN DRAG LEAVES
$(document).on("dragleave", ".highlighted_drop_target", function(event) {
$(".highlighted_drop_target").removeClass("highlighted_drop_target"); $(".highlighted_drop_target").removeClass("highlighted_drop_target");
}); });
$(document).on("dragenter", ".pin>.drag_entered_top:not(.highlighted_drop_target), .pin>.drag_entered_bottom:not(.highlighted_drop_target)", function(event) { // SET DROP TARGET WHEN ENTERING PINS
// SET DROP TARGET WHEN ENTERING PINS
$(document).on("dragenter", ".pin>.drag_entered_top:not(.highlighted_drop_target), .pin>.drag_entered_bottom:not(.highlighted_drop_target)", function(event) {
event.stopPropagation(); event.stopPropagation();
if (DragAndDrop.DragNodeClass == "tab") { if (DragAndDrop.DragNodeClass == "tab") {
$(".highlighted_drop_target").removeClass("highlighted_drop_target"); $(".highlighted_drop_target").removeClass("highlighted_drop_target");
$(this).addClass("highlighted_drop_target"); $(this).addClass("highlighted_drop_target");
} }
}); });
$(document).on("dragenter", ".tab>.drag_entered_top:not(.highlighted_drop_target), .tab>.drag_entered_bottom:not(.highlighted_drop_target)", function(event) { // SET DROP TARGET WHEN ENTERING TABS
// SET DROP TARGET WHEN ENTERING TABS
$(document).on("dragenter", ".tab>.drag_entered_top:not(.highlighted_drop_target), .tab>.drag_entered_bottom:not(.highlighted_drop_target)", function(event) {
event.stopPropagation(); event.stopPropagation();
if ($(".selected:visible").find($(this)).length == 0 && DragAndDrop.DragNodeClass == "tab") { if (DragAndDrop.DragNodeClass == "tab") {
if (opt.max_tree_drag_drop && opt.max_tree_depth >= 0) { if ($(".selected_tab:visible").find($(this)).length == 0) {
if ($(this).parents(".tab").length + DragAndDrop.Depth > opt.max_tree_depth+1) { return; } if (opt.max_tree_drag_drop && opt.max_tree_depth >= 0) {
if ($(this).parents(".tab").length + DragAndDrop.Depth-1 > opt.max_tree_depth) {
return;
}
}
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
$(this).addClass("highlighted_drop_target");
} }
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
$(this).addClass("highlighted_drop_target");
} }
}); });
$(document).on("dragenter", ".tab>.drag_enter_center:not(.highlighted_drop_target)", function(event) { $(document).on("dragenter", ".tab>.drag_enter_center:not(.highlighted_drop_target)", function(event) {
event.stopPropagation(); event.stopPropagation();
if ($(".selected:visible").find($(this)).length == 0 && DragAndDrop.DragNodeClass == "tab" && opt.max_tree_depth != 0) { if (DragAndDrop.DragNodeClass == "tab") {
if (opt.max_tree_drag_drop) { if ($(".selected_tab:visible").find($(this)).length == 0 && opt.max_tree_depth != 0) {
if (opt.max_tree_depth == 0) { return; } if (opt.max_tree_drag_drop && opt.max_tree_depth > 0) {
if ($(this).parents(".tab").length + DragAndDrop.Depth > opt.max_tree_depth) { return; } if ($(this).parents(".tab").length + DragAndDrop.Depth > opt.max_tree_depth) {
return;
}
}
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
$(this).addClass("highlighted_drop_target");
} }
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
$(this).addClass("highlighted_drop_target");
} }
}); });
$(document).on("dragenter", ".folder>.drag_entered_top:not(.highlighted_drop_target), .folder>.drag_entered_bottom:not(.highlighted_drop_target), .folder>.drag_enter_center:not(.highlighted_drop_target)", function(event) { // SET DROP TARGET WHEN ENTERING FOLDERS
// SET DROP TARGET WHEN ENTERING FOLDERS
$(document).on("dragenter", ".folder>.drag_entered_top:not(.highlighted_drop_target), .folder>.drag_entered_bottom:not(.highlighted_drop_target), .folder>.drag_enter_center:not(.highlighted_drop_target)", function(event) {
event.stopPropagation(); event.stopPropagation();
if (DragAndDrop.DragNodeClass != "group") { if (DragAndDrop.DragNodeClass == "folder") {
// if (/* $(".selected:visible").find($(this)).length > 0 || */ DragAndDrop.DragNodeClass != "folder") { return; }
$(".highlighted_drop_target").removeClass("highlighted_drop_target"); $(".highlighted_drop_target").removeClass("highlighted_drop_target");
$(this).addClass("highlighted_drop_target"); $(this).addClass("highlighted_drop_target");
} }
}); });
$(document).on("dragenter", ".folder>.drag_enter_center:not(.highlighted_drop_target)", function(event) {
// SET DROP TARGET, PIN_LIST, TAB_LIST, GROUP OR GROUP_BUTTON event.stopPropagation();
$(document).on("dragover", "#pin_list, .group, .group_drag_box", function(event) { if (DragAndDrop.DragNodeClass == "tab") {
if (DragAndDrop.DragNodeClass != "group" && $(".highlighted_drop_target").length == 0 && event.target.className == $(this)[0].className) { $(".highlighted_drop_target").removeClass("highlighted_drop_target");
$(this).addClass("highlighted_drop_target"); $(this).addClass("highlighted_drop_target");
} }
}); });
$(document).on("dragover", "#pin_list, .group, .group_drag_box", function(event) { // SET DROP TARGET, PIN_LIST, TAB_LIST, GROUP OR GROUP_BUTTON
// TIMER FOR FOR AUTO EXPAND if (DragAndDrop.DragNodeClass != "group") {
$(document).on("dragenter", ".drag_enter_center", function(event) { if ($(".highlighted_drop_target").length == 0 && event.target.className == $(this)[0].className) {
$(this).addClass("highlighted_drop_target");
}
}
});
$(document).on("dragenter", ".drag_enter_center", function(event) { // TIMER FOR FOR AUTO EXPAND
event.stopPropagation(); event.stopPropagation();
DragAndDrop.timeout = false; DragAndDrop.timeout = false;
setTimeout(function() { DragAndDrop.timeout = true; }, 1800); setTimeout(function() {
DragAndDrop.timeout = true;
}, 1800);
}); });
$(document).on("dragleave", ".drag_enter_center", function(event) { $(document).on("dragleave", ".drag_enter_center", function(event) {
DragAndDrop.timeout = false; DragAndDrop.timeout = false;
@ -167,190 +201,212 @@ function SetDragAndDropEvents() {
DragAndDrop.timeout = false; DragAndDrop.timeout = false;
} }
}); });
$(document).on("drop", "*", function(event) { // DROP
// DROP chrome.runtime.sendMessage({command: "dropped", DroppedToWindowId: CurrentWindowId});
$(document).on("drop", "*", function(event) {
event.stopPropagation(); event.stopPropagation();
if (DragAndDrop.ComesFromWindowId == CurrentWindowId /* && ($(window).width() > event.clientX || $(window).height() > event.clientY) */) { if (DragAndDrop.ComesFromWindowId == CurrentWindowId) {
DropToTarget($(".highlighted_drop_target")); DropToTarget($(".highlighted_drop_target"));
} else { } else {
$(".selected").addClass("selected_frozen").removeClass("selected"); if (Object.keys(DragAndDrop.Folders).length > 0) {
for (var folder in DragAndDrop.Folders) {
bgfolders[DragAndDrop.Folders[folder].id] = Object.assign({}, DragAndDrop.Folders[folder]);
}
AppendFolders(bgfolders);
}
$(".selected_tab").addClass("selected_frozen").removeClass("selected_tab");
let target = $(".highlighted_drop_target"); let target = $(".highlighted_drop_target");
let counter = DragAndDrop.TabsIds.length; let counter = 0;
(DragAndDrop.TabsIds).forEach(function(TabId) { (DragAndDrop.TabsIds).forEach(function(TabId) {
chrome.tabs.move(TabId, { windowId: CurrentWindowId, index: -1 }, function(MovedTab) { chrome.tabs.move(TabId, { windowId: CurrentWindowId, index: -1 }, function(MovedTab) {
counter--; if (browserId == "F") { // FIRFOX BUG 1398272 - HAVE TO REPLACE ORIGINAL ID
setTimeout(function() { if ((DragAndDrop.TabsIdsParents).indexOf("ch"+DragAndDrop.TabsIds[counter]) != -1) {
if (counter == 0) { DragAndDrop.TabsIdsParents[(DragAndDrop.TabsIdsParents).indexOf("ch"+DragAndDrop.TabsIds[counter])] = "ch"+MovedTab[0].id;
setTimeout(function() {
(DragAndDrop.SelectedTabsIds).forEach(function(selectedTabId) {
if ($("#"+selectedTabId)[0]){
$("#"+selectedTabId).addClass("selected_temporarly").addClass("selected");
}
});
if (browserId != "F") { // I HAVE TO EXLUDE THIS IN FIREFOX SINCE MOVED TAB LOSES ITS ORIGINAL ID - WHAT IN THE ACTUAL F*CK MOZILLA!
for (var tabsIdsIndex = 1; tabsIdsIndex < (DragAndDrop.TabsIds).length; tabsIdsIndex++) {
if ($("#"+DragAndDrop.TabsIds[tabsIdsIndex])[0] && $("#"+DragAndDrop.Parents[tabsIdsIndex])[0]){
$("#"+DragAndDrop.Parents[tabsIdsIndex]).append($("#"+DragAndDrop.TabsIds[tabsIdsIndex]));
}
}
}
DropToTarget(target);
},300);
} }
},300); if ((DragAndDrop.TabsIdsSelected).indexOf(DragAndDrop.TabsIds[counter]) != -1) {
DragAndDrop.TabsIdsSelected[(DragAndDrop.TabsIdsSelected).indexOf(DragAndDrop.TabsIds[counter])] = MovedTab[0].id;
}
DragAndDrop.TabsIds[counter] = MovedTab[0].id;
}
counter++;
if (counter == DragAndDrop.TabsIds.length) {
setTimeout(function() {
(DragAndDrop.TabsIdsSelected).forEach(function(selectedTabId) {
if ($("#"+selectedTabId)[0]) {
$("#"+selectedTabId).addClass("selected_temporarly").addClass("selected_tab");
}
});
for (var tabsIdsIndex = 1; tabsIdsIndex < (DragAndDrop.TabsIds).length; tabsIdsIndex++) {
if ($("#"+DragAndDrop.TabsIds[tabsIdsIndex])[0] && $("#"+DragAndDrop.TabsIdsParents[tabsIdsIndex])[0]) {
$("#"+DragAndDrop.TabsIdsParents[tabsIdsIndex]).append($("#"+DragAndDrop.TabsIds[tabsIdsIndex]));
}
}
for (var FolderSelectedIndex = 0; FolderSelectedIndex < (DragAndDrop.FoldersSelected).length; FolderSelectedIndex++) {
if ($("#"+DragAndDrop.FoldersSelected[FolderSelectedIndex])[0]) {
$("#"+DragAndDrop.FoldersSelected[FolderSelectedIndex]).addClass("selected_folder_temporarly").addClass("selected_folder");
}
}
DropToTarget(target);
}, 300);
}
}); });
}); });
} }
$(".drop_target").css({"pointer-events": "none"});
}); });
$(document).on("dragend", ".tab_header, .folder_header", function(event) { // DETACH TABS
// DETACH setTimeout(function() {
$(document).on("dragend", ".tab_header", function(event) { if (DragAndDrop.ComesFromWindowId == CurrentWindowId && DragAndDrop.DroppedToWindowId == 0) {
if (DragAndDrop.ComesFromWindowId == CurrentWindowId) { if ( (browserId == "F" && (event.screenX < event.view.mozInnerScreenX || event.screenX > (event.view.mozInnerScreenX + $(window).width()) || (event.screenY < event.view.mozInnerScreenY || event.screenY > (event.view.mozInnerScreenY + $(window).height()))))
if (browserId == "F" && (event.screenX < event.view.mozInnerScreenX || event.screenX > (event.view.mozInnerScreenX + $(window).width()) || (event.screenY < event.view.mozInnerScreenY || event.screenY > (event.view.mozInnerScreenY + $(window).height())))) { || (browserId != "F" && (event.pageX < 0 || event.pageX > $(window).width() || event.pageY < 0 || event.pageY > $(window).height()))
DetachTabs(DragAndDrop.TabsIds); ) {
if (DragAndDrop.DragNodeClass == "tab") {
DetachTabs(DragAndDrop.TabsIds, {});
}
if (DragAndDrop.DragNodeClass == "folder") {
DetachTabs(DragAndDrop.TabsIds, DragAndDrop.Folders);
setTimeout(function() {
SaveFolders();
}, 500);
}
}
} }
if (browserId != "F" && (event.pageX < 0 || event.pageX > $(window).width() || event.pageY < 0 || event.pageY > $(window).height())) { }, 200);
DetachTabs(DragAndDrop.TabsIds); $(".drop_target").css({"pointer-events": "none"});
}
}
}); });
$(document).on("dragstart", ".group_drag_box", function(event) { // DRAGGING GROUPS
// dragging groups
$(document).on("dragstart", ".group_drag_box", function(event) {
event.originalEvent.dataTransfer.setData("null", "null"); event.originalEvent.dataTransfer.setData("null", "null");
event.originalEvent.dataTransfer.setDragImage(document.getElementById("DragImage"), 0, 0); event.originalEvent.dataTransfer.setDragImage(document.getElementById("DragImage"), 0, 0);
DragAndDrop.DragNodeClass = "group"; DragAndDrop.DragNodeClass = "group";
DragAndDrop.DragNode = $(this).parent(); DragAndDrop.DragNode = $(this).parent();
$(".highlighted_drop_target").removeClass("highlighted_drop_target"); $(".highlighted_drop_target").removeClass("highlighted_drop_target");
}); });
$(document).on("dragenter", ".group_drag_box", function(event) { // WHEN DRAGGING THE GROUP, MOVE IT UP OR DOWN
if (DragAndDrop.DragNodeClass == "group") {
// when dragging the group, move it up or down if (DragAndDrop.DragNode != undefined && $(this).parent() != DragAndDrop.DragNode) {
$(document).on("dragenter", ".group_drag_box", function(event) { if ($(this).parent().index() <= DragAndDrop.DragNode.index()) {
if (DragAndDrop.DragNode != undefined && DragAndDrop.DragNodeClass == "group" && $(this).parent() != DragAndDrop.DragNode) { DragAndDrop.DragNode.insertBefore($(this).parent());
if ( $(this).parent().index() <= DragAndDrop.DragNode.index() ) { } else {
DragAndDrop.DragNode.insertBefore($(this).parent()); if ($(this).parent().index() > DragAndDrop.DragNode.index()) {
} else { DragAndDrop.DragNode.insertAfter($(this).parent());
if ($(this).parent().index() > DragAndDrop.DragNode.index()) { }
DragAndDrop.DragNode.insertAfter($(this).parent());
} }
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
} }
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
} }
}); });
$(document).on("dragend", ".group_drag_box", function(event) { // WHEN FINISHED DRAGGING THE GROUP
// when finished dragging the group
$(document).on("dragend", ".group_drag_box", function(event) {
DragAndDrop.DragNodeClass = "";
DragAndDrop.DragNode = undefined; DragAndDrop.DragNode = undefined;
UpdateBgGroupsOrder(); UpdateBgGroupsOrder();
$(".highlighted_drop_target").removeClass("highlighted_drop_target"); $(".highlighted_drop_target").removeClass("highlighted_drop_target");
RearrangeGroupsLists();
$(".drop_target").css({"pointer-events": "none"});
if (opt.syncro_tabbar_groups_tabs_order) {
schedule_rearrange_tabs++;
}
}); });
} }
function DropToTarget(TargetNode) { function DropToTarget(TargetNode) {
// dropped on pin if (DragAndDrop.DragNodeClass == "tab") {
if (TargetNode.parent().is(".pin")) { if (TargetNode.parent().is(".pin")) { // dropped on pin
$(".selected").each(function() { $(".selected_tab").each(function() {
SetTabClass({ id: this.id, pin: true }); SetTabClass({ id: this.id, pin: true });
if (TargetNode.is(".drag_entered_top")) {
$(this).insertBefore(TargetNode.parent());
} else {
$(this).insertAfter(TargetNode.parent());
}
});
}
if (TargetNode.is("#pin_list")) { // dropped on pin_list
$(".selected_tab").each(function() {
SetTabClass({ id: this.id, pin: true });
});
TargetNode.append($(".selected_tab"));
}
if (TargetNode.parent().is(".tab, .folder")) { // dropped on tab or folder
if (TargetNode.parent().is(".selected_tab")) {
TargetNode.parent().addClass("highlighted_selected").removeClass("selected_tab");
}
$(".selected_tab").each(function() {
SetTabClass({ id: this.id, pin: false });
});
if (TargetNode.is(".drag_entered_top")) { if (TargetNode.is(".drag_entered_top")) {
$(this).insertBefore(TargetNode.parent()); $($(".selected_tab").get().reverse()).insertBefore(TargetNode.parent());
} else {
$(this).insertAfter(TargetNode.parent());
} }
}); if (TargetNode.is(".drag_entered_bottom")) {
} $($(".selected_tab").get().reverse()).insertAfter(TargetNode.parent());
}
// dropped on pin_list if (TargetNode.is(".drag_enter_center")) {
if (TargetNode.is("#pin_list")) { if (opt.append_child_tab == "bottom") {
$(".selected").each(function() { $("#ch" + TargetNode[0].id.substr(2)).append($($(".selected_tab").get().reverse()));
SetTabClass({ id: this.id, pin: true }); } else {
}); $("#ch" + TargetNode[0].id.substr(2)).prepend($($(".selected_tab").get().reverse()));
TargetNode.append($(".selected")); }
}
// dropped on tab
if (TargetNode.parent().is(".tab, .folder")) {
if (TargetNode.parent().is(".selected")) {
TargetNode.parent().addClass("highlighted_selected").removeClass("selected");
}
$(".selected").each(function() {
SetTabClass({ id: this.id, pin: false });
});
if (TargetNode.is(".drag_entered_top")) {
$($(".selected").get().reverse()).insertBefore(TargetNode.parent());
}
if (TargetNode.is(".drag_entered_bottom")) {
$($(".selected").get().reverse()).insertAfter(TargetNode.parent());
}
if (TargetNode.is(".drag_enter_center")) {
if (opt.append_child_tab == "bottom") {
$("#ch" + TargetNode[0].id.substr(2)).append($($(".selected").get().reverse()));
} else {
$("#ch" + TargetNode[0].id.substr(2)).prepend($($(".selected").get().reverse()));
} }
} }
if (TargetNode.is(".group")) { // dropped on group (tab list)
$(".selected_tab").each(function() {
SetTabClass({ id: this.id, pin: false });
});
$("#ch"+TargetNode[0].id).append($($(".selected_tab").get().reverse()));
}
if (TargetNode.is(".group_drag_box")) { // dropped on group button (group list)
$(".selected_tab").each(function() {
SetTabClass({ id: this.id, pin: false });
});
$("#ch"+TargetNode[0].id.substr(1)).append($($(".selected_tab").get().reverse()));
}
$(".highlighted_selected").addClass("selected_tab").removeClass("highlighted_selected");
$(".selected_frozen").addClass("selected_tab").removeClass("selected_frozen");
$(".selected_temporarly").removeClass("selected_tab").removeClass("selected_temporarly");
} }
if (DragAndDrop.DragNodeClass == "folder") { // dropped on group button (group list)
// dropped on group (tab list) if (TargetNode.is(".group_drag_box")) {
if (TargetNode.is(".group")) { $("#cf"+TargetNode[0].id.substr(1)).append($($(".selected_folder").get().reverse()));
$(".selected").each(function() { }
SetTabClass({ id: this.id, pin: false }); if (TargetNode.parent().is(".folder")) { // dropped on folder
}); if (TargetNode.parent().is(".selected_folder")) {
TargetNode.append($($(".selected").get().reverse())); TargetNode.parent().addClass("highlighted_selected").removeClass("selected_folder");
}
if (TargetNode.is(".drag_entered_top")) {
$($(".selected_folder").get().reverse()).insertBefore(TargetNode.parent());
}
if (TargetNode.is(".drag_entered_bottom")) {
$($(".selected_folder").get().reverse()).insertAfter(TargetNode.parent());
}
if (TargetNode.is(".drag_enter_center")) {
if (opt.append_child_tab == "bottom") {
$("#cf" + TargetNode[0].id.substr(2)).append($($(".selected_folder").get().reverse()));
} else {
$("#cf" + TargetNode[0].id.substr(2)).prepend($($(".selected_folder").get().reverse()));
}
}
}
$(".highlighted_selected").addClass("selected_folder").removeClass("highlighted_selected");
$(".selected_folder_frozen").addClass("selected_folder").removeClass("selected_folder_frozen");
$(".selected_folder_temporarly").removeClass("selected_folder").removeClass("selected_folder_temporarly");
setTimeout(function() {
SaveFolders();
}, 300);
} }
// dropped on group button (group list)
if (TargetNode.is(".group_drag_box")) {
$(".selected").each(function() {
SetTabClass({ id: this.id, pin: false });
});
$("#"+TargetNode[0].id.substr(1)).append($($(".selected").get().reverse()));
}
$(".highlighted_selected").addClass("selected").removeClass("highlighted_selected");
// if ($(".tab.active:visible")[0] == undefined) {
// bggroups[$("#"+tabId).parents(".group")[0].id].activetab = parseInt(tabId);
// if ($("#"+tabId).parents(".group")[0].id != active_group) {
// SetActiveGroup($("#"+tabId).parents(".group")[0].id, false, true);
// }
// chrome.runtime.sendMessage({command: "save_groups", groups: bggroups, windowId: CurrentWindowId});
// }
RefreshExpandStates(); RefreshExpandStates();
DragAndDrop.timeout = false; DragAndDrop.timeout = false;
RefreshGUI(); RefreshGUI();
RefreshCounters();
if (opt.syncro_tabbar_tabs_order) {
let TTtabsIndexes = $(".pin, .tab").map(function(){return parseInt(this.id);}).toArray();
chrome.tabs.move(DragAndDrop.TabsIds, {index: TTtabsIndexes.indexOf(DragAndDrop.TabsIds[0])});
setTimeout(function() {
schedule_rearrange_tabs++;
}, 500);
}
setTimeout(function() { setTimeout(function() {
DropTargetsSendToBack();
schedule_update_data++; schedule_update_data++;
schedule_rearrange_tabs++;
}, 500); }, 500);
TargetNode.removeClass("highlighted_drop_target"); TargetNode.removeClass("highlighted_drop_target");
$(".tab_header_hover").removeClass("tab_header_hover"); $(".tab_header_hover").removeClass("tab_header_hover");
$(".selected_frozen").addClass("selected").removeClass("selected_frozen"); $(".folder_header").removeClass("folder_header_hover");
$(".selected_temporarly").removeClass("selected").removeClass("selected_temporarly"); $(".dragover_highlight").removeClass("dragover_highlight"); // this is group dragover indicator
// this is group dragover indicator
$(".dragover_highlight").removeClass("dragover_highlight");
} }

View File

@ -3,70 +3,193 @@
// that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/ // that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/
function AddNewFolder() { function AddNewFolder(p) {
var ID = GenerateNewFolderID(); var newId = GenerateNewFolderID();
AppendFolder({id: ID, name: "untitled"}); bgfolders[newId] = { id: newId, parent: (p.ParentId ? p.ParentId : ""), index: (p.index ? p.index : 0), name: (p.name ? p.name : caption_noname_group), expand: (p.expand ? p.expand : "n") };
AppendFolder({id: newId, ParentId: (p.ParentId ? p.ParentId : ""), name: caption_noname_group});
SaveFolders();
RefreshCounters();
return newId;
} }
function AppendFolder(param) { function AppendFolder(param) {
var fd = document.createElement("div"); fd.className = "folder c"; fd.id = param.id;// FOLDER if ($("#"+param.id).length == 0) {
var dc = document.createElement("div"); dc.className = "drop_target drag_enter_center"; dc.id = "dc"+param.id; fd.appendChild(dc); // DROP TARGET CENTER var fd = document.createElement("div"); fd.className = "folder "; if (param.expand) { fd.className += param.expand } fd.id = param.id;// FOLDER
var dt = document.createElement("div"); dt.className = "drop_target drag_entered_top"; dt.id = "du"+param.id; fd.appendChild(dt); // DROP TARGET TOP var dc = document.createElement("div"); dc.className = "drop_target drag_enter_center"; dc.id = "dc"+param.id; fd.appendChild(dc); // DROP TARGET CENTER
var db = document.createElement("div"); db.className = "drop_target drag_entered_bottom"; db.id = "dd"+param.id; fd.appendChild(db); // DROP TARGET BOTTOM var dt = document.createElement("div"); dt.className = "drop_target drag_entered_top"; dt.id = "du"+param.id; fd.appendChild(dt); // DROP TARGET TOP
var db = document.createElement("div"); db.className = "drop_target drag_entered_bottom"; db.id = "dd"+param.id; fd.appendChild(db); // DROP TARGET BOTTOM
var fh = document.createElement("div"); fh.className = opt.always_show_close ? "folder_header close_show" : "folder_header"; fh.id = "folder_header"+param.id; fh.draggable = true; fd.appendChild(fh); // HEADER
var fh = document.createElement("div"); fh.className = "folder_header"; fh.id = "tab_header"+param.id; fh.draggable = true; fd.appendChild(fh); // HEADER var ex = document.createElement("div"); ex.className = "folder_icon"; ex.id = "fop"+param.id; fh.appendChild(ex);
var ex = document.createElement("div"); ex.className = "folder_icon"; ex.id = "fop"+param.id; fh.appendChild(ex); var ft = document.createElement("div"); ft.className = "folder_title"; ft.id = "folder_title"+param.id; ft.textContent = param.name; fh.appendChild(ft); // TITLE
var ft = document.createElement("div"); ft.className = "folder_title"; ft.id = "folder_title"+param.id; ft.textContent = param.name; fh.appendChild(ft); // TITLE var cf = document.createElement("div"); cf.className = "children"; cf.id = "cf"+param.id; fd.appendChild(cf);
// $("#tab_title" + tab.id)[0].textContent = title; var ch = document.createElement("div"); ch.className = "children"; ch.id = "ch"+param.id; fd.appendChild(ch);
// $("#tab_header" + tab.id).attr("title", title); if (!opt.never_show_close) {
var cl = document.createElement("div"); cl.className = "close"; cl.id = "close"+param.id; fh.appendChild(cl); // CLOSE BUTTON
var ci = document.createElement("div"); ci.className = "close_img"; ci.id = "close_img"+param.id; cl.appendChild(ci);
}
if (param.ParentId == "" || param.ParentId == undefined || $("#cf"+param.ParentId).length == 0) {
var ch = document.createElement("div"); ch.className = "children"; ch.id = "ch"+param.id; fd.appendChild(ch); $("#cf"+active_group).append(fd);
// var tt = document.createElement("div"); tt.className = "tab_title"; tt.id = "tab_title"+param.tab.id; th.appendChild(tt); // TITLE } else {
$("#cf"+param.ParentId).append(fd);
$("#"+active_group).append(fd); }
}
} }
function GenerateNewFolderID() {
function GenerateNewFolderID(){
var newID = "f_"+GenerateRandomID(); var newID = "f_"+GenerateRandomID();
console.log("generating "+newID);
if ($("#"+newID)[0]) { if ($("#"+newID)[0]) {
GenerateNewFolderID(); GenerateNewFolderID();
console.log("exists "+newID);
} else { } else {
console.log("yay this is ok "+newID);
return newID; return newID;
} }
} }
function AppendFolders(Folders) {
for (var folderId in Folders) {
AppendFolder({id: folderId, ParentId: Folders[folderId].parent, name: Folders[folderId].name, expand: Folders[folderId].expand});
}
// APPEND FOLDERS TO PARENTS
for (var folderId in Folders) {
if ($("#"+folderId)[0] && Folders[folderId].parent != $("#"+folderId).parent().parent()[0].id) {
$("#cf"+Folders[folderId].parent).append($("#"+folderId));
}
}
}
function SaveFolders() {
$(".folder").each(function() {
bgfolders[this.id].parent = $(this).parent().parent()[0].id;
bgfolders[this.id].index = $(this).index();
bgfolders[this.id].expand = ($(this).is(".n") ? "n" : ($(this).is(".c") ? "c" : "o"));
});
chrome.runtime.sendMessage({command: "save_folders", folders: bgfolders, windowId: CurrentWindowId});
}
function RearrangeFolders(first_loop) {
$(".folder").each(function() {
if (bgfolders[this.id] && $(this).parent().children().eq(bgfolders[this.id].index)[0]) {
if ($(this).index() > bgfolders[this.id].index) {
$(this).insertBefore($(this).parent().children().eq(bgfolders[this.id].index));
} else {
$(this).insertAfter($(this).parent().children().eq(bgfolders[this.id].index));
}
}
if (bgfolders[this.id] && $(this).index() != bgfolders[this.id].index && first_loop) {
RearrangeFolders(false);
}
});
}
function RemoveFolder(FolderId) {
if ($("#"+FolderId)[0]) {
if (opt.promote_children == true) {
if (opt.promote_children_in_first_child == true && $("#cf"+FolderId).children().length > 0) {
let FirstChild = $("#cf"+FolderId).children()[0];
$(FirstChild).insertAfter($("#"+FolderId));
$("#cf"+FirstChild.id).append($("#cf"+FolderId).children());
if ($("#ch"+FolderId).children().length > 0) {
$("#ch"+FirstChild.id).append($("#ch"+FolderId).children());
}
} else {
$("#ch"+($("#"+FolderId).parent().parent()[0].id)).append($("#ch"+FolderId).children());
$("#cf"+FolderId).children().insertAfter($("#"+FolderId));
}
} else {
$("#"+FolderId+" .tab").each(function() {
chrome.tabs.remove(parseInt(this.id), null);
});
$("#"+FolderId+" .folder").each(function() {
delete bgfolders[this.id];
});
}
$("#"+FolderId).remove();
delete bgfolders[FolderId];
RefreshExpandStates();
chrome.runtime.sendMessage({command: "save_folders", folders: bgfolders, windowId: CurrentWindowId});
}
}
function SetActiveFolder(FolderId) {
if ($("#"+FolderId).length > 0) {
$(".selected_folder").removeClass("selected_folder");
$("#"+FolderId).addClass("selected_folder");
}
}
// Rename folder popup
function ShowRenameFolderDialog(FolderId) {
$("#folder_edit_name")[0].value = bgfolders[FolderId].name;
$("#folder_edit_name").data("FolderId", FolderId);
$("#folder_edit").css({"display": "block", "top": $("#toolbar_groups").offset().top + 8, "left": 22});
}
// when pressed OK in folder popup
function FolderRenameConfirm() {
$("#folder_edit_name")[0].value = $("#folder_edit_name")[0].value.replace(/[\f\n\r\v\t\<\>\+\-\(\)\.\,\;\:\~\/\|\?\@\!\"\'\£\$\%\&\^\#\=\*\[\]]?/gi, "");
bgfolders[$("#folder_edit_name").data("FolderId")].name = $("#folder_edit_name")[0].value;
$("#folder_title"+$("#folder_edit_name").data("FolderId"))[0].innerText = $("#folder_edit_name")[0].value;
$(".edit_dialog").hide(0);
chrome.runtime.sendMessage({command: "save_folders", folders: bgfolders, windowId: CurrentWindowId});
RefreshCounters();
}
function SetFolderEvents() { function SetFolderEvents() {
// EXPAND BOX - EXPAND / COLLAPSE // EXPAND BOX - EXPAND / COLLAPSE
$(document).on("mousedown", ".folder_icon", function(event) { $(document).on("click", ".folder_icon", function(event) {
event.stopPropagation(); event.stopPropagation();
if (event.button == 0) { if (event.button == 0) {
if ($(this).parent().parent().is(".o")) { if ($(this).parent().parent().is(".o")) {
$(this).parent().parent().removeClass("o").addClass("c"); $(this).parent().parent().removeClass("o").addClass("c");
// chrome.runtime.sendMessage({ command: "update_tab", tabId: parseInt($(this).parent().parent()[0].id), tab: { expand: "c" } });
} else { } else {
if ($(this).parent().parent().is(".c")) { if ($(this).parent().parent().is(".c")) {
$(this).parent().parent().removeClass("c").addClass("o"); $(this).parent().parent().removeClass("c").addClass("o");
// chrome.runtime.sendMessage({ command: "update_tab", tabId: parseInt($(this).parent().parent()[0].id), tab: { expand: "o" } });
// if (opt.close_other_trees) {
// $(".o:visible:not(#"+$(this).parent().parent()[0].id+")").removeClass("o").addClass("c");
// $(this).parents(".tab").each(function() {
// $(this).removeClass("n").removeClass("c").addClass("o");
// chrome.runtime.sendMessage({ command: "update_tab", tabId: parseInt(this.id), tab: { expand: "o" } });
// });
// $(".c").each(function() {
// chrome.runtime.sendMessage({ command: "update_tab", tabId: parseInt(this.id), tab: { expand: "c" } });
// });
// }
} }
} }
RefreshExpandStates();
RefreshCounters();
SaveFolders();
}
});
// SINGLE CLICK TO ACTIVATE FOLDER
$(document).on("click", ".folder_header", function(event) {
event.stopPropagation();
if (event.button == 0 && !event.shiftKey) {
$("#"+active_group+" .tab").removeClass("selected_tab");
if (!event.ctrlKey) {
$(".selected_folder:not(#"+($(this).parent()[0].id)+")").removeClass("selected_folder");
}
// SetActiveFolder();
$(this).parent().toggleClass("selected_folder");
}
});
// CLOSE TAB/PIN
$(document).on("mousedown", ".folder_header", function(event) {
if ((event.button == 1 && opt.close_with_MMB == true) || (event.button == 0 && $(event.target).is(".close, .close_img"))) {
RemoveFolder($(this).parent()[0].id);
}
if (event.button == 2) {
event.stopPropagation();
ShowFolderMenu($(this).parent(), event);
}
});
// edit folder dialog box
$(document).on("mousedown", "#folder_edit_discard", function(event) {
$(".edit_dialog").hide(0);
});
$("#folder_edit_name").keyup(function(e) {
if (e.keyCode == 13) {
FolderRenameConfirm();
}
});
$(document).on("mousedown", "#folder_edit_confirm", function(event) {
FolderRenameConfirm();
});
// edit folder
$(document).on("dblclick", ".folder_title", function(event) {
if (event.button == 0) {
ShowRenameFolderDialog($(this).parent().parent()[0].id);
}
});
$(document).on("mouseover", ".folder_header", function(event) {
$(this).addClass("folder_header_hover");
if (opt.always_show_close == false) {
$(this).addClass("close_show");
}
});
$(document).on("mouseleave", ".folder_header", function(event) {
$(this).removeClass("folder_header_hover");
if (opt.always_show_close == false) {
$(this).removeClass("close_show");
} }
}); });
} }

View File

@ -4,41 +4,42 @@
// ********** GLOBAL VARIABLES FOR BACKGROUND, OPTIONS AND SIDEBAR *************** // ********** GLOBAL VARIABLES FOR BACKGROUND, OPTIONS AND SIDEBAR ***************
var running = false; var running = false;
var schedule_save = 0; var schedule_save = -999;
var schedule_update_indexes = 0; var schedule_update_data = 0;
var schedule_rearrange_tabs = 0; var schedule_rearrange_tabs = 0;
var schedule_rearrange_reverse = false;
var windows = {}; var windows = {};
var tabs = {}; var tabs = {};
var MouseHoverOver = ""; var MouseHoverOver = "";
var DragAndDrop = {
timeout: false,
var DragAndDrop = {timeout: false, DragNode: undefined, DragNodeClass: "", SelectedTabsIds: [], TabsIds: [], Parents: [], ComesFromWindowId: 0, Depth: 0}; DragNode: undefined,
var DropTargetsInFront = false; DragNodeClass: "",
TabsIds: [],
TabsIdsParents: [],
var menuTabId = 0; TabsIdsSelected: [],
Folders: {},
FoldersSelected: [],
ComesFromWindowId: 0,
DroppedToWindowId: 0,
Depth: 0
};
var menuItemId = 0;
var CurrentWindowId = 0; var CurrentWindowId = 0;
var SearchIndex = 0; var SearchIndex = 0;
var schedule_update_data = 0;
var active_group = "tab_list"; var active_group = "tab_list";
var PickColor = ""; var PickColor = "";
var opt = {}; var opt = {};
var browserId = navigator.userAgent.match("Opera") !== null ? "O" : ( navigator.userAgent.match("Vivaldi") !== null ? "V" : (navigator.userAgent.match("Firefox") !== null ? "F" : "C" ) ); var browserId = navigator.userAgent.match("Opera") !== null ? "O" : ( navigator.userAgent.match("Vivaldi") !== null ? "V" : (navigator.userAgent.match("Firefox") !== null ? "F" : "C" ) );
var bgtabs = {}; var bgtabs = {};
var bggroups = {}; var bggroups = {};
var bgfolders = {};
var caption_clear_filter = chrome.i18n.getMessage("caption_clear_filter"); var caption_clear_filter = chrome.i18n.getMessage("caption_clear_filter");
var caption_loading = chrome.i18n.getMessage("caption_loading"); var caption_loading = chrome.i18n.getMessage("caption_loading");
var caption_searchbox = chrome.i18n.getMessage("caption_searchbox"); var caption_searchbox = chrome.i18n.getMessage("caption_searchbox");
var caption_ungrouped_group = chrome.i18n.getMessage("caption_ungrouped_group"); var caption_ungrouped_group = chrome.i18n.getMessage("caption_ungrouped_group");
var caption_noname_group = chrome.i18n.getMessage("caption_noname_group"); var caption_noname_group = chrome.i18n.getMessage("caption_noname_group");
var DefaultToolbar = var DefaultToolbar =
'<div id=toolbar_main>'+ '<div id=toolbar_main>'+
'<div class=button id=button_new><div class=button_img></div></div>'+ '<div class=button id=button_new><div class=button_img></div></div>'+
@ -48,7 +49,7 @@ var DefaultToolbar =
'<div class=button id=button_tools><div class=button_img></div></div>'+ '<div class=button id=button_tools><div class=button_img></div></div>'+
'<div class=button id=button_groups><div class=button_img></div></div>'+ '<div class=button id=button_groups><div class=button_img></div></div>'+
'<div class=button id=button_backup><div class=button_img></div></div>'+ '<div class=button id=button_backup><div class=button_img></div></div>'+
// '<div class=button id=button_folders><div class=button_img></div></div>'+ '<div class=button id=button_folders><div class=button_img></div></div>'+
'</div>'+ '</div>'+
'<div class=toolbar_shelf id=toolbar_search>'+ '<div class=toolbar_shelf id=toolbar_search>'+
'<div id=toolbar_search_input_box>'+ '<div id=toolbar_search_input_box>'+
@ -68,9 +69,9 @@ var DefaultToolbar =
'<div class=button id=button_downloads><div class=button_img></div></div>'+ '<div class=button id=button_downloads><div class=button_img></div></div>'+
'<div class=button id=button_history><div class=button_img></div></div>'+ '<div class=button id=button_history><div class=button_img></div></div>'+
'<div class=button id=button_settings><div class=button_img></div></div>'+ '<div class=button id=button_settings><div class=button_img></div></div>'+
'<div class=button id=button_extensions><div class=button_img></div></div>'+ '<div class=button id=button_extensions><div class=button_img></div></div>'
'<div class=button id=button_discard><div class=button_img></div></div>'
: '')+ : '')+
'<div class=button id=button_discard><div class=button_img></div></div>'+
'<div class=button id=button_move><div class=button_img></div></div>'+ '<div class=button id=button_move><div class=button_img></div></div>'+
'</div>'+ '</div>'+
'<div class=toolbar_shelf id=toolbar_shelf_groups>'+ '<div class=toolbar_shelf id=toolbar_shelf_groups>'+
@ -90,31 +91,54 @@ var DefaultToolbar =
'<div class=button id=button_load_bak2><div class=button_img></div></div>'+ '<div class=button id=button_load_bak2><div class=button_img></div></div>'+
'<div class=button id=button_load_bak3><div class=button_img></div></div>' '<div class=button id=button_load_bak3><div class=button_img></div></div>'
: '')+ : '')+
'</div>'+
'<div class=toolbar_shelf id=toolbar_shelf_folders>'+
'<div class=button id=button_new_folder><div class=button_img></div></div>'+
'<div class=button id=button_remove_folder><div class=button_img></div></div>'+
'<div class=button id=button_edit_folder><div class=button_img></div></div>'+
'</div>'; '</div>';
// '<div class=toolbar_shelf id=toolbar_shelf_folders>'+ var DefaultTheme = {
// '</div>'+ "ToolbarShow": true,
"ColorsSet": {},
var DefaultTheme = { "ToolbarShow": true, "ColorsSet": {}, "TabsSizeSetNumber": 2, "theme_name": "untitled", "theme_version": 2, "toolbar": DefaultToolbar, "unused_buttons": "" }; "TabsSizeSetNumber": 2,
var DefaultPreferences = { "skip_load": false, "new_open_below": false, "pin_list_multi_row": false, "close_with_MMB": true, "always_show_close": false, "allow_pin_close": false, "append_child_tab": "bottom", "append_child_tab_after_limit": "after", "append_orphan_tab": "bottom", "after_closing_active_tab": "below", "close_other_trees": false, "promote_children": true, "promote_children_in_first_child": true, "open_tree_on_hover": true, "max_tree_depth": -1, "max_tree_drag_drop": true, "never_show_close": false, "switch_with_scroll": false, "syncro_tabbar_tabs_order": true, "show_counter_groups": true, "show_counter_tabs": true, "show_counter_tabs_hints": true, "groups_toolbar_default": true }; "theme_name": "untitled",
"theme_version": 2,
"toolbar": DefaultToolbar,
"unused_buttons": ""
};
var DefaultPreferences = {
"skip_load": false,
"pin_list_multi_row": false,
"close_with_MMB": true,
"always_show_close": false,
"allow_pin_close": false,
"append_child_tab": "bottom",
"append_child_tab_after_limit": "after",
"append_orphan_tab": "bottom",
"after_closing_active_tab": "below_seek_in_parent",
"close_other_trees": false,
"promote_children": true,
"promote_children_in_first_child": true,
"open_tree_on_hover": true,
"max_tree_depth": -1,
"max_tree_drag_drop": true,
"never_show_close": false,
"switch_with_scroll": false,
"syncro_tabbar_tabs_order": true,
"show_counter_groups": true,
"show_counter_tabs": true,
"show_counter_tabs_hints": true,
"groups_toolbar_default": true,
"syncro_tabbar_groups_tabs_order": true,
"debug": false
};
var theme = {
"TabsSizeSetNumber": 2,
"ToolbarShow": true,
"toolbar": DefaultToolbar
};
// ******************* GLOBAL FUNCTIONS ************************ // ******************* GLOBAL FUNCTIONS ************************
// function LoadData(KeyName, ExpectReturnDefaultType) {
// chrome.runtime.sendMessage({command: "load_data", K: KeyName, T: ExpectReturnDefaultType}, function(response) {
// return response;
// });
// }
function LoadData(KeyName, ExpectReturnDefaultType) {
var data = ExpectReturnDefaultType;
try {
data = JSON.parse(localStorage[KeyName]);
return data;
} catch(e) {
return ExpectReturnDefaultType;
}
}
// generate random id // generate random id
function GenerateRandomID(){ function GenerateRandomID(){
@ -128,10 +152,41 @@ function RGBtoHex(color){
} }
function HexToRGB(hex, alpha){ function HexToRGB(hex, alpha){
hex = hex.replace('#', ''); let r = parseInt(hex.length == 3 ? hex.slice(0, 1).repeat(2) : hex.slice(0, 2), 16); let g = parseInt(hex.length == 3 ? hex.slice(1, 2).repeat(2) : hex.slice(2, 4), 16); let b = parseInt(hex.length == 3 ? hex.slice(2, 3).repeat(2) : hex.slice(4, 6), 16); if (alpha) { return 'rgba('+r+', '+g+', '+b+', '+alpha+')'; } else { return 'rgb('+r+', '+g+', '+b+')'; } hex = hex.replace('#', '');
let r = parseInt(hex.length == 3 ? hex.slice(0, 1).repeat(2) : hex.slice(0, 2), 16);
let g = parseInt(hex.length == 3 ? hex.slice(1, 2).repeat(2) : hex.slice(2, 4), 16);
let b = parseInt(hex.length == 3 ? hex.slice(2, 3).repeat(2) : hex.slice(4, 6), 16);
if (alpha) { return 'rgba('+r+', '+g+', '+b+', '+alpha+')'; } else { return 'rgb('+r+', '+g+', '+b+')'; }
} }
function GetCurrentTheme() {
chrome.storage.local.get(null, function(items) {
if (items["current_theme"] && items["themes"] && items["themes"][items["current_theme"]]) {
theme = items["themes"][items["current_theme"]];
} else {
theme = Object.assign({}, DefaultTheme);
}
});
}
function ApplyTheme(theme) {
RestoreStateOfGroupsToolbar();
ApplySizeSet(theme["TabsSizeSetNumber"]);
ApplyColorsSet(theme["ColorsSet"]);
if (theme.ToolbarShow) {
if (theme.theme_version == DefaultTheme.theme_version) {
$("#toolbar").html(theme.toolbar);
if (browserId == "F") {
$(".button#button_load_bak1, .button#button_load_bak2, .button#button_load_bak3").remove();
}
} else {
$("#toolbar").html(DefaultToolbar);
}
}
RestoreToolbarShelf();
RestoreToolbarSearchFilter();
Loadi18n();
}
/* theme colors is an object with css variables (but without --), for example; {"button_background": "#f2f2f2", "filter_box_border": "#cccccc"} */ /* theme colors is an object with css variables (but without --), for example; {"button_background": "#f2f2f2", "filter_box_border": "#cccccc"} */
function ApplyColorsSet(ThemeColors){ function ApplyColorsSet(ThemeColors){
let css_variables = ""; let css_variables = "";
@ -157,7 +212,7 @@ function ApplySizeSet(size){
} }
} }
if (browserId == "F") { if (browserId == "F") {
// I have no idea what is going on, but why top position for various things is different in firefox????? // for some reason top position for various things is different in firefox?????
if (size > 1) { if (size > 1) {
document.styleSheets[document.styleSheets.length-1].insertRule(".tab_header>.tab_title { margin-top: -1px; }", document.styleSheets[document.styleSheets.length-1].cssRules.length); document.styleSheets[document.styleSheets.length-1].insertRule(".tab_header>.tab_title { margin-top: -1px; }", document.styleSheets[document.styleSheets.length-1].cssRules.length);
} else { } else {
@ -167,27 +222,26 @@ function ApplySizeSet(size){
} }
function LoadPreferences() { function LoadPreferences() {
var LoadedPreferences = LoadData("preferences", {}); opt = Object.assign({}, DefaultPreferences);
chrome.storage.local.get(null, function(items) {
for (var parameter in DefaultPreferences) { if (items["preferences"]) {
opt[parameter] = DefaultPreferences[parameter]; for (var parameter in items["preferences"]) {
} if (opt[parameter] != undefined) {
for (var parameter in LoadedPreferences) { opt[parameter] = items["preferences"][parameter];
if (opt[parameter] != undefined) { }
opt[parameter] = LoadedPreferences[parameter]; }
} }
} });
} }
function LoadDefaultPreferences() { function LoadDefaultPreferences() {
for (var parameter in DefaultPreferences) { opt = Object.assign({}, DefaultPreferences);
opt[parameter] = DefaultPreferences[parameter];
}
} }
function SavePreferences() { function SavePreferences() {
localStorage["preferences"] = JSON.stringify(opt); chrome.runtime.sendMessage({command: "save_preferences", opt: opt}, function(response) {
setTimeout(function() { setTimeout(function() {
chrome.runtime.sendMessage({command: "reload_options"}); chrome.runtime.sendMessage({command: "reload_options"});
}, 200); }, 300);
});
} }
function ShowOpenFileDialog(id, extension) { function ShowOpenFileDialog(id, extension) {
let body = document.getElementById("body"); let body = document.getElementById("body");
@ -211,3 +265,9 @@ function SaveFile(filename, data) {
link.remove(); link.remove();
} }
function log(m) {
if (opt.debug) {
console.log(m);
}
// chrome.runtime.sendMessage({command: "console_log", m: m});
}

View File

@ -4,32 +4,52 @@
// ********** GROUPS FUNCTIONS *************** // ********** GROUPS FUNCTIONS ***************
function AppendAllGroups() { function SaveGroups() {
chrome.runtime.sendMessage({command: "save_groups", groups: bggroups, windowId: CurrentWindowId});
}
function AppendGroups(Groups) {
// var scroll = $("#group_list").scrollTop(); // var scroll = $("#group_list").scrollTop();
for (var group in bggroups) { for (var group in Groups) {
AppendGroupToList(bggroups[group].id, bggroups[group].name, bggroups[group].font); AppendGroupToList(Groups[group].id, Groups[group].name, Groups[group].font);
} }
RearrangeGroups(0); setTimeout(function() {
RearrangeGroupsButtons(0);
}, 1000);
} }
function RearrangeGroups(stack) { function RearrangeGroupsButtons(stack) {
$(".group_button").each(function() { $(".group_button").each(function() {
if ($("#group_list").children().eq(bggroups[(this.id).substr(1)].index)[0] && $(this).index() > bggroups[(this.id).substr(1)].index) { let groupId = (this.id).substr(1);
$(this).insertBefore($("#group_list").children().eq(bggroups[(this.id).substr(1)].index)[0]); if (bggroups[groupId]) {
} else { if ($("#group_list").children().eq(bggroups[groupId].index)[0] && $(this).index() > bggroups[groupId].index) {
if ($("#group_list").children().eq(bggroups[(this.id).substr(1)].index)[0] && $(this).index() < bggroups[(this.id).substr(1)].index) { $(this).insertBefore($("#group_list").children().eq(bggroups[groupId].index)[0]);
$(this).insertAfter($("#group_list").children().eq(bggroups[(this.id).substr(1)].index)[0]); } else {
if ($("#group_list").children().eq(bggroups[groupId].index)[0] && $(this).index() < bggroups[groupId].index) {
$(this).insertAfter($("#group_list").children().eq(bggroups[groupId].index)[0]);
}
}
if ($(this).index() != bggroups[groupId].index && stack < 10) {
RearrangeGroupsButtons(stack+1);
} }
} }
if ($(this).index() != bggroups[(this.id).substr(1)].index && stack < 10) { });
RearrangeGroups(stack+1); }
function RearrangeGroupsLists() {
let scroll = $("#"+active_group).scrollTop();
$(".group_button").each(function() {
let groupId = (this.id).substr(1);
if ($("#"+groupId)[0]) {
$("#groups").append($("#"+groupId));
} }
}); });
$("#"+active_group).scrollTop(scroll);
} }
function AppendGroupToList(groupId, group_name, font_color) { function AppendGroupToList(groupId, group_name, font_color) {
if ($("#"+groupId).length == 0 && $("#groups")[0]) { if ($("#"+groupId).length == 0 && $("#groups")[0]) {
var grp = document.createElement("div"); grp.className = "group"; grp.id = groupId; $("#groups")[0].appendChild(grp); var grp = document.createElement("div"); grp.className = "group"; grp.id = groupId; $("#groups")[0].appendChild(grp);
var gcf = document.createElement("div"); gcf.className = "children_folders"; gcf.id = "cf"+groupId; grp.appendChild(gcf);
var gct = document.createElement("div"); gct.className = "children_tabs"; gct.id = "ch"+groupId; grp.appendChild(gct);
} }
if ($("#_"+groupId).length == 0) { if ($("#_"+groupId).length == 0) {
var gbn = document.createElement("div"); gbn.className = "group_button"; gbn.id = "_"+groupId; $("#group_list")[0].appendChild(gbn); var gbn = document.createElement("div"); gbn.className = "group_button"; gbn.id = "_"+groupId; $("#group_list")[0].appendChild(gbn);
@ -57,11 +77,10 @@ function GenerateNewGroupID(){
function AddNewGroup(p) { function AddNewGroup(p) {
var newId = GenerateNewGroupID(); var newId = GenerateNewGroupID();
bggroups[newId] = { id: newId, index: 0, activetab: 0, activetab_ttid: "", name: (p.name ? p.name : caption_noname_group), font: (p.font ? p.font : "") }; bggroups[newId] = { id: newId, index: 0, active_tab: 0, active_tab_ttid: "", name: (p.name ? p.name : caption_noname_group), font: (p.font ? p.font : "") };
AppendGroupToList(newId, bggroups[newId].name, bggroups[newId].font); AppendGroupToList(newId, bggroups[newId].name, bggroups[newId].font);
UpdateBgGroupsOrder(); UpdateBgGroupsOrder();
return newId; return newId;
// chrome.runtime.sendMessage({command: "save_groups", groups: bggroups, windowId: CurrentWindowId});
} }
// function AppendTabsToGroup(p) { // function AppendTabsToGroup(p) {
@ -70,23 +89,34 @@ function AddNewGroup(p) {
// remove group, delete tabs if close_tabs is true // remove group, delete tabs if close_tabs is true
function GroupRemove(groupId, close_tabs) { function GroupRemove(groupId, close_tabs) {
if (close_tabs) { if (close_tabs) {
CloseTabs($("#"+active_group).find(".tab").map(function() {return parseInt(this.id);}).toArray()); CloseTabs($("#"+groupId).find(".tab").map(function() {return parseInt(this.id);}).toArray());
} else { $("#"+groupId+" .folder").each(function() {
$("#"+groupId).children().each(function() { RemoveFolder(this.id);
$("#tab_list").append(this);
}); });
} else {
$("#cf"+groupId).children().each(function() {
$("#cftab_list").append(this);
});
$("#ch"+groupId).children().each(function() {
$("#chtab_list").append(this);
});
RefreshExpandStates();
RefreshCounters();
} }
delete bggroups[groupId]; delete bggroups[groupId];
if ($("#_"+groupId).prev(".group_button")[0]) {
SetActiveGroup(($("#_"+groupId).prev(".group_button")[0].id).substr(1), true, true); if ($("#"+groupId)[0].id == active_group) {
} else { if ($("#_"+groupId).prev(".group_button")[0]) {
if ($("#_"+groupId).next(".group_button")[0]) { SetActiveGroup(($("#_"+groupId).prev(".group_button")[0].id).substr(1), true, true);
SetActiveGroup(($("#_"+groupId).next(".group_button")[0].id).substr(1), true, true);
} else { } else {
SetActiveGroup("tab_list", true, true); if ($("#_"+groupId).next(".group_button")[0]) {
SetActiveGroup(($("#_"+groupId).next(".group_button")[0].id).substr(1), true, true);
} else {
SetActiveGroup("tab_list", true, true);
}
} }
} }
chrome.runtime.sendMessage({command: "save_groups", groups: bggroups, windowId: CurrentWindowId}); SaveGroups();
$("#"+groupId).remove(); $("#"+groupId).remove();
$("#_"+groupId).remove(); $("#_"+groupId).remove();
schedule_update_data++; schedule_update_data++;
@ -94,44 +124,53 @@ function GroupRemove(groupId, close_tabs) {
function UpdateBgGroupsOrder() { function UpdateBgGroupsOrder() {
$(".group_button").each(function() { $(".group_button").each(function() {
bggroups[(this.id).substr(1)].index = $(this).index(); if (bggroups[(this.id).substr(1)]) {
bggroups[(this.id).substr(1)].index = $(this).index();
}
}); });
chrome.runtime.sendMessage({command: "save_groups", groups: bggroups, windowId: CurrentWindowId}); SaveGroups();
} }
function SetActiveGroup(groupId, switch_to_active_in_group, scroll_to_active) { function SetActiveGroup(groupId, switch_to_active_in_group, scroll_to_active) {
if ($("#"+groupId)[0] == undefined) { log("function: SetActiveGroup");
return; if ($("#"+groupId)[0]) {
active_group = groupId;
$(".group_button").removeClass("active_group");
$("#_"+groupId).addClass("active_group");
$(".tab, .group").hide();
$("#"+groupId).show();
$("#"+groupId+" .tab").show();
RefreshGUI();
$("#group_edit").hide();
if (switch_to_active_in_group && $("#"+groupId+" .active_tab")[0]){
chrome.tabs.update(parseInt($("#"+groupId+" .active_tab")[0].id), {active: true});
}
if (scroll_to_active && $("#"+groupId+" .active_tab")[0]){
ScrollToTab($("#"+groupId+" .active_tab")[0].id);
}
if (groupId == "tab_list") {
$("#button_remove_group, #button_edit_group").addClass("disabled");
} else {
$("#button_remove_group, #button_edit_group").removeClass("disabled");
}
chrome.runtime.sendMessage({command: "set_active_group", active_group: groupId, windowId: CurrentWindowId});
RefreshExpandStates();
RefreshCounters();
} }
$(".group_button").removeClass("active_group");
$("#_"+groupId).addClass("active_group");
$(".tab, .group").hide();
$("#"+groupId).show();
$("#"+groupId+" .tab").show();
active_group = groupId;
RefreshGUI();
$("#group_edit").hide();
if (switch_to_active_in_group && $("#"+groupId+" .active")[0]){
chrome.tabs.update(parseInt($("#"+groupId+" .active")[0].id), {active: true});
}
if (scroll_to_active && $("#"+groupId+" .active")[0]){
ScrollToTab($("#"+groupId+" .active")[0].id);
}
if (groupId == "tab_list") {
$("#button_remove_group, #button_edit_group").addClass("disabled");
} else {
$("#button_remove_group, #button_edit_group").removeClass("disabled");
}
chrome.runtime.sendMessage({command: "set_active_group", active_group: groupId, windowId: CurrentWindowId});
} }
function SetActiveTabInActiveGroup(tabId) { function SetActiveTabInGroup(groupId, tabId) {
if ($("#"+tabId).parents(".group")[0] && bggroups[active_group] != undefined) { if ($(".tab#"+tabId)[0] /* && $("#"+tabId).parents(".group")[0] */ && bggroups[groupId] != undefined) {
bggroups[$("#"+tabId).parents(".group")[0].id].activetab = parseInt(tabId); // bggroups[$("#"+tabId).parents(".group")[0].id].active_tab = parseInt(tabId);
if ($("#"+tabId).parents(".group")[0].id != active_group) { // if ($("#"+tabId).parents(".group")[0].id != active_group) {
SetActiveGroup($("#"+tabId).parents(".group")[0].id, false, true); if (groupId != active_group) {
// SetActiveGroup($("#"+tabId).parents(".group")[0].id, false, true);
SetActiveGroup(groupId, false, true);
} }
chrome.runtime.sendMessage({command: "save_groups", groups: bggroups, windowId: CurrentWindowId}); if (bggroups[groupId]) {
bggroups[groupId].active_tab = parseInt(tabId);
}
SaveGroups();
} }
} }
@ -159,21 +198,25 @@ function SetActiveTabInActiveGroup(tabId) {
// } // }
// Edit group popup // Edit group popup
function ShowGroupEditWindow(GroupId) { function ShowGroupEditWindow() {
$("#group_edit_name")[0].value = bggroups[GroupId].name; if (bggroups[menuItemId]) {
$("#group_edit").css({"display": "block", "top": $("#toolbar_groups").offset().top + 8, "left": 22}); $("#group_edit_name")[0].value = bggroups[menuItemId].name;
$("#group_edit_font").css({"background-color": bggroups[GroupId].font == "" ? "var(--button_icons, #808080)" : "#"+bggroups[GroupId].font}); $("#group_edit").css({"display": "block", "top": $("#toolbar_groups").offset().top + 8, "left": 22});
$("#group_edit_font").css({"background-color": bggroups[menuItemId].font == "" ? "var(--button_icons, #808080)" : "#"+bggroups[menuItemId].font});
}
} }
// when pressed OK in group popup // when pressed OK in group popup
function GroupEditConfirm() { function GroupEditConfirm() {
$("#group_edit_name")[0].value = $("#group_edit_name")[0].value.replace(/[\f\n\r\v\t\<\>\+\-\(\)\.\,\;\:\~\/\|\?\@\!\"\'\£\$\%\&\^\#\=\*\[\]]?/gi, ""); if (bggroups[menuItemId]) {
bggroups[active_group].name = $("#group_edit_name")[0].value; $("#group_edit_name")[0].value = $("#group_edit_name")[0].value.replace(/[\f\n\r\v\t\<\>\+\-\(\)\.\,\;\:\~\/\|\?\@\!\"\'\£\$\%\&\^\#\=\*\[\]]?/gi, "");
bggroups[active_group].font = RGBtoHex($("#group_edit_font").css("background-color")); bggroups[menuItemId].name = $("#group_edit_name")[0].value;
$("#group_edit").hide(0); bggroups[menuItemId].font = RGBtoHex($("#group_edit_font").css("background-color"));
$(".group_title#_gte" +active_group).css({"color": "#"+bggroups[active_group].font}); $(".edit_dialog").hide(0);
RefreshGUI(); $(".group_title#_gte" +menuItemId).css({"color": "#"+bggroups[menuItemId].font});
chrome.runtime.sendMessage({command: "save_groups", groups: bggroups, windowId: CurrentWindowId}); RefreshGUI();
SaveGroups();
}
} }
// "Move to group" popup // "Move to group" popup
@ -216,8 +259,8 @@ function RestoreStateOfGroupsToolbar() {
function SetGroupEvents() { function SetGroupEvents() {
// activate group // activate group
$(document).on("mousedown", ".group_button", function(event) { $(document).on("click", ".group_button", function(event) {
menuGroupId = (this.id).substr(1); // menuGroupId = (this.id).substr(1);
if (event.button == 0) { if (event.button == 0) {
SetActiveGroup((this.id).substr(1), true, true); SetActiveGroup((this.id).substr(1), true, true);
} }
@ -241,7 +284,7 @@ function SetGroupEvents() {
// edit group dialog box // edit group dialog box
$(document).on("mousedown", "#group_edit_discard", function(event) { $(document).on("mousedown", "#group_edit_discard", function(event) {
$("#group_edit").hide(0); $(".edit_dialog").hide(0);
}); });
$("#group_edit_name").keyup(function(e) { $("#group_edit_name").keyup(function(e) {
if (e.keyCode == 13) { if (e.keyCode == 13) {
@ -269,7 +312,8 @@ function SetGroupEvents() {
// edit group // edit group
$(document).on("dblclick", ".group_button:not(#_tab_list)", function(event) { $(document).on("dblclick", ".group_button:not(#_tab_list)", function(event) {
if (event.button == 0) { if (event.button == 0) {
ShowGroupEditWindow((this.id).substr(1)); menuItemId = (this.id).substr(1);
ShowGroupEditWindow();
} }
}); });
@ -287,7 +331,7 @@ function SetGroupEvents() {
// remove tabs from group button // remove tabs from group button
// $(document).on("mousedown", "#remove_tabs_from_group", function(event) { // $(document).on("mousedown", "#remove_tabs_from_group", function(event) {
// if (event.button == 0 && vt.ActiveGroup.match("at|ut") == null) { // if (event.button == 0 && vt.ActiveGroup.match("at|ut") == null) {
// AppendTabsToGroup({tabsIds: $(".tab.selected:visible").map(function() {return parseInt(this.id);}).toArray(), groupId: "ut", SwitchTabIfHasActive: true, insertAfter: true, moveTabs: true}); // AppendTabsToGroup({tabsIds: $(".tab.selected_tab:visible").map(function() {return parseInt(this.id);}).toArray(), groupId: "ut", SwitchTabIfHasActive: true, insertAfter: true, moveTabs: true});
// } // }
// }); // });

View File

@ -4,6 +4,61 @@
// ********** MENU *************** // ********** MENU ***************
function ShowTabMenu(TabNode, event) {
$(".menu").hide(0);
menuItemId = parseInt(TabNode[0].id);
// MUTE TABS
if (TabNode.is(".muted")) {
$("#tabs_menu_mute").css({ "display": "none" });
$("#tabs_menu_unmute").css({ "display": "" });
} else {
$("#tabs_menu_mute").css({ "display": "" });
$("#tabs_menu_unmute").css({ "display": "none" });
}
if (TabNode.is(".pin")) {
if (!opt.allow_pin_close) {
$("#tabs_menu_close").css({ "display": "none" });
}
// show contextmenu with correct size position
if ($("#pins_menu").outerWidth() > $(window).width() - 10) {
$("#pins_menu").css({ "width": $(window).width() - 10 });
} else {
$("#pins_menu").css({ "width": "" });
}
var x = event.pageX >= $(window).width() - $("#pins_menu").outerWidth() ? $(window).width() - $("#pins_menu").outerWidth() : event.pageX;
var y = event.pageY >= $(window).height() - $("#pins_menu").outerHeight() - 10 ? $(window).height() - $("#pins_menu").outerHeight() - 10 : event.pageY;
$("#pins_menu").css({ "display": "block", "top": y - 15, "left": x - 5 });
}
if (TabNode.is(".tab")) {
if ($("#" + menuItemId).is(".o, .c")) {
$("#tabs_menu_close_tree").css({ "display": "" });
} else {
$("#tabs_menu_close_tree").css({ "display": "none" });
}
if ($("#tabs_menu").outerWidth() > $(window).width() - 10) {
$("#tabs_menu").css({ "width": $(window).width() - 10 });
} else {
$("#tabs_menu").css({ "width": "" });
}
var x = event.pageX >= $(window).width() - $("#tabs_menu").outerWidth() ? $(window).width() - $("#tabs_menu").outerWidth() : event.pageX;
var y = event.pageY >= $(window).height() - $("#tabs_menu").outerHeight() - 10 ? $(window).height() - $("#tabs_menu").outerHeight() - 10 : event.pageY;
$("#tabs_menu").css({ "display": "block", "top": y - 15, "left": x - 5 });
}
}
function ShowFolderMenu(FolderNode, event) {
$(".menu").hide(0);
menuItemId = FolderNode[0].id;
if ($("#folders_menu").outerWidth() > $(window).width() - 10) {
$("#folders_menu").css({ "width": $(window).width() - 10 });
} else {
$("#folders_menu").css({ "width": "" });
}
var x = event.pageX >= $(window).width() - $("#folders_menu").outerWidth() ? $(window).width() - $("#folders_menu").outerWidth() : event.pageX;
var y = event.pageY >= $(window).height() - $("#folders_menu").outerHeight() - 10 ? $(window).height() - $("#folders_menu").outerHeight() - 10 : event.pageY;
$("#folders_menu").css({ "display": "block", "top": y - 15, "left": x - 5 });
}
function SetMenu() { function SetMenu() {
// trigger action when the contexmenu is about to be shown // trigger action when the contexmenu is about to be shown
$(document).bind("contextmenu", function(event) { $(document).bind("contextmenu", function(event) {
@ -12,117 +67,95 @@ function SetMenu() {
} }
}); });
// show menu // show global menu
$(document).on("mousedown", "#groups, .tab, .pin", function(event) { $(document).on("mousedown", "#pin_list, .group", function(event) {
event.stopPropagation(); event.stopPropagation();
if (event.button == 2) { if (event.button == 2) {
$(".menu").hide(0); $(".menu").hide(0);
menuItemId = active_group;
if ($(this).is(".tab, .pin")) { var x = event.pageX >= $(window).width() - $("#global_menu").outerWidth() ? $(window).width() - $("#global_menu").outerWidth() : event.pageX;
menuTabId = parseInt($(this)[0].id); var y = event.pageY >= $(window).height() - $("#global_menu").outerHeight() - 10 ? $(window).height() - $("#global_menu").outerHeight() - 10 : event.pageY;
} else { $("#global_menu").css({ "display": "block", "top": y - 15, "left": x - 5 });
if ($(".active:visible")[0]) {
menuTabId = parseInt($(".active:visible")[0].id);
} else {
if ($(".active")[0]) {
menuTabId = parseInt($(".active")[0].id);
}
}
}
if ($("#" + menuTabId).is(".pin")) {
$("#tabs_menu_pin").text(chrome.i18n.getMessage("tabs_menu_unpin"));
$("#tabs_menu_close").prev().css({ "display": "none" });
$("#tabs_menu_close_other").css({ "display": "none" });
$("#tabs_menu_expand_all, #tabs_menu_collapse_all").css({ "display": "none" });
$("#tabs_menu_collapse_all").next().css({ "display": "none" });
if (!opt.allow_pin_close) {
$("#tabs_menu_close").css({ "display": "none" });
}
} else {
$("#tabs_menu_pin").text(chrome.i18n.getMessage("tabs_menu_pin"));
$("#tabs_menu_close").prev().css({ "display": "" });
$("#tabs_menu_close, #tabs_menu_close_other").css({ "display": "" });
$("#tabs_menu_expand_all, #tabs_menu_collapse_all").css({ "display": "" });
$("#tabs_menu_collapse_all").next().css({ "display": "" });
}
if ($("#" + menuTabId).is(".o, .c")) {
$("#tabs_menu_close_tree").css({ "display": "" });
} else {
$("#tabs_menu_close_tree").css({ "display": "none" });
}
// MUTE TABS
if ($("#" + menuTabId).is(".muted")) {
$("#tabs_menu_mute").css({ "display": "none" });
$("#tabs_menu_unmute").css({ "display": "" });
} else {
$("#tabs_menu_mute").css({ "display": "" });
$("#tabs_menu_unmute").css({ "display": "none" });
}
// show contextmenu with correct size position
if ($("#tabs_menu").outerWidth() > $(window).width() - 10) {
$("#tabs_menu").css({ "width": $(window).width() - 10 });
} else {
$("#tabs_menu").css({ "width": "" });
}
var x = event.pageX >= $(window).width() - $("#tabs_menu").outerWidth() ? $(window).width() - $("#tabs_menu").outerWidth() : event.pageX;
var y = event.pageY >= $(window).height() - $("#tabs_menu").outerHeight() - 10 ? $(window).height() - $("#tabs_menu").outerHeight() - 10 : event.pageY;
$("#tabs_menu").css({ "display": "block", "top": y - 15, "left": x - 5 });
} }
}); });
// show global menu
$(document).on("mousedown", ".group_drag_box", function(event) {
// event.stopPropagation();
if (event.button == 2) {
$(".menu").hide(0);
if (this.id == "-tab_list") {
menuItemId = "tab_list";
$("#groups_menu_rename, #groups_menu_delete, #groups_menu_delete_tabs_close").hide();
} else {
menuItemId = (this.id).substr(1);
$("#groups_menu_rename, #groups_menu_delete, #groups_menu_delete_tabs_close").show();
}
var x = event.pageX >= $(window).width() - $("#groups_menu").outerWidth() ? $(window).width() - $("#groups_menu").outerWidth() : event.pageX;
var y = event.pageY >= $(window).height() - $("#groups_menu").outerHeight() - 10 ? $(window).height() - $("#groups_menu").outerHeight() - 10 : event.pageY;
$("#groups_menu").css({ "display": "block", "top": y - 15, "left": x - 5 });
}
});
// if the menu element is clicked // if the menu element is clicked
$(document).on("mousedown", "#tabs_menu li", function(event) { $(document).on("mousedown", ".menu li", function(event) {
event.stopPropagation();
if (event.button != 0) { if (event.button != 0) {
return; return;
} }
event.stopPropagation();
switch ($(this).attr("data-action")) { switch ($(this).attr("data-action")) {
case "tab_new": case "tab_new":
chrome.tabs.create({}); chrome.tabs.create({});
break; break;
case "tab_clone": case "tab_clone":
if ($("#" + menuTabId).is(".selected")) { if ($("#" + menuItemId).is(".selected_tab")) {
$(".selected:visible").each(function() { $(".selected_tab:visible").each(function() {
chrome.tabs.duplicate(parseInt(this.id)); chrome.tabs.duplicate(parseInt(this.id));
}); });
} else { } else {
chrome.tabs.duplicate(menuTabId); chrome.tabs.duplicate(menuItemId);
} }
break; break;
case "tab_move": case "tab_move":
if ($("#" + menuTabId).is(".selected")) { if ($("#" + menuItemId).is(".selected_tab, .active_tab")) {
DetachTabs($(".selected:visible").map(function() { return parseInt(this.id); }).toArray()); let tabsArr = [];
$(".active_tab:visible, .selected_tab:visible").each(function() {
tabsArr.push(parseInt(this.id));
if ($("#ch"+this.id).children().length > 0) {
$($("#ch"+this.id).find(".tab")).each(function() {
tabsArr.push(parseInt(this.id));
});
}
});
DetachTabs(tabsArr);
} else { } else {
DetachTabs([menuTabId]); DetachTabs([menuItemId]);
} }
break; break;
case "tab_reload": case "tab_reload":
if ($("#" + menuTabId).is(".selected")) { if ($("#" + menuItemId).is(".selected_tab")) {
$(".selected:visible").each(function() { $(".selected_tab:visible").each(function() {
chrome.tabs.reload(parseInt(this.id)); chrome.tabs.reload(parseInt(this.id));
}); });
} else { } else {
chrome.tabs.reload(menuTabId); chrome.tabs.reload(menuItemId);
} }
break; break;
case "tab_pin": case "tab_pin":
if ($("#" + menuTabId).is(".selected")) { if ($("#" + menuItemId).is(".selected_tab")) {
$(".selected:visible").each(function() { $(".selected_tab:visible").each(function() {
chrome.tabs.update(parseInt(this.id), { pinned: ($("#" + menuTabId).is(".pin") ? false : true) }); chrome.tabs.update(parseInt(this.id), { pinned: ($("#" + menuItemId).is(".pin") ? false : true) });
}); });
} else { } else {
chrome.tabs.update(menuTabId, { pinned: ($("#" + menuTabId).is(".pin") ? false : true) }); chrome.tabs.update(menuItemId, { pinned: ($("#" + menuItemId).is(".pin") ? false : true) });
} }
break; break;
case "tab_mute": case "tab_mute":
if ($("#" + menuTabId).is(".selected")) { if ($("#" + menuItemId).is(".selected_tab")) {
$(".selected:visible").each(function() { $(".selected_tab:visible").each(function() {
chrome.tabs.get(parseInt(this.id), function(tab) { chrome.tabs.get(parseInt(this.id), function(tab) {
if (tab) { if (tab) {
chrome.tabs.update(tab.id, { muted: true }); chrome.tabs.update(tab.id, { muted: true });
@ -130,16 +163,16 @@ function SetMenu() {
}); });
}); });
} else { } else {
chrome.tabs.get(menuTabId, function(tab) { chrome.tabs.get(menuItemId, function(tab) {
if (tab) { if (tab) {
chrome.tabs.update(tab.id, { muted: true }); chrome.tabs.update(tab.id, { muted: true });
} }
}); });
} }
break; break;
case "tab_unmute": case "tab_unmute":
if ($("#" + menuTabId).is(".selected")) { if ($("#" + menuItemId).is(".selected_tab")) {
$(".selected:visible").each(function() { $(".selected_tab:visible").each(function() {
chrome.tabs.get(parseInt(this.id), function(tab) { chrome.tabs.get(parseInt(this.id), function(tab) {
if (tab) { if (tab) {
chrome.tabs.update(tab.id, { muted: false }); chrome.tabs.update(tab.id, { muted: false });
@ -147,64 +180,100 @@ function SetMenu() {
}); });
}); });
} else { } else {
chrome.tabs.get(menuTabId, function(tab) { chrome.tabs.get(menuItemId, function(tab) {
chrome.tabs.update(tab.id, { muted: false }); chrome.tabs.update(tab.id, { muted: false });
}); });
} }
break; break;
case "tab_mute_other": case "tab_mute_other":
if ($("#" + menuTabId).is(".selected")) { if ($("#" + menuItemId).is(".selected_tab")) {
$(".tab:visible:not(.selected)").each(function() { $(".tab:visible:not(.selected_tab)").each(function() {
chrome.tabs.update(parseInt(this.id), { muted: true }); chrome.tabs.update(parseInt(this.id), { muted: true });
}); });
} else { } else {
$(".tab:visible:not(#" + menuTabId + ")").each(function() { $(".tab:visible:not(#" + menuItemId + ")").each(function() {
chrome.tabs.update(parseInt(this.id), { muted: true }); chrome.tabs.update(parseInt(this.id), { muted: true });
}); });
} }
break; break;
case "tab_unmute_other": case "tab_unmute_other":
if ($("#" + menuTabId).is(".selected")) { if ($("#" + menuItemId).is(".selected_tab")) {
$(".tab:visible:not(.selected)").each(function() { $(".tab:visible:not(.selected_tab)").each(function() {
chrome.tabs.update(parseInt(this.id), { muted: false }); chrome.tabs.update(parseInt(this.id), { muted: false });
}); });
} else { } else {
$(".tab:visible:not(#" + menuTabId + ")").each(function() { $(".tab:visible:not(#" + menuItemId + ")").each(function() {
chrome.tabs.update(parseInt(this.id), { muted: false }); chrome.tabs.update(parseInt(this.id), { muted: false });
}); });
} }
break; break;
case "tab_close": case "tab_close":
CloseTabs($("#" + menuTabId).is(".selected") ? $(".selected:visible").map(function() { return parseInt(this.id); }).toArray() : [menuTabId]); CloseTabs($("#" + menuItemId).is(".selected_tab") ? $(".selected_tab:visible").map(function() { return parseInt(this.id); }).toArray() : [menuItemId]);
break; break;
case "tab_close_tree": case "tab_close_tree":
CloseTabs($("#" + menuTabId).find(".tab").map(function() { return parseInt(this.id); }).toArray()); CloseTabs($("#" + menuItemId).find(".tab").map(function() { return parseInt(this.id); }).toArray());
CloseTabs([menuTabId]); CloseTabs([menuItemId]);
break; break;
case "tab_close_other": case "tab_close_other":
CloseTabs($(".tab:visible:not(#" + menuTabId + ")").map(function() { return parseInt(this.id); }).toArray()); CloseTabs($(".tab:visible:not(#" + menuItemId + ")").map(function() { return parseInt(this.id); }).toArray());
break; break;
case "tab_undo_close": case "tab_undo_close":
chrome.sessions.getRecentlyClosed(null, function(sessions) { chrome.sessions.getRecentlyClosed(null, function(sessions) {
if (sessions.length > 0) { if (sessions.length > 0) {
chrome.sessions.restore(null, function() {}); chrome.sessions.restore(null, function() {});
} }
}); });
break; break;
case "tab_discard": case "tab_discard":
DiscardTabs($("#" + menuTabId).is(".selected") ? $(".tab.selected:visible").map(function() { return parseInt(this.id); }).toArray() : [menuTabId]); DiscardTabs($("#" + menuItemId).is(".selected_tab") ? $(".tab.selected_tab:visible").map(function() { return parseInt(this.id); }).toArray() : [menuItemId]);
break; break;
case "tab_settings": case "tab_settings":
chrome.tabs.create({ "url": "options.html" }); chrome.tabs.create({ "url": "options.html" });
break; break;
case "tab_expand_all": case "tab_expand_all":
$(".tab.c").addClass("o").removeClass("c"); $(".tab.c").addClass("o").removeClass("c");
schedule_update_data++; schedule_update_data++;
break; break;
case "tab_collapse_all": case "tab_collapse_all":
$(".tab.o").addClass("c").removeClass("o"); $(".tab.o").addClass("c").removeClass("o");
schedule_update_data++; schedule_update_data++;
break; break;
case "folder_new":
AddNewFolder({});
break;
case "folder_rename":
if ($("#" + menuItemId).is(".selected_folder")) {
$(".selected_folder:visible").each(function() {
ShowRenameFolderDialog(this.id);
});
} else {
ShowRenameFolderDialog(menuItemId);
}
break;
case "folder_delete":
if ($("#" + menuItemId).is(".selected_folder")) {
$(".selected_folder:visible").each(function() {
RemoveFolder(this.id);
});
} else {
RemoveFolder(menuItemId);
}
break;
case "group_new":
AddNewGroup({});
break;
case "group_rename":
ShowGroupEditWindow();
break;
case "group_delete":
GroupRemove(menuItemId, false);
break;
case "group_delete_tabs_close":
GroupRemove(menuItemId, true);
break;
case "group_unload":
DiscardTabs($("#"+menuItemId+" .tab").map(function() { return parseInt(this.id); }).toArray());
break;
} }
$(".menu").hide(0); $(".menu").hide(0);
}); });
@ -212,19 +281,16 @@ function SetMenu() {
// move tabs to group // move tabs to group
// $(document).on("mousedown", "#tabs_menu_move_to_new_group, .move_to_group_menu_entry", function(event) { // $(document).on("mousedown", "#tabs_menu_move_to_new_group, .move_to_group_menu_entry", function(event) {
// var tabsIds // var tabsIds
// if ($(this).is("#tabs_menu_move_to_new_group")) { // if ($(this).is("#tabs_menu_move_to_new_group")) {
// bg.dt.DropToGroup = AddNewGroup(575757); // bg.dt.DropToGroup = AddNewGroup(575757);
// GetColorFromMiddlePixel(vt.menuTabId, bg.dt.DropToGroup); // GetColorFromMiddlePixel(vt.menuItemId, bg.dt.DropToGroup);
// } else { // } else {
// bg.dt.DropToGroup = this.id.substr(8); // bg.dt.DropToGroup = this.id.substr(8);
// } // }
// AppendTabsToGroup({tabsIds: DragAndDrop.tabsIds, groupId: bg.dt.DropToGroup, SwitchTabIfHasActive: true, insertAfter: true, RemoveClass: "selected", moveTabs: true}); // AppendTabsToGroup({tabsIds: DragAndDrop.tabsIds, groupId: bg.dt.DropToGroup, SwitchTabIfHasActive: true, insertAfter: true, RemoveClass: "selected_tab", moveTabs: true});
// }); // });

View File

@ -45,18 +45,12 @@ function RefreshGUI() {
$(".group_title").each(function(){ $(".group_title").each(function(){
$(this)[0].innerText = (bggroups[(this.id).substr(4)] ? bggroups[(this.id).substr(4)].name : caption_noname_group) + (opt.show_counter_groups ? " (" + $("#" + (this.id).substr(4) +" .tab").length + ")" : ""); $(this)[0].innerText = (bggroups[(this.id).substr(4)] ? bggroups[(this.id).substr(4)].name : caption_noname_group) + (opt.show_counter_groups ? " (" + $("#" + (this.id).substr(4) +" .tab").length + ")" : "");
}); });
$("#_gtetab_list")[0].innerText = caption_ungrouped_group + (opt.show_counter_groups ? " (" + $("#tab_list .tab").length + ")" : "");
$(".group_button").each(function(){ $(".group_button").each(function(){
$(this).css({ "height": $(this).children(0).innerWidth() }); $(this).css({ "height": $(this).children(0).innerWidth() });
}); });
$("#groups").css({ "top": $("#toolbar")[0].getBoundingClientRect().height + $("#pin_list")[0].getBoundingClientRect().height, "left": $("#toolbar_groups").outerWidth(), "height": $(window).height() - $("#pin_list")[0].getBoundingClientRect().height - $("#toolbar").outerHeight(), "width": $(window).width() - $("#toolbar_groups").outerWidth() }); $("#groups").css({ "top": $("#toolbar")[0].getBoundingClientRect().height + $("#pin_list")[0].getBoundingClientRect().height, "left": $("#toolbar_groups").outerWidth(), "height": $(window).height() - $("#pin_list")[0].getBoundingClientRect().height - $("#toolbar").outerHeight(), "width": $(window).width() - $("#toolbar_groups").outerWidth() });
// $(".c, .o").each(function(){
// RefreshTabCounter(this.id);
// $("#tab_title" + this.id)[0].textContent = $("#tab_title" + this.id).attr( "title" ) + " ("+$("#ch"+this.id).children().length+")";
// });
} }
// set discarded class // set discarded class
@ -146,7 +140,7 @@ function GetFaviconAndTitle(tabId, addCounter) {
$("#tab_header" + tab.id).css({ "background-image": "url(" + tab.favIconUrl + ")" }); $("#tab_header" + tab.id).css({ "background-image": "url(" + tab.favIconUrl + ")" });
}; };
img.onerror = function() { img.onerror = function() {
$("#tab_header" + tab.id).css({ "background-image": ((tab.url == "" || browserId == "F") ? "url(./theme/empty.svg)" : ("url(chrome://favicon/" + tab.url + ")")) }); $("#tab_header" + tab.id).css({ "background-image": ((tab.url == "" || browserId == "F") ? "url(./theme/icon_empty.svg)" : ("url(chrome://favicon/" + tab.url + ")")) });
// $("#tab_header" + tab.id).css({ "background-image": "url(" + tab.url + ")" }); // $("#tab_header" + tab.id).css({ "background-image": "url(" + tab.url + ")" });
} }
} }
@ -163,8 +157,8 @@ function GetFaviconAndTitle(tabId, addCounter) {
if ($("#" + tabId)[0]) GetFaviconAndTitle(tabId, addCounter); if ($("#" + tabId)[0]) GetFaviconAndTitle(tabId, addCounter);
}, 1000); }, 1000);
} }
if (addCounter) { if (addCounter && (opt.show_counter_tabs || opt.show_counter_tabs_hints)) {
RefreshTabCounter(tabId && (opt.show_counter_tabs || opt.show_counter_tabs_hints)); RefreshTabCounter(tabId);
} }
} }
@ -174,43 +168,70 @@ function GetFaviconAndTitle(tabId, addCounter) {
// refresh open closed trees states // refresh open closed trees states
function RefreshExpandStates() { function RefreshExpandStates() {
$(".children").each(function() { $(".folder:visible").each(function() {
if ($(this).children().length > 0) { if ($("#ch"+this.id).children().length == 0 && $("#cf"+this.id).children().length == 0) {
$(this).parent().removeClass("n"); $(this).removeClass("o").removeClass("c").addClass("n");
if ($(this).parent().is(":not(.o, .c)")) {
$(this).parent().addClass("o");
}
if ($("#tab_title"+$(this).parent()[0].id)[0]) {
if (opt.show_counter_tabs) {
$("#tab_title"+$(this).parent()[0].id)[0].textContent = $(this).parent().data("title") + " ("+$("#"+this.id+" .tab").length+")";
}
if (opt.show_counter_tabs_hints) {
$("#tab_header"+$(this).parent()[0].id).attr("title", $(this).parent().data("title") + " ("+$("#"+this.id+" .tab").length+")");
}
}
} else { } else {
$(this).parent().removeClass("o").removeClass("c").addClass("n"); if ($(this).is(":not(.o, .c)")) {
if ($("#tab_title"+$(this).parent()[0].id)[0]) { $(this).addClass("o").removeClass("n");
$("#tab_title"+$(this).parent()[0].id)[0].textContent = $(this).parent().data("title"); }
}
});
$(".tab:visible").each(function() {
if ($("#ch"+this.id).children().length == 0) {
$(this).removeClass("o").removeClass("c").addClass("n");
} else {
if ($(this).is(":not(.o, .c)")) {
$(this).addClass("o").removeClass("n");
} }
} }
}); });
} }
function RefreshTabCounter(tabId) { function RefreshCounters() {
if ($("#"+tabId).data("title")) { if (opt.show_counter_tabs || opt.show_counter_tabs_hints) {
if (opt.show_counter_tabs) { $(".tab.n:visible").each(function() {
if ($(".c#"+tabId+", .o#"+tabId)[0]) { if ($("#tab_title"+this.id)[0]) {
$("#tab_title"+tabId)[0].textContent = $("#"+tabId).data("title") + " ("+$("#ch"+tabId+" .tab").length+")"; $("#tab_title"+this.id)[0].textContent = $(this).data("title");
} else { $("#tab_header"+this.id).attr("title", $(this).data("title"));
$("#tab_title"+tabId)[0].textContent = $("#"+tabId).data("title");
} }
} });
if (opt.show_counter_tabs_hints) { $(".tab.c:visible, .tab.o:visible").each(function() {
if ($(".c#"+tabId+", .o#"+tabId)[0]) { if (opt.show_counter_tabs) {
$("#tab_header"+tabId).attr("title", $("#"+tabId).data("title") + " ("+$("#ch"+tabId+" .tab").length+")"); $("#tab_title"+this.id)[0].textContent = ("("+$("#"+this.id+" .tab").length+") ") + $(this).data("title");
} else { }
$("#tab_header"+tabId).attr("title", $("#"+tabId).data("title")); if (opt.show_counter_tabs_hints) {
$("#tab_header"+this.id).attr("title", ("("+$("#"+this.id+" .tab").length+") ") + $(this).data("title"));
}
});
$(".folder:visible").each(function() {
if (opt.show_counter_tabs) {
$("#folder_title"+this.id)[0].textContent = ("("+$("#"+this.id+" .tab").length+") ") + bgfolders[this.id].name;
}
if (opt.show_counter_tabs_hints) {
$("#folder_header"+this.id).attr("title", ("("+$("#"+this.id+" .tab").length+") ") + bgfolders[this.id].name);
}
});
}
}
function RefreshTabCounter(tabId) {
if (opt.show_counter_tabs || opt.show_counter_tabs_hints) {
if ($("#"+tabId).data("title")) {
if (opt.show_counter_tabs) {
if ($(".c#"+tabId+", .o#"+tabId)[0]) {
$("#tab_title"+tabId)[0].textContent = ("("+$("#ch"+tabId+" .tab").length+") ") + $("#"+tabId).data("title");
} else {
$("#tab_title"+tabId)[0].textContent = $("#"+tabId).data("title");
}
}
if (opt.show_counter_tabs_hints) {
if ($(".c#"+tabId+", .o#"+tabId)[0]) {
$("#tab_header"+tabId).attr("title", ("("+$("#ch"+tabId+" .tab").length+") ") + $("#"+tabId).data("title"));
} else {
$("#tab_header"+tabId).attr("title", $("#"+tabId).data("title"));
}
} }
} }
} }

View File

@ -6,7 +6,9 @@
async function UpdateData() { async function UpdateData() {
setInterval(function() { setInterval(function() {
if (schedule_update_data > 1) {schedule_update_data = 1;} if (schedule_update_data > 1) {
schedule_update_data = 1;
}
if (schedule_update_data > 0) { if (schedule_update_data > 0) {
$(".pin").each(function() { $(".pin").each(function() {
chrome.runtime.sendMessage({ chrome.runtime.sendMessage({
@ -21,47 +23,39 @@ async function UpdateData() {
}); });
$(".tab").each(function() { $(".tab").each(function() {
chrome.runtime.sendMessage({ chrome.runtime.sendMessage({
command: "update_tab", command: "update_tab",
tabId: parseInt(this.id), tabId: parseInt(this.id),
tab: { tab: {
parent: $(this).parent(".group")[0] ? $(this).parent()[0].id : $(this).parent().parent(".tab, .folder")[0].id, parent: $(this).parent().parent()[0].id,
index: $(this).index(), index: $(this).index(),
expand: ($(this).is(".n") ? "n" : ($(this).is(".c") ? "c" : "o")) expand: ($(this).is(".n") ? "n" : ($(this).is(".c") ? "c" : "o"))
} }
}); });
}); });
schedule_update_data--; schedule_update_data--;
} }
}, 1000); }, 1000);
} }
function RearrangeBrowserTabs() {
function RearrangeBrowserTabsCheck() {
setInterval(function() { setInterval(function() {
if (opt.syncro_tabbar_tabs_order) { if (schedule_rearrange_tabs > 0) {
if (schedule_rearrange_tabs > 1) {schedule_rearrange_tabs = 1;} schedule_rearrange_tabs--;
if (schedule_rearrange_tabs > 0) { let tabIds = $(".pin, .tab").map(function(){return parseInt(this.id);}).toArray();
let tabIds = $(".pin, .tab").map(function(){return parseInt(this.id);}).toArray(); RearrangeBrowserTabsLoop(tabIds, tabIds.length-1);
RearrangeBrowserTabs(tabIds, tabIds.length-1);
schedule_rearrange_tabs--;
}
} }
}, 1000); }, 1000);
} }
async function RearrangeBrowserTabsLoop(tabIds, tabIndex) {
async function RearrangeBrowserTabs(tabIds, tabIndex) { if (tabIndex >= 0 && schedule_rearrange_tabs == 0){
if (tabIndex > 0){ chrome.tabs.get(tabIds[tabIndex], function(tab1) {
chrome.tabs.get(tabIds[tabIndex], function(tab) { if (tabIndex != tab1.index) {
if (tab && tabIndex != tab.index) {
chrome.tabs.move(tabIds[tabIndex], {index: tabIndex}); chrome.tabs.move(tabIds[tabIndex], {index: tabIndex});
} }
setTimeout(function() { RearrangeBrowserTabsLoop( tabIds, (tabIndex-1) );
RearrangeBrowserTabs( tabIds, (tabIndex-1) );
}, 1);
}); });
} }
} }
function RearrangeTreeTabs(tabs, bgtabs, first_loop) {
function RearrangeTreeTabs(tabs, bgtabs, first_run) {
tabs.forEach(function(Tab) { tabs.forEach(function(Tab) {
if (bgtabs[Tab.id] && $("#"+Tab.id)[0] && $("#"+Tab.id).parent().children().eq(bgtabs[Tab.id].index)[0]) { if (bgtabs[Tab.id] && $("#"+Tab.id)[0] && $("#"+Tab.id).parent().children().eq(bgtabs[Tab.id].index)[0]) {
if ($("#"+Tab.id).index() > bgtabs[Tab.id].index) { if ($("#"+Tab.id).index() > bgtabs[Tab.id].index) {
@ -70,12 +64,11 @@ function RearrangeTreeTabs(tabs, bgtabs, first_run) {
$("#"+Tab.id).insertAfter($("#"+Tab.id).parent().children().eq(bgtabs[Tab.id].index)); $("#"+Tab.id).insertAfter($("#"+Tab.id).parent().children().eq(bgtabs[Tab.id].index));
} }
} }
if (bgtabs[Tab.id] && $("#"+Tab.id).index() != bgtabs[Tab.id].index && first_run) { if (bgtabs[Tab.id] && $("#"+Tab.id).index() != bgtabs[Tab.id].index && first_loop) {
RearrangeTreeTabs(tabs, bgtabs, false); RearrangeTreeTabs(tabs, bgtabs, false);
} }
}); });
} }
// param - tuple object with paramenters: param.tab - tab object, param.ParentId - Parent tabId, param.InsertAfterId - insert tab after this tabId (on same level), // param - tuple object with paramenters: param.tab - tab object, param.ParentId - Parent tabId, param.InsertAfterId - insert tab after this tabId (on same level),
// param.Append - if true Appends tab at the end of tree if false or prepends // param.Append - if true Appends tab at the end of tree if false or prepends
function AppendTab(param) { function AppendTab(param) {
@ -83,7 +76,6 @@ function AppendTab(param) {
GetFaviconAndTitle(param.tab.id, param.addCounter); GetFaviconAndTitle(param.tab.id, param.addCounter);
return; return;
} }
var ClassList = param.tab.pinned ? "pin" : "tab n"; var ClassList = param.tab.pinned ? "pin" : "tab n";
if (param.tab.discarded) { if (param.tab.discarded) {
ClassList = ClassList + " discarded"; ClassList = ClassList + " discarded";
@ -91,7 +83,6 @@ function AppendTab(param) {
if (param.AdditionalClass) { if (param.AdditionalClass) {
ClassList = ClassList +" "+ param.AdditionalClass; ClassList = ClassList +" "+ param.AdditionalClass;
} }
var tb = document.createElement("div"); tb.className = ClassList; tb.id = param.tab.id; // TAB var tb = document.createElement("div"); tb.className = ClassList; tb.id = param.tab.id; // TAB
var dc = document.createElement("div"); dc.className = "drop_target drag_enter_center"; dc.id = "dc"+param.tab.id; tb.appendChild(dc); // DROP TARGET CENTER var dc = document.createElement("div"); dc.className = "drop_target drag_enter_center"; dc.id = "dc"+param.tab.id; tb.appendChild(dc); // DROP TARGET CENTER
var dt = document.createElement("div"); dt.className = "drop_target drag_entered_top"; dt.id = "du"+param.tab.id; tb.appendChild(dt); // DROP TARGET TOP var dt = document.createElement("div"); dt.className = "drop_target drag_entered_top"; dt.id = "du"+param.tab.id; tb.appendChild(dt); // DROP TARGET TOP
@ -99,38 +90,31 @@ function AppendTab(param) {
var th = document.createElement("div"); th.className = opt.always_show_close ? "tab_header close_show" : "tab_header"; th.id = "tab_header"+param.tab.id; th.draggable = true; tb.appendChild(th); // HEADER var th = document.createElement("div"); th.className = opt.always_show_close ? "tab_header close_show" : "tab_header"; th.id = "tab_header"+param.tab.id; th.draggable = true; tb.appendChild(th); // HEADER
var ex = document.createElement("div"); ex.className = "expand"; ex.id = "exp"+param.tab.id; th.appendChild(ex); // EXPAND ARROW var ex = document.createElement("div"); ex.className = "expand"; ex.id = "exp"+param.tab.id; th.appendChild(ex); // EXPAND ARROW
var tt = document.createElement("div"); tt.className = "tab_title"; tt.id = "tab_title"+param.tab.id; th.appendChild(tt); // TITLE var tt = document.createElement("div"); tt.className = "tab_title"; tt.id = "tab_title"+param.tab.id; th.appendChild(tt); // TITLE
// var tc = document.createElement("div"); tc.className = "tab_counter"; tc.id = "tab_counter"+param.tab.id; th.appendChild(tc); // TABS COUNTER
if (!opt.never_show_close) { if (!opt.never_show_close) {
var cl = document.createElement("div"); cl.className = "close"; cl.id = "close"+param.tab.id; th.appendChild(cl); // CLOSE BUTTON var cl = document.createElement("div"); cl.className = "close"; cl.id = "close"+param.tab.id; th.appendChild(cl); // CLOSE BUTTON
var ci = document.createElement("div"); ci.className = "close_img"; ci.id = "close_img"+param.tab.id; cl.appendChild(ci); var ci = document.createElement("div"); ci.className = "close_img"; ci.id = "close_img"+param.tab.id; cl.appendChild(ci);
} }
var mi = document.createElement("div"); mi.className = "tab_mediaicon"; mi.id = "tab_mediaicon"+param.tab.id; th.appendChild(mi); var mi = document.createElement("div"); mi.className = "tab_mediaicon"; mi.id = "tab_mediaicon"+param.tab.id; th.appendChild(mi);
var ch = document.createElement("div"); ch.className = "children"; ch.id = "ch"+param.tab.id; tb.appendChild(ch); var ch = document.createElement("div"); ch.className = "children"; ch.id = "ch"+param.tab.id; tb.appendChild(ch);
if (param.tab.pinned) { if (param.tab.pinned) {
param.ParentId = "pin_list"; param.ParentId = "pin_list";
} else { } else {
if (param.ParentId == undefined || $("#"+param.ParentId).is(".pin, #pin_list") || $("#"+param.ParentId).length == 0) { if (param.ParentId == undefined || $("#"+param.ParentId).is(".pin, #pin_list") || $("#"+param.ParentId).length == 0) {
param.ParentId = active_group; param.ParentId = "ch"+active_group;
} else { } else {
if($("#"+param.ParentId).is(".tab")) { if ($("#ch"+param.ParentId).children().length == 0) {
if ($("#ch"+param.ParentId).children().length == 0) { $("#"+param.ParentId).addClass("o").removeClass("n").removeClass("c");
$("#"+param.ParentId).addClass("o").removeClass("n").removeClass("c");
}
param.ParentId = "ch"+param.ParentId;
} }
param.ParentId = "ch"+param.ParentId;
} }
} }
if (param.Append) { if (param.Append) {
$("#"+param.ParentId).append(tb); $("#"+param.ParentId).append(tb);
} }
if (!param.Append) { if (!param.Append) {
$("#"+param.ParentId).prepend(tb); $("#"+param.ParentId).prepend(tb);
} }
if (param.InsertBeforeId != undefined && $("#"+param.InsertBeforeId)[0]) { if (param.InsertBeforeId != undefined && $("#"+param.InsertBeforeId)[0]) {
if ((param.tab.pinned && $("#"+param.InsertBeforeId).is(".pin")) || (!param.tab.pinned && $("#"+param.InsertBeforeId).is(".tab"))) { if ((param.tab.pinned && $("#"+param.InsertBeforeId).is(".pin")) || (!param.tab.pinned && $("#"+param.InsertBeforeId).is(".tab"))) {
$("#"+param.tab.id).insertBefore($("#"+param.InsertBeforeId)); $("#"+param.tab.id).insertBefore($("#"+param.InsertBeforeId));
@ -141,32 +125,25 @@ function AppendTab(param) {
$("#"+param.tab.id).insertAfter($("#"+param.InsertAfterId)); $("#"+param.tab.id).insertAfter($("#"+param.InsertAfterId));
} }
} }
GetFaviconAndTitle(param.tab.id, param.addCounter); GetFaviconAndTitle(param.tab.id, param.addCounter);
RefreshMediaIcon(param.tab.id); RefreshMediaIcon(param.tab.id);
if (param.tab.active && param.SkipSetActive == undefined) { if (param.tab.active && param.SkipSetActive == undefined) {
SetActiveTab(param.tab.id); SetActiveTab(param.tab.id);
} }
if (param.Scroll) { if (param.Scroll) {
ScrollToTab(param.tab.id); ScrollToTab(param.tab.id);
} }
} }
function RemoveTabFromList(tabId) { function RemoveTabFromList(tabId) {
if ($("#"+tabId)[0]) { if ($("#"+tabId)[0]) {
$("#"+tabId).remove(); $("#"+tabId).remove();
} }
} }
// param - tuple object with paramenters: param.pin - true for pinned, param.id - tabId function SetTabClass(param) { // param - tuple object with paramenters: param.pin - true for pinned, param.id - tabId
function SetTabClass(param) {
if (param.pin) { if (param.pin) {
$("#pin_list").append($("#"+param.id)); $("#pin_list").append($("#"+param.id));
// flatten out children if ($("#ch"+param.id).children().length > 0) { // flatten out children
if ($("#ch"+param.id).children().length > 0) {
$($("#"+param.id).children().find(".pin, .tab").get().reverse()).each(function() { $($("#"+param.id).children().find(".pin, .tab").get().reverse()).each(function() {
$(this).removeClass("tab").removeClass("n").removeClass("o").removeClass("c").addClass("pin"); $(this).removeClass("tab").removeClass("n").removeClass("o").removeClass("c").addClass("pin");
$(this).insertAfter($("#"+param.id)); $(this).insertAfter($("#"+param.id));
@ -175,68 +152,103 @@ function SetTabClass(param) {
} }
$("#"+param.id).removeClass("tab").removeClass("n").removeClass("o").removeClass("c").addClass("pin"); $("#"+param.id).removeClass("tab").removeClass("n").removeClass("o").removeClass("c").addClass("pin");
} else { } else {
$("#"+active_group).prepend($("#"+param.id)); $("#ch"+active_group).prepend($("#"+param.id));
$("#"+param.id).removeClass("pin").removeClass("attention").addClass("tab"); $("#"+param.id).removeClass("pin").removeClass("attention").addClass("tab");
RefreshExpandStates(); RefreshExpandStates();
} }
chrome.tabs.update(parseInt(param.id), {pinned: param.pin}); chrome.tabs.update(parseInt(param.id), {pinned: param.pin});
RefreshGUI(); RefreshGUI();
} }
function SetActiveTab(tabId) { function SetActiveTab(tabId) {
if ($("#"+tabId).length > 0) { if ($("#"+tabId).length > 0) {
$(".active:visible").removeClass("active").removeClass("selected"); if ($("#"+tabId).is(".tab")) {
$(".pin, .tab:visible").removeClass("active").removeClass("selected").removeClass("selected_frozen").removeClass("selected_temporarly").removeClass("tab_header_hover"); SetActiveTabInGroup($("#"+tabId).parents(".group")[0].id, tabId);
}
$(".selected_folder").removeClass("selected_folder");
$(".pin, #"+active_group+" .tab").removeClass("active_tab").removeClass("selected_tab").removeClass("selected_frozen").removeClass("selected_temporarly").removeClass("tab_header_hover");
$(".highlighted_drop_target").removeClass("highlighted_drop_target"); $(".highlighted_drop_target").removeClass("highlighted_drop_target");
$("#"+tabId).removeClass("attention").addClass("active"); $("#"+tabId).removeClass("attention").addClass("active_tab");
ScrollToTab(tabId); ScrollToTab(tabId);
SetActiveTabInActiveGroup(tabId);
} }
} }
function ScrollToTab(tabId) { function ScrollToTab(tabId) {
if ($("#"+tabId).length == 0) { if ($("#"+tabId)[0]) {
return false; if ($("#"+tabId).is(".pin")) {
} if ($("#"+tabId).position().left+$("#"+tabId).outerWidth() > $("#pin_list").innerWidth()) {
if ($("#"+tabId).is(":not(:visible)")) { $("#pin_list").scrollLeft($("#pin_list").scrollLeft()+$("#"+tabId).position().left+$("#"+tabId).outerWidth()-$("#pin_list").innerWidth());
$("#"+tabId).parents(".tab").removeClass("c").addClass("o"); } else {
} if ($("#"+tabId).position().left < 0) {
if ($("#"+tabId).is(".pin")) { $("#pin_list").scrollLeft($("#pin_list").scrollLeft()+$("#"+tabId).position().left);
if ($("#"+tabId).position().left+$("#"+tabId).outerWidth() > $("#pin_list").innerWidth()) { }
$("#pin_list").scrollLeft($("#pin_list").scrollLeft()+$("#"+tabId).position().left+$("#"+tabId).outerWidth()-$("#pin_list").innerWidth());
} else {
if ($("#"+tabId).position().left < 0) {
$("#pin_list").scrollLeft($("#pin_list").scrollLeft()+$("#"+tabId).position().left);
} }
} }
} if ($("#"+tabId).is(".tab")) {
if ($("#"+tabId).is(".tab")) { if ($("#"+active_group+" #"+tabId)[0]) {
if ($("#"+tabId).offset().top - $("#"+active_group).offset().top < 0) { if ($("#"+tabId).is(":not(:visible)")) {
$("#"+active_group).scrollTop($("#"+active_group).scrollTop() + $("#"+tabId).offset().top - $("#"+active_group).offset().top); $("#"+tabId).parents(".folder, .tab").removeClass("c").addClass("o");
} else { }
if ($("#"+tabId).offset().top - $("#"+active_group).offset().top > $("#"+active_group).innerHeight() - $(".tab_header").outerHeight()) { if ($("#"+tabId).offset().top - $("#"+active_group).offset().top < 0) {
$("#"+active_group).scrollTop($("#"+active_group).scrollTop() + $("#"+tabId).offset().top - $("#"+active_group).offset().top - $("#"+active_group).innerHeight() + $(".tab_header").outerHeight() + 4); $("#"+active_group).scrollTop($("#"+active_group).scrollTop() + $("#"+tabId).offset().top - $("#"+active_group).offset().top);
} else {
if ($("#"+tabId).offset().top - $("#"+active_group).offset().top > $("#"+active_group).innerHeight() - $(".tab_header").outerHeight()) {
$("#"+active_group).scrollTop($("#"+active_group).scrollTop() + $("#"+tabId).offset().top - $("#"+active_group).offset().top - $("#"+active_group).innerHeight() + $(".tab_header").outerHeight() + 4);
}
}
} }
} }
} }
} }
function DetachTabs(tabsIds, Folders) {
function DetachTabs(tabsIds) {
chrome.windows.get(CurrentWindowId, {populate : true}, function(window) { chrome.windows.get(CurrentWindowId, {populate : true}, function(window) {
if (window.tabs.length == 1) { if (window.tabs.length == 1 || tabsIds.length == 0 || tabsIds.length == window.tabs.length) {
return; return;
} }
chrome.windows.create({tabId: tabsIds[0], state:window.state}, function(new_window) { chrome.windows.create({state:window.state}, function(new_window) {
(tabsIds).forEach(function(tabId) { let Indexes = [];
chrome.tabs.move(tabId, {windowId: new_window.id, index:-1}); let Parents = [];
let Expands = [];
let NewIds = [];
let NewTabs = [];
tabsIds.forEach(function(tabId) {
Indexes.push($("#"+tabId).index());
Parents.push($("#"+tabId).parent().parent()[0].id);
Expands.push($("#"+tabId).is(".n") ? "n" : ($("#"+tabId).is(".c") ? "c" : "o"));
}); });
}) let Ind = 0;
tabsIds.forEach(function(tabId) {
chrome.tabs.move(tabId, {windowId: new_window.id, index:-1}, function(MovedTab) {
NewIds.push(MovedTab[0].id);
if (browserId == "F") { // AGAIN BUG 1398272 - MOZILLA!
NewTabs.push({id: NewIds[Ind], index: Indexes[Ind], parent: ((tabsIds.indexOf(parseInt(Parents[Ind])) != -1) ? NewIds[tabsIds.indexOf(parseInt(Parents[Ind]))] : Parents[Ind]), expand: Expands[Ind]});
} else {
NewTabs.push({id: NewIds[Ind], index: Indexes[Ind], parent: Parents[Ind], expand: Expands[Ind]});
}
Ind++;
});
});
chrome.tabs.remove(new_window.tabs[0].id, null);
let Loop = 0;
var Append = setInterval(function() {
chrome.runtime.sendMessage({command: "remote_update", groups: {}, folders: Folders, tabs: NewTabs, windowId: new_window.id}, function(response) {
log("Detach - Remote Append and Update Loop, giving half second to attach each tab");
});
Loop++;
if (Loop > tabsIds.length) {
clearInterval(Append);
}
}, 500);
if (Object.keys(Folders).length > 0) {
for (var folder in Folders) {
RemoveFolder(Folders[folder].id);
}
}
});
}); });
} }
function FindTab(input) { // find and select tabs
// find and select tabs $(".filtered").removeClass("filtered").removeClass("selected_tab");
function FindTab(input) {
$(".filtered").removeClass("filtered").removeClass("selected");
$(".highlighted_search").removeClass("highlighted_search"); $(".highlighted_search").removeClass("highlighted_search");
if (input.length == 0) { if (input.length == 0) {
$("#filter_box")[0].value = ""; $("#filter_box")[0].value = "";
@ -250,33 +262,30 @@ function FindTab(input) {
chrome.tabs.query({windowId: CurrentWindowId, pinned: false}, function(tabs) { chrome.tabs.query({windowId: CurrentWindowId, pinned: false}, function(tabs) {
tabs.forEach(function(Tab) { tabs.forEach(function(Tab) {
if ($("#button_filter_type").is(".url") && Tab.url.toLowerCase().match(input.toLowerCase())) { if ($("#button_filter_type").is(".url") && Tab.url.toLowerCase().match(input.toLowerCase())) {
$("#"+Tab.id).addClass("filtered").addClass("selected"); $("#"+Tab.id).addClass("filtered").addClass("selected_tab");
} }
if ($("#button_filter_type").is(".title") && Tab.title.toLowerCase().match(input.toLowerCase())) { if ($("#button_filter_type").is(".title") && Tab.title.toLowerCase().match(input.toLowerCase())) {
$("#"+Tab.id).addClass("filtered").addClass("selected"); $("#"+Tab.id).addClass("filtered").addClass("selected_tab");
} }
}); });
}); });
} }
function CloseTabs(tabsIds) { function CloseTabs(tabsIds) {
if ($("#"+active_group+" .active_tab")[0] && tabsIds.indexOf(parseInt($("#"+active_group+" .active_tab")[0].id)) != -1) {
ActionBeforeTabsClose();
}
tabsIds.forEach(function(tabId) { tabsIds.forEach(function(tabId) {
if ($("#"+tabId).is(".pin") && opt.allow_pin_close) { if ($("#"+tabId).is(".pin") && opt.allow_pin_close) {
$("#"+tabId).remove(); $("#"+tabId).remove();
chrome.tabs.update(tabId, {pinned: false}); chrome.tabs.update(tabId, {pinned: false});
} }
if ($("#"+tabId).is(".tab")) {
$("#"+tabId).remove();
}
}); });
setTimeout(function() { setTimeout(function() {
chrome.tabs.remove(tabsIds, null); chrome.tabs.remove(tabsIds, null);
}, 100); }, 50);
} }
function DiscardTabs(tabsIds) { function DiscardTabs(tabsIds) {
var delay = 400; var delay = 100;
if ($("#"+tabsIds[0]).is(".discarded")) { if ($("#"+tabsIds[0]).is(".discarded")) {
delay = 5; delay = 5;
} else { } else {
@ -289,32 +298,76 @@ function DiscardTabs(tabsIds) {
}, delay); }, delay);
} }
} }
function ActionBeforeTabsClose() {
log("function: ActionBeforeTabsClose");
function ActivateNextTab() { if ($("#"+active_group+" .tab").length == 1) {
if ($(".pin.active:visible")[0]) { log("there is only one tab");
if ($(".pin.active").next(".pin")[0]) { if (opt.after_closing_active_tab == "above" || opt.after_closing_active_tab == "above_seek_in_parent") {
chrome.tabs.update(parseInt($(".pin.active").next(".pin")[0].id), { active: true }); log("activate group above");
if ($("#"+active_group).prev(".group")[0]) {
SetActiveGroup(($("#"+active_group).prev(".group")[0].id), true, true);
} else {
if ($("#"+active_group).next(".group")[0]) {
SetActiveGroup(($("#"+active_group).next(".group")[0].id), true, true);
} else {
SetActiveGroup("tab_list", true, true);
}
}
} else { } else {
if ($(".pin.active").prev(".pin")[0]) { log("activate group below");
chrome.tabs.update(parseInt($(".pin.active").prev(".pin")[0].id), { active: true }); if ($("#"+active_group).next(".group")[0]) {
SetActiveGroup(($("#"+active_group).next(".group")[0].id), true, true);
} else {
if ($("#"+active_group).prev(".group")[0]) {
SetActiveGroup(($("#"+active_group).prev(".group")[0].id), true, true);
} else {
SetActiveGroup("tab_list", true, true);
}
}
}
} else {
log("there are more tabs");
if (opt.after_closing_active_tab == "above") {
ActivatePrevTab();
}
if (opt.after_closing_active_tab == "below") {
ActivateNextTab();
}
if (opt.after_closing_active_tab == "above_seek_in_parent") {
ActivatePrevTabBeforeClose();
}
if (opt.after_closing_active_tab == "below_seek_in_parent") {
ActivateNextTabBeforeClose();
}
}
}
function ActivateNextTabBeforeClose() {
log("function: ActivateNextTabBeforeClose");
if ($(".pin.active_tab:visible")[0]) {
if ($(".pin.active_tab").next(".pin")[0]) {
chrome.tabs.update(parseInt($(".pin.active_tab").next(".pin")[0].id), { active: true });
} else {
if ($(".pin.active_tab").prev(".pin")[0]) {
chrome.tabs.update(parseInt($(".pin.active_tab").prev(".pin")[0].id), { active: true });
} }
} }
} }
if ($(".tab.active:visible")[0]) { if ($("#"+active_group+" .tab.active_tab")[0] && $("#"+active_group+" .tab").length > 1) {
if ($(".active:visible").children().last().children(".tab")[0]) { if ($("#"+active_group+" .tab.active_tab").children().last().children(".tab")[0]) {
chrome.tabs.update(parseInt($(".active:visible").children().last().children(".tab")[0].id), { active: true }); chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").children().last().children(".tab")[0].id), { active: true });
} else { } else {
if ($(".active:visible").next(".tab")[0]) { if ($("#"+active_group+" .tab.active_tab").next(".tab")[0]) {
chrome.tabs.update(parseInt($(".active:visible").next(".tab")[0].id), { active: true }); chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").next(".tab")[0].id), { active: true });
} else { } else {
if ($(".active:visible").parent().parent().next(".tab")[0]) { if ($("#"+active_group+" .tab.active_tab").prev(".tab")[0]) {
chrome.tabs.update(parseInt($(".active:visible").parent().parent().next(".tab")[0].id), { active: true }); chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").prev(".tab")[0].id), { active: true });
} else { } else {
if ($(".active:visible").parents(".tab").last().next(".tab")[0]) { if ($("#"+active_group+" .tab.active_tab").parent().is(".children") && $("#"+active_group+" .tab.active_tab").parent().parent(".tab")[0]) {
chrome.tabs.update(parseInt($(".active:visible").parents(".tab").last().next(".tab")[0].id), { active: true }); chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").parent().parent(".tab")[0].id), { active: true });
} else { } else {
if ($(".tab:visible").length > 1) { if ($("#"+active_group+" .tab.active_tab").parents(".tab").last().next(".tab")[0]) {
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").parents(".tab").last().next(".tab")[0].id), { active: true });
} else {
ActivatePrevTab(); ActivatePrevTab();
} }
} }
@ -323,57 +376,108 @@ function ActivateNextTab() {
} }
} }
} }
function ActivatePrevTabBeforeClose() {
function ActivatePrevTab() { log("function: ActivatePrevTabBeforeClose");
if ($(".pin.active")[0]) { if ($(".pin.active_tab")[0]) {
if ($(".pin.active").prev(".pin")[0]) { log("active_tab is pin");
chrome.tabs.update(parseInt($(".pin.active").prev(".pin")[0].id), { active: true }); if ($(".pin.active_tab").prev(".pin")[0]) {
chrome.tabs.update(parseInt($(".pin.active_tab").prev(".pin")[0].id), { active: true });
} else { } else {
if ($(".pin.active").next(".pin")[0]) { if ($(".pin.active_tab").next(".pin")[0]) {
chrome.tabs.update(parseInt($(".pin.active").next(".pin")[0].id), { active: true }); chrome.tabs.update(parseInt($(".pin.active_tab").next(".pin")[0].id), { active: true });
} }
} }
} }
if ($(".tab.active:visible")[0]) { if ($("#"+active_group+" .tab.active_tab")[0] && $("#"+active_group+" .tab").length > 1) {
if ($(".active:visible").prev().find(".tab").length > 0) { log("active_group tabs length is > 1");
chrome.tabs.update(parseInt($(".active:visible").prev().find(".tab").last()[0].id), { active: true }); if ($("#"+active_group+" .tab.active_tab").children().last().children(".tab")[0]) {
log("activating first child, because active tab is root");
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").children().last().children(".tab")[0].id), { active: true });
} else { } else {
if ($(".active:visible").prev(".tab")[0]) { if ($("#"+active_group+" .tab.active_tab").prev(".tab")[0]) {
chrome.tabs.update(parseInt($(".active:visible").prev(".tab")[0].id), { active: true }); log("activating previous tab on same level");
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").prev(".tab")[0].id), { active: true });
} else { } else {
if ($(".tab.active:visible").parent().is(".children") && $(".tab.active:visible").parent().parent(".tab")[0]) { if ($("#"+active_group+" .tab.active_tab").next(".tab")[0]) {
chrome.tabs.update(parseInt($(".tab.active:visible").parent().parent(".tab")[0].id), { active: true }); log("previous tab not found, activating next one on same level");
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").next(".tab")[0].id), { active: true });
} else { } else {
if ($(".tab:visible").length > 1) { if ($("#"+active_group+" .tab.active_tab").parent().is(".children") && $(".tab.active_tab").parent().parent(".tab")[0]) {
ActivateNextTab(); log("previous and next tab not found, which means active tab is last on same level, activating parent");
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").parent().parent(".tab")[0].id), { active: true });
} else {
if ($("#"+active_group+" .tab.active_tab").parents(".tab").last().prev(".tab")[0]) {
log("parent tab not found, which means we are on top in hierarchy, activating previous on top level");
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").parents(".tab").last().prev(".tab")[0].id), { active: true });
} else {
log("all attempts to find previous tab failed, lets activate next tab");
ActivateNextTab();
}
} }
} }
} }
} }
} }
} }
function ActivateNextTab() {
function DropTargetsSendToFront() { log("function: ActivateNextTab");
if (DropTargetsInFront == false) { if ($(".pin.active_tab")[0]) {
$(".drop_target").show(); log("active_tab is pin");
DropTargetsInFront = true; if ($(".pin.active_tab").next(".pin")[0]) {
chrome.tabs.update(parseInt($(".pin.active_tab").next(".pin")[0].id), { active: true });
} else {
if ($(".pin.active_tab").prev(".pin")[0]) {
chrome.tabs.update(parseInt($(".pin.active_tab").prev(".pin")[0].id), { active: true });
}
}
}
if ($("#"+active_group+" .tab.active_tab")[0] && $("#"+active_group+" .tab").length > 1) {
if ($("#"+active_group+" .tab.active_tab").children().last().children(".tab")[0]) {
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").children().last().children(".tab")[0].id), { active: true });
} else {
if ($("#"+active_group+" .tab.active_tab").next(".tab")[0]) {
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").next(".tab")[0].id), { active: true });
} else {
if ($("#"+active_group+" .tab.active_tab").parent().parent().next("#"+active_group+" .tab")[0]) {
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").parent().parent().next(".tab")[0].id), { active: true });
} else {
if ($("#"+active_group+" .tab.active_tab").parents(".tab").last().next(".tab")[0]) {
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").parents(".tab").last().next(".tab")[0].id), { active: true });
}
}
}
}
} }
} }
function DropTargetsSendToBack() { function ActivatePrevTab() {
if (DropTargetsInFront) { log("function: ActivatePrevTab");
$(".drop_target").hide(); if ($(".pin.active_tab")[0]) {
DropTargetsInFront = false; log("active_tab is pin");
if ($(".pin.active_tab").prev(".pin")[0]) {
chrome.tabs.update(parseInt($(".pin.active_tab").prev(".pin")[0].id), { active: true });
} else {
if ($(".pin.active_tab").next(".pin")[0]) {
chrome.tabs.update(parseInt($(".pin.active_tab").next(".pin")[0].id), { active: true });
}
}
}
if ($("#"+active_group+" .tab.active_tab")[0] && $("#"+active_group+" .tab").length > 1) {
if ($("#"+active_group+" .tab.active_tab").prev().find(".tab").length > 0) {
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").prev().find(".tab").last()[0].id), { active: true });
} else {
if ($("#"+active_group+" .tab.active_tab").prev(".tab")[0]) {
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").prev(".tab")[0].id), { active: true });
} else {
if ($("#"+active_group+" .tab.tab.active_tab").parent().is(".children") && $("#"+active_group+" .tab.active_tab").parent().parent(".tab")[0]) {
chrome.tabs.update(parseInt($("#"+active_group+" .tab.active_tab").parent().parent(".tab")[0].id), { active: true });
}
}
}
} }
} }
// ********** TABS EVENTS *************** // ********** TABS EVENTS ***************
function SetTabEvents() { function SetTabEvents() {
$(document).on("dblclick", ".group, #pin_list, .tab", function(event) { // double click to create tab
// double click to create tab
$(document).on("dblclick", ".group, #pin_list, .tab", function(event) {
if (event.button == 0 && $(event.target).is(this)) { if (event.button == 0 && $(event.target).is(this)) {
if (event.target.id == "pin_list") { if (event.target.id == "pin_list") {
chrome.tabs.create({ pinned: true }); chrome.tabs.create({ pinned: true });
@ -382,42 +486,31 @@ function SetTabEvents() {
} }
} }
}); });
$(document).on("mouseenter", ".close", function(event) { $(document).on("mouseenter", ".close", function(event) {
$(this).addClass("close_hover"); $(this).addClass("close_hover");
}); });
$(document).on("mouseleave", ".close", function(event) { $(document).on("mouseleave", ".close", function(event) {
$(".close_hover").removeClass("close_hover"); $(".close_hover").removeClass("close_hover");
}); });
$(document).on("mouseenter", ".expand", function(event) { $(document).on("mouseenter", ".expand", function(event) {
$(this).addClass("hover"); $(this).addClass("hover");
}); });
$(document).on("mouseleave", ".expand", function(event) { $(document).on("mouseleave", ".expand", function(event) {
$(".expand.hover").removeClass("hover"); $(".expand.hover").removeClass("hover");
}); });
$(document).on("mouseover", ".tab_header", function(event) { $(document).on("mouseover", ".tab_header", function(event) {
$(this).addClass("tab_header_hover"); $(this).addClass("tab_header_hover");
if (opt.always_show_close == false) { if (opt.always_show_close == false) {
$(this).addClass("close_show"); $(this).addClass("close_show");
} }
}); });
$(document).on("mouseleave", ".tab_header", function(event) { $(document).on("mouseleave", ".tab_header", function(event) {
$(this).removeClass("tab_header_hover"); $(this).removeClass("tab_header_hover");
if (opt.always_show_close == false) { if (opt.always_show_close == false) {
$(this).removeClass("close_show"); $(this).removeClass("close_show");
} }
}); });
$(document).on("mousedown", ".expand", function(event) { // EXPAND BOX - EXPAND / COLLAPSE
// EXPAND BOX - EXPAND / COLLAPSE
$(document).on("mousedown", ".expand", function(event) {
// event.stopPropagation();
if (event.button == 0) { if (event.button == 0) {
if ($(this).parent().parent().is(".o")) { if ($(this).parent().parent().is(".o")) {
$(this).parent().parent().removeClass("o").addClass("c"); $(this).parent().parent().removeClass("o").addClass("c");
@ -425,7 +518,7 @@ function SetTabEvents() {
} else { } else {
if ($(this).parent().parent().is(".c")) { if ($(this).parent().parent().is(".c")) {
$(this).parent().parent().removeClass("c").addClass("o"); $(this).parent().parent().removeClass("c").addClass("o");
chrome.runtime.sendMessage({ command: "update_tab", tabId: parseInt($(this).parent().parent()[0].id), tab: { expand: "o" } }); chrome.runtime.sendMessage({command: "update_tab", tabId: parseInt($(this).parent().parent()[0].id), tab: { expand: "o" } });
if (opt.close_other_trees) { if (opt.close_other_trees) {
$(".o:visible:not(#"+$(this).parent().parent()[0].id+")").removeClass("o").addClass("c"); $(".o:visible:not(#"+$(this).parent().parent()[0].id+")").removeClass("o").addClass("c");
$(this).parents(".tab").each(function() { $(this).parents(".tab").each(function() {
@ -440,67 +533,55 @@ function SetTabEvents() {
} }
} }
}); });
$(document).on("mousedown", ".tab, .pin", function(event) { // SELECT TAB/PIN
// SELECT TAB/PIN
$(document).on("mousedown", ".tab, .pin", function(event) {
if ($(".menu").is(":visible")) { if ($(".menu").is(":visible")) {
return; return;
} }
event.stopPropagation(); event.stopPropagation();
if (event.button == 0) { if (event.button == 0) {
DropTargetsSendToBack(); $("#"+active_group+" .folder").removeClass("selected_folder");
let tabId = parseInt(this.id); let tabId = parseInt(this.id);
// SET SELECTION WITH SHIFT if (event.shiftKey) { // SET SELECTION WITH SHIFT
if (event.shiftKey) { $(".pin, .tab:visible").removeClass("selected_tab").removeClass("selected_frozen").removeClass("selected_temporarly");
$(".pin, .tab:visible").removeClass("selected").removeClass("selected_frozen").removeClass("selected_temporarly"); if ($(this).index() >= $(".active_tab:visible").index()) {
if ($(this).index() >= $(".active:visible").index()) { $(".active_tab:visible").nextUntil($(this), ":visible").add($(".active_tab:visible")).add($(this)).addClass("selected_tab");
$(".active:visible").nextUntil($(this), ":visible").add($(".active:visible")).add($(this)).addClass("selected");
} else { } else {
$(".active:visible").prevUntil($(this), ":visible").add($(".active:visible")).add($(this)).addClass("selected"); $(".active_tab:visible").prevUntil($(this), ":visible").add($(".active_tab:visible")).add($(this)).addClass("selected_tab");
} }
} }
// TOGGLE SELECTION WITH CTRL if (event.ctrlKey) { // TOGGLE SELECTION WITH CTRL
if (event.ctrlKey) { // if ($(".active_tab:visible").is(":not(.selected_tab)")) {
// if ($(".active:visible").is(":not(.selected)")) { // $(".active_tab:visible").addClass("selected_tab");
// $(".active:visible").addClass("selected");
// } // }
$(this).toggleClass("selected"); $(this).toggleClass("selected_tab");
} }
} }
}); });
$(document).on("mousedown", ".tab_header", function(event) { // CLOSE TAB/PIN
// CLOSE TAB/PIN
$(document).on("mousedown", ".tab_header", function(event) {
if ($(".menu").is(":visible")) {
return;
}
let tabId = parseInt($(this).parent()[0].id); let tabId = parseInt($(this).parent()[0].id);
if ((event.button == 1 && opt.close_with_MMB == true && $(this).parent().is(".tab")) || (event.button == 1 && opt.close_with_MMB == true && $(this).parent().is(".pin") && opt.allow_pin_close == true) || (event.button == 0 && $(event.target).is(".close, .close_img"))) { if ((event.button == 1 && opt.close_with_MMB == true && $(this).parent().is(".tab")) || (event.button == 1 && opt.close_with_MMB == true && $(this).parent().is(".pin") && opt.allow_pin_close == true) || (event.button == 0 && $(event.target).is(".close, .close_img"))) {
if ($(this).parent().is(".active:visible") && opt.after_closing_active_tab != "browser") { if ($(this).parent().is(".active_tab:visible") && opt.after_closing_active_tab != "browser") {
if (opt.after_closing_active_tab == "above") { ActionBeforeTabsClose();
ActivatePrevTab(); } // hide pin before it will be closed by listener
}
if (opt.after_closing_active_tab == "below") {
ActivateNextTab();
}
}
// hide pin before it will be closed by listener
$(".pin#"+tabId).css({ "width": "0px", "height": "0px", "border": "none", "overflow": "hidden" }); $(".pin#"+tabId).css({ "width": "0px", "height": "0px", "border": "none", "overflow": "hidden" });
chrome.tabs.update(tabId, {pinned: false}); chrome.tabs.update(tabId, {pinned: false});
if ($("#"+tabId)[0]) chrome.tabs.remove(tabId); setTimeout(function() {
if ($("#"+tabId)[0]) {
chrome.tabs.remove(tabId);
}
}, 100);
}
if (event.button == 2) {
event.stopPropagation();
ShowTabMenu($(this).parent(), event);
} }
}); });
$(document).on("click", ".tab_header", function(event) { // SINGLE CLICK TO ACTIVATE TAB
if ($(".menu").is(":visible") || ($(this).parent().is(".c, .o") && $(event.target).is(".expand")) || $(event.target).is(".close, .close_img, .tab_mediaicon")) {
// SINGLE CLICK TO ACTIVATE TAB
$(document).on("click", ".tab_header", function(event) {
if ($(".menu").is(":visible")) {
return; return;
} }
event.stopPropagation(); event.stopPropagation();
if (event.button == 0 && !event.shiftKey && !event.ctrlKey && $(event.target).is(":not(.close, .close_img, .expand, .tab_mediaicon)")) { if (event.button == 0 && !event.shiftKey && !event.ctrlKey) {
SetActiveTab($(this).parent()[0].id); SetActiveTab($(this).parent()[0].id);
chrome.tabs.update(parseInt($(this).parent()[0].id), { active: true }); chrome.tabs.update(parseInt($(this).parent()[0].id), { active: true });
} }

View File

@ -4,22 +4,6 @@
// ********** TOOLBAR *************** // ********** TOOLBAR ***************
function RestoreToolbarSearchFilterBAK() {
let filter_type = "url";
if (localStorage.getItem("filter_type") !== null) {
filter_type = localStorage["filter_type"];
}
if (filter_type == "url") {
$("#button_filter_type").addClass("url").removeClass("title");
} else {
$("#button_filter_type").addClass("title").removeClass("url");
}
}
function RestoreToolbarSearchFilter() { function RestoreToolbarSearchFilter() {
chrome.runtime.sendMessage({command: "get_search_filter", windowId: CurrentWindowId}, function(response) { chrome.runtime.sendMessage({command: "get_search_filter", windowId: CurrentWindowId}, function(response) {
if (response == "url") { if (response == "url") {
@ -30,10 +14,6 @@ function RestoreToolbarSearchFilter() {
}); });
} }
function RestoreToolbarShelf() { function RestoreToolbarShelf() {
chrome.runtime.sendMessage({command: "get_active_shelf", windowId: CurrentWindowId}, function(response) { chrome.runtime.sendMessage({command: "get_active_shelf", windowId: CurrentWindowId}, function(response) {
$("#filter_box").attr("placeholder", caption_searchbox); $("#filter_box").attr("placeholder", caption_searchbox);
@ -92,39 +72,38 @@ function RestoreToolbarShelf() {
function SetToolbarShelfToggle(click_type) { function SetToolbarShelfToggle(click_type) {
// tools and search buttons toggle // tools and search buttons toggle
$(document).on(click_type, "#button_tools, #button_search, #button_groups, #button_backup, #button_folders", function(event) { $(document).on(click_type, "#button_tools, #button_search, #button_groups, #button_backup, #button_folders", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; if ($(this).is(".on")) {
$(".on").removeClass("on");
$(".toolbar_shelf").addClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "", windowId: CurrentWindowId});
} else {
$(".toolbar_shelf").addClass("hidden");
if ($(this).is("#button_tools")) {
$("#toolbar_shelf_tools").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "tools", windowId: CurrentWindowId});
}
if ($(this).is("#button_search")) {
$("#toolbar_search").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "search", windowId: CurrentWindowId});
}
if ($(this).is("#button_groups")) {
$("#toolbar_shelf_groups").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "groups", windowId: CurrentWindowId});
}
if ($(this).is("#button_backup")) {
$("#toolbar_shelf_backup").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "backup", windowId: CurrentWindowId});
}
if ($(this).is("#button_folders")) {
$("#toolbar_shelf_folders").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "folders", windowId: CurrentWindowId});
}
$(".button").removeClass("on");
$(this).addClass("on");
}
RefreshGUI();
} }
if ($(this).is(".on")) {
$(".on").removeClass("on");
$(".toolbar_shelf").addClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "", windowId: CurrentWindowId});
} else {
$(".toolbar_shelf").addClass("hidden");
if ($(this).is("#button_tools")) {
$("#toolbar_shelf_tools").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "tools", windowId: CurrentWindowId});
}
if ($(this).is("#button_search")) {
$("#toolbar_search").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "search", windowId: CurrentWindowId});
}
if ($(this).is("#button_groups")) {
$("#toolbar_shelf_groups").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "groups", windowId: CurrentWindowId});
}
if ($(this).is("#button_backup")) {
$("#toolbar_shelf_backup").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "backup", windowId: CurrentWindowId});
}
if ($(this).is("#button_folders")) {
$("#toolbar_shelf_folders").removeClass("hidden");
chrome.runtime.sendMessage({command: "set_active_shelf", active_shelf: "folders", windowId: CurrentWindowId});
}
$(".button").removeClass("on");
$(this).addClass("on");
}
RefreshGUI();
}); });
} }
@ -153,20 +132,20 @@ function SetToolbarEvents() {
ScrollToTab($(".tab.filtered")[SearchIndex].id); ScrollToTab($(".tab.filtered")[SearchIndex].id);
$($(".tab.filtered")[SearchIndex]).addClass("highlighted_search"); $($(".tab.filtered")[SearchIndex]).addClass("highlighted_search");
}); });
// new tab // new tab
$(document).on("mousedown", "#button_new", function(event) { $(document).on("mousedown", "#button_new", function(event) {
if (event.button == 1 && $(".active:visible")[0]) { if (event.button == 1 && $(".active_tab:visible")[0]) {
chrome.tabs.duplicate(parseInt($(".active:visible")[0].id), function(tab) { chrome.tabs.duplicate(parseInt($(".active_tab:visible")[0].id), function(tab) {
setTimeout(function() { setTimeout(function() {
$("#"+tab.id).insertAfter($(".active:visible")[0]); $("#"+tab.id).insertAfter($(".active_tab:visible")[0]);
RefreshExpandStates(); RefreshExpandStates();
schedule_update_data++; schedule_update_data++;
RefreshCounters();
}, 100); }, 100);
}); });
} }
if (event.button == 2 && $(".active:visible")[0]) { if (event.button == 2 && $("#"+active_group+" .active_tab")[0]) {
ScrollToTab($(".active:visible")[0].id); ScrollToTab($("#"+active_group+" .active_tab")[0].id);
} }
}); });
$(document).on("click", "#button_new", function(event) { $(document).on("click", "#button_new", function(event) {
@ -176,55 +155,50 @@ function SetToolbarEvents() {
}); });
// pin tab // pin tab
$(document).on("mousedown", "#button_pin", function(event) { $(document).on("mousedown", "#button_pin", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; $(".active_tab:visible, .selected_tab:visible").each(function() {
chrome.tabs.update(parseInt(this.id), { pinned: ($(this).is(".pin") ? false : true) });
});
} }
$(".active:visible, .selected:visible").each(function() {
chrome.tabs.update(parseInt(this.id), { pinned: ($(this).is(".pin") ? false : true) });
});
}); });
// undo close // undo close
$(document).on("mousedown", "#button_undo", function(event) { $(document).on("mousedown", "#button_undo", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; chrome.sessions.getRecentlyClosed( null, function(sessions) {
} if (sessions.length > 0) {
chrome.sessions.getRecentlyClosed( null, function(sessions) { chrome.sessions.restore(null, function(restored) {
if (sessions.length > 0) { // if (browserId == "F") {
chrome.sessions.restore(null, function(restored) { // if (restored.tab != undefined) {
// if (browserId == "F") { // let t = Promise.resolve(browser.sessions.getTabValue(restored.tab.id, "TTId")).then(function(TTId) {
// if (restored.tab != undefined) { // TODO RESTORE TREE IF POSSIBLE
// let t = Promise.resolve(browser.sessions.getTabValue(restored.tab.id, "TTId")).then(function(TTId) { // console.log(TTId);
// TODO RESTORE TREE IF POSSIBLE // });
// console.log(TTId); // }
// });
// } // }
// } });
}); }
} });
}); }
}); });
// move tab to new window (detach) // move tab to new window (detach)
$(document).on("mousedown", "#button_move", function(event) { $(document).on("mousedown", "#button_move", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; if ($("#"+active_group+" .selected_tab")[0]){
} let detach = GetSelectedTabs();
var tabsArr = []; DetachTabs(detach.TabsIds, {});
$(".active:visible, .selected:visible").each(function() { } else {
tabsArr.push(parseInt(this.id)); if ($("#"+active_group+" .selected_folder")[0]){
if ($("#ch"+this.id).children().length > 0) { let detach = GetSelectedFolders();
$($("#ch"+this.id).find(".tab")).each(function() { DetachTabs(detach.TabsIds, detach.Folders);
tabsArr.push(parseInt(this.id)); }
});
} }
}); }
DetachTabs(tabsArr);
}); });
// move tab to new window (detach) // move tab to new window (detach)
$(document).on("mousedown", "#repeat_search", function(event) { $(document).on("mousedown", "#repeat_search", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; FindTab($("#filter_box")[0].value);
} }
FindTab($("#filter_box")[0].value);
}); });
// filter on input // filter on input
$("#filter_box").on("input", function() { $("#filter_box").on("input", function() {
@ -232,101 +206,42 @@ function SetToolbarEvents() {
}); });
// change filtering type // change filtering type
$(document).on("mousedown", "#button_filter_type", function(event) { $(document).on("mousedown", "#button_filter_type", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; if ($("#button_filter_type").is(".url")) {
$("#button_filter_type").removeClass("url").addClass("title");
} else {
$("#button_filter_type").addClass("url").removeClass("title");
}
FindTab($("#filter_box")[0].value);
chrome.runtime.sendMessage({command: "set_search_filter", search_filter: ($(this).is(".url") ? "url" : "title"), windowId: CurrentWindowId});
} }
$("#button_filter_type").toggleClass("url").toggleClass("title");
FindTab($("#filter_box")[0].value);
chrome.runtime.sendMessage({command: "set_search_filter", search_filter: ($(this).is(".url") ? "url" : "title"), windowId: CurrentWindowId});
// localStorage["filter_type"] = $(this).is(".url") ? "url" : "title";
}); });
// clear filter button // clear filter button
$(document).on("mousedown", "#button_filter_clear", function(event) { $(document).on("mousedown", "#button_filter_clear", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; $("#button_filter_clear").css({"opacity": "0"}).attr("title", "");
FindTab("");
} }
$("#button_filter_clear").css({"opacity": "0"}).attr("title", "");
FindTab("");
}); });
// sort tabs // sort tabs
$(document).on("mousedown", "#button_sort", function(event) { // $(document).on("mousedown", "#button_sort", function(event) {
if (event.button != 0) { // if (event.button == 0) {
return; // SortTabs();
} // }
SortTabs(); // });
});
// bookmarks
$(document).on("mousedown", "#button_bookmarks", function(event) {
if (event.button != 0) {
return;
}
chrome.tabs.create({url: "chrome://bookmarks/"});
});
// downloads
$(document).on("mousedown", "#button_downloads", function(event) {
if (event.button != 0) {
return;
}
chrome.tabs.create({url: "chrome://downloads/"});
});
// history
$(document).on("mousedown", "#button_history", function(event) {
if (event.button != 0) {
return;
}
chrome.tabs.create({url: "chrome://history/"});
});
// extensions
$(document).on("mousedown", "#button_extensions", function(event) {
if (event.button != 0) {
return;
}
chrome.tabs.create({url: "chrome://extensions"});
});
// settings
$(document).on("mousedown", "#button_settings", function(event) {
if (event.button != 0) {
return;
}
chrome.tabs.create({url: "chrome://settings/"});
});
// vertical tabs options // vertical tabs options
$(document).on("mousedown", "#button_options", function(event) { $(document).on("mousedown", "#button_options", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; chrome.tabs.create({url: "options.html" });
} }
chrome.tabs.create({url: "options.html" });
}); });
// discard tabs // new group
$(document).on("mousedown", "#button_discard", function(event) {
if (event.button != 0) {
return;
}
chrome.tabs.query({windowId: CurrentWindowId, pinned: false}, function(tabs) {
var tabsIds = [];
tabs.forEach(function(Tab) {
tabsIds.push(Tab.id);
});
DiscardTabs(tabsIds);
});
});
// new group button
$(document).on("mousedown", "#button_new_group", function(event) { $(document).on("mousedown", "#button_new_group", function(event) {
if (event.button == 0) { if (event.button == 0) {
AddNewGroup({}); AddNewGroup({});
} }
}); });
// remove group
// new group button
$(document).on("mousedown", "#button_remove_group", function(event) { $(document).on("mousedown", "#button_remove_group", function(event) {
let close_tabs = event.shiftKey; let close_tabs = event.shiftKey;
if (event.button == 0) { if (event.button == 0) {
@ -335,62 +250,112 @@ function SetToolbarEvents() {
} }
} }
}); });
// edit group
// EDIT GROUP
$(document).on("mousedown", "#button_edit_group", function(event) { $(document).on("mousedown", "#button_edit_group", function(event) {
if (active_group != "tab_list") { if (event.button == 0 && active_group != "tab_list") {
ShowGroupEditWindow(active_group); menuItemId = active_group;
ShowGroupEditWindow();
} }
}); });
// import-export group // import-export group
$(document).on("mousedown", "#button_export_group", function(event) { $(document).on("mousedown", "#button_export_group", function(event) {
ExportGroup(bggroups[active_group].name+".tt_group"); if (event.button == 0) {
ExportGroup(bggroups[active_group].name+".tt_group");
}
}); });
$(document).on("mousedown", "#button_import_group", function(event) { $(document).on("mousedown", "#button_import_group", function(event) {
ShowOpenFileDialog("file_import_group", ".tt_group"); if (event.button == 0) {
ShowOpenFileDialog("file_import_group", ".tt_group");
}
}); });
$(document).on("change", "#file_import_group", function(event) { $(document).on("change", "#file_import_group", function(event) {
ImportGroup(); ImportGroup();
}); });
// new folder
$(document).on("mousedown", "#button_new_folder", function(event) {
if (event.button == 0) {
AddNewFolder({});
}
});
// rename folder
$(document).on("mousedown", "#button_edit_folder", function(event) {
if (event.button == 0 && $(".selected_folder:visible")[0]) {
ShowRenameFolderDialog($(".selected_folder:visible")[0].id);
}
});
// remove folder
$(document).on("mousedown", "#button_remove_folder", function(event) {
// let close_tabs = event.shiftKey;
if (event.button == 0 && $(".selected_folder:visible")[0]) {
$("#"+active_group+" .selected_folder").each(function() {
RemoveFolder(this.id);
});
// RemoveFolder($(".selected_folder:visible")[0].id);
}
});
// discard tabs
$(document).on("mousedown", "#button_discard", function(event) {
if (event.button == 0) {
DiscardTabs($(".selected_tab")[0] ? ($(".selected_tab").map(function() { return parseInt(this.id); }).toArray()) : ($(".pin, .tab").map(function() { return parseInt(this.id); }).toArray()) );
}
});
if (browserId != "F") { if (browserId != "F") {
// bookmarks
$(document).on("mousedown", "#button_bookmarks", function(event) {
if (event.button == 0) {
chrome.tabs.create({url: "chrome://bookmarks/"});
}
});
// downloads
$(document).on("mousedown", "#button_downloads", function(event) {
if (event.button == 0) {
chrome.tabs.create({url: "chrome://downloads/"});
}
});
// history
$(document).on("mousedown", "#button_history", function(event) {
if (event.button == 0) {
chrome.tabs.create({url: "chrome://history/"});
}
});
// extensions
$(document).on("mousedown", "#button_extensions", function(event) {
if (event.button == 0) {
chrome.tabs.create({url: "chrome://extensions"});
}
});
// settings
$(document).on("mousedown", "#button_settings", function(event) {
if (event.button == 0) {
chrome.tabs.create({url: "chrome://settings/"});
}
});
// load backups // load backups
$(document).on("mousedown", "#button_load_bak1:not(.disabled), #button_load_bak2:not(.disabled), #button_load_bak3:not(.disabled)", function(event) { $(document).on("mousedown", "#button_load_bak1:not(.disabled), #button_load_bak2:not(.disabled), #button_load_bak3:not(.disabled)", function(event) {
if (event.button != 0) { if (event.button == 0) {
return; let BakN = (this.id).substr(15);
chrome.storage.local.get(null, function(items) {
if (Object.keys(items["windows_BAK"+BakN]).length > 0) { chrome.storage.local.set({"windows": items["windows_BAK"+BakN]}); }
if (Object.keys(items["tabs_BAK"+BakN]).length > 0) { chrome.storage.local.set({"tabs": items["tabs_BAK"+BakN]}); alert("Loaded backup"); }
chrome.runtime.sendMessage({command: "reload"}); chrome.runtime.sendMessage({command: "reload_sidebar"}); location.reload();
});
} }
let wins = LoadData("windows_BAK"+(this.id).substr(15), []);
let tabs = LoadData("tabs_BAK"+(this.id).substr(15), []);
if (wins.length) {
localStorage["windows"] = JSON.stringify(wins);
}
if (tabs.length) {
localStorage["tabs"] = JSON.stringify(tabs);
alert("Loaded backup");
}
chrome.runtime.sendMessage({command: "reload"});
chrome.runtime.sendMessage({command: "reload_sidebar"});
location.reload();
}); });
} }
// import-export backups // import-export backups
$(document).on("mousedown", "#button_export_bak", function(event) { $(document).on("mousedown", "#button_export_bak", function(event) {
ExportTabs("Session.tt_session"); ExportSession("Session.tt_session");
}); });
$(document).on("mousedown", "#button_import_bak", function(event) { $(document).on("mousedown", "#button_import_bak", function(event) {
ShowOpenFileDialog("file_import_backup", ".tt_session"); ShowOpenFileDialog("file_import_backup", ".tt_session");
}); });
$(document).on("change", "#file_import_backup", function(event) { $(document).on("change", "#file_import_backup", function(event) {
ImportTabs(); ImportSession();
}); });

114
scripts/utils.js Normal file
View File

@ -0,0 +1,114 @@
// 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/
// sort tabs main function
function SortTabs(){
if ($(".tab").find(":visible:first")[0]){
chrome.tabs.query({windowId: vt.windowId}, function(tabs){
tabs.sort(function(tab_a, tab_b){
return SplitUrl(tab_a).localeCompare( SplitUrl(tab_b) );
});
var first_tabId;
if ($(".selected:visible")[0]){
first_tabId = parseInt($(".selected:visible")[0].id);
} else {
first_tabId = parseInt($(".tab").find(":visible:first")[0].parentNode.id);
}
chrome.tabs.get(first_tabId, function(tab){
var new_index = tab.index;
tabs.forEach(function(Tab){
// sort selected when more than 1 tab is selected
if (($(".selected:visible").length > 1 && $("#"+Tab.id).is(":visible") && !Tab.pinned && $("#"+Tab.id).is(".selected")) || ($(".selected:visible").length < 2 && $("#"+Tab.id).is(":visible") && !Tab.pinned)){
chrome.tabs.move(Tab.id, {"index": new_index});
new_index++;
}
});
});
if (bg.opt.scroll_to_active){
setTimeout(function(){
ScrollTabList($(".active:visible")[0].id);
},1000);
}
});
}
}
// sort tabs sub function
function SplitUrl(tab){
var tmp_url = new URL(tab.url);
if (tmp_url.protocol != "http:"){
tmp_url.protocol == "http:";
}
var url_parts = [];
if (tab.pinned){
url_parts.push("#"+tab.index);
} else {
url_parts.push("~");
}
var parts = tmp_url.host.split(".");
parts.reverse();
if (parts.length > 1){
parts = parts.slice(1);
}
parts.join(".");
url_parts.push(parts);
url_parts.push(tab.title.toLowerCase());
return url_parts.join(" ! ");
}
// bookmark main function
function BookmarkTabs(tabs_array, FolderName){
var rootId;
var vertical_tabs_folderId;
chrome.bookmarks.getRootByName("bookmarks_bar", function(tree){
rootId = tree.id;
chrome.bookmarks.search("VerticalTabs", function(list){
for (var elem in list) {
if (list[elem].parentId == rootId){
vertical_tabs_folderId = list[elem].id;
break;
}
}
if (vertical_tabs_folderId == undefined){
chrome.bookmarks.create({parentId: rootId, title: "VerticalTabs"}, function(vertical_tabs_new){
vertical_tabs_folderId = vertical_tabs_new.id;
});
}
chrome.bookmarks.search(FolderName, function(list){
for (var elem in list) {
if (list[elem].parentId == vertical_tabs_folderId){
SlowlyBookmarkTabs(tabs_array, list[elem].id);
return;
}
}
chrome.bookmarks.create({parentId: vertical_tabs_folderId, title: FolderName}, function(active_group_folderId_new){
SlowlyBookmarkTabs(tabs_array, active_group_folderId_new.id);
});
});
});
});
}
// bookmark sub function
function SlowlyBookmarkTabs(tabs_array, group_folderId){
if (tabs_array.length > 0){
chrome.tabs.get(tabs_array[0], function(tab){
chrome.bookmarks.search({url: tab.url}, function(list){
tabs_array.splice(0, 1);
setTimeout(function(){
SlowlyBookmarkTabs(tabs_array, group_folderId);
},10);
for (var elem in list){
if (list[elem].parentId == group_folderId){
bookmarkId = list[elem].id;
return;
}
}
chrome.bookmarks.create({parentId: group_folderId, title: tab.title, url: tab.url});
});
});
}
}

View File

@ -49,30 +49,38 @@
<div id="groups"> <div id="groups">
<div class="group" id="tab_list"> <div class="group" id="tab_list">
<div class="children_folders" id="cftab_list"></div>
<div class="children_tabs" id="chtab_list"></div>
</div> </div>
</div> </div>
<input type="color" id="color_picker" style="position:absolute; left:-1000px; top:-1000px; width:1px; height:1px; overflow:hidden;"> <input type="color" id="color_picker" style="position:absolute; left:-1000px; top:-1000px; width:1px; height:1px; overflow:hidden;">
<ul class="group_edit" id="group_edit"> <ul class="edit_dialog" id="group_edit">
<input id="group_edit_name" type="text"></input> <input class="edit_dialog_edit_name" id="group_edit_name" type="text"></input>
<div class="group_edit_color" id="group_edit_font"></div> <div class="group_edit_color" id="group_edit_font"></div>
<br> <br>
<div id="group_edit_discard"><span class="group_edit_button" id="group_edit_button_cancel"></span></div> <div class="edit_dialog_discard" id="group_edit_discard"><span class="edit_dialog_button" id="group_edit_button_cancel"></span></div>
<div id="group_edit_confirm"><span class="group_edit_button" id="group_edit_button_confirm"></span></div> <div class="edit_dialog_confirm" id="group_edit_confirm"><span class="edit_dialog_button" id="group_edit_button_confirm"></span></div>
</ul> </ul>
<ul class="menu" id="tabs_menu"> <ul class="edit_dialog" id="folder_edit">
<li data-action="tab_new" class="menu_item" id="tabs_menu_new"></li> <input class="edit_dialog_edit_name" id="folder_edit_name" type="text"></input>
<br>
<div class="edit_dialog_discard" id="folder_edit_discard"><span class="edit_dialog_button" id="folder_edit_button_cancel"></span></div>
<div class="edit_dialog_confirm" id="folder_edit_confirm"><span class="edit_dialog_button" id="folder_edit_button_confirm"></span></div>
</ul>
<ul class="menu" id="pins_menu">
<li data-action="tab_pin" class="menu_item" id="tabs_menu_unpin"></li>
<div class="separator"></div>
<li data-action="tab_clone" class="menu_item" id="tabs_menu_clone"></li> <li data-action="tab_clone" class="menu_item" id="tabs_menu_clone"></li>
<div class="separator"></div>
<li data-action="tab_move" class="menu_item" id="tabs_menu_move"></li> <li data-action="tab_move" class="menu_item" id="tabs_menu_move"></li>
<li data-action="tab_reload" class="menu_item" id="tabs_menu_reload"></li> <li data-action="tab_reload" class="menu_item" id="tabs_menu_reload"></li>
<li data-action="tab_discard" class="menu_item" id="tabs_menu_discard"></li> <li data-action="tab_discard" class="menu_item" id="tabs_menu_discard"></li>
<div class="separator"></div> <div class="separator"></div>
<li data-action="tab_expand_all" class="menu_item" id="tabs_menu_expand_all"></li> <li data-action="tab_close" class="menu_item" id="tabs_menu_close"></li>
<li data-action="tab_collapse_all" class="menu_item" id="tabs_menu_collapse_all"></li>
<div class="separator"></div>
<li data-action="tab_pin" class="menu_item" id="tabs_menu_pin"></li>
<div class="separator"></div> <div class="separator"></div>
<li data-action="tab_mute" class="menu_item" id="tabs_menu_mute"></li> <li data-action="tab_mute" class="menu_item" id="tabs_menu_mute"></li>
<li data-action="tab_unmute" class="menu_item" id="tabs_menu_unmute"></li> <li data-action="tab_unmute" class="menu_item" id="tabs_menu_unmute"></li>
@ -80,23 +88,82 @@
<li data-action="tab_mute_other" class="menu_item" id="tabs_menu_mute_other"></li> <li data-action="tab_mute_other" class="menu_item" id="tabs_menu_mute_other"></li>
<li data-action="tab_unmute_other" class="menu_item" id="tabs_menu_unmute_other"></li> <li data-action="tab_unmute_other" class="menu_item" id="tabs_menu_unmute_other"></li>
<div class="separator"></div> <div class="separator"></div>
<li data-action="tab_undo_close" class="menu_item" id="tabs_menu_undo"></li>
<div class="separator"></div>
<li data-action="tab_settings" class="menu_item" id="tabs_menu_settings"></li>
</ul>
<ul class="menu" id="tabs_menu">
<li data-action="tab_new" class="menu_item" id="tabs_menu_new"></li>
<div class="separator"></div>
<li data-action="tab_pin" class="menu_item" id="tabs_menu_pin"></li>
<div class="separator"></div>
<li data-action="folder_new" class="menu_item" id="folders_menu_new_folder"></li>
<li data-action="group_new" class="menu_item" id="groups_menu_new_group"></li>
<div class="separator"></div>
<li data-action="tab_clone" class="menu_item" id="tabs_menu_clone"></li>
<div class="separator"></div>
<li data-action="tab_expand_all" class="menu_item" id="tabs_menu_expand_all"></li>
<li data-action="tab_collapse_all" class="menu_item" id="tabs_menu_collapse_all"></li>
<div class="separator"></div>
<li data-action="tab_move" class="menu_item" id="tabs_menu_move"></li>
<li data-action="tab_reload" class="menu_item" id="tabs_menu_reload"></li>
<li data-action="tab_discard" class="menu_item" id="tabs_menu_discard"></li>
<div class="separator"></div>
<li data-action="tab_close" class="menu_item" id="tabs_menu_close"></li> <li data-action="tab_close" class="menu_item" id="tabs_menu_close"></li>
<li data-action="tab_close_tree" class="menu_item" id="tabs_menu_close_tree"></li> <li data-action="tab_close_tree" class="menu_item" id="tabs_menu_close_tree"></li>
<li data-action="tab_close_other" class="menu_item" id="tabs_menu_close_other"></li> <li data-action="tab_close_other" class="menu_item" id="tabs_menu_close_other"></li>
<div class="separator"></div> <div class="separator"></div>
<li data-action="tab_mute" class="menu_item" id="tabs_menu_mute"></li>
<li data-action="tab_unmute" class="menu_item" id="tabs_menu_unmute"></li>
<div class="separator"></div>
<li data-action="tab_mute_other" class="menu_item" id="tabs_menu_mute_other"></li>
<li data-action="tab_unmute_other" class="menu_item" id="tabs_menu_unmute_other"></li>
<div class="separator"></div>
<li data-action="tab_undo_close" class="menu_item" id="tabs_menu_undo"></li> <li data-action="tab_undo_close" class="menu_item" id="tabs_menu_undo"></li>
<div class="separator"></div> <div class="separator"></div>
<li data-action="tab_settings" class="menu_item" id="tabs_menu_settings"></li> <li data-action="tab_settings" class="menu_item" id="tabs_menu_settings"></li>
</ul> </ul>
<ul class="menu" id="folders_menu">
<li data-action="tab_new" class="menu_item" id="tabs_menu_new"></li>
<li data-action="folder_new" class="menu_item" id="folders_menu_new_folder"></li>
<li data-action="group_new" class="menu_item" id="groups_menu_new_group"></li>
<div class="separator"></div>
<li data-action="folder_rename" class="menu_item" id="folders_menu_rename_folder"></li>
<div class="separator"></div>
<li data-action="folder_delete" class="menu_item" id="folders_menu_delete"></li>
<div class="separator"></div>
<li data-action="tab_settings" class="menu_item" id="tabs_menu_settings"></li>
</ul>
<ul class="menu" id="global_menu">
<li data-action="tab_new" class="menu_item" id="tabs_menu_new"></li>
<li data-action="folder_new" class="menu_item" id="folders_menu_new_folder"></li>
<li data-action="group_new" class="menu_item" id="groups_menu_new_group"></li>
<div class="separator"></div>
<li data-action="tab_expand_all" class="menu_item" id="tabs_menu_expand_all"></li>
<li data-action="tab_collapse_all" class="menu_item" id="tabs_menu_collapse_all"></li>
<div class="separator"></div>
<li data-action="tab_undo_close" class="menu_item" id="tabs_menu_undo"></li>
<div class="separator"></div>
<li data-action="tab_settings" class="menu_item" id="tabs_menu_settings"></li>
</ul>
<ul class="menu" id="groups_menu">
<li data-action="group_new" class="menu_item" id="groups_menu_new_group"></li>
<li data-action="group_rename" class="menu_item" id="groups_menu_rename"></li>
<li data-action="group_delete" class="menu_item" id="groups_menu_delete"></li>
<li data-action="group_delete_tabs_close" class="menu_item" id="groups_menu_delete_tabs_close"></li>
<div class="separator"></div>
<li data-action="group_unload" class="menu_item" id="groups_menu_unload"></li>
</ul>
<!-- <!--
<ul class="menu" id="move_to_group_menu"> <ul class="menu" id="move_to_group_menu">
<li data-action="move_to_new_group" class="menu_item" id="tabs_menu_move_to_new_group"></li> <li data-action="move_to_new_group" class="menu_item" id="tabs_menu_move_to_new_group"></li>
<div class="separator"></div> <div class="separator"></div>
</ul> </ul>
<ul class="menu" id="groups_menu"> <ul class="menu" id="groups_menu">
<li data-action="group_new" class="groups_menu_item" id="groups_menu_new"></li>
<li data-action="group_edit" class="groups_menu_item" id="groups_menu_edit"></li>
<li data-action="group_bookmark" class="groups_menu_item" id="groups_menu_bookmark"></li> <li data-action="group_bookmark" class="groups_menu_item" id="groups_menu_bookmark"></li>
<div class="separator"></div> <div class="separator"></div>
<li data-action="group_mute" class="groups_menu_item" id="groups_menu_mute"></li> <li data-action="group_mute" class="groups_menu_item" id="groups_menu_mute"></li>
@ -106,7 +173,6 @@
<div class="separator"></div> <div class="separator"></div>
<li data-action="group_close" class="groups_menu_item" id="groups_menu_close"></li> <li data-action="group_close" class="groups_menu_item" id="groups_menu_close"></li>
<li data-action="group_close_with_tabs" class="groups_menu_item" id="groups_menu_close_with_tabs"></li> <li data-action="group_close_with_tabs" class="groups_menu_item" id="groups_menu_close_with_tabs"></li>
<li data-action="group_discard" class="groups_menu_item" id="groups_menu_discard"></li>
<li data-action="group_suspend" class="groups_menu_item" id="groups_menu_suspend"></li> <li data-action="group_suspend" class="groups_menu_item" id="groups_menu_suspend"></li>
<div class="separator"></div> <div class="separator"></div>
</ul> </ul>
@ -118,6 +184,7 @@
<script type="text/javascript" src="../scripts/toolbar.js"></script> <script type="text/javascript" src="../scripts/toolbar.js"></script>
<script type="text/javascript" src="../scripts/chrome.js"></script> <script type="text/javascript" src="../scripts/chrome.js"></script>
<script type="text/javascript" src="../scripts/refresh.js"></script> <script type="text/javascript" src="../scripts/refresh.js"></script>
<script type="text/javascript" src="../scripts/utils.js"></script>
<script type="text/javascript" src="../scripts/drag_and_drop.js"></script> <script type="text/javascript" src="../scripts/drag_and_drop.js"></script>
<script type="text/javascript" src="../scripts/backup.js"></script> <script type="text/javascript" src="../scripts/backup.js"></script>

View File

@ -13,7 +13,7 @@ function Loadi18n() {
$(this).text(chrome.i18n.getMessage(this.id)); $(this).text(chrome.i18n.getMessage(this.id));
}); });
// edit group dialog labels // edit group dialog labels
$(".group_edit_button").each(function() { $(".edit_dialog_button").each(function() {
$(this)[0].textContent = chrome.i18n.getMessage(this.id); $(this)[0].textContent = chrome.i18n.getMessage(this.id);
}); });
} }
@ -26,24 +26,31 @@ function RestorePinListRowSettings() {
RefreshGUI(); RefreshGUI();
} }
function Run() { function Run() {
LoadPreferences(); chrome.runtime.sendMessage({command: "is_bg_ready"}, function(response) {
setTimeout(function() {
if (response == true) {
Load();
} else {
Run();
}
},200);
});
}
function Load() {
chrome.windows.getCurrent({populate: false}, function(window) { chrome.windows.getCurrent({populate: false}, function(window) {
CurrentWindowId = window.id; CurrentWindowId = window.id;
chrome.runtime.sendMessage({command: "is_bg_running"}, function(response) { chrome.runtime.sendMessage({command: "get_preferences"}, function(response) {
running = response; opt = Object.assign({}, response);
chrome.runtime.sendMessage({command: "get_browser_tabs"}, function(response) { chrome.runtime.sendMessage({command: "get_browser_tabs"}, function(response) {
bgtabs = Object.assign({}, response); bgtabs = Object.assign({}, response);
chrome.runtime.sendMessage({command: "get_groups", windowId: CurrentWindowId}, function(response) { chrome.runtime.sendMessage({command: "get_folders", windowId: CurrentWindowId}, function(response) {
bggroups = Object.assign({}, response); bgfolders = Object.assign({}, response);
chrome.runtime.sendMessage({command: "get_theme", windowId: CurrentWindowId}, function(response) { chrome.runtime.sendMessage({command: "get_groups", windowId: CurrentWindowId}, function(response) {
theme = response; bggroups = Object.assign({}, response);
setTimeout(function() { chrome.runtime.sendMessage({command: "get_theme", windowId: CurrentWindowId}, function(response) {
if (opt != undefined && browserId != undefined && bgtabs != undefined && bggroups != undefined && running == true) { ApplyTheme(response);
Initialize(); Initialize();
} else { });
Run();
}
},200);
}); });
}); });
}); });
@ -51,46 +58,19 @@ function Run() {
}); });
} }
function Initialize() { function Initialize() {
// THEME
RestoreStateOfGroupsToolbar();
// var theme = LoadData(("theme"+localStorage["current_theme"]), {"TabsSizeSetNumber": 2, "ToolbarShow": true, "toolbar": DefaultToolbar});
// I have no idea what is going on in latest build, but why top position for various things is different in firefox?????
if (browserId == "F") {
if (theme.TabsSizeSetNumber > 1) {
document.styleSheets[document.styleSheets.length-1].insertRule(".tab_header>.tab_title { margin-top: -1px; }", document.styleSheets[document.styleSheets.length-1].cssRules.length);
}
}
ApplySizeSet(theme["TabsSizeSetNumber"]);
ApplyColorsSet(theme["ColorsSet"]);
if (theme.ToolbarShow) {
if (theme.theme_version == DefaultTheme.theme_version) {
$("#toolbar").html(theme.toolbar);
if (browserId == "F") {
$(".button#button_load_bak1, .button#button_load_bak2, .button#button_load_bak3").remove();
}
} else {
$("#toolbar").html(DefaultToolbar);
}
}
// APPEND GROUPS // APPEND GROUPS
AppendAllGroups(); AppendGroups(bggroups);
chrome.tabs.query({currentWindow: true}, function(tabs) { chrome.tabs.query({currentWindow: true}, function(tabs) {
// AddNewFolder();AddNewFolder();AddNewFolder();AddNewFolder();AddNewFolder(); // APPEND FOLDERS
AppendFolders(bgfolders);
// APPEND TABS // APPEND TABS
let tc = tabs.length; let tc = tabs.length;
for (var ti = 0; ti < tc; ti++) { for (var ti = 0; ti < tc; ti++) {
AppendTab({tab: tabs[ti], Append: true, SkipSetActive: true}); AppendTab({tab: tabs[ti], Append: true, SkipSetActive: true});
} }
for (var ti = 0; ti < tc; ti++) {
if (bgtabs[tabs[ti].id] && !tabs[ti].pinned && $("#"+bgtabs[tabs[ti].id].parent)[0] && $("#"+bgtabs[tabs[ti].id].parent).is(".group")) {
$("#"+bgtabs[tabs[ti].id].parent).append($("#"+tabs[ti].id));
}
}
for (var ti = 0; ti < tc; ti++) { for (var ti = 0; ti < tc; ti++) {
if (bgtabs[tabs[ti].id] && !tabs[ti].pinned) { if (bgtabs[tabs[ti].id] && !tabs[ti].pinned) {
if ($("#"+bgtabs[tabs[ti].id].parent).length > 0 && $("#"+bgtabs[tabs[ti].id].parent).is(".tab") && $("#"+tabs[ti].id).find($("#ch"+bgtabs[tabs[ti].id].parent)).length == 0) { if ($("#"+bgtabs[tabs[ti].id].parent).length > 0 && $("#"+tabs[ti].id).find($("#ch"+bgtabs[tabs[ti].id].parent)).length == 0) {
$("#ch"+bgtabs[tabs[ti].id].parent).append($("#"+tabs[ti].id)); $("#ch"+bgtabs[tabs[ti].id].parent).append($("#"+tabs[ti].id));
} }
} }
@ -100,18 +80,17 @@ function Initialize() {
$("#"+tabs[ti].id).addClass(bgtabs[tabs[ti].id].expand); $("#"+tabs[ti].id).addClass(bgtabs[tabs[ti].id].expand);
} }
} }
// SET ACTIVE IN EACH GROUP // SET ACTIVE TAB FOR EACH GROUP
for (var group in bggroups) { for (var group in bggroups) {
if ($("#"+group+" #"+bggroups[group].activetab)[0]) { if ($("#"+group+" #"+bggroups[group].active_tab)[0]) {
$("#"+bggroups[group].activetab).addClass("active"); $("#"+bggroups[group].active_tab).addClass("active_tab");
} }
} }
chrome.runtime.sendMessage({command: "get_active_group", windowId: CurrentWindowId}, function(response) { chrome.runtime.sendMessage({command: "get_active_group", windowId: CurrentWindowId}, function(response) {
SetActiveGroup(response, true, true); SetActiveGroup(response, false, true);
}); });
RearrangeTreeTabs(tabs, bgtabs, true); RearrangeTreeTabs(tabs, bgtabs, true);
RestoreToolbarShelf(); RearrangeFolders(true);
RestoreToolbarSearchFilter();
SetToolbarShelfToggle("mousedown"); SetToolbarShelfToggle("mousedown");
StartChromeListeners(); StartChromeListeners();
SetIOEvents(); SetIOEvents();
@ -122,29 +101,40 @@ function Initialize() {
SetFolderEvents(); SetFolderEvents();
SetMenu(); SetMenu();
SetDragAndDropEvents(); SetDragAndDropEvents();
RearrangeBrowserTabsCheck(); if (opt.syncro_tabbar_tabs_order || opt.syncro_tabbar_groups_tabs_order) {
Loadi18n(); RearrangeBrowserTabs();
}
RestorePinListRowSettings(); RestorePinListRowSettings();
if (browserId == "V") {
VivaldiRefreshMediaIcons();
}
var SetActiveLoop = setInterval(function() {
log("SetActiveTab");
chrome.tabs.query({currentWindow: true, active: true}, function(tabs) {
if (tabs[0].pinned && $("#"+active_group+" .active_tab")[0]) {
SetActiveTab(tabs[0].id);
} else {
clearInterval(SetActiveLoop);
}
});
}, 1000);
setTimeout(function() { setTimeout(function() {
RefreshExpandStates(); RefreshExpandStates();
RefreshCounters();
}, 1000); }, 1000);
setTimeout(function() { setTimeout(function() {
UpdateData(); UpdateData();
delete bgtabs; delete bgtabs;
delete theme; delete theme;
}, 5000); }, 5000);
if ($(".active:visible").length == 0) { if (browserId != "F") {
chrome.tabs.query({currentWindow: true, active: true}, function(tabs) { chrome.storage.local.get(null, function(items) {
if (tabs[0]) { if (Object.keys(items["windows_BAK1"]).length > 0) { $("#button_load_bak1").removeClass("disabled"); }
SetActiveTab(tabs[0].id); if (Object.keys(items["windows_BAK2"]).length > 0) { $("#button_load_bak2").removeClass("disabled"); }
} if (Object.keys(items["windows_BAK3"]).length > 0) { $("#button_load_bak3").removeClass("disabled"); }
}); });
} }
if (browserId == "V") {
VivaldiRefreshMediaIcons();
}
}); });
} }
function log(m) {
chrome.runtime.sendMessage({command: "console_log", m: m});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 B

75
theme/expand_c.svg Normal file
View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="20"
height="20"
viewBox="0 0 20 20"
id="svg4216"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="expand_closed.svg">
<defs
id="defs4218">
<pattern
y="0"
x="0"
height="6"
width="6"
patternUnits="userSpaceOnUse"
id="EMFhbasepattern" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="-7.637165"
inkscape:cy="10.163524"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1028"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:object-paths="true"
inkscape:snap-intersection-paths="true"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true" />
<metadata
id="metadata4221">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1032.3622)">
<path
inkscape:connector-curvature="0"
id="path4159"
d="m 2,1051.3622 0,-18 18,9 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

75
theme/expand_o.svg Normal file
View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="20"
height="20"
viewBox="0 0 20 20"
id="svg4216"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="expand_open.svg">
<defs
id="defs4218">
<pattern
y="0"
x="0"
height="6"
width="6"
patternUnits="userSpaceOnUse"
id="EMFhbasepattern" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="-7.480915"
inkscape:cy="12.038524"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1028"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:object-paths="true"
inkscape:snap-intersection-paths="true"
inkscape:object-nodes="true"
inkscape:snap-smooth-nodes="true" />
<metadata
id="metadata4221">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1032.3622)">
<path
inkscape:connector-curvature="0"
id="path4159"
d="m 1,1034.3622 18,0 -9,18 z"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

87
theme/icon_audio.svg Normal file
View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg3347"
version="1.1"
inkscape:version="0.91 r13725"
width="32"
height="32"
viewBox="0 0 32 32"
sodipodi:docname="icon_audio.svg">
<metadata
id="metadata3353">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3351" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1058"
id="namedview3349"
showgrid="false"
inkscape:zoom="22.627418"
inkscape:cx="26.09653"
inkscape:cy="12.511364"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg3347"
inkscape:snap-page="true"
inkscape:snap-center="true"
inkscape:snap-midpoints="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true"
inkscape:snap-smooth-nodes="true"
inkscape:object-nodes="true"
inkscape:snap-intersection-paths="true" />
<circle
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#747474;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="path4367"
cx="16"
cy="16"
r="15.5" />
<path
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#747474;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 19.822266,4.0009397 c -0.625024,0.01859 -1.306528,0.3134121 -1.885254,1.0019749 l -5.025879,4.9966908 -2.411133,0 c -0.831,0 -1.5,0.6690136 -1.5,1.5000316 l 0,9.000195 c 0,0.831018 0.669,1.500032 1.5,1.500032 l 2.411133,0 5.025879,4.99669 C 19.48028,28.832722 21.75,27.874085 21.75,26.318316 l 0,-20.6371641 c 0,-0.9723541 -0.88603,-1.7111944 -1.927734,-1.6802122 z"
id="path4363"
inkscape:connector-curvature="0" />
<circle
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#484848;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="path4367-3"
cx="62.667339"
cy="15.648156"
r="16" />
<path
id="path4363-9"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#303030;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 66.303216,20.605411 c -0.225509,-0.102094 -0.495003,-0.362337 -0.588623,-0.568416 -0.11076,-0.243808 -0.11375,-0.680744 -0.0063,-0.90738 0.04467,-0.09413 0.292516,-0.382316 0.550781,-0.640411 0.51028,-0.509948 0.737221,-0.819847 0.985761,-1.346109 0.259965,-0.550451 0.327078,-0.870101 0.322535,-1.53619 -0.0034,-0.506294 -0.02163,-0.640094 -0.133799,-0.984374 -0.237499,-0.729013 -0.494106,-1.127977 -1.175815,-1.828126 -0.263574,-0.270702 -0.513301,-0.559694 -0.55495,-0.642203 -0.044,-0.08718 -0.07572,-0.264947 -0.07572,-0.424391 0,-0.681928 0.572223,-1.199134 1.229117,-1.110941 0.277004,0.03719 0.765098,0.369614 1.232371,0.83933 0.778247,0.782315 1.268599,1.656516 1.552552,2.767894 0.160972,0.630041 0.204648,1.758965 0.09289,2.401104 -0.157395,0.904373 -0.522568,1.779381 -1.045997,2.50636 -0.311231,0.432261 -0.963328,1.076335 -1.349017,1.332418 -0.235034,0.156054 -0.311177,0.181368 -0.581042,0.193169 -0.193063,0.0085 -0.365145,-0.01113 -0.45483,-0.05174 z m 2.605205,4.114373 c -0.718996,-0.310949 -0.905938,-1.291431 -0.344136,-1.80494 0.07326,-0.06696 0.312497,-0.256091 0.531636,-0.420287 1.390626,-1.041951 2.497218,-2.643242 3.018195,-4.367466 0.278134,-0.920516 0.332662,-1.335382 0.331239,-2.520186 -0.0011,-0.962797 -0.01219,-1.105824 -0.126576,-1.641626 -0.464149,-2.174031 -1.622081,-3.9891005 -3.373891,-5.2886095 -0.487395,-0.361554 -0.614982,-0.522675 -0.697715,-0.881088 -0.147449,-0.638785 0.387329,-1.295818 1.054702,-1.295818 0.310709,0 0.564314,0.11453 1.036234,0.467972 2.00977,1.505203 3.448923,3.6933425 4.054802,6.1650645 0.226209,0.922836 0.295459,1.642879 0.269143,2.798493 -0.01886,0.828481 -0.0452,1.127341 -0.145537,1.651351 -0.437652,2.285744 -1.503415,4.265256 -3.151939,5.854304 -0.560462,0.540242 -1.269621,1.096555 -1.588969,1.246496 -0.273428,0.128383 -0.620709,0.142935 -0.867188,0.03633 z M 61.489605,3.6490955 c -0.625024,0.01859 -1.306528,0.313412 -1.885254,1.001975 l -5.025879,4.99669 -2.411133,0 c -0.831,0 -1.5,0.6690135 -1.5,1.5000315 l 0,9.000195 c 0,0.831018 0.669,1.500032 1.5,1.500032 l 2.411133,0 5.025879,4.99669 c 1.543268,1.836168 3.812988,0.877531 3.812988,-0.678238 l 0,-20.6371635 c 0,-0.972354 -0.88603,-1.711194 -1.927734,-1.680212 z"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg3347"
version="1.1"
inkscape:version="0.91 r13725"
width="32"
height="32"
viewBox="0 0 32 32"
sodipodi:docname="icon_audio_hover.svg">
<metadata
id="metadata3353">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3351" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1058"
id="namedview3349"
showgrid="false"
inkscape:zoom="11.313709"
inkscape:cx="8.3336413"
inkscape:cy="25.450376"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg3347"
inkscape:snap-page="true"
inkscape:snap-center="true"
inkscape:snap-midpoints="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true"
inkscape:snap-smooth-nodes="true"
inkscape:object-nodes="true"
inkscape:snap-intersection-paths="true" />
<circle
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.89411765;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="path4367"
cx="16"
cy="16"
r="15.5" />
<path
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:0.89320385;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 19.822266,4.0009397 c -0.625024,0.01859 -1.306528,0.3134121 -1.885254,1.0019749 l -5.025879,4.9966908 -2.411133,0 c -0.831,0 -1.5,0.6690136 -1.5,1.5000316 l 0,9.000195 c 0,0.831018 0.669,1.500032 1.5,1.500032 l 2.411133,0 5.025879,4.99669 C 19.48028,28.832722 21.75,27.874085 21.75,26.318316 l 0,-20.6371641 c 0,-0.9723541 -0.88603,-1.7111944 -1.927734,-1.6802122 z"
id="path4363"
inkscape:connector-curvature="0" />
<circle
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#484848;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="path4367-3"
cx="62.667339"
cy="15.648156"
r="16" />
<path
id="path4363-9"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#303030;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 66.303216,20.605411 c -0.225509,-0.102094 -0.495003,-0.362337 -0.588623,-0.568416 -0.11076,-0.243808 -0.11375,-0.680744 -0.0063,-0.90738 0.04467,-0.09413 0.292516,-0.382316 0.550781,-0.640411 0.51028,-0.509948 0.737221,-0.819847 0.985761,-1.346109 0.259965,-0.550451 0.327078,-0.870101 0.322535,-1.53619 -0.0034,-0.506294 -0.02163,-0.640094 -0.133799,-0.984374 -0.237499,-0.729013 -0.494106,-1.127977 -1.175815,-1.828126 -0.263574,-0.270702 -0.513301,-0.559694 -0.55495,-0.642203 -0.044,-0.08718 -0.07572,-0.264947 -0.07572,-0.424391 0,-0.681928 0.572223,-1.199134 1.229117,-1.110941 0.277004,0.03719 0.765098,0.369614 1.232371,0.83933 0.778247,0.782315 1.268599,1.656516 1.552552,2.767894 0.160972,0.630041 0.204648,1.758965 0.09289,2.401104 -0.157395,0.904373 -0.522568,1.779381 -1.045997,2.50636 -0.311231,0.432261 -0.963328,1.076335 -1.349017,1.332418 -0.235034,0.156054 -0.311177,0.181368 -0.581042,0.193169 -0.193063,0.0085 -0.365145,-0.01113 -0.45483,-0.05174 z m 2.605205,4.114373 c -0.718996,-0.310949 -0.905938,-1.291431 -0.344136,-1.80494 0.07326,-0.06696 0.312497,-0.256091 0.531636,-0.420287 1.390626,-1.041951 2.497218,-2.643242 3.018195,-4.367466 0.278134,-0.920516 0.332662,-1.335382 0.331239,-2.520186 -0.0011,-0.962797 -0.01219,-1.105824 -0.126576,-1.641626 -0.464149,-2.174031 -1.622081,-3.9891005 -3.373891,-5.2886095 -0.487395,-0.361554 -0.614982,-0.522675 -0.697715,-0.881088 -0.147449,-0.638785 0.387329,-1.295818 1.054702,-1.295818 0.310709,0 0.564314,0.11453 1.036234,0.467972 2.00977,1.505203 3.448923,3.6933425 4.054802,6.1650645 0.226209,0.922836 0.295459,1.642879 0.269143,2.798493 -0.01886,0.828481 -0.0452,1.127341 -0.145537,1.651351 -0.437652,2.285744 -1.503415,4.265256 -3.151939,5.854304 -0.560462,0.540242 -1.269621,1.096555 -1.588969,1.246496 -0.273428,0.128383 -0.620709,0.142935 -0.867188,0.03633 z M 61.489605,3.6490955 c -0.625024,0.01859 -1.306528,0.313412 -1.885254,1.001975 l -5.025879,4.99669 -2.411133,0 c -0.831,0 -1.5,0.6690135 -1.5,1.5000315 l 0,9.000195 c 0,0.831018 0.669,1.500032 1.5,1.500032 l 2.411133,0 5.025879,4.99669 c 1.543268,1.836168 3.812988,0.877531 3.812988,-0.678238 l 0,-20.6371635 c 0,-0.972354 -0.88603,-1.711194 -1.927734,-1.680212 z"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg3347"
version="1.1"
inkscape:version="0.91 r13725"
width="32"
height="32"
viewBox="0 0 32 32"
sodipodi:docname="icon_audio_muted.svg">
<metadata
id="metadata3353">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3351" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1058"
id="namedview3349"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="12.977065"
inkscape:cy="17.431941"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg3347"
inkscape:snap-page="true"
inkscape:snap-center="true"
inkscape:snap-midpoints="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true"
inkscape:snap-smooth-nodes="true"
inkscape:object-nodes="true"
inkscape:snap-intersection-paths="true" />
<circle
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#747474;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="path4367"
cx="16"
cy="16"
r="15.5" />
<path
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#747474;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 19.822266,4.0009397 c -0.625024,0.01859 -1.306528,0.3134121 -1.885254,1.0019749 l -5.025879,4.9966908 -2.411133,0 c -0.831,0 -1.5,0.6690136 -1.5,1.5000316 l 0,9.000195 c 0,0.831018 0.669,1.500032 1.5,1.500032 l 2.411133,0 5.025879,4.99669 C 19.48028,28.832722 21.75,27.874085 21.75,26.318316 l 0,-20.6371641 c 0,-0.9723541 -0.88603,-1.7111944 -1.927734,-1.6802122 z"
id="path4363"
inkscape:connector-curvature="0" />
<circle
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#484848;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="path4367-3"
cx="62.667339"
cy="15.648156"
r="16" />
<path
id="path4363-9"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#303030;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 66.303216,20.605411 c -0.225509,-0.102094 -0.495003,-0.362337 -0.588623,-0.568416 -0.11076,-0.243808 -0.11375,-0.680744 -0.0063,-0.90738 0.04467,-0.09413 0.292516,-0.382316 0.550781,-0.640411 0.51028,-0.509948 0.737221,-0.819847 0.985761,-1.346109 0.259965,-0.550451 0.327078,-0.870101 0.322535,-1.53619 -0.0034,-0.506294 -0.02163,-0.640094 -0.133799,-0.984374 -0.237499,-0.729013 -0.494106,-1.127977 -1.175815,-1.828126 -0.263574,-0.270702 -0.513301,-0.559694 -0.55495,-0.642203 -0.044,-0.08718 -0.07572,-0.264947 -0.07572,-0.424391 0,-0.681928 0.572223,-1.199134 1.229117,-1.110941 0.277004,0.03719 0.765098,0.369614 1.232371,0.83933 0.778247,0.782315 1.268599,1.656516 1.552552,2.767894 0.160972,0.630041 0.204648,1.758965 0.09289,2.401104 -0.157395,0.904373 -0.522568,1.779381 -1.045997,2.50636 -0.311231,0.432261 -0.963328,1.076335 -1.349017,1.332418 -0.235034,0.156054 -0.311177,0.181368 -0.581042,0.193169 -0.193063,0.0085 -0.365145,-0.01113 -0.45483,-0.05174 z m 2.605205,4.114373 c -0.718996,-0.310949 -0.905938,-1.291431 -0.344136,-1.80494 0.07326,-0.06696 0.312497,-0.256091 0.531636,-0.420287 1.390626,-1.041951 2.497218,-2.643242 3.018195,-4.367466 0.278134,-0.920516 0.332662,-1.335382 0.331239,-2.520186 -0.0011,-0.962797 -0.01219,-1.105824 -0.126576,-1.641626 -0.464149,-2.174031 -1.622081,-3.9891005 -3.373891,-5.2886095 -0.487395,-0.361554 -0.614982,-0.522675 -0.697715,-0.881088 -0.147449,-0.638785 0.387329,-1.295818 1.054702,-1.295818 0.310709,0 0.564314,0.11453 1.036234,0.467972 2.00977,1.505203 3.448923,3.6933425 4.054802,6.1650645 0.226209,0.922836 0.295459,1.642879 0.269143,2.798493 -0.01886,0.828481 -0.0452,1.127341 -0.145537,1.651351 -0.437652,2.285744 -1.503415,4.265256 -3.151939,5.854304 -0.560462,0.540242 -1.269621,1.096555 -1.588969,1.246496 -0.273428,0.128383 -0.620709,0.142935 -0.867188,0.03633 z M 61.489605,3.6490955 c -0.625024,0.01859 -1.306528,0.313412 -1.885254,1.001975 l -5.025879,4.99669 -2.411133,0 c -0.831,0 -1.5,0.6690135 -1.5,1.5000315 l 0,9.000195 c 0,0.831018 0.669,1.500032 1.5,1.500032 l 2.411133,0 5.025879,4.99669 c 1.543268,1.836168 3.812988,0.877531 3.812988,-0.678238 l 0,-20.6371635 c 0,-0.972354 -0.88603,-1.711194 -1.927734,-1.680212 z"
inkscape:connector-curvature="0" />
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#747474;fill-opacity:1;fill-rule:evenodd;stroke:#e7e7e7;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect4393"
width="40.959385"
height="2.2954471"
x="-20.479692"
y="21.479692"
transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,0,0)" />
</svg>

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg3347"
version="1.1"
inkscape:version="0.91 r13725"
width="32"
height="32"
viewBox="0 0 32 32"
sodipodi:docname="icon_audio_muted_hover.svg">
<metadata
id="metadata3353">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3351" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1058"
id="namedview3349"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="20.156418"
inkscape:cy="21.255344"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg3347"
inkscape:snap-page="true"
inkscape:snap-center="true"
inkscape:snap-midpoints="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true"
inkscape:snap-smooth-nodes="true"
inkscape:object-nodes="true"
inkscape:snap-intersection-paths="true" />
<circle
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.89411765;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="path4367"
cx="16"
cy="16"
r="15.5" />
<path
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:0.89411765;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 19.822266,4.0009397 c -0.625024,0.01859 -1.306528,0.3134121 -1.885254,1.0019749 l -5.025879,4.9966908 -2.411133,0 c -0.831,0 -1.5,0.6690136 -1.5,1.5000316 l 0,9.000195 c 0,0.831018 0.669,1.500032 1.5,1.500032 l 2.411133,0 5.025879,4.99669 C 19.48028,28.832722 21.75,27.874085 21.75,26.318316 l 0,-20.6371641 c 0,-0.9723541 -0.88603,-1.7111944 -1.927734,-1.6802122 z"
id="path4363"
inkscape:connector-curvature="0" />
<circle
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#e7e7e7;fill-opacity:1;fill-rule:evenodd;stroke:#484848;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="path4367-3"
cx="62.667339"
cy="15.648156"
r="16" />
<path
id="path4363-9"
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#303030;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
d="m 66.303216,20.605411 c -0.225509,-0.102094 -0.495003,-0.362337 -0.588623,-0.568416 -0.11076,-0.243808 -0.11375,-0.680744 -0.0063,-0.90738 0.04467,-0.09413 0.292516,-0.382316 0.550781,-0.640411 0.51028,-0.509948 0.737221,-0.819847 0.985761,-1.346109 0.259965,-0.550451 0.327078,-0.870101 0.322535,-1.53619 -0.0034,-0.506294 -0.02163,-0.640094 -0.133799,-0.984374 -0.237499,-0.729013 -0.494106,-1.127977 -1.175815,-1.828126 -0.263574,-0.270702 -0.513301,-0.559694 -0.55495,-0.642203 -0.044,-0.08718 -0.07572,-0.264947 -0.07572,-0.424391 0,-0.681928 0.572223,-1.199134 1.229117,-1.110941 0.277004,0.03719 0.765098,0.369614 1.232371,0.83933 0.778247,0.782315 1.268599,1.656516 1.552552,2.767894 0.160972,0.630041 0.204648,1.758965 0.09289,2.401104 -0.157395,0.904373 -0.522568,1.779381 -1.045997,2.50636 -0.311231,0.432261 -0.963328,1.076335 -1.349017,1.332418 -0.235034,0.156054 -0.311177,0.181368 -0.581042,0.193169 -0.193063,0.0085 -0.365145,-0.01113 -0.45483,-0.05174 z m 2.605205,4.114373 c -0.718996,-0.310949 -0.905938,-1.291431 -0.344136,-1.80494 0.07326,-0.06696 0.312497,-0.256091 0.531636,-0.420287 1.390626,-1.041951 2.497218,-2.643242 3.018195,-4.367466 0.278134,-0.920516 0.332662,-1.335382 0.331239,-2.520186 -0.0011,-0.962797 -0.01219,-1.105824 -0.126576,-1.641626 -0.464149,-2.174031 -1.622081,-3.9891005 -3.373891,-5.2886095 -0.487395,-0.361554 -0.614982,-0.522675 -0.697715,-0.881088 -0.147449,-0.638785 0.387329,-1.295818 1.054702,-1.295818 0.310709,0 0.564314,0.11453 1.036234,0.467972 2.00977,1.505203 3.448923,3.6933425 4.054802,6.1650645 0.226209,0.922836 0.295459,1.642879 0.269143,2.798493 -0.01886,0.828481 -0.0452,1.127341 -0.145537,1.651351 -0.437652,2.285744 -1.503415,4.265256 -3.151939,5.854304 -0.560462,0.540242 -1.269621,1.096555 -1.588969,1.246496 -0.273428,0.128383 -0.620709,0.142935 -0.867188,0.03633 z M 61.489605,3.6490955 c -0.625024,0.01859 -1.306528,0.313412 -1.885254,1.001975 l -5.025879,4.99669 -2.411133,0 c -0.831,0 -1.5,0.6690135 -1.5,1.5000315 l 0,9.000195 c 0,0.831018 0.669,1.500032 1.5,1.500032 l 2.411133,0 5.025879,4.99669 c 1.543268,1.836168 3.812988,0.877531 3.812988,-0.678238 l 0,-20.6371635 c 0,-0.972354 -0.88603,-1.711194 -1.927734,-1.680212 z"
inkscape:connector-curvature="0" />
<rect
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#000000;fill-opacity:0.89411765;fill-rule:evenodd;stroke:#e7e7e7;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
id="rect4393"
width="40.959385"
height="2.2954471"
x="-20.479692"
y="21.479692"
transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,0,0)" />
</svg>

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -39,16 +39,16 @@
guidetolerance="10" guidetolerance="10"
inkscape:pageopacity="0" inkscape:pageopacity="0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:window-width="1552" inkscape:window-width="1920"
inkscape:window-height="811" inkscape:window-height="1058"
id="namedview3349" id="namedview3349"
showgrid="false" showgrid="false"
inkscape:zoom="11.313709" inkscape:zoom="11.313709"
inkscape:cx="-6.6202105" inkscape:cx="-2.4116637"
inkscape:cy="14.42908" inkscape:cy="6.1185819"
inkscape:window-x="185" inkscape:window-x="1912"
inkscape:window-y="94" inkscape:window-y="-8"
inkscape:window-maximized="0" inkscape:window-maximized="1"
inkscape:current-layer="svg3347" inkscape:current-layer="svg3347"
inkscape:snap-page="true" inkscape:snap-page="true"
inkscape:snap-center="true" inkscape:snap-center="true"
@ -59,36 +59,16 @@
inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true" inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true" /> inkscape:object-paths="true" />
<rect <path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#cccccc;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="rect3365" d="M 0,5 0,15 13,15 13,5 Z"
width="6.99999" id="path4138"
height="6.99999" inkscape:connector-curvature="0"
x="20.687504" sodipodi:nodetypes="ccccc" />
y="-13.625002" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3367"
width="4.99999"
height="4.99999"
x="36.187504"
y="0.74999785" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3369"
width="4.99999"
height="4.99999"
x="32.812504"
y="13.812496" />
<path <path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 12.3125,4.8504126 12.28125,2.0625 6.34375,2.125 5.71875,1.03125 2.6875,1.09375 1.96875,2.78125 0.53125,2.84375 0.50457646,15.003657" d="m 12.499937,5.5 1.25e-4,-2 -6.156187,0 L 5.71875,1.5 0.5,1.5 0.5,15"
id="path4149" id="path4149"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" /> sodipodi:nodetypes="cccccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 0.50520155,14.718693 12.15104845,0 0,-10.343693 -12.12855679,0.090218"
id="path4151"
inkscape:connector-curvature="0" />
</svg> </svg>

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -24,7 +24,7 @@
<dc:format>image/svg+xml</dc:format> <dc:format>image/svg+xml</dc:format>
<dc:type <dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title> <dc:title />
</cc:Work> </cc:Work>
</rdf:RDF> </rdf:RDF>
</metadata> </metadata>
@ -39,16 +39,16 @@
guidetolerance="10" guidetolerance="10"
inkscape:pageopacity="0" inkscape:pageopacity="0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:window-width="1552" inkscape:window-width="1920"
inkscape:window-height="811" inkscape:window-height="1058"
id="namedview3349" id="namedview3349"
showgrid="false" showgrid="false"
inkscape:zoom="11.313709" inkscape:zoom="11.313709"
inkscape:cx="-15.841251" inkscape:cx="-3.2022799"
inkscape:cy="9.3738536" inkscape:cy="9.440858"
inkscape:window-x="185" inkscape:window-x="1912"
inkscape:window-y="94" inkscape:window-y="-8"
inkscape:window-maximized="0" inkscape:window-maximized="1"
inkscape:current-layer="svg3347" inkscape:current-layer="svg3347"
inkscape:snap-page="true" inkscape:snap-page="true"
inkscape:snap-center="true" inkscape:snap-center="true"
@ -59,37 +59,16 @@
inkscape:snap-bbox-edge-midpoints="true" inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true" inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true" /> inkscape:object-paths="true" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#cccccc;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3365"
width="6.99999"
height="6.99999"
x="20.687504"
y="-13.625002" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3367"
width="4.99999"
height="4.99999"
x="36.187504"
y="0.74999785" />
<rect
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect3369"
width="4.99999"
height="4.99999"
x="32.812504"
y="13.812496" />
<path <path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 6,5.3125 5.3378538,5.4893868 4.875,5.9375 0.78125,14.5 11.90625,14.40625 14.894908,5.9394164 14.802966,5.5366117 14.40816,5.1698614 Z" d="M 3,5 0,15 13,15 16,5 Z"
id="path4138" id="path4138"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccccc" /> sodipodi:nodetypes="ccccc" />
<path <path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 12.3125,4.8504126 12.28125,2.0625 6.34375,2.125 5.71875,1.03125 2.6875,1.09375 1.96875,2.78125 0.53125,2.84375 0.50457646,15.003657" d="m 12.499937,5.5 1.25e-4,-2 -6.156187,0 L 5.71875,1.5 0.5,1.5 0.5,15"
id="path4149" id="path4149"
inkscape:connector-curvature="0" inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" /> sodipodi:nodetypes="cccccc" />
</svg> </svg>

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -25,6 +25,8 @@
div { div {
background-repeat: no-repeat; background-repeat: no-repeat;
-webkit-mask-repeat:no-repeat;
mask-repeat: no-repeat;
} }
.sidebar_body { .sidebar_body {
background-color: var(--tab_list_background); background-color: var(--tab_list_background);
@ -108,144 +110,164 @@ div {
/* MAIN TOOLBAR BUTTONS */ /* MAIN TOOLBAR BUTTONS */
#button_bookmarks>.button_img { #button_bookmarks>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_bookmarks.svg); -webkit-mask-image: url(../theme/toolbar_bookmarks.svg);
mask-image: url(../theme/toolbar_bookmarks.svg); mask-image: url(../theme/toolbar_bookmarks.svg);
} }
#button_options>.button_img { #button_options>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_options.svg); -webkit-mask-image: url(../theme/toolbar_options.svg);
mask-image: url(../theme/toolbar_options.svg); mask-image: url(../theme/toolbar_options.svg);
} }
#button_settings>.button_img { #button_settings>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_settings.svg); -webkit-mask-image: url(../theme/toolbar_settings.svg);
mask-image: url(../theme/toolbar_settings.svg); mask-image: url(../theme/toolbar_settings.svg);
} }
#button_move .button_img { #button_move .button_img {
-webkit-mask-box-image: url(../theme/toolbar_move.svg); -webkit-mask-image: url(../theme/toolbar_move.svg);
mask-image: url(../theme/toolbar_move.svg); mask-image: url(../theme/toolbar_move.svg);
} }
#button_pin>.button_img { #button_pin>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_pin.svg); -webkit-mask-image: url(../theme/toolbar_pin.svg);
mask-image: url(../theme/toolbar_pin.svg); mask-image: url(../theme/toolbar_pin.svg);
} }
#button_history>.button_img { #button_history>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_history.svg); -webkit-mask-image: url(../theme/toolbar_history.svg);
mask-image: url(../theme/toolbar_history.svg); mask-image: url(../theme/toolbar_history.svg);
} }
#button_undo>.button_img { #button_undo>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_undo.svg); -webkit-mask-image: url(../theme/toolbar_undo.svg);
mask-image: url(../theme/toolbar_undo.svg); mask-image: url(../theme/toolbar_undo.svg);
} }
#button_downloads>.button_img { #button_downloads>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_downloads.svg); -webkit-mask-image: url(../theme/toolbar_downloads.svg);
mask-image: url(../theme/toolbar_downloads.svg); mask-image: url(../theme/toolbar_downloads.svg);
} }
#button_extensions>.button_img { #button_extensions>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_extensions.svg); -webkit-mask-image: url(../theme/toolbar_extensions.svg);
mask-image: url(../theme/toolbar_extensions.svg); mask-image: url(../theme/toolbar_extensions.svg);
} }
#button_discard>.button_img { #button_discard>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_discard.svg); -webkit-mask-image: url(../theme/toolbar_discard.svg);
mask-image: url(../theme/toolbar_discard.svg); mask-image: url(../theme/toolbar_discard.svg);
} }
#button_new>.button_img { #button_new>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_plus_big.svg); -webkit-mask-image: url(../theme/toolbar_plus_big.svg);
mask-image: url(../theme/toolbar_plus_big.svg); mask-image: url(../theme/toolbar_plus_big.svg);
} }
#button_tools>.button_img { #button_tools>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_wrench.svg); -webkit-mask-image: url(../theme/toolbar_wrench.svg);
mask-image: url(../theme/toolbar_wrench.svg); mask-image: url(../theme/toolbar_wrench.svg);
} }
#button_search>.button_img { #button_search>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_search.svg); -webkit-mask-image: url(../theme/toolbar_search.svg);
mask-image: url(../theme/toolbar_search.svg); mask-image: url(../theme/toolbar_search.svg);
} }
#button_groups>.button_img { #button_groups>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_groups.svg); -webkit-mask-image: url(../theme/toolbar_groups.svg);
mask-image: url(../theme/toolbar_groups.svg); mask-image: url(../theme/toolbar_groups.svg);
} }
#button_groups_toolbar_hide>.button_img { #button_groups_toolbar_hide>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_groups_hide.svg); -webkit-mask-image: url(../theme/toolbar_groups_hide.svg);
mask-image: url(../theme/toolbar_groups_hide.svg); mask-image: url(../theme/toolbar_groups_hide.svg);
} }
#button_new_group>.button_img { #button_new_group>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_plus_small.svg); -webkit-mask-image: url(../theme/toolbar_plus_small.svg);
mask-image: url(../theme/toolbar_plus_small.svg); mask-image: url(../theme/toolbar_plus_small.svg);
} }
#button_edit_group>.button_img { #button_edit_group>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_edit.svg); -webkit-mask-image: url(../theme/toolbar_edit.svg);
mask-image: url(../theme/toolbar_edit.svg); mask-image: url(../theme/toolbar_edit.svg);
} }
#button_remove_group>.button_img { #button_remove_group>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_trashcan.svg); -webkit-mask-image: url(../theme/toolbar_trashcan.svg);
mask-image: url(../theme/toolbar_trashcan.svg); mask-image: url(../theme/toolbar_trashcan.svg);
} }
#button_import_group>.button_img { #button_import_group>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_import.svg); -webkit-mask-image: url(../theme/toolbar_import.svg);
mask-image: url(../theme/toolbar_import.svg); mask-image: url(../theme/toolbar_import.svg);
} }
#button_load_bak1>.button_img { #button_load_bak1>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_load_bak1.svg); -webkit-mask-image: url(../theme/toolbar_load_bak1.svg);
mask-image: url(../theme/toolbar_load_bak1.svg); mask-image: url(../theme/toolbar_load_bak1.svg);
} }
#button_load_bak2>.button_img { #button_load_bak2>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_load_bak2.svg); -webkit-mask-image: url(../theme/toolbar_load_bak2.svg);
mask-image: url(../theme/toolbar_load_bak2.svg); mask-image: url(../theme/toolbar_load_bak2.svg);
} }
#button_load_bak3>.button_img { #button_load_bak3>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_load_bak3.svg); -webkit-mask-image: url(../theme/toolbar_load_bak3.svg);
mask-image: url(../theme/toolbar_load_bak3.svg); mask-image: url(../theme/toolbar_load_bak3.svg);
} }
#button_backup>.button_img { #button_backup>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_save.svg); -webkit-mask-image: url(../theme/toolbar_save.svg);
mask-image: url(../theme/toolbar_save.svg); mask-image: url(../theme/toolbar_save.svg);
} }
#button_export_bak>.button_img { #button_export_bak>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_save.svg); -webkit-mask-image: url(../theme/toolbar_save.svg);
mask-image: url(../theme/toolbar_save.svg); mask-image: url(../theme/toolbar_save.svg);
} }
#button_import_merge_bak>.button_img { #button_import_merge_bak>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_merge.svg); -webkit-mask-image: url(../theme/toolbar_merge.svg);
mask-image: url(../theme/toolbar_merge.svg); mask-image: url(../theme/toolbar_merge.svg);
} }
#button_import_bak>.button_img { #button_import_bak>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_import.svg); -webkit-mask-image: url(../theme/toolbar_import.svg);
mask-image: url(../theme/toolbar_import.svg); mask-image: url(../theme/toolbar_import.svg);
} }
#button_export_group>.button_img { #button_export_group>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_save.svg); -webkit-mask-image: url(../theme/toolbar_save.svg);
mask-image: url(../theme/toolbar_save.svg); mask-image: url(../theme/toolbar_save.svg);
} }
#button_folders>.button_img {
-webkit-mask-image: url(../theme/toolbar_folder.svg);
mask-image: url(../theme/toolbar_folder.svg);
}
#button_new_folder>.button_img {
-webkit-mask-image: url(../theme/toolbar_plus_small.svg);
mask-image: url(../theme/toolbar_plus_small.svg);
}
#button_edit_folder>.button_img {
-webkit-mask-image: url(../theme/toolbar_edit.svg);
mask-image: url(../theme/toolbar_edit.svg);
}
#button_remove_folder>.button_img {
-webkit-mask-image: url(../theme/toolbar_trashcan.svg);
mask-image: url(../theme/toolbar_trashcan.svg);
}
/* MAIN TOOLBAR SEARCHBOX */ /* MAIN TOOLBAR SEARCHBOX */
#button_filter_type.url>.button_img { #button_filter_type.url>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_filter_url.svg); -webkit-mask-image: url(../theme/toolbar_filter_url.svg);
mask-image: url(../theme/toolbar_filter_url.svg); mask-image: url(../theme/toolbar_filter_url.svg);
} }
#button_filter_type.title>.button_img { #button_filter_type.title>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_filter_title.svg); -webkit-mask-image: url(../theme/toolbar_filter_title.svg);
mask-image: url(../theme/toolbar_filter_title.svg); mask-image: url(../theme/toolbar_filter_title.svg);
} }
@ -255,14 +277,14 @@ div {
} }
#filter_search_go_prev>.button_img { #filter_search_go_prev>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_filter_search_go_prev.svg); -webkit-mask-image: url(../theme/toolbar_filter_search_go_prev.svg);
mask-image: url(../theme/toolbar_filter_search_go_prev.svg); mask-image: url(../theme/toolbar_filter_search_go_prev.svg);
width: 16px; width: 16px;
background-size: 16px 22px; background-size: 16px 22px;
} }
#filter_search_go_next>.button_img { #filter_search_go_next>.button_img {
-webkit-mask-box-image: url(../theme/toolbar_filter_search_go_next.svg); -webkit-mask-image: url(../theme/toolbar_filter_search_go_next.svg);
mask-image: url(../theme/toolbar_filter_search_go_next.svg); mask-image: url(../theme/toolbar_filter_search_go_next.svg);
width: 16px; width: 16px;
background-size: 16px 22px; background-size: 16px 22px;
@ -299,7 +321,7 @@ div {
#button_filter_clear { #button_filter_clear {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
-webkit-mask-box-image: url(../theme/toolbar_filter_clear.svg); -webkit-mask-image: url(../theme/toolbar_filter_clear.svg);
mask-image: url(../theme/toolbar_filter_clear.svg); mask-image: url(../theme/toolbar_filter_clear.svg);
top: 5.5px; top: 5.5px;
right: 4px; right: 4px;
@ -430,89 +452,88 @@ div {
/* GROUP EDIT DIALOG */ /* GROUP AND FOLDER EDIT DIALOG */
#group_edit { .edit_dialog {
z-index: 1000; z-index: 1000;
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
width: calc(100% - 28px); width: calc(100% - 28px);
height: 53px; height: 53px;
background-color: #efefef; background-color: var(--tabs_menu_background);
display: none; display: none;
word-wrap: normal; word-wrap: normal;
white-space: initial; white-space: initial;
font-family: Arial, Helvetica, "Nimbus Sans L", "Liberation Sans", FreeSans, Sans-serif; font-size: 12px; font-family: Arial, Helvetica, "Nimbus Sans L", "Liberation Sans", FreeSans, Sans-serif; font-size: 12px;
border: 1px solid #bebebe; border: 1px solid var(--tabs_menu_border);
padding: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;
background: #ffffff;
color: var(--tabs_menu_font); color: var(--tabs_menu_font);
} }
#group_edit_font, .edit_dialog_confirm,
#group_edit_name, .edit_dialog_discard {
#group_edit_confirm,
#group_edit_discard {
position: absolute; position: absolute;
} }
#group_edit_font { .edit_dialog_confirm,
display: inline-block; .edit_dialog_discard {
top: 5px;
width: 19px; height: 19px;
border: 1px solid #bebebe;
background-color: #000000;
color: var(--tabs_menu_font);
}
#group_edit_font {
right: 5px;
}
#group_edit_name {
display: inline-block;
vertical-align: top;
top: 5px; left: 5px; width: calc(100% - 37px);
}
#group_edit_confirm,
#group_edit_discard {
line-height: 17px; line-height: 17px;
font-family: Arial, Helvetica, "Nimbus Sans L", "Liberation Sans", FreeSans, Sans-serif; font-family: Arial, Helvetica, "Nimbus Sans L", "Liberation Sans", FreeSans, Sans-serif;
font-size: 11px; font-size: 11px;
color: #000000;
text-overflow: ellipsis; text-overflow: ellipsis;
background: transparent; background: transparent;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
overflow: hidden; overflow: hidden;
display: inline-block; display: inline-block;
top: 30px; top: 30px;
width: calc(50% - 8px); height: 17px; width: calc(50% - 8px); height: 17px;
border: 1px solid #bebebe; border: 1px solid var(--tabs_menu_border);
color: var(--tabs_menu_font);
} }
#group_edit_confirm { .edit_dialog_confirm {
left: 5px; left: 5px;
} }
#group_edit_discard { .edit_dialog_discard {
left: calc(50% + 1px); left: calc(50% + 1px);
} }
.edit_dialog_confirm:hover,
.edit_dialog_discard:hover {
border: 1px solid var(--tabs_menu_hover_border);
background-color: var(--tabs_menu_hover_background);
}
.edit_dialog_edit_name {
position: absolute;
display: inline-block;
vertical-align: top;
top: 4px; left: 5px;
width: calc(100% - 38px); height: 19px;
background-color: var(--filter_box_background);
border: solid 1px var(--filter_box_border);
color: var(--filter_box_font);
}
.edit_dialog_edit_name:focus {
outline: none;
}
#folder_edit_name {
width: calc(100% - 14px);
}
#group_edit_font {
position: absolute;
display: inline-block;
top: 5px;
right: 5px;
width: 19px; height: 19px;
border: 1px solid var(--tabs_menu_border);
background-color: #000000;
color: var(--tabs_menu_font);
}
#group_edit_font:hover { #group_edit_font:hover {
opacity: 0.8; opacity: 0.8;
} }
#group_edit_confirm:hover,
#group_edit_discard:hover {
background-color: #dcdcdc;
}
@ -541,61 +562,61 @@ div {
font-weight:var(--tab_hover_title_font_weight); font-weight:var(--tab_hover_title_font_weight);
} }
/* normal selected */ /* normal selected */
.selected>.tab_header{ .selected_tab>.tab_header{
border:1px solid var(--tab_selected_border); border:1px solid var(--tab_selected_border);
background-color:var(--tab_selected_background); background-color:var(--tab_selected_background);
} }
.tab.selected>.tab_header>.tab_title{ .tab.selected_tab>.tab_header>.tab_title{
color:var(--tab_selected_title_font_color); color:var(--tab_selected_title_font_color);
font-style:var(--tab_selected_title_font_style); font-style:var(--tab_selected_title_font_style);
font-weight:var(--tab_selected_title_font_weight); font-weight:var(--tab_selected_title_font_weight);
} }
/* normal selected hover */ /* normal selected hover */
.selected>.tab_header_hover{ .selected_tab>.tab_header_hover{
border:1px solid var(--tab_selected_hover_border); border:1px solid var(--tab_selected_hover_border);
background-color:var(--tab_selected_hover_background); background-color:var(--tab_selected_hover_background);
} }
.tab.selected>.tab_header_hover>.tab_title{ .tab.selected_tab>.tab_header_hover>.tab_title{
color:var(--tab_selected_hover_title_font_color); color:var(--tab_selected_hover_title_font_color);
font-style:var(--tab_selected_hover_title_font_style); font-style:var(--tab_selected_hover_title_font_style);
font-weight:var(--tab_selected_hover_title_font_weight); font-weight:var(--tab_selected_hover_title_font_weight);
} }
/* normal active */ /* normal active */
.active>.tab_header{ .active_tab>.tab_header{
border:1px solid var(--tab_active_border); border:1px solid var(--tab_active_border);
background-color:var(--tab_active_background); background-color:var(--tab_active_background);
} }
.tab.active>.tab_header>.tab_title{ .tab.active_tab>.tab_header>.tab_title{
color:var(--tab_active_title_font_color); color:var(--tab_active_title_font_color);
font-style:var(--tab_active_title_font_style); font-style:var(--tab_active_title_font_style);
font-weight:var(--tab_active_title_font_weight); font-weight:var(--tab_active_title_font_weight);
} }
/* normal active hover */ /* normal active hover */
.active>.tab_header_hover{ .active_tab>.tab_header_hover{
border:1px solid var(--tab_active_hover_border); border:1px solid var(--tab_active_hover_border);
background-color:var(--tab_active_hover_background); background-color:var(--tab_active_hover_background);
} }
.tab.active>.tab_header_hover>.tab_title{ .tab.active_tab>.tab_header_hover>.tab_title{
color:var(--tab_active_hover_title_font_color); color:var(--tab_active_hover_title_font_color);
font-style:var(--tab_active_hover_title_font_style); font-style:var(--tab_active_hover_title_font_style);
font-weight:var(--tab_active_hover_title_font_weight); font-weight:var(--tab_active_hover_title_font_weight);
} }
/* normal selected active */ /* normal selected active */
.selected.active>.tab_header{ .selected_tab.active_tab>.tab_header{
border:1px solid var(--tab_active_selected_border); border:1px solid var(--tab_active_selected_border);
background-color:var(--tab_active_selected_background); background-color:var(--tab_active_selected_background);
} }
.tab.selected.active>.tab_header>.tab_title{ .tab.selected_tab.active_tab>.tab_header>.tab_title{
color:var(--tab_active_selected_title_font_color); color:var(--tab_active_selected_title_font_color);
font-style:var(--tab_active_selected_title_font_style); font-style:var(--tab_active_selected_title_font_style);
font-weight:var(--tab_active_selected_title_font_weight); font-weight:var(--tab_active_selected_title_font_weight);
} }
/* normal selected active hover */ /* normal selected active hover */
.selected.active>.tab_header_hover{ .selected_tab.active_tab>.tab_header_hover{
border:1px solid var(--tab_selected_active_hover_border); border:1px solid var(--tab_selected_active_hover_border);
background-color:var(--tab_selected_active_hover_background); background-color:var(--tab_selected_active_hover_background);
} }
.tab.selected.active>.tab_header_hover>.tab_title{ .tab.selected_tab.active_tab>.tab_header_hover>.tab_title{
color:var(--tab_selected_active_hover_title_font_color); color:var(--tab_selected_active_hover_title_font_color);
font-style:var(--tab_selected_active_hover_title_font_style); font-style:var(--tab_selected_active_hover_title_font_style);
font-weight:var(--tab_selected_active_hover_title_font_weight); font-weight:var(--tab_selected_active_hover_title_font_weight);
@ -621,21 +642,21 @@ div {
font-weight:var(--tab_discarded_hover_title_font_weight); font-weight:var(--tab_discarded_hover_title_font_weight);
} }
/* unloaded selected */ /* unloaded selected */
.selected.discarded>.tab_header{ .selected_tab.discarded>.tab_header{
border:1px solid var(--tab_selected_discarded_border); border:1px solid var(--tab_selected_discarded_border);
background-color:var(--tab_selected_discarded_background); background-color:var(--tab_selected_discarded_background);
} }
.tab.selected.discarded>.tab_header>.tab_title{ .tab.selected_tab.discarded>.tab_header>.tab_title{
color:var(--tab_selected_discarded_title_font_color); color:var(--tab_selected_discarded_title_font_color);
font-style:var(--tab_selected_discarded_title_font_style); font-style:var(--tab_selected_discarded_title_font_style);
font-weight:var(--tab_selected_discarded_title_font_weight); font-weight:var(--tab_selected_discarded_title_font_weight);
} }
/* unloaded selected hover */ /* unloaded selected hover */
.selected.discarded>.tab_header_hover{ .selected_tab.discarded>.tab_header_hover{
border:1px solid var(--tab_selected_discarded_hover_border); border:1px solid var(--tab_selected_discarded_hover_border);
background-color:var(--tab_selected_discarded_hover_background); background-color:var(--tab_selected_discarded_hover_background);
} }
.tab.selected.discarded>.tab_header_hover>.tab_title{ .tab.selected_tab.discarded>.tab_header_hover>.tab_title{
color:var(--tab_selected_discarded_hover_title_font_color); color:var(--tab_selected_discarded_hover_title_font_color);
font-style:var(--tab_selected_discarded_hover_title_font_style); font-style:var(--tab_selected_discarded_hover_title_font_style);
font-weight:var(--tab_selected_discarded_hover_title_font_weight); font-weight:var(--tab_selected_discarded_hover_title_font_weight);
@ -661,61 +682,61 @@ div {
font-weight:var(--tab_filtered_hover_title_font_weight); font-weight:var(--tab_filtered_hover_title_font_weight);
} }
/* search result active */ /* search result active */
.filtered.active>.tab_header{ .filtered.active_tab>.tab_header{
border:1px solid var(--tab_filtered_active_border); border:1px solid var(--tab_filtered_active_border);
background-color:var(--tab_filtered_active_background); background-color:var(--tab_filtered_active_background);
} }
.tab.filtered.active>.tab_header>.tab_title{ .tab.filtered.active_tab>.tab_header>.tab_title{
color:var(--tab_filtered_active_title_font_color); color:var(--tab_filtered_active_title_font_color);
font-style:var(--tab_filtered_active_title_font_style); font-style:var(--tab_filtered_active_title_font_style);
font-weight:var(--tab_filtered_active_title_font_weight); font-weight:var(--tab_filtered_active_title_font_weight);
} }
/* search result active hover */ /* search result active hover */
.filtered.active>.tab_header_hover{ .filtered.active_tab>.tab_header_hover{
border:1px solid var(--tab_filtered_active_hover_border); border:1px solid var(--tab_filtered_active_hover_border);
background-color:var(--tab_filtered_active_hover_background); background-color:var(--tab_filtered_active_hover_background);
} }
.tab.filtered.active>.tab_header_hover>.tab_title{ .tab.filtered.active_tab>.tab_header_hover>.tab_title{
color:var(--tab_filtered_active_hover_title_font_color); color:var(--tab_filtered_active_hover_title_font_color);
font-style:var(--tab_filtered_active_hover_title_font_style); font-style:var(--tab_filtered_active_hover_title_font_style);
font-weight:var(--tab_filtered_active_hover_title_font_weight); font-weight:var(--tab_filtered_active_hover_title_font_weight);
} }
/* search result selected */ /* search result selected */
.selected.filtered>.tab_header{ .selected_tab.filtered>.tab_header{
border:1px solid var(--tab_filtered_selected_border); border:1px solid var(--tab_filtered_selected_border);
background-color:var(--tab_filtered_selected_background); background-color:var(--tab_filtered_selected_background);
} }
.tab.selected.filtered>.tab_header>.tab_title{ .tab.selected_tab.filtered>.tab_header>.tab_title{
color:var(--tab_filtered_selected_title_font_color); color:var(--tab_filtered_selected_title_font_color);
font-style:var(--tab_filtered_selected_title_font_style); font-style:var(--tab_filtered_selected_title_font_style);
font-weight:var(--tab_filtered_selected_title_font_weight); font-weight:var(--tab_filtered_selected_title_font_weight);
} }
/* search result selected hover */ /* search result selected hover */
.selected.filtered>.tab_header_hover{ .selected_tab.filtered>.tab_header_hover{
border:1px solid var(--tab_filtered_selected_hover_border); border:1px solid var(--tab_filtered_selected_hover_border);
background-color:var(--tab_filtered_selected_hover_background); background-color:var(--tab_filtered_selected_hover_background);
} }
.tab.selected.filtered>.tab_header_hover>.tab_title{ .tab.selected_tab.filtered>.tab_header_hover>.tab_title{
color:var(--tab_filtered_selected_hover_title_font_color); color:var(--tab_filtered_selected_hover_title_font_color);
font-style:var(--tab_filtered_selected_hover_title_font_style); font-style:var(--tab_filtered_selected_hover_title_font_style);
font-weight:var(--tab_filtered_selected_hover_title_font_weight); font-weight:var(--tab_filtered_selected_hover_title_font_weight);
} }
/* search result active selected */ /* search result active selected */
.selected.filtered.active>.tab_header{ .selected_tab.filtered.active_tab>.tab_header{
border:1px solid var(--tab_filtered_selected_active_border); border:1px solid var(--tab_filtered_selected_active_border);
background-color:var(--tab_filtered_selected_active_background); background-color:var(--tab_filtered_selected_active_background);
} }
.tab.selected.filtered.active>.tab_header>.tab_title{ .tab.selected_tab.filtered.active_tab>.tab_header>.tab_title{
color:var(--tab_filtered_selected_active_title_font_color); color:var(--tab_filtered_selected_active_title_font_color);
font-style:var(--tab_filtered_selected_active_title_font_style); font-style:var(--tab_filtered_selected_active_title_font_style);
font-weight:var(--tab_filtered_selected_active_title_font_weight); font-weight:var(--tab_filtered_selected_active_title_font_weight);
} }
/* search result active selected hover */ /* search result active selected hover */
.selected.filtered.active>.tab_header_hover{ .selected_tab.filtered.active_tab>.tab_header_hover{
border:1px solid var(--tab_filtered_selected_active_hover_border); border:1px solid var(--tab_filtered_selected_active_hover_border);
background-color:var(--tab_filtered_selected_active_hover_background); background-color:var(--tab_filtered_selected_active_hover_background);
} }
.tab.filtered.selected.active>.tab_header_hover>.tab_title{ .tab.filtered.selected_tab.active_tab>.tab_header_hover>.tab_title{
color:var(--tab_filtered_selected_active_hover_title_font_color); color:var(--tab_filtered_selected_active_hover_title_font_color);
font-style:var(--tab_filtered_selected_active_hover_title_font_style); font-style:var(--tab_filtered_selected_active_hover_title_font_style);
font-weight:var(--tab_filtered_selected_active_hover_title_font_weight); font-weight:var(--tab_filtered_selected_active_hover_title_font_weight);
@ -741,61 +762,61 @@ div {
font-weight:var(--tab_filtered_highlighted_search_hover_title_font_weight); font-weight:var(--tab_filtered_highlighted_search_hover_title_font_weight);
} }
/* search result active highlighted */ /* search result active highlighted */
.active.filtered.highlighted_search>.tab_header{ .active_tab.filtered.highlighted_search>.tab_header{
border:1px solid var(--tab_filtered_active_highlighted_search_border); border:1px solid var(--tab_filtered_active_highlighted_search_border);
background-color:var(--tab_filtered_active_highlighted_search_background); background-color:var(--tab_filtered_active_highlighted_search_background);
} }
.tab.active.filtered.highlighted_search>.tab_header>.tab_title{ .tab.active_tab.filtered.highlighted_search>.tab_header>.tab_title{
color:var(--tab_filtered_active_highlighted_search_title_font_color); color:var(--tab_filtered_active_highlighted_search_title_font_color);
font-style:var(--tab_filtered_active_highlighted_search_title_font_style); font-style:var(--tab_filtered_active_highlighted_search_title_font_style);
font-weight:var(--tab_filtered_active_highlighted_search_title_font_weight); font-weight:var(--tab_filtered_active_highlighted_search_title_font_weight);
} }
/* search result active highlighted hover */ /* search result active highlighted hover */
.active.filtered.highlighted_search>.tab_header_hover{ .active_tab.filtered.highlighted_search>.tab_header_hover{
border:1px solid var(--tab_filtered_active_highlighted_search_hover_border); border:1px solid var(--tab_filtered_active_highlighted_search_hover_border);
background-color:var(--tab_filtered_active_highlighted_search_hover_background); background-color:var(--tab_filtered_active_highlighted_search_hover_background);
} }
.tab.active.filtered.highlighted_search>.tab_header_hover>.tab_title{ .tab.active_tab.filtered.highlighted_search>.tab_header_hover>.tab_title{
color:var(--tab_filtered_active_highlighted_search_hover_title_font_color); color:var(--tab_filtered_active_highlighted_search_hover_title_font_color);
font-style:var(--tab_filtered_active_highlighted_search_hover_title_font_style); font-style:var(--tab_filtered_active_highlighted_search_hover_title_font_style);
font-weight:var(--tab_filtered_active_highlighted_search_hover_title_font_weight); font-weight:var(--tab_filtered_active_highlighted_search_hover_title_font_weight);
} }
/* search result selected highlighted */ /* search result selected highlighted */
.selected.filtered.highlighted_search>.tab_header{ .selected_tab.filtered.highlighted_search>.tab_header{
border:1px solid var(--tab_filtered_selected_highlighted_search_border); border:1px solid var(--tab_filtered_selected_highlighted_search_border);
background-color:var(--tab_filtered_selected_highlighted_search_background); background-color:var(--tab_filtered_selected_highlighted_search_background);
} }
.tab.selected.filtered.highlighted_search>.tab_header>.tab_title{ .tab.selected_tab.filtered.highlighted_search>.tab_header>.tab_title{
color:var(--tab_filtered_selected_highlighted_search_title_font_color); color:var(--tab_filtered_selected_highlighted_search_title_font_color);
font-style:var(--tab_filtered_selected_highlighted_search_title_font_style); font-style:var(--tab_filtered_selected_highlighted_search_title_font_style);
font-weight:var(--tab_filtered_selected_highlighted_search_title_font_weight); font-weight:var(--tab_filtered_selected_highlighted_search_title_font_weight);
} }
/* search result selected highlighted hover */ /* search result selected highlighted hover */
.selected.filtered.highlighted_search>.tab_header_hover{ .selected_tab.filtered.highlighted_search>.tab_header_hover{
border:1px solid var(--tab_filtered_selected_highlighted_search_hover_border); border:1px solid var(--tab_filtered_selected_highlighted_search_hover_border);
background-color:var(--tab_filtered_selected_highlighted_search_hover_background); background-color:var(--tab_filtered_selected_highlighted_search_hover_background);
} }
.tab.selected.filtered.highlighted_search>.tab_header_hover>.tab_title{ .tab.selected_tab.filtered.highlighted_search>.tab_header_hover>.tab_title{
color:var(--tab_filtered_selected_highlighted_search_hover_title_font_color); color:var(--tab_filtered_selected_highlighted_search_hover_title_font_color);
font-style:var(--tab_filtered_selected_highlighted_search_hover_title_font_style); font-style:var(--tab_filtered_selected_highlighted_search_hover_title_font_style);
font-weight:var(--tab_filtered_selected_highlighted_search_hover_title_font_weight); font-weight:var(--tab_filtered_selected_highlighted_search_hover_title_font_weight);
} }
/* search result selected active highlighted */ /* search result selected active highlighted */
.active.selected.filtered.highlighted_search>.tab_header{ .active_tab.selected_tab.filtered.highlighted_search>.tab_header{
border:1px solid var(--tab_filtered_selected_active_highlighted_search_border); border:1px solid var(--tab_filtered_selected_active_highlighted_search_border);
background-color:var(--tab_filtered_selected_active_highlighted_search_background); background-color:var(--tab_filtered_selected_active_highlighted_search_background);
} }
.tab.active.selected.filtered.highlighted_search>.tab_header>.tab_title{ .tab.active_tab.selected_tab.filtered.highlighted_search>.tab_header>.tab_title{
color:var(--tab_filtered_selected_active_highlighted_search_title_font_color); color:var(--tab_filtered_selected_active_highlighted_search_title_font_color);
font-style:var(--tab_filtered_selected_active_highlighted_search_title_font_style); font-style:var(--tab_filtered_selected_active_highlighted_search_title_font_style);
font-weight:var(--tab_filtered_selected_active_highlighted_search_title_font_weight); font-weight:var(--tab_filtered_selected_active_highlighted_search_title_font_weight);
} }
/* search result selected active highlighted hover */ /* search result selected active highlighted hover */
.active.selected.filtered.highlighted_search>.tab_header_hover{ .active_tab.selected_tab.filtered.highlighted_search>.tab_header_hover{
border:1px solid var(--tab_filtered_selected_active_highlighted_search_hover_border); border:1px solid var(--tab_filtered_selected_active_highlighted_search_hover_border);
background-color:var(--tab_filtered_selected_active_highlighted_search_hover_background); background-color:var(--tab_filtered_selected_active_highlighted_search_hover_background);
} }
.tab.active.selected.filtered.highlighted_search>.tab_header_hover>.tab_title{ .tab.active_tab.selected_tab.filtered.highlighted_search>.tab_header_hover>.tab_title{
color:var(--tab_filtered_selected_active_highlighted_search_hover_title_font_color); color:var(--tab_filtered_selected_active_highlighted_search_hover_title_font_color);
font-style:var(--tab_filtered_selected_active_highlighted_search_hover_title_font_style); font-style:var(--tab_filtered_selected_active_highlighted_search_hover_title_font_style);
font-weight:var(--tab_filtered_selected_active_highlighted_search_hover_title_font_weight); font-weight:var(--tab_filtered_selected_active_highlighted_search_hover_title_font_weight);
@ -844,8 +865,8 @@ div {
height: var(--tab_height); height: var(--tab_height);
line-height: var(--tab_height_line); line-height: var(--tab_height_line);
width: calc(100% - 4px); width: calc(100% - 4px);
background-image: url(../theme/empty.svg); background-image: url(../theme/icon_empty.svg);
background-size: var(--favicon_size); background-size: var(--favicon_width) var(--favicon_height);
background-position: var(--favicon_left), center; background-position: var(--favicon_left), center;
} }
@ -853,8 +874,8 @@ div {
/* DRAG AND DROP TARGETS */ /* DRAG AND DROP TARGETS */
.drop_target { .drop_target {
display: none;
position: absolute; position: absolute;
pointer-events: none;
} }
.tab>.drag_enter_center { .tab>.drag_enter_center {
@ -919,28 +940,24 @@ div {
/* TABS WITH CHILDREN, OPEN AND CLOSED */ /* TABS WITH CHILDREN, OPEN AND CLOSED */
.tab.c>.tab_header,
.tab.o>.tab_header {
background-position: calc(var(--favicon_left) + 8px), center;
}
.tab.c>.tab_header>.tab_title,
.tab.o>.tab_header>.tab_title {
padding-left: calc(var(--tab_title_text_padding_left) + 8px);
}
.expand { .expand {
z-index: 200; z-index: 200;
position: absolute; position: absolute;
top: calc(var(--tab_height)/2 - 8px); top: 0px;
left: 0px; left: 0px;
width: 24px; height: var(--expand_height);
height: 16px; width: var(--expand_width);
-webkit-mask-position: var(--expand_mask_left) var(--expand_mask_top);
-webkit-mask-size: var(--expand_mask_width) var(--expand_mask_height);
mask-size: var(--expand_mask_width) var(--expand_mask_height);
mask-position: var(--expand_mask_left) var(--expand_mask_top);
} }
/* CHILDREN TABS */ /* CHILDREN TABS */
.tab>.children { .tab>.children {
position: relative; position: relative;
padding-left: var(--children_padding_left); padding-left: var(--children_padding_left);
/* padding-left: 4%; */
} }
.tab.o>.children { .tab.o>.children {
@ -958,25 +975,29 @@ div {
} }
.tab.c>.tab_header>.expand { .tab.c>.tab_header>.expand {
background-size: 24px 16px;
background-position: 0px center;
background-color: var(--expand_closed_background); background-color: var(--expand_closed_background);
-webkit-mask-box-image: url(../theme/expand_closed.svg);
mask-image: url(../theme/expand_closed.svg); mask-image: url(../theme/expand_closed.svg);
-webkit-mask-image: url(../theme/expand_c.svg);
} }
.tab.o>.tab_header>.expand { .tab.o>.tab_header>.expand {
background-size: 24px 16px;
background-position: 0px center;
background-color: var(--expand_open_background); background-color: var(--expand_open_background);
-webkit-mask-box-image: url(../theme/expand_open.svg);
mask-image: url(../theme/expand_open.svg); mask-image: url(../theme/expand_open.svg);
-webkit-mask-image: url(../theme/expand_o.svg);
}
.o.tab>.tab_header>.tab_title,
.c.tab>.tab_header>.tab_title {
padding-left: var(--tab_title_text_padding_exp_left);
} }
/* FOLDERS */ /* FOLDERS */
/* .group>.children_folders{
background-color: var(--folder_list_background);
} */
.folder_title { .folder_title {
z-index: 5; z-index: 5;
font-family: Arial, Helvetica, "Nimbus Sans L", "Liberation Sans", FreeSans, Sans-serif; font-family: Arial, Helvetica, "Nimbus Sans L", "Liberation Sans", FreeSans, Sans-serif;
@ -1009,13 +1030,10 @@ div {
height: var(--tab_height); height: var(--tab_height);
line-height: var(--tab_height_line); line-height: var(--tab_height_line);
width: calc(100% - 4px); width: calc(100% - 4px);
border-radius:var(--tab_header_border_radius);
border:1px solid var(--tab_border);
background-color:var(--tab_background);
} }
/* .drop_target {
display: none;
position: absolute;
} */
.folder>.drag_enter_center { .folder>.drag_enter_center {
border-radius: var(--tab_header_border_radius); border-radius: var(--tab_header_border_radius);
z-index: 11; z-index: 11;
@ -1084,41 +1102,74 @@ div {
.folder.o>.folder_header { .folder.o>.folder_header {
background-position: calc(var(--favicon_left) + 8px), center; background-position: calc(var(--favicon_left) + 8px), center;
} }
.folder.c>.folder_header>.folder_title,
.folder.o>.folder_header>.folder_title {
padding-left: calc(var(--tab_title_text_padding_left) + 8px);
}
.folder_icon { .folder_icon {
z-index: 200; z-index: 200;
position: absolute; position: absolute;
top: calc(var(--tab_height)/2 - 8px); top: calc(var(--tab_height)/2 - var(--favicon_height)/2);
left: var(--favicon_left); left: var(--favicon_left);
width: 16px; width: var(--favicon_width);
height: 16px; height: var(--favicon_height);
background-size: 16px 16px; mask-size: var(--favicon_width) var(--favicon_height);
background-position: 0px center; mask-position: 0px 0px;
-webkit-mask-size: var(--favicon_width) var(--favicon_height);
-webkit-mask-position: 0px 0px;
} }
.folder.c>.folder_header>.folder_icon.hover, .folder.c>.folder_header>.folder_icon:hover,
.folder.o>.folder_header>.folder_icon.hover { .folder.o>.folder_header>.folder_icon:hover {
background-color: var(--expand_hover_background); background-color: var(--expand_hover_background);
} }
.folder>.folder_header>.folder_icon,
.folder.n>.folder_header>.folder_icon, .folder.n>.folder_header>.folder_icon,
.folder.c>.folder_header>.folder_icon { .folder.c>.folder_header>.folder_icon {
/* background-color: #b2b2b2; */
background-color: var(--expand_closed_background); background-color: var(--expand_closed_background);
-webkit-mask-box-image: url(../theme/folder_closed.svg); -webkit-mask-image: url(../theme/icon_folder_closed.svg);
mask-image: url(../theme/folder_closed.svg); mask-image: url(../theme/icon_folder_closed.svg);
} }
.folder.o>.folder_header>.folder_icon { .folder.o>.folder_header>.folder_icon {
background-color: var(--expand_open_background); background-color: var(--expand_open_background);
-webkit-mask-box-image: url(../theme/folder_open.svg); -webkit-mask-image: url(../theme/icon_folder_open.svg);
mask-image: url(../theme/folder_open.svg); mask-image: url(../theme/icon_folder_open.svg);
}
/* normal hover */
.folder>.folder_header_hover{
border-radius:var(--tab_header_border_radius);
border:1px solid var(--tab_hover_border);
background-color:var(--tab_hover_background);
}
/* normal selected */
.selected_folder>.folder_header{
border:1px solid var(--tab_selected_border);
background-color:var(--tab_selected_background);
}
.selected_folder>.folder_header>.folder_title{
color:var(--tab_selected_title_font_color);
font-style:var(--tab_selected_title_font_style);
font-weight:var(--tab_selected_title_font_weight);
}
/* normal selected hover */
.selected_folder>.folder_header_hover{
border:1px solid var(--tab_selected_hover_border);
background-color:var(--tab_selected_hover_background);
}
.selected_folder>.folder_header_hover>.folder_title{
color:var(--tab_selected_hover_title_font_color);
font-style:var(--tab_selected_hover_title_font_style);
font-weight:var(--tab_selected_hover_title_font_weight);
} }
.children_folders>:last-child {
margin-bottom: 1px;
}
/* PINS */ /* PINS */
@ -1152,8 +1203,8 @@ div {
.pin>.tab_header { .pin>.tab_header {
height: calc(100% - 3px); height: calc(100% - 3px);
width: calc(100% - 3px); width: calc(100% - 3px);
background-image: url(../theme/empty.svg); background-image: url(../theme/icon_empty.svg);
background-size: var(--favicon_size); background-size: var(--favicon_width) var(--favicon_height);
background-position: center, center; background-position: center, center;
} }
@ -1198,34 +1249,41 @@ div {
/* MEDIA */ /* MEDIA */
.tab.c>.tab_header>.tab_mediaicon, /* .tab.c>.tab_header>.tab_mediaicon,
.tab.o>.tab_header>.tab_mediaicon { .tab.o>.tab_header>.tab_mediaicon {
left: calc(var(--pin_width) - 4px); left: calc(var(--pin_width) - 4px);
} } */
.tab_mediaicon { .tab_mediaicon {
position: absolute; position: absolute;
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
z-index: 999; z-index: 999;
bottom: 2px; bottom: 2px;
left: calc(var(--pin_width) - 12px); left: var(--tab_mediaicon_left);
bottom: var(--tab_mediaicon_bottom);
height: 0px; height: 0px;
width: 0px; width: 0px;
background-size: 0px 0px; background-size: 0px 0px;
} }
.audible>.tab_header>.tab_mediaicon { .audible>.tab_header>.tab_mediaicon {
height: 10px; height: var(--tab_mediaicon_height);
width: 10px; width: var(--tab_mediaicon_width);
background-image: url(../theme/media.gif); background-image: url(../theme/icon_audio.svg);
background-size: 10px 10px; background-size: var(--tab_mediaicon_width) var(--tab_mediaicon_height);
}
.audible>.tab_header>.tab_mediaicon:hover {
background-image: url(../theme/icon_audio_hover.svg);
} }
.muted>.tab_header>.tab_mediaicon { .muted>.tab_header>.tab_mediaicon {
height: 10px; height: var(--tab_mediaicon_height);
width: 10px; width: var(--tab_mediaicon_width);
background-image: url(../theme/media_muted.gif); background-image: url(../theme/icon_audio_muted.svg);
background-size: 10px 10px; background-size: var(--tab_mediaicon_width) var(--tab_mediaicon_height);
}
.muted>.tab_header>.tab_mediaicon:hover {
background-image: url(../theme/icon_audio_muted_hover.svg);
} }
@ -1258,7 +1316,7 @@ div {
height: 100%; height: 100%;
width: 100%; width: 100%;
background-color: var(--close_x); background-color: var(--close_x);
-webkit-mask-box-image: url(../theme/close.svg); -webkit-mask-image: url(../theme/close.svg);
mask-image: url(../theme/close.svg); mask-image: url(../theme/close.svg);
mask-size: 100%; mask-size: 100%;
mask-position: center, center; mask-position: center, center;
@ -1290,7 +1348,7 @@ div {
/* MENU */ /* MENU */
#tabs_menu { .menu {
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
display: none; display: none;
@ -1305,18 +1363,18 @@ div {
color: var(--tabs_menu_font); color: var(--tabs_menu_font);
} }
#tabs_menu li { .menu li {
padding: 3px 8px; padding: 3px 8px;
border: 1px solid var(--tabs_menu_background); border: 1px solid var(--tabs_menu_background);
list-style-type: none; list-style-type: none;
} }
#tabs_menu li:hover { .menu li:hover {
border: 1px solid var(--tabs_menu_hover_border); border: 1px solid var(--tabs_menu_hover_border);
background-color: var(--tabs_menu_hover_background); background-color: var(--tabs_menu_hover_background);
} }
#tabs_menu .separator { .menu .separator {
height: 1px; height: 1px;
width: 80%; width: 80%;
background-color: var(--tabs_menu_separator); background-color: var(--tabs_menu_separator);

View File

@ -247,6 +247,8 @@ body {
--tab_filtered_selected_active_highlighted_search_hover_title_font_style: italic; --tab_filtered_selected_active_highlighted_search_hover_title_font_style: italic;
--tab_filtered_selected_active_highlighted_search_hover_title_font_weight: bold; --tab_filtered_selected_active_highlighted_search_hover_title_font_weight: bold;
/* folders */
/* --folder_list_background: #fafafa; */
--expand_hover_background: #ffa500; --expand_hover_background: #ffa500;

View File

@ -12,12 +12,21 @@ body {
--title_font_size: 10.5px; --title_font_size: 10.5px;
--tab_title_text_padding_left: 19px; --tab_title_text_padding_left: 18px;
--tab_title_text_padding_exp_left: 25px;
--tab_title_text_padding_right_with_close_button: 20px; --tab_title_text_padding_right_with_close_button: 20px;
--favicon_size: 13px 13px; --favicon_width: 13px;
--favicon_left: 4px; --favicon_height: 13px;
--favicon_left: 1px;
--expand_height: 15px;
--expand_width: 26px;
--expand_mask_top: 6px;
--expand_mask_left: 18px;
--expand_mask_height: 4px;
--expand_mask_width: 4px;
--drag_area_top: 6px; --drag_area_top: 6px;
--drag_area_bottom: 4px; --drag_area_bottom: 4px;
@ -27,4 +36,9 @@ body {
--close_right: 1px; --close_right: 1px;
--close_height: 11px; --close_height: 11px;
--close_width: 11px; --close_width: 11px;
--tab_mediaicon_height: 8px;
--tab_mediaicon_width: 8px;
--tab_mediaicon_left: 1px;
--tab_mediaicon_bottom: 1px;
} }

View File

@ -12,12 +12,21 @@ body {
--title_font_size: 10.5px; --title_font_size: 10.5px;
--tab_title_text_padding_left: 23px; --tab_title_text_padding_left: 21px;
--tab_title_text_padding_exp_left: 30px;
--tab_title_text_padding_right_with_close_button: 20px; --tab_title_text_padding_right_with_close_button: 20px;
--favicon_size: 14px 14px; --favicon_width: 15px;
--favicon_left: 5px; --favicon_height: 15px;
--favicon_left: 1px;
--expand_height: 17px;
--expand_width: 30px;
--expand_mask_top: 7px;
--expand_mask_left: 21px;
--expand_mask_height: 5px;
--expand_mask_width: 5px;
--drag_area_top: 6px; --drag_area_top: 6px;
--drag_area_bottom: 4px; --drag_area_bottom: 4px;
@ -27,4 +36,9 @@ body {
--close_right: 2px; --close_right: 2px;
--close_height: 11px; --close_height: 11px;
--close_width: 11px; --close_width: 11px;
--tab_mediaicon_height: 11px;
--tab_mediaicon_width: 11px;
--tab_mediaicon_left: 1px;
--tab_mediaicon_bottom: 1px;
} }

View File

@ -13,11 +13,20 @@ body {
--title_font_size: 12px; --title_font_size: 12px;
--tab_title_text_padding_left: 26px; --tab_title_text_padding_left: 26px;
--tab_title_text_padding_exp_left: 35px;
--tab_title_text_padding_right_with_close_button: 19px; --tab_title_text_padding_right_with_close_button: 19px;
--favicon_size: 16px 16px; --favicon_width: 17px;
--favicon_left: 5px; --favicon_height: 17px;
--favicon_left: 1px;
--expand_height: 19px;
--expand_width: 36px;
--expand_mask_top: 7px;
--expand_mask_left: 24px;
--expand_mask_height: 6px;
--expand_mask_width: 6px;
--drag_area_top: 7px; --drag_area_top: 7px;
--drag_area_bottom: 5px; --drag_area_bottom: 5px;
@ -27,4 +36,9 @@ body {
--close_right: 2px; --close_right: 2px;
--close_height: 13px; --close_height: 13px;
--close_width: 13px; --close_width: 13px;
--tab_mediaicon_height: 11px;
--tab_mediaicon_width: 11px;
--tab_mediaicon_left: 1px;
--tab_mediaicon_bottom: 1px;
} }

View File

@ -12,12 +12,21 @@ body {
--title_font_size: 12px; --title_font_size: 12px;
--tab_title_text_padding_left: 26px; --tab_title_text_padding_left: 25px;
--tab_title_text_padding_exp_left: 37px;
--tab_title_text_padding_right_with_close_button: 24px; --tab_title_text_padding_right_with_close_button: 24px;
--favicon_size: 16px 16px; --favicon_width: 17px;
--favicon_left: 6px; --favicon_height: 17px;
--favicon_left: 2px;
--expand_height: 21px;
--expand_width: 38px;
--expand_mask_top: 8px;
--expand_mask_left: 25px;
--expand_mask_height: 7px;
--expand_mask_width: 7px;
--drag_area_top: 8px; --drag_area_top: 8px;
--drag_area_bottom: 5px; --drag_area_bottom: 5px;
@ -27,4 +36,9 @@ body {
--close_right: 3px; --close_right: 3px;
--close_height: 13px; --close_height: 13px;
--close_width: 13px; --close_width: 13px;
--tab_mediaicon_height: 12px;
--tab_mediaicon_width: 12px;
--tab_mediaicon_left: 1px;
--tab_mediaicon_bottom: 1px;
} }

View File

@ -12,12 +12,21 @@ body {
--title_font_size: 14px; --title_font_size: 14px;
--tab_title_text_padding_left: 26px; --tab_title_text_padding_left: 27px;
--tab_title_text_padding_exp_left: 39px;
--tab_title_text_padding_right_with_close_button: 24px; --tab_title_text_padding_right_with_close_button: 24px;
--favicon_size: 16px 16px; --favicon_width: 17px;
--favicon_left: 6px; --favicon_height: 17px;
--favicon_left: 3px;
--expand_height: 23px;
--expand_width: 41px;
--expand_mask_top: 9px;
--expand_mask_left: 27px;
--expand_mask_height: 7px;
--expand_mask_width: 7px;
--drag_area_top: 9px; --drag_area_top: 9px;
--drag_area_bottom: 6px; --drag_area_bottom: 6px;
@ -27,4 +36,9 @@ body {
--close_right: 4px; --close_right: 4px;
--close_height: 14px; --close_height: 14px;
--close_width: 14px; --close_width: 14px;
--tab_mediaicon_height: 12px;
--tab_mediaicon_width: 12px;
--tab_mediaicon_left: 1px;
--tab_mediaicon_bottom: 1px;
} }

74
theme/toolbar_folder.svg Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg3347"
version="1.1"
inkscape:version="0.91 r13725"
width="22"
height="22"
viewBox="0 0 22 22"
sodipodi:docname="toolbar_folder.svg">
<metadata
id="metadata3353">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3351" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1058"
id="namedview3349"
showgrid="false"
inkscape:zoom="22.627417"
inkscape:cx="14.698991"
inkscape:cy="11.544138"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg3347"
inkscape:snap-page="true"
inkscape:snap-center="true"
inkscape:snap-midpoints="true"
inkscape:snap-bbox="true"
inkscape:bbox-paths="true"
inkscape:bbox-nodes="true"
inkscape:snap-bbox-edge-midpoints="true"
inkscape:snap-bbox-midpoints="true"
inkscape:object-paths="true" />
<path
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 4.9999998,7.9999928 0,10.0000002 13.0000002,0 0,-10.0000002 z"
id="path4138"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 17.499937,8.4999928 1.25e-4,-2 -6.156187,0 -0.625125,-2 -5.2187502,0 0,13.5000002"
id="path4149"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccc" />
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB