bump to v1.1
BIN
Screenshots/Options.png
Normal file
After Width: | Height: | Size: 169 KiB |
BIN
Screenshots/Options_FF.png
Normal file
After Width: | Height: | Size: 166 KiB |
BIN
Screenshots/Options_FF_1.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
Screenshots/Options_FF_2.png
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
Screenshots/Options_FF_3.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
Screenshots/Options_FF_4.png
Normal file
After Width: | Height: | Size: 96 KiB |
BIN
Screenshots/Options_FF_5.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
Screenshots/Sidebar.png
Normal file
After Width: | Height: | Size: 7.7 KiB |
48
TODO.txt
Normal file
@ -0,0 +1,48 @@
|
||||
TOP PRIORITY:
|
||||
|
||||
Add a shortcut to open tree tabs sidebar
|
||||
|
||||
undo close to restore trees (will work ONLY in firefox)
|
||||
|
||||
|
||||
|
||||
Loading data using message
|
||||
|
||||
Close tab on Middle mouse click and not On Middle mouse down
|
||||
|
||||
Split Pin size in theme
|
||||
|
||||
|
||||
add textbox for ungrouped name in options
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LOW PRIORITY:
|
||||
|
||||
option for scrollbar on the left
|
||||
folders
|
||||
|
||||
unread state?
|
||||
|
||||
menu: collapse entire tree
|
||||
menu: expand tree
|
||||
menu: copy urls of the selected tabs
|
||||
menu: bookmark selected tabs/tree
|
||||
menu: select all
|
||||
menu: invert selection
|
||||
|
||||
options: Customising the context menu
|
||||
|
||||
|
||||
click on active to return to previous tab
|
||||
|
||||
sort tabs/tree
|
||||
|
||||
maybe filter tabs on search
|
||||
|
||||
|
||||
make tabs border width configurable, including size 0
|
||||
|
||||
make tab spacing confiogurable, including 0 size
|
1
Themes/dark by cvvar00.tt_theme
Normal file
@ -0,0 +1 @@
|
||||
{"ToolbarShow":true,"ColorsSet":{"scrollbar_thumb":"#666666","scrollbar_thumb_hover":"#999999","scrollbar_track":"#474747","toolbar_background":"#474747","toolbar_border_bottom":"#666666","button_border":"#474747","button_background":"#474747","button_hover_border":"#666666","button_hover_background":"#666666","button_icons":"#dddddd","filter_box_background":"#fafafa","filter_box_border":"#fafafa","filter_box_font":"#333333","filter_clear_icon":"#808080","pin_list_border_bottom":"#666666","pin_list_background":"#474747","tab_list_background":"#474747","tab_background":"#474747","tab_border":"#474747","tab_hover_background":"#666666","tab_hover_border":"#666666","tab_selected_background":"#666666","tab_selected_border":"#666666","tab_selected_hover_border":"#888888","tab_selected_hover_background":"#888888","tab_filtered":"#9a9500","tab_filtered_highlighted":"#ae7100","tab_filtered_selected":"#0f8079","tab_filtered_selected_active":"#1299a9","tab_title":"#eeeeee","tab_title_active":"#fefefe","tab_title_discarded":"#bbbbbb","drag_indicator":"#7090c8","close_x":"#eeeeee","close_hover_x":"#fefefe","close_hover_border":"#474747","close_hover_background":"#474747","expand_open_border":"#cccccc","expand_open_background":"#cccccc","expand_closed_border":"#999999","expand_closed_background":"#999999","expand_lines":"#cccccc","tabs_menu_font":"#333333","tabs_menu_background":"#fafafa","tabs_menu_border":"#bebebe","tabs_menu_hover_background":"#efefef","tabs_menu_hover_border":"#bebebe","tabs_menu_separator":"#efefef"},"TabsSizeSetNumber":4,"TabsSizeSet":{"pin_width":"30px","pin_height":"28px","tab_height":"23px","tab_height_line":"27px","expand_box_size":"5px","expand_box_top":"8px","expand_box_left":"3px","expand_line_h_top":"11px","expand_line_h_width":"12px","expand_line_h_oc_width":"3px","expand_line_v_top":"-11px","expand_line_v_left":"0px","expand_line_v_last_height":"23px","title_padding_with_close":"24px","title_font_size":"12.5px","title_padding_left":"25px","drag_area_top":"9px","drag_area_bottom":"6px","close_top":"4px","close_right":"4px","close_size":"14px","favicon_size":"16px 16px","favicon_pos":"4px center"},"ScrollbarPinList":"4","ScrollbarTabList":"10","theme_name":"dark by cvvar00","theme_version":1,"toolbar":"\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_main\">\n\t\t\t\t\t\t<div class=\"button\" id=\"button_new\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_pin\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_undo\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_search\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_tools\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_search\">\n\t\t\t\t\t\t<div id=\"toolbar_search_input_box\">\n\t\t\t\t\t\t\t<input id=\"filter_box\" type=\"text\" placeholder=\"Search tabs...\">\n\t\t\t\t\t\t\t<div id=\"button_filter_clear\" style=\"opacity:0;\" type=\"reset\"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div id=\"toolbar_search_buttons\">\n\t\t\t\t\t\t\t<div class=\"button\" id=\"button_filter_type\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\t<div class=\"button\" id=\"filter_search_go_prev\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\t<div class=\"button\" id=\"filter_search_go_next\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_tools\">\n\t\t\t\t\t\t<div class=\"button\" id=\"button_options\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_bookmarks\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_downloads\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_history\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_settings\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_extensions\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_discard\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_move\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id=\"toolbar_separator\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_unused_buttons\">\n\t\t\t\t\t</div>\t\t\t\t\n\t\t\t\t"}
|
1
Themes/dark by kroppy.tt_theme
Normal file
@ -0,0 +1 @@
|
||||
{"ToolbarShow":true,"ColorsSet":{"scrollbar_thumb":"#484848","scrollbar_thumb_hover":"#323232","scrollbar_track":"#3c3c3c","toolbar_background":"#484848","toolbar_border_bottom":"#323232","button_border":"#484848","button_background":"#484848","button_hover_border":"#323232","button_hover_background":"#323232","button_icons":"#adadad","filter_box_background":"#3c3c3c","filter_box_border":"#323232","filter_box_font":"#adadad","filter_clear_icon":"#adadad","pin_list_border_bottom":"#323232","pin_list_background":"#3c3c3c","tab_list_background":"#3c3c3c","tab_background":"#484848","tab_border":"#484848","tab_hover_background":"#323232","tab_hover_border":"#323232","tab_selected_background":"#707070","tab_selected_border":"#707070","tab_selected_hover_border":"#818181","tab_selected_hover_background":"#818181","tab_filtered":"#827e00","tab_filtered_highlighted":"#b37400","tab_filtered_selected":"#0f8079","tab_filtered_selected_active":"#1299a9","active_font_weight":"normal","tab_title":"#adadad","tab_title_active":"#cacaca","tab_title_discarded":"#7e7e7e","drag_indicator":"#c4c4c4","close_x":"#c4c4c4","close_hover_x":"#fbfcfe","close_hover_border":"#757676","close_hover_background":"#939394","expand_open_border":"#339bf3","expand_open_background":"#339bf3","expand_closed_border":"#818181","expand_closed_background":"#818181","expand_lines":"#9d9d9d","tabs_menu_font":"#333333","tabs_menu_background":"#fafafa","tabs_menu_border":"#bebebe","tabs_menu_hover_background":"#efefef","tabs_menu_hover_border":"#bebebe","tabs_menu_separator":"#efefef"},"TabsSizeSetNumber":2,"TabsSizeSet":{"pin_width":"26px","pin_height":"24px","tab_height":"19px","tab_height_line":"22px","expand_box_size":"5px","expand_box_top":"6px","expand_box_left":"3px","expand_line_h_top":"9px","expand_line_h_width":"12px","expand_line_h_oc_width":"3px","expand_line_v_top":"-9px","expand_line_v_left":"0px","expand_line_v_last_height":"19px","title_padding_with_close":"24px","title_font_size":"12px","title_padding_left":"25px","drag_area_top":"7px","drag_area_bottom":"5px","close_top":"2px","close_right":"2px","close_size":"13px","favicon_size":"16px 16px","favicon_pos":"4px center"},"ScrollbarPinList":"2","ScrollbarTabList":"16","theme_name":"dark by kroppy","theme_version":1,"toolbar":"\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_main\">\n\t\t\t\t\t\t<div class=\"button\" id=\"button_new\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_pin\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_undo\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_search\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_tools\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_search\">\n\t\t\t\t\t\t<div id=\"toolbar_search_input_box\">\n\t\t\t\t\t\t\t<input id=\"filter_box\" type=\"text\" placeholder=\"Search tabs...\">\n\t\t\t\t\t\t\t<div id=\"button_filter_clear\" style=\"opacity:0;\" type=\"reset\"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div id=\"toolbar_search_buttons\">\n\t\t\t\t\t\t\t<div class=\"button\" id=\"button_filter_type\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\t<div class=\"button\" id=\"filter_search_go_prev\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\t<div class=\"button\" id=\"filter_search_go_next\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_tools\">\n\t\t\t\t\t\t<div class=\"button\" id=\"button_options\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_bookmarks\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_downloads\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_history\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_settings\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_extensions\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_discard\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_move\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id=\"toolbar_separator\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_unused_buttons\">\n\t\t\t\t\t</div>\t\t\t\t\n\t\t\t\t"}
|
1
Themes/dark by kvaps.tt_theme
Normal file
@ -0,0 +1 @@
|
||||
{"ToolbarShow":true,"ColorsSet":{"scrollbar_thumb":"#cdcdcd","scrollbar_thumb_hover":"#a6a6a6","scrollbar_track":"#e4e4e4","toolbar_background":"#4a4a4a","toolbar_border_bottom":"#2f2f2f","button_border":"#4c4c4c","button_background":"#4a4a4a","button_hover_border":"#383838","button_hover_background":"#383838","button_icons":"#d7d7d7","filter_box_background":"#333333","filter_box_border":"#2d2d2d","filter_box_font":"#e3e3e3","filter_clear_icon":"#808080","pin_list_border_bottom":"#2f2f2f","pin_list_background":"#3f3f3f","tab_list_background":"#3f3f3f","tab_background":"#4a4a4a","tab_border":"#4a4a4a","tab_hover_background":"#383838","tab_hover_border":"#383838","tab_selected_background":"#333333","tab_selected_border":"#3e3e3e","tab_selected_hover_border":"#2d2d2d","tab_selected_hover_background":"#2d2d2d","tab_filtered":"#785400","tab_filtered_highlighted":"#8e5c00","tab_filtered_selected":"#0f8079","tab_filtered_selected_active":"#1299a9","active_font_weight":"bold","tab_title":"#e3e3e3","tab_title_active":"#ffffff","tab_title_discarded":"#7e7e7e","drag_indicator":"#e3e3e3","close_x":"#7d7d7d","close_hover_x":"#fbfcfe","close_hover_border":"#757676","close_hover_background":"#939394","expand_open_border":"#8a8a8a","expand_open_background":"#d0e2f0","expand_closed_border":"#969696","expand_closed_background":"#eaeaea","expand_lines":"#cccccc","tabs_menu_font":"#e5e5e5","tabs_menu_background":"#414141","tabs_menu_border":"#252525","tabs_menu_hover_background":"#252525","tabs_menu_hover_border":"#252525","tabs_menu_separator":"#525252"},"TabsSizeSetNumber":4,"TabsSizeSet":{"pin_width":"30px","pin_height":"28px","tab_height":"23px","tab_height_line":"26px","expand_box_size":"5px","expand_box_top":"8px","expand_box_left":"3px","expand_line_h_top":"11px","expand_line_h_width":"12px","expand_line_h_oc_width":"3px","expand_line_v_top":"-11px","expand_line_v_left":"0px","expand_line_v_last_height":"23px","title_padding_with_close":"24px","title_font_size":"12.5px","title_padding_left":"25px","drag_area_top":"9px","drag_area_bottom":"6px","close_top":"4px","close_right":"4px","close_size":"14px","favicon_size":"16px 16px","favicon_pos":"4px center"},"ScrollbarPinList":4,"ScrollbarTabList":16,"theme_name":"kvaps_dark","theme_version":1,"toolbar":"\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_main\">\n\t\t\t\t\t\t<div class=\"button\" id=\"button_new\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_pin\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_undo\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_search\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_tools\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_search\">\n\t\t\t\t\t\t<div id=\"toolbar_search_input_box\">\n\t\t\t\t\t\t\t<input id=\"filter_box\" type=\"text\" placeholder=\"Search tabs...\">\n\t\t\t\t\t\t\t<div id=\"button_filter_clear\" style=\"opacity:0;\" type=\"reset\"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div id=\"toolbar_search_buttons\">\n\t\t\t\t\t\t\t<div class=\"button\" id=\"button_filter_type\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\t<div class=\"button\" id=\"filter_search_go_prev\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\t<div class=\"button\" id=\"filter_search_go_next\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_tools\">\n\t\t\t\t\t\t<div class=\"button\" id=\"button_options\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_bookmarks\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_downloads\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_history\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_settings\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_extensions\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_discard\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_move\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id=\"toolbar_separator\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_unused_buttons\">\n\t\t\t\t\t</div>\t\t\t\t\n\t\t\t\t"}
|
1
Themes/dark2 by kroppy.tt_theme
Normal file
1
Themes/legacy by luetage.tt_theme
Normal file
@ -0,0 +1 @@
|
||||
{"ToolbarShow":true,"ColorsSet":{"scrollbar_thumb":"#c4c4c4","scrollbar_thumb_hover":"#787878","scrollbar_track":"#ffffff","toolbar_background":"#f6f6f6","toolbar_border_bottom":"#cccccc","button_border":"#f6f6f6","button_background":"#f6f6f6","button_hover_border":"#ecebee","button_hover_background":"#ecebee","button_icons":"#000000","filter_box_background":"#fafafa","filter_box_border":"#cccccc","filter_box_font":"#333333","filter_clear_icon":"#000000","pin_list_border_bottom":"#cccccc","pin_list_background":"#ffffff","tab_list_background":"#ffffff","tab_background":"#f6f6f6","tab_border":"#d2d2d2","tab_hover_background":"#d6d5d8","tab_hover_border":"#878787","tab_selected_background":"#c7f4e2","tab_selected_border":"#00caa7","tab_selected_hover_border":"#00caa7","tab_selected_hover_background":"#1de6b4","tab_filtered":"#ffa53b","tab_filtered_highlighted":"#ff8628","tab_filtered_selected":"#fff422","tab_filtered_selected_active":"#fff422","active_font_weight":"bold","tab_title":"#000000","tab_title_active":"#000000","tab_title_discarded":"#7e7e7e","drag_indicator":"#00caa7","close_x":"#3b3b3d","close_hover_x":"#000000","close_hover_border":"#939394","close_hover_background":"#b0adbd","expand_open_border":"#129071","expand_open_background":"#00caa7","expand_closed_border":"#969696","expand_closed_background":"#eaeaea","expand_lines":"#129071","tabs_menu_font":"#333333","tabs_menu_background":"#fafafa","tabs_menu_border":"#bebebe","tabs_menu_hover_background":"#efefef","tabs_menu_hover_border":"#bebebe","tabs_menu_separator":"#efefef"},"TabsSizeSetNumber":2,"TabsSizeSet":{"pin_width":"26px","pin_height":"24px","tab_height":"19px","tab_height_line":"22px","expand_box_size":"5px","expand_box_top":"6px","expand_box_left":"3px","expand_line_h_top":"9px","expand_line_h_width":"12px","expand_line_h_oc_width":"3px","expand_line_v_top":"-9px","expand_line_v_left":"0px","expand_line_v_last_height":"19px","title_padding_with_close":"24px","title_font_size":"12px","title_padding_left":"25px","drag_area_top":"7px","drag_area_bottom":"5px","close_top":"2px","close_right":"2px","close_size":"13px","favicon_size":"16px 16px","favicon_pos":"4px center"},"ScrollbarPinList":"4","ScrollbarTabList":"8","theme_name":"legacy by luetage","theme_version":1,"toolbar":"\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_main\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t<div class=\"button\" id=\"button_new\"><div class=\"button_img\"></div></div><div class=\"button\" id=\"button_pin\"><div class=\"button_img\"></div></div><div class=\"button\" id=\"button_undo\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t<div class=\"button\" id=\"button_search\"><div class=\"button_img\"></div></div><div class=\"button on\" id=\"button_tools\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int hidden\" id=\"toolbar_search\">\n\t\t\t\t\t\t<div id=\"toolbar_search_input_box\">\n\t\t\t\t\t\t\t<input id=\"filter_box\" type=\"text\" placeholder=\"Search tabs...\">\n\t\t\t\t\t\t\t<div id=\"button_filter_clear\" style=\"opacity:0;\" type=\"reset\"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div id=\"toolbar_search_buttons\">\n\t\t\t\t\t\t\t<div class=\"button url\" id=\"button_filter_type\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\t<div class=\"button\" id=\"filter_search_go_prev\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t\t<div class=\"button\" id=\"filter_search_go_next\"><div class=\"button_img\"></div></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_tools\">\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t<div class=\"button\" id=\"button_options\"><div class=\"button_img\"></div></div><div class=\"button\" id=\"button_bookmarks\"><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_settings\"><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_move\" draggable=\"true\"><div class=\"button_img\"></div></div></div>\n\t\t\t\t\t<div id=\"toolbar_separator\">\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class=\"toolbar_int\" id=\"toolbar_unused_buttons\">\n\t\t\t\t\t</div>\t\t\t\t\n\t\t\t\t"}
|
@ -5,6 +5,9 @@
|
||||
"extDesc": {
|
||||
"message": "Manage your tabs in the sidebar!"
|
||||
},
|
||||
"OpenSidebar": {
|
||||
"message": "Open Tree Tabs"
|
||||
},
|
||||
|
||||
|
||||
"button_new": {
|
||||
@ -189,7 +192,7 @@
|
||||
"message": " Tabs "
|
||||
},
|
||||
"options_syncro_tabbar_tabs_order": {
|
||||
"message": "synchronise TabBar tabs order with Tree Tabs (with too many tabs, after moving tabs, Tree Tabs may be unresponsive for a second)"
|
||||
"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"
|
||||
},
|
||||
"options_switch_with_scroll": {
|
||||
"message": "switch tabs with mouse wheel"
|
||||
@ -212,6 +215,11 @@
|
||||
"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)"
|
||||
},
|
||||
|
||||
"options_promote_children_in_first_child": {
|
||||
"message": "promote first child tab as a parent"
|
||||
},
|
||||
|
||||
"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."
|
||||
},
|
||||
@ -268,7 +276,13 @@
|
||||
"message": "at the bottom"
|
||||
},
|
||||
"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": {
|
||||
"message": "show children tabs count on tab's title"
|
||||
},
|
||||
"options_show_counter_tabs_hints": {
|
||||
"message": "show children tabs count in tab's hint"
|
||||
},
|
||||
|
||||
"options_max_tree_depth": {
|
||||
@ -277,6 +291,21 @@
|
||||
|
||||
|
||||
|
||||
"options_groups": {
|
||||
"message": "Groups"
|
||||
},
|
||||
|
||||
"options_show_counter_groups": {
|
||||
"message": "show tabs count on groups"
|
||||
},
|
||||
|
||||
"options_groups_toolbar_default": {
|
||||
"message": "show groups toolbar in new windows"
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -554,7 +583,7 @@
|
||||
|
||||
|
||||
"options_clear_data": {
|
||||
"message": "Sidebar is not loading? Clear everything! ATTENTION! Tabs arrangement will be lost as well!"
|
||||
"message": "Sidebar is not loading? Reset! ATTENTION! All options and saved Themes will be lost!"
|
||||
},
|
||||
|
||||
|
||||
@ -582,7 +611,7 @@
|
||||
|
||||
|
||||
"caption_ungrouped_group": {
|
||||
"message": "Ungrouped tabs"
|
||||
"message": "Ungrouped"
|
||||
},
|
||||
"caption_noname_group": {
|
||||
"message": "untitled"
|
||||
|
@ -3,6 +3,7 @@
|
||||
<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="../legacy.js"></script>
|
||||
<script type="text/javascript" src="../bg_ch.js"></script>
|
||||
<script type="text/javascript" src="../bg_ff.js"></script>
|
||||
</html>
|
81
bg_ch.js
@ -2,27 +2,20 @@
|
||||
// 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 {
|
||||
if (browserId != "F") {
|
||||
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, []);
|
||||
@ -31,24 +24,22 @@ function ChromeLoadTabs(retry) {
|
||||
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: {}};
|
||||
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) {
|
||||
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 (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 = "";
|
||||
@ -58,14 +49,12 @@ function ChromeLoadTabs(retry) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@ -76,9 +65,9 @@ function ChromeLoadTabs(retry) {
|
||||
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;
|
||||
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;
|
||||
@ -86,7 +75,6 @@ function ChromeLoadTabs(retry) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// replace parents tabIds for new ones, for that purpose refTabs was made before
|
||||
for (var tabId in tabs) {
|
||||
if (refTabs[tabs[tabId].parent] != undefined) {
|
||||
@ -94,8 +82,6 @@ function ChromeLoadTabs(retry) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// replace active tab ids for each group using refTabs
|
||||
for (var windowId in windows) {
|
||||
for (var group in windows[windowId].groups) {
|
||||
@ -104,14 +90,10 @@ function ChromeLoadTabs(retry) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 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;
|
||||
running = true;
|
||||
ChromeAutoSaveData("", 1000);
|
||||
ChromeAutoSaveData("_BAK1", 300000);
|
||||
ChromeAutoSaveData("_BAK2", 600000);
|
||||
@ -122,14 +104,12 @@ function ChromeLoadTabs(retry) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 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);
|
||||
setInterval(function() {
|
||||
if (schedule_save > 1 || BackupName != "") {schedule_save = 1;}
|
||||
if (!hold && 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) {
|
||||
var WinCount = w.length;
|
||||
var t_count = 0;
|
||||
@ -143,8 +123,8 @@ async function ChromeAutoSaveData(BackupName, LoopTimer) {
|
||||
|
||||
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});
|
||||
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});
|
||||
}
|
||||
|
||||
let TabsCount = w[wIndex].tabs.length;
|
||||
@ -167,7 +147,6 @@ async function ChromeAutoSaveData(BackupName, LoopTimer) {
|
||||
}
|
||||
}, 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"};
|
||||
@ -198,7 +177,7 @@ function ChromeListeners() {
|
||||
});
|
||||
|
||||
chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) {
|
||||
chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId});
|
||||
setTimeout(function() { chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId}); },5);
|
||||
delete tabs[tabId];
|
||||
schedule_save++;
|
||||
});
|
||||
@ -259,7 +238,7 @@ function ChromeListeners() {
|
||||
});
|
||||
|
||||
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: {}};
|
||||
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: {}};
|
||||
schedule_save++;
|
||||
});
|
||||
|
||||
@ -269,7 +248,7 @@ function ChromeListeners() {
|
||||
});
|
||||
|
||||
chrome.runtime.onSuspend.addListener(function() {
|
||||
hold = true;
|
||||
running = false;
|
||||
});
|
||||
}
|
||||
|
||||
@ -301,6 +280,24 @@ function ChromeMessageListeners() {
|
||||
sendResponse(windows[message.windowId].active_group);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case "set_search_filter":
|
||||
windows[message.windowId].search_filter = message.search_filter;
|
||||
schedule_save++;
|
||||
break;
|
||||
case "get_search_filter":
|
||||
if (windows[message.windowId]) {
|
||||
sendResponse(windows[message.windowId].search_filter);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
case "set_active_shelf":
|
||||
windows[message.windowId].active_shelf = message.active_shelf;
|
||||
schedule_save++;
|
||||
@ -325,8 +322,8 @@ function ChromeMessageListeners() {
|
||||
case "get_browser_tabs":
|
||||
sendResponse(tabs);
|
||||
break;
|
||||
case "is_bg_busy":
|
||||
sendResponse(hold);
|
||||
case "is_bg_running":
|
||||
sendResponse(running);
|
||||
break;
|
||||
case "update_tab":
|
||||
if (tabs[message.tabId]) {
|
||||
@ -336,6 +333,10 @@ function ChromeMessageListeners() {
|
||||
schedule_save++;
|
||||
}
|
||||
break;
|
||||
case "get_theme":
|
||||
let theme = LoadData(("theme"+localStorage["current_theme"]), {"TabsSizeSetNumber": 2, "ToolbarShow": true, "toolbar": DefaultToolbar});
|
||||
sendResponse(theme);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
214
bg_ff.js
@ -2,26 +2,33 @@
|
||||
// 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 {
|
||||
if (browserId == "F") {
|
||||
LoadPreferences();
|
||||
FirefoxStart();
|
||||
FirefoxMessageListeners();
|
||||
}
|
||||
|
||||
|
||||
function FirefoxStart() {
|
||||
var SafeToRun = true;
|
||||
chrome.tabs.query({windowType: "normal"}, function(t) {
|
||||
chrome.tabs.query({}, function(t) {
|
||||
// will loop forever if session restore tab is found
|
||||
for (var tabIndex = 0; tabIndex < t.length; tabIndex++) {
|
||||
if (t[tabIndex].url.match("about:sessionrestore") && t.length < 5) {
|
||||
if (t[tabIndex].url.match("about:sessionrestore") && t.length < 10) {
|
||||
SafeToRun = false;
|
||||
chrome.tabs.update(t[tabIndex].id, { active: true });
|
||||
}
|
||||
if (tabIndex == t.length-1) {
|
||||
if (SafeToRun) {
|
||||
FirefoxLoadTabs(0);
|
||||
if (localStorage.getItem("t0") !== null){
|
||||
LoadV015(0);
|
||||
} else {
|
||||
if (localStorage.getItem("tabs") !== null){
|
||||
FirefoxLoadV100(0);
|
||||
} else {
|
||||
FirefoxLoadTabs(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setTimeout(function() {
|
||||
FirefoxStart();
|
||||
@ -32,113 +39,74 @@ function FirefoxStart() {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function FirefoxLoadTabs(retry) {
|
||||
chrome.windows.getAll({windowTypes: ["normal"], populate: true}, function(w) {
|
||||
|
||||
var refTabs = {};
|
||||
var tt_ids = {};
|
||||
var tabs_matched = 0;
|
||||
var tabs_count = 0;
|
||||
for (var wIndex = 0; wIndex < w.length; wIndex++) {
|
||||
tabs_count += w[wIndex].tabs.length;
|
||||
}
|
||||
|
||||
// load tabs and windows from hdd
|
||||
var LoadedWindows = LoadData("windows", []);
|
||||
var LoadedTabs = LoadData("tabs", []);
|
||||
|
||||
// if loaded tabs mismatch by 50%, then try to load back
|
||||
if (LoadedTabs.length < tabs_count*0.5 || retry > 0) {
|
||||
LoadedTabs = LoadData("tabs_BAK"+retry, []);
|
||||
}
|
||||
// if loaded windows mismatch, then try to load back
|
||||
if (LoadedWindows.length < w.length || retry > 0) {
|
||||
LoadedWindows = LoadData("windows_BAK"+retry, []);
|
||||
}
|
||||
|
||||
// CACHED COUNTS AND STUFF
|
||||
var lastWinId = w[w.length-1].id;
|
||||
var lastTabId = w[w.length-1].tabs[w[w.length-1].tabs.length-1].id;
|
||||
|
||||
var LoadedWinCount = LoadedWindows.length;
|
||||
var LoadedTabsCount = LoadedTabs.length;
|
||||
var WinCount = w.length;
|
||||
|
||||
|
||||
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
|
||||
|
||||
let winIndex = wIndex;
|
||||
let winId = w[winIndex].id;
|
||||
let tabsCount = w[winIndex].tabs.length;
|
||||
|
||||
let win = Promise.resolve(browser.sessions.getWindowValue(winId, "TTId")).then(function(TTId) { // LOAD TTID FROM FIREFOX GET WINDOW VALUE
|
||||
if (TTId != undefined) {
|
||||
windows[winId] = {ttid: TTId, 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: {}};
|
||||
// LOAD TTID FROM FIREFOX GET WINDOW VALUE
|
||||
let win = Promise.resolve(browser.sessions.getWindowValue(winId, "TTdata")).then(function(WindowData) {
|
||||
|
||||
if (opt.skip_load == false && WindowData != undefined) {
|
||||
windows[winId] = Object.assign({}, WindowData);
|
||||
} else {
|
||||
windows[winId] = {ttid: "", 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: {}};
|
||||
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: {}};
|
||||
}
|
||||
|
||||
for (var tIndex = 0; tIndex < tabsCount; tIndex++) {
|
||||
|
||||
let tabIndex = tIndex;
|
||||
let tabId = w[winIndex].tabs[tabIndex].id;
|
||||
let tabPinned = w[winIndex].tabs[tabIndex].pinned;
|
||||
|
||||
let tab = Promise.resolve(browser.sessions.getTabValue(tabId, "TTId")).then(function(TTId) { // LOAD TTID FROM FIREFOX GET TAB VALUE
|
||||
if (TTId != undefined) {
|
||||
tabs[tabId] = {ttid: TTId, parent: tabPinned ? "pin_list" : "tab_list", index: tabIndex, expand: "n"};
|
||||
// LOAD TTID FROM FIREFOX GET TAB VALUE
|
||||
let tab = Promise.resolve(browser.sessions.getTabValue(tabId, "TTdata")).then(function(TabData) {
|
||||
if (opt.skip_load == false && TabData != undefined) {
|
||||
tabs[tabId] = Object.assign({}, TabData);
|
||||
tt_ids[tabs[tabId].ttid] = tabId;
|
||||
tabs_matched++;
|
||||
} else {
|
||||
tabs[tabId] = {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 (tabId == lastTabId && winId == lastWinId) {
|
||||
for (var ThisSessonWinId in windows) {
|
||||
if (windows[ThisSessonWinId].ttid != ""){
|
||||
for (var LwIndex = 0; LwIndex < LoadedWinCount; LwIndex++) {
|
||||
if (LoadedWindows[LwIndex].ttid == windows[ThisSessonWinId].ttid) {
|
||||
windows[ThisSessonWinId].group_bar = LoadedWindows[LwIndex].group_bar;
|
||||
windows[ThisSessonWinId].active_shelf = LoadedWindows[LwIndex].active_shelf;
|
||||
windows[ThisSessonWinId].active_group = LoadedWindows[LwIndex].active_group;
|
||||
if (Object.keys(LoadedWindows[LwIndex].groups).length > 0) { windows[ThisSessonWinId].groups = Object.assign({}, LoadedWindows[LwIndex].groups); }
|
||||
if (Object.keys(LoadedWindows[LwIndex].folders).length > 0) { windows[ThisSessonWinId].folders = Object.assign({}, LoadedWindows[LwIndex].folders); }
|
||||
LoadedWindows[LwIndex].ttid = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (windows[ThisSessonWinId].ttid == ""){
|
||||
AppendWinTTId(parseInt(ThisSessonWinId));
|
||||
}
|
||||
}
|
||||
// OK, DONE WITH WINDOWS, START TABS LOOP
|
||||
for (var ThisSessonTabId in tabs) {
|
||||
if (tabs[ThisSessonTabId].ttid != ""){
|
||||
for (var LtabIndex = 0; LtabIndex < LoadedTabsCount; LtabIndex++) {
|
||||
if (LoadedTabs[LtabIndex].ttid == tabs[ThisSessonTabId].ttid) {
|
||||
refTabs[LoadedTabs[LtabIndex].id] = ThisSessonTabId;
|
||||
tabs[ThisSessonTabId].parent = LoadedTabs[LtabIndex].parent;
|
||||
tabs[ThisSessonTabId].index = LoadedTabs[LtabIndex].index;
|
||||
tabs[ThisSessonTabId].expand = LoadedTabs[LtabIndex].expand;
|
||||
LoadedTabs[LtabIndex].ttid = "";
|
||||
tabs_matched++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (tabs[ThisSessonTabId].ttid == ""){
|
||||
AppendTabTTId(parseInt(ThisSessonTabId));
|
||||
}
|
||||
}
|
||||
// OK, DONE, NOW REPLACE OLD PARENTS IDS WITH THIS SESSION IDS
|
||||
for (var ThisSessonTabId in tabs) {
|
||||
if (refTabs[tabs[ThisSessonTabId].parent] != undefined) {
|
||||
tabs[ThisSessonTabId].parent = refTabs[tabs[ThisSessonTabId].parent];
|
||||
if (tt_ids[tabs[ThisSessonTabId].parent_ttid] != undefined) {
|
||||
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 group in windows[ThisSessonWinId].groups) {
|
||||
if (refTabs[windows[ThisSessonWinId].groups[group].activetab]) {
|
||||
windows[ThisSessonWinId].groups[group].activetab = refTabs[windows[ThisSessonWinId].groups[group].activetab];
|
||||
if (tt_ids[windows[ThisSessonWinId].groups[group].activetab_ttid] != undefined) {
|
||||
windows[ThisSessonWinId].groups[group].activetab = tt_ids[windows[ThisSessonWinId].groups[group].activetab_ttid];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,14 +114,10 @@ function FirefoxLoadTabs(retry) {
|
||||
// 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
|
||||
if (opt.skip_load == true || retry > 2 || (tabs_matched > tabs_count*0.5)) {
|
||||
hold = false;
|
||||
FirefoxAutoSaveData("", 1000);
|
||||
FirefoxAutoSaveData("_BAK1", 300000);
|
||||
FirefoxAutoSaveData("_BAK2", 600000);
|
||||
FirefoxAutoSaveData("_BAK3", 1800000);
|
||||
running = true;
|
||||
FirefoxAutoSaveData();
|
||||
FirefoxListeners();
|
||||
} else {
|
||||
setTimeout(function() {FirefoxLoadTabs(retry+1);}, 2000);
|
||||
@ -168,53 +132,33 @@ function FirefoxLoadTabs(retry) {
|
||||
}
|
||||
|
||||
// save every second if there is anything to save obviously
|
||||
// async function FirefoxAutoSaveData(BAK, timer) {
|
||||
async function FirefoxAutoSaveData(BackupName, LoopTimer) {
|
||||
setTimeout(function() {
|
||||
FirefoxAutoSaveData(BackupName, LoopTimer);
|
||||
if (schedule_save > 1 || BackupName != "") {schedule_save = 1;}
|
||||
if (!hold && schedule_save > 0 && Object.keys(tabs).length > 1) {
|
||||
async function FirefoxAutoSaveData() {
|
||||
setInterval(function() {
|
||||
if (schedule_save > 1) {schedule_save = 1;}
|
||||
if (running && 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 = t_count + w[wIndex].tabs.length;
|
||||
}
|
||||
|
||||
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
|
||||
let winId = w[wIndex].id;
|
||||
if (windows[winId] != undefined && windows[winId].ttid != 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({ttid: windows[winId].ttid, 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});
|
||||
if (windows[winId] != undefined && windows[winId].ttid != 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) {
|
||||
browser.sessions.setWindowValue(winId, "TTdata", windows[winId] );
|
||||
}
|
||||
|
||||
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].ttid != undefined && tabs[tabId].parent != undefined && tabs[tabId].index != undefined && tabs[tabId].expand != undefined) {
|
||||
Tabs.push({id: tabId, ttid: tabs[tabId].ttid, parent: tabs[tabId].parent, index: tabs[tabId].index, expand: tabs[tabId].expand});
|
||||
counter++;
|
||||
browser.sessions.setTabValue( tabId, "TTdata", tabs[tabId] );
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function GenerateNewWindowID(){
|
||||
var newID = GenerateRandomID();
|
||||
var newID = "w_"+GenerateRandomID();
|
||||
var newIdAvailable = true;
|
||||
for (var windowId in windows) {
|
||||
if (windows[windowId].ttid == newID) {
|
||||
@ -229,7 +173,7 @@ function GenerateNewWindowID(){
|
||||
}
|
||||
|
||||
function GenerateNewTabID(){
|
||||
var newID = GenerateRandomID();
|
||||
var newID = "t_"+GenerateRandomID();
|
||||
var newIdAvailable = true;
|
||||
for (var tabId in tabs) {
|
||||
if (tabs[tabId].ttid == newID) {
|
||||
@ -245,22 +189,22 @@ function GenerateNewTabID(){
|
||||
|
||||
function AppendTabTTId(tabId){
|
||||
let NewTTTabId = GenerateNewTabID();
|
||||
browser.sessions.setTabValue(tabId, "TTId", NewTTTabId);
|
||||
if (tabs[tabId] != undefined) {
|
||||
tabs[tabId].ttid = NewTTTabId;
|
||||
} else {
|
||||
tabs[tabId] = {ttid: NewTTTabId, parent: "tab_list", index: 0, expand: "n"};
|
||||
tabs[tabId] = {ttid: NewTTTabId, parent: "tab_list", parent_ttid: "", index: 0, expand: "n"};
|
||||
}
|
||||
browser.sessions.setTabValue( tabId, "TTdata", tabs[tabId] );
|
||||
}
|
||||
|
||||
function AppendWinTTId(windowId){
|
||||
let NewTTWindowId = GenerateNewWindowID();
|
||||
browser.sessions.setWindowValue(windowId, "TTId", NewTTWindowId);
|
||||
if (windows[windowId] != undefined) {
|
||||
windows[windowId].ttid = NewTTWindowId;
|
||||
} else {
|
||||
windows[windowId] = {ttid: NewTTWindowId, 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: {}};
|
||||
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: {}};
|
||||
}
|
||||
browser.sessions.setWindowValue( windowId, "TTdata", windows[windowId] );
|
||||
}
|
||||
|
||||
function ReplaceParents(oldTabId, newTabId) {
|
||||
@ -270,7 +214,6 @@ function ReplaceParents(oldTabId, newTabId) {
|
||||
tabs[tabId].parent = newTabId;
|
||||
}
|
||||
}
|
||||
|
||||
// TO DO FOLDERS
|
||||
}
|
||||
|
||||
@ -279,6 +222,20 @@ var DETACHED_TABS___Bug1398272___WTF_ARE_YOU_DOING_MOZILLA = {};
|
||||
// start all listeners
|
||||
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.sidebarAction.setPanel({panel: (browser.extension.getURL("/sidebar.html")) });
|
||||
browser.sidebarAction.open();
|
||||
@ -315,7 +272,7 @@ function FirefoxListeners() {
|
||||
});
|
||||
|
||||
chrome.tabs.onRemoved.addListener(function(tabId, removeInfo) {
|
||||
chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId});
|
||||
setTimeout(function() { chrome.runtime.sendMessage({command: "tab_removed", windowId: removeInfo.windowId, tabId: tabId}); },5);
|
||||
delete tabs[tabId];
|
||||
schedule_save++;
|
||||
});
|
||||
@ -323,6 +280,8 @@ function FirefoxListeners() {
|
||||
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
|
||||
if (changeInfo.pinned == true) {
|
||||
tabs[tabId].parent = "pin_list";
|
||||
tabs[tabId].parent_ttid = "";
|
||||
schedule_save++;
|
||||
}
|
||||
if (changeInfo.title != undefined && !tab.active) {
|
||||
chrome.runtime.sendMessage({command: "tab_attention", windowId: tab.windowId, tabId: tabId});
|
||||
@ -382,6 +341,11 @@ function FirefoxMessageListeners() {
|
||||
break;
|
||||
case "save_groups":
|
||||
windows[message.windowId].groups = Object.assign({}, message.groups);
|
||||
for (var group in windows[message.windowId].groups) {
|
||||
if (tabs[windows[message.windowId].groups[group].activetab]) {
|
||||
windows[message.windowId].groups[group].activetab_ttid = tabs[windows[message.windowId].groups[group].activetab].ttid;
|
||||
}
|
||||
}
|
||||
schedule_save++;
|
||||
break;
|
||||
case "set_active_group":
|
||||
@ -393,6 +357,15 @@ function FirefoxMessageListeners() {
|
||||
sendResponse(windows[message.windowId].active_group);
|
||||
}
|
||||
break;
|
||||
case "set_search_filter":
|
||||
windows[message.windowId].search_filter = message.search_filter;
|
||||
schedule_save++;
|
||||
break;
|
||||
case "get_search_filter":
|
||||
if (windows[message.windowId]) {
|
||||
sendResponse(windows[message.windowId].search_filter);
|
||||
}
|
||||
break;
|
||||
case "set_active_shelf":
|
||||
windows[message.windowId].active_shelf = message.active_shelf;
|
||||
schedule_save++;
|
||||
@ -417,17 +390,32 @@ function FirefoxMessageListeners() {
|
||||
case "get_browser_tabs":
|
||||
sendResponse(tabs);
|
||||
break;
|
||||
case "is_bg_busy":
|
||||
sendResponse(hold);
|
||||
case "is_bg_running":
|
||||
sendResponse(running);
|
||||
break;
|
||||
case "update_tab":
|
||||
if (tabs[message.tabId]) {
|
||||
for (var parameter in message.tab) {
|
||||
tabs[message.tabId][parameter] = message.tab[parameter];
|
||||
if (message.tab.index) {
|
||||
tabs[message.tabId].index = message.tab.index;
|
||||
}
|
||||
if (message.tab.expand) {
|
||||
tabs[message.tabId].expand = message.tab.expand;
|
||||
}
|
||||
if (message.tab.parent) {
|
||||
tabs[message.tabId].parent = message.tab.parent;
|
||||
if (tabs[message.tab.parent]) {
|
||||
tabs[message.tabId].parent_ttid = tabs[message.tab.parent].ttid;
|
||||
} else {
|
||||
tabs[message.tabId].parent_ttid = "";
|
||||
}
|
||||
}
|
||||
schedule_save++;
|
||||
}
|
||||
break;
|
||||
case "get_theme":
|
||||
let theme = LoadData(("theme"+localStorage["current_theme"]), {"TabsSizeSetNumber": 2, "ToolbarShow": true, "toolbar": DefaultToolbar});
|
||||
sendResponse(theme);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
106
bg_v015_to_v1.js
@ -1,106 +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/
|
||||
|
||||
function OldHashTab(tab){
|
||||
if (tabs[tab.id] == undefined){
|
||||
tabs[tab.id] = {ttid: "", hash: 0, h: 0, parent: tab.pinned ? "pin_list" : "tab_list", index: tab.index, expand: "n"};
|
||||
}
|
||||
var hash = 0;
|
||||
if (tab.url.length === 0){
|
||||
return 0;
|
||||
}
|
||||
for (var i = 0; i < tab.url.length; i++){
|
||||
hash = (hash << 5)-hash;
|
||||
hash = hash+tab.url.charCodeAt(i);
|
||||
hash |= 0;
|
||||
}
|
||||
tabs[tab.id].h = hash;
|
||||
}
|
||||
|
||||
|
||||
function LoadV015(retry){
|
||||
var loaded_options = {};
|
||||
for (var parameter in DefaultPreferences) {
|
||||
opt[parameter] = DefaultPreferences[parameter];
|
||||
}
|
||||
// set loaded options
|
||||
if (localStorage.getItem("current_options") !== null){
|
||||
loaded_options = JSON.parse(localStorage["current_options"]);
|
||||
}
|
||||
for (var parameter in opt) {
|
||||
if (loaded_options[parameter] != undefined && opt[parameter] != undefined){
|
||||
opt[parameter] = loaded_options[parameter];
|
||||
}
|
||||
}
|
||||
SavePreferences();
|
||||
if (localStorage.getItem("current_options") !== null){
|
||||
localStorage.removeItem("current_options");
|
||||
|
||||
}
|
||||
|
||||
chrome.tabs.query({windowType: "normal"}, function(qtabs){
|
||||
// create current tabs object
|
||||
qtabs.forEach(function(Tab){
|
||||
OldHashTab(Tab);
|
||||
});
|
||||
|
||||
var reference_tabs = {};
|
||||
var tabs_to_save = [];
|
||||
var tabs_matched = 0;
|
||||
|
||||
// compare saved tabs from storage to current session tabs, but can be skipped if set in options
|
||||
qtabs.forEach(function(Tab){
|
||||
for (var t = 0; t < 9999; t++){
|
||||
if (localStorage.getItem("t"+t) !== null){
|
||||
var LoadedTab = JSON.parse(localStorage["t"+t]);
|
||||
if (LoadedTab[1] === tabs[Tab.id].h && reference_tabs[LoadedTab[0]] == undefined){
|
||||
reference_tabs[LoadedTab[0]] = Tab.id;
|
||||
tabs[Tab.id].parent = LoadedTab[2];
|
||||
tabs[Tab.id].index = LoadedTab[3];
|
||||
tabs[Tab.id].expand = LoadedTab[4];
|
||||
tabs_matched++;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// replace parents tabIds to new ones, for that purpose reference_tabs was made before
|
||||
for (var tabId in tabs){
|
||||
if (reference_tabs[tabs[tabId].parent] != undefined){
|
||||
tabs[tabId].parent = reference_tabs[tabs[tabId].parent];
|
||||
}
|
||||
}
|
||||
|
||||
if (browserId == "F") {
|
||||
// append ids to firefox tabs
|
||||
qtabs.forEach(function(Tab){
|
||||
AppendTabTTId(Tab.id);
|
||||
});
|
||||
qtabs.forEach(function(Tab){
|
||||
tabs_to_save.push({id: Tab.id, ttid: tabs[tabId].ttid, parent: tabs[Tab.id].parent, index: tabs[Tab.id].index, expand: tabs[Tab.id].expand});
|
||||
});
|
||||
} else {
|
||||
// create new hashes
|
||||
qtabs.forEach(function(Tab){
|
||||
ChromeHashURL(Tab);
|
||||
});
|
||||
qtabs.forEach(function(Tab){
|
||||
tabs_to_save.push({id: Tab.id, hash: tabs[Tab.id].hash, parent: tabs[Tab.id].parent, index: tabs[Tab.id].index, expand: tabs[Tab.id].expand});
|
||||
});
|
||||
}
|
||||
localStorage["t_count"] = JSON.stringify(qtabs.length);
|
||||
localStorage["tabs"] = JSON.stringify(tabs_to_save);
|
||||
for (var t = 0; t < 9999; t++){
|
||||
if (localStorage.getItem("t"+t) !== null){
|
||||
localStorage.removeItem("t"+t);
|
||||
}
|
||||
}
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
9
files_ForTesting/background.html
Normal file
@ -0,0 +1,9 @@
|
||||
<!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="../legacy.js"></script>
|
||||
<script type="text/javascript" src="../bg_ch.js"></script>
|
||||
<script type="text/javascript" src="../bg_ff.js"></script>
|
||||
</html>
|
43
files_ForTesting/manifest.json
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"default_locale": "en",
|
||||
"background": {
|
||||
"page": "background.html",
|
||||
"persistent": true
|
||||
},
|
||||
"name": "Tree Tabs",
|
||||
"description": "__MSG_extDesc__",
|
||||
"icons": {
|
||||
"128": "icons/128.png",
|
||||
"48": "icons/48.png",
|
||||
"38": "icons/24.png",
|
||||
"19": "icons/16.png",
|
||||
"16": "icons/16.png"
|
||||
},
|
||||
"permissions": [ "tabs", "sessions", "<all_urls>" ],
|
||||
|
||||
"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": {
|
||||
"page": "options.html",
|
||||
"open_in_tab": true
|
||||
},
|
||||
"version": "0.0.16"
|
||||
}
|
@ -3,6 +3,6 @@
|
||||
<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="../legacy.js"></script>
|
||||
<script type="text/javascript" src="../bg_ff.js"></script>
|
||||
</html>
|
@ -39,5 +39,5 @@
|
||||
"page": "options.html",
|
||||
"open_in_tab": true
|
||||
},
|
||||
"version": "0.0.16"
|
||||
"version": "1.1"
|
||||
}
|
8
files_opera/background.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!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="../legacy.js"></script>
|
||||
<script type="text/javascript" src="../bg_ch.js"></script>
|
||||
</html>
|
@ -3,7 +3,7 @@
|
||||
"minimum_opera_version": "42",
|
||||
"default_locale": "en",
|
||||
"background": {
|
||||
"scripts": [ "background.js" ],
|
||||
"page": "background.html",
|
||||
"persistent": true
|
||||
},
|
||||
"name": "Tree Tabs",
|
||||
@ -16,20 +16,6 @@
|
||||
"16": "icons/16.png"
|
||||
},
|
||||
"permissions": [ "tabs", "sessions", "<all_urls>" ],
|
||||
"commands": {
|
||||
"goto_tab_above": {
|
||||
"suggested_key": {
|
||||
"default": "Alt+1"
|
||||
},
|
||||
"description": "Go to tab above"
|
||||
},
|
||||
"goto_tab_below": {
|
||||
"suggested_key": {
|
||||
"default": "Alt+2"
|
||||
},
|
||||
"description": "Go to tab below"
|
||||
}
|
||||
},
|
||||
"sidebar_action": {
|
||||
"default_icon": {
|
||||
"19": "icons/16.png",
|
||||
@ -39,5 +25,5 @@
|
||||
"default_title": "Tree Tabs"
|
||||
},
|
||||
"options_page": "options.html",
|
||||
"version": "0.0.16"
|
||||
"version": "1.0"
|
||||
}
|
||||
|
8
files_vivaldi/background.html
Normal file
@ -0,0 +1,8 @@
|
||||
<!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="../legacy.js"></script>
|
||||
<script type="text/javascript" src="../bg_ch.js"></script>
|
||||
</html>
|
@ -2,7 +2,7 @@
|
||||
"manifest_version": 2,
|
||||
"default_locale": "en",
|
||||
"background": {
|
||||
"scripts": [ "background.js" ],
|
||||
"page": "background.html",
|
||||
"persistent": true
|
||||
},
|
||||
"name": "Tree Tabs",
|
||||
@ -15,20 +15,6 @@
|
||||
"16": "icons/16.png"
|
||||
},
|
||||
"permissions": [ "tabs", "sessions", "<all_urls>" ],
|
||||
"commands": {
|
||||
"goto_tab_above": {
|
||||
"suggested_key": {
|
||||
"default": "Alt+1"
|
||||
},
|
||||
"description": "Go to tab above"
|
||||
},
|
||||
"goto_tab_below": {
|
||||
"suggested_key": {
|
||||
"default": "Alt+2"
|
||||
},
|
||||
"description": "Go to tab below"
|
||||
}
|
||||
},
|
||||
"options_ui": {
|
||||
"page": "options.html",
|
||||
"open_in_tab": false
|
||||
|
253
legacy.js
Normal file
@ -0,0 +1,253 @@
|
||||
// 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/
|
||||
|
||||
function OldHashTab(tab){
|
||||
if (tabs[tab.id] == undefined){
|
||||
tabs[tab.id] = {ttid: "", hash: 0, h: 0, parent: tab.pinned ? "pin_list" : "tab_list", index: tab.index, expand: "n"};
|
||||
}
|
||||
var hash = 0;
|
||||
if (tab.url.length === 0){
|
||||
return 0;
|
||||
}
|
||||
for (var i = 0; i < tab.url.length; i++){
|
||||
hash = (hash << 5)-hash;
|
||||
hash = hash+tab.url.charCodeAt(i);
|
||||
hash |= 0;
|
||||
}
|
||||
tabs[tab.id].h = hash;
|
||||
}
|
||||
|
||||
|
||||
function LoadV015(retry){
|
||||
var loaded_options = {};
|
||||
for (var parameter in DefaultPreferences) {
|
||||
opt[parameter] = DefaultPreferences[parameter];
|
||||
}
|
||||
// set loaded options
|
||||
if (localStorage.getItem("current_options") !== null){
|
||||
loaded_options = JSON.parse(localStorage["current_options"]);
|
||||
}
|
||||
for (var parameter in opt) {
|
||||
if (loaded_options[parameter] != undefined && opt[parameter] != undefined){
|
||||
opt[parameter] = loaded_options[parameter];
|
||||
}
|
||||
}
|
||||
SavePreferences();
|
||||
if (localStorage.getItem("current_options") !== null){
|
||||
localStorage.removeItem("current_options");
|
||||
|
||||
}
|
||||
|
||||
chrome.tabs.query({windowType: "normal"}, function(qtabs){
|
||||
// create current tabs object
|
||||
qtabs.forEach(function(Tab){
|
||||
OldHashTab(Tab);
|
||||
});
|
||||
|
||||
var reference_tabs = {};
|
||||
var tabs_to_save = [];
|
||||
var tabs_matched = 0;
|
||||
|
||||
// compare saved tabs from storage to current session tabs, but can be skipped if set in options
|
||||
qtabs.forEach(function(Tab){
|
||||
for (var t = 0; t < 9999; t++){
|
||||
if (localStorage.getItem("t"+t) !== null){
|
||||
var LoadedTab = JSON.parse(localStorage["t"+t]);
|
||||
if (LoadedTab[1] === tabs[Tab.id].h && reference_tabs[LoadedTab[0]] == undefined){
|
||||
reference_tabs[LoadedTab[0]] = Tab.id;
|
||||
tabs[Tab.id].parent = LoadedTab[2];
|
||||
tabs[Tab.id].index = LoadedTab[3];
|
||||
tabs[Tab.id].expand = LoadedTab[4];
|
||||
tabs_matched++;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// replace parents tabIds to new ones, for that purpose reference_tabs was made before
|
||||
for (var tabId in tabs){
|
||||
if (reference_tabs[tabs[tabId].parent] != undefined){
|
||||
tabs[tabId].parent = reference_tabs[tabs[tabId].parent];
|
||||
}
|
||||
}
|
||||
|
||||
if (browserId == "F") {
|
||||
// append ids to firefox tabs
|
||||
qtabs.forEach(function(Tab){
|
||||
AppendTabTTId(Tab.id);
|
||||
});
|
||||
qtabs.forEach(function(Tab){
|
||||
tabs_to_save.push({id: Tab.id, ttid: tabs[tabId].ttid, parent: tabs[Tab.id].parent, index: tabs[Tab.id].index, expand: tabs[Tab.id].expand});
|
||||
});
|
||||
} else {
|
||||
// create new hashes
|
||||
qtabs.forEach(function(Tab){
|
||||
ChromeHashURL(Tab);
|
||||
});
|
||||
qtabs.forEach(function(Tab){
|
||||
tabs_to_save.push({id: Tab.id, hash: tabs[Tab.id].hash, parent: tabs[Tab.id].parent, index: tabs[Tab.id].index, expand: tabs[Tab.id].expand});
|
||||
});
|
||||
}
|
||||
localStorage["t_count"] = JSON.stringify(qtabs.length);
|
||||
localStorage["tabs"] = JSON.stringify(tabs_to_save);
|
||||
for (var t = 0; t < 9999; t++){
|
||||
if (localStorage.getItem("t"+t) !== null){
|
||||
localStorage.removeItem("t"+t);
|
||||
}
|
||||
}
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
function FirefoxLoadV100(retry) {
|
||||
chrome.windows.getAll({windowTypes: ["normal"], populate: true}, function(w) {
|
||||
|
||||
var refTabs = {};
|
||||
var tabs_matched = 0;
|
||||
var tabs_count = 0;
|
||||
for (var wIndex = 0; wIndex < w.length; wIndex++) {
|
||||
tabs_count += w[wIndex].tabs.length;
|
||||
}
|
||||
|
||||
// load tabs and windows from hdd
|
||||
var LoadedWindows = LoadData("windows", []);
|
||||
var LoadedTabs = LoadData("tabs", []);
|
||||
|
||||
// if loaded tabs mismatch by 50%, then try to load back
|
||||
if (LoadedTabs.length < tabs_count*0.5 || retry > 0) {
|
||||
LoadedTabs = LoadData("tabs_BAK"+retry, []);
|
||||
}
|
||||
// if loaded windows mismatch, then try to load back
|
||||
if (LoadedWindows.length < w.length || retry > 0) {
|
||||
LoadedWindows = LoadData("windows_BAK"+retry, []);
|
||||
}
|
||||
// CACHED COUNTS AND STUFF
|
||||
var lastWinId = w[w.length-1].id;
|
||||
var lastTabId = w[w.length-1].tabs[w[w.length-1].tabs.length-1].id;
|
||||
var LoadedWinCount = LoadedWindows.length;
|
||||
var LoadedTabsCount = LoadedTabs.length;
|
||||
var WinCount = w.length;
|
||||
|
||||
for (var wIndex = 0; wIndex < WinCount; wIndex++) {
|
||||
let winIndex = wIndex;
|
||||
let winId = w[winIndex].id;
|
||||
let tabsCount = w[winIndex].tabs.length;
|
||||
|
||||
let win = Promise.resolve(browser.sessions.getWindowValue(winId, "TTId")).then(function(TTId) { // LOAD TTID FROM FIREFOX GET WINDOW VALUE
|
||||
if (TTId != undefined) {
|
||||
windows[winId] = {ttid: 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: {}};
|
||||
} 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: {}};
|
||||
}
|
||||
for (var tIndex = 0; tIndex < tabsCount; tIndex++) {
|
||||
|
||||
let tabIndex = tIndex;
|
||||
let tabId = w[winIndex].tabs[tabIndex].id;
|
||||
let tabPinned = w[winIndex].tabs[tabIndex].pinned;
|
||||
|
||||
let tab = Promise.resolve(browser.sessions.getTabValue(tabId, "TTId")).then(function(TTId) { // LOAD TTID FROM FIREFOX GET TAB VALUE
|
||||
if (TTId != undefined) {
|
||||
tabs[tabId] = {ttid: TTId, parent_ttid: "", parent: tabPinned ? "pin_list" : "tab_list", index: tabIndex, expand: "n"};
|
||||
} else {
|
||||
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 (tabId == lastTabId && winId == lastWinId) {
|
||||
for (var ThisSessonWinId in windows) {
|
||||
if (windows[ThisSessonWinId].ttid != ""){
|
||||
for (var LwIndex = 0; LwIndex < LoadedWinCount; LwIndex++) {
|
||||
if (LoadedWindows[LwIndex].ttid == windows[ThisSessonWinId].ttid) {
|
||||
if (LoadedWindows[LwIndex].group_bar) { windows[ThisSessonWinId].group_bar = LoadedWindows[LwIndex].group_bar; }
|
||||
if (LoadedWindows[LwIndex].search_filter) { windows[ThisSessonWinId].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[ThisSessonWinId].active_group = LoadedWindows[LwIndex].active_group; }
|
||||
if (Object.keys(LoadedWindows[LwIndex].groups).length > 0) { windows[ThisSessonWinId].groups = Object.assign({}, LoadedWindows[LwIndex].groups); }
|
||||
if (Object.keys(LoadedWindows[LwIndex].folders).length > 0) { windows[ThisSessonWinId].folders = Object.assign({}, LoadedWindows[LwIndex].folders); }
|
||||
LoadedWindows[LwIndex].ttid = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AppendWinTTId(parseInt(ThisSessonWinId));
|
||||
}
|
||||
}
|
||||
// OK, DONE WITH WINDOWS, START TABS LOOP
|
||||
for (var ThisSessonTabId in tabs) {
|
||||
if (tabs[ThisSessonTabId].ttid != ""){
|
||||
for (var LtabIndex = 0; LtabIndex < LoadedTabsCount; LtabIndex++) {
|
||||
if (LoadedTabs[LtabIndex].ttid == tabs[ThisSessonTabId].ttid) {
|
||||
refTabs[LoadedTabs[LtabIndex].id] = ThisSessonTabId;
|
||||
if (LoadedTabs[LtabIndex].parent) { tabs[ThisSessonTabId].parent = LoadedTabs[LtabIndex].parent; }
|
||||
if (LoadedTabs[LtabIndex].index) { tabs[ThisSessonTabId].index = LoadedTabs[LtabIndex].index; }
|
||||
if (LoadedTabs[LtabIndex].expand) { tabs[ThisSessonTabId].expand = LoadedTabs[LtabIndex].expand; }
|
||||
LoadedTabs[LtabIndex].ttid = "";
|
||||
tabs_matched++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AppendTabTTId(parseInt(ThisSessonTabId));
|
||||
}
|
||||
}
|
||||
// OK, DONE, NOW REPLACE OLD PARENTS IDS WITH THIS SESSION IDS
|
||||
for (var ThisSessonTabId in tabs) {
|
||||
if (refTabs[tabs[ThisSessonTabId].parent] != undefined) {
|
||||
tabs[ThisSessonTabId].parent = refTabs[tabs[ThisSessonTabId].parent];
|
||||
}
|
||||
}
|
||||
// OK, SAME THING FOR ACTIVE TABS IN GROUPS
|
||||
|
||||
for (var ThisSessonWinId in windows) {
|
||||
for (var group in windows[ThisSessonWinId].groups) {
|
||||
if (refTabs[windows[ThisSessonWinId].groups[group].activetab]) {
|
||||
windows[ThisSessonWinId].groups[group].activetab = refTabs[windows[ThisSessonWinId].groups[group].activetab];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (localStorage.getItem("t_count") !== null){
|
||||
localStorage.removeItem("t_count");
|
||||
}
|
||||
if (localStorage.getItem("tabs_BAK1") !== null){
|
||||
localStorage.removeItem("tabs_BAK1");
|
||||
}
|
||||
if (localStorage.getItem("tabs_BAK2") !== null){
|
||||
localStorage.removeItem("tabs_BAK2");
|
||||
}
|
||||
if (localStorage.getItem("tabs_BAK3") !== null){
|
||||
localStorage.removeItem("tabs_BAK3");
|
||||
}
|
||||
if (localStorage.getItem("tabs") !== null){
|
||||
localStorage.removeItem("tabs");
|
||||
}
|
||||
if (localStorage.getItem("windows") !== null){
|
||||
localStorage.removeItem(windows);
|
||||
}
|
||||
|
||||
|
||||
// will try to find tabs for 3 times
|
||||
if (opt.skip_load == true || retry > 2 || (tabs_matched > tabs_count*0.5)) {
|
||||
|
||||
running = true;
|
||||
FirefoxAutoSaveData();
|
||||
FirefoxListeners();
|
||||
} else {
|
||||
setTimeout(function() {FirefoxLoadTabs(retry+1);}, 2000);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
@ -39,5 +39,5 @@
|
||||
"page": "options.html",
|
||||
"open_in_tab": true
|
||||
},
|
||||
"version": "1.0"
|
||||
"version": "1.1"
|
||||
}
|
35
options.html
@ -54,6 +54,21 @@
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="field" id="field_groups">
|
||||
<legend class="label" id="options_groups"></legend>
|
||||
<table style="display:vinline-block;">
|
||||
<tr>
|
||||
<td><input type="checkbox" class="opt_checkbox bg_opt" id="groups_toolbar_default"></input></td>
|
||||
<td style="position:relative;left:2px;width:3px;">-</td>
|
||||
<td class="label" id="options_groups_toolbar_default"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="opt_checkbox bg_opt" id="show_counter_groups"></input></td>
|
||||
<td style="position:relative;left:2px;width:3px;">-</td>
|
||||
<td class="label" id="options_show_counter_groups"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="field" id="field_tabs">
|
||||
<legend class="label" id="options_tabs"></legend>
|
||||
@ -98,6 +113,11 @@
|
||||
<td style="position:relative;top:-5px;left:2px;width:3px;">-</td>
|
||||
<td class="label" id="options_promote_children"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="opt_checkbox bg_opt" id="promote_children_in_first_child"></input></td>
|
||||
<td style="position:relative;left:2px;width:3px;">-</td>
|
||||
<td class="label" id="options_promote_children_in_first_child"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="position:relative;top:-1px;"><input type="checkbox" class="opt_checkbox bg_opt" id="skip_load"></input></td>
|
||||
<td style="position:relative;top:-1px;left:2px;width:3px;">-</td>
|
||||
@ -108,6 +128,21 @@
|
||||
<td style="position:relative;left:2px;width:3px;">-</td>
|
||||
<td class="label" id="options_max_tree_drag_drop"></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<tr>
|
||||
<td><input type="checkbox" class="opt_checkbox bg_opt" id="show_counter_tabs"></input></td>
|
||||
<td style="position:relative;left:2px;width:3px;">-</td>
|
||||
<td class="label" id="options_show_counter_tabs"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="checkbox" class="opt_checkbox bg_opt" id="show_counter_tabs_hints"></input></td>
|
||||
<td style="position:relative;left:2px;width:3px;">-</td>
|
||||
<td class="label" id="options_show_counter_tabs_hints"></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<ul>
|
||||
|
@ -305,10 +305,17 @@ function SetEvents() {
|
||||
});
|
||||
|
||||
// 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", 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", function(event) {
|
||||
chrome.runtime.sendMessage({command: "reload_sidebar"});
|
||||
});
|
||||
|
||||
// options that need a total reload
|
||||
$(document).on("click", "#groups_toolbar_default", function(event) {
|
||||
chrome.runtime.sendMessage({command: "reload"});
|
||||
chrome.runtime.sendMessage({command: "reload_sidebar"});
|
||||
location.reload();
|
||||
});
|
||||
|
||||
// set dropdown menu options
|
||||
$("#append_child_tab, #append_child_tab_after_limit, #after_closing_active_tab, #append_orphan_tab").change(function() {
|
||||
opt[this.id] = $(this).val();
|
||||
|
@ -14,6 +14,9 @@ function LoadTheme(themeName) {
|
||||
$("#toolbar").html(SelectedTheme.toolbar);
|
||||
$("#toolbar_unused_buttons").html(SelectedTheme.unused_buttons);
|
||||
|
||||
if (browserId == "F") {
|
||||
$(".button#button_load_bak1, .button#button_load_bak2, .button#button_load_bak3").remove();
|
||||
}
|
||||
// expand toolbar options
|
||||
SelectedTheme.ToolbarShow = $("#show_toolbar")[0].checked = SelectedTheme.ToolbarShow;
|
||||
$("#field_show_toolbar").css({"height": $("#show_toolbar")[0].checked ? "" : "6"});
|
||||
|
@ -5,7 +5,6 @@
|
||||
// ********** CHROME EVENTS ***************
|
||||
|
||||
function StartChromeListeners(){
|
||||
|
||||
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
|
||||
if (message.command == "drag_drop") {
|
||||
DragAndDrop.DragNodeClass = message.DragNodeClass;
|
||||
@ -15,9 +14,6 @@ function StartChromeListeners(){
|
||||
DragAndDrop.ComesFromWindowId = message.ComesFromWindowId;
|
||||
DragAndDrop.Depth = message.Depth;
|
||||
}
|
||||
if (message.command == "drag_dropped") {
|
||||
DragAndDrop.Dropped = message.Dropped;
|
||||
}
|
||||
if (message.command == "reload_sidebar") {
|
||||
window.location.reload();
|
||||
}
|
||||
@ -42,12 +38,10 @@ function StartChromeListeners(){
|
||||
if (message.windowId == CurrentWindowId) {
|
||||
switch(message.command) {
|
||||
case "tab_created":
|
||||
|
||||
// if set to treat unparented tabs as active tab's child
|
||||
if (opt.append_orphan_tab == "as_child" && message.tab.openerTabId == undefined && $(".active:visible")[0]) {
|
||||
message.tab.openerTabId = $(".active:visible")[0].id;
|
||||
}
|
||||
|
||||
// child case
|
||||
if (message.tab.openerTabId) {
|
||||
// append to tree
|
||||
@ -59,7 +53,6 @@ function StartChromeListeners(){
|
||||
AppendTab({ tab: message.tab, ParentId: message.tab.openerTabId, Append: true, Scroll: true });
|
||||
}
|
||||
}
|
||||
|
||||
// if reached depth limit of the tree
|
||||
if (opt.max_tree_depth > 0 && $("#"+message.tab.openerTabId).parents(".tab").length >= opt.max_tree_depth) {
|
||||
if (opt.append_child_tab_after_limit == "after") {
|
||||
@ -72,7 +65,6 @@ function StartChromeListeners(){
|
||||
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") {
|
||||
@ -109,12 +101,20 @@ function StartChromeListeners(){
|
||||
RefreshGUI();
|
||||
break;
|
||||
case "tab_detached":
|
||||
if (opt.promote_children && $("#"+message.tabId).is(".tab")) {
|
||||
$("#ch"+message.tabId).children().insertAfter($("#"+message.tabId));
|
||||
} else {
|
||||
$("#"+message.tabId).find(".tab").each(function() {
|
||||
RemoveTabFromList(this.id);
|
||||
});
|
||||
if ($(".tab#"+message.tabId)[0]) {
|
||||
if (opt.promote_children == true) {
|
||||
if (opt.promote_children_in_first_child == true && $("#ch"+message.tabId).children().length > 1) {
|
||||
let FirstChild = $("#ch"+message.tabId).children()[0];
|
||||
$(FirstChild).insertAfter($("#"+message.tabId));
|
||||
$("#ch"+FirstChild.id).append($("#ch"+message.tabId).children());
|
||||
} else {
|
||||
$("#ch"+message.tabId).children().insertAfter($("#"+message.tabId));
|
||||
}
|
||||
} else {
|
||||
$("#ch"+message.tabId).find(".tab").each(function() {
|
||||
RemoveTabFromList(this.id);
|
||||
});
|
||||
}
|
||||
}
|
||||
RemoveTabFromList(message.tabId);
|
||||
setTimeout(function() { schedule_update_data++; },300);
|
||||
@ -122,10 +122,16 @@ function StartChromeListeners(){
|
||||
break;
|
||||
case "tab_removed":
|
||||
if ($(".tab#"+message.tabId)[0]) {
|
||||
if (opt.promote_children) {
|
||||
$("#ch"+message.tabId).children().insertAfter($("#"+message.tabId));
|
||||
if (opt.promote_children == true) {
|
||||
if (opt.promote_children_in_first_child == true && $("#ch"+message.tabId).children().length > 1) {
|
||||
let FirstChild = $("#ch"+message.tabId).children()[0];
|
||||
$(FirstChild).insertAfter($("#"+message.tabId));
|
||||
$("#ch"+FirstChild.id).append($("#ch"+message.tabId).children());
|
||||
} else {
|
||||
$("#ch"+message.tabId).children().insertAfter($("#"+message.tabId));
|
||||
}
|
||||
} else {
|
||||
$("#"+message.tabId).find(".tab").each(function() {
|
||||
$("#ch"+message.tabId).find(".tab").each(function() {
|
||||
chrome.tabs.remove(parseInt(this.id));
|
||||
});
|
||||
}
|
||||
@ -143,12 +149,15 @@ function StartChromeListeners(){
|
||||
break;
|
||||
case "tab_updated":
|
||||
if (message.changeInfo.favIconUrl != undefined || message.changeInfo.url != undefined) {
|
||||
setTimeout(function() { GetFaviconAndTitle(message.tabId); },100);
|
||||
setTimeout(function() {
|
||||
GetFaviconAndTitle(message.tabId, true);
|
||||
},100);
|
||||
}
|
||||
if (message.changeInfo.title != undefined) {
|
||||
setTimeout(function() { GetFaviconAndTitle(message.tabId); },1000);
|
||||
setTimeout(function() {
|
||||
GetFaviconAndTitle(message.tabId, true);
|
||||
},1000);
|
||||
}
|
||||
|
||||
if (message.changeInfo.audible != undefined || message.changeInfo.mutedInfo != undefined) {
|
||||
RefreshMediaIcon(message.tabId);
|
||||
}
|
||||
|
@ -38,25 +38,20 @@ function SetDragAndDropEvents() {
|
||||
// SET FOLDER DRAG SOURCE
|
||||
$(document).on("dragstart", ".folder_header", function(event) {
|
||||
DragAndDrop.DragNodeClass = "folder";
|
||||
DragAndDrop.Dropped = false;
|
||||
event.stopPropagation();
|
||||
event.originalEvent.dataTransfer.setDragImage(document.getElementById("DragImage"), 0, 0);
|
||||
event.originalEvent.dataTransfer.setData("text", "");
|
||||
|
||||
|
||||
DragAndDrop.ComesFromWindowId = CurrentWindowId;
|
||||
DragAndDrop.SelectedTabsIds.splice(0, DragAndDrop.SelectedTabsIds.length);
|
||||
DragAndDrop.TabsIds.splice(0, DragAndDrop.TabsIds.length);
|
||||
DragAndDrop.Parents.splice(0, DragAndDrop.Parents.length);
|
||||
|
||||
// chrome.runtime.sendMessage({command: "drag_drop", DragNodeClass: "tab", SelectedTabsIds: DragAndDrop.SelectedTabsIds, TabsIds: DragAndDrop.TabsIds, Parents: DragAndDrop.Parents, ComesFromWindowId: CurrentWindowId, Depth: DragAndDrop.Depth});
|
||||
});
|
||||
|
||||
|
||||
// SET TAB DRAG SOURCE
|
||||
$(document).on("dragstart", ".tab_header", function(event) {
|
||||
DragAndDrop.DragNodeClass = "tab";
|
||||
DragAndDrop.Dropped = false;
|
||||
event.stopPropagation();
|
||||
event.originalEvent.dataTransfer.setDragImage(document.getElementById("DragImage"), 0, 0);
|
||||
event.originalEvent.dataTransfer.setData("text", "");
|
||||
@ -80,14 +75,14 @@ function SetDragAndDropEvents() {
|
||||
DragAndDrop.Parents.splice(0, DragAndDrop.Parents.length);
|
||||
|
||||
DragAndDrop.Depth = 0;
|
||||
$(".selected:visible").find(".tab").each(function() {
|
||||
if ($(this).parents(".tab").length > DragAndDrop.Depth) { DragAndDrop.Depth = $(this).parents(".tab").length; }
|
||||
$(".selected:visible").find(".pin, .tab").each(function() {
|
||||
if ($(this).parents(".pin, .tab").length > DragAndDrop.Depth) { DragAndDrop.Depth = $(this).parents(".pin, .tab").length; }
|
||||
});
|
||||
DragAndDrop.Depth -= $(this).parents(".tab").length-1;
|
||||
DragAndDrop.Depth -= $(this).parents(".pin, .tab").length-1;
|
||||
if (DragAndDrop.Depth < 0) {
|
||||
DragAndDrop.Depth = 0;
|
||||
}
|
||||
|
||||
console.log(DragAndDrop.Depth);
|
||||
$(".selected:visible").each(function() {
|
||||
DragAndDrop.SelectedTabsIds.push(parseInt(this.id));
|
||||
DragAndDrop.TabsIds.push(parseInt(this.id));
|
||||
@ -107,29 +102,47 @@ function SetDragAndDropEvents() {
|
||||
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
|
||||
});
|
||||
|
||||
// SET DROP TARGET WHEN ENTERING PINS AND TABS
|
||||
$(document).on("dragenter", ".tab>.drag_entered_top:not(.highlighted_drop_target), .tab>.drag_entered_bottom:not(.highlighted_drop_target), .tab>.drag_enter_center:not(.highlighted_drop_target)", function(event) {
|
||||
// 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();
|
||||
if ($(".selected:visible").find($(this)).length > 0 || DragAndDrop.DragNodeClass != "tab") { return; }
|
||||
if (opt.max_tree_drag_drop && opt.max_tree_depth >= 0) {
|
||||
if ($(this).is(".drag_enter_center")) {
|
||||
if (opt.max_tree_depth == 0) { return; }
|
||||
if ($(this).parents(".tab").length + DragAndDrop.Depth > opt.max_tree_depth) { return; }
|
||||
} else {
|
||||
if (DragAndDrop.DragNodeClass == "tab") {
|
||||
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
|
||||
$(this).addClass("highlighted_drop_target");
|
||||
}
|
||||
});
|
||||
|
||||
// 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();
|
||||
if ($(".selected:visible").find($(this)).length == 0 && DragAndDrop.DragNodeClass == "tab") {
|
||||
if (opt.max_tree_drag_drop && opt.max_tree_depth >= 0) {
|
||||
if ($(this).parents(".tab").length + DragAndDrop.Depth > opt.max_tree_depth+1) { 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) {
|
||||
event.stopPropagation();
|
||||
if ($(".selected:visible").find($(this)).length == 0 && DragAndDrop.DragNodeClass == "tab" && opt.max_tree_depth != 0) {
|
||||
if (opt.max_tree_drag_drop) {
|
||||
if (opt.max_tree_depth == 0) { 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");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 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();
|
||||
if (DragAndDrop.DragNodeClass == "group") { return; }
|
||||
// if (/* $(".selected:visible").find($(this)).length > 0 || */ DragAndDrop.DragNodeClass != "folder") { return; }
|
||||
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
|
||||
$(this).addClass("highlighted_drop_target");
|
||||
if (DragAndDrop.DragNodeClass != "group") {
|
||||
// if (/* $(".selected:visible").find($(this)).length > 0 || */ DragAndDrop.DragNodeClass != "folder") { return; }
|
||||
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
|
||||
$(this).addClass("highlighted_drop_target");
|
||||
}
|
||||
});
|
||||
|
||||
// SET DROP TARGET, PIN_LIST, TAB_LIST, GROUP OR GROUP_BUTTON
|
||||
@ -157,15 +170,10 @@ function SetDragAndDropEvents() {
|
||||
|
||||
// DROP
|
||||
$(document).on("drop", "*", function(event) {
|
||||
DragAndDrop.Dropped = true;
|
||||
chrome.runtime.sendMessage({command: "drag_dropped", DragAndDrop: true});
|
||||
event.stopPropagation();
|
||||
|
||||
if (DragAndDrop.ComesFromWindowId == CurrentWindowId && MouseHoverOver != "" && $(".highlighted_drop_target")[0] != undefined) {
|
||||
if (DragAndDrop.ComesFromWindowId == CurrentWindowId /* && ($(window).width() > event.clientX || $(window).height() > event.clientY) */) {
|
||||
DropToTarget($(".highlighted_drop_target"));
|
||||
}
|
||||
|
||||
if (DragAndDrop.ComesFromWindowId != CurrentWindowId && $(".highlighted_drop_target")[0] != undefined) {
|
||||
} else {
|
||||
$(".selected").addClass("selected_frozen").removeClass("selected");
|
||||
let target = $(".highlighted_drop_target");
|
||||
let counter = DragAndDrop.TabsIds.length;
|
||||
@ -199,11 +207,14 @@ function SetDragAndDropEvents() {
|
||||
|
||||
// DETACH
|
||||
$(document).on("dragend", ".tab_header", function(event) {
|
||||
setTimeout(function() {
|
||||
if (DragAndDrop.Dropped == false && MouseHoverOver == "" && $(".highlighted_drop_target")[0] == undefined) {
|
||||
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())))) {
|
||||
DetachTabs(DragAndDrop.TabsIds);
|
||||
}
|
||||
},1100);
|
||||
if (browserId != "F" && (event.pageX < 0 || event.pageX > $(window).width() || event.pageY < 0 || event.pageY > $(window).height())) {
|
||||
DetachTabs(DragAndDrop.TabsIds);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -303,6 +314,28 @@ function DropToTarget(TargetNode) {
|
||||
|
||||
$(".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();
|
||||
DragAndDrop.timeout = false;
|
||||
RefreshGUI();
|
||||
|
@ -5,7 +5,7 @@
|
||||
// ********** GLOBAL VARIABLES FOR BACKGROUND, OPTIONS AND SIDEBAR ***************
|
||||
|
||||
|
||||
var hold = true;
|
||||
var running = false;
|
||||
var schedule_save = 0;
|
||||
var schedule_update_indexes = 0;
|
||||
var schedule_rearrange_tabs = 0;
|
||||
@ -15,7 +15,7 @@ var tabs = {};
|
||||
var MouseHoverOver = "";
|
||||
|
||||
|
||||
var DragAndDrop = {timeout: false, DragNode: undefined, DragNodeClass: "", Dropped: true, SelectedTabsIds: [], TabsIds: [], Parents: [], ComesFromWindowId: 0, Depth: 0};
|
||||
var DragAndDrop = {timeout: false, DragNode: undefined, DragNodeClass: "", SelectedTabsIds: [], TabsIds: [], Parents: [], ComesFromWindowId: 0, Depth: 0};
|
||||
var DropTargetsInFront = false;
|
||||
|
||||
|
||||
@ -85,20 +85,27 @@ var DefaultToolbar =
|
||||
'<div class=button id=button_import_bak><div class=button_img></div></div>'+
|
||||
'<div class=button id=button_import_merge_bak><div class=button_img></div></div>'+
|
||||
'<div class=button id=button_export_bak><div class=button_img></div></div>'+
|
||||
(browserId != "F" ?
|
||||
'<div class=button id=button_load_bak1><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>'+
|
||||
|
||||
var DefaultTheme = { "ToolbarShow": true, "ColorsSet": {}, "TabsSizeSetNumber": 2, "theme_name": "untitled", "theme_version": 2, "toolbar": DefaultToolbar, "unused_buttons": "" };
|
||||
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, "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 };
|
||||
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 };
|
||||
|
||||
|
||||
|
||||
|
||||
// ******************* 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 {
|
||||
@ -180,7 +187,7 @@ function SavePreferences() {
|
||||
localStorage["preferences"] = JSON.stringify(opt);
|
||||
setTimeout(function() {
|
||||
chrome.runtime.sendMessage({command: "reload_options"});
|
||||
},200);
|
||||
}, 200);
|
||||
}
|
||||
function ShowOpenFileDialog(id, extension) {
|
||||
let body = document.getElementById("body");
|
||||
|
@ -57,7 +57,7 @@ function GenerateNewGroupID(){
|
||||
|
||||
function AddNewGroup(p) {
|
||||
var newId = GenerateNewGroupID();
|
||||
bggroups[newId] = { id: newId, index: 0, activetab: 0, name: (p.name ? p.name : caption_noname_group), font: (p.font ? p.font : "") };
|
||||
bggroups[newId] = { id: newId, index: 0, activetab: 0, activetab_ttid: "", name: (p.name ? p.name : caption_noname_group), font: (p.font ? p.font : "") };
|
||||
AppendGroupToList(newId, bggroups[newId].name, bggroups[newId].font);
|
||||
UpdateBgGroupsOrder();
|
||||
return newId;
|
||||
@ -111,14 +111,13 @@ function SetActiveGroup(groupId, switch_to_active_in_group, scroll_to_active) {
|
||||
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){
|
||||
if (scroll_to_active && $("#"+groupId+" .active")[0]){
|
||||
ScrollToTab($("#"+groupId+" .active")[0].id);
|
||||
}
|
||||
if (groupId == "tab_list" && $("#button_edit_group")[0]) {
|
||||
if (groupId == "tab_list") {
|
||||
$("#button_remove_group, #button_edit_group").addClass("disabled");
|
||||
} else {
|
||||
$("#button_remove_group, #button_edit_group").removeClass("disabled");
|
||||
@ -127,8 +126,11 @@ function SetActiveGroup(groupId, switch_to_active_in_group, scroll_to_active) {
|
||||
}
|
||||
|
||||
function SetActiveTabInActiveGroup(tabId) {
|
||||
if (bggroups[active_group] != undefined) {
|
||||
bggroups[active_group].activetab = parseInt(tabId);
|
||||
if ($("#"+tabId).parents(".group")[0] && bggroups[active_group] != 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});
|
||||
}
|
||||
}
|
||||
@ -224,7 +226,6 @@ function SetGroupEvents() {
|
||||
// show/hide groups toolbar
|
||||
$(document).on("mousedown", "#button_groups_toolbar_hide", function(event) {
|
||||
if (event.button == 0) {
|
||||
// $("#toolbar_groups").toggleClass("hidden");
|
||||
$("#toolbar_groups").toggleClass("hidden");
|
||||
if ($("#toolbar_groups").is(".hidden")) {
|
||||
$("#toolbar_groups").css({"width": "0px", "border-right": "none"});
|
||||
@ -264,6 +265,16 @@ function SetGroupEvents() {
|
||||
$("#"+PickColor).css({"background-color": $("#color_picker")[0].value});
|
||||
});
|
||||
|
||||
|
||||
// edit group
|
||||
$(document).on("dblclick", ".group_button:not(#_tab_list)", function(event) {
|
||||
if (event.button == 0) {
|
||||
ShowGroupEditWindow((this.id).substr(1));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// scroll groups
|
||||
// $(document).on("mousedown", "#scroll_group_up, #scroll_group_down", function(event) {
|
||||
// IOKeys.LMB = true;
|
||||
|
@ -43,15 +43,20 @@ function RefreshGUI() {
|
||||
$("#toolbar_groups").css({ "top": $("#toolbar").outerHeight() + $("#pin_list")[0].getBoundingClientRect().height, "height": $(window).height() - $("#toolbar").outerHeight() - $("#pin_list")[0].getBoundingClientRect().height});
|
||||
|
||||
$(".group_title").each(function(){
|
||||
$(this)[0].innerText = (bggroups[(this.id).substr(4)] ? bggroups[(this.id).substr(4)].name : caption_noname_group) + " (" + $("#" + (this.id).substr(4) ).children().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 + " (" + $("#tab_list").children().length + ")";
|
||||
$("#_gtetab_list")[0].innerText = caption_ungrouped_group + (opt.show_counter_groups ? " (" + $("#tab_list .tab").length + ")" : "");
|
||||
|
||||
$(".group_button").each(function(){
|
||||
$(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() });
|
||||
|
||||
// $(".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
|
||||
@ -98,41 +103,40 @@ function RefreshMediaIcon(tabId) {
|
||||
|
||||
// Vivaldi does not have changeInfo.audible listener, this is my own implementation, hopefully this will not affect performance too much
|
||||
function VivaldiRefreshMediaIcons() {
|
||||
chrome.tabs.query({currentWindow: true}, function(tabs) {
|
||||
$(".audible, .muted").removeClass("audible").removeClass("muted");
|
||||
let tc = tabs.length;
|
||||
for (var ti = 0; ti < tc; ti++) {
|
||||
if (tabs[ti].audible) {
|
||||
$("#" + tabs[ti].id).addClass("audible");
|
||||
setInterval(function() {
|
||||
chrome.tabs.query({currentWindow: true}, function(tabs) {
|
||||
$(".audible, .muted").removeClass("audible").removeClass("muted");
|
||||
let tc = tabs.length;
|
||||
for (var ti = 0; ti < tc; ti++) {
|
||||
if (tabs[ti].audible) {
|
||||
$("#" + tabs[ti].id).addClass("audible");
|
||||
}
|
||||
if (tabs[ti].mutedInfo.muted) {
|
||||
$("#" + tabs[ti].id).addClass("muted");
|
||||
}
|
||||
}
|
||||
if (tabs[ti].mutedInfo.muted) {
|
||||
$("#" + tabs[ti].id).addClass("muted");
|
||||
}
|
||||
}
|
||||
});
|
||||
setTimeout(function() {
|
||||
VivaldiRefreshMediaIcons();
|
||||
});
|
||||
}, 1400);
|
||||
}
|
||||
|
||||
|
||||
function GetFaviconAndTitle(tabId) {
|
||||
function GetFaviconAndTitle(tabId, addCounter) {
|
||||
if ($("#" + tabId)[0]) {
|
||||
chrome.tabs.get(parseInt(tabId), function(tab) {
|
||||
if (tab){
|
||||
var title = tab.title ? tab.title : tab.url;
|
||||
let title = tab.title ? tab.title : tab.url;
|
||||
if (tab.status == "complete") {
|
||||
$("#" + tabId).removeClass("loading");
|
||||
// change title
|
||||
$("#tab_title" + tab.id)[0].textContent = title;
|
||||
$("#tab_header" + tab.id).attr("title", title);
|
||||
$("#"+tabId).data("title", title);
|
||||
|
||||
// compatibility with various Tab suspender extensions
|
||||
if (tab.favIconUrl != undefined && tab.favIconUrl.match("data:image/png;base64") != null) {
|
||||
$("#tab_header" + tab.id).css({ "background-image": "url(" + tab.favIconUrl + ")" });
|
||||
} else {
|
||||
// case for internal pages, favicons don't have access, but can be loaded from url
|
||||
if (tab.url.match("opera://|vivaldi://|browser://|chrome://|chrome-extension://|about:") != null) {
|
||||
if (tab.url.match("opera://|vivaldi://|browser://|chrome://|chrome-extension://") != null) {
|
||||
$("#tab_header" + tab.id).css({ "background-image": "url(chrome://favicon/" + tab.url + ")" });
|
||||
} else {
|
||||
// change favicon
|
||||
@ -142,7 +146,8 @@ function GetFaviconAndTitle(tabId) {
|
||||
$("#tab_header" + tab.id).css({ "background-image": "url(" + tab.favIconUrl + ")" });
|
||||
};
|
||||
img.onerror = function() {
|
||||
$("#tab_header" + tab.id).css({ "background-image": "url(chrome://favicon/" + tab.url + ")" });
|
||||
$("#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": "url(" + tab.url + ")" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -153,10 +158,15 @@ function GetFaviconAndTitle(tabId) {
|
||||
title = tab.title ? tab.title : caption_loading;
|
||||
$("#tab_title" + tab.id)[0].textContent = title;
|
||||
$("#tab_header" + tab.id).attr("title", title);
|
||||
$("#"+tabId).data("title", title);
|
||||
setTimeout(function() {
|
||||
if ($("#" + tabId)[0]) GetFaviconAndTitle(tabId);
|
||||
if ($("#" + tabId)[0]) GetFaviconAndTitle(tabId, addCounter);
|
||||
}, 1000);
|
||||
}
|
||||
if (addCounter) {
|
||||
RefreshTabCounter(tabId && (opt.show_counter_tabs || opt.show_counter_tabs_hints));
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -170,8 +180,38 @@ function RefreshExpandStates() {
|
||||
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 {
|
||||
$(this).parent().removeClass("o").removeClass("c").addClass("n");
|
||||
if ($("#tab_title"+$(this).parent()[0].id)[0]) {
|
||||
$("#tab_title"+$(this).parent()[0].id)[0].textContent = $(this).parent().data("title");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function RefreshTabCounter(tabId) {
|
||||
if ($("#"+tabId).data("title")) {
|
||||
if (opt.show_counter_tabs) {
|
||||
if ($(".c#"+tabId+", .o#"+tabId)[0]) {
|
||||
$("#tab_title"+tabId)[0].textContent = $("#"+tabId).data("title") + " ("+$("#ch"+tabId+" .tab").length+")";
|
||||
} 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", $("#"+tabId).data("title") + " ("+$("#ch"+tabId+" .tab").length+")");
|
||||
} else {
|
||||
$("#tab_header"+tabId).attr("title", $("#"+tabId).data("title"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
// ********** TABS FUNCTIONS ***************
|
||||
|
||||
async function UpdateData() {
|
||||
setTimeout(function() {
|
||||
setInterval(function() {
|
||||
if (schedule_update_data > 1) {schedule_update_data = 1;}
|
||||
if (schedule_update_data > 0) {
|
||||
$(".pin").each(function() {
|
||||
@ -32,13 +32,11 @@ async function UpdateData() {
|
||||
});
|
||||
schedule_update_data--;
|
||||
}
|
||||
UpdateData();
|
||||
},1000);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function RearrangeBrowserTabsCheck() {
|
||||
setTimeout(function() {
|
||||
RearrangeBrowserTabsCheck();
|
||||
setInterval(function() {
|
||||
if (opt.syncro_tabbar_tabs_order) {
|
||||
if (schedule_rearrange_tabs > 1) {schedule_rearrange_tabs = 1;}
|
||||
if (schedule_rearrange_tabs > 0) {
|
||||
@ -47,7 +45,7 @@ function RearrangeBrowserTabsCheck() {
|
||||
schedule_rearrange_tabs--;
|
||||
}
|
||||
}
|
||||
},1000);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
async function RearrangeBrowserTabs(tabIds, tabIndex) {
|
||||
@ -56,7 +54,9 @@ async function RearrangeBrowserTabs(tabIds, tabIndex) {
|
||||
if (tab && tabIndex != tab.index) {
|
||||
chrome.tabs.move(tabIds[tabIndex], {index: tabIndex});
|
||||
}
|
||||
RearrangeBrowserTabs( tabIds, (tabIndex-1) );
|
||||
setTimeout(function() {
|
||||
RearrangeBrowserTabs( tabIds, (tabIndex-1) );
|
||||
}, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ function RearrangeTreeTabs(tabs, bgtabs, first_run) {
|
||||
// param.Append - if true Appends tab at the end of tree if false or prepends
|
||||
function AppendTab(param) {
|
||||
if ($("#"+param.tab.id).length > 0) {
|
||||
GetFaviconAndTitle(param.tab.id);
|
||||
GetFaviconAndTitle(param.tab.id, param.addCounter);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -142,9 +142,10 @@ function AppendTab(param) {
|
||||
}
|
||||
}
|
||||
|
||||
GetFaviconAndTitle(param.tab.id);
|
||||
GetFaviconAndTitle(param.tab.id, param.addCounter);
|
||||
RefreshMediaIcon(param.tab.id);
|
||||
|
||||
|
||||
if (param.tab.active && param.SkipSetActive == undefined) {
|
||||
SetActiveTab(param.tab.id);
|
||||
}
|
||||
@ -187,7 +188,7 @@ function SetActiveTab(tabId) {
|
||||
$(".active:visible").removeClass("active").removeClass("selected");
|
||||
$(".pin, .tab:visible").removeClass("active").removeClass("selected").removeClass("selected_frozen").removeClass("selected_temporarly").removeClass("tab_header_hover");
|
||||
$(".highlighted_drop_target").removeClass("highlighted_drop_target");
|
||||
$("#"+tabId).removeClass("attention").addClass("active")/* .addClass("selected") */;
|
||||
$("#"+tabId).removeClass("attention").addClass("active");
|
||||
ScrollToTab(tabId);
|
||||
SetActiveTabInActiveGroup(tabId);
|
||||
}
|
||||
@ -270,7 +271,7 @@ function CloseTabs(tabsIds) {
|
||||
});
|
||||
setTimeout(function() {
|
||||
chrome.tabs.remove(tabsIds, null);
|
||||
},100);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
|
||||
@ -285,7 +286,7 @@ function DiscardTabs(tabsIds) {
|
||||
if (tabsIds.length > 0) {
|
||||
setTimeout(function() {
|
||||
DiscardTabs(tabsIds);
|
||||
},delay);
|
||||
}, delay);
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,9 +295,12 @@ function ActivateNextTab() {
|
||||
if ($(".pin.active:visible")[0]) {
|
||||
if ($(".pin.active").next(".pin")[0]) {
|
||||
chrome.tabs.update(parseInt($(".pin.active").next(".pin")[0].id), { active: true });
|
||||
} else {
|
||||
if ($(".pin.active").prev(".pin")[0]) {
|
||||
chrome.tabs.update(parseInt($(".pin.active").prev(".pin")[0].id), { active: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($(".tab.active:visible")[0]) {
|
||||
if ($(".active:visible").children().last().children(".tab")[0]) {
|
||||
chrome.tabs.update(parseInt($(".active:visible").children().last().children(".tab")[0].id), { active: true });
|
||||
@ -309,6 +313,10 @@ function ActivateNextTab() {
|
||||
} else {
|
||||
if ($(".active:visible").parents(".tab").last().next(".tab")[0]) {
|
||||
chrome.tabs.update(parseInt($(".active:visible").parents(".tab").last().next(".tab")[0].id), { active: true });
|
||||
} else {
|
||||
if ($(".tab:visible").length > 1) {
|
||||
ActivatePrevTab();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,9 +328,12 @@ function ActivatePrevTab() {
|
||||
if ($(".pin.active")[0]) {
|
||||
if ($(".pin.active").prev(".pin")[0]) {
|
||||
chrome.tabs.update(parseInt($(".pin.active").prev(".pin")[0].id), { active: true });
|
||||
} else {
|
||||
if ($(".pin.active").next(".pin")[0]) {
|
||||
chrome.tabs.update(parseInt($(".pin.active").next(".pin")[0].id), { active: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($(".tab.active:visible")[0]) {
|
||||
if ($(".active:visible").prev().find(".tab").length > 0) {
|
||||
chrome.tabs.update(parseInt($(".active:visible").prev().find(".tab").last()[0].id), { active: true });
|
||||
@ -332,6 +343,10 @@ function ActivatePrevTab() {
|
||||
} else {
|
||||
if ($(".tab.active:visible").parent().is(".children") && $(".tab.active:visible").parent().parent(".tab")[0]) {
|
||||
chrome.tabs.update(parseInt($(".tab.active:visible").parent().parent(".tab")[0].id), { active: true });
|
||||
} else {
|
||||
if ($(".tab:visible").length > 1) {
|
||||
ActivateNextTab();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -402,7 +417,7 @@ function SetTabEvents() {
|
||||
|
||||
// EXPAND BOX - EXPAND / COLLAPSE
|
||||
$(document).on("mousedown", ".expand", function(event) {
|
||||
event.stopPropagation();
|
||||
// event.stopPropagation();
|
||||
if (event.button == 0) {
|
||||
if ($(this).parent().parent().is(".o")) {
|
||||
$(this).parent().parent().removeClass("o").addClass("c");
|
||||
@ -426,17 +441,15 @@ function SetTabEvents() {
|
||||
}
|
||||
});
|
||||
|
||||
// SELECT OR CLOSE TAB/PIN
|
||||
// SELECT TAB/PIN
|
||||
$(document).on("mousedown", ".tab, .pin", function(event) {
|
||||
if ($(".menu").is(":visible")) {
|
||||
return;
|
||||
}
|
||||
event.stopPropagation();
|
||||
|
||||
DropTargetsSendToBack();
|
||||
let tabId = parseInt(this.id);
|
||||
|
||||
if (event.button == 0) {
|
||||
DropTargetsSendToBack();
|
||||
let tabId = parseInt(this.id);
|
||||
// SET SELECTION WITH SHIFT
|
||||
if (event.shiftKey) {
|
||||
$(".pin, .tab:visible").removeClass("selected").removeClass("selected_frozen").removeClass("selected_temporarly");
|
||||
@ -446,7 +459,6 @@ function SetTabEvents() {
|
||||
$(".active:visible").prevUntil($(this), ":visible").add($(".active:visible")).add($(this)).addClass("selected");
|
||||
}
|
||||
}
|
||||
|
||||
// TOGGLE SELECTION WITH CTRL
|
||||
if (event.ctrlKey) {
|
||||
// if ($(".active:visible").is(":not(.selected)")) {
|
||||
@ -455,15 +467,17 @@ function SetTabEvents() {
|
||||
$(this).toggleClass("selected");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// CLOSE TAB
|
||||
if (
|
||||
(
|
||||
($(this).is(".tab") && $(event.target).is(":not(.expand)")) && ((event.button == 1 && opt.close_with_MMB == true)
|
||||
|| (event.button == 0 && $(event.target).is(".close, .close_img"))))
|
||||
|| ($(this).is(".pin") && event.button == 1 && opt.close_with_MMB == true && opt.allow_pin_close == true)
|
||||
) {
|
||||
if ($(this).is(".active:visible") && opt.after_closing_active_tab != "browser") {
|
||||
|
||||
// CLOSE TAB/PIN
|
||||
$(document).on("mousedown", ".tab_header", function(event) {
|
||||
if ($(".menu").is(":visible")) {
|
||||
return;
|
||||
}
|
||||
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 ($(this).parent().is(".active:visible") && opt.after_closing_active_tab != "browser") {
|
||||
if (opt.after_closing_active_tab == "above") {
|
||||
ActivatePrevTab();
|
||||
}
|
||||
@ -471,30 +485,15 @@ function SetTabEvents() {
|
||||
ActivateNextTab();
|
||||
}
|
||||
}
|
||||
|
||||
// hide tab that will be closed
|
||||
$("#"+tabId).css({ "width": "0px", "height": "0px", "border": "none", "overflow": "hidden" });
|
||||
|
||||
chrome.tabs.update(tabId, {muted:true, pinned: false});
|
||||
|
||||
// repeated what is in chrome events on tab_removed event, to avoid lag
|
||||
if ($(this).is(".tab")) {
|
||||
if (opt.promote_children) {
|
||||
$("#ch"+tabId).children().insertAfter($(this));
|
||||
} else {
|
||||
$(this).find(".tab").each(function() {
|
||||
chrome.tabs.remove(parseInt(this.id));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// delayed tab removal, so ActivatePrevTab() or ActivateNextTab() will not activate wrong tab
|
||||
setTimeout(function() {
|
||||
if ($("#"+tabId)[0]) chrome.tabs.remove(tabId);
|
||||
}, 1000);
|
||||
// hide pin before it will be closed by listener
|
||||
$(".pin#"+tabId).css({ "width": "0px", "height": "0px", "border": "none", "overflow": "hidden" });
|
||||
chrome.tabs.update(tabId, {pinned: false});
|
||||
if ($("#"+tabId)[0]) chrome.tabs.remove(tabId);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// SINGLE CLICK TO ACTIVATE TAB
|
||||
$(document).on("click", ".tab_header", function(event) {
|
||||
if ($(".menu").is(":visible")) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
|
||||
|
||||
function RestoreToolbarSearchFilter() {
|
||||
function RestoreToolbarSearchFilterBAK() {
|
||||
let filter_type = "url";
|
||||
if (localStorage.getItem("filter_type") !== null) {
|
||||
filter_type = localStorage["filter_type"];
|
||||
@ -18,11 +18,26 @@ function RestoreToolbarSearchFilter() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function RestoreToolbarSearchFilter() {
|
||||
chrome.runtime.sendMessage({command: "get_search_filter", windowId: CurrentWindowId}, function(response) {
|
||||
if (response == "url") {
|
||||
$("#button_filter_type").addClass("url").removeClass("title");
|
||||
} else {
|
||||
$("#button_filter_type").addClass("title").removeClass("url");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function RestoreToolbarShelf() {
|
||||
chrome.runtime.sendMessage({command: "get_active_shelf", windowId: CurrentWindowId}, function(response) {
|
||||
$("#filter_box").attr("placeholder", caption_searchbox);
|
||||
$("#filter_box").css({"opacity": 1});
|
||||
|
||||
$(".on").removeClass("on");
|
||||
$(".toolbar_shelf").addClass("hidden");
|
||||
if (response == "search" && $("#button_search").length != 0) {
|
||||
@ -46,26 +61,28 @@ function RestoreToolbarShelf() {
|
||||
$("#button_folders").addClass("on");
|
||||
}
|
||||
|
||||
let bak1 = LoadData("windows_BAK1", []);
|
||||
let bak2 = LoadData("windows_BAK2", []);
|
||||
let bak3 = LoadData("windows_BAK3", []);
|
||||
if (browserId != "F") {
|
||||
let bak1 = LoadData("windows_BAK1", []);
|
||||
let bak2 = LoadData("windows_BAK2", []);
|
||||
let bak3 = LoadData("windows_BAK3", []);
|
||||
|
||||
if (bak1.length && $(".button#button_load_bak1")[0]) {
|
||||
$(".button#button_load_bak1").removeClass("disabled");
|
||||
} else {
|
||||
$(".button#button_load_bak1").addClass("disabled");
|
||||
}
|
||||
if (bak1.length && $(".button#button_load_bak1")[0]) {
|
||||
$(".button#button_load_bak1").removeClass("disabled");
|
||||
} else {
|
||||
$(".button#button_load_bak1").addClass("disabled");
|
||||
}
|
||||
|
||||
if (bak2.length && $(".button#button_load_bak2")[0]) {
|
||||
$(".button#button_load_bak2").removeClass("disabled");
|
||||
} else {
|
||||
$(".button#button_load_bak2").addClass("disabled");
|
||||
}
|
||||
if (bak2.length && $(".button#button_load_bak2")[0]) {
|
||||
$(".button#button_load_bak2").removeClass("disabled");
|
||||
} else {
|
||||
$(".button#button_load_bak2").addClass("disabled");
|
||||
}
|
||||
|
||||
if (bak3.length && $(".button#button_load_bak3")[0]) {
|
||||
$(".button#button_load_bak3").removeClass("disabled");
|
||||
} else {
|
||||
$(".button#button_load_bak3").addClass("disabled");
|
||||
if (bak3.length && $(".button#button_load_bak3")[0]) {
|
||||
$(".button#button_load_bak3").removeClass("disabled");
|
||||
} else {
|
||||
$(".button#button_load_bak3").addClass("disabled");
|
||||
}
|
||||
}
|
||||
|
||||
RefreshGUI();
|
||||
@ -139,9 +156,6 @@ function SetToolbarEvents() {
|
||||
|
||||
// new tab
|
||||
$(document).on("mousedown", "#button_new", function(event) {
|
||||
if (event.button == 0) {
|
||||
chrome.tabs.create({});
|
||||
}
|
||||
if (event.button == 1 && $(".active:visible")[0]) {
|
||||
chrome.tabs.duplicate(parseInt($(".active:visible")[0].id), function(tab) {
|
||||
setTimeout(function() {
|
||||
@ -155,6 +169,11 @@ function SetToolbarEvents() {
|
||||
ScrollToTab($(".active:visible")[0].id);
|
||||
}
|
||||
});
|
||||
$(document).on("click", "#button_new", function(event) {
|
||||
if (event.button == 0) {
|
||||
chrome.tabs.create({});
|
||||
}
|
||||
});
|
||||
// pin tab
|
||||
$(document).on("mousedown", "#button_pin", function(event) {
|
||||
if (event.button != 0) {
|
||||
@ -218,7 +237,15 @@ function SetToolbarEvents() {
|
||||
}
|
||||
$("#button_filter_type").toggleClass("url").toggleClass("title");
|
||||
FindTab($("#filter_box")[0].value);
|
||||
localStorage["filter_type"] = $(this).is(".url") ? "url" : "title";
|
||||
|
||||
|
||||
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
|
||||
$(document).on("mousedown", "#button_filter_clear", function(event) {
|
||||
@ -330,28 +357,29 @@ function SetToolbarEvents() {
|
||||
|
||||
|
||||
|
||||
if (browserId != "F") {
|
||||
// load backups
|
||||
$(document).on("mousedown", "#button_load_bak1:not(.disabled), #button_load_bak2:not(.disabled), #button_load_bak3:not(.disabled)", function(event) {
|
||||
if (event.button != 0) {
|
||||
return;
|
||||
}
|
||||
let wins = LoadData("windows_BAK"+(this.id).substr(15), []);
|
||||
let tabs = LoadData("tabs_BAK"+(this.id).substr(15), []);
|
||||
|
||||
// load backups
|
||||
$(document).on("mousedown", "#button_load_bak1:not(.disabled), #button_load_bak2:not(.disabled), #button_load_bak3:not(.disabled)", function(event) {
|
||||
if (event.button != 0) {
|
||||
return;
|
||||
}
|
||||
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");
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
chrome.runtime.sendMessage({command: "reload"});
|
||||
chrome.runtime.sendMessage({command: "reload_sidebar"});
|
||||
location.reload();
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// import-export backups
|
||||
$(document).on("mousedown", "#button_export_bak", function(event) {
|
||||
|
88
sidebar.js
@ -3,20 +3,15 @@
|
||||
// that can be found at https://creativecommons.org/licenses/by-nc-nd/4.0/
|
||||
|
||||
document.addEventListener("DOMContentLoaded", Run(), false);
|
||||
|
||||
|
||||
|
||||
function Loadi18n() {
|
||||
// toolbar labels
|
||||
$(".button").each(function() {
|
||||
$(this).attr("title", chrome.i18n.getMessage(this.id));
|
||||
});
|
||||
|
||||
// menu labels
|
||||
$(".menu_item").each(function() {
|
||||
$(this).text(chrome.i18n.getMessage(this.id));
|
||||
});
|
||||
|
||||
// edit group dialog labels
|
||||
$(".group_edit_button").each(function() {
|
||||
$(this)[0].textContent = chrome.i18n.getMessage(this.id);
|
||||
@ -30,73 +25,69 @@ function RestorePinListRowSettings() {
|
||||
}
|
||||
RefreshGUI();
|
||||
}
|
||||
|
||||
function Run() {
|
||||
LoadPreferences();
|
||||
chrome.windows.getCurrent({populate: false}, function(window) {
|
||||
CurrentWindowId = window.id;
|
||||
chrome.runtime.sendMessage({command: "is_bg_busy"}, function(response) {
|
||||
hold = response;
|
||||
chrome.runtime.sendMessage({command: "is_bg_running"}, function(response) {
|
||||
running = response;
|
||||
chrome.runtime.sendMessage({command: "get_browser_tabs"}, function(response) {
|
||||
bgtabs = Object.assign({}, response);
|
||||
chrome.runtime.sendMessage({command: "get_groups", windowId: CurrentWindowId}, function(response) {
|
||||
bggroups = Object.assign({}, response);
|
||||
setTimeout(function() {
|
||||
if (opt != undefined && browserId != undefined && bgtabs != undefined && bggroups != undefined && hold == false) {
|
||||
Initialize();
|
||||
} else {
|
||||
Run();
|
||||
}
|
||||
},200);
|
||||
chrome.runtime.sendMessage({command: "get_theme", windowId: CurrentWindowId}, function(response) {
|
||||
theme = response;
|
||||
setTimeout(function() {
|
||||
if (opt != undefined && browserId != undefined && bgtabs != undefined && bggroups != undefined && running == true) {
|
||||
Initialize();
|
||||
} else {
|
||||
Run();
|
||||
}
|
||||
},200);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function Initialize() {
|
||||
|
||||
// THEME
|
||||
RestoreStateOfGroupsToolbar();
|
||||
var theme = LoadData(("theme"+localStorage["current_theme"]), {"TabsSizeSetNumber": 2, "ToolbarShow": true, "toolbar": DefaultToolbar});
|
||||
|
||||
// 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") {
|
||||
// I have no idea what is going on in latest build, but why top position for various things is different in firefox?????
|
||||
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);
|
||||
|
||||
AppendAllGroups();
|
||||
|
||||
chrome.tabs.query({currentWindow: true}, function(tabs) {
|
||||
|
||||
// AddNewFolder();
|
||||
// AddNewFolder();
|
||||
// AddNewFolder();
|
||||
// AddNewFolder();
|
||||
|
||||
if (theme.ToolbarShow) {
|
||||
if (theme.theme_version == DefaultTheme.theme_version) {
|
||||
$("#toolbar").html(theme.toolbar);
|
||||
} else {
|
||||
$("#toolbar").html(DefaultToolbar);
|
||||
if (browserId == "F") {
|
||||
$(".button#button_load_bak1, .button#button_load_bak2, .button#button_load_bak3").remove();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
$("#toolbar").html(DefaultToolbar);
|
||||
}
|
||||
}
|
||||
// APPEND GROUPS
|
||||
AppendAllGroups();
|
||||
chrome.tabs.query({currentWindow: true}, function(tabs) {
|
||||
// AddNewFolder();AddNewFolder();AddNewFolder();AddNewFolder();AddNewFolder();
|
||||
// APPEND TABS
|
||||
let tc = tabs.length;
|
||||
for (var ti = 0; ti < tc; ti++) {
|
||||
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++) {
|
||||
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) {
|
||||
@ -104,30 +95,24 @@ function Initialize() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var ti = 0; ti < tc; ti++) {
|
||||
if (bgtabs[tabs[ti].id] && !tabs[ti].pinned) {
|
||||
$("#"+tabs[ti].id).addClass(bgtabs[tabs[ti].id].expand);
|
||||
}
|
||||
}
|
||||
|
||||
// SET ACTIVE IN EACH GROUP
|
||||
for (var group in bggroups) {
|
||||
if ($("#"+group+" #"+bggroups[group].activetab)[0]) {
|
||||
$("#"+bggroups[group].activetab).addClass("active");
|
||||
}
|
||||
}
|
||||
|
||||
chrome.runtime.sendMessage({command: "get_active_group", windowId: CurrentWindowId}, function(response) {
|
||||
SetActiveGroup(response, true, true);
|
||||
});
|
||||
|
||||
RearrangeTreeTabs(tabs, bgtabs, true);
|
||||
RefreshExpandStates();
|
||||
|
||||
RestoreToolbarShelf();
|
||||
RestoreToolbarSearchFilter();
|
||||
SetToolbarShelfToggle("mousedown");
|
||||
|
||||
StartChromeListeners();
|
||||
SetIOEvents();
|
||||
SetToolbarEvents();
|
||||
@ -137,18 +122,17 @@ function Initialize() {
|
||||
SetFolderEvents();
|
||||
SetMenu();
|
||||
SetDragAndDropEvents();
|
||||
|
||||
RearrangeBrowserTabsCheck();
|
||||
Loadi18n();
|
||||
|
||||
RestorePinListRowSettings();
|
||||
|
||||
setTimeout(function() {
|
||||
RefreshExpandStates();
|
||||
}, 1000);
|
||||
setTimeout(function() {
|
||||
UpdateData();
|
||||
delete bgtabs;
|
||||
delete theme;
|
||||
},5000);
|
||||
|
||||
}, 5000);
|
||||
if ($(".active:visible").length == 0) {
|
||||
chrome.tabs.query({currentWindow: true, active: true}, function(tabs) {
|
||||
if (tabs[0]) {
|
||||
@ -156,15 +140,11 @@ function Initialize() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (browserId == "V") {
|
||||
VivaldiRefreshMediaIcons();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function log(m) {
|
||||
chrome.runtime.sendMessage({command: "console_log", m: m});
|
||||
}
|