我正在使用SMARTY PHP TEMPLATE ENGINE、Apache 2和PHP 5.3.3。这是我原来的 main.js 文件内容
// Functions
(function($){
var url1 = /(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,
url2 = /(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,
linkifyThis = function () {
var childNodes = this.childNodes,
i = childNodes.length;
while(i--)
{
var n = childNodes[i];
if (n.nodeType == 3) {
var html = $.trim(n.nodeValue);
if (html)
{
html = html.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(url1, '$1<a href="http://$2" target="_blank">$2</a>$3')
.replace(url2, '$1<a href="$2" target="_blank">$2</a>$5');
$(n).after(html).remove();
}
}
else if (n.nodeType == 1 && !/^(a|button|textarea)$/i.test(n.tagName)) {
linkifyThis.call(n);
}
}
};
$.fn.linkify = function () {
return this.each(linkifyThis);
};
})(jQuery);
function openCenteredWindow(url, height, width, name, parms) {
var left = Math.floor( (screen.width - width) / 2);
var top = Math.floor( (screen.height - height) / 2);
var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
if (parms) { winParms += "," + parms; }
var win = window.open(url, name, winParms);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
return win;
}
但是当我在浏览器上浏览我的 js 文件(http://domain.com/js/main.js)时,它是这样的:
(function($){var url1=/(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,url2=/(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,linkifyThis=function(){var childNodes=this.childNodes,i=childNodes.length;while(i--)
{var n=childNodes[i];if(n.nodeType==3){var html=$.trim(n.nodeValue);if(html)
{html=html.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(url1,'$1<a href="http://$2" target="_blank">$2</a>$3').replace(url2,'$1<a href="$2" target="_blank">$2</a>$5');$(n).after(html).remove();}}
else if(n.nodeType==1&&!/^(a|button|textarea)$/i.test(n.tagName)){linkifyThis.call(n);}}};$.fn.linkify=function(){return this.each(linkifyThis);};})(jQuery);function openCenteredWindow(url,height,width,name,parms){var left=Math.floor((screen.width- width)/2);var top=Math.floor((screen.height- height)/2);var winParms="top="+ top+",left="+ left+",height="+ height+",width="+ width;if(parms){winParms+=","+ parms;}
var win=window.open(url,name,winParms);if(parseInt(navigator.appVersion)>=4){win.window.focus();}
return win;}
这就像 GZIPPED,删除换行符和注释行。现在我在main.js文件中添加一些内容。现在main.js的原始内容是这样的:
// Functions
(function($){
var url1 = /(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,
url2 = /(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,
linkifyThis = function () {
var childNodes = this.childNodes,
i = childNodes.length;
while(i--)
{
var n = childNodes[i];
if (n.nodeType == 3) {
var html = $.trim(n.nodeValue);
if (html)
{
html = html.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(url1, '$1<a href="http://$2" target="_blank">$2</a>$3')
.replace(url2, '$1<a href="$2" target="_blank">$2</a>$5');
$(n).after(html).remove();
}
}
else if (n.nodeType == 1 && !/^(a|button|textarea)$/i.test(n.tagName)) {
linkifyThis.call(n);
}
}
};
$.fn.linkify = function () {
return this.each(linkifyThis);
};
})(jQuery);
function openCenteredWindow(url, height, width, name, parms) {
var left = Math.floor( (screen.width - width) / 2);
var top = Math.floor( (screen.height - height) / 2);
var winParms = "top=" + top + ",left=" + left + ",height=" + height + ",width=" + width;
if (parms) { winParms += "," + parms; }
var win = window.open(url, name, winParms);
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
return win;
}
$(document).ready({
/*
-webkit-border-bottom-left-radius: 0px !important;
-moz-border-radius-bottomleft: 0px !important;
border-bottom-left-radius: 0px !important;
*/
/* dropdown sub-menu control
***************************/
var leftItemSub = $('.loginbarLeftItem').find('ul');
var rightItemSub = $('.loginbarRightItem').find('ul');
if(leftItemSub.length){
leftItemSub.parent().css({
'-webkit-border-bottom-left-radius': '10px !important',
'-moz-border-radius-bottomleft': '10px !important',
'border-bottom-left-radius': '10px !important'
});
}
if(rightItemSub.length){
rightItemSub.parent().css({
'-webkit-border-bottom-left-radius': '10px !important',
'-moz-border-radius-bottomleft': '10px !important',
'border-bottom-left-radius': '10px !important'
});
}
});
但是当我在浏览器上浏览到我的main.js文件时,它是相同的(没有新行,也没有新添加的内容)
(function($){var url1=/(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,url2=/(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,linkifyThis=function(){var childNodes=this.childNodes,i=childNodes.length;while(i--)
{var n=childNodes[i];if(n.nodeType==3){var html=$.trim(n.nodeValue);if(html)
{html=html.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(url1,'$1<a href="http://$2" target="_blank">$2</a>$3').replace(url2,'$1<a href="$2" target="_blank">$2</a>$5');$(n).after(html).remove();}}
else if(n.nodeType==1&&!/^(a|button|textarea)$/i.test(n.tagName)){linkifyThis.call(n);}}};$.fn.linkify=function(){return this.each(linkifyThis);};})(jQuery);function openCenteredWindow(url,height,width,name,parms){var left=Math.floor((screen.width- width)/2);var top=Math.floor((screen.height- height)/2);var winParms="top="+ top+",left="+ left+",height="+ height+",width="+ width;if(parms){winParms+=","+ parms;}
var win=window.open(url,name,winParms);if(parseInt(navigator.appVersion)>=4){win.window.focus();}
return win;}
CSS文件也有同样的问题。GZIPing 和缓存我的 JS 和 CSS 文件。但我找不到它。我试过了CTRL+F5
有任何想法吗 ?
注1
/js 和 /css 文件夹上没有.htaccess文件。但是根文件夹上有一个 .htaccess 。
options -multiviews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^users$ users.php
RewriteRule ^categories/([^/.]+)?$ cat.php?cid=$1&%{QUERY_STRING}
RewriteRule ^user/([^/.]+)?$ user.php?uname=$1&%{QUERY_STRING}
RewriteRule ^tags/([^/.]+)/([^/.]+)?$ tags.php?cid=$1&tag=$2&%{QUERY_STRING}
RewriteRule ^([^/.]+)/([^/.]+)/([^/.]*)?$ view.php?title=$1&id=$2&%{QUERY_STRING}
</IfModule>
<IfModule mod_security.c>
# Turn off mod_security filtering.
SecFilterEngine Off
# The below probably isn't needed,
# but better safe than sorry.
SecFilterScanPOST Off
</IfModule>
笔记2
当我浏览到main.js?(randomnumbers)
( like main.js?345458
) 时,我可以看到新版本。但仍然没有注释行和新行。