Sha256: 777840ece03acd3230e7fbd218c40b7f9b1c3cea9926b743bbaece8cf06599d9
Contents?: true
Size: 1.26 KB
Versions: 49
Compression:
Stored size: 1.26 KB
Contents
if (!RedactorPlugins) var RedactorPlugins = {}; (function($) { RedactorPlugins.definedlinks = function() { return { init: function() { if (!this.opts.definedLinks) return; this.modal.addCallback('link', $.proxy(this.definedlinks.load, this)); }, load: function() { var $select = $('<select id="redactor-defined-links" />'); $('#redactor-modal-link-insert').prepend($select); this.definedlinks.storage = {}; $.getJSON(this.opts.definedLinks, $.proxy(function(data) { $.each(data, $.proxy(function(key, val) { this.definedlinks.storage[key] = val; $select.append($('<option>').val(key).html(val.name)); }, this)); $select.on('change', $.proxy(this.definedlinks.select, this)); }, this)); }, select: function(e) { var key = $(e.target).val(); var name = '', url = ''; if (key !== 0) { name = this.definedlinks.storage[key].name; url = this.definedlinks.storage[key].url; } $('#redactor-link-url').val(url); var $el = $('#redactor-link-url-text'); if ($el.val() === '') $el.val(name); } }; }; })(jQuery);
Version data entries
49 entries across 49 versions & 8 rubygems