-
Notifications
You must be signed in to change notification settings - Fork 0
/
fckplugin.js
34 lines (30 loc) · 1.28 KB
/
fckplugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
var ImportScript = function( sSrc )
{
document.write( '<scr' + 'ipt type="text/javascript" src="' + sSrc + '"></sc' + 'ript>' ) ;
} ;
var oApi = window;
ImportScript( FCKPlugins.Items.dynamicelement.Path + 'common.js' ) ;
var sHtmlFile = FCKPlugins.Items.dynamicelement.Path + 'dialog/fck_insert.html' ;
var oDialogCommand = new FCKDialogCommand( 'InsertDynamicElement',
FCKLang.DlgDynTitleInsertUpdate, sHtmlFile, 380, 190 ) ;
FCKCommands.RegisterCommand( 'InsertDynamicElement', oDialogCommand ) ;
var oItem = new FCKToolbarButton( 'InsertDynamicElement', FCKLang.DlgDynTitleInsertUpdate ) ;
var sIconUrl = FCKPlugins.Items.dynamicelement.Path + 'dynamicelement.png' ;
oItem.IconPath = sIconUrl ;
FCKToolbarItems.RegisterItem( 'InsertDynamicElement', oItem ) ;
var AddItems = function ( oMenu, oTag, sTagName )
{
if ( sTagName !== 'IMG' || oTag.className !== 'FCK__DynamicElement' )
return;
oMenu.AddSeparator() ;
oMenu.AddItem( 'InsertDynamicElement', FCKLang.DlgDynTitleUpdate, sIconUrl ) ;
} ;
FCK.ContextMenu.RegisterListener( { AddItems: AddItems } ) ;
FCKDocumentProcessor.AppendNew().ProcessDocument = function( document )
{
var aDivs = document.getElementsByClassName( 'dynamicelement' ) ;
var i = aDivs.length - 1 ;
while ( i >= 0 && ( oDiv = aDivs[i--] ) )
ProcessDiv(oDiv);
} ;