mirror of
https://github.com/jaywcjlove/wxmp.git
synced 2026-01-10 15:28:47 +08:00
add file.
This commit is contained in:
7
css/popup.css
Normal file
7
css/popup.css
Normal file
@@ -0,0 +1,7 @@
|
||||
ul,li{margin: 0;padding: 0;}
|
||||
.warpper{width: 200px; min-height: 23px;}
|
||||
.warpper ul {}
|
||||
.warpper ul li{}
|
||||
.warpper ul li a{display: block;box-shadow: 0 1px 1px 0 #D0D0D0;line-height: 23px;border:1px solid #D0D0D0;border-radius: 4px;padding: 0 5px;color:#333;}
|
||||
.warpper ul li a:hover{box-shadow: 0 1px 1px 0 #4A90E2;border: 1px solid #4A90E2;color:#4A90E2;}
|
||||
.warpper ul li a:active{box-shadow: 0 1px 1px 0 #ABABAB;border: 1px solid #ABABAB;color:#ABABAB;}
|
||||
BIN
img/icon.png
Normal file
BIN
img/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
25
js/bg.js
Normal file
25
js/bg.js
Normal file
@@ -0,0 +1,25 @@
|
||||
chrome.extension.onRequest.addListener(
|
||||
function (request, sender, sendResponse) {
|
||||
if (request.hello == "btn_del_family") {
|
||||
var bodys = document.querySelectorAll('iframe#ueditor_0')
|
||||
if(bodys&&bodys.length>0&&bodys[0].contentDocument){
|
||||
var body = bodys[0].contentDocument;
|
||||
if(body){
|
||||
var elms = body.querySelectorAll('code,pre,h1,h2,h3,h4,h5,h6,p,div,span');
|
||||
for (var i = 0; i < elms.length; i++) {
|
||||
var styl = elms[i].getAttribute('style');
|
||||
if(styl){
|
||||
styl = styl.replace(/font-family\:[\s\S]*?\;/g,'')
|
||||
elms[i].setAttribute('style',styl)
|
||||
}
|
||||
|
||||
if(elms[i].tagName === 'PRE'){
|
||||
elms[i].setAttribute('style','box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; padding: 5px; border: 0px; outline: 0px; vertical-align: baseline; overflow: auto; border-radius: 3px; word-break: break-all; word-wrap: break-word; font-stretch: normal; line-height: normal; color: rgb(51, 51, 51); background-color: rgb(247, 247, 249); ')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sendResponse({ msg: '更改完毕!!' });
|
||||
}
|
||||
}
|
||||
);
|
||||
4
js/jq.3.0.0.min.js
vendored
Normal file
4
js/jq.3.0.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
20
js/popup.js
Normal file
20
js/popup.js
Normal file
@@ -0,0 +1,20 @@
|
||||
$('.warpper a.btn_del_family').on('click',function(){
|
||||
var self = this
|
||||
chrome.tabs.getSelected(null, function (tab) {
|
||||
chrome.tabs.sendRequest(tab.id, {"hello": "btn_del_family"}, function (response) {
|
||||
$(self).find('span').html(response.msg);
|
||||
setTimeout(function(){
|
||||
$(self).find('span').html('');
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
})
|
||||
|
||||
$('.warpper a.btn_del_fonts').on('click',function(){
|
||||
console.log("btn_del_fonts");
|
||||
chrome.tabs.getSelected(null, function (tab) {
|
||||
chrome.tabs.sendRequest(tab.id, {"hello": "btn_del_fonts"}, function (response) {
|
||||
console.log("response",response);
|
||||
});
|
||||
});
|
||||
})
|
||||
16
manifest.json
Normal file
16
manifest.json
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
{
|
||||
"name": "Wxmp",
|
||||
"version": "1.0",
|
||||
"description": "微信公众账号发文章优化文章插件",
|
||||
"icons": { "128": "img/icon.png" },
|
||||
"permissions": ["*://*/*","declarativeContent","tabs", "unlimitedStorage"],
|
||||
"browser_action": {
|
||||
"default_title": "",
|
||||
"default_icon": "img/icon.png",
|
||||
"default_popup": "popup.html"
|
||||
},
|
||||
"manifest_version": 2,
|
||||
"content_scripts": [{"matches": ["*://*/*"],"js": ["js/bg.js"]}],
|
||||
"permissions": ["*://*/*","tabs"]
|
||||
}
|
||||
18
popup.html
Normal file
18
popup.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>弹出层</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/popup.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="warpper">
|
||||
<ul>
|
||||
<li><a class="btn_del_family" href="#">删除family样式<span></span></a></li>
|
||||
<!-- <li><a class="btn_del_fonts" href="#">删除family样式</a></li> -->
|
||||
</ul>
|
||||
</div>
|
||||
<script type="text/javascript" src="js/jq.3.0.0.min.js"></script>
|
||||
<script type="text/javascript" src="js/popup.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user