用户:Salt lovely/沙盒

Salt lovely留言 | 贡献2022年7月10日 (日) 00:31的版本 (添加 “添加到页尾测试” 到页尾)

尚未实装,所以除了我以外的人都看不见2333

测试功能

/抓取MCBBS用户头像

新签名

/签名

样式测试

这是一段普通文字,这是一段红色文字这是一段内链文字这是一段外链文字

新章节: 测试

测试:添加新章节

JS代码存档

// MCBBS头像上传时三个大小头像切片上传代码 - 修改 - 启用抗锯齿
// 其实就加了两行
(0, eval)(`function saveAvatar() {
    var img = $('avatarimage');
    var sd = getSelectorDimention();
    var ad = getAvatarDimension();
    var rl = (sd.left-ad.left)/ad.width;
    var rt = (sd.top-ad.top)/ad.height;
    var rw = sd.width/ad.width;
    var rh = sd.height/ad.height;
    var iw = jQuery('#avatarimage').width();
    var ih = jQuery('#avatarimage').height();
    var sl = rl*iw;
    var st = rt*ih;
    var sw = rw*iw;
    var sh = rh*ih;
    var tw = sw;
    var th = sh;
    if (sw>200 || sh>250) {
        var r = Math.max(sw/200, sh/250);
        tw = Math.floor(sw/r);
        th = Math.floor(sh/r);
    }          
    var canvas = document.createElement('canvas');
    canvas.width = tw;
    canvas.height = th;
    var ctx = canvas.getContext("2d");
    ctx.fillStyle = 'white';
    ctx.fillRect(0, 0, tw, th);
    ctx.drawImage(img, sl, st, sw, sh, 0, 0, tw, th);
    ctx.imageSmoothingEnabled = true;   // 启用抗锯齿
    ctx.imageSmoothingQuality = "high"; // 高品质抗锯齿
    var dataURL = canvas.toDataURL("image/jpeg");
    jQuery('#avatar1').val(dataURL.substr(dataURL.indexOf(",") + 1));
    var tw = sw;
    var th = sh;
    if (sw>120 || sh>120) {
        var r = Math.max(sw/120, sh/120);
        tw = Math.floor(sw/r);
        th = Math.floor(sh/r);
    }     
    var canvas = document.createElement('canvas');
    canvas.width = tw;
    canvas.height = th;
    var ctx = canvas.getContext("2d");
    ctx.fillStyle = 'white';
    ctx.fillRect(0, 0, tw, th);
    ctx.drawImage(img, sl, st, sw, sh, 0, 0, tw, th);
    var dataURL = canvas.toDataURL("image/jpeg");
    jQuery('#avatar2').val(dataURL.substr(dataURL.indexOf(",") + 1));
    var mwh = Math.min(sw, sh);
    if (sw>mwh) {
        sl += Math.floor((sw-mwh)/2);
        sw = mwh;
    }
    if (sh>mwh) {
        st += Math.floor((sh-mwh)/2);
        sh = mwh;
    }
    var tw = 48;
    var th = 48;
    var canvas = document.createElement('canvas');
    canvas.width = tw;
    canvas.height = th;
    var ctx = canvas.getContext("2d");
    ctx.fillStyle = 'white';
    ctx.fillRect(0, 0, tw, th);
    ctx.drawImage(img, sl, st, sw, sh, 0, 0, tw, th);
    var dataURL = canvas.toDataURL("image/jpeg");
    jQuery('#avatar3').val(dataURL.substr(dataURL.indexOf(",") + 1));
    var src = $('avatarform').action;
    $('avatarform').action = data[data.indexOf('src')+1].replace('images/camera.swf?inajax=1', 'index.php?m=user&a=rectavatar&base64=yes');
    $('avatarform').target='rectframe'; 
}`)

添加新章节“新章节: 测试”

测试:添加新章节添加到页尾测试