├── LICENSE ├── assets ├── add.png ├── back.png ├── close.png ├── forward.png ├── internet.png ├── loading.gif ├── no_sound.png ├── reload.png └── sound.png ├── back.js ├── icons ├── 128.png ├── 16.png └── 48.png ├── jquery-3.0.0.js ├── jquery-ui.js ├── main.js ├── manifest.json └── style.css /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /assets/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/add.png -------------------------------------------------------------------------------- /assets/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/back.png -------------------------------------------------------------------------------- /assets/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/close.png -------------------------------------------------------------------------------- /assets/forward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/forward.png -------------------------------------------------------------------------------- /assets/internet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/internet.png -------------------------------------------------------------------------------- /assets/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/loading.gif -------------------------------------------------------------------------------- /assets/no_sound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/no_sound.png -------------------------------------------------------------------------------- /assets/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/reload.png -------------------------------------------------------------------------------- /assets/sound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/assets/sound.png -------------------------------------------------------------------------------- /back.js: -------------------------------------------------------------------------------- 1 | var stack; 2 | 3 | function init(){ 4 | // Start here 5 | chrome.tabs.query({},function(tab){ 6 | stack = tab; 7 | }); 8 | 9 | chrome.contextMenus.create({"contexts":["all"],"id": "pinTab","title": "Pin/Unpin Tab"}); 10 | chrome.contextMenus.create({"contexts":["all"],"id": "subMute","title": "Mute/Unmute"}); 11 | chrome.contextMenus.create({"contexts":["all"],"id": "muteTab","parentId": "subMute","title": "Mute/Unmute Tab"}); 12 | chrome.contextMenus.create({"contexts":["all"],"id": "muteAllOthers","parentId": "subMute","title": "Mute all other Tabs"}); 13 | chrome.contextMenus.create({"contexts":["all"],"id": "unmuteAllOthers","parentId": "subMute","title": "Unmute all other Tabs"}); 14 | chrome.contextMenus.create({"contexts":["all"],"id": "duplicateTab","title": "Duplicate Tab"}); 15 | chrome.contextMenus.create({"contexts":["all"],"id": "closeAllOthers","title": "Close all other Tabs"}); 16 | chrome.contextMenus.create({"contexts":["all"],"id": "closeTab","title": "Close Tab"}); 17 | } 18 | 19 | function broadcast(data,sender){ 20 | chrome.tabs.query({},function(tab){ 21 | stack = tab; 22 | if(data==null) data = tab; 23 | $.each(tab,function(i,x){ 24 | if(x.id!=sender){ 25 | chrome.tabs.sendMessage(x.id,data); 26 | } 27 | }); 28 | console.log(tab); 29 | }); 30 | } 31 | 32 | chrome.contextMenus.onClicked.addListener( 33 | function(response,tab){ 34 | if(response.menuItemId == "pinTab"){ 35 | chrome.tabs.update(tab.id,{pinned: !tab.pinned}); 36 | 37 | }else if(response.menuItemId == "muteTab"){ 38 | chrome.tabs.update(tab.id,{muted: !tab.mutedInfo.muted}); 39 | 40 | }else if(response.menuItemId == "muteAllOthers"){ 41 | $.each(stack,function(i,x){ 42 | if(x.id != tab.id && x.audible) chrome.tabs.update(x.id,{muted: true}); 43 | }); 44 | 45 | }else if(response.menuItemId == "unmuteAllOthers"){ 46 | $.each(stack,function(i,x){ 47 | if(x.id != tab.id && x.audible) chrome.tabs.update(x.id,{muted: false}); 48 | }); 49 | 50 | }else if(response.menuItemId == "duplicateTab"){ 51 | chrome.tabs.create({url:tab.url}); 52 | 53 | }else if(response.menuItemId == "closeTab"){ 54 | chrome.tabs.remove(tab.id); 55 | 56 | }else if(response.menuItemId == "closeAllOthers"){ 57 | $.each(stack,function(i,x){ 58 | if(x.id != tab.id) chrome.tabs.remove(x.id); 59 | }); 60 | 61 | } 62 | }); 63 | 64 | chrome.runtime.onMessage.addListener( 65 | function(response, tab, callback){ 66 | 67 | if(response.code == "getData"){ 68 | callback({stack: stack, 69 | myId: tab.tab.id, 70 | windowId: tab.tab.windowId}); 71 | 72 | }else if(response.code == "checkIfFullscreen"){ 73 | chrome.windows.get(tab.tab.windowId, function(chromeWindow) { 74 | // "normal", "minimized", "maximized" or "fullscreen" 75 | callback({"isFullscreen":(chromeWindow.state == "fullscreen")}); 76 | }); 77 | return true; 78 | 79 | }else if(response.code == "setActive"){ 80 | chrome.tabs.update(response.tabId,{active: true}); 81 | 82 | }else if(response.code == "createTab"){ 83 | chrome.tabs.create({}); 84 | 85 | }else if(response.code == "muteTab"){ 86 | $.each(stack,function(i,x){ 87 | if(x.id == response.tabId){ 88 | chrome.tabs.update(response.tabId,{muted: !x.mutedInfo.muted}); 89 | return; 90 | } 91 | }); 92 | 93 | }else if(response.code == "closeTab"){ 94 | chrome.tabs.remove(response.tabId); 95 | if(response.tabId != tab.tab.id) 96 | chrome.tabs.update(tab.tab.id, {active: true}); 97 | 98 | }else if(response.code == "moveTab"){ 99 | chrome.tabs.move(response.id,{'index':response.index}); 100 | 101 | }else{ 102 | //broadcast(response,tab.id); 103 | } 104 | }); 105 | 106 | chrome.tabs.onUpdated.addListener(function(tabId,changeInfo,tab){ 107 | console.log("onUpdated activated"); 108 | broadcast(null,null); 109 | }); 110 | 111 | chrome.tabs.onCreated.addListener(function(tab){ 112 | console.log("onCreated activated"); 113 | broadcast(null,null); 114 | }); 115 | 116 | chrome.tabs.onMoved.addListener(function(tabId,moveInfo){ 117 | console.log("onMoved activated"); 118 | broadcast(null,null); 119 | }); 120 | 121 | chrome.tabs.onActivated.addListener(function(activeInfo){ 122 | console.log("onActivated activated"); 123 | broadcast(null,null); 124 | }); 125 | 126 | chrome.tabs.onDetached.addListener(function(tabId,detachInfo){ 127 | console.log("onDetached activated"); 128 | broadcast(null,null); 129 | }); 130 | 131 | chrome.tabs.onAttached.addListener(function(tabId,attachInfo){ 132 | console.log("onAttached activated"); 133 | broadcast(null,null); 134 | }); 135 | 136 | chrome.tabs.onRemoved.addListener(function(tabId,removeInfo){ 137 | console.log("onRemoved activated"); 138 | broadcast(null,null); 139 | }); 140 | 141 | chrome.tabs.onReplaced.addListener(function(addedTabId,removedTabId){ 142 | console.log("onReplaced activated"); 143 | //broadcast(null,null); 144 | }); 145 | 146 | init(); 147 | -------------------------------------------------------------------------------- /icons/128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/icons/128.png -------------------------------------------------------------------------------- /icons/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/icons/16.png -------------------------------------------------------------------------------- /icons/48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/samuthekid/tabrevolution/b3b4342785ff5abf609755355133c23ec216c4c4/icons/48.png -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | var stack; 2 | var order; 3 | var myId; 4 | var windowId; 5 | var isFullscreen; 6 | 7 | function init(){ 8 | // Start here 9 | 10 | // Append styles 11 | $("head").append(""); 12 | $("#tr_style").load(chrome.extension.getURL("/style.css")); 13 | 14 | // Append div 15 | boss = $("
"); 16 | boss.attr("id","tr"); 17 | boss.addClass("tr_reset tr_disabled"); 18 | $("body").append(boss); 19 | 20 | $(window).resize(checkIfFullscreen); 21 | 22 | $(window).keydown(function(e){ 23 | var key = e.which; 24 | if(key == 13 && $(".tr_input").is(":focus")){ 25 | //submit form 26 | var query = $(".tr_input").val(); 27 | url_reg = /^((http|https|ftp|chrome):\/\/)?([a-zA-Z0-9\_\-]+)((\.|\:)[a-zA-Z0-9\_\-]+)+(\/.*)?$/; 28 | if(url_reg.test(query)){ 29 | // URL 30 | if(query.includes("http://") || query.includes("https://")) 31 | location.href = query; 32 | else 33 | location.href = "http://"+query; 34 | }else{ 35 | // NOT URL 36 | location.href = "https://www.google.pt/search?q="+query; 37 | } 38 | return false; 39 | }else if((e.ctrlKey && key==76) || (e.altKey && key==68)){ 40 | $("#tr").addClass("tr_hover"); 41 | $("input.tr_input").select(); 42 | } 43 | }); 44 | 45 | chrome.runtime.sendMessage({"code":"getData"}, 46 | function(response){ 47 | stack = response.stack; 48 | myId = response.myId; 49 | windowId = response.windowId; 50 | //console.log(myId+" "+windowId); 51 | checkIfFullscreen(); 52 | redraw(); 53 | }); 54 | } 55 | 56 | function checkIfFullscreen(){ 57 | chrome.runtime.sendMessage({"code":"checkIfFullscreen"}, 58 | function(response){ 59 | isFullscreen = response.isFullscreen; 60 | if(isFullscreen){ 61 | $("#tr").removeClass("tr_disabled"); 62 | }else{ 63 | $("#tr").addClass("tr_disabled"); 64 | } 65 | }); 66 | } 67 | 68 | function checkForMoves(){ 69 | $.each($(".tr_sortable").children(),function(i,x){ 70 | x = parseInt(x.dataset["tabid"]); 71 | chrome.runtime.sendMessage({"code":"moveTab","id":x,"index":i}); 72 | }); 73 | } 74 | 75 | function makeSortable(){ 76 | var tabs = $(".tr_tops").tabs(); 77 | tabs.find(".tr_sortable").sortable({ 78 | axis: "x", 79 | stop: function(e) { 80 | tabs.tabs("refresh"); 81 | checkForMoves(); 82 | } 83 | }); 84 | } 85 | 86 | function addEvents(){ 87 | 88 | $(".tr_tab").mousedown(function(e){ 89 | switch(e.which){ 90 | case 2: 91 | // MIDDLE CLICK 92 | chrome.runtime.sendMessage({"code":"closeTab","tabId":parseInt(e.target.closest("li").dataset["tabid"])}); 93 | e.preventDefault(); 94 | e.stopPropagation(); 95 | break; 96 | } 97 | return true;// to allow the browser to know that we handled it. 98 | }); 99 | 100 | $(".tr_tab").click(function(e) { 101 | if(e.target.className.includes("tr_tab_close")){ 102 | chrome.runtime.sendMessage({"code":"closeTab","tabId":parseInt(e.target.closest("li").dataset["tabid"])}); 103 | }else if(e.target.className.includes("tr_tab_sound")){ 104 | chrome.runtime.sendMessage({"code":"muteTab","tabId":parseInt(e.target.closest("li").dataset["tabid"])}); 105 | }else{ 106 | chrome.runtime.sendMessage({"code":"setActive","tabId":parseInt(e.target.closest("li").dataset["tabid"])}); 107 | } 108 | }); 109 | 110 | $(".tr_new_tab").click(function(e){ 111 | chrome.runtime.sendMessage({"code":"createTab"}); 112 | }); 113 | 114 | $("#tr_prev").click(function(e){ 115 | window.history.back(); 116 | }); 117 | 118 | $("#tr_next").click(function(e){ 119 | window.history.forward(); 120 | }); 121 | 122 | $("#tr_rel").click(function(e){ 123 | location.reload(); 124 | }); 125 | 126 | $("input.tr_input").on("focus",function(e){ 127 | $(e.target).select(); 128 | $("#tr").addClass("tr_hover"); 129 | }); 130 | 131 | $("input.tr_input").on("focusout",function(e){ 132 | if(e.target.value == ""){ 133 | e.target.value = location.href; 134 | } 135 | $("#tr").removeClass("tr_hover"); 136 | }); 137 | } 138 | 139 | function redraw(){ 140 | var isLoading = false; 141 | 142 | $("#tr").html(""); 143 | 144 | tops = $("
"); 145 | tops.addClass("tr_reset tr_tops"); 146 | 147 | pins = $("