普特莫斯维基 (Purtmars Wikipedia 📖)

“Chemdah 用户文档目录”的版本间的差异

来自Purtmars Wikipedia —— 普特莫斯维基
 
(未显示同一用户的21个中间版本)
第1行: 第1行:
{{:GrowlNotification}}
 
<html>
 
<script>
 
(function() {
 
 
    var watermark = function(self) {
 
        this.elem = self;
 
    }
 
 
    watermark.prototype = {
 
        options: {
 
            canvas: []
 
        },
 
        init: function(options) {
 
            $.extend(this.options, this.defaults, options);
 
            var $body = $('body'),
 
                can1 = this.__createCanvas($body),
 
                can2 = this.__createCanvas($body),
 
                canAll = this.__createCanvas($body),
 
                settings = this.options,
 
                txtlen = settings.texts.length;
 
            settings.deg = settings.textRotate * Math.PI / 180;
 
            this.__calcTextSize($body);
 
            var repeatTimes = Math.ceil(screen.width / settings.txts.length / settings.width);
 
            settings.canvasWidth = settings.canvasWidth * repeatTimes;
 
            var extTxts = [];
 
            while (repeatTimes--)
 
                extTxts = extTxts.concat(settings.txts);
 
            settings.txts = extTxts;
 
 
            var fixH = settings.maxWidth * Math.abs(Math.sin(settings.deg)) + Math.cos(settings.deg) * settings.textHeight;
 
            if (fixH > settings.height)
 
                settings.height = fixH;
 
            var ctx1 = this.__setCanvasStyle(can1, settings.canvasWidth, settings.height);
 
            var ctx2 = this.__setCanvasStyle(can2, settings.canvasWidth, settings.height);
 
            var ctx = this.__setCanvasStyle(canAll, settings.canvasWidth, settings.height * 2, true);
 
 
            this.__drawText(ctx1, settings.txts);
 
            this.__drawText(ctx2, settings.txts.reverse());
 
            ctx.drawImage(can1, 0, 0, settings.canvasWidth, settings.height);
 
            ctx.drawImage(can2, 0, settings.height, settings.canvasWidth, settings.height);
 
            var dataURL = canAll.toDataURL("image/png");
 
            $(this.elem).css('backgroundImage', "url(" + dataURL + ")");
 
        },
 
        __createCanvas: function($container) {
 
            var canvas = document.createElement('canvas');
 
            $container.append(canvas);
 
            this.options.canvas.push(canvas);
 
            return canvas;
 
        },
 
        __calcTextSize: function($container) {
 
            var txts = [],
 
                maxWidth = 0,
 
                canvasWidth = 0,
 
                settings = this.options;
 
            $.each(settings.texts, function(i, text) {
 
                var span = $('<span style="font:' + settings.textFont + ';visibility: hidden;display: inline-block;"> ' + text + '</span>')
 
                    .appendTo($container);
 
                var tWidth = span[0].offsetWidth,
 
                    tHeight = span[0].offsetHeight;
 
                span.remove();
 
                txts.push({
 
                    txt: text,
 
                    width: tWidth,
 
                    height: tHeight
 
                });
 
                maxWidth = Math.max(maxWidth, tWidth);
 
                settings.textHeight = tHeight;
 
                var shadow = Math.cos(settings.deg) * tWidth;
 
                canvasWidth += (settings.width < shadow ? shadow : settings.width) - tHeight * Math.sin(settings.deg);
 
            });
 
            settings.txts = txts;
 
            settings.maxWidth = maxWidth;
 
            settings.canvasWidth = canvasWidth;
 
        },
 
        __setCanvasStyle: function(canvas, width, height, notextstyle) {
 
            canvas.width = width;
 
            canvas.height = height;
 
            canvas.style.display = 'none';
 
 
            var ctx = canvas.getContext('2d');
 
            if (!notextstyle) {
 
                var deg = this.options.deg,
 
                    absSindeg = Math.abs(Math.sin(deg));
 
                ctx.rotate(deg);
 
                var offset = absSindeg * this.options.height - this.options.textHeight * absSindeg;
 
                var nx = -offset * Math.cos(deg),
 
                    ny = -offset * absSindeg;
 
                ctx.translate(nx, ny * absSindeg);
 
 
                ctx.font = this.options.textFont;
 
                ctx.fillStyle = this.options.textColor;
 
                ctx.textAlign = 'left';
 
                ctx.textBaseline = 'Middle';
 
            }
 
            return ctx;
 
        },
 
        __drawText: function(ctx, txts) {
 
            var settings = this.options;
 
            $.each(txts, function(i, obj) {
 
 
                var wnap = (settings.maxWidth - obj.width) / 2;
 
                var x = settings.width * Math.cos(settings.deg) * i,
 
                    y = -x * Math.tan(settings.deg) + settings.height;
 
                ctx.fillText(obj.txt, x + wnap, y);
 
            });
 
        },
 
        __destory: function() {
 
            $.each(this.options.canvas, function(i, canvas) {
 
                canvas.remove();
 
                canvas = null;
 
            });
 
        }
 
    }
 
 
    $.fn.watermark = function(options) {
 
        new watermark(this).init(options);
 
    }
 
 
})(jQuery);
 
 
$(document).ready(function() {
 
    if ($("#pt-userpage a").html() != null) {
 
        $('body').watermark({
 
            texts: [$("#pt-userpage a").html()],
 
            textColor: "rgb(240, 240, 240)",
 
            textFont: '16px 微软雅黑',
 
            width: 300,
 
            height: 200,
 
            textRotate: -30
 
        });
 
    }
 
});
 
    GrowlNotification.notify({
 
        title: '注意!',
 
        description: '当前正在浏览私有页面, 请勿传播内容副本.',
 
        type: 'error',
 
        position: 'top-right',
 
        closeTimeout: 10000,
 
        showProgress: true
 
    });
 
</script>
 
</html>
 
 
<div style="margin-top: -18px"></div>
 
<div style="margin-top: -18px"></div>
 +
{{:Chemdah Watermark}}
 
= 目录 =
 
= 目录 =
* 开始
+
* [[Chemdah]]
* 基本
+
* [[ChemdahPremium:开始|开始]]
 +
* '''基本'''
 +
** [[ChemdahPremium:配置文件|配置文件]]
 +
** [[ChemdahPremium:语言文件|语言文件]]
 +
* '''[[ChemdahPremium:命令|命令]]'''
 +
** [[ChemdahPremium:命令#/chemdah|/chemdah]]
 +
** [[ChemdahPremium:命令#/chemdahapi|/chemdahapi]]
 +
** [[ChemdahPremium:命令#/chemdahplayerdata|/chemdahplayerdata]]
 +
** [[ChemdahPremium:命令#/chemdahplayerlevel|/chemdahplayerlevel]]
 +
** [[ChemdahPremium:命令#/chemdahquest|/chemdahquest]]
 +
** [[ChemdahPremium:命令#/chemdahscript|/chemdahscript]]
 +
** [[ChemdahPremium:命令#/chemdahvariables|/chemdahvariables]]
 +
* '''核心'''
 +
** '''[[ChemdahPremium:对话|对话]]'''
 +
*** [[ChemdahPremium:对话#对话的工作流程|对话工作流程]]
 +
*** [[ChemdahPremium:对话#对话结构|对话结构]]
 +
*** [[ChemdahPremium:对话#对话约束|对话约束]]
 +
*** [[ChemdahPremium:对话#对话中使用脚本代理|对话中使用脚本代理]]
 +
*** [[ChemdahPremium:对话#对话风格|对话风格]]
 +
*** [[ChemdahPremium:对话#对话设置文件(对话风格设置文件)|对话风格设置文件]]
 +
*** [[ChemdahPremium:对话#对话触发器与支持的插件列表|对话触发器与支持的插件列表]]
 +
** '''[[ChemdahPremium:任务|任务]]'''
 +
*** [[ChemdahPremium:任务#任务的工作流程|任务工作流程]]
 +
*** [[ChemdahPremium:任务#任务结构|任务结构]]
 +
*** [[ChemdahPremium:任务#任务中使用脚本代理|任务中使用脚本代理]]
 +
*** [[ChemdahPremium:任务类型|任务类型]]
 +
*** '''[[ChemdahPremium:组件|组件]]'''
 +
**** [[ChemdahPremium:组件#自动化|自动化]]
 +
**** [[ChemdahPremium:组件#追踪|追踪]]
 +
**** [[ChemdahPremium:组件#进度|进度]]
 +
**** [[ChemdahPremium:组件#纵览|纵览]]
 +
**** [[ChemdahPremium:组件#管制|管制]]
 +
**** [[ChemdahPremium:组件#超时|超时]]
 +
**** [[ChemdahPremium:组件#重启|重启]]
 +
**** [[ChemdahPremium:组件#依赖|依赖]]
 +
**** [[ChemdahPremium:组件#组队|组队与支持的插件列表]]
 +
*** '''[[ChemdahPremium:元数据|元数据]]'''
 +
**** [[ChemdahPremium:元数据#名称|名称]]
 +
**** [[ChemdahPremium:元数据#类型|类型]]
 +
*** '''[[ChemdahPremium:选择器|选择器]]'''
 +
**** [[ChemdahPremium:选择器#区域选择器|区域选择器]]
 +
**** [[ChemdahPremium:选择器#方块选择器|方块选择器]]
 +
**** [[ChemdahPremium:选择器#实体选择器|实体选择器与支持的插件列表]]
 +
**** [[ChemdahPremium:选择器#物品选择器|物品选择器与支持的插件列表]]
 +
*** [[ChemdahPremium:开发者模式|开发者模式]]
 +
** '''[[ChemdahPremium:数据库|数据库]]'''
 +
*** [[ChemdahPremium:数据库#LOCAL|LOCAL]]
 +
*** [[ChemdahPremium:数据库#SQL|SQL]]
 +
*** [[ChemdahPremium:数据库#MONGODB|MONGODB]]
 +
* '''[[ChemdahPremium:外置模块|外置模块]]'''
 +
** [[ChemdahPremium:外置模块#等级系统|等级系统]]
 +
** [[ChemdahPremium:外置模块#任务纵览|任务纵览]]
 +
** [[ChemdahPremium:外置模块#脚本文件|脚本文件]]
 +
** [[ChemdahPremium:外置模块#场景演出|场景演出]]
 +
** [[ChemdahPremium:外置模块#PlaceholderAPI|PlaceholderAPI]]

2021年6月14日 (一) 03:10的最新版本