Created
January 17, 2024 18:01
-
-
Save mhsattarian/ae2d16f012b53f4cd036ed7bcb67ea4b to your computer and use it in GitHub Desktop.
A simple (browser)action Chrome extension to add a rotate Instagram lives/stories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrome.action.onClicked.addListener(function (tab) { | |
chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { | |
var activeTab = tabs[0]; | |
chrome.tabs.sendMessage(activeTab.id, { | |
message: "clicked_browser_action", | |
}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doSmthing() { | |
var videoEl = document.querySelector("video"); | |
videoEl.setAttribute("controls", ""); | |
var prevRotate = 0; | |
if (videoEl.style.transform) | |
prevRotate = parseInt(videoEl.style.transform.split("(")[1].slice(0, -4)); | |
document.body.style.cssText = ` | |
rotate: ${prevRotate + 90}deg; | |
`; | |
} | |
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) { | |
if (request.message === "clicked_browser_action") { | |
doSmthing(); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 3, | |
"name": "IGLive landscape", | |
"description": "Make instagram live video landscape", | |
"version": "0.1", | |
"icons": { "64": "icon.png" }, | |
"action": { | |
"default_icon": "icon.png", | |
"default_title": "Make live video landscape!" | |
}, | |
"background": { | |
"service_worker": "background.js" | |
}, | |
"content_scripts": [ | |
{ | |
"matches": ["https://www.instagram.com/*"], | |
"js": ["content.js"] | |
} | |
], | |
"host_permisson": ["https://www.instagram.com/*"], | |
"permissions": ["tabs", "webNavigation"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment