发新话题
打印

Lightbox v2.0 添加总结(对以前的总结,适用于1.7版本)

Lightbox v2.0 添加总结(对以前的总结,适用于1.7版本)

其实这篇文章是没有必要写的,但是对于新手还有对于程序不太了解的可能就有一定的必要了。
我想提醒的是,lightbox v2.0同样可以在zblog1.7版本中使用(这是我些这篇文章的主要目的)。
我的博客里面已修改成功了。

首先请参照 http://bbs.rainbowsoft.org/viewthread.php?tid=400&extra=page%3D1
做好前5步,第六步,在1.7版本的734行下面开始修改代码的,或者你可以使用dreamwaver的查找功能
去找:
复制内容到剪贴板
代码:
If ZC_UBB_IMAGE_ENABLE And Instr(strType,"[image]")>0 Then
'[img]
(对于1.6f版本不是在734行)
找到以后,你可以看到它下面的代码是:
复制内容到剪贴板
代码:
objRegExp.Pattern="(\[IMG=)([0-9]*),([0-9]*),([^\n\[]*)(\])(.+?)(\[\/IMG\])"
                strContent= objRegExp.Replace(strContent,"<img src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/>")

                objRegExp.Pattern="(\[IMG=)([0-9]*),([^\n\[]*)(\])(.+?)(\[\/IMG\])"
                strContent= objRegExp.Replace(strContent,"<img src=""$5"" alt=""$3"" title=""$3"" width=""$2""/>")

                objRegExp.Pattern="(\[IMG=)([0-9]*)(\])(.+?)(\[\/IMG\])"
                strContent= objRegExp.Replace(strContent,"<img src=""$4"" alt="""" title="""" width=""$2""/>")

                objRegExp.Pattern="(\[IMG\])(.+?)(\[\/IMG\])"
                strContent= objRegExp.Replace(strContent,"<img onload=""ResizeImage(this,"&ZC_IMAGE_WIDTH&")"" src=""$2"" alt="""" title=""""/>")


                objRegExp.Pattern="(\[IMG_LEFT=)([0-9]*),([0-9]*),([^\n\[]*)(\])(.+?)(\[\/IMG_LEFT\])"
                strContent= objRegExp.Replace(strContent,"<img class=""float-left"" style=""float:left"" src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/>")

                objRegExp.Pattern="(\[IMG_LEFT=)([0-9]*),([^\n\[]*)(\])(.+?)(\[\/IMG_LEFT\])"
                strContent= objRegExp.Replace(strContent,"<img class=""float-left"" style=""float:left"" src=""$5"" alt=""$3"" title=""$3"" width=""$2""/>")

                objRegExp.Pattern="(\[IMG_LEFT=)([0-9]*)(\])(.+?)(\[\/IMG_LEFT\])"
                strContent= objRegExp.Replace(strContent,"<img class=""float-left"" style=""float:left"" src=""$4"" alt="""" title="""" width=""$2""/>")

                objRegExp.Pattern="(\[IMG_LEFT\])(.+?)(\[\/IMG_LEFT\])"
                strContent= objRegExp.Replace(strContent,"<img onload=""ResizeImage(this,"&ZC_IMAGE_WIDTH&")"" class=""float-left"" style=""float:left"" src=""$2"" alt="""" title=""""/>")


                objRegExp.Pattern="(\[IMG_RIGHT=)([0-9]*),([0-9]*),(.*)(\])(.+?)(\[\/IMG_RIGHT\])"
                strContent= objRegExp.Replace(strContent,"<img class=""float-right"" style=""float:right"" src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/>")

                objRegExp.Pattern="(\[IMG_RIGHT=)([0-9]*),(.*)(\])(.+?)(\[\/IMG_RIGHT\])"
                strContent= objRegExp.Replace(strContent,"<img class=""float-right"" style=""float:right"" src=""$5"" alt=""$3"" title=""$3"" width=""$2""/>")

                objRegExp.Pattern="(\[IMG_RIGHT=)([0-9]*)(\])(.+?)(\[\/IMG_RIGHT\])"
                strContent= objRegExp.Replace(strContent,"<img class=""float-right"" style=""float:right"" src=""$4"" alt="""" title="""" width=""$2""/>")

                objRegExp.Pattern="(\[IMG_RIGHT\])(.+?)(\[\/IMG_RIGHT\])"
                strContent= objRegExp.Replace(strContent,"<img onload=""ResizeImage(this,"&ZC_IMAGE_WIDTH&")"" class=""float-right"" style=""float:right"" src=""$2"" alt="""" title=""""/>")
你将上面的代码替换为下面的代码(综合了http://bbs.rainbowsoft.org/viewthread.php?tid=454&extra=page%3D2上面的介绍):
复制内容到剪贴板
代码:
objRegExp.Pattern="(\[IMG=)([0-9]*),([0-9]*),([^\n\[]*)(\])(.+?)(\[\/IMG\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$6"" rel=""lightbox[roadtrip]"" title=""$4""><img src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/></a>")
                objRegExp.Pattern="(\[IMG=)([0-9]*),([^\n\[]*)(\])(.+?)(\[\/IMG\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$5"" rel=""lightbox[roadtrip]"" title=""$3""><img src=""$5"" alt=""$3"" title=""$3"" width=""$2""/></a>")
                objRegExp.Pattern="(\[IMG=)([0-9]*)(\])(.+?)(\[\/IMG\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$4"" rel=""lightbox[roadtrip]"" title=""""><img src=""$4"" alt="""" title="""" width=""$2""/></a>")
                objRegExp.Pattern="(\[IMG\])(.+?)(\[\/IMG\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$2"" rel=""lightbox[roadtrip]"" title=""""><img onload=""ResizeImage(this,"&ZC_IMAGE_WIDTH&")"" src=""$2"" alt="""" title=""""/></a>")

                objRegExp.Pattern="(\[IMG_LEFT=)([0-9]*),([0-9]*),([^\n\[]*)(\])(.+?)(\[\/IMG_LEFT\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$6"" rel=""lightbox[roadtrip]"" title=""$4""><img class=""float-left"" style=""float:left"" src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/></a>")
                objRegExp.Pattern="(\[IMG_LEFT=)([0-9]*),([^\n\[]*)(\])(.+?)(\[\/IMG_LEFT\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$5"" rel=""lightbox[roadtrip]"" title=""$3""><img class=""float-left"" style=""float:left"" src=""$5"" alt=""$3"" title=""$3"" width=""$2""/></a>")
                objRegExp.Pattern="(\[IMG_LEFT=)([0-9]*)(\])(.+?)(\[\/IMG_LEFT\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$4"" rel=""lightbox[roadtrip]"" title=""""><img class=""float-left"" style=""float:left"" src=""$4"" alt="""" title="""" width=""$2""/></a>")
                objRegExp.Pattern="(\[IMG_LEFT\])(.+?)(\[\/IMG_LEFT\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$2"" rel=""lightbox[roadtrip]"" title=""""><img onload=""ResizeImage(this,"&ZC_IMAGE_WIDTH&")"" class=""float-left"" style=""float:left"" src=""$2"" alt="""" title=""""/></a>")

                objRegExp.Pattern="(\[IMG_RIGHT=)([0-9]*),([0-9]*),(.*)(\])(.+?)(\[\/IMG_RIGHT\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$6"" rel=""lightbox[roadtrip]"" title=""$4""><img class=""float-right"" style=""float:right"" src=""$6"" alt=""$4"" title=""$4"" width=""$2"" height=""$3""/></a>")
                objRegExp.Pattern="(\[IMG_RIGHT=)([0-9]*),(.*)(\])(.+?)(\[\/IMG_RIGHT\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$5"" rel=""lightbox[roadtrip]"" title=""$3""><img class=""float-right"" style=""float:right"" src=""$5"" alt=""$3"" title=""$3"" width=""$2""/></a>")
                objRegExp.Pattern="(\[IMG_RIGHT=)([0-9]*)(\])(.+?)(\[\/IMG_RIGHT\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$4"" rel=""lightbox[roadtrip]"" title=""""><img class=""float-right"" style=""float:right"" src=""$4"" alt="""" title="""" width=""$2""/></a>")
                objRegExp.Pattern="(\[IMG_RIGHT\])(.+?)(\[\/IMG_RIGHT\])"
                strContent= objRegExp.Replace(strContent,"<a href=""$2"" rel=""lightbox[roadtrip]"" title=""""><img onload=""ResizeImage(this,"&ZC_IMAGE_WIDTH&")"" class=""float-right"" style=""float:right"" src=""$2"" alt="""" title=""""/></a>")
然后进行:
打开Z-Blog目录/TEMPLATE/single.html文件(原文的介绍是需要修改了另外的几个模版页面的,我感觉没必要的),在<head>和</head>之间加上如下代码:
复制内容到剪贴板
代码:
        <script type="text/javascript" src="<#ZC_BLOG_HOST#>SCRIPT/prototype.js"></script>
        <script type="text/javascript" src="<#ZC_BLOG_HOST#>SCRIPT/scriptaculous.js?load=effects"></script>
        <script type="text/javascript" src="<#ZC_BLOG_HOST#>SCRIPT/lightbox.js"></script>
        <link rel="stylesheet" href="<#ZC_BLOG_HOST#>CSS/lightbox.css" type="text/css" media="screen" />
然后:修改Z-Blog目录/SCRIPT/common.js文件,查找到:
复制内容到剪贴板
代码:
objImage.attachEvent('onclick', function(){try{showModelessDialog(objImage.src);}catch(e){window.open(objImage.src);}});
并删除这些代码。
最后重建就可以了。

[ 本帖最后由 lockice 于 2007-1-11 16:56 编辑 ]
冰锁---网络,技术,新闻,文摘,评论,生活

http://www.lockice.com/

TOP

Lightbox中的prototype.js能在1.7中正常运行?
布罗格的烘培机
短信已禁用,有事发贴。

TOP

我这上面似乎是正常的,暂时没发现有错误。可以看这个页面这上面有两个图片。
http://www.lockice.com/YingYing/48.html
冰锁---网络,技术,新闻,文摘,评论,生活

http://www.lockice.com/

TOP

1.7不建议使用Lightbox,请改用GreyBox.

http://bbs.rainbowsoft.org/viewt ... &extra=page%3D1

不用修改源码,只改模板,效果更炫.
布罗格的烘培机
短信已禁用,有事发贴。

TOP

发新话题