// ==UserScript==
// @name 精易论坛-定制区小助手
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Su
// @description 快捷自定义回复,一键回帖,快速接单。
// @match https://bbs.125.la/*
// @require https://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @grant GM_xmlhttpRequest
// @grant GM_setValue
// @grant GM_getValue
// @downloadURL https://update.greasyfork.icu/scripts/407590/%E7%B2%BE%E6%98%93%E8%AE%BA%E5%9D%9B-%E5%AE%9A%E5%88%B6%E5%8C%BA%E5%B0%8F%E5%8A%A9%E6%89%8B.user.js
// @updateURL https://update.greasyfork.icu/scripts/407590/%E7%B2%BE%E6%98%93%E8%AE%BA%E5%9D%9B-%E5%AE%9A%E5%88%B6%E5%8C%BA%E5%B0%8F%E5%8A%A9%E6%89%8B.meta.js
// ==/UserScript==
(function () {
function getValue(name){
//加载配置
return GM_getValue(name);
}
function setValue(){
//保存配置
var ret=GM_setValue("kjhf",$("#conf").val());
getConf();
return ret;
}
function getConf(){
//获取快捷回复内容
var conf = getValue("kjhf");
var arr=conf.split('\n');
$("#kjhf").html("");
console.log(arr.length)
if(conf==''){$("#kjhf").append('')}
for(var i=0;i'+arr[i]+'')
}
}
};
var setting = function () {
var conf =getValue("kjhf");
layer.open({
type: 1,
title: "设置快捷回复内容(一行一条)",
closeBtn: false,
area: "540px;",
shade: 0.8,
id: "LAY_layuipro",
resize: false,
btn: ["保存", "关闭"],
btnAlign: "c",
moveType: 1,
content: '',
success: function (layero) {
var btn = layero.find('.layui-layer-btn');
btn.find('.layui-layer-btn0').on("click",setValue);
//btn.find(".layui-layer-btn0").addEventListener("click",setValue);
},
});
};
function send() {
$("#fastpostmessage").val($("#kjhf option:selected").text());
ajaxpost('fastpostform', 'fastpostreturn', 'fastpostreturn', 'onerror', $('fastpostsubmit'));
var _val = $.map($("#kjhf option:not(:selected)"), function (ele) {
return ele.text;
}).join("\n");
var conf = $("#kjhf option:selected").text() + "\n" + _val;
GM_setValue("kjhf",conf)
setTimeout(() => {
window.location.reload();
window.scrollTo(0, 0);
//刷新
}, 2000);
}
var plate = $("#pt .z a").eq(3).text();
if(plate=="APP/WEB 定制"){ $(".jiedan").hide();
$("head").append(
""
);
var parent = $("#postlist tbody .pcb").eq(0);
$(parent).prepend('
');
$(parent).prepend(
''
)
var btn= document.getElementById("getConf");
btn.addEventListener("click",setting)
var btn_send= document.getElementById("send");
btn_send.addEventListener("click",send)
getConf();}
})();