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
Tagname
Tagname
属性 / 方法 描述 $(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' ] )