Site Notice

hello, world

Difference between revisions of "MediaWiki:Js-ChaoXingDanMuZhuShou.js"

From Project-EPB Commons
(Created page with "→‎* *『Wjghj Project Static』 * This _JavaScript_ code is from https://common.wjghj.cn * CC BY-NC-SA *: window.loadSMM = setInterval(function () { if (typeof ($) !==...")
 
Line 10: Line 10:
 
     $('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="20"></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="20"></input></label><br/><button id="SMMbtn">发送</button> <label><input id="SMMconfirm" type="checkbox"></input>确认发送</label></div></div>');
 
     $('#SMMbtn').click(function () {
 
     $('#SMMbtn').click(function () {
       window.sendMsg($('#SMMcontent').val(), Number($('#SMMtimes').val()), false);
+
       sendMsgManager($('#SMMcontent').val(), Number($('#SMMtimes').val()), false);
 
     });
 
     });
 
   }
 
   }
 
}, 100);
 
}, 100);
  
window.sendMsg = function (msg, limit, confirm) {
+
window.sendMsgManager = function (msg, limit, confirm) {
 
   if (limit === undefined) limit = 1;
 
   if (limit === undefined) limit = 1;
 
   var times = 1;
 
   var times = 1;

Revision as of 22:54, 21 February 2020

/**
 *『Wjghj Project Static』
 * This _JavaScript_ code is from https://common.wjghj.cn
 * CC BY-NC-SA
 **/
window.loadSMM = setInterval(function () {
  if (typeof ($) !== 'undefined') {
    clearInterval(loadSMM);
    if ($('#SMM').length > 0) return;
    $('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="20"></input></label><br/><button id="SMMbtn">发送</button> <label><input id="SMMconfirm" type="checkbox"></input>确认发送</label></div></div>');
    $('#SMMbtn').click(function () {
      sendMsgManager($('#SMMcontent').val(), Number($('#SMMtimes').val()), false);
    });
  }
}, 100);

window.sendMsgManager = function (msg, limit, confirm) {
  if (limit === undefined) limit = 1;
  var times = 1;
  var start = setInterval(function () {
    if (times > limit) {
      clearInterval(start);
      return;
    }
    msg1 = msg.replace(/\$count/ig, times);
    $('#RKLBChat_sendText').val(msg1);
    if (confirm === true) {
      $('#RKLBChat_sendMsg').click();
    } else {
      console.info('这是debug模式\n发送信息:' + msg1 + '\n发送次数:(' + times + '/' + limit + ')');
    }
    times = ++times;
  }, 200);
}