chrome extension demos
chrome extension demos
demo
https://github.com/hartleybrody/buzzkill/blob/master/bootstrap.js
https://github.com/hartleybrody/buzzkill/blob/master/manifest.json
// when the extension is first installed
chrome.runtime.onInstalled.addListener(function(details) {
chrome.storage.sync.set({ clean_news_feed: true });
});
// listen for any changes to the URL of any tab.
chrome.tabs.onUpdated.addListener(function(id, info, tab) {
if (tab.url.toLowerCase().indexOf("facebook.com") > -1) {
chrome.pageAction.show(tab.id);
}
});
// update the icon when the user's settings change
// chrome.storage.onChanged.addListener(function(changes, areaName){
// alert("changed settings");
// console.log("changed settings");
// if (localStorage["clean_news_feed"] == "true"){
// path = "active-icon.jpeg";
// } else {
// path = "inactive-icon.jpeg";
// }
// chrome.tabs.getCurrent( function(tab){
// chrome.pageAction.setIcon({
// "tabId": tab.id,
// "path": path
// });
// });
// });
chrome.runtime.onInstalled.addListener(function() {
chrome.contextMenus.create({
id: "sampleContextMenu",
title: "Sample Context Menu",
contexts: ["selection"]
});
});
chrome.runtime.onInstalled.addListener(function() {
chrome.contextMenus.create({
id: "sampleContextMenu",
title: "Sample Context Menu",
contexts: ["selection"]
});
});
// This will run when a bookmark is created.
chrome.bookmarks.onCreated.addListener(function() {
// do something
});
chrome.runtime.onMessage.addListener(function(message, sender, reply) {
chrome.runtime.onMessage.removeListener(event);
});
//
content script
chrome.runtime.onMessage.addListener(
function(message, callback) {
if (message == “changeColor”){
chrome.tabs.executeScript({
code: 'document.body.style.backgroundColor="orange"'
});
}
});
chrome.runtime.onMessage.addListener(
function(message, callback) {
if (message == “runContentScript”){
chrome.tabs.executeScript({
file: 'contentScript.js'
});
}
});
github jira chrome extensions
https://github.com/RobQuistNL/chrome-github-jira/blob/master/src/options.js
chrome.storage.sync.get({}, function() {
//
});
chrome.storage.sync.set({}, function() {
//
});
chrome.storage.sync.remove(['jiraUrl', 'prTemplate']);
https://github.com/maxday/jira-issue-easyCopy/blob/master/content.js
chrome.runtime.onMessage.addListener(function(msg, sender, sendResponse) {
var issueNumber = document.getElementById("key-val").textContent;
var issueDescription = document.getElementById("summary-val").textContent;
sendResponse(issueNumber + " - " + issueDescription);
});
https://github.com/maxday/jira-issue-easyCopy/blob/master/background.js
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.sendMessage(tab.id, { text: "report_back" }, sendToClipbord);
});
function sendToClipbord(myString) {
var input = document.createElement('textarea');
document.body.appendChild(input);
input.value = myString;
input.focus();
input.select();
document.execCommand('Copy');
input.remove();
}
https://github.com/taylorfoss89/Jira-Chrome-Extension/blob/master/jiraExtension/popup.js
chrome.tabs.update({
url: "https://contegixapp1.livenation.com/jira/browse/" + jiraGroup + '-' + jiraNumber
});
https://github.com/hbmartin/chrome-jira/blob/master/background.js
chrome.browserAction.setBadgeText({text: count.toString()});
chrome.browserAction.setBadgeBackgroundColor({color: [20, 20, 20, 230]});
chrome.windows.getAll({populate:true}, function(winData) {
//
});
// Handle Jira keyword in omnibox
chrome.omnibox.onInputEntered.addListener(function(text) {
chrome.tabs.getSelected(null, function(tab) {
chrome.tabs.update(tab.id, {
url: jira_url + "/secure/QuickSearch.jspa?searchString=" + text
});
});
});
chrome.extension.onMessage.addListener(function(msg,sender,sendResponse){
if (msg == "updateJira"){
console.log("async update");
setTimeout(updateJira, 2);
}
});
https://github.com/hbmartin/chrome-jira/blob/master/common.js
https://github.com/hbmartin/chrome-jira/blob/master/manifest.json
https://github.com/hbmartin/chrome-jira/blob/master/options.js
chrome.extension.sendMessage("updateJira");
https://github.com/hbmartin/chrome-jira/blob/master/popup.js
chrome.extension.getBackgroundPage().updateJira();
window.open(chrome.extension.getURL("options.html"));
chrome.extension.sendMessage("updateJira");
https://github.com/joshuaheng/jira-github-chrome/blob/master/background.js
chrome.tabs.onUpdated.addListener(function(tabId, info, tab) {
if (info.status == "complete") {
chrome.tabs.executeScript(tabId, {file: 'content.js'});
}
});
https://github.com/joshuaheng/jira-github-chrome/blob/master/content.js
(() => {
const $title = document.querySelector('.js-issue-title');
if (!$title) {
return;
}
chrome.storage.local.get(['jiraUrl', 'inlineLinks'], (options) => {
const jiraUrl = !!options.jiraUrl ?
options.jiraUrl :
'https://jira.nextcapital.com';
let title = $title.innerHTML.replace(/(<a[^>]+>|⬆︎|<\/a>)/g, '');
title.match(/[a-zA-Z0-9-]+(?=[\],\s\d#]*\])/g).forEach((tag) => {
const url = `${jiraUrl}/browse/${tag}`;
const attrs = `href="${url}" target="_blank"`;
const replacement = options.inlineLinks === false ?
`${tag}<a ${attrs}>⬆︎</a>` :
`<a ${attrs}>${tag}</a>`;
title = title.replace(tag, replacement);
});
$title.innerHTML = title;
});
})();
https://github.com/joshuaheng/jira-github-chrome/blob/master/options.js
const $jiraUrlInput = document.querySelector('#jira-url');
const $inlineLinksInput = document.querySelector('#inline-links');
chrome.storage.local.get(['jiraUrl', 'inlineLinks'], (options) => {
if (!!options.jiraUrl) {
$jiraUrlInput.value = options.jiraUrl;
}
if (options.inlineLinks !== false) {
$inlineLinksInput.setAttribute('checked', 'checked');
}
});
$jiraUrlInput.addEventListener('change', () => {
chrome.storage.local.set({ jiraUrl: $jiraUrlInput.value });
});
$inlineLinksInput.addEventListener('change', () => {
chrome.storage.local.set({ inlineLinks: $inlineLinksInput.checked });
});
chrome extension demos的更多相关文章
- Chrome Extension 检查视图(无效)处理方法
最近闲来无事,简单看了下Chrome扩展的开发,并且开发一个小小的翻译插件(TranslateBao)作为练手,开发细节不详述了,如果有新学习chrome extension开发的新人,可以参考源码, ...
- 开发Chrome Extension截取你微博的帐号密码
Google允许开发者对Chrome浏览器做扩展,所以有了之前火爆的12306抢票软件,我 也用它抢过票,一直很好奇它怎么注入js到12306上面的.这周有空研究了下Chrome Extension, ...
- chrome extension overview
目录 什么是扩展............................................................................................ ...
- 打包Egret游戏为Chrome extension
今天,本来是打算做一个Chrome扩展去爬取网站base64编码图片的. 在跟着图灵社区<Chrome扩展及应用开发>敲demo代码的过程中,发现chrome的扩展的结构理论上可以兼容所有 ...
- Google Chrome Native Messaging开发实录(二)Chrome Extension扩展
接上一篇<Google Chrome Native Messaging开发实录(一)背景介绍>的项目背景,话不多说,有关Chrome Extension介绍和文档就不展开了,直接上代码. ...
- Chrome Extension 实战
想起个问题,线上项目js要有bug,怎么进行调试修改. ------------- 想起来,方法应该是,拦截线上的js的请求,转到本地代码上进行调试... ------------- 网上看到 Chr ...
- 解决chrome extension无法下载的问题
由于GFW把谷歌应用商店给屏蔽了,下载chrome扩展变得很困难. 我使用的是版本30.0.1599.101 m. 那么你需要做的第一个处理是,修改host文件,保证chrome应用商店可以登录.如下 ...
- 一起来做Chrome Extension《搭个架子》
CEF - A simple Chrome Extension development falsework CEF是一个简单的Chrome Extension开发脚手架,它有如下功能: 模块化的结构, ...
- 一起来做Chrome Extension《一些问题》
目录 Unchecked runtime.lastError: The message port closed before a response wa received. 使用 eval Conte ...
随机推荐
- Scratch入门课程(1)——把工具准备好
为了让更多的同学了解少儿编程,从今天开始,我将以每周1次的频率发布Scratch的入门课程,大约在30课时左右. 几点情况说明: 1.这批课程主要面向2-4年级的同学,难度都不大,按照教程可以很轻松地 ...
- 北京Uber优步司机奖励政策(12月13日)
滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...
- 北京Uber优步司机奖励政策(9月21日~9月27日)
用户组:优步北京人民优步A组(适用于9月21日-9月27日) 滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不 ...
- CodeForces 547D Mike and Fish 思维
题意: 二维平面上给出\(n\)个点,然后对每个点进行染色:红色和蓝色,要求位于同一行或同一列的点中,红色点和蓝色点的个数相差不超过1 分析: 正解是求欧拉路径,在这篇博客中看到一个巧妙的思路: 对于 ...
- python中- \r用法
# \r 默认表示将输出的内容返回到第一个指针,这样的话,后面的内容会覆盖前面的内容 def main(): for i in range(65,91): s="\r{name:s}&quo ...
- 惊喜Skr人,Istio的创始人Shriram Rajagopalan手把手教你如何使用Istio
Shriram与来自Google.Lyft.IBM和其他公司的社区贡献者们一起并肩作战,积极地向Istio和Envoy项目作贡献.同时,Shriram是IBM的Amalgam8项目的创始成员之一.目前 ...
- HTTP基本定义
一.网络的简单定义: 1.http:是www服务器传输超文本向本地浏览器的传输协议.(应用层) 2.IP:是计算机之间相互识别通信的机制.(网络层) 3.TCP:是应用层通信之间通信.(传输层) IP ...
- 【SpringCloud】 第九篇: 服务链路追踪(Spring Cloud Sleuth)
前言: 必需学会SpringBoot基础知识 简介: spring cloud 为开发人员提供了快速构建分布式系统的一些工具,包括配置管理.服务发现.断路器.路由.微代理.事件总线.全局锁.决策竞选. ...
- 【转】: 探索Lua5.2内部实现:虚拟机指令(1) 概述
Lua一直把虚拟机执行代码的效率作为一个非常重要的设计目标.而采用什么样的指令系统的对于虚拟机的执行效率来说至关重要. Stack based vs Register based VM 根据指令获取操 ...
- [CH0304]IncDec Sequence
和NOIP2018DAY1T1类似的题目,但思维难度高多了. 这题既可以抬高路面,也可以降低路面,而且目标平面不确定,就难起来了. 但是两道题的基本思路几乎一样,同样我们将 2~n 的高度差分,1之所 ...