Site Notice
hello, world
Difference between revisions of "MediaWiki:Js-ChaoXingDanMuZhuShou.js"
From Project-EPB Commons
([InPageEdit] 没有编辑摘要) |
([InPageEdit] 没有编辑摘要) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
clearInterval(loadSMM); | clearInterval(loadSMM); | ||
if ($('#SMM').length > 0) return; | if ($('#SMM').length > 0) return; | ||
+ | |||
$('head').append('<link rel="stylesheet" href="https://common.wjghj.cn/css/ChaoXingDanMuZhuShou">'); | $('head').append('<link rel="stylesheet" href="https://common.wjghj.cn/css/ChaoXingDanMuZhuShou">'); | ||
$('body').append('<div id="SMM"><div id="SMMdrag"></div><div id="SMMinner">发送内容:<br/><textarea id="SMMcontent"></textarea><br/><label>发送次数:<br/><input id="SMMtimes" type="number" value="1" min="1" max="50"></input></label><br/><button id="SMMbtn">发送</button> <label><input id="SMMconfirm" type="checkbox"></input>确认发送</label></div></div>'); | $('body').append('<div id="SMM"><div id="SMMdrag"></div><div id="SMMinner">发送内容:<br/><textarea id="SMMcontent"></textarea><br/><label>发送次数:<br/><input id="SMMtimes" type="number" value="1" min="1" max="50"></input></label><br/><button id="SMMbtn">发送</button> <label><input id="SMMconfirm" type="checkbox"></input>确认发送</label></div></div>'); | ||
+ | |||
+ | $('#SMMdrag').mousedown(dragAble); | ||
+ | |||
$('#SMMbtn').click(function () { | $('#SMMbtn').click(function () { | ||
var sendContent = $('#SMMcontent').val(), | var sendContent = $('#SMMcontent').val(), | ||
Line 20: | Line 24: | ||
isConfirm = $('#SMMconfirm').prop('checked'); | isConfirm = $('#SMMconfirm').prop('checked'); | ||
if (sendContent === '') return; | if (sendContent === '') return; | ||
− | $('#SMMcontent').val(''); | + | // $('#SMMcontent').val(''); |
+ | // $('#SMMtimes').val('1'); | ||
$('#SMMconfirm').prop('checked', false); | $('#SMMconfirm').prop('checked', false); | ||
+ | if (sendTimes > 50) sendTimes = 50; | ||
window.sendMsg(sendContent, sendTimes, isConfirm); | window.sendMsg(sendContent, sendTimes, isConfirm); | ||
}); | }); | ||
Line 28: | Line 34: | ||
window.sendMsg = function (msg, limit, confirm) { | window.sendMsg = function (msg, limit, confirm) { | ||
+ | if (!confirm) return; | ||
if (limit === undefined) limit = 1; | if (limit === undefined) limit = 1; | ||
var times = 1; | var times = 1; | ||
Line 33: | Line 40: | ||
if (times > limit) { | if (times > limit) { | ||
clearInterval(start); | clearInterval(start); | ||
+ | $('#SMMbtn').attr('disabled',false).text('发送'); | ||
return; | return; | ||
} | } | ||
− | msg1 = msg.replace(/\$count/ig, times); | + | $('#SMMbtn').attr('disabled','disabled').text('发送中(' + times + '/' + limit + ')'); |
+ | msg1 = msg.replace(/(\$count|\$次数)/ig, times); | ||
+ | |||
$('#RKLBChat_sendText').val(msg1); | $('#RKLBChat_sendText').val(msg1); | ||
− | + | $('#RKLBChat_sendMsg').click(); | |
− | + | console.info('这是debug信息\n发送信息:' + msg1 + '\n发送次数:(' + times + '/' + limit + ')'); | |
− | |||
− | |||
− | |||
times = ++times; | times = ++times; | ||
− | }, | + | }, 250); |
} | } | ||
+ | |||
+ | // Dragable | ||
+ | window.dragAble = function (e) { | ||
+ | var element = $(this); | ||
+ | var baseX = e.clientX; | ||
+ | var baseY = e.clientY; | ||
+ | var baseOffsetX = element.parent().offset().left; | ||
+ | var baseOffsetY = element.parent().offset().top; | ||
+ | $(document).mousemove(function (e) { | ||
+ | element.parent().css({ | ||
+ | 'left': baseOffsetX + e.clientX - baseX, | ||
+ | 'top': baseOffsetY + e.clientY - baseY, | ||
+ | 'bottom': 'auto' | ||
+ | }); | ||
+ | }); | ||
+ | $(document).mouseup(function () { | ||
+ | $(document).unbind('mousemove'); | ||
+ | $(document).unbind('mouseup'); | ||
+ | dragAble(element); | ||
+ | }); | ||
+ | }; |
Latest revision as of 00:55, 22 February 2020
/**
*『Wjghj Project Static』
* This _JavaScript_ code is from https://common.wjghj.cn
* CC BY-NC-SA
*
* <超星直播网课弹幕助手>
* 用途:可以用快的飞起的速度狂刷评论,甚至是一口气发数十个评论
* 警告:别刷太多了小心老师打人!!!
* 用法:使用 CustomStyleScript 等浏览器插件在 https://live-rk.chaoxing.com 域名下加载本脚本
**/
window.loadSMM = setInterval(function () {
if (typeof ($) !== 'undefined') {
clearInterval(loadSMM);
if ($('#SMM').length > 0) return;
$('head').append('<link rel="stylesheet" href="https://common.wjghj.cn/css/ChaoXingDanMuZhuShou">');
$('body').append('<div id="SMM"><div id="SMMdrag"></div><div id="SMMinner">发送内容:<br/><textarea id="SMMcontent"></textarea><br/><label>发送次数:<br/><input id="SMMtimes" type="number" value="1" min="1" max="50"></input></label><br/><button id="SMMbtn">发送</button> <label><input id="SMMconfirm" type="checkbox"></input>确认发送</label></div></div>');
$('#SMMdrag').mousedown(dragAble);
$('#SMMbtn').click(function () {
var sendContent = $('#SMMcontent').val(),
sendTimes = Number($('#SMMtimes').val()),
isConfirm = $('#SMMconfirm').prop('checked');
if (sendContent === '') return;
// $('#SMMcontent').val('');
// $('#SMMtimes').val('1');
$('#SMMconfirm').prop('checked', false);
if (sendTimes > 50) sendTimes = 50;
window.sendMsg(sendContent, sendTimes, isConfirm);
});
}
}, 100);
window.sendMsg = function (msg, limit, confirm) {
if (!confirm) return;
if (limit === undefined) limit = 1;
var times = 1;
var start = setInterval(function () {
if (times > limit) {
clearInterval(start);
$('#SMMbtn').attr('disabled',false).text('发送');
return;
}
$('#SMMbtn').attr('disabled','disabled').text('发送中(' + times + '/' + limit + ')');
msg1 = msg.replace(/(\$count|\$次数)/ig, times);
$('#RKLBChat_sendText').val(msg1);
$('#RKLBChat_sendMsg').click();
console.info('这是debug信息\n发送信息:' + msg1 + '\n发送次数:(' + times + '/' + limit + ')');
times = ++times;
}, 250);
}
// Dragable
window.dragAble = function (e) {
var element = $(this);
var baseX = e.clientX;
var baseY = e.clientY;
var baseOffsetX = element.parent().offset().left;
var baseOffsetY = element.parent().offset().top;
$(document).mousemove(function (e) {
element.parent().css({
'left': baseOffsetX + e.clientX - baseX,
'top': baseOffsetY + e.clientY - baseY,
'bottom': 'auto'
});
});
$(document).mouseup(function () {
$(document).unbind('mousemove');
$(document).unbind('mouseup');
dragAble(element);
});
};