Skip to content

Commit

Permalink
updated spec, reader tool added
Browse files Browse the repository at this point in the history
  • Loading branch information
ogewan committed Jul 9, 2015
1 parent 192fa12 commit b0fae47
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 69 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ attribute to preload images but not implemented yet
**1.9.1** App pages added

**1.9.2** Major bugfixes, including null and undefined property checking
* addendum: bugfixes on direction js, properties are now more clear

### comix-ngn Writer version 1.2.0 (beta)
### comix-ngn Writer version 1.1.0 (beta)
**0.5.0**: "Initial Setup, Versioning

**0.8.0**: Huge implementations, Object config by dynamic form injection for Page and Chapter, Setting config compartmentalized, design config added
Expand All @@ -144,9 +145,5 @@ attribute to preload images but not implemented yet

**1.1.0**: Setup for refactoring, all JS re-specified and deferred, js enclosed in closure

**1.1.5**: Refactoring begun, all dependicies included and deferred, writer has been beautified for legibility, but there is now writer.min.html which is the compressed version

**1.2.0**: Added spiner config, spinner needs to be refactor

### comix-ngn Pyoofreader Version 0.1.0 (beta)
**0.1.0**: Implemented version, counts page dif and warns of Mismatch
23 changes: 11 additions & 12 deletions comixngn.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,17 @@ cG.REPO.producer = {"def":N};

///////
cG.REPO.stage = {"def":{id:"def",construct:function(name,scriptt,anchor,options){
var direction=function(d,l){if(void 0===d)return-1;if("string"===typeof d)d={parent:null,offset:0,loading:{lines:16,rate:1E3/30,width:250,height:250,xpos:.5,ypos:.5,back:"#FFF",color:"#373737"},config:{dir:"assets/",pagestartnum:!1,chapterstartnum:!1,imgprebuffer:5,imgpostbuffer:5,startpage:0,back:"#FFF"},pages:[{alt:"",hover:"",title:"",url:[d],release:0,note:"",perm:!1,anim8:!1}],chapters:[]};else if(Array.isArray(d)){for(var m={parent:null,offset:0,loading:{lines:16,rate:1E3/30,width:250,height:250,
xpos:.5,ypos:.5,back:"#FFF",color:"#373737"},config:{dir:"assets/",pagestartnum:!1,chapterstartnum:!1,imgprebuffer:5,imgpostbuffer:5,startpage:0,back:"#FFF"},pages:[],chapters:[]},b=0;b<d.length;b++)if(m.pages.push({alt:"",hover:"",title:"",url:[],release:0,note:"",perm:!1,anim8:!1}),Array.isArray(d[b]))for(var x=0;x<d[b].length;x++)m.pages[b].url.push(d[b][x]);else m.pages[b].url.push(d[b]);d=m}else if(void 0===d.pages[0].url)return-1;if(void 0===l||null==l)l=0;var e=d.pages,n=d.pages.length,y=!0,
r=-1,k=d.loading,p=d.config,t=[],u=[],h=new Image,z=!0,A={acW:300,acH:300},c=[document.createElement("canvas"),document.createElement("canvas")],B=c[1].getContext("2d"),D=b=function(){return 0},v=b,E=b,w={context:c[0].getContext("2d"),color:k.color,start:Date.now(),lines:k.lines,cW:k.width,cH:k.height,acW:c[1].width,acH:c[1].height,rate:k.rate},F=function(a){var b=Math.floor((Date.now()-a.start)/1E3*a.lines)/a.lines,g=a.color.substr(1);a.context.save();a.context.clearRect(0,0,a.acW,a.acH);a.context.translate(a.acW/
2,a.acH/2);a.context.rotate(2*Math.PI*b);3==g.length&&(g=g[0]+C[0]+g[1]+g[1]+g[2]+g[2]);for(var b=parseInt(g.substr(0,2),16).toString(),c=parseInt(g.substr(2,2),16).toString(),g=parseInt(g.substr(4,2),16).toString(),d=0;d<a.lines;d++)a.context.beginPath(),a.context.rotate(2*Math.PI/a.lines),a.context.moveTo(a.cW/10,0),a.context.lineTo(a.cW/4,0),a.context.lineWidth=a.cW/30,a.context.strokeStyle="rgba("+b+","+c+","+g+","+d/a.lines+")",a.context.stroke();a.context.restore();y&&window.setTimeout(F,a.rate,
w)},G=function(a,b){if(null===a||void 0===a)a={x:0,y:0};else if(isNaN(a)){if(null===a.y||void 0===a.y)a.y=0;if(null===a.x||void 0===a.x)a.x=0}else a={x:0,y:a};if(null===b||void 0===b)b=400;0>a.y&&(a.y=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight);0>a.x&&(a.x=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth);var c={x:void 0!==window.pageXOffset?a.x-window.pageXOffset:a.x-document.documentElement.scrollLeft,y:void 0!==window.pageYOffset?
a.y-window.pageYOffset:a.y-document.documentElement.scrollTop};if(c=={x:0,y:0})return c;var d=function(a,b,c){window.scrollBy(Math.floor(a.x)/b,Math.floor(a.y)/b);c+1<5*b&&window.setTimeout(d,5,a,b,c+1)};window.setTimeout(d,5,c,Math.floor(b/5),0);return c},m=function(){e[this.imaginaryID].loaded=!0},q=function(a,b){y=!0;window.setTimeout(F,k.rate,w);D();e[b].loaded||B.clearRect(0,0,c[1].width,c[1].height);a.imaginaryID=b;a.src=p.dir+e[b].url[0];for(var d=0,f=b-1;f>b-p.imgprebuffer-1&&0<=f;f--)e[f].loaded||
(u[d].imaginaryID=f,u[d].src=p.dir+e[f].url,d++);d=0;for(f=b+1;f<p.imgpostbuffer+b+1&&f<n;f++)e[f].loaded||(t[d].imaginaryID=f,t[d].src=p.dir+e[f].url,d++)};this.count=function(){return n};this.current=function(){return r};this.callback=function(a,b){if(null===a||void 0===a)return v;if(null===b||void 0===b)return a?0<a?D:E:v;a?0<a?D=b:E=b:v=b;return 1};this.go=function(a){a=null===a||void 0===a?0:parseInt(a,10);a=isNaN(a)?0:a;q(h,Math.floor(Math.max(0,Math.min(n-1,a))));return a};this.prev=function(){var a=
r-1;0<=a&&q(h,a);return a};this.next=function(){var a=r+1;a<n&&q(h,a);return a};this.frst=function(){0<=r&&q(h,0);return 0};this.last=function(){q(h,n-1);return n-1};this.rand=function(){var a=Math.floor(Math.random()*(n-1));q(h,a);return a};this.scroll=function(a){return null===a||void 0===a?z:z=a};this.scrollTo=function(a,b){return G(a,b)};c[0].height=480;c.width=640;c[0].style.background=k.back;c[0].style.zIndex=0;c[0].style.position="absolute";A=w;l?l.appendChild(c[0]):document.body.appendChild(c[0]);
window.setTimeout(F,k.rate,w);h=new Image;h.imaginaryID=-1;h.addEventListener("load",function(){e[this.imaginaryID].loaded?B.clearRect(0,0,this.width,this.height):e[this.imaginaryID].loaded=!0;v();c[1].width=c[0].width=A.acW=this.width;c[1].height=c[0].height=A.acH=this.height;B.drawImage(this,0,0);r=this.imaginaryID;y=0;z&&G();E()},!1);for(b=0;b<e.length;b++)e[b].desig=b?b==e.length-1?1:0:-1,e[b].loaded=!1;for(b=0;b<d.config.imgprebuffer;b++)u.push(new Image),u[b].imaginaryID=-1,u[b].addEventListener("load",
m,!1);for(b=0;b<d.config.imgpostbuffer;b++)t.push(new Image),t[b].imaginaryID=-1,t[b].addEventListener("load",m,!1);c[1].height=480;c[1].width=640;c[1].background=p.back;c[1].style.zIndex=1;c[1].style.position="absolute";l?l.appendChild(c[1]):document.body.appendChild(c[1])};
/*var sd = glue(spec,scriptt);
console.log(sd);*/
var direction=function(d,k){if(void 0===d)return-1;if("string"===typeof d)d={parent:null,offset:0,loading:{lines:16,rate:1E3/30,diameter:250,xpos:.5,ypos:.5,back:"#FFF",color:"#373737"},config:{dir:"assets/",pagestartnum:!1,chapterstartnum:!1,imgprebuffer:5,imgpostbuffer:5,startpage:0,back:"#FFF"},pages:[{alt:"",hover:"",title:"",url:[d],release:0,note:"",perm:!1,anim8:!1}],chapters:[]};else if(Array.isArray(d)){for(var l={parent:null,offset:0,loading:{lines:16,rate:1E3/30,diameter:250,xpos:.5,ypos:.5,
back:"#FFF",color:"#373737"},config:{dir:"assets/",pagestartnum:!1,chapterstartnum:!1,imgprebuffer:5,imgpostbuffer:5,startpage:0,back:"#FFF"},pages:[],chapters:[]},b=0;b<d.length;b++)if(l.pages.push({alt:"",hover:"",title:"",url:[],release:0,note:"",perm:!1,anim8:!1}),Array.isArray(d[b]))for(var w=0;w<d[b].length;w++)l.pages[b].url.push(d[b][w]);else l.pages[b].url.push(d[b]);d=l}else if(void 0===d.pages[0].url)return-1;if(void 0===k||null==k)k=0;var e=d.pages,m=d.pages.length,x=!0,r=-1,n=d.loading,
p=d.config,t=[],u=[],h=new Image,y=!0,c=[document.createElement("canvas"),document.createElement("canvas")],z=c[1].getContext("2d"),A=b=function(){return 0},v=b,B=b,D={context:c[0].getContext("2d"),color:n.color,start:Date.now(),lines:n.lines,diameter:n.diameter,cwidth:c[1].width,cheight:c[1].height,rate:n.rate},E=function(a){var b=Math.floor((Date.now()-a.start)/1E3*a.lines)/a.lines,g=a.color.substr(1);a.context.save();a.context.clearRect(0,0,a.cwidth,a.cheight);a.context.translate(a.cwidth/2,a.cheight/
2);a.context.rotate(2*Math.PI*b);3==g.length&&(g=g[0]+C[0]+g[1]+g[1]+g[2]+g[2]);for(var b=parseInt(g.substr(0,2),16).toString(),c=parseInt(g.substr(2,2),16).toString(),g=parseInt(g.substr(4,2),16).toString(),d=0;d<a.lines;d++)a.context.beginPath(),a.context.rotate(2*Math.PI/a.lines),a.context.moveTo(a.diameter/10,0),a.context.lineTo(a.diameter/4,0),a.context.lineWidth=a.diameter/30,a.context.strokeStyle="rgba("+b+","+c+","+g+","+d/a.lines+")",a.context.stroke();a.context.restore();x&&window.setTimeout(E,
a.rate,D)},F=function(a,b){if(null===a||void 0===a)a={x:0,y:0};else if(isNaN(a)){if(null===a.y||void 0===a.y)a.y=0;if(null===a.x||void 0===a.x)a.x=0}else a={x:0,y:a};if(null===b||void 0===b)b=400;0>a.y&&(a.y=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight);0>a.x&&(a.x=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth);var c={x:void 0!==window.pageXOffset?a.x-window.pageXOffset:a.x-document.documentElement.scrollLeft,y:void 0!==
window.pageYOffset?a.y-window.pageYOffset:a.y-document.documentElement.scrollTop};if(c=={x:0,y:0})return c;var d=function(a,b,c){window.scrollBy(Math.floor(a.x)/b,Math.floor(a.y)/b);c+1<5*b&&window.setTimeout(d,5,a,b,c+1)};window.setTimeout(d,5,c,Math.floor(b/5),0);return c},l=function(){e[this.imaginaryID].loaded=!0},q=function(a,b){x=!0;window.setTimeout(E,n.rate,D);A();e[b].loaded||z.clearRect(0,0,c[1].width,c[1].height);a.imaginaryID=b;a.src=p.dir+e[b].url[0];for(var d=0,f=b-1;f>b-p.imgprebuffer-
1&&0<=f;f--)e[f].loaded||(u[d].imaginaryID=f,u[d].src=p.dir+e[f].url,d++);d=0;for(f=b+1;f<p.imgpostbuffer+b+1&&f<m;f++)e[f].loaded||(t[d].imaginaryID=f,t[d].src=p.dir+e[f].url,d++)};this.count=function(){return m};this.current=function(){return r};this.callback=function(a,b){if(null===a||void 0===a)return v;if(null===b||void 0===b)return a?0<a?A:B:v;a?0<a?A=b:B=b:v=b;return 1};this.go=function(a){a=null===a||void 0===a?0:parseInt(a,10);a=isNaN(a)?0:a;q(h,Math.floor(Math.max(0,Math.min(m-1,a))));return a};
this.prev=function(){var a=r-1;0<=a&&q(h,a);return a};this.next=function(){var a=r+1;a<m&&q(h,a);return a};this.frst=function(){0<=r&&q(h,0);return 0};this.last=function(){q(h,m-1);return m-1};this.rand=function(){var a=Math.floor(Math.random()*(m-1));q(h,a);return a};this.scroll=function(a){return null===a||void 0===a?y:y=a};this.scrollTo=function(a,b){return F(a,b)};c[0].height=480;c.width=640;c[0].style.background=n.back;c[0].style.zIndex=0;c[0].style.position="absolute";k?k.appendChild(c[0]):
document.body.appendChild(c[0]);window.setTimeout(E,n.rate,D);h=new Image;h.imaginaryID=-1;h.addEventListener("load",function(){e[this.imaginaryID].loaded?z.clearRect(0,0,this.width,this.height):e[this.imaginaryID].loaded=!0;v();c[1].width=c[0].width=this.width;c[1].height=c[0].height=this.height;z.drawImage(this,0,0);r=this.imaginaryID;x=0;y&&F();B()},!1);for(b=0;b<e.length;b++)e[b].desig=b?b==e.length-1?1:0:-1,e[b].loaded=!1;for(b=0;b<d.config.imgprebuffer;b++)u.push(new Image),u[b].imaginaryID=
-1,u[b].addEventListener("load",l,!1);for(b=0;b<d.config.imgpostbuffer;b++)t.push(new Image),t[b].imaginaryID=-1,t[b].addEventListener("load",l,!1);c[1].height=480;c[1].width=640;c[1].background=p.back;c[1].style.zIndex=1;c[1].style.position="absolute";k?k.appendChild(c[1]):document.body.appendChild(c[1])};
/**/
this.main = new direction(scriptt,anchor);
this.name = name;
this.type = "def";
Expand Down
4 changes: 2 additions & 2 deletions comixngn.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit b0fae47

Please sign in to comment.