Entries Tagged with "javascript"

使 sIFR 3 安守其职而不替换中文标题

Saturday, December 20th, 2008

如果大家看过这个博客,可能已经发现博客的各个标题都用了非标准字体。这种效果是使用 sIFR 3 脚本来实现的。其主要原理就是利用Flash文件可以内嵌自定义字体来自动将页面中的特定文字自动替代(大家在英文标题上右键看看。。。)。诚然对于西方语言来说,要内嵌字体是很容易实现的。对于英文来说就只有26个字母,即使包含大小写、粗体、斜体和粗斜体等变体,文件也不会太大(几个kB ~ 十几kB)。对于其它使用拼音文字的语言来说情况也类似,都能将下载Swf 文件控制在适于网络传输的范围内。然而对于方块字来说就不太现实了。无论怎样压缩,做出来的swf文件都是1MB以上。 由于我的Blog上既有外文条目,也有中文。那有没有什么方法可以让sIFR 3 不处理中文条目呢?开始我想通过设置Flash 里头的css变量font-family,将后备字体列上,希望flash能自动调用本机系统上头的字体。可惜flash 不买账。最后就逼着我改点东东了。 下面是两个判别标题是否含有中文的函数: function fnFilterChinese( arrList) { //alert(arrList.length); var retList = []; for (var i=0;i< =arrList.length-1;i++) { var node = arrList[i]; if (fnCanShowChar(node.innerHTML)) { retList.push(node); } else { node.className += ” sIFR-ReplaceFailed”; }; }; //alert(retList.length); return retList; }; function fnCanShowChar(str) { for (var i=0;i 0×261) { //alert(str.charCodeAt(i) [...]

Tags: Tags: , , , ,

How melopia toggles its layout

Saturday, February 18th, 2006

I know that this changing layout technique has been dealt for many times by others, and I’m not the last one to deal with it. I tend to make things flexible, not just a web design, but also real-life stuffs (so don’t fix a time with me, lol). OK, to make a layout flexible, it [...]

Tags: Tags: , , , , ,

About Ray

Saturday, February 11th, 2006

Hi there! I’m from Guangzhou, China, and welcome to my weblog. OK, melop is not my real name, but the net name I’ve been using since I registered my first email account. My English name is Ray Cui and Chinese name in Pinyin is CUI Rong-Feng. I’m an undergraduate student of already graduated the Biology [...]

Tags: Tags: , , , , , , , , ,

54 queries. 0.628 seconds.