1/** 2 * reflex.js 1.5 (10-Aug-2010) 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 && ( !document.documentMode || document.documentMode < 9 ) ? 1 : 0; 15 16if(isIE) { 17 if(document.namespaces['v']==null) { 18 var e=["shape","shapetype","group","background","path","formulas","handles","fill","stroke","shadow","textbox","textpath","imagedata","line","polyline","curve","roundrect","oval","rect","arc","image"],s=document.createStyleSheet(); 19 for(var i=0; i<e.length; i++) {s.addRule("v\\:"+e[i],"behavior: url(#default#VML);");} document.namespaces.add("v","urn:schemas-microsoft-com:vml"); 20 } 21} 22 23function getImages(className){ 24 var children = document.getElementsByTagName('img'); 25 var elements = new Array(); var i = 0; 26 var child; var classNames; var j = 0; 27 for (i=0;i<children.length;i++) { 28 child = children[i]; 29 classNames = child.className.split(' '); 30 for (var j = 0; j < classNames.length; j++) { 31 if (classNames[j] == className) { 32 elements.push(child); 33 break; 34 } 35 } 36 } 37 return elements; 38} 39 40function getClasses(classes,string){ 41 var temp = ''; 42 for (var j=0;j<classes.length;j++) { 43 if (classes[j] != string) { 44 if (temp) { 45 temp += ' ' 46 } 47 temp += classes[j]; 48 } 49 } 50 return temp; 51} 52 53function getClassValue(classes,string){ 54 var temp = 0; var pos = string.length; 55 for (var j=0;j<classes.length;j++) { 56 if (classes[j].indexOf(string) == 0) { 57 temp = Math.min(classes[j].substring(pos),100); 58 break; 59 } 60 } 61 return Math.max(0,temp); 62} 63function getClassColor(classes,string){ 64 var temp = 0; var str = ''; var pos = string.length; 65 for (var j=0;j<classes.length;j++) { 66 if (classes[j].indexOf(string) == 0) { 67 temp = classes[j].substring(pos); 68 str = '#' + temp.toLowerCase(); 69 break; 70 } 71 } 72 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;} 73} 74function getClassAttribute(classes,string){ 75 var temp = 0; var pos = string.length; 76 for (var j=0;j<classes.length;j++) { 77 if (classes[j].indexOf(string) == 0) { 78 temp = 1; 79 break; 80 } 81 } 82 return temp; 83} 84 85function clipPolyRight(ctx,x,y,w,h,t,d,s) { 86 var z = (h-t-t)/h; 87 ctx.beginPath(); 88 ctx.moveTo(x,y); ctx.lineTo(w,y+t); ctx.lineTo(w,y+h-t); ctx.lineTo(x,y+h); 89 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);} 90 ctx.closePath(); 91} 92 93function clipPolyLeft(ctx,x,y,w,h,t,d,s) { 94 var z = (h-t-t)/h; 95 ctx.beginPath(); 96 ctx.moveTo(x,y+t); ctx.lineTo(w,y+1); ctx.lineTo(w,y+h); ctx.lineTo(x,y+h-t); 97 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))); } 98 ctx.closePath(); 99} 100 101function strokePolyRight(ctx,x,y,w,h,t,d,s,b) { 102 var z = (h-t-t)/h; var n = (b>=1?1:0); 103 ctx.beginPath(); 104 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); 105 ctx.closePath(); 106} 107function strokePolyLeft(ctx,x,y,w,h,t,d,s,b) { 108 var z = (h-t-t)/h; var n = (b>=1?1:0); 109 ctx.beginPath(); 110 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); 111 ctx.closePath(); 112} 113 114function clipReflex(ctx,x,y,w,h,t,d,s,o) { 115 var z = (h-t-t)/h; 116 ctx.beginPath(); 117 if(o=='r') { 118 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); 119 }else { 120 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); 121 } 122 ctx.closePath(); 123} 124 125function clearReflex(ctx,x,y,w,h,t,d,s,o) { 126 var z = (h-t-t)/h; 127 ctx.beginPath(); 128 if(o=='r') { 129 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); 130 }else { 131 ctx.moveTo(w,y+h-1); ctx.lineTo(x,y+h-t-1); ctx.lineTo(x,y+h-t+1);
131 ctx.lineTo(w,y+h+1); 132 } 133 ctx.closePath(); 134} 135 136function addIEReflex() { 137 var theimages = getImages('reflex'); 138 var image, object, vml, display, flt, classes, newClasses, head, fill, flex, foot; 139 var i, j, z, q, p, dist, stl, iter, rest, radi, higt, divs, opac, colr, bord, wide, half, ih, iw, ww, hh, fb, xb; 140 var itiltright, itiltnone, itiltleft, iheight, iopacity, idistance, iborder, icolor, iradius; 141 var children = document.getElementsByTagName('img'); var tilt = 'r'; 142 for(i=0;i<theimages.length;i++) { 143 image = theimages[i]; object = image.parentNode; j = 0; 144 itiltright = 0; itiltnone = 0; itiltleft = 0; 145 iheight = 33; iopacity = 33; idistance = 0; 146 iborder = 0; icolor = '#000000'; iradius = 0; 147 if(image.width>=32 && image.height>=32) { 148 classes = image.className.split(' '); 149 iradius = getClassValue(classes,"iradius"); 150 iborder = getClassValue(classes,"iborder"); 151 iheight = getClassValue(classes,"iheight"); 152 iopacity = getClassValue(classes,"iopacity"); 153 idistance = getClassValue(classes,"idistance"); 154 icolor = getClassColor(classes,"icolor"); 155 itiltleft = getClassAttribute(classes,"itiltleft"); 156 itiltright = getClassAttribute(classes,"itiltright"); 157 itiltnone = getClassAttribute(classes,"itiltnone"); 158 if(itiltright==true) tilt = 'r'; 159 if(itiltnone==true) tilt = 'n'; 160 if(itiltleft==true) tilt = 'l'; 161 newClasses = getClasses(classes,"reflex"); 162 ih = image.height; iw = image.width; dist = idistance; 163 radi = Math.min(iradius,Math.max(iw,ih)/10); 164 colr = (icolor!=0?icolor:'#000000'); 165 opac = (iopacity>0?iopacity:33); 166 divs = 100/(iheight>=10?iheight:33); 167 p = (iheight>=10?iheight:33)/100; 168 higt = Math.floor(ih/divs); wide = 12; 169 if(iborder==1) { bord = 0; }else { 170 iborder = Math.floor(Math.round(Math.min(Math.min(iborder,higt/4),Math.max(iw,ih)/20))/2)*2; 171 bord = (iborder>0?iborder/2:0); 172 } 173 ww = parseInt(iw/20); q = 1; 174 iter = Math.floor((iw-ww-ww)/wide); 175 rest = ((iw-ww-ww)%wide); half = (((iw-ww-ww)/wide)-1)/2; 176 hh = iter+(rest>0?1:0); z = (ih-hh-hh)/ih; 177 display = (image.currentStyle.display.toLowerCase()=='block')?'block':'inline-block'; 178 vml = document.createElement(['<var style="overflow:hidden;display:' + display + ';width:' + iw + 'px;height:' + (ih+higt+dist) + 'px;padding:0;">'].join('')); 179 flt = image.currentStyle.styleFloat.toLowerCase(); 180 display = (flt=='left'||flt=='right')?'inline':display; 181 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) + '">'; 182 if(tilt=='n') { 183 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>'; 184 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>'; 185 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>'; 186 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>'; 187 }else if(tilt=='r') { 188 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>'; 189 for(j=0;j<iter;j++) { 190 if(j==(iter-1)) q = (rest>0?1:0); 191 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>'; 192 } 193 if(rest>0) { 194 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>'; 195 }
196 q = ((iter*z)/(ih/100))/2; 197 if(bord>0||iborder>0) { 198 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>'; 199 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>'; 200 }else {fb = ''; xb = ''; } 201 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>'; 202 }else if(tilt=='l') { 203 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>'; 204 for(j=0;j<iter;j++) { 205 if(j==(iter-1)) q = (rest>0?1:0); 206 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>'; 207 } 208 if(rest>0) { 209 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>'; 210 } 211 q = 100-(((iter*z)/(ih/100))/2); 212 if(bord>0||iborder>0) { 213 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>';
214 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>'; 215 }else {fb = ''; xb = ''; } 216 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>'; 217 } 218 foot = '</v:group>'; 219 vml.innerHTML = head+flex+xb+fill+fb+foot; 220 vml.className = newClasses; 221 vml.style.cssText = image.style.cssText; 222 vml.style.height = ih+higt+dist+'px'; vml.width = iw; 223 vml.height = ih+higt+dist; vml.style.width = iw+'px'; 224 vml.src = image.src; vml.alt = image.alt; 225 if(image.id!='') vml.id = image.id; 226 if(image.title!='') vml.title = image.title; 227 if(image.getAttribute('onclick')!='') vml.setAttribute('onclick',image.getAttribute('onclick')); 228 object.replaceChild(vml,image); 229 if(tilt=='r') {tilt='n';}else if(tilt=='n') {tilt='l';}else if(tilt=='l') {tilt='r';} 230 vml.style.visibility = 'visible'; 231 } 232 } 233} 234 235function addReflex() { 236 var theimages = getImages('reflex'); 237 var image, object, canvas, context, classes, newClasses, resource, tmp; 238 var i, j, dist, stl, iter, rest, radi, higt, divs, opac, colr, bord, wide, ih, iw; 239 var itiltright, itiltnone, itiltleft, iheight, iopacity, idistance, iborder, icolor, iradius; 240 var children = document.getElementsByTagName('img'); var tilt = 'r'; 241 var tmp = navigator.userAgent.indexOf('WebKit')!=-1?true:false; 242 var isWK=(tmp==true?window.postMessage?false:window.external?false:true:false); 243 var isCR=(tmp==true&&window.external?true:false); 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.naturalHeight || image.height; 266 iw = image.naturalWidth || image.width; 267 dist = idistance; 268 radi = Math.min(iradius,Math.max(iw,ih)/10); 269 colr = (icolor!=0?icolor:'#000000'); 270 opac = (100-(iopacity>0?iopacity:33))/100; 271 divs = 100/(iheight>=10?iheight:33); 272 higt = Math.floor(ih/divs); 273 iborder = Math.round(Math.min(Math.min(iborder,higt/4),Math.max(iw,ih)/20)); 274 wide = 12; bord = (iborder>0?iborder/2:0); 275 canvas.className = newClasses; 276 canvas.style.cssText = image.style.cssText; 277 canvas.style.height = ih+higt+dist+'px'; canvas.width = iw; 278 canvas.style.width = iw+'px'; canvas.height = ih+higt+dist; 279 canvas.src = image.src; canvas.alt = image.alt; 280 if(image.id!='') canvas.id = image.id;
281 if(image.title!='') canvas.title = image.title; 282 if(image.getAttribute('onclick')!='') canvas.setAttribute('onclick',image.getAttribute('onclick')); 283 iter = Math.floor(canvas.width/wide); rest = (canvas.width%wide); 284 if(tilt=='l'||tilt=='r') { 285 resource = document.createElement('canvas'); 286 if(resource.getContext) { 287 resource.style.position = 'fixed'; 288 resource.style.left = -9999+'px'; 289 resource.style.top = 0+'px'; 290 resource.height = canvas.height; 291 resource.width = canvas.width; 292 resource.style.height = canvas.height+'px'; 293 resource.style.width = canvas.width+'px'; 294 if(isWK) {object.appendChild(resource);} 295 } 296 } 297 context = canvas.getContext("2d"); 298 object.replaceChild(canvas,image); 299 context.clearRect(0,0,canvas.width,canvas.height); 300 if(!isCR) { 301 context.globalCompositeOperation = "source-over"; 302 context.fillStyle = "rgba(0,0,0,0)"; 303 context.fillRect(0,0,canvas.width,canvas.height); 304 } 305 context.save(); 306 context.translate(0,canvas.height);
307 context.scale(1,-1); 308 context.drawImage(image,0,-(canvas.height-higt-higt-dist),canvas.width,canvas.height-higt-dist); 309 context.restore(); 310 if(iborder>0) { 311 context.strokeStyle = colr; 312 context.lineWidth = iborder; 313 context.beginPath(); 314 context.rect(bord,canvas.height-higt+bord,canvas.width-iborder,higt); 315 context.closePath(); 316 context.stroke(); 317 } 318 if(!isWK||tilt=='n') { 319 context.globalCompositeOperation = "destination-out"; 320 stl = context.createLinearGradient(0,canvas.height-higt,0,canvas.height); 321 stl.addColorStop(1,"rgba(0,0,0,1.0)"); 322 stl.addColorStop(0,"rgba(0,0,0,"+opac+")"); 323 context.fillStyle = stl; 324 } 325 if(isWK) { 326 context.beginPath(); 327 context.rect(0,canvas.height-higt,canvas.width,higt); 328 context.closePath(); 329 context.fill(); 330 }else { 331 context.fillRect(0,canvas.height-higt,canvas.width,higt); 332 } 333 context.globalCompositeOperation = "source-over"; 334 context.drawImage(image,0,0,iw,ih); 335 context.save(); 336 if(isWK&&dist>0&&tilt!='n') { 337 context.fillStyle = '#808080'; 338 context.fillRect(0,canvas.height-higt-dist,canvas.width,dist); 339 } 340 if(iborder>0) { 341 if(tilt=='n') { 342 context.beginPath(); 343 context.rect(bord,bord,canvas.width-iborder,canvas.height-higt-dist-iborder); 344 context.closePath(); 345 context.stroke(); 346 } 347 } 348 if(tilt=='l'||tilt=='r') { 349 if(resource.getContext) { 350 context = resource.getContext("2d"); 351 context.globalCompositeOperation = "source-over"; 352 context.clearRect(0,0,resource.width,resource.height); 353 if(tilt=='r') { 354 for(j=0;j<iter;j++) { 355 context.drawImage(canvas,j*wide,0,wide,resource.height,j*wide,j*1,wide,resource.height-(j*2)); 356 } 357 if(rest>0) { 358 rest = canvas.width-(iter*wide); 359 context.drawImage(canvas,j*wide,0,rest,resource.height,j*wide,j*1,rest,resource.height-(j*2)); 360 } 361 }else { 362 for(j=0;j<iter;j++) { 363 context.drawImage(canvas,j*wide,0,wide,resource.height,j*wide,(iter-j)*1,wide,resource.height-((iter-j)*2)); 364 } 365 if(rest>0) { 366 rest = canvas.width-(iter*wide); 367 context.drawImage(canvas,j*wide,0,rest,resource.height,j*wide,0,rest,resource.height); 368 } 369 } 370 context.save(); 371 if(canvas.getContext) { 372 context = canvas.getContext("2d"); 373 context.clearRect(0,0,canvas.width,canvas.height); 374 if(tilt=='r') { 375 clipPolyRight(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt); 376 }else { 377 clipPolyLeft(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:1),dist,higt); 378 } 379 context.clip(); 380 context.drawImage(resource,parseInt(canvas.width/20),0,parseInt(canvas.width*0.9),canvas.height); 381 context.save(); 382 if(iborder>0) { 383 context.lineWidth = iborder; 384 if(tilt=='r') { 385 strokePolyRight(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt,bord); 386 context.stroke(); 387 }else { 388 strokePolyLeft(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt,bord); 389 context.stroke(); 390 } 391 } 392 if(isWK) { 393 context.globalCompositeOperation = "destination-out"; 394 stl = context.createLinearGradient((tilt=='l'?canvas.width:0),canvas.height-higt,(tilt=='l'?canvas.width-parseInt(wide/divs):parseInt(wide/divs)),canvas.height); 395 stl.addColorStop(1,"rgba(255,0,0,1.0)"); 396 stl.addColorStop(0,"rgba(255,0,0,"+opac+")"); 397 context.fillStyle = stl; 398 clipReflex(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt,tilt); 399 context.fill(); 400 globalCompositeOperation = "source-in"; 401 clearReflex(context,canvas.width/20,0,canvas.width*0.95,canvas.height,iter+(rest>0?1:0),dist,higt,tilt); 402 context.clip(); 403 context.clearRect(0,0,canvas.width,canvas.height); 404 context.clearRect(0,0,canvas.width,canvas.height); 405 context.clearRect(0,0,canvas.width,canvas.height); 406 context.clearRect(0,0,canvas.width,canvas.height); 407 if(isWK) {object.removeChild(resource);} 408 } 409 } 410 } 411 } 412 if(tilt=='r') {tilt='n';}else if(tilt=='n') {tilt='l';}else if(tilt=='l') {tilt='r';} 413 context.save(); 414 canvas.style.visibility = 'visible'; 415 } 416 } 417} 418 419if(window.addEventListener) window.addEventListener("load",addReflex,false); 420else window.attachEvent("onload",addIEReflex);
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.