しばらくの間、 Core 5 File Managerユーティリティを正常に使用してきましたが、ディレクトリに数百の画像が蓄積され始めると、IE ユーザーにとって大幅に速度が低下し始めました。現在、遅延読み込みをハックしようとしていますが、非常にうまくいきません。
問題のブロックは次のとおりです。
// Retrieve the data and generate the markup.
$.getJSON(fileConnector + '?path=' + path + '&mode=getfolder&getsizes=false&showThumbs=' + showThumbs, function(data){
var result = '';
if(data){
if(data['Code'] && data['Code'] != 0)
{
result = "<div style='text-align:center;color:red;'>An error occured:<br \/>" + data['Error'] + "<\/div>";
// $.prompt(data['Error']);
} else
{
var key = '';
if($('#fileinfo').data('view') == 'grid'){
result += '<ul id="contents" class="grid">';
for(key in data){
var props = data[key]['Properties'];
if (props)
{
var scaledWidth = 64;
var actualWidth = props['Width'];
if(actualWidth > 1 && actualWidth < scaledWidth) scaledWidth = actualWidth;
result += '<li class="' + (data[key]["File Type"] == 'dir' ? 'directory':'file') + '">'+
'<div class="clip"><img src="' + data[key]['Preview'] + '" width="' + scaledWidth + '" alt="' + data[key]['VisiblePath'] + '" /></div><p>' + data[key]['Filename'] + '</p>';
if(props['Width'] && props['Width'] != '') result += '<span class="meta dimensions">' + props['Width'] + 'x' + props['Height'] + '</span>';
if(props['Size'] && props['Size'] != '') result += '<span class="meta size">' + props['Size'] + '</span>';
if(props['Date Created'] && props['Date Created'] != '') result += '<span class="meta created">' + props['Date Created'] + '</span>';
if(props['Date Modified'] && props['Date Modified'] != '') result += '<span class="meta modified">' + props['Date Modified'] + '</span>';
result += '</li>';
}
}
result += '</ul>';
if (key=='')
{
result = '<div style="margin-top:40px;text-align:center;"><em>No files found</em></div>';
}
} else {
result += '<table id="contents" class="list">';
result += '<thead><tr><th class="headerSortDown"><span>Name</span></th><th><span>Dimensions</span></th><th><span>Size</span></th><th><span>Modified</span></th></tr></thead>';
result += '<tbody>';
for(key in data){
var path = data[key]['VisiblePath'];
var props = data[key]['Properties'];
if (props)
{
result += '<tr class="' + (data[key]["File Type"] == 'dir' ? 'directory':'file') + '">';
result += '<td title="' + path + '">' + data[key]['Filename'] + '</td>';
if(props['Width'] && props['Width'] != ''){
result += ('<td>' + props['Width'] + 'x' + props['Height'] + '</td>');
} else {
result += '<td></td>';
}
if(props['Size'] && props['Size'] != ''){
result += '<td><abbr title="' + props['Size'] + '">' + formatBytes(props['Size']) + '</abbr></td>';
} else {
result += '<td></td>';
}
if(props['Date Modified'] && props['Date Modified'] != ''){
result += '<td>' + props['Date Modified'] + '</td>';
} else {
result += '<td></td>';
}
result += '</tr>';
}
}
if (key=='')
{
result += '<tr><td colspan="4" style="text-align:center"><em>No files found</em></td></tr>';
}
result += '</tbody>';
result += '</table>';
}
}
} else {
result += '<h1>Could not retrieve folder contents.</h1>';
}
// Add the new markup to the DOM.
$('#fileinfo').html(result);
json リクエストは、cfdirectory タグを使用して呼び出し元に返されるデータの構造体を構築する coldfusion 関数にヒットします。
<cffunction name="_getDirectoryInfo" returntype="array" access="private">
<cfargument name="path" type="string" required="yes" />
<cfargument name="getsizes" type="boolean" required="yes" />
<cfargument name="filter" type="string" required="no" default="" />
<cfset var dirlist_qry = "" />
<cfset var data_arr = arrayNew(1) />
<cfset var currData_struct = "" />
<cfset var imageData_struct = "" />
<cfset var dirPath = (arguments.path) />
<cfset var webDirPath = _getWebPath(dirPath) />
<cfset var displayWebPath = _getWebPath(path=dirPath, includeUploadRoot=false) />
<cfif not DirectoryExists(dirPath)>
<cfdirectory action="create" directory="#dirPath#">
<!--- no longer required, we will auto create the directory
<cfset returnError(translate('DIRECTORY_NOT_EXIST', dirPath)) />
--->
</cfif>
<cftry>
<cfdirectory action="list" directory="#dirPath#" name="dirlist_qry" sort="type,name" filter="#arguments.filter#" />
<cfcatch>
<cfset returnError(translate('UNABLE_TO_OPEN_DIRECTORY', arguments.path, cfcatch.message & " - " & cfcatch.detail)) />
</cfcatch>
</cftry>
<cfloop query="dirlist_qry"><cfif find('.', dirlist_qry.name) neq 1>
<cfset currData_struct = structNew() />
<cfset arrayAppend(data_arr, currData_struct) />
<cfset structInsert(currData_struct, "Filename", dirlist_qry.name) />
<cfset structInsert(currData_struct, "Error", "") />
<cfset structInsert(currData_struct, "Code", 0) />
<cfset structInsert(currData_struct, "Properties", structNew()) />
<cfset structInsert(currData_struct.Properties, "Date Created", "") />
<cfset structInsert(currData_struct.Properties, "Date Modified", "#lsdateformat(dateLastModified, 'medium')# #timeformat(dateLastModified, 'HH:mm:ss')#") />
<cfset structInsert(currData_struct.Properties, "Height", "") />
<cfset structInsert(currData_struct.Properties, "Width", "") />
<cfif dirlist_qry.type eq "DIR">
<cfset structInsert(currData_struct, "Path", webDirPath & dirlist_qry.name & "/") />
<cfset structInsert(currData_struct, "VisiblePath", displayWebPath & dirlist_qry.name & "/") />
<cfset structInsert(currData_struct, "File Type", "dir") />
<cfset structInsert(currData_struct, "Preview", request.directoryIcon) />
<cfset structInsert(currData_struct.Properties, "Size", "") />
<cfelse>
<cfset structInsert(currData_struct, "Path", webDirPath & dirlist_qry.name) />
<cfset structInsert(currData_struct, "VisiblePath", displayWebPath & dirlist_qry.name) />
<cfset structInsert(currData_struct, "File Type", lCase(listlast(dirlist_qry.name, '.'))) />
<cfset structInsert(currData_struct.Properties, "Size", dirlist_qry.size) />
<cfif _isImage(dirlist_qry.name)>
<cfset structInsert(currData_struct, "Preview", webDirPath & dirlist_qry.name) />
<cfif arguments.getsizes>
<cfset imageData_struct = _getImageInfo(dirlist_qry.directory & variables.separator & dirlist_qry.name) />
<cfset structInsert(currData_struct.Properties, "Height", imageData_struct.height, true) />
<cfset structInsert(currData_struct.Properties, "Width", imageData_struct.width, true) />
</cfif>
<cfelse>
<cfset structInsert(currData_struct, "Preview", request.defaultIcon) />
</cfif>
</cfif>
</cfif></cfloop>
<cfreturn data_arr />
</cffunction>
広範な調査の結果、さらに遅くなることなく開始/終了コールをセットアップする方法を見つけることができません。これに対処したのは私だけではないことを知っているので、アイデアのためにこれを投稿したかった. 私が試したすべてのページネーション プラグインは、core5 のセットアップ方法が原因で機能しませんでした。皆様、よい休日を。