⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fck_image.js

📁 本文是一个中文版BLOG程序
💻 JS
字号:
var dialog		= window.parent ;
var oEditor		= window.parent.InnerDialogLoaded() ;
var FCK			= oEditor.FCK ;
var FCKLang		= oEditor.FCKLang ;
var FCKConfig	= oEditor.FCKConfig ;
var FCKTools	= oEditor.FCKTools ;
var oImage		= window.parent.Selection.GetSelectedElement() ;
if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) { oImage = null ; }
window.onload = function() {
	oEditor.FCKLanguageManager.TranslatePage(document) ;
	LoadSelection() ;
	window.parent.SetAutoSize( true ) ;
	window.parent.SetOkButton( true ) ;
	SelectField( 'txtUrl' ) ;
}
function LoadSelection() {
	if ( ! oImage ) return ;
	GetE('txtUrl').value    = GetAttribute( oImage, 'src', '' ) ;
	GetE('txtAlt').value    = GetAttribute( oImage, 'alt', '' ) ;
	GetE('txtBorder').value	= GetAttribute( oImage, 'border', '' ) ;
	GetE('cmbAlign').value	= GetAttribute( oImage, 'align', '' ) ;
	var iWidth, iHeight ;
	var regexSize = /^\s*(\d+)px\s*$/i ;
	if ( oImage.style.width ) {
		var aMatchW  = oImage.style.width.match( regexSize ) ;
		if ( aMatchW ) {
			iWidth = aMatchW[1] ;
			oImage.style.width = '' ;
			SetAttribute( oImage, 'width' , iWidth ) ;
		}
	}
	if ( oImage.style.height ) {
		var aMatchH  = oImage.style.height.match( regexSize ) ;
		if ( aMatchH ) {
			iHeight = aMatchH[1] ;
			oImage.style.height = '' ;
			SetAttribute( oImage, 'height', iHeight ) ;
		}
	}
	GetE('txtWidth').value	= iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ;
	GetE('txtHeight').value	= iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ;
}
function Ok() {
	if ( GetE('txtUrl').value.length == 0 ) {
		GetE('txtUrl').focus() ;
		alert( FCKLang.DlgImgAlertUrl ) ;
		return false ;
	}
	oEditor.FCKUndo.SaveUndoStep() ;
	oImage = FCK.CreateElement( 'IMG' ) ;
	UpdateImage( oImage ) ;
	return true ;
}
function UpdateImage( e ) {
	SetAttribute( e, "src", GetE('txtUrl').value ) ;
	SetAttribute( e, "alt", GetE('txtAlt').value ) ;
	SetAttribute( e, "width", GetE('txtWidth').value ) ;
	SetAttribute( e, "height", GetE('txtHeight').value ) ;
	SetAttribute( e, "border", GetE('txtBorder').value ) ;
	SetAttribute( e, "align", GetE('cmbAlign').value ) ;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -