/*
    IndaJava: plugin to ie enjine 
*/
(function () {
    'use strict';

    CKEDITOR.plugins.add('pastebase64ie',
    {
    init: function (editor) {

         function replaceImgText(html) {
             if (/<img[^>]*src="data:image\/(bmp|dds|gif|jpg|jpeg|png|psd|pspimage|tga|thm|tif|tiff|yuv|ai|eps|ps|svg);base64,.*?"[^>]*>/gi.test(html)) {
                 $(html).find("img:first").attr("src");
                 return html.replace(' src=', ' class="forum-inline-message" style="max-height:300px; max-width:400px;" src=');
             } else
                 return html;
         }

         editor.on('paste', function (e) {

             var html = e.data.dataValue;
             if (!html)
                 return;

             e.data.dataValue = replaceImgText(html);
         });

     } //Init
 });
})();
