Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luyishisi/chrome-plug-in
如何自制一个简单的chrome插件
https://github.com/luyishisi/chrome-plug-in
Last synced: about 2 months ago
JSON representation
如何自制一个简单的chrome插件
- Host: GitHub
- URL: https://github.com/luyishisi/chrome-plug-in
- Owner: luyishisi
- Created: 2015-08-27T06:55:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-27T07:02:31.000Z (over 9 years ago)
- Last Synced: 2023-12-23T05:19:47.063Z (about 1 year ago)
- Language: JavaScript
- Size: 148 KB
- Stars: 6
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# A chrome extension for removing ads on the web page.
一款简易的chrome插件,可清除页面中的广告。
仓库里是整个插件包,下载安装chrome拓展可以直接使用,chrome插件安装及配置参考:
http://open.chrome.360.cn/extension_dev/getstarted.html通过在匹配的页面注入js脚本文件,通过找到页面中的广告框然后将其隐藏(通过JQ hide()方法)达到清除广告的效果。
通过寻找页面中广告的特性,通过算法可以得到广告框的外层id或者类名。
简单的算法如下:
```Javascript
//简单的智能算法
findSomeAdPossible: function() {
//找到可能的广告wrapper
var sap = $('div iframe'),
ad_img = $('div script').parent().find('img,embed'),
float_img = $('div object').parent().find('img,embed');this.arrayDel(sap,360,200);
this.arrayDel(ad_img,350,150);
this.arrayDel(float_img,350,150);
},
arrayDel : function(arr,conWidth,conHeight){
var len = arr.length;for(var i = 0 ; i