diff --git a/footer.html b/footer.html index e0a828b..8725303 100644 --- a/footer.html +++ b/footer.html @@ -1,4 +1,6 @@ - + + + + diff --git a/header.html b/header.html index e3b71c3..7385463 100644 --- a/header.html +++ b/header.html @@ -4,7 +4,8 @@ Markdown 語法說明 - - + +
+ diff --git a/scripts/detect_cleartype.js b/scripts/detect_cleartype.js new file mode 100644 index 0000000..a419fad --- /dev/null +++ b/scripts/detect_cleartype.js @@ -0,0 +1,99 @@ +/* + * TypeHelpers version 1.0 + * Zoltan Hawryluk, Nov 24 2009. + * @see http://www.useragentman.com/blog/2009/11/29/how-to-detect-font-smoothing-using-javascript/ + * + * Released under the MIT License. http://www.opensource.org/licenses/mit-license.php + * + * Works for + * - IE6+ (Windows), + * - Firefox 3.5+ (Windows, Mac, Linux), + * - Safari 4+ (Windows, Mac OS X), + * - Chrome 3.0+ (Windows). + * Opera 10.10 and under reports unknown support for font-smoothing. + * + * Modified by Christian Beier (www.beier-christian.eu) to detect the ClearType technology. + * + * Required: jQuery 1.3.x + * + * + * METHODS + * ------- + * + * hasSmoothing() returns: + * true if font smoothing is enabled + * false if font smoothing isn't enabled + * null if it cannot detect if it's on or not. + * + * addClasses() adds the following classes to the html tag: + * "hasFontSmoothing-true" if font smoothing is enabled + * "hasFontSmoothing-false" if it isn't + * "hasFontSmoothing-unknown" if it cannot detect it. + * + */ + +var TypeHelpers = new function(){ + var me = this; + + me.hasSmoothing = function(){ + // IE has screen.fontSmoothingEnabled - sweet! + if (typeof(screen.fontSmoothingEnabled) != "undefined") { + return screen.fontSmoothingEnabled; + } else { + try { + // Create a 35x35 Canvas block. + var canvasNode = document.createElement("canvas"); + canvasNode.width = "35"; + canvasNode.height = "35" + + // We must put this node into the body, otherwise + // Safari Windows does not report correctly. + canvasNode.style.display = "none"; + document.body.appendChild(canvasNode); + var ctx = canvasNode.getContext("2d"); + + // draw a black letter "O", 32px Arial. + ctx.textBaseline = "top"; + ctx.font = "32px Arial"; + ctx.fillStyle = "black"; + ctx.strokeStyle = "black"; + + ctx.fillText("O", 0, 0); + + // start at (8,1) and search the canvas from left to right, + // top to bottom to see if we can find a non-black pixel. If + // so we return true. + for (var j = 8; j <= 32; j++) { + for (var i = 1; i <= 32; i++) { + var imageData = ctx.getImageData(i, j, 1, 1).data + var alpha = imageData[3]; + + if (alpha != 255 && alpha != 0 && alpha > 180) { + return true; // font-smoothing must be on. + } + } + + } + + // didn't find any non-black pixels - return false. + return false; + } + catch (ex) { + // Something went wrong (for example, Opera cannot use the + // canvas fillText() method. Return null (unknown). + return null; + } + } + } + + $(document).ready(function() { + var result = me.hasSmoothing(); + if (result == true) { + $('html').addClass('hasFontSmoothing-true'); + } else if (result == false) { + $('html').addClass('hasFontSmoothing-false'); + } else { // result == null + $('html').addClass('hasFontSmoothing-unknown'); + } + }); +} diff --git a/stylesheets/main.css b/stylesheets/main.css new file mode 100644 index 0000000..f84c6bd --- /dev/null +++ b/stylesheets/main.css @@ -0,0 +1,52 @@ +html { + font-family: serif; +} + +html.hasFontSmoothing-true { + font-family: "微軟正黑體", "Microsoft JhengHei", sans-serif; +} + +div.wikistyle{width:960px} + +div.wikistyle{background-color:#f8f8f8;padding:.7em;} +div.wikistyle{border:1px solid #e9e9e9;} + +.wikistyle h1,.wikistyle h2,.wikistyle h3,.wikistyle h4,.wikistyle h5,.wikistyle h6{border:0!important;} +.wikistyle h1{font-size:170%!important;border-top:4px solid #aaa!important;padding-top:.5em!important;margin-top:1.5em!important;} +.wikistyle h1:first-child{margin-top:0!important;padding-top:.25em!important;border-top:none!important;} +.wikistyle h2{font-size:150%!important;margin-top:1.5em!important;border-top:4px solid #e0e0e0!important;padding-top:.5em!important;} +.wikistyle h3{margin-top:1em!important;} +.wikistyle p{margin:1em 0!important;line-height:1.5em!important;} +.wikistyle a.absent{color:#a00;} +.wikistyle ul,#wiki-form .content-body ul{margin:1em 0 1em 2em!important;} +.wikistyle ol,#wiki-form .content-body ol{margin:1em 0 1em 2em!important;} +.wikistyle ul li,#wiki-form .content-body ul li,.wikistyle ol li,#wiki-form .content-body ol li{margin-top:.5em;margin-bottom:.5em;} +.wikistyle ul ul,.wikistyle ul ol,.wikistyle ol ol,.wikistyle ol ul,#wiki-form .content-body ul ul,#wiki-form .content-body ul ol,#wiki-form .content-body ol ol,#wiki-form .content-body ol ul{margin-top:0!important;margin-bottom:0!important;} +.wikistyle blockquote{margin:1em 0!important;border-left:5px solid #ddd!important;padding-left:.6em!important;color:#555!important;} +.wikistyle dt{font-weight:bold!important;margin-left:1em!important;} +.wikistyle dd{margin-left:2em!important;margin-bottom:1em!important;} +.wikistyle table{margin:1em 0!important;} +.wikistyle table th{border-bottom:1px solid #bbb!important;padding:.2em 1em!important;} +.wikistyle table td{border-bottom:1px solid #ddd!important;padding:.2em 1em!important;} +.wikistyle pre{margin:1em 0;font-size:12px;background-color:#eee;border:1px solid #ddd;padding:5px;line-height:1.5em;color:#444;overflow:auto;-webkit-box-shadow:rgba(0,0,0,0.07) 0 1px 2px inset;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;} +.wikistyle pre::-webkit-scrollbar{height:8px;width:8px;} +.wikistyle pre::-webkit-scrollbar-track-piece{margin-bottom:10px;background-color:#e5e5e5;border-bottom-left-radius:4px 4px;border-bottom-right-radius:4px 4px;border-top-left-radius:4px 4px;border-top-right-radius:4px 4px;} +.wikistyle pre::-webkit-scrollbar-thumb:vertical{height:25px;background-color:#ccc;-webkit-border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(255,255,255,1);} +.wikistyle pre::-webkit-scrollbar-thumb:horizontal{width:25px;background-color:#ccc;-webkit-border-radius:4px;} +.wikistyle pre code{padding:0!important;font-size:12px!important;background-color:#eee!important;border:none!important;} +.wikistyle code{font-size:12px!important;background-color:#f8f8ff!important;color:#444!important;padding:0 .2em!important;border:1px solid #dedede!important;} +.wikistyle a code,.wikistyle a:link code,.wikistyle a:visited code{color:#4183c4!important;} +.wikistyle img{max-width:100%;} +.wikistyle pre.console{margin:1em 0!important;font-size:12px!important;background-color:black!important;padding:.5em!important;line-height:1.5em!important;color:white!important;} +.wikistyle pre.console code{padding:0!important;font-size:12px!important;background-color:black!important;border:none!important;color:white!important;} +.wikistyle pre.console span{color:#888!important;} +.wikistyle pre.console span.command{color:yellow!important;} +.wikistyle .frame{margin:0;display:inline-block;} +.wikistyle .frame img{display:block;} +.wikistyle .frame>span{display:block;border:1px solid #aaa;padding:4px;} +.wikistyle .frame span span{display:block;font-size:10pt;margin:0;padding:4px 0 2px 0;text-align:center;line-height:10pt;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;} +.wikistyle .float-left{float:left;padding:.5em 1em .25em 0;} +.wikistyle .float-right{float:right;padding:.5em 0 .25em 1em;} +.wikistyle .align-left{display:block;text-align:left;} +.wikistyle .align-center{display:block;text-align:center;} +.wikistyle .align-right{display:block;text-align:right;}