Changeset 1681 for websites

Show
Ignore:
Timestamp:
11/16/07 23:37:04 (6 years ago)
Author:
cho45
Message:

websites/coderepos.org/trac/share/js/TracUtils.js:

ぜんぜんだめだったのを修正
布団で作業しているので IE で未確認

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • websites/coderepos.org/trac/share/js/TracUtils.js

    r1680 r1681  
    33 
    44var SVN_REPOS_BASE = 'http://svn.coderepos.org/share'; 
    5  
    6  
    7 (function () { 
    8  
    9 /* 
    10  * Browse Source のときに該当する svn web にすぐ翔べるように 
    11  */ 
    12 function addJumpToReposLink() { 
    13         var content = $("#content .browser"); 
    14         if (content) { 
    15                 var aboutLink  = $("#metanav li.last a"); 
    16                 var tracRoot   = $X("string(//a[0]/@href)").replace(/\?.*/, ''); 
    17                 var sourcePath = String(location).replace(tracRoot, SVN_REPOS_BASE).replace(/\?.*/, ''); 
    18                 aboutLink.replaceWith( 
    19                         $("<a title='Jump to Repository'>SVN Web</a>").attr("href", sourcePath) 
    20                 ); 
    21                 $("#ctxtnav li:first").after($("<li>").append($("<a>SVN Web</a>").attr("href", sourcePath))); 
    22         } 
    23 } 
    24  
    25 function clickableCodeArea () { 
    26         var start = "//Executable"; 
    27         $("//*[@id='content']//div[@class='code']/pre[contains(.//span[@class='code-comment'],'"+start+"')]").each(function () { 
    28                 var e = $(this); 
    29                 var js = e.text(); 
    30                 var a = $("<a href='javascript:void(156)>Click to execute.</a>").click(function () { 
    31                         eval(js); 
    32                 }).css({ 
    33                         fontSize   : "80%", 
    34                         fontWeight : "bold", 
    35                         border     : "1px solid #ccc", 
    36                         display    : "block", 
    37                         width      : "10em", 
    38                         padding    : "0.2em", 
    39                         margin     : "0 auto 0.2em 0", 
    40                         textAlign  : "center" 
    41                 }); 
    42                 e.parent().before(a); 
    43         }); 
    44 } 
    45  
    46 function addBodyClass () { 
    47         if (location.pathname.indexOf("/share/wiki/Committers") == 0) { 
    48                 document.body.className = "committer"; 
    49         } 
    50 } 
     5var TRAC_BASE      = 'http://coderepos.org/share'; 
    516 
    527$(function () { 
     
    549        clickableCodeArea(); 
    5510        addBodyClass(); 
     11 
     12        /* 
     13         * Browse Source のときに該当する svn web にすぐ翔べるように 
     14         */ 
     15        function addJumpToReposLink() { 
     16                if (location.pathname.indexOf("/share/browser") == 0) { 
     17                        var aboutLink  = $("#metanav li.last a"); 
     18                        var sourcePath = String(location).replace(TRAC_BASE + "/browser", SVN_REPOS_BASE).replace(/\?.*/, ''); 
     19                        aboutLink.replaceWith( 
     20                                $("<a title='Jump to Repository'>SVN Web</a>").attr("href", sourcePath) 
     21                        ); 
     22                        $("#ctxtnav li:first").after($("<li>").append($("<a>SVN Web</a>").attr("href", sourcePath))); 
     23                } 
     24        } 
     25 
     26        function clickableCodeArea () { 
     27                var start = "//Executable"; 
     28                $("//*[@id='content']//div[@class='code']/pre[contains(.//span[@class='code-comment'],'"+start+"')]").each(function () { 
     29                        var e = $(this); 
     30                        var js = e.text(); 
     31                        var a = $("<a href='javascript:void(156)>Click to execute.</a>").click(function () { 
     32                                eval(js); 
     33                        }).css({ 
     34                                fontSize   : "80%", 
     35                                fontWeight : "bold", 
     36                                border     : "1px solid #ccc", 
     37                                display    : "block", 
     38                                width      : "10em", 
     39                                padding    : "0.2em", 
     40                                margin     : "0 auto 0.2em 0", 
     41                                textAlign  : "center" 
     42                        }); 
     43                        e.parent().before(a); 
     44                }); 
     45        } 
     46 
     47        function addBodyClass () { 
     48                if (location.pathname.indexOf("/share/wiki/Committers") == 0) { 
     49                        document.body.className = "committer"; 
     50                } 
     51        } 
    5652}); 
    57  
    58 })(); 
    5953 
    6054// extend version of $X