当前位置:网站首页>chrome扩展:如何使对话框位于当前窗口的右侧?
chrome扩展:如何使对话框位于当前窗口的右侧?
2022-07-30 20:24:00 【乐辞】
chrome扩展:如何使对话框位于当前窗口的右侧?
本文介绍了chrome扩展: 如何使扩展对话框位于当前窗口的右侧的处理方法。
chrome.action.onClicked.addListener(async function(tab){
var windows = await chrome.windows.getAll({
populate: true, windowTypes: ["popup"]}) || []
// 在这边我的处理是只能显示一个对话框,每次判断有没有已存在的对话框,如果有则取上一次的对话框给予焦点
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 参数包含了浏览器窗口的信息,如 高度、宽度 ...
chrome.windows.create({
tabId: tab.id,url: "popup.html", type: "popup", width:340,height:610,top: 80,left: (w.width - 450)});
});
}
})
边栏推荐
- Recommendation system: evaluation index [offline evaluation index: RMSE (root mean square error), AUC, precision, recall, F1] [online evaluation: A/B test] [generally required response time <0.5s]
- HMS Core音频编辑服务音源分离与空间音频渲染,助力快速进入3D音频的世界
- MySQL ODBC驱动简介
- 推荐系统-排序层:排序层架构【用户、物品特征处理步骤】
- 银行数据资产转换能力弱?思迈特软件助力解决银行困境
- ceph的部署练习
- Multi-threaded mutex application RAII mechanism
- Based on the face of the common expression recognition - model building, training and testing
- 线性结构:栈和队列
- MySQL 高级(进阶) SQL 语句 (一)
猜你喜欢
我是一名阿里在职9年软件测试工程师,我的经历也许能帮到处于迷茫期的你
Multi-threaded mutex application RAII mechanism
ceph的部署练习
To the operation of the int variable assignment is atom?
[NISACTF 2022]下
【考研词汇训练营】Day18 —— amount,max,consider,account,actual,eliminate,letter,significant,embarrass,collapse
一文2500字手把手教你配置Jenkins自动化邮件通知
7.联合索引(最左前缀原则)
推荐系统-排序层:排序层架构【用户、物品特征处理步骤】
flyway的快速入门教程
随机推荐
MySQL的on duplicate key update 的使用
@WebServlet注解(Servlet注解)
MySQL (2)
明解C语言第五章习题
想要写出好的测试用例,先要学会测试设计
4年测试经验去面试10分钟就被赶出来了,面试官说我还不如应届生?都这么卷吗...
Recommendation System - Sorting Layer - Model (1): Embedding + MLP (Multilayer Perceptron) Model [Deep Crossing Model: Classic Embedding + MLP Model Structure]
多线程的互斥锁应用RAII机制
我是一名阿里在职9年软件测试工程师,我的经历也许能帮到处于迷茫期的你
基于人脸的常见表情识别——模型搭建、训练与测试
MySQL数据库字段超长问题
并发与并行的区别
Oblique document scanning and character recognition (opencv, coordinate transformation analysis)
Can't find the distributed lock of Redisson?
[Node implements data encryption]
360杜跃进:太空安全风险加剧,需打造一体化防御体系
CDH集群spark-shell执行过程分析
推荐系统:开源项目/工具【谷歌:TensorFlow Recommenders】【Facebook:TorchRec】【百度:Graph4Rec】【阿里:DeepRec和EasyRec】
MySQL——几种常见的嵌套查询
是对称矩阵的对角化