Extension to return old Twitter layout from 2015.
at master 1.1 kB view raw
1chrome.contextMenus.create({ 2 id: 'open_settings', 3 title: 'Open settings', 4 contexts: ['action'] 5}); 6 7chrome.runtime.onInstalled.addListener(() => { 8 chrome.runtime.setUninstallURL('https://dimden.dev/ot/uninstall.html'); 9}); 10 11chrome.contextMenus.onClicked.addListener(info => { 12 if (info.menuItemId === 'open_settings') { 13 chrome.tabs.create({ 14 url: 'https://twitter.com/old/settings' 15 }); 16 } 17}); 18chrome.action.onClicked.addListener(() => { 19 chrome.tabs.create({ 20 url: 'https://twitter.com/old/settings' 21 }); 22}); 23 24chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => { 25 if(request.action === "inject") { 26 console.log(request, sender.tab.id); 27 chrome.scripting.executeScript({ 28 target: { 29 tabId: sender.tab.id, 30 allFrames : true 31 }, 32 injectImmediately: true, 33 files: request.data 34 }).then(res => { 35 console.log('injected', res); 36 }).catch(e => { 37 console.log('error injecting', e); 38 }); 39 } 40});