mirror of
https://github.com/jaywcjlove/wxmp.git
synced 2026-01-11 15:58:48 +08:00
add file.
This commit is contained in:
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);
|
||||
});
|
||||
});
|
||||
})
|
||||
Reference in New Issue
Block a user