📄 glossy.js
字号:
/** * glossy.js 1.31 (19-Jul-2007) * (c) by Christian Effenberger * All Rights Reserved * Source: glossy.netzgesta.de * Distributed under Netzgestade Software License Agreement * http://www.netzgesta.de/cvi/LICENSE.txt * License permits free of charge * use on non-commercial and * private web sites only **/var tmp = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0;if(tmp) var isIE = document.namespaces ? 1 : 0;if(isIE) { if(document.namespaces['v'] == null) { var stl = document.createStyleSheet(); stl.addRule("v\\:*", "behavior: url(#default#VML);"); document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); }}function getImages(className){ var children = document.getElementsByTagName('img'); var elements = new Array(); var i = 0; var child; var classNames; var j = 0; for (i=0;i<children.length;i++) { child = children[i]; classNames = child.className.split(' '); for (var j = 0; j < classNames.length; j++) { if (classNames[j] == className) { elements.push(child); break; } } } return elements;}function getClasses(classes,string){ var temp = ''; for (var j=0;j<classes.length;j++) { if (classes[j] != string) { if (temp) { temp += ' ' } temp += classes[j]; } } return temp;}function getClassValue(classes,string){ var temp = 0; var pos = string.length; for (var j=0;j<classes.length;j++) { if (classes[j].indexOf(string) == 0) { temp = Math.min(classes[j].substring(pos),100); break; } } return Math.max(0,temp);}function getClassColor(classes,string){ var temp = 0; var str = ''; var pos = string.length; for (var j=0;j<classes.length;j++) { if (classes[j].indexOf(string) == 0) { temp = classes[j].substring(pos); str = '#' + temp.toLowerCase(); break; } } 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; }}function getClassAttribute(classes,string){ var temp = 0; var pos = string.length; for (var j=0;j<classes.length;j++) { if (classes[j].indexOf(string) == 0) { temp = 1; break; } } return temp;}function roundedRect(ctx,x,y,width,height,radius,nopath){ if (!nopath) ctx.beginPath(); ctx.moveTo(x,y+radius); ctx.lineTo(x,y+height-radius); ctx.quadraticCurveTo(x,y+height,x+radius,y+height); ctx.lineTo(x+width-radius,y+height); ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius); ctx.lineTo(x+width,y+radius); ctx.quadraticCurveTo(x+width,y,x+width-radius,y); ctx.lineTo(x+radius,y); ctx.quadraticCurveTo(x,y,x,y+radius); if (!nopath) ctx.closePath();}function addRadialStyle(ctx,x1,y1,r1,x2,y2,r2,opacity) { var tmp = ctx.createRadialGradient(x1,y1,r1,x2,y2,r2); var opt = Math.min(parseFloat(opacity+0.1),1.0); tmp.addColorStop(0,'rgba(0,0,0,'+opt+')'); tmp.addColorStop(0.25,'rgba(0,0,0,'+opacity+')'); tmp.addColorStop(1,'rgba(0,0,0,0)'); return tmp;}function addLinearStyle(ctx,x,y,w,h,opacity) { var tmp = ctx.createLinearGradient(x,y,w,h); var opt = Math.min(parseFloat(opacity+0.1),1.0); tmp.addColorStop(0,'rgba(0,0,0,'+opt+')'); tmp.addColorStop(0.25,'rgba(0,0,0,'+opacity+')'); tmp.addColorStop(1,'rgba(0,0,0,0)'); return tmp;}function addBright(ctx,x,y,width,height,radius,opacity) { var style = ctx.createLinearGradient(0,y,0,y+height); style.addColorStop(0,'rgba(254,254,254,'+opacity+')'); style.addColorStop(1,'rgba(254,254,254,0.1)'); ctx.beginPath(); ctx.moveTo(x,y+radius); ctx.lineTo(x,y+height-radius); ctx.quadraticCurveTo(x,y+height,x+radius,y+height); ctx.lineTo(x+width-radius,y+height); ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius); ctx.lineTo(x+width,y+radius); ctx.quadraticCurveTo(x+width,y,x+width-radius,y); ctx.lineTo(x+radius,y); ctx.quadraticCurveTo(x,y,x,y+radius); ctx.closePath(); ctx.fillStyle = style; ctx.fill();}function addDark(ctx,x,y,width,height,radius,opacity) { var style = ctx.createLinearGradient(0,y,0,y+height); style.addColorStop(0,'rgba(0,0,0,0)'); style.addColorStop(1,'rgba(0,0,0,'+opacity+')'); ctx.beginPath(); ctx.moveTo(x,y); ctx.lineTo(x,y+height-radius); ctx.quadraticCurveTo(x,y+height,x+radius,y+height); ctx.lineTo(x+width-radius,y+height); ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius); ctx.lineTo(x+width,y); ctx.lineTo(x,y); ctx.closePath(); ctx.fillStyle = style; ctx.fill();}function addFrame(ctx,x,y,width,height,radius,opacity) { roundedRect(ctx,x,y,width,height,radius); var style = ctx.createLinearGradient(0,0,0,height); style.addColorStop(0,'rgba(254,254,254,'+opacity+')'); style.addColorStop(1,'rgba(0,0,0,'+opacity+')'); ctx.lineWidth = (radius+x)/2; ctx.strokeStyle = style; ctx.stroke();}function glossyShadow(ctx,x,y,width,height,radius,opacity){ var style; var os = radius/2; ctx.beginPath(); ctx.rect(x+radius,y,width-(radius*2),y+os); ctx.closePath(); style = addLinearStyle(ctx,x+radius,y+os,x+radius,y,opacity); ctx.fillStyle = style; ctx.fill(); ctx.beginPath(); ctx.rect(x,y,radius,radius); ctx.closePath(); style = addRadialStyle(ctx,x+radius,y+radius,radius-os,x+radius,y+radius,radius,opacity); ctx.fillStyle = style; ctx.fill(); ctx.beginPath(); ctx.rect(x,y+radius,os,height-(radius*2));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -