当前位置:网站首页>chrome extension: how to make the dialog be on the right side of the current window?
chrome extension: how to make the dialog be on the right side of the current window?
2022-07-30 20:33:00 【music】
chrome扩展:How can I make the dialog be on the right side of the current window?
本文介绍了chrome扩展: How to make the extension dialog be located on the right side of the current window.
chrome.action.onClicked.addListener(async function(tab){
var windows = await chrome.windows.getAll({
populate: true, windowTypes: ["popup"]}) || []
// My processing here is that only one dialog box can be displayed,Each time it is judged whether there is an existing dialog box,If there is, take the last dialog to give focus
if(windows.length > 0){
var lastFoucsedWindow = await chrome.windows.getLastFocused({
populate: true, windowTypes: ["popup"]
})
if(!lastFoucsedWindow.focused){
chrome.windows.update(lastFoucsedWindow.id, {
focused: true});
}
}else{
chrome.windows.getCurrent(function(w) {
// w The parameter contains information about the browser window,如 高度、宽度 ...
chrome.windows.create({
tabId: tab.id,url: "popup.html", type: "popup", width:340,height:610,top: 80,left: (w.width - 450)});
});
}
})
边栏推荐
- 基于人脸的常见表情识别——模型搭建、训练与测试
- 普通的int main(){}没有写return 0;会怎么样?
- Redisson 的分布式锁找不到?
- 基于Apache Doris的湖仓分析
- 软考 --- 数据库(6)数据仓库、分布式数据库
- 是对称矩阵的对角化
- Recommendation System - Sorting Layer - Model (1): Embedding + MLP (Multilayer Perceptron) Model [Deep Crossing Model: Classic Embedding + MLP Model Structure]
- Activiti 工作流引擎 详解
- 2022-07-29 mysql/stonedb慢SQL-Q17-分析
- MySQL的DATE_FORMAT()函数将Date转为字符串
猜你喜欢
KEIL问题:【keil Error: failed to execute ‘C:\Keil\ARM\ARMCC‘】
Oblique document scanning and character recognition (opencv, coordinate transformation analysis)
ECCV2022 | 对比视觉Transformer的在线持续学习
MySql 创建索引
TensorFlow2: Overview
Difference Between Concurrency and Parallelism
推荐系统:评估指标【离线评估指标:RMSE(均方根误差)、AUC、准确率、召回率、F1】【在线评估:A/B测试】【一般要求响应时间<0.5s】
倾斜文档扫描与字符识别(opencv,坐标变换分析)
IDEA2018.3.5取消双击Shift快捷键
啊?现在初级测试招聘都要求会自动化了?
随机推荐
Ordinary int main(){} does not write return 0; what will happen?
什么是公约数
对一次生产环境产生OOM的记录,结论:除非在自己完全有把握的情况下,否则不要偷懒查询无用字段
推荐系统:冷启动问题【用户冷启动、物品冷启动、系统冷启动】
MySQL 高级(进阶) SQL 语句 (一)
如何解决gedit 深色模式下高亮文本不可见?
推荐系统-排序层:排序层架构【用户、物品特征处理步骤】
【luogu P8031】Kućice(计算几何)
MySQL的DATE_FORMAT()函数将Date转为字符串
Based on the face of the common expression recognition - model building, training and testing
啊?现在初级测试招聘都要求会自动化了?
MySQL_关于JSON数据的查询
英文字母间隔突然增大(全角与半角转换)
Mysql 回表
2.网络资源访问工具:requests
使用map函数,对list中的每个元素进行操作 好像不用map
Flink_CDC搭建及简单使用
18.客户端会话技术Cookie
一文2500字手把手教你配置Jenkins自动化邮件通知
明解C语言第五章习题