參考連結:http://phpbb-tw.net/phpbb/viewtopic.php?t=33720
使用版本:phpbb 2.0.17
網站位置:http://www.phpbbhacks.com/download/3957
狀況描述:
我給我的系統安裝了 Resize Posted Images Based on Max Width 2.4.5
為何不能起效用呢?
Internet Explorer 左下還出現了指令碼錯誤呢...
提供附件參考如下:
1)MOD 說明文件:
代碼: 選擇全部
##############################################################
## MOD Title: Resize Posted Images Based on Max Width
## MOD Author: spooky2280 < webmaster@christianfecteau.com > (Christian Fecteau) http://portfolio.christianfecteau.com/
## MOD Description: This MOD resizes images within posts to make it so they don't break your layout. Images resized are made
## clickable and openable in a popup in full-size. You can specify a different max width for each of your themes.
## Images that do not exceed the max width are left as is. See the MOD in action: http://christianfecteau.com/rmw
##
## MOD Version: 2.4.5
##
## Installation Level: Easy
## Installation Time: 5 Minutes (1 minute with EasyMod)
##
## Files To Edit: 7
## templates/subSilver/bbcode.tpl
## templates/subSilver/overall_header.tpl
## templates/subSilver/overall_footer.tpl
## templates/subSilver/simple_header.tpl
## templates/subSilver/simple_footer.tpl
## includes/page_header.php
## language/lang_english/lang_main.php
##
## Included Files: 1
## templates/rmw_jslib.js
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## This MOD uses Javascript and works in all W3C DOM browsers:
## NN6+, IE5+, Mozilla/Firefox/Camino, Safari, Opera7+, etc.
##
## To set a different max width than the 400 pixels default one:
## 1. OPEN overall_header.tpl and simple_header.tpl in templates/subSilver/
## 2. FIND rmw_max_width = 400
## 3. CHANGE 400 to the width in pixels that you want for this template
## 4. REPEAT steps 1 to 3 for each of your other templates (if any)
##
## Don't forget to edit all your templates and languages in addition to subSilver and lang_english
##
##############################################################
## MOD History:
##
## 2005-01-18 - Version 2.4.5
## - Files with changes from 2.4.4 to 2.4.5:
## - templates/rmw_jslib.js
## - I forgot to remove a line (124) in the js file that was there for testing purposes only:
## rmw_obj.setAttribute('resizemod','over');
## This can cause a bug if for some reason the onload event fires twice. A user reported
## a situation where it happens and I was able to force the bug, so... line's deleted now!
##
## 略\r
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
copy templates/rmw_jslib.js to templates/rmw_jslib.js
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/bbcode.tpl
#
#-----[ FIND ]------------------------------------------
#
# around line 56
#
<!-- BEGIN img -->
#
#-----[ IN-LINE FIND ]------------------------------------------
#
<img
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
# should look like: <img resizemod="on" onload="rmw_img_loaded(this)" src="{URL}" border="0" />
#
resizemod="on" onload="rmw_img_loaded(this)"
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND ]------------------------------------------
#
# around line 212
#
<!-- BEGIN switch_enable_pm_popup -->
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- start mod : Resize Posted Images Based on Max Width -->
<script type="text/javascript">
//<![CDATA[
<!--
var rmw_max_width = 400; // you can change this number, this is the max width in pixels for posted images
var rmw_border_1 = '1px solid {T_BODY_LINK}';
var rmw_border_2 = '2px dotted {T_BODY_LINK}';
var rmw_image_title = '{L_RMW_IMAGE_TITLE}';
//-->
//]]>
</script>
<script type="text/javascript" src="{U_RMW_JSLIB}"></script>
<!-- fin mod : Resize Posted Images Based on Max Width -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_footer.tpl
#
#-----[ FIND ]------------------------------------------
#
</body
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<div style="display:none" id="resizemod"></div>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/simple_header.tpl
#
#-----[ FIND ]------------------------------------------
#
# around line 234
#
</head
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<!-- start mod : Resize Posted Images Based on Max Width -->
<script type="text/javascript">
//<![CDATA[
<!--
var rmw_max_width = 400; // this max width is used in the Topic Review iframe when posting
var rmw_border_1 = '1px solid {T_BODY_LINK}';
var rmw_border_2 = '2px dotted {T_BODY_LINK}';
var rmw_image_title = '{L_RMW_IMAGE_TITLE}';
//-->
//]]>
</script>
<script type="text/javascript" src="{U_RMW_JSLIB}"></script>
<!-- fin mod : Resize Posted Images Based on Max Width -->
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/simple_footer.tpl
#
#-----[ FIND ]------------------------------------------
#
</body
#
#-----[ BEFORE, ADD ]------------------------------------------
#
<div style="display:none" id="resizemod"></div>
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
# around line 361
#
'L_WHOSONLINE_MOD'
#
#-----[ AFTER, ADD ]------------------------------------------
#
//-- start mod : Resize Posted Images Based on Max Width ----------------------------------
'L_RMW_IMAGE_TITLE' => $lang['rmw_image_title'],
'U_RMW_JSLIB' => $phpbb_root_path . 'templates/rmw_jslib.js',
//-- fin mod : Resize Posted Images Based on Max Width ------------------------------------
#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
# around line 163
#
$lang['Moderator']
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['rmw_image_title'] = 'Click to view full-size'; // mod : Resize Posted Images Based on Max Width
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM代碼: 選擇全部
/*
"Resize Posted Images Based on Max Width" 2.4.5
A phpBB MOD originally created by Christian Fecteau.
This MOD is copyright (c) Christian Fecteau 2004-2005
This MOD is released under the Creative Commons licence:
http://creativecommons.org/licenses/by-nc-sa/2.0/
Read carefully this licence before making any use of my code.
Credits must be given with my full name (Christian Fecteau)
and a link to my portfolio: http://portfolio.christianfecteau.com/
Removal or alteration of this notice is strongly prohibited.
*/
// don't change anything below
function rmw_go()
{
var rmw_img_array = document.getElementsByTagName("IMG");
for (var i = 0; i < rmw_img_array.length; i++)
{
var rmw_img = rmw_img_array[i];
if (String(rmw_img.getAttribute('resizemod')) == 'on')
{
if (rmw_wait_for_width && rmw_img.width && !isNaN(rmw_img.width))
{
if (rmw_img.width > Number(rmw_max_width))
{
rmw_img.setAttribute('resizemod','off');
rmw_img.onload = null;
rmw_img.removeAttribute('onload');
var rmw_clone = rmw_img.cloneNode(false);
var rmw_parent = rmw_img.parentNode;
rmw_clone.setAttribute('width',String(rmw_max_width));
rmw_parent.replaceChild(rmw_clone,rmw_img);
rmw_make_pop(rmw_clone);
}
}
else if (!rmw_wait_for_width)
{
rmw_img.setAttribute('resizemod','off');
var rmw_clone = rmw_img.cloneNode(false);
rmw_img.onload = null;
rmw_img.removeAttribute('onload');
var rmw_parent = rmw_img.parentNode;
var rmw_ind = rmw_count++;
rmw_clone.setAttribute('resizemod',String(rmw_ind));
rmw_preload[rmw_ind] = new Image();
rmw_preload[rmw_ind].src = rmw_img.src;
if (window.showModelessDialog)
{
rmw_clone.style.margin = '2px';
}
rmw_clone.style.border = rmw_border_1;
rmw_clone.style.width = '28px';
rmw_parent.replaceChild(rmw_clone,rmw_img);
}
}
}
if (!rmw_over && document.getElementById('resizemod'))
{
rmw_over = true;
rmw_go();
}
else if (!rmw_over)
{
window.setTimeout('rmw_go()',2000);
}
}
function rmw_img_loaded(rmw_obj)
{
if (!document.getElementsByTagName || !document.createElement) {return;}
var rmw_att = String(rmw_obj.getAttribute('resizemod'));
var rmw_real_width = false;
if ((rmw_att != 'on') && (rmw_att != 'off'))
{
var rmw_index = Number(rmw_att);
if (rmw_preload[rmw_index].width)
{
rmw_real_width = rmw_preload[rmw_index].width;
}
}
else
{
rmw_obj.setAttribute('resizemod','off');
if (rmw_obj.width)
{
rmw_real_width = rmw_obj.width;
}
}
if (!rmw_real_width || isNaN(rmw_real_width) || (rmw_real_width <= 0))
{
var rmw_rand1 = String(rmw_count++);
eval("rmw_retry" + rmw_rand1 + " = rmw_obj;");
eval("window.setTimeout('rmw_img_loaded(rmw_retry" + rmw_rand1 + ")',2000);");
return;
}
if (rmw_real_width > Number(rmw_max_width))
{
if (window.showModelessDialog)
{
rmw_obj.style.margin = '2px';
}
rmw_make_pop(rmw_obj);
}
else if (!rmw_wait_for_width)
{
rmw_obj.style.width = String(rmw_real_width) + 'px';
rmw_obj.style.border = '0';
if (window.showModelessDialog)
{
rmw_obj.style.margin = '0px';
}
}
if (window.ActiveXObject) // IE on Mac and Windows
{
window.clearTimeout(rmw_timer1);
rmw_timer1 = window.setTimeout('rmw_refresh_tables()',10000);
}
}
function rmw_refresh_tables()
{
var rmw_tables = document.getElementsByTagName("TABLE");
for (var j = 0; j < rmw_tables.length; j++)
{
rmw_tables[j].refresh();
}
}
function rmw_make_pop(rmw_ref)
{
rmw_ref.style.border = rmw_border_2;
rmw_ref.style.width = String(rmw_max_width) + 'px';
if (!window.opera)
{
rmw_ref.onclick = function()
{
if (!rmw_pop.closed)
{
rmw_pop.close();
}
rmw_pop = window.open('about:blank','christianfecteaudotcom',rmw_pop_features);
rmw_pop.resizeTo(window.screen.availWidth,window.screen.availHeight);
rmw_pop.moveTo(0,0);
rmw_pop.focus();
rmw_pop.location.href = this.src;
}
}
else
{
var rmw_rand2 = String(rmw_count++);
eval("rmw_pop" + rmw_rand2 + " = new Function(\"rmw_pop = window.open('" + rmw_ref.src + "','christianfecteaudotcom','" + rmw_pop_features + "'); if (rmw_pop) {rmw_pop.focus();}\")");
eval("rmw_ref.onclick = rmw_pop" + rmw_rand2 + ";");
}
document.all ? rmw_ref.style.cursor = 'hand' : rmw_ref.style.cursor = 'pointer';
rmw_ref.title = rmw_image_title;
if (window.showModelessDialog)
{
rmw_ref.style.margin = '0px';
}
}
if (document.getElementsByTagName && document.createElement) // W3C DOM browsers
{
rmw_preload = new Array();
if (window.GeckoActiveXObject || window.showModelessDialog) // Firefox, NN7.1+, and IE5+ for Win
{
rmw_wait_for_width = false;
}
else
{
rmw_wait_for_width = true;
}
rmw_pop_features = 'top=0,left=0,width=' + String(window.screen.width-80) + ',height=' + String(window.screen.height-190) + ',scrollbars=1,resizable=1';
rmw_over = false;
rmw_count = 1;
rmw_timer1 = null;
if (!window.opera)
{
rmw_pop = new Object();
rmw_pop.closed = true;
rmw_old_onunload = window.onunload;
window.onunload = function()
{
if (rmw_old_onunload)
{
rmw_old_onunload();
rmw_old_onunload = null;
}
if (!rmw_pop.closed)
{
rmw_pop.close();
}
}
}
window.setTimeout('rmw_go()',2000);
}
不知是否這裡出錯呢?
templates/ca_aphrodite/overall_header.tpl
代碼: 選擇全部
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="Author" content="http://www.phpbbstyles.com" />
{META}
{NAV_LINKS}
<title>{SITENAME} :: {PAGE_TITLE}</title>
<link rel="stylesheet" href="templates/ca_aphrodite/style.css" type="text/css" />
<script language="javascript" type="text/javascript" src="templates/ca_aphrodite/scripts.js"></script>
{CA_INLINE_CSS}
<!-- IE conditional comments: http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp -->
<!--[if IE]>
<style type="text/css">
/* IE hack to emulate the :hover & :focus pseudo-classes
Add the selectors below that required the extra attributes */
.row1h, .row1h-new { behavior: url("templates/ca_aphrodite/pseudo-hover.htc"); }
</style>
<!-- start mod : Resize Posted Images Based on Max Width -->
<script type="text/javascript">
//<![CDATA[
<!--
var rmw_max_width = 400; // you can change this number, this is the max width in pixels for posted images
var rmw_border_1 = '1px solid {T_BODY_LINK}';
var rmw_border_2 = '2px dotted {T_BODY_LINK}';
var rmw_image_title = '{L_RMW_IMAGE_TITLE}';
//-->
//]]>
</script>
<script type="text/javascript" src="{U_RMW_JSLIB}"></script>
<!-- fin mod : Resize Posted Images Based on Max Width -->
<![endif]-->
</head>
<body onload="PreloadFlag = true;">
<a name="top"></a>
<table cellspacing="0" width="100%" id="forum">
<tr>
<td class="forum-header" align="left"><a href="{U_PORTAL}" title="{L_INDEX}"><img src="templates/ca_aphrodite/images/logo.gif" height="63" alt="{L_INDEX}" /></a></td>
<td class="forum-header header-search" align="right" valign="bottom">
<form action="{U_SEARCH}" method="get"><input name="search_keywords" type="text" class="post" style="width: 100px;" /> <input type="submit" class="liteoption" value="{L_SEARCH}" /></form>
</td>
</tr>
<tr>
<td colspan="2" class="forum-buttons" valign="middle">
<a href="{U_PORTAL}">{L_HOME}</a> •
<!-- BEGIN switch_user_logged_out -->
<a href="{U_REGISTER}">{L_REGISTER}</a> •
<!-- END switch_user_logged_out -->
<!-- BEGIN switch_user_logged_in -->
<a href="{U_PROFILE}">{L_PROFILE}</a> •
<a href="{U_PRIVATEMSGS}">{L_PRIVATEMSGS}</a> •
<!-- END switch_user_logged_in -->
<a href="{U_SEARCH}">{L_SEARCH}</a> •
<a href="{U_FAQ}">{L_FAQ}</a> •
<a href="{U_MEMBERLIST}">{L_MEMBERLIST}</a> •
<a href="{U_GROUP_CP}">{L_USERGROUPS}</a> •
<a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a>
</td>
</tr>
<tr>
<td colspan="2" id="content">
<!-- BEGIN switch_user_logged_in -->
<div class="popup{PRIVMSG_IMG}"><a href="{U_PRIVATEMSGS}">{PRIVATE_MESSAGE_INFO}</a></div>
<!-- END switch_user_logged_in -->


