iugo

万能贴图修改,可以在PB2中随意贴图

  •  
  •   iugo · Dec 9, 2010 · 5382 views
    This topic created in 5704 days ago, the information mentioned may be changed or developed.
    简单替换,实现各种功能,不过安全隐患未经证实。

    原帖: http://bbs.blueidea.com/thread-2728149-1-1.html
    我以前在 LeadBBS 中看到的。

    修改方法:

    在模板帖子展示处添加 <span id=clian.net> </span>

    然后在页尾添加如下代码:
    <script language="javascript">
    //<!--
    function code(id)
    {
    if (document.getElementById(id))
    {
    document.getElementById(id).innerHTML = convertcode(document.getElementById(id).innerHTML);
    }
    }
    function convertcode(str)
    {
    str = str.replace(/\[http\:\/\/(.+?)\.gif/gi,"<img src='http://$1.gif' />");//gif
    str = str.replace(/\[http\:\/\/(.+?)\.jpg/gi,"<img src='http://$1.jpg' />");//jpg
    str = str.replace(/\[http\:\/\/(.+?)\.png/gi,"<img src='http://$1.png' />");//png
    return str;
    }
    code('clian.net');
    //-->
    </script>
    7 replies    1970-01-01 08:00:00 +08:00
    iugo
        1
    iugo  
    OP
       Dec 9, 2010
    贴图方法:在图片链接前加 [
    dimlau
        2
    dimlau  
       Dec 10, 2010
    你稍做修改之后放进 filters.py 得了。
    不过既然匹配前缀,就没必要匹配后缀名了吧,很多图片地址是不带后缀名的。
    iugo
        3
    iugo  
    OP
       Dec 10, 2010
    @dimlau 这个的好处是js,浏览器来处理。
    alai
        4
    alai  
       Dec 14, 2010
    有没有演示地址?
    dimlau
        5
    dimlau  
       Dec 14, 2010
    呃,这个更全面了。
    http://www.v2ex.com/t/5698
    alai
        6
    alai  
       Dec 17, 2010
    有人试过PB2+textile了吗?
    imsein
        7
    imsein  
       Dec 23, 2010 via iPod
    不错,mark
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2727 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 62ms · UTC 15:44 · PVG 23:44 · LAX 08:44 · JFK 11:44
    ♥ Do have faith in what you're doing.