针对canvas,jquery,VUE,base64,代码解密编写的简易代码

1:代码

function a() { }
a.prototype.canvas = function (element) {
    if (element.tagName == 'CANVAS') {
        this.ctx = element.getContext('2d');
    } else 
        console.error('This element is not canvas.')
}
a.prototype.r = function (x, y, width, height) {
    this.ctx.fillRect(x, y, width, height);
}
a.prototype.moveTo = function (x, y) {
    this.ctx.moveTo(x, y);
}
a.prototype.lineTo = function (x, y) {
    this.ctx.lineTo(x, y);
}
a.prototype.print = function () {
    this.ctx.stroke();
}
window.p = a();
window.pen = a();
function d(id_name) {
    this.id = document.querySelector(id_name);
    if (this.id == null)
        console.error('Don\'t have a element.')
};
d.prototype.remove = function () {
    this.id.remove();
}
d.prototype.text = function () {
    return this.id.innerText;
}
d.prototype.gtext = function (text) {
    this.id.innerText = text;
}
d.prototype.html = function () {
    return this.id.innerText;
}
d.prototype.ghtml = function (html) {
    this.id.innerHTML = html;
}
d.prototype.class = function () {
    return this.id.classnName;
}
d.prototype.gclass = function (CSS) {
    this.id.className = CSS;
}
d.prototype.id = function () {
    return this.id.innerText;
}
d.prototype.gid = function (id) {
    this.id.id = id;
}
d.prototype.on = function (_leixin, fangfa) {
    this.id['on' + _leixin] = fangfa;
}
d.prototype.click=function(){
    this.id.click()
}
d.prototype.style = function (leixing, style) {
    return this.id.style;
}
d.prototype.appendChild = function (code) {
    this.id.appendChild(code);
}
d.prototype.q = function () {
    return this.id;
}
window.$ = d()
function VUE(c) {
    var hc = document.getElementsByTagName('vue');
    if (c == null)
        console.error('C don\'t have text')
    for (var i = 0; i < hc.length; i++)
        if (c[hc[i].innerText])
            hc[i].innerHTML = c[hc[i].innerText];
}
function encode(str) {
    var encode = encodeURI(str);
    var base64 = btoa(encode);
    return base64;
}
function decode(str) {
    var decode = atob(str);
    var str = decodeURI(decode);
    return str;
}
function decrypt(code0, _code) {
    var code = code0.split('');
    var str = '';
    for (var i = 0; i < code.length; i++)
        if (/(^-?[0-9]+\.{1}\d+$)|(^-?[1-9][0-9]*$)|(^-?0{1}$)/.test(code[i]))
            code[i] = _code[Number(code[i])];
    for (var i = 0; i < code.length; i++)
        str += code[i];
    return str;
}

2:教程

1:canvas
属性 / 方法描述
pen/p.canvas(element)寻找标签
pen/p.r(x,y,width,height)画width*height的长方形到x,y坐标
pen/p.moveTo(x,y)将画笔移到x,y坐标
pen/p.lineTo(x,y)从当前坐标画直线到x,y坐标
pen/p.print()打印到上面element标签
2:jquery

注意:这里所有id填充:

属性描述
class.classname
id#idname
TagnameTagname
属性 / 方法描述
$(id).remove()删除自己
$(id).text()返回id里的文字(不包含html标签)
$(id).gtext(text)把id全部改为text(html标签无效)
$(id).html返回id里的文字(包含html标签)
$(id).gtext(html)把id全部改为text(html标签有效)
$(id).class返回id的class
$(id).gclass(CSS)把id的class改为CSS
$(id).id返回id的id
$(id).gid(id)把id的id改为id
$(id).on(lexing,style)leixing:如onmousedown-> mousedown,
$(id).on(lexing,style)style:如:function(){…}
$(id).click()虚拟按下id
$(id).style()返回该id的style
$(id).appendChild(code)把code放到id里
$(id).q()返回id

3:vue.js

和普通的vue没什么区别,只是:
{{a}}应改成<vue>a</vue>

4:数字转base64

属性 / 方法描述
encode(str)把str转为base64
decode(str)把str转为base64

5:代码解密编写

方法:decrypt(code0,_code)
如:

decrpyt(`function 0(){
	1 2
}`,['a','retrun','b'])
/*function a(){
	return b
}*/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值