// ==UserScript== // @name AC-论坛悬浮回复框 // @description 常用论坛的悬浮回复框,点击固定,再次点击缩回 // @namespace K // @include * // @version 2.7 // @note 反馈地址 http://bbs.kafan.cn/thread-2076136-1-1.html // @note V2.7 忘了关闭按键事件的LOG // @note V2.6 更新-修改为仅图标触发展开关闭效果,页面中点击不关闭输入框,避免误操作,输入框中输入内容不影响 & 新增Esc键关闭输入框 // @note V2.5 依据建议,替换为https的默认图片 // @note V2.4 修复回复框右键导致的设置框弹出,同时修改左右和上下位置调整 // @note V2.3 修复鼠标移开的悬浮框显示问题 // @note V2.2 根据图标和图标位置动态调整悬浮框的宽度 // @note V2.1 新增,鼠标移动到图标上显示悬浮框 // @note V2.0 修改为图标触发效果,支持自定义图标,左键(展开-关闭); 右键(设置界面) // @icon https://coding.net/u/zb227/p/zbImg/git/raw/master/img0/icon.jpg // @run-at document-end // @grant GM_registerMenuCommand // @grant GM_getValue // @grant GM_setValue // @downloadURL https://update.greasyfork.icu/scripts/27155/AC-%E8%AE%BA%E5%9D%9B%E6%82%AC%E6%B5%AE%E5%9B%9E%E5%A4%8D%E6%A1%86.user.js // @updateURL https://update.greasyfork.icu/scripts/27155/AC-%E8%AE%BA%E5%9D%9B%E6%82%AC%E6%B5%AE%E5%9B%9E%E5%A4%8D%E6%A1%86.meta.js // ==/UserScript== !function(){ var imgWidth = parseInt(GM_getValue("check_mWidth", 50)); //图标宽度 var imgHeight = parseInt(GM_getValue("check_mHeight", 50)); //图标高度 let defaultX = 400; try{defaultX = (document.body.offsetWidth - document.querySelector("#wp").offsetWidth) / 2 + 10}catch (e) {} var imgAtX = parseInt(GM_getValue("check_mAtX", defaultX)); //图标距离左边或者右边的距离 var imgAtY = parseInt(GM_getValue("check_mAtY", -40)); //图标距离顶部或底部的距离 var imgUrl = GM_getValue("check_mUrl", "https://a.ikafan.com/image/smiley/default/14.gif"); // 图标地址 var configForm; // 设置界面 /***打开设置页面的函数***/ function showConfigFlashRpy () { configForm = document.createElement("div"); configForm.className = "acConfigSetRpy"; document.body.appendChild(configForm); configForm.style = "width: 520px; font-size: 14px; position: fixed; color: rgb(0, 0, 0); z-index: 99; box-shadow: 2px 2px 3px rgba(0, 0, 0, 0.5); border: 1px solid rgb(204, 204, 204); background: rgba(255, 255, 255, 0.9) none repeat scroll 0% 0%; border-top-right-radius: 2px; border-bottom-left-radius: 2px; padding: 10px; left: 0px; right: 0px; top: 0px; bottom: 0px; margin: auto; height: 290px; max-height: 90%; overflow: auto; text-align: center; -moz-user-select: none;"; configForm.appendChild(createTextNode("透明图片请用PNG或者GIF格式, 保存之后刷新页面即可", 1)); configForm.appendChild(createTextNode("图标的地址:")); var check_mUrl = configForm.appendChild(createInputNode(imgUrl)).firstChild; configForm.appendChild(createTextNode("图标距两边的距离[左正右负]:")); var check_mAtX = configForm.appendChild(createInputNode(imgAtX)).firstChild; configForm.appendChild(createTextNode("图标距上下的距离[上正下负]:")); var check_mAtY = configForm.appendChild(createInputNode(imgAtY)).firstChild; configForm.appendChild(createTextNode("图标宽度:")); var check_mWidth = configForm.appendChild(createInputNode(imgWidth)).firstChild; configForm.appendChild(createTextNode("图标高度:")); var check_mHeight = configForm.appendChild(createInputNode(imgHeight)).firstChild; var check_mSave = configForm.appendChild(createButtonNode("保存")); var check_mCancel = configForm.appendChild(createButtonNode("取消")); check_mSave.onclick = function(){ //检查属性是否符合规则 if(check_mUrl.value.indexOf("http") != 0){ alert("地址不规范"); }else if(/^\d+$/.test(check_mAtX) || /^\d+$/.test(check_mAtY) || /^\d+$/.test(check_mWidth) || /^\d+$/.test(check_mHeight)){ alert("请输入整数"); } //使用保存数据的功能 GM_setValue("check_mUrl", check_mUrl.value); GM_setValue("check_mAtX", check_mAtX.value); GM_setValue("check_mAtY", check_mAtY.value); GM_setValue("check_mWidth", check_mWidth.value); GM_setValue("check_mHeight", check_mHeight.value); configForm.remove(); location.reload(); } check_mCancel.onclick = function(){ configForm.remove(); } //configForm.innerHTML = "