root/platform/tdiary/plugin/prettify.rb

Revision 11283, 0.8 kB (checked in by drry, 7 months ago)
  • ちょっとした変更です。
Line 
1# prettify.rb
2
3if /^(?:latest|day|month|nyear)$/ =~ @mode then
4        add_header_proc do
5                <<-HTML
6                <link href="prettify.css" type="text/css" rel="stylesheet" />
7                <script type="text/javascript" src="prettify.js"></script>
8                <script type="text/javascript"><!--
9                        function google_prettify(){
10                                var divs=document.getElementsByTagName("div");
11                                for(var i=divs.length;i-- >0;){
12                                        if(divs[i].className!="body")continue;
13                                        var pres=divs[i].getElementsByTagName("pre");
14                                        for(var j=pres.length;j-- >0;){
15                                                pres[j].className="prettyprint";
16                                        }
17                                }
18                                prettyPrint();
19                        }
20                        if(window.addEventListener){
21                                window.addEventListener('load',google_prettify,false);
22                        }else if(window.attachEvent){
23                                window.attachEvent('onload',google_prettify);
24                        }else{
25                                window.onload=google_prettify;
26                        }
27                // --></script>
28                HTML
29        end
30end
Note: See TracBrowser for help on using the browser.