DDR爱好者之家 Design By 杰米
1,准备要素
1)替换字体的js文件
js代码:
function com_stewartspeak_replacement() { /* Dynamic Heading Generator By Stewart Rosenberger http://www.stewartspeak.com/headings/ This script searches through a web page for specific or general elements and replaces them with dynamically generated images, in conjunction with a server-side script. */ replaceSelector("h1","dynatext/heading.php",true);//前两个参数需要修改 var testURL = "dynatext/loading.gif" ;//修改为对应的图片路径 var doNotPrintImages = false; var printerCSS = "replacement-print.css"; var hideFlicker = false; var hideFlickerCSS = "replacement-screen.css"; var hideFlickerTimeout = 100;//这里可以做相应的修改 /* --------------------------------------------------------------------------- For basic usage, you should not need to edit anything below this comment. If you need to further customize this script's abilities, make sure you're familiar with Javascript. And grab a soda or something. */ var items; var imageLoaded = false; var documentLoaded = false; function replaceSelector(selector,url,wordwrap) { if(typeof items == "undefined") items = new Array(); items[items.length] = {selector: selector, url: url, wordwrap: wordwrap}; } if(hideFlicker) { document.write('<link id="hide-flicker" rel="stylesheet" media="screen" href="' + hideFlickerCSS + '" />'); window.flickerCheck = function() { if(!imageLoaded) setStyleSheetState('hide-flicker',false); }; setTimeout('window.flickerCheck();',hideFlickerTimeout) } if(doNotPrintImages) document.write('<link id="print-text" rel="stylesheet" media="print" href="' + printerCSS + '" />'); var test = new Image(); test.onload = function() { imageLoaded = true; if(documentLoaded) replacement(); }; test.src = testURL + "" + (new Date()).getTime(); addLoadHandler(function(){ documentLoaded = true; if(imageLoaded) replacement(); }); function documentLoad() { documentLoaded = true; if(imageLoaded) replacement(); } function replacement() { for(var i=0;i<items.length;i++) { var elements = getElementsBySelector(items[i].selector); if(elements.length > 0) for(var j=0;j<elements.length;j++) { if(!elements[j]) continue ; var text = extractText(elements[j]); while(elements[j].hasChildNodes()) elements[j].removeChild(elements[j].firstChild); var tokens = items[i].wordwrap ""+escape(tokens[k]+' ')+"&selector="+escape(items[i].selector); var image = document.createElement("img"); image.className = "replacement"; image.alt = tokens[k] ; image.src = url; elements[j].appendChild(image); } if(doNotPrintImages) { var span = document.createElement("span"); span.style.display = 'none'; span.className = "print-text"; span.appendChild(document.createTextNode(text)); elements[j].appendChild(span); } } } if(hideFlicker) setStyleSheetState('hide-flicker',false); } function addLoadHandler(handler) { if(window.addEventListener) { window.addEventListener("load",handler,false); } else if(window.attachEvent) { window.attachEvent("onload",handler); } else if(window.onload) { var oldHandler = window.onload; window.onload = function piggyback() { oldHandler(); handler(); }; } else { window.onload = handler; } } function setStyleSheetState(id,enabled) { var sheet = document.getElementById(id); if(sheet) sheet.disabled = (!enabled); } function extractText(element) { if(typeof element == "string") return element; else if(typeof element == "undefined") return element; else if(element.innerText) return element.innerText; var text = ""; var kids = element.childNodes; for(var i=0;i<kids.length;i++) { if(kids[i].nodeType == 1) text += extractText(kids[i]); else if(kids[i].nodeType == 3) text += kids[i].nodeValue; } return text; } /* Finds elements on page that match a given CSS selector rule. Some complicated rules are not compatible. Based on Simon Willison's excellent "getElementsBySelector" function. Original code (with comments and description): http://simon.incutio.com/archive/2003/03/25/getElementsBySelector */ function getElementsBySelector(selector) { var tokens = selector.split(' '); var currentContext = new Array(document); for(var i=0;i<tokens.length;i++) { token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,''); if(token.indexOf('#') > -1) { var bits = token.split('#'); var tagName = bits[0]; var id = bits[1]; var element = document.getElementById(id); if(tagName && element.nodeName.toLowerCase() != tagName) return new Array(); currentContext = new Array(element); continue; } if(token.indexOf('.') > -1) { var bits = token.split('.'); var tagName = bits[0]; var className = bits[1]; if(!tagName) tagName = '*'; var found = new Array; var foundCount = 0; for(var h=0;h<currentContext.length;h++) { var elements; if(tagName == '*') elements = currentContext[h].all ""]*)""htmlcode"><"dip" (pixels dropped below baseline) of this font for this size. */ function get_dip($font,$size) { $test_chars = 'abcdefghijklmnopqrstuvwxyz' . 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . '1234567890' . '!@#$%^&*()\'"\\/;.,`~<>[]{}-+_-=' ; $box = @ImageTTFBBox($size,0,$font,$test_chars) ; return $box[3] ; } /* attempt to create an image containing the error message given. if this works, the image is sent to the browser. if not, an error is logged, and passed back to the browser as a 500 code instead. */ function fatal_error($message) { // send an image if(function_exists('ImageCreate')) { $width = ImageFontWidth(5) * strlen($message) + 10 ; $height = ImageFontHeight(5) + 10 ; if($image = ImageCreate($width,$height)) { $background = ImageColorAllocate($image,255,255,255) ; $text_color = ImageColorAllocate($image,0,0,0) ; ImageString($image,5,5,5,$message,$text_color) ; header('Content-type: image/png') ; ImagePNG($image) ; ImageDestroy($image) ; exit ; } } // send 500 code header("HTTP/1.0 500 Internal Server Error") ; print($message) ; exit ; } /* decode an HTML hex-code into an array of R,G, and B values. accepts these formats: (case insensitive) #ffffff, ffffff, #fff, fff */ function hex_to_rgb($hex) { // remove '#' if(substr($hex,0,1) == '#') $hex = substr($hex,1) ; // expand short form ('fff') color if(strlen($hex) == 3) { $hex = substr($hex,0,1) . substr($hex,0,1) . substr($hex,1,1) . substr($hex,1,1) . substr($hex,2,1) . substr($hex,2,1) ; } if(strlen($hex) != 6) fatal_error('Error: Invalid color "'.$hex.'"') ; // convert $rgb['red'] = hexdec(substr($hex,0,2)) ; $rgb['green'] = hexdec(substr($hex,2,2)) ; $rgb['blue'] = hexdec(substr($hex,4,2)) ; return $rgb ; } /* convert embedded, javascript unicode characters into embedded HTML entities. (e.g. '%u2018' => '‘'). returns the converted string. */ function javascript_to_html($text) { $matches = null ; preg_match_all('/%u([0-9A-F]{4})/i',$text,$matches) ; if(!empty($matches)) for($i=0;$i<sizeof($matches[0]);$i++) $text = str_replace($matches[0][$i], '&#'.hexdec($matches[1][$i]).';',$text) ; return $text ; } "htmlcode">DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米
暂无评论...
更新日志
2024年11月29日
2024年11月29日
- 凤飞飞《我们的主题曲》飞跃制作[正版原抓WAV+CUE]
- 刘嘉亮《亮情歌2》[WAV+CUE][1G]
- 红馆40·谭咏麟《歌者恋歌浓情30年演唱会》3CD[低速原抓WAV+CUE][1.8G]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[320K/MP3][193.25MB]
- 【轻音乐】曼托凡尼乐团《精选辑》2CD.1998[FLAC+CUE整轨]
- 邝美云《心中有爱》1989年香港DMIJP版1MTO东芝首版[WAV+CUE]
- 群星《情叹-发烧女声DSD》天籁女声发烧碟[WAV+CUE]
- 刘纬武《睡眠宝宝竖琴童谣 吉卜力工作室 白噪音安抚》[FLAC/分轨][748.03MB]
- 理想混蛋《Origin Sessions》[320K/MP3][37.47MB]
- 公馆青少年《我其实一点都不酷》[320K/MP3][78.78MB]
- 群星《情叹-发烧男声DSD》最值得珍藏的完美男声[WAV+CUE]
- 群星《国韵飘香·贵妃醉酒HQCD黑胶王》2CD[WAV]
- 卫兰《DAUGHTER》【低速原抓WAV+CUE】
- 公馆青少年《我其实一点都不酷》[FLAC/分轨][398.22MB]
- ZWEI《迟暮的花 (Explicit)》[320K/MP3][57.16MB]