Img大小自适应代码:
<script language="javascript"> function autoSetImgSize(elemId, percent) { var doc = document; if( elemId != null && elemId != "" ) { try { doc = doc.getElementById(elemId); } catch (e1) { doc = document; } } if( percent == null || percent == "" ) percent = "90%"; var items = doc.getElementsByTagName('img'); for( var k = 0; k < items.length; k++ ) { var w1 = items[k].width; items[k].style.width = percent; var w2 = items[k].width; items[k].height = items[k].height * (w2/w1); } } autoSetImgSize(null, "100%"); </script>
方法说明: autoSetImgSize(elemId, percent) elemId:html element id,可以为null或空 percent:自适应后的比例
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_USERAGENT, $user_agent); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); $data = curl_exec($ch);
if(curl_errno($ch)!==0){ $res=array(curl_errno($ch)*-1,curl_error($ch)); }else{ $curl_info=curl_getinfo($ch); $rsp_code=$curl_info["http_code"]; $res=array($rsp_code,$data); } //close curl connection curl_close($ch); return $res;
<!-- tinyMCE --> <script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> <script language="javascript" type="text/javascript"> // Notice: The simple theme does not use all options some of them are limited to the advanced theme tinyMCE.init({ mode : "textareas", width : "100%", theme : "advanced", theme_advanced_buttons1 : "bold, italic, strikethrough, separator, bullist, numlist, outdent, indent, separator, justifyleft, justifycenter, justifyright ,separator, link, unlink, image, wordpress, separator, undo, redo, separator,forecolor,backcolor, separator, code", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", paste_use_dialog : false, theme_advanced_resizing : true, theme_advanced_resize_horizontal : false, theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", dialog_type : "modal", entity_encoding : "raw", relative_urls : false, remove_script_host : false, force_p_newlines : true, force_br_newlines : false, convert_newlines_to_brs : false, remove_linebreaks : true }); </script> <!-- /tinyMCE -->
修改:/templets/default/header.html 第 60 行增加: 目的:增加TinyMCE支持,库
<!--{if $forum['allowhtml'] || $allowhtml}--> <!-- tinyMCE --> <script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script language="javascript" type="text/javascript"> // Notice: The simple theme does not use all options some of them are limited to the advanced theme tinyMCE.init({ theme : "advanced", mode : "exact", elements : "message", save_callback : "customSave", handle_event_callback: "ctlent", // mode : "textareas", width : "100%", theme_advanced_buttons1 : "bold, italic, strikethrough, separator, bullist, numlist, outdent, indent, separator, justifyleft, justifycenter, justifyright ,separator, link, unlink, image, wordpress, separator, undo, redo, separator,forecolor,backcolor, separator, code", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", paste_use_dialog : false, theme_advanced_resizing : true, theme_advanced_resize_horizontal : false, theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", dialog_type : "modal", entity_encoding : "raw", relative_urls : false, remove_script_host : false, force_p_newlines : true, force_br_newlines : false, convert_newlines_to_brs : false, remove_linebreaks : true }); // Custom save callback, gets called when the contents is to be submitted function customSave(id, content) { // alert(id + "=" + content); } </script> <!-- end: tinyMCE --> <!--{/if}-->
修改:/include/discuzcode.func.php 256 行增加: 目的:为了兼容老帖子的UBB换行问题
if( $htmlon || $allowhtml ) return nl2br(str_replace(array("\t"), array(' '), $message));
修改:/templets/post_bbinsert.htm 第一行替换成: 目的:开启了html后,把UBB可视化编辑器屏蔽掉
<!--{if $forum['allowhtml'] || $allowhtml}--> <!-- using TinyWCE --> <!--{elseif $bbinsert}-->
修改:/templets/post_editpost.html,post_newthread.html,post_newreply.html 三个模板文件中分别查找 function validate(theform) ,在这一行下增加: 目的:支持TinyMCE的即时保存,即与Textarea之间的信息交换
<!--{if $forum['allowhtml'] || $allowhtml}--> // add by yangbo.2006.07.01 bug: alert must be input title tinyMCE.triggerSave(); <!--{/if}-->
|
|