403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/cvetdv.ru/bitrix/js/burlakastudio.realcommenter/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/js/burlakastudio.realcommenter/talk_editor_toolbar_buttons.js
'use strict';

if (!window.LHEButtons) {
  window.LHEButtons = {};
}

LHEButtons['Source'] = {
  id: 'Source',
  name: BX.message.Source,
  html: '<html>',
  OnBeforeCreate: function (pLEditor, pBut) {
    if (pLEditor.bBBCode && !pLEditor.arConfig.bConvertContentFromBBCodes) {
      pBut.id = 'SourceBB';
      pBut.name = pBut.title = BX.message.BBSource;
    }
    pBut.title += ': ' + BX.message.Off;
    return pBut;
  },
  handler: function (pBut) {
    var bHtml = pBut.pLEditor.sEditorMode == 'html';
    pBut.pWnd.title = pBut.oBut.name + ': ' + (bHtml ? BX.message.On : BX.message.Off);
    pBut.pLEditor.SetView(bHtml ? 'code' : 'html');
    pBut.Check(bHtml);
  }
};

// BASE
//LHEButtons[ 'Anchor' ] = {
//	id: 'Anchor',
//	name: BX.message.Anchor,
//	bBBHide: true,
//	OnBeforeCreate: function ( pLEditor, pBut ) {
//		if ( pLEditor.bBBCode )
//			return false;
//		return pBut;
//	},
//	handler: function ( pBut ) {
//		pBut.pLEditor.OpenDialog( { id: 'Anchor' } );
//	},
//	parser:
//		{
//			name: "anchor",
//			obj: {
//				Parse: function ( sName, sContent, pLEditor ) {
//					return sContent.replace(
//						/<a(\s[\s\S]*?)(?:>\s*?<\/a)?(?:\/?)?>/ig,
//						function ( sContent ) {
//							if ( sContent.toLowerCase().indexOf( "href" ) > 0 )
//								return sContent;
//
//							var id = pLEditor.SetBxTag( false, { tag: "anchor", params: { value: sContent } } );
//							return '<img id="' + id + '" src="' + pLEditor.oneGif + '" class="bxed-anchor" />';
//						}
//					);
//				},
//				UnParse: false
//			}
//		}
//};
//
LHEButtons['CreateLink'] = {
  id: 'CreateLink',
  name: BX.message.CreateLink,
  html: '&lt;a&gt;',
  name_edit: BX.message.EditLink,
  OnBeforeCreate: function (pLEditor, pBut) {
    // Disable in non BBCode mode in html
    pBut.disableOnCodeView = !pLEditor.bBBCode || pLEditor.arConfig.bConvertContentFromBBCodes;
    return pBut;
  },
  handler: function (pBut) {
    var p = (pBut.arSelectedElement && pBut.arSelectedElement['A']) ? pBut.arSelectedElement['A'] : pBut.pLEditor.GetSelectionObject();
    pBut.pLEditor.OpenDialog({ id: 'Link', obj: p, bCM: !!pBut.menu });
  },
  parser: {
    name: 'a',
    obj: {
      Parse: function (sName, sContent, pLEditor) {
        // Link
        return sContent.replace(
          /(<noindex>)*?<a([\s\S]*?(?:.*?[^\?]{1})??)(>[\s\S]*?<\/a>)(<\/noindex>)*/ig,
          function (str, s0, s1, s2, s3) {
            var arParams = pLEditor.GetAttributesList(s1), i, val, res = '', bPhp = false;
            if (s0 && s3 && s0.toLowerCase().indexOf('noindex') != -1 && s3.toLowerCase().indexOf('noindex') != -1) {
              arParams.noindex = true;
              arParams.rel = 'nofollow';
            }

            res = '<a id="' + pLEditor.SetBxTag(false, { tag: 'a', params: arParams }) + '" ';
            for (i in arParams) {
              if (typeof arParams[i] == 'string' && i != 'id' && i != 'noindex') {
                res += i + '="' + BX.util.htmlspecialchars(arParams[i]) + '" ';
              }
            }
            res += s2;
            return res;
          }
        );
      },
      UnParse: function (bxTag, pNode, pLEditor) {
        if (!bxTag.params)
          return '';

        var i, res = '<a ';

        // Only for BBCodes
        if (pLEditor.bBBCode) {
          var innerHtml = '';
          for (i = 0; i < pNode.arNodes.length; i++)
            innerHtml += pLEditor._RecursiveGetHTML(pNode.arNodes[i]);

          if (BX.util.trim(innerHtml) == BX.util.trim(bxTag.params.href))
            res = '[url]' + bxTag.params.href + '[/url]';
          else
            res = '[url=' + bxTag.params.href + ']' + innerHtml + '[/url]';

          return res;
        }

        bxTag.params['class'] = pNode.arAttributes['class'] || '';
        for (i in bxTag.params)
          if (bxTag.params[i] && i != 'noindex')
            res += i + '="' + BX.util.htmlspecialchars(bxTag.params[i]) + '" ';

        res += '>';

        for (i = 0; i < pNode.arNodes.length; i++)
          res += pLEditor._RecursiveGetHTML(pNode.arNodes[i]);

        res += '</a>';

        if (bxTag.params.noindex)
          res = '<noindex>' + res + '</noindex>';

        return res;
      }
    }
  }
};

LHEButtons['DeleteLink'] = {
  id: 'DeleteLink',
  name: BX.message.DeleteLink,
  cmd: 'Unlink',
  html: '<b><s>&lt;a&gt;</s></b>',
  disableOnCodeView: true,
  handler: function (pBut) {
    var p = (pBut.arSelectedElement && pBut.arSelectedElement['A']) ? pBut.arSelectedElement['A'] : pBut.pLEditor.GetSelectionObject();
    if (p && p.tagName != 'A')
      p = BX.findParent(pBut.pLEditor.GetSelectionObject(), { tagName: 'A' });

    if (BX.browser.IsIE() && !p) {
      var oRange = pBut.pLEditor.GetSelectionRange();
      if (pBut.pLEditor.GetSelectedText(oRange) == '') {
        pBut.pLEditor.InsertHTML('<img id="bx_lhe_temp_bogus_node" src="' + pBut.pLEditor.oneGif + '" _moz_editor_bogus_node="on" style="border: 0px !important;"/>');
        var bogusImg = pBut.pLEditor.pEditorDocument.getElementById('bx_lhe_temp_bogus_node');
        if (bogusImg) {
          p = BX.findParent(bogusImg, { tagName: 'A' });
          bogusImg.parentNode.removeChild(bogusImg);
        }
      }
    }

    if (p) {
      if (!BX.browser.IsIE())
        pBut.pLEditor.SelectElement(p);
      pBut.pLEditor.executeCommand('Unlink');
    }
  }
};

LHEButtons['Bold'] = {
  id: 'Bold',
  name: BX.message.Bold,
  OnBeforeCreate: function (pLEditor, pBut) {
    // Disable in non BBCode mode in html
    pBut.disableOnCodeView = !pLEditor.bBBCode || pLEditor.arConfig.bConvertContentFromBBCodes;
    return pBut;
  },
  html: 'B',
  cmd: 'Bold',
  style: {
    fontWeight: 'bold'
  },
  bbHandler: function (pBut) {
    pBut.pLEditor.FormatBB({ tag: 'B', pBut: pBut });
  }
};

LHEButtons['Italic'] = {
  id: 'Italic',
  name: BX.message.Italic,
  html: 'I',
  cmd: 'Italic',
  style: {
    fontStyle: 'oblique'
  },
  OnBeforeCreate: function (pLEditor, pBut) {
    // Disable in non BBCode mode in html
    pBut.disableOnCodeView = !pLEditor.bBBCode || pLEditor.arConfig.bConvertContentFromBBCodes;
    return pBut;
  },
  bbHandler: function (pBut) {
    pBut.pLEditor.FormatBB({ tag: 'I', pBut: pBut });
  }
};

LHEButtons['RemoveFormat'] = {
  id: 'RemoveFormat',
  name: BX.message.RemoveFormat,
  html: '',
  //cmd : 'RemoveFormat',
  OnBeforeCreate: function (pLEditor, pBut) {
    // Disable in non BBCode mode in html
    pBut.disableOnCodeView = !pLEditor.bBBCode || pLEditor.arConfig.bConvertContentFromBBCodes;
    return pBut;
  },
  handler: function (pBut) {

    pBut.pLEditor.executeCommand('RemoveFormat');

    var
      pElement = pBut.pLEditor.GetSelectionObject(),
      i, arNodes = [];

    if (pElement) {
      var arNodes = BX.findChildren(pElement, { tagName: 'del' }, true);
      if (!arNodes || !arNodes.length)
        arNodes = [];

      var pPar = BX.findParent(pElement, { tagName: 'del' });
      if (pPar)
        arNodes.push(pPar);

      if (pElement.nodeName && pElement.nodeName.toLowerCase() == 'del')
        arNodes.push(pElement);
    }

    if (arNodes && arNodes.length > 0) {
      for (i = 0; i < arNodes.length; i++) {
        arNodes[i].style.textDecoration = '';
        pBut.pLEditor.RidOfNode(arNodes[i], true);
      }
    }
  },
  bbHandler: function (pBut) {
    pBut.pLEditor.RemoveFormatBB();
  }
};

LHEButtons['Quote'] = {
  id: 'Quote',
  name: BX.message.Quote,
  html: '&laquo;...&raquo;',
  OnBeforeCreate: function (pLEditor, pBut) {
    // Disable in non BBCode mode in html
    pBut.disableOnCodeView = !pLEditor.bBBCode || pLEditor.arConfig.bConvertContentFromBBCodes;

    pLEditor.systemCSS += 'blockquote {border-left: 2px dotted #bdbdbd!important; background: #f1f1f1; padding: 9px 4px 8px 24px; color: #6d6d6d!important; margin: 14px 0 10px 15px; font-style: oblique; position: relative; } blockquote:before { content: \'\\201C\'; position: absolute; left: 2px; font-size: 2.3em; color: #bdbdbd; top: 13px; }\n';
    return pBut;
  },
  handler: function (pBut) {
    if (pBut.pLEditor.arConfig.bQuoteFromSelection) {
      var res;
      if (document.selection && document.selection.createRange)
        res = document.selection.createRange().text;
      else if (window.getSelection)
        res = window.getSelection().toString();

      res = BX.util.htmlspecialchars(res);
      res = res.replace(/\n/g, '<br>');

      var strId = '';
      if (!pBut.pLEditor.bBBCode)
        //strId = " id=" + pBut.pLEditor.SetBxTag( false, { tag: "quote" } ) + "\"";

        if (res && res.length > 0)
          return pBut.pLEditor.InsertHTML('<blockquote>' + res + '</blockquote><br>');
    }

    // Catch all blockquotes
    var
      arBQ = pBut.pLEditor.pEditorDocument.getElementsByTagName('blockquote'),
      i, l = arBQ.length;

    // Set specific name to nodes
    for (i = 0; i < l; i++)
      arBQ[i].name = '__bx_temp_quote';

    // Create new qoute
    pBut.pLEditor.executeCommand('Indent');

    // Search for created node and try to adjust new style end id
    setTimeout(function () {
      var
        arNewBQ = pBut.pLEditor.pEditorDocument.getElementsByTagName('blockquote'),
        i, l = arNewBQ.length;

      for (i = 0; i < l; i++) {
        //if ( arBQ[ i ].name == "__bx_temp_quote" ) {
        //	arBQ[ i ].removeAttribute( "name" );
        //} else {
        //	arBQ[ i ].className = "bx-quote";
        //	arBQ[ i ].id = pBut.pLEditor.SetBxTag( false, { tag: "quote" } );
        //}
        //try {
        //	arBQ[ i ].setAttribute( "style", '' );
        //} catch ( e ) {
        //}

        if (!arBQ[i].nextSibling)
          arBQ[i].parentNode.appendChild(BX.create('BR', {}, pBut.pLEditor.pEditorDocument));

        if (arBQ[i].previousSibling && arBQ[i].previousSibling.nodeName && arBQ[i].previousSibling.nodeName.toLowerCase() == 'blockquote')
          arBQ[i].parentNode.insertBefore(BX.create('BR', {}, pBut.pLEditor.pEditorDocument), arBQ[i]);
      }
    }, 10);
  },
  bbHandler: function (pBut) {
    if (pBut.pLEditor.arConfig.bQuoteFromSelection) {
      if (document.selection && document.selection.createRange)
        res = document.selection.createRange().text;
      else if (window.getSelection)
        res = window.getSelection().toString();

      if (res && res.length > 0)
        return pBut.pLEditor.WrapWith('[QUOTE]', '[/QUOTE]', res);
    }

    pBut.pLEditor.FormatBB({ tag: 'QUOTE', pBut: pBut });
  },
  parser: {
    name: 'quote',
    obj: {
      Parse: function (sName, sContent, pLEditor) {
        sContent = sContent.replace(/\[quote\]/ig, '<blockquote>');
        // Add additional <br> after "quote" in the end of the text
        sContent = sContent.replace(/\[\/quote\]$/ig, '</blockquote><br>');
        // Add additional <br> between two quotes
        sContent = sContent.replace(/\[\/quote\](<blockquote)/ig, '</blockquote><br>$1');
        sContent = sContent.replace(/\[\/quote\]/ig, '</blockquote>');

        return sContent;
      },
      UnParse: function (bxTag, pNode, pLEditor) {
        if (bxTag.tag == 'quote') {
          var i, l = pNode.arNodes.length, res = '[QUOTE]';
          for (i = 0; i < l; i++)
            res += pLEditor._RecursiveGetHTML(pNode.arNodes[i]);
          res += '[/QUOTE]';
          return res;
        }
        return '';
      }
    }
  }
};

//CONTEXT MENU
var LHEContMenu = {};
LHEContMenu['A'] = [LHEButtons['CreateLink'], LHEButtons['DeleteLink']];
LHEContMenu['IMG'] = [LHEButtons['Image']];
LHEContMenu['VIDEO'] = [LHEButtons['Video']];



Youez - 2016 - github.com/yon3zu
LinuXploit