file.js
来自「在线生成手机二维码的源程序」· JavaScript 代码 · 共 26 行
JS
26 行
function File(filename,mode){
this.offset = 0;
this.binmode = (/bin/.test(mode)) ? true : false ;
var req = new XMLHttpRequest;
if(this.binmode) filename+=".hex";
req.open("GET",filename,false);
req.send(null);
this.file = req.responseText;
}
File.open = function(filename,mode){
return new File(filename,mode)
}
File.prototype.read = function(length){
if(this.binmode){length *= 2}
var res = this.file.substr(this.offset,length)
this.offset += length;
if(this.binmode){
res = res.pack();
}
return res
}
File.prototype.close = null;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?