我正在尝试从 chrome 扩展将 CSS 代码注入到活动选项卡中,但到目前为止我在网上看到的任何内容都对我不起作用。我对这一切都很陌生,所以如果我的问题有点天真并且我只是错过了一些基本的东西,我很抱歉。这是我到目前为止所想到的:
function inject_1(){
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
css = 'body { background-color = "red" !important; }';
chrome.scripting.insertCSS(
{
target: {tabId: tabs[0].id},
css: css,
}, function() {
if (chrome.runtime.lastError) {
message.innerText = 'There was an error injecting css : \n' + chrome.runtime.lastError.message;
}
});
});
}
Run Code Online (Sandbox Code Playgroud)
这是我尝试过的第二种方法:
function inject_2(){
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.scripting.executeScript(
{
target: {tabId: tabs[0].id},
files: ["inject.css"],
}, function() {
if (chrome.runtime.lastError) {
message.innerText = 'There was an error injecting …Run Code Online (Sandbox Code Playgroud) javascript css google-chrome google-chrome-extension manifest.json
我正在尝试运行一个非常简单的 tqdm 脚本:
from tqdm.notebook import tqdm
for i in tqdm(range(10)):
time.sleep(1)
Run Code Online (Sandbox Code Playgroud)
但我遇到了:
IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
Run Code Online (Sandbox Code Playgroud)
我的 ipywidgets 是 v8.0.4,jupyter v1.0.0...tqdm 不再与 VS Code Jupyter Notebook 一起使用吗?