Dayana MIX
Вы хотите отреагировать на этот пост ? Создайте аккаунт всего в несколько кликов или войдите на форум.
Код нашего баннера



Последние темы
» Лирические стихи.
Вставка изображения с маршрутной ссылкой EmptyВт 29 Мар - 7:21 автор Nataliya

» Шаман......
Вставка изображения с маршрутной ссылкой EmptyВт 29 Мар - 7:19 автор Nataliya

» [Салаты] Пять ошибок при приготовлении оливье
Вставка изображения с маршрутной ссылкой EmptyСр 26 Янв - 13:20 автор Scheila

»  Наша Беседка.. :)
Вставка изображения с маршрутной ссылкой EmptyСб 18 Дек - 13:17 автор Феникс

» Супы из рыбы и морепродуктов
Вставка изображения с маршрутной ссылкой EmptyВт 14 Дек - 22:26 автор Scheila

» Другие закуски
Вставка изображения с маршрутной ссылкой EmptyВт 14 Дек - 22:25 автор Scheila

» Теперь мы есть в Telegram
Вставка изображения с маршрутной ссылкой EmptyЧт 26 Авг - 7:59 автор Феникс

» мои клипы.
Вставка изображения с маршрутной ссылкой EmptyСр 4 Авг - 20:55 автор Nataliya

» МОМЕНТЫ ЖИЗНИ
Вставка изображения с маршрутной ссылкой EmptyСр 4 Авг - 20:44 автор Nataliya

Любимые темы
Загрузка избранного...


Предыдущая тема Следующая тема Перейти вниз

  • 1

Вставка изображения с маршрутной ссылкой

Сообщение автор  Сб 24 Дек - 21:43

Почти каждый хостинг предлагает готовую ссылку, но может и пригодится кому. Smile

Код:
$(function() {
    $(function() {
        $('.sceditor-button-image').after('<a title="Вставка изображения" class="sceditor-button sceditor-button-imganc"><div style="background:url(http://i39.servimg.com/u/f39/18/21/41/30/imganc10.png);"></div></a>');
        $('.sceditor-button-imganc').click(function() {
            if ($('.sceditor-insertimganc').length) return $('.sceditor-insertimganc').remove();
            $('body').append('<div class="sceditor-dropdown sceditor-insertimganc" style="position:absolute;"><div><label>Ссылка на изображение</label> <input id="imganc-img" class="url" placeholder="http://" type="text"></div><div><label>Маршрутная ссылка</label> <input id="imganc-url" class="url" placeholder="http://" type="text"></div><div><label>Ширина (необязательное поле)</label> <input id="imganc-width" size="2" type="text"></div><div><label>Высота (необязательное поле)</label> <input id="imganc-height" size="2" type="text"></div><div><input id="submit-imganc" class="button" value="Вставка" type="button"></div></div>');
            $('.sceditor-insertimganc').css({
                'left': $('.sceditor-button-imganc').offset().left + 'px',
                'top': $('.sceditor-button-imganc').offset().top + 25 + 'px'
            });
            $('#submit-imganc').click(function() {
                var dimension = '',
                    width = $('#imganc-width').val(),
                    height = $('#imganc-height').val(),
                    image = $('#imganc-img').val(),
                    url = $('#imganc-url').val();
                if (width.length > 0 && height.length > 0) dimension = '(' + width + 'px,' + height + 'px)';
                else if (width.length > 0 && height.length < 1) dimension = '(' + width + 'px,' + width + 'px)';
                else if (width.length < 1 && height.length > 0) dimension = '(' + height + 'px,' + height + 'px)';
                if (image.length > 0 && url.length > 0) $('#text_editor_textarea').sceditor('instance').insertText('[url=' + url + '][img' + dimension + ']' + image, '[/img][/url]');
                $('.sceditor-insertimganc').remove();
                return false
            })
        });
        $('.sceditor-button-source').click(function() {
            $('.sceditor-button-imganc').removeClass('disabled')
        });
        $('.sceditor-button').not('.sceditor-button-imganc').click(function() {
            $('.sceditor-insertimganc').remove()
        });
        $('.sceditor-container textarea').focus(function() {
            $('.sceditor-insertimganc').remove()
        });
        $('.sceditor-container i-frame').contents().mousedown(function() {
            $('.sceditor-insertimganc').remove()
        })
    })
});


Результат :
Вставка изображения с маршрутной ссылкой GtzO3z
Феникс
Феникс
Администратор


Мужчина Посты : 1598
Очки : 6378
Возраст : 52
Откуда : Россошь

Вернуться к началу Перейти вниз

Вставка изображения с маршрутной ссылкой Sdsd1110
  • 2

Re: Вставка изображения с маршрутной ссылкой

Сообщение автор  Пт 5 Фев - 16:22

список команд


Код:
$(function() {
  if (!$.sceditor) return;
 
  $.sceditor.command.set('cmd', {
 
  dropDown : function(editor, caller, callback) {
 
    // Добавьте ниже метки, которые станут частью вашей команды, разделяя их запятыми
 
    var items = ['sucesso', 'alerta', 'info', 'visitante', 'aviso'];
 
    var content = $(
    '<div>' +
    '  <div>' +
    '    <label>Выберите тег</label>' +
    '    <select></select>' +
    '  </div>' +
    '  <div>' +
    '    <label>Заголовок (необязательно)</label>' +
    '    <input type="text" id="cmdValue" value="" />' +
    '  </div>' +
    '  <div>' +
    '    <input type="button" class="button" value="Вставить">' +
    '  </div>' +
    '</div>'
    );
            $.each(items, function(key, val) {
                  content.find('select').append('<option class="sceditor-cmd-option" value="' + val + '">' + val + '</option>');
            });
            content.find('.button').click(function(e) {
                callback(content.find('select').val());
                editor.closeDropDown(true);
            });
            editor.createDropDown(caller, "cmd", content);
  },
  // РЕЖИМ WYSIWYG
  exec : function(caller) {
  var editor = this;
      $.sceditor.command.get('cmd').dropDown(editor, caller, function(cmd) {
        var before = '[' + cmd + ']', end = '[/' + cmd + ']', title = $('#cmdValue').val();
        if(title !== '') {
            before = '[' + cmd + '="' + title + '"]';
            editor.wysiwygEditorInsertHtml(before, end);
        }
      });
  },
  // РЕЖИМ ИСТОЧНИКА
  txtExec : function(caller) {
  var editor = this;
      $.sceditor.command.get('cmd').dropDown(editor, caller, function(cmd) {
        var title = $('#cmdValue').val();
        if(title) {
            editor.insertText('[' + cmd + '="' + title + '"]','[/' + cmd + ']');
        } else {
            editor.insertText('[' + cmd + ']','[/' + cmd + ']');
        }
      });
  }, tooltip: "Список команд"});
 
  toolbar = toolbar.replace(/quote/,'cmd,quote');
 
  $('head').append(
  '<style type="text/css">' +
  '.sceditor-button-cmd div {' +
  '  background:url(https://cdn2.iconfinder.com/data/icons/snipicons/500/th-list-16.png) !important}' +
  '  .sceditor-cmd {' +
  '  width:auto;' +
  '  height:auto;' +
  '  overflow-y:auto;' +
  '}' +
  '.sceditor-cmd select {' +
  '  margin: 0 0 .75em;' +
  '}' +
  '</style>'
  );
});
Феникс
Феникс
Администратор


Мужчина Посты : 1598
Очки : 6378
Возраст : 52
Откуда : Россошь

Вернуться к началу Перейти вниз

Вставка изображения с маршрутной ссылкой Sdsd1110

Предыдущая тема Следующая тема Вернуться к началу

- Похожие темы


Коды ссылок на тему для вставки:
URL:
BBCode:
HTML:
 
Права доступа к этому форуму:
Вы не можете отвечать на сообщения