forked from mirror/MrDoc
Chrome扩展添加鼠标选择控制选项
This commit is contained in:
parent
b798654857
commit
0600e96501
BIN
BrowserMark/img/dashang_alipay.jpg
Normal file
BIN
BrowserMark/img/dashang_alipay.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 KiB |
BIN
BrowserMark/img/dashang_paypal.png
Normal file
BIN
BrowserMark/img/dashang_paypal.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
BrowserMark/img/dashang_qq.png
Normal file
BIN
BrowserMark/img/dashang_qq.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 40 KiB |
BIN
BrowserMark/img/dashang_wx.jpg
Normal file
BIN
BrowserMark/img/dashang_wx.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
BrowserMark/img/wx_qrcode.jpg
Normal file
BIN
BrowserMark/img/wx_qrcode.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
@ -1,5 +1,7 @@
|
||||
(function($){
|
||||
var form = layui.form;
|
||||
(function($){
|
||||
'use strict';
|
||||
var form = layui.form;
|
||||
window.mrdocClipperSettings = {
|
||||
init: function(){
|
||||
var self = this,
|
||||
@ -14,6 +16,21 @@
|
||||
mrdocClipperOptions.get(['accountKey'],function(r){
|
||||
$("input[name='mrdoc_account_key']").val(r['accountKey']);
|
||||
});
|
||||
// 鼠标自动选择
|
||||
mrdocClipperOptions.get(['mouseAutoSelect'], function(r){
|
||||
console.log(r)
|
||||
if(r['mouseAutoSelect']){
|
||||
// 设置启用
|
||||
// console.log('鼠标自动选择')
|
||||
$('input[name="mouse-auto-select"]').prop('checked',true)
|
||||
form.render('checkbox');
|
||||
}else{
|
||||
// 设置关闭
|
||||
// console.log('鼠标手动选择')
|
||||
$('input[name="mouse-auto-select"]').prop('checked',false)
|
||||
form.render('checkbox');
|
||||
}
|
||||
});
|
||||
//转存图片
|
||||
// mrdocClipperOptions.get(['retrieveImg'],function(r){
|
||||
// if(r['retrieveImg'] == true){
|
||||
@ -66,4 +83,40 @@ checkAccountKey = function(server_url,account_key){
|
||||
layer.closeAll('loading');
|
||||
$('button.layui-btn').attr("disabled",false);
|
||||
$('button.layui-btn').removeClass('layui-btn-disabled');
|
||||
}
|
||||
}
|
||||
|
||||
// 监听鼠标自动选择开关
|
||||
form.on('switch(mouseAutoSelect)', function(data){
|
||||
// console.log(data.elem.checked); //开关是否开启,true或者false
|
||||
// console.log(data.value); //开关value值,也可以通过data.elem.value得到
|
||||
mrdocClipperOptions = chrome.storage.local
|
||||
mrdocClipperOptions.set({'mouseAutoSelect':data.elem.checked})
|
||||
});
|
||||
|
||||
|
||||
//显示微信公众号二维码图片
|
||||
$("#wx_qrcode").click(function(r){
|
||||
var layer = layui.layer;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['auto'],
|
||||
skin: 'layui-layer-nobg', //没有背景色
|
||||
shadeClose: true,
|
||||
content: $('#wx_qrcode_img')
|
||||
});
|
||||
})
|
||||
|
||||
// 显示打赏图片
|
||||
$("#dashang").click(function(r){
|
||||
var layer = layui.layer;
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: false,
|
||||
closeBtn: 0,
|
||||
area: ['400px','400px'],
|
||||
shadeClose: true,
|
||||
content: $('#dashang_img')
|
||||
});
|
||||
})
|
@ -149,12 +149,39 @@ createInspector = function(autoExtractContent) {
|
||||
createInspector(false);
|
||||
|
||||
// 默认关闭鼠标选择标记框
|
||||
hideInspector = function(){
|
||||
parent.postMessage({
|
||||
name: 'hideinspectorfrommrdocpopup'
|
||||
}, '*');
|
||||
};
|
||||
hideInspector();
|
||||
// hideInspector = function(){
|
||||
// parent.postMessage({
|
||||
// name: 'hideinspectorfrommrdocpopup'
|
||||
// }, '*');
|
||||
// };
|
||||
// hideInspector();
|
||||
|
||||
// 获取鼠标选择开关状态
|
||||
getMouseSelectStatus = function(){
|
||||
var mrdocClipperOptions = chrome.storage.local;
|
||||
var form = layui.form;
|
||||
mrdocClipperOptions.get(['mouseAutoSelect'], function(r){
|
||||
console.log(r)
|
||||
if(r['mouseAutoSelect']){ //鼠标自动选择
|
||||
// 开启鼠标选择器
|
||||
parent.postMessage({
|
||||
name: 'showinspectorfrommrdocpopup'
|
||||
}, '*');
|
||||
// 更新渲染popup页面鼠标选择开关状态
|
||||
$("#mouse-select").prop('checked',true);
|
||||
form.render('checkbox');
|
||||
}else{ // 鼠标手动选择
|
||||
// 关闭鼠标选择器
|
||||
parent.postMessage({
|
||||
name: 'hideinspectorfrommrdocpopup'
|
||||
}, '*');
|
||||
// 更新渲染popup页面鼠标选择开关状态
|
||||
$("#mouse-select").prop('checked',false);
|
||||
form.render('checkbox');
|
||||
}
|
||||
});
|
||||
}
|
||||
getMouseSelectStatus();
|
||||
|
||||
|
||||
// 处理background发送来的页面剪藏内容,将其添加到文本编辑器中
|
||||
|
@ -16,30 +16,28 @@
|
||||
background-color: #fafafa;
|
||||
text-align: center;
|
||||
}
|
||||
/* .container{
|
||||
display: flex;
|
||||
display: -webkit-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
} */
|
||||
.login-form{
|
||||
margin-top: 15%;
|
||||
padding: 20px 50px 20px 60px;
|
||||
background-color: #fff;
|
||||
-webkit-box-shadow: #666 0px 0px 10px;
|
||||
-moz-box-shadow: #666 0px 0px 10px;
|
||||
box-shadow: #666 0px 0px 10px;
|
||||
-moz-box-shadow: #666 0px 0px 10px;
|
||||
box-shadow: #666 0px 0px 10px;
|
||||
}
|
||||
.register-link{
|
||||
font-size: 12px;
|
||||
}
|
||||
.layui-input{
|
||||
/* width: 500px; */
|
||||
.layui-form-label{
|
||||
width: auto;
|
||||
}
|
||||
.layui-form-onswitch {
|
||||
border-color: #1E9FFF;
|
||||
background-color: #1E9FFF;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-container">
|
||||
<div class="layui-container" style="width: 650px;">
|
||||
<div class="login-form">
|
||||
<div class="layui-form" >
|
||||
<div class="layui-form-item">
|
||||
@ -58,19 +56,58 @@
|
||||
<input type="text" id="mrdoc_token" name="mrdoc_account_key" placeholder="请输入用户token" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">鼠标自动选择</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="checkbox" name="mouse-auto-select" lay-filter='mouseAutoSelect' lay-skin='switch' lay-text='开启|关闭'>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn layui-btn-normal" type="button" id="checkKey">验证</button>
|
||||
<button class="layui-btn layui-btn-normal" type="button" id="save-btn">保存</button>
|
||||
</div>
|
||||
</div>
|
||||
<a class="register-link" href="http://mrdoc.zmister.com" target="_blank">使用帮助</a> -
|
||||
<a class="register-link" href="http://mrdoc.zmister.com" target="_blank">帮助</a> -
|
||||
<a class="register-link" href="https://gitee.com/zmister/MrDoc/" target="_blank">码云</a> -
|
||||
<a class="register-link" href="https://github.com/zmister2016/MrDoc" target="_blank">GitHub</a>
|
||||
<a class="register-link" href="https://github.com/zmister2016/MrDoc" target="_blank">GitHub</a> -
|
||||
<a class="register-link" id="wx_qrcode" href="javascript:void(0);">微信公众号</a> -
|
||||
<a class="register-link" id="dashang" href="javascript:void(0);">打赏作者</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<!-- 微信公众号二维码图片 -->
|
||||
<img id="wx_qrcode_img" style="display: none;" src="img/wx_qrcode.jpg" />
|
||||
<!-- 打赏选项卡模板 -->
|
||||
<div id="dashang_img" style="display: none;">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">微信</li>
|
||||
<li>支付宝</li>
|
||||
<li>QQ支付</li>
|
||||
<li>PayPal</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content" style="height: 100px;">
|
||||
<div class="layui-tab-item layui-show" align='center'>
|
||||
<img src="img/dashang_wx.jpg" style="width: 300px;height: auto;" />
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<img src="img/dashang_alipay.jpg" style="width: 300px;height: auto;" />
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<img src="img/dashang_qq.png" style="width: 300px;height: auto;" />
|
||||
</div>
|
||||
<div class="layui-tab-item" align='center'>
|
||||
<a href="https://paypal.me/zmister" target="_blank">
|
||||
<img src="img/dashang_paypal.png" style="width: 280px;height: auto;" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="js/lib/jquery-2.1.1.min.js"></script>
|
||||
<script src="layui/layui.all.js"></script>
|
||||
<script src="js/options.js"></script>
|
||||
|
@ -41,15 +41,15 @@
|
||||
<textarea name="editor" id="editor"></textarea>
|
||||
</div>
|
||||
<div class="bottom">
|
||||
<label class="layui-form-label" style="padding-left: 0;">鼠标选择</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="checkbox" id="mouse-select" lay-skin="switch" lay-text="开启|关闭"/>
|
||||
</div>
|
||||
<label style="float:right;margin-top: 5px;">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm" id="resetbtn" title="重置内容">重 置</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="savebtn" title="保存文档">保 存</a>
|
||||
<label class="layui-form-label" style="padding-left: 0;">鼠标选择</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="checkbox" id="mouse-select" lay-skin="switch" lay-text="开启|关闭"/>
|
||||
</div>
|
||||
<label style="float:right;margin-top: 5px;">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-sm" id="resetbtn" title="重置内容">重 置</a>
|
||||
<a class="layui-btn layui-btn-normal layui-btn-sm" id="savebtn" title="保存文档">保 存</a>
|
||||
|
||||
</label>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user