Impact factor for posts is a measurement of importance.

Impact factor for users reflect their authority, reputation and contribution on a particular topic.

Rating reflects the quality of posts.

Rating on Voofie is not a simple average of all ratings, but a weighted average of rating, weighted by the impact factor of users who rated.

Explore exciting communities of

Create a placeholder for <script> like ckeditor does to FLASH

Bookmark and Share
10 Sep 10

Hi guys, 

I want to create a similar effect to <script> tags that the ckeditor does to Flash. Whenever ckeditor detects a flash object, it replaces the object with a placeholder and a icon. That's my goal , but for <script> tag.

Below is the code I have so far. I create my plugin based on existing mediaEmbed plugin (using iframe). I am able to insert it. but ckeditor can not detect if the inserted text contain <script> tag and alert me about that. 

I already post questions on ckeditor and try community advices but still no luck. 

Pref: http://cksource.com/forums/viewtopic.php?f=11&t=19752&start=10 

and http://cksource.com/forums/viewtopic.php?f=11&t=17260&p=44472&hilit=fakeobject#p44472

Please tell me what i am doing wrong.

( function() {
    CKEDITOR.plugins.add( 'MediaEmbed',
    {
        requires: [ 'dialog' ],
        init: function( editor )
        {
           var me = this;
           CKEDITOR.dialog.add( 'MediaEmbedDialog', function ()
           {
              return {
                 title : 'Embed Media Dialog',
                 minWidth : 550,
                 minHeight : 100,
                 contents :
                       [
                          {
                             id : 'dialog',
                             label : 'Paste Embed Media',
                             expand : true,
                             elements :
                                   [
                                      {
                                       type : 'textarea',
                                       id : 'pageMediaEmbed',
                                       label : 'Paste Embed Media',
                                       style : 'width:100%'
                                      }
                                    ]
                          }
                       ],
                 onOk : function()
                 {    
                  var content = CKEDITOR.dialog.getCurrent().getValueOf('dialog','pageMediaEmbed');
                  editor.insertHtml(content);
                 }
              };
           } );

            editor.addCommand( 'MediaEmbed', new CKEDITOR.dialogCommand( 'MediaEmbedDialog' ) );

            editor.ui.addButton( 'MediaEmbed',
            {
                label: 'Insert Embed Media',
                command: 'MediaEmbed',
                icon: this.path + 'images/icon.gif'
            } );
            
            editor.addCss(
                 'img.cke_phpcode' +
                 '{' +
                    'background-image: url(' + CKEDITOR.getUrl( this.path + 'placeholder.png' ) + ');' +
                    'background-position: center center;' +
                    'background-repeat: no-repeat;' +
                    'border: 0px;' +
                    'width: 13px;' +
                    'height: 13px;' +
                 '}'
                 );
        },
        
        afterInit : function( editor )
        {  

          var dataProcessor = editor.dataProcessor;
          var dataFilter = dataProcessor && dataProcessor.dataFilter;
          if (dataFilter) {
             dataFilter.addRules({
                elements: {
                   'script': function(element) { 
                       alert('script present');
                     }
                }
             }, 10);
          }
        },
        
        requires : [ 'fakeobjects' ]

    } );
    
} )();

Add comments >

Please login to post answer.

Page Info
18Impacts
2/1 rate
1711
Your Rating: