text: /* eslint-disable linebreak-style */
  /* eslint-disable no-unused-vars */
  /* eslint-disable no-undef */
  
  function insertAtCursor(myField, myValue) {
      var textTop = myField.scrollTop;
      var documentTop = document.documentElement.scrollTop;
  
      //IE 浏览器
      if (document.selection) {
          myField.focus();
          var sel = document.selection.createRange();
          sel.text = myValue;
          sel.select();
      }
  
      //FireFox、Chrome等
      else if (myField.selectionStart || myField.selectionStart == '0') {
          var startPos = myField.selectionStart;
          var endPos = myField.selectionEnd;
          myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos, myField.value.length);
          myField.focus();
          myField.selectionStart = startPos + myValue.length;
          myField.selectionEnd = startPos + myValue.length;
      } else {
          myField.value += myValue;
          myField.focus();
      }
  
      myField.scrollTop = textTop;
      document.documentElement.scrollTop=documentTop;
  }
  
  $(function() {
      if($('#wmd-button-row').length>0){
          $('#wmd-button-row').append('<li class="wmd-spacer wmd-spacer1"></li><li class="wmd-button" id="wmd-photoset-button" style="" title="插入图集">图集</li>');
          $('#wmd-button-row').append('<li class="wmd-spacer wmd-spacer1"></li><li class="wmd-button" id="wmd-owo-button" style="" title="插入表情"><span style="width:unset" class="OwO"></span></li>');
          new OwO({
              logo: 'OωO',
              container: document.getElementsByClassName('OwO')[0],
              target: document.getElementById('text'),
              api: '/usr/themes/VOID/assets/libs/owo/OwO_02.json',
              position: 'down',
              width: '400px',
              maxHeight: '250px'
          });
      }
      $(document).on('click','#wmd-photoset-button',function() {
          myField = document.getElementById('text');
          insertAtCursor(myField, '\n\n[photos]\n\n[/photos]\n\n');
      });
  });
  