Вход Регистрация
Файл: public/js/3rd_party/ckeditor/plugins/ipsbbcode/dialogs/ipsbbcode.js
Строк: 281
<?php

/*
Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*
* This plug in by:
* Matt Mecham 2011
* Invision Power Services, Inc.
*/

(function()
{
    var 
ipsBbCodeDialog = function( editorinitVal )
    {
        var 
fetchDdContents = function()
        {
            
arr = [];
            
arr[0] = [ ipb.lang['ckeditor__pselectbbcode'], 'nill' ];
                                
            
$H(editor.config.IPS_BBCODE).each( function( tag )
            {
                
tag.key;
                
tag.value;
                
                
arrarr.length ] = [ v.titlev.tag ];
            } );
            
            return 
arr;
        };
            
        var 
fetchTagData = function( tag )
        {
            return ( 
editor.config.IPS_BBCODE[tag] ) ? editor.config.IPS_BBCODE[tag] : [];
        }
        
        var 
resetIt = function()
        {
            var 
dialog    editor.config._dialog/* When you're hacky and you know it */
            
var option    dialog.getContentElement'info''option' ).getElement();
            var 
content   dialog.getContentElement'info''content' ).getElement();
            var 
select    dialog.getContentElement'info''bbcodeTag' ).getElement();
            
            
option.hide();
            
content.hide();
            
            $(
'bbcode-description').hide();
        };
        
        
// Handles the event when the "Type" selection box is changed.
        
var bbCodeChanged = function()
        {
            var 
dialog    this.getDialog(),
                
typeValue this.getValue();
            
            
editor.config._dialog dialog;
            
            var 
tagData   fetchTagDatatypeValue );
            var 
option    dialog.getContentElement'info''option' ).getElement();
            var 
content   dialog.getContentElement'info''content' ).getElement();

            
option.hide();
            
content.hide();
            $(
'bbcode-description').hide();
                
            if ( 
typeValue != 'nill' && tagData.tag )
            {
                $(
'bbcode-description').updatetagData.desc ).show();

                
/* Show contents */
                
if ( parseInttagData.useoption ) == )
                {
                    
oid option.getAttribute('id');
                    
option.show();
                    $(
oid).down('label').updatetagData.menu_option_text tagData.menu_option_text ipb.lang['ckeditor__genoption'] );
                }
                
                
/* Show value */
                
if( parseInttagData.single_tag ) == )
                {
                    
cid content.getAttribute('id');
                    
content.show();
                    $(
cid).down('label').updatetagData.menu_content_text tagData.menu_content_text ipb.lang['ckeditor__gencontent'] );
                    
                    var 
html IPSCKTools.getSelectionHtmleditor );
                    
                    if ( 
html != '' && ! Object.isUndefined( $(cid).down('textarea') ) )
                    {
                        $(
cid).down('textarea').value html;
                        $(
cid).down('textarea').hide();
                        
                        if ( ! $(
'__x_insert') )
                        {
                            $(
cid).down('textarea').up('div').insert( new Element'div', { id'__x_insert' } ) );
                        }
                        
                         $(
'__x_insert').updatehtml );
                    }
                    else
                    {
                        
                        if ( $(
'__x_insert') )
                        {
                            $(
'__x_insert').update('');
                            $(
cid).down('textarea').value '';
                            $(
cid).down('textarea').show();
                        }
                    }
                }
            }
        };
    
        return {
            
title ipb.lang['ckeditor__bbcode'],
            
minWidth 350,
            
minHeight 140,
            
onShow : function()
            {
                var 
element this.getParentEditor().getSelection().getSelectedElement();
            },
            
onOk : function()
            {
                var 
editor    this.getParentEditor();
                
                
element editor.document.createElement'span' );
                
element.setAttribute'name''bbcodename' );
                
                
this.commitContent( { element element } );
                
                
tag            element.getAttribute('cke-saved-bbcode-tag');
                
option        element.getAttribute('cke-saved-bbcode-option');
                
ourcontent    element.getAttribute('cke-saved-bbcode-content');
                
                if( 
ourcontent == 'false' )
                {
                    
ourcontent '';
                }
                
                if( 
option == 'false' )
                {
                    
option '';
                }

                var 
tagData fetchTagDatatag );
                
                if ( 
ourcontent.match( /n|r/ ) )
                {
                    
Debug.write('moo');
                    
ourcontent ourcontent.replace( /n|r/g'<br>' );
                }
                
                if ( 
tagData.tag )
                {
                    if( 
parseInttagData.single_tag ) == )
                    {
                        if ( 
parseInttagData.useoption ) == )
                        {
                            
mytag '[' tag '='' + option + '']';
                        }
                        else
                        {
                            
mytag '[' tag ']';
                        }
                    }
                    else if ( 
parseInttagData.useoption ) == )
                    {
                        if ( 
tagData.optional_option == && option == '' )
                        {
                            
mytag '[' tag ']' ourcontent '[/' tag ']';
                        }
                        else
                        {
                            
mytag '[' tag '='' + option + '']' ourcontent '[/' tag ']';
                        }
                    }
                    else
                    {
                        
mytag '[' tag ']' ourcontent '[/' tag ']';
                    }
                    
                    
// Insert HTML
                    
editor.insertHtmlmytag );
                    
                    
resetIt();
                }
                
            },
            
contents : [
                {
                    
id 'info',
                    
label ipb.lang['ckeditor__bbcodelabel'],
                    
title ipb.lang['ckeditor__bbcodelabel'],
                    
elements : [
                        {
                            
id 'bbcodeTag',
                            
type 'select',
                            
label ipb.lang['ckeditor__bbcodelabel'],
                            
items fetchDdContents(),
                            
'default': ( typeofinitVal ) != 'undefined' && initVal != '' ) ? initVal 'nill',
                            
onLoadbbCodeChanged,
                            
onChange bbCodeChanged,
                            
commit : function( data )
                            {
                                var 
element data.element;
    
                                if ( 
this.getValue() )
                                    
element.setAttribute'cke-saved-bbcode-tag'this.getValue() );
                                else
                                {
                                    
element.setAttribute'cke-saved-bbcode-tag'false );
                                }
                            }
                        },
                        {
                            
id 'codedescription',
                            
type 'html',
                            
html'<div id="bbcode-description"></div>'
                        
},
                        {
                            
id 'option',
                            
type 'text',
                            
label ipb.lang['ckeditor__genoption'],
                            
hidden1,
                            
'default' '',
                            
accessKey 'N',
                            
setup : function( element )
                            {
                            },
                            
commit : function( data )
                            {
                                var 
element data.element;
    
                                if ( 
this.getValue() )
                                    
element.setAttribute'cke-saved-bbcode-option'this.getValue() );
                                else
                                {
                                    
element.setAttribute'cke-saved-bbcode-option'false );
                                }
                            }
                        },
                        {
                            
id 'content',
                            
type 'textarea',
                            
label ipb.lang['ckeditor__gencontent'],
                            
'default' '',
                            
hidden1,
                            
accessKey 'O',
                            
setup : function( data )
                            {
                            },
                            
commit : function( data )
                            {
                                var 
element data.element;
    
                                if ( 
this.getValue() )
                                    
element.setAttribute'cke-saved-bbcode-content'this.getValue() );
                                else
                                {
                                    
element.setAttribute'cke-saved-bbcode-content'false );
                                }
                                
                                
this.value '';
                            }
                        }
                    ]
                }
            ]
        };
    };
    
    
    
$H(CKEDITOR.config.IPS_BBCODE).each( function( tag )
    {
        
tag.key;
        
tag.value;

        if ( 
v.image && v.image != '' )
        {
            eval( 
"CKEDITOR.dialog.add( 'ipsbbcode_" v.tag "', function( editor ) { return ipsBbCodeDialog( editor, '" v.tag "' ); } );" );
        }
    } );
        
    
CKEDITOR.dialog.add'ipsbbcode', function( editor )
    {
        return 
ipsBbCodeDialogeditor'' );
        
    } );
    
} )();
?>
Онлайн: 0
Реклама