You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

universal_function.js 1.1 kB

1234567891011121314151617181920212223242526272829
  1. //仿GM_xmlhttpRequest函数v1.3
  2. if (typeof(GM_xmlhttpRequest) == "undefined") {
  3. var GM_xmlhttpRequest = function(GM_param) {
  4. var xhr = new XMLHttpRequest(); //创建XMLHttpRequest对象
  5. xhr.open(GM_param.method, GM_param.url, true);
  6. if (GM_param.responseType) xhr.responseType = GM_param.responseType;
  7. if (GM_param.overrideMimeType) xhr.overrideMimeType(GM_param.overrideMimeType);
  8. xhr.onreadystatechange = function() //设置回调函数
  9. {
  10. if (xhr.readyState === xhr.DONE) {
  11. if (xhr.status === 200 && GM_param.onload)
  12. GM_param.onload(xhr);
  13. if (xhr.status !== 200 && GM_param.onerror)
  14. GM_param.onerror(xhr);
  15. }
  16. }
  17. for (var header in GM_param.headers) {
  18. xhr.setRequestHeader(header, GM_param.headers[header]);
  19. }
  20. xhr.send(GM_param.data ? GM_param.data : null);
  21. }
  22. }
  23. //数字补0
  24. function PrefixInteger(num, length) {
  25. return (Array(length).join('0') + num).slice(-length);
  26. }

智龙迷城队伍图制作工具

Contributors (1)