Groups
Sign in
Groups
blogger-ext2
Conversations
About
Send feedback
Help
plugin_syntaxhighlight
0 views
Skip to first unread message
elleryq
unread,
Dec 19, 2007, 3:51:42 AM
12/19/07
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to blogger-ext2
這是我寫的一個很簡單的 syntaxhighlight plugin,主要是使用 dp.syntaxhighlight
使用前需先加入 dp.syntaxhighlight 相關 javascript,例如:
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/shCore.js
'></
script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushCSharp.js'></script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushVb.js'></script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushPhp.js'></script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushJScript.js'></script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushSql.js'></script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushXml.js'></script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushPython.js'></script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushCss.js'></script>
<script type="text/javascript" src='http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
shBrushCpp.js'></script>
下面是 plugin 內容:
// Register dp.SyntaxHighLight
// Dependency:
// jQuery
// blogger-ext2-core
BloggerExt.SH = function() {
// Plugin 由此開始
if( dp!='undefined' ) {
jQuery("pre > br").each( function()
{ jQuery(this).replaceWith( "\n" ); } );
jQuery("textarea > br").each( function()
{ jQuery(this).replaceWith( "\n" ); } );
dp.SyntaxHighlighter.ClipboardSwf = 'http://
syntaxhighlighter.googlecode.com/svn/tags/1.5.1/Scripts/
clipboard.swf';
dp.SyntaxHighlighter.HighlightAll('code');
}
};
BloggerExt.SH.user_pref = function() {
var prefs = [];
return prefs;
};
BloggerExt.SH.update_pref = function(prefs) {
};
BloggerExt.register('SH', { SH: true} );
Reply all
Reply to author
Forward
0 new messages