1/** 2 * reflex.js 1.2 (11-Sep-2008) 3 * (c) by Christian Effenberger 4 * All Rights Reserved 5 * Source: reflex.netzgesta.de 6 * Distributed under Netzgestade Software License Agreement 7 * http://www.netzgesta.de/cvi/LICENSE.txt 8 * License permits free of charge 9 * use on non-commercial and 10 * private web sites only 11**/ 12 13var tmp = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0; 14if(tmp) var isIE = document.namespaces ? 1 : 0; 15 16if(isIE) { 17 if(document.namespaces['v'] == null) { 18 var stl = document.createStyleSheet(); 19 stl.addRule("v\\:*", "behavior: url(#default#VML);"); 20 document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); 21 } 22} 23 24function getImages(className){ 25 var children = document.getElementsByTagName('img'); 26 var elements = new Array(); var i = 0; 27 var child; var classNames; var j = 0; 28 for (i=0;i<children.length;i++) { 29 child = children[i]; 30 classNames = child.className.split(' '); 31 for (var j = 0; j < classNames.length; j++) { 32 if (classNames[j] == className) { 33 elements.push(child); 34 break; 35 } 36 } 37 } 38 return elements; 39} 40 41function getClasses(classes,string){ 42 var temp = ''; 43 for (var j=0;j<classes.length;j++) { 44 if (classes[j] != string) { 45 if (temp) { 46 temp += ' ' 47 } 48 temp += classes[j]; 49 } 50 } 51 return temp; 52} 53 54function getClassValue(classes,string){ 55 var temp = 0; var pos = string.length; 56 for (var j=0;j<classes.length;j++) { 57 if (classes[j].indexOf(string) == 0) { 58 temp = Math.min(classes[j].substring(pos),100); 59 break; 60 } 61 } 62 return Math.max(0,temp); 63} 64function getClassColor(classes,string){ 65 var temp = 0; var str = ''; var pos = string.length; 66 for (var j=0;j<classes.length;j++) { 67 if (classes[j].indexOf(string) == 0) { 68 temp = classes[j].substring(pos); 69 str = '#' + temp.toLowerCase(); 70 break; 71 } 72 } 73 if(str.match(/^#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i)) {return str; }else {return 0;} 74} 75function getClassAttribute(classes,string){ 76 var temp = 0; var pos = string.length; 77 for (var j=0;j<classes.length;j++) { 78 if (classes[j].indexOf(string) == 0) { 79 temp = 1; 80 break; 81 } 82 } 83 return temp; 84} 85 86function clipPolyRight(ctx,x,y,w,h,t,d,s) { 87 var z = (h-t-t)/h; 88 ctx.beginPath(); 89 ctx.moveTo(x,y); ctx.lineTo(w,y+t); ctx.lineTo(w,y+h-t); ctx.lineTo(x,y+h); 90 if(d>0) {ctx.lineTo(x,y+h-s); ctx.lineTo(w,y+h-t-(z*s)); ctx.lineTo(w,y+h-t-(z*(s+d))); ctx.lineTo(x,y+h-s-d);} 91 ctx.closePath(); 92} 93 94function clipPolyLeft(ctx,x,y,w,h,t,d,s) { 95 var z = (h-t-t)/h; 96 ctx.beginPath(); 97 ctx.moveTo(x,y+t); ctx.lineTo(w,y+1); ctx.lineTo(w,y+h); ctx.lineTo(x,y+h-t); 98 if(d>0) {ctx.lineTo(x,y+h-t-(z*s)); ctx.lineTo(w,y+h-s); ctx.lineTo(w,y+h-s-d); ctx.lineTo(x,y+h-t-(z*(s+d))); } 99 ctx.closePath(); 100} 101 102function strokePolyRight(ctx,x,y,w,h,t,d,s,b) { 103 var z = (h-t-t)/h; var n = (b>=1?1:0); 104 ctx.beginPath(); 105 ctx.moveTo(x+b,y+b); ctx.lineTo(w-b,y+t+b-n); ctx.lineTo(w-b,y+h-t-(z*(s+d))-b); ctx.lineTo(x+b,y+h-s-d-b); 106 ctx.closePath(); 107} 108function strokePolyLeft(ctx,x,y,w,h,t,d,s,b) { 109 var z = (h-t-t)/h; var n = (b>=1?1:0); 110 ctx.beginPath(); 111 ctx.moveTo(x+b,y+t+b-n); ctx.lineTo(w-b,y+b); ctx.lineTo(w-b,y+h-s-d-b); ctx.lineTo(x+b,y+h-t-(z*(s+d))-b); 112 ctx.closePath(); 113} 114 115function clipReflex(ctx,x,y,w,h,t,d,s,o) { 116 var z = (h-t-t)/h; 117 ctx.beginPath(); 118 if(o=='r') { 119 ctx.moveTo(x,y+h-s); ctx.lineTo(w,y+h-t-(z*s)); ctx.lineTo(w,y+h-t+2); ctx.lineTo(x,y+h+2); 120 }else { 121 ctx.moveTo(w,y+h+2); ctx.lineTo(w,y+h-s); ctx.lineTo(x,y+h-t-(z*s)); ctx.lineTo(x,y+h-t+2); 122 } 123 ctx.closePath(); 124} 125 126function clearReflex(ctx,x,y,w,h,t,d,s,o) { 127 var z = (h-t-t)/h; 128 ctx.beginPath(); 129 if(o=='r') { 130 ctx.moveTo(x,y+h-1); ctx.lineTo(w,y+h-t-1); ctx.lineTo(w,y+h-t+1); ctx.lineTo(x,y+h+1); 131 }else { 132 ctx.moveTo(w,y+h-1); ctx.lineTo(x,y+h-t-1); ctx.lineTo(x,y+h-t+1); ctx.lineTo(w,y+h+1); 133 } 134 ctx.closePath(); 135} 136 137function addIEReflex() { 138 var theimages = getImages('reflex'); 139 var image, object, vml, display, flt, classes, newClasses, head, fill, flex, foot; 140 var i, j, z, q, p, dist, stl, iter, rest, radi, higt, divs, opac, c
140olr, bord, wide, half, ih, iw, ww, hh, fb, xb; 141 var itiltright, itiltnone, itiltleft, iheight, iopacity, idistance, iborder, icolor, iradius; 142 var children = document.getElementsByTagName('img'); var tilt = 'r'; 143 for(i=0;i<theimages.length;i++) { 144 image = theimages[i]; object = image.parentNode; j = 0; 145 itiltright = 0; itiltnone = 0; itiltleft = 0; 146 iheight = 33; iopacity = 33; idistance = 0; 147 iborder = 0; icolor = '#000000'; iradius = 0; 148 if(image.width>=32 && image.height>=32) { 149 classes = image.className.split(' '); 150 iradius = getClassValue(classes,"iradius"); 151 iborder = getClassValue(classes,"iborder"); 152 iheight = getClassValue(classes,"iheight"); 153 iopacity = getClassValue(classes,"iopacity"); 154 idistance = getClassValue(classes,"idistance"); 155 icolor = getClassColor(classes,"icolor"); 156 itiltleft = getClassAttribute(classes,"itiltleft"); 157 itiltright = getClassAttribute(classes,"itiltright"); 158 itiltnone = getClassAttribute(classes,"itiltnone"); 159 if(itiltright==true) tilt = 'r'; 160 if(itiltnone==true) tilt = 'n'; 161 if(itiltleft==true) tilt = 'l'; 162 newClasses = getClasses(classes,"reflex"); 163 ih = image.height; iw = image.width; dist = idistance; 164 radi = Math.min(iradius,Math.max(iw,ih)/10); 165 colr = (icolor!=0?icolor:'#000000'); 166 opac = (iopacity>0?iopacity:33); 167 divs = 100/(iheight>=10?iheight:33); 168 p = (iheight>=10?iheight:33)/100; 169 higt = Math.floor(ih/divs); wide = 12; 170 if(iborder==1) { bord = 0; }else { 171 iborder = Math.floor(Math.round(Math.min(Math.min(iborder,higt/4),Math.max(iw,ih)/20))/2)*2; 172 bord = (iborder>0?iborder/2:0); 173 } 174 ww = parseInt(iw/20); q = 1; 175 iter = Math.floor((iw-ww-ww)/wide); 176 rest = ((iw-ww-ww)%wide); half = (((iw-ww-ww)/wide)-1)/2; 177 hh = iter+(rest>0?1:0); z = (ih-hh-hh)/ih; 178 display = (image.currentStyle.display.toLowerCase()=='block')?'block':'inline-block'; 179 vml = document.createElement(['<var style="overflow:hidden;display:' + display + ';width:' + iw + 'px;height:' + (ih+higt+dist) + 'px;padding:0;">'].join('')); 180 flt = image.currentStyle.styleFloat.toLowerCase(); 181 display = (flt=='left'||flt=='right')?'inline':display; 182 head = '<v:group style="zoom:1; display:' + display + '; margin:-1px 0 0 -1px; padding:0; position:relative; width:' + iw + 'px;height:' + (ih+higt+dist) + 'px;" coordsize="' + iw + ',' + (ih+higt+dist) + '">'; 183 if(tilt=='n') { 184 fill = '<v:rect strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:0px; left:0px; width:' + iw + 'px;height:' + ih + 'px;"><v:fill src="' + image.src + '" type="frame" /></v:rect>'; 185 fb = '<v:rect strokeweight="'+iborder+'" strokecolor="'+colr+'" filled="f" stroked="'+(bord>0||iborder>0?'t':'f')+'" fillcolor="#ffffff" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:'+bord+'px; left:'+bord+'px; width:'+(iw-bord-bord)+'px;height:'+(ih-bord-bord)+'px;"></v:rect>'; 186 xb = '<v:rect strokeweight="'+iborder+'" strokecolor="'+colr+'" filled="f" stroked="'+(bord>0||iborder>0?'t':'f')+'" fillcolor="#ffffff" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:'+(ih+dist+bord)+'px; left:'+bord+'px; width:'+(iw-bord-bord)+'px;height:'+(higt-bord-bord)+'px; filter: progid:DXImageTransform.Microsoft.Alpha(opacity='+opac+',style=1,finishOpacity=0,startx=0,starty=0,finishx=0,finishy='+parseInt(ih*0.66)+');"></v:rect>'; 187 flex = '<v:rect strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:'+(ih+dist)+'px; left:0px; width:' + iw + 'px;height:' + higt + 'px; filter:flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+opac+',style=1,finishOpacity=0,startx=0,starty=0,finishx=0,finishy='+ih+');"><v:fill origin="0,0" position="0,-'+(divs/2-0.5)+'" size="1,'+(1*divs)+'" src="' + image.src + '" type="frame" /></v:rect>'; 188 }else if(tilt=='r') { 189 fill = '<v:rect strokeweight="0" filled="t" stroked="f" fillcolor="#808080" style="position:absolute; margin:-1px 0 0 -1px;padding:0 ;width:' + iw + 'px;height:' + (ih+higt+dist) + 'px;"><v:fill color="#808080" opacity="0.0" /></v:rect><v:shape strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" coordorigin="0,0" coordsize="'+iw+','+ih+'" path="m '+ww+',0 l '+ww+','+ih+','+(iw-ww)+','+(ih-hh)+','+(iw-ww)+','+hh+' x e" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:0px; left:0px; width:' + iw + 'px;height:' + ih + 'px;"><v:fill src="' + image.src + '" type="frame" /></v:shape>'; 190 for(j=0;j<iter;j++) { 191 if(j==(iter-1)) q = (rest>0?1:0); 192 fill += '<v:shape strokeweight="0" filled="t" stroked="f" fillcolor="#808080" coordorigin="0,0" coordsize="'+iw+','+ih+'" path="m '+(ww+(j*wide))+','+j+' l '+(q+ww+((j+1)*wide))+','+(j+1)+','+(q+ww+((j+1)*wide))+','+(ih-1-j)+','+(ww+(j*wide))+','+(ih-j)+' x e" style="position:absolute; margin: -1px 0 0 -1px; padding:0px; top:0px; left:0px; width:' + iw + 'px; height:' + ih + 'px;"><v:fill origin="0,0" position="'+(half-j)+',0" size="'+((iw-ww-ww)/wide)+',1" type="frame" src="' + image.src + '" /></v:shape>'; 193 } 194 if(rest>0) { 195 fill += '<v:shape strokeweight="0" filled="t" stroked="f" fillcolor="#808080" coordorigin="0,0" coordsize="'+iw+','+ih+'" path="m '+(ww+(j*wide))+','+j+' l '+(ww+((j+1)*wide))+','+(j+1)+','+(ww+((j+1)*wide))+','+(ih-1-j)+','+(ww+(j*wide))+','+(ih-j)+' x e" style="position:absolute; margin: -1px 0 0 -1px; padding:0px; top:0px; left:0px; width:' + iw + 'px; height:' + ih + 'px;"><v:fill origin="0,0" position="'+(half-j)+',0" size="'+((iw-ww-ww)/wide)+',1" type="frame" src="' + image.src + '" /></v:shape>'; 196 }
197 q = ((iter*z)/(ih/100))/2; 198 if(bord>0||iborder>0) { 199 fb = '<v:shape strokeweight="'+iborder+'" strokecolor="'+colr+'" filled="f" stroked="'+(bord>0||iborder>0?'t':'f')+'" coordorigin="0,0" coordsize="'+iw+','+ih+'" path="m '+(ww+bord)+','+bord+' l '+(ww+bord)+','+(ih-bord)+','+(iw-ww-bord)+','+(ih-hh-bord)+','+(iw-ww-bord)+','+(hh+bord)+' x e" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:0px; left:0px; width:' + iw + 'px;height:' + ih + 'px;"></v:shape>'; 200 xb = '<v:shape strokeweight="'+iborder+'" strokecolor="'+colr+'" stroked="'+(bord>0||iborder>0?'t':'f')+'" filled="f" coordorigin="0,0" coordsize="'+iw+','+(hh+higt+dist)+'" path="m '+(ww+bord)+','+(hh+dist+bord)+' l '+(ww+bord)+','+(higt+hh+dist-bord)+','+(iw-ww-bord)+','+(parseInt((higt+dist)*z)-bord)+','+(iw-ww-bord)+','+(parseInt(dist*z)+bord)+' x e" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:'+(ih-hh+dist)+'px; left:0px; width:' + iw + 'px;height:' + (hh+higt+dist) + 'px; flip: y; filter:flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+opac+',style=1,finishOpacity=0,startx=0,starty=0,finishx='+q+',finishy=80);"></v:shape>'; 201 }else {fb = ''; xb = ''; } 202 flex = '<v:shape strokeweight="0" stroked="f" filled="t" fillcolor="#808080" coordorigin="0,0" coordsize="'+iw+','+(hh+higt+dist)+'" path="m '+ww+','+(hh+dist)+' l '+ww+','+(higt+hh+dist)+','+(iw-ww)+','+parseInt((higt+dist)*z)+','+(iw-ww)+','+parseInt(dist*z)+' x e" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:'+(ih-hh+dist)+'px; left:0px; width:' + iw + 'px;height:' + (hh+higt+dist) + 'px; flip: y; filter:flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+opac+',style=1,finishOpacity=0,startx=0,starty=0,finishx='+q+',finishy=90);"><v:fill origin="0,0" position="0,-'+((divs/2)-0.5)+'" size="1,'+(divs)+'" src="' + image.src + '" type="frame" /></v:shape>'; 203 }else if(tilt=='l') { 204 fill = '<v:rect strokeweight="0" filled="t" stroked="f" fillcolor="#808080" style="position:absolute; margin:-1px 0 0 -1px;padding:0 ;width:' + iw + 'px;height:' + (ih+higt+dist) + 'px;"><v:fill color="#808080" opacity="0.0" /></v:rect><v:shape strokeweight="0" filled="t" stroked="f" fillcolor="#ffffff" coordorigin="0,0" coordsize="'+iw+','+ih+'" path="m '+ww+','+hh+' l '+ww+','+(ih-hh)+','+(iw-ww)+','+ih+','+(iw-ww)+',0 x e" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:0px; left:0px; width:' + iw + 'px;height:' + ih + 'px;"><v:fill src="' + image.src + '" type="frame" /></v:shape>'; 205 for(j=0;j<iter;j++) { 206 if(j==(iter-1)) q = (rest>0?1:0); 207 fill += '<v:shape strokeweight="0" filled="t" stroked="f" fillcolor="#808080" coordorigin="0,0" coordsize="'+iw+','+ih+'" path="m '+(ww+(j*wide))+','+(iter-j)+' l '+(q+ww+((j+1)*wide))+','+(iter-1-j)+','+(q+ww+((j+1)*wide))+','+(ih-1-iter+j)+','+(ww+(j*wide))+','+(ih-iter+j)+' x e" style="position:absolute; margin: -1px 0 0 -1px; padding:0px; top:0px; left:0px; width:' + iw + 'px; height:' + ih + 'px;"><v:fill origin="0,0" position="'+(half-j)+',0" size="'+((iw-ww-ww)/wide)+',1" type="frame" src="' + image.src + '" /></v:shape>'; 208 } 209 if(rest>0) { 210 fill += '<v:shape strokeweight="0" filled="t" stroked="f" fillcolor="#808080" coordorigin="0,0" coordsize="'+iw+','+ih+'" path="m '+(ww+(j*wide))+','+(iter-j)+' l '+(ww+((j+1)*wide))+','+(iter-1-j)+','+(ww+((j+1)*wide))+','+(ih-1-iter+j)+','+(ww+(j*wide))+','+(ih-iter+j)+' x e" style="position:absolute; margin: -1px 0 0 -1px; padding:0px; top:0px; left:0px; width:' + iw + 'px; height:' + ih + 'px;"><v:fill origin="0,0" position="'+(half-j)+',0" size="'+((iw-ww-ww)/wide)+',1" type="frame" src="' + image.src + '" /></v:shape>'; 211 } 212 q = 100-(((iter*z)/(ih/100))/2); 213 if(bord>0||iborder>0) { 214 fb = '<v:shape strokeweight="'+iborder+'" strokecolor="'+colr+'" filled="f" stroked="'+(bord>0||iborder>0?'t':'f')+'" coordorigin="0,0" coordsize="'+iw+','+ih+'" path="m '+(ww+bord)+','+(hh+bord)+' l '+(ww+bord)+','+(ih-hh-bord)+','+(iw-ww-bord)+','+(ih-bord)+','+(iw-ww-bord)+','+bord+' x e" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:0px; left:0px; width:' + iw + 'px;height:' + ih + 'px;"></v:shape>';
215 xb = '<v:shape strokeweight="'+iborder+'" strokecolor="'+colr+'" stroked="'+(bord>0||iborder>0?'t':'f')+'" filled="f" coordorigin="0,0" coordsize="'+iw+','+(hh+higt+dist)+'" path="m '+(ww+bord)+','+(parseInt(dist*z)+bord)+' l '+(ww+bord)+','+(parseInt((higt+dist)*z)-bord)+','+(iw-ww-bord)+','+(higt+hh+dist-bord)+','+(iw-ww-bord)+','+(hh+dist+bord)+' x e" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:'+(ih-hh+dist)+'px; left:0px; width:' + iw + 'px;height:' + (hh+higt+dist) + 'px; flip: y; filter:flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+opac+',style=1,finishOpacity=0,startx=100,starty=0,finishx='+q+',finishy=80);"></v:shape>'; 216 }else {fb = ''; xb = ''; } 217 flex = '<v:shape strokeweight="0" filled="t" stroked="f" fillcolor="#808080" coordorigin="0,0" coordsize="'+iw+','+(hh+higt+dist)+'" path="m '+ww+','+parseInt(dist*z)+' l '+ww+','+parseInt((higt+dist)*z)+','+(iw-ww)+','+(higt+hh+dist)+','+(iw-ww)+','+(hh+dist)+' x e" style="position:absolute; margin:-1px 0 0 -1px; padding:0; top:'+(ih-hh+dist)+'px; left:0px; width:' + iw + 'px;height:' + (hh+higt+dist) + 'px; flip: y; filter:flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+opac+',style=1,finishOpacity=0,startx=100,starty=0,finishx='+q+',finishy=90);"><v:fill origin="0,0" position="0,-'+((divs/2)-0.5)+'" size="1,'+(divs)+'" src="' + image.src + '" type="frame" /></v:shape>'; 218 } 219 foot = '</v:group>'; 220 vml.innerHTML = head+flex+xb+fill+fb+foot; 221 vml.className = newClasses; 222 vml.style.cssText = image.style.cssText; 223 vml.style.height = ih+higt+dist+'px'; vml.width = iw; 224 vml.height = ih+higt+dist; vml.style.width = iw+'px'; 225 vml.src = image.src; vml.alt = image.alt; 226 if(image.id!='') vml.id = image.id; 227 if(image.title!='') vml.title = image.title; 228 if(image.getAttribute('onclick')!='') vml.setAttribute('onclick',image.getAttribute('onclick')); 229 object.replaceChild(vml,image); 230 if(tilt=='r') {tilt='n';}else if(tilt=='n') {tilt='l';}else if(tilt=='l') {tilt='r';} 231 vml.style.visibility = 'visible'; 232 } 233 } 234} 235 236function addReflex() { 237 var theimages = getImages('reflex'); 238 var image, object, canvas, context, classes, newClasses, resource, tmp; 239 var i, j, dist, stl, iter, rest, radi, higt, divs, opac, colr, bord, wide, ih, iw; 240 var itiltright, itiltnone, itiltleft, iheight, iopacity, idistance, iborder, icolor, iradius; 241 var children = document.getElementsByTagName('img'); var tilt = 'r'; 242 var isWK = navigator.appVersion.indexOf('WebKit')!=-1?1:0; var isOP = window.opera?1:0; 243 var isW5 = document.defaultCharset&&!window.execScript?1:0; 244 for(i=0;i<theimages.length;i++) { 245 image = theimages[i]; object = image.parentNode; tmp = 0; 246 itiltright = 0; itiltnone = 0; itiltleft = 0; 247 iheight = 33; iopacity = 33; idistance = 0; 248 iborder = 0; icolor = '#000000'; iradius = 0; 249 canvas = document.createElement('canvas'); 250 if(canvas.getContext && image.width>=32 && image.height>=32) { 251 classes = image.className.split(' '); 252 iradius = getClassValue(classes,"iradius"); 253 iborder = getClassValue(classes,"iborder"); 254 iheight = getClassValue(classes,"iheight"); 255 iopacity = getClassValue(classes,"iopacity"); 256 idistance = getClassValue(classes,"idistance"); 257 icolor = getClassColor(classes,"icolor"); 258 itiltleft = getClassAttribute(classes,"itiltleft"); 259 itiltright = getClassAttribute(classes,"itiltright"); 260 itiltnone = getClassAttribute(classes,"itiltnone"); 261 if(itiltright==true) tilt = 'r'; 262 if(itiltnone==true) tilt = 'n'; 263 if(itiltleft==true) tilt = 'l'; 264 newClasses = getClasses(classes,"reflex"); 265 ih = image.height; iw = image.width; dist = idistance; 266 radi = Math.min(iradius,Math.max(iw,ih)/10); 267 colr = (icolor!=0?icolor:'#000000'); 268 opac = (100-(iopacity>0?iopacity:33))/100; 269 divs = 100/(iheight>=10?iheight:33); 270 higt = Math.floor(image.height/divs); 271 iborder = Math.round(Math.min(Math.min(iborder,higt/4),Math.max(iw,ih)/20)); 272 wide = 12; bord = (iborder>0?iborder/2:0); 273 canvas.className = newClasses; 274 canvas.style.cssText = image.style.cssText; 275 canvas.style.height = ih+higt+dist+'px'; canvas.width = iw; 276 canvas.style.width = iw+'px'; canvas.height = ih+higt+dist; 277 canvas.src = image.src; canvas.alt = image.alt; 278 if(image.id!='') canvas.id = image.id;
279 if(image.title!='') canvas.title = image.title; 280 if(image.getAttribute('onclick')!='') canvas.setAttribute('onclick',image.getAttribute('onclick')); 281 iter = Math.floor(canvas.width/wide); rest = (canvas.width%wide); 282 if(tilt=='l'||tilt=='r') { 283 resource = document.createElement('canvas'); 284 if(resource.getContext) { 285 resource.style.position = 'fixed'; 286 resource.style.left = -9999+'px'; 287 resource.style.top = 0+'px'; 288 resource.height = canvas.height; 289 resource.width = canvas.width; 290 resource.style.height = canvas.height+'px'; 291 resource.style.width = canvas.width+'px'; 292 if(isWK&&!isW5) {object.appendChild(resource);} 293 } 294 } 295 context = canvas.getContext("2d"); 296 object.replaceChild(canvas,image); 297 context.clearRect(0,0,canvas.width,canvas.height); 298 context.globalCompositeOperation = "source-over"; 299 context.fillStyle = 'rgba(0,0,0,0)'; 300 context.fillRect(0,0,canvas.width,canvas.height); 301 context.save(); 302 context.translate(0,canvas.height);
303 context.scale(1,-1); 304 context.drawImage(image,0,-(canvas.height-higt-higt-dist),canvas.width,canvas.height-higt-dist); 305 context.restore(); 306 if(iborder>0) { 307 context.strokeStyle = colr; 308 context.lineWidth = iborder; 309 context.beginPath(); 310 context.rect(bord,canvas.height-higt+bord,canvas.width-iborder,higt); 311 context.closePath(); 312 context.stroke(); 313 } 314 if(!isWK||tilt=='n') { 315 context.globalCompositeOperation = "destination-out"; 316 stl = context.createLinearGradient(0,canvas.height-higt,0,canvas.height); 317 stl.addColorStop(1,"rgba(0,0,0,1.0)"); 318 stl.addColorStop(0,"rgba(0,0,0,"+opac+")"); 319 context.fillStyle = stl; 320 } 321 if(isWK) { 322 context.beginPath(); 323 context.rect(0,canvas.height-higt,canvas.width,higt); 324 context.closePath(); 325 context.fill(); 326 }else { 327 context.fillRect(0,canvas.height-higt,canvas.width,higt); 328 } 329 context.globalCompositeOperation = "source-over"; 330 context.drawImage(image,0,0,iw,ih); 331 context.save(); 332 if(isWK&&dist>0&&tilt!='n') { 333 context.fillStyle = '#808080'; 334 context.fillRect(0,canvas.height-higt-dist,canvas.width,dist); 335 } 336 if(iborder>0) { 337 if(tilt=='n') { 338 context.beginPath(); 339 context.rect(bord,bord,canvas.width-iborder,canvas.height-higt-dist-iborder); 340 context.closePath(); 341 context.stroke(); 342 } 343 } 344 if(tilt=='l'||tilt=='r') { 345 if(resource.getContext) { 346 context = resource.getContext("2d"); 347 context.globalCompositeOperation = "source-over"; 348 context.clearRect(0,0,resource.width,resource.height); 349 if(tilt=='r') { 350 for(j=0;j<iter;j++) { 351 context.drawImage(canvas,j*wide,0,wide,resource.height,j*wide,j*1,wide,resource.height-(j*2)); 352 } 353 if(rest>0) { 354 rest = canvas.width-(iter*wide); 355 context.drawImage(canvas,j*wide,0,rest,resource.height,j*wide,j*1,rest,resource.height-(j*2)); 356 } 357 }else { 358 for(j=0;j<iter;j++) { 359 context.drawImage(canvas,j*wide,0,wide,resource.height,j*wide,(iter-j)*1,wide,resource.height-((iter-j)*2)); 360 } 361 if(rest>0) { 362 rest = canvas.width-(iter*wide); 363 context.drawImage(canvas,j*wide,0,rest,resource.height,j*wide,0,rest,resource.height); 364 } 365 } 366 context.save(); 367 if(canvas.getContext) { 368 context = canvas.getContext("2d"); 369 context.clearRect(0,0,canvas.width,canvas.height); 370 if(tilt=='r') { 371 clipPolyRight(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt); 372 }else { 373 clipPolyLeft(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:1),dist,higt); 374 } 375 context.clip(); 376 context.drawImage(resource,parseInt(canvas.width/20),0,parseInt(canvas.width*0.9),canvas.height); 377 context.save(); 378 if(iborder>0) { 379 context.lineWidth = iborder; 380 if(tilt=='r') { 381 strokePolyRight(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt,bord); 382 context.stroke(); 383 }else { 384 strokePolyLeft(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt,bord); 385 context.stroke(); 386 } 387 } 388 if(isWK) { 389 context.globalCompositeOperation = "destination-out"; 390 stl = context.createLinearGradient((tilt=='l'?canvas.width:0),canvas.height-higt,(tilt=='l'?canvas.width-parseInt(wide/divs):parseInt(wide/divs)),canvas.height); 391 stl.addColorStop(1,"rgba(255,0,0,1.0)"); 392 stl.addColorStop(0,"rgba(255,0,0,"+opac+")"); 393 context.fillStyle = stl; 394 clipReflex(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt,tilt); 395 context.fill(); 396 globalCompositeOperation = "source-in"; 397 clearReflex(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt,tilt); 398 context.clip(); 399 context.clearRect(0,0,canvas.width,canvas.height); 400 context.clearRect(0,0,canvas.width,canvas.height); 401 context.clearRect(0,0,canvas.width,canvas.height); 402 context.clearRect(0,0,canvas.width,canvas.height);
403 if(isWK&&!isW5) {object.removeChild(resource);} 404 } 405 } 406 } 407 } 408 if(tilt=='r') {tilt='n';}else if(tilt=='n') {tilt='l';}else if(tilt=='l') {tilt='r';} 409 context.save(); 410 canvas.style.visibility = 'visible'; 411 } 412 } 413} 414 415var reflexOnload = window.onload; 416window.onload = function () { if(reflexOnload) reflexOnload(); if(isIE){addIEReflex(); }else {addReflex(); }}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.