admin/ckfinder/plugins/imageresize/plugin.js
(开头部分) 21KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.html or http://cksource.com/ckfinder/license
*
* The software, this file and its contents are subject to the CKFinder
* License. Please read the license.txt file before using, installing, copying,
* modifying or distribute this file or part of its contents. The contents of
* this file is part of the Source Code of CKFinder.
*/
CKFinder.addPlugin( 'imageresize', {
readOnly : false,
connectorInitialized : function( api, xml )
{
var node = xml.selectSingleNode( 'Connector/PluginsInfo/imageresize/@smallThumb' );
if ( node )
CKFinder.config.imageresize_thumbSmall = node.value;
node = xml.selectSingleNode( 'Connector/PluginsInfo/imageresize/@mediumThumb' );
if ( node )
CKFinder.config.imageresize_thumbMedium = node.value;
node = xml.selectSingleNode( 'Connector/PluginsInfo/imageresize/@largeThumb' );
if ( node )
CKFinder.config.imageresize_thumbLarge = node.value;
},
uiReady : function( api )
{
var regexExt = /^(.*)\.([^\.]+)$/,
regexFileName = /^(.*?)(?:_\d+x\d+)?\.([^\.]+)$/,
regexGetSize = /^\s*(\d+)(px)?\s*$/i,
regexGetSizeOrEmpty = /(^\s*(\d+)(px)?\s*$)|^$/i,
imageDimension = { width : 0, height : 0 },
file,
doc;
var updateFileName = function( dialog )
{
var width = dialog.getValueOf( 'tab1', 'width' ) || 0,
height = dialog.getValueOf( 'tab1', 'height' ) || 0,
e = dialog.getContentElement( 'tab1', 'createNewBox' );
if ( width && height )
{
var matches = file.name.match( regexFileName );
dialog.setValueOf( 'tab1', 'fileName', matches[1] + '_' + width + 'x' + height );
e.getElement().show();
}
else
e.getElement().hide();
};
var onSizeChange = function()
{
var value = this.getValue(), // This = input element.
dialog = this.getDialog(),
maxWidth = api.config.imagesMaxWidth,
maxHeight = api.config.imagesMaxHeight,
aMatch = value.match( regexGetSize ),
width = imageDimension.width,
后面还有 616 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
