diff --git a/assets/plugins/counter/counter.js b/assets/plugins/counter/counter.js index dd1da79..391c19e 100644 --- a/assets/plugins/counter/counter.js +++ b/assets/plugins/counter/counter.js @@ -1,41 +1,44 @@ if (!RedactorPlugins) var RedactorPlugins = {}; -RedactorPlugins.counter = function() +(function($) { - return { - init: function() - { - if (!this.opts.counterCallback) return; - - this.$editor.on('keyup.redactor-limiter', $.proxy(function(e) + RedactorPlugins.counter = function() + { + return { + init: function() { - var words = 0, characters = 0, spaces = 0; + if (!this.opts.counterCallback) return; + + this.$editor.on('keyup.redactor-limiter', $.proxy(function(e) + { + var words = 0, characters = 0, spaces = 0; - var html = this.code.get(); + var html = this.code.get(); - var text = html.replace(/<\/(.*?)>/gi, ' '); - text = text.replace(/<(.*?)>/gi, ''); - text = text.replace(/\t/gi, ''); - text = text.replace(/\n/gi, ''); - text = text.replace(/\r/gi, ''); - text = $.trim(text); + var text = html.replace(/<\/(.*?)>/gi, ' '); + text = text.replace(/<(.*?)>/gi, ''); + text = text.replace(/\t/gi, ''); + text = text.replace(/\n/gi, ''); + text = text.replace(/\r/gi, ''); + text = $.trim(text); - if (text !== '') - { - var arrWords = text.split(/\s+/); - var arrSpaces = text.match(/\s/g); + if (text !== '') + { + var arrWords = text.split(/\s+/); + var arrSpaces = text.match(/\s/g); - if (arrWords) words = arrWords.length; - if (arrSpaces) spaces = arrSpaces.length; + if (arrWords) words = arrWords.length; + if (arrSpaces) spaces = arrSpaces.length; - characters = text.length; + characters = text.length; - } + } - this.core.setCallback('counter', { words: words, characters: characters, spaces: spaces }); + this.core.setCallback('counter', { words: words, characters: characters, spaces: spaces }); - }, this)); - } + }, this)); + } + }; }; -}; +})(jQuery); \ No newline at end of file diff --git a/assets/plugins/definedlinks/definedlinks.js b/assets/plugins/definedlinks/definedlinks.js index afb001a..962a95d 100644 --- a/assets/plugins/definedlinks/definedlinks.js +++ b/assets/plugins/definedlinks/definedlinks.js @@ -1,50 +1,53 @@ if (!RedactorPlugins) var RedactorPlugins = {}; -RedactorPlugins.definedlinks = function() +(function($) { - return { - init: function() - { - if (!this.opts.definedLinks) return; + RedactorPlugins.definedlinks = function() + { + return { + init: function() + { + if (!this.opts.definedLinks) return; - this.modal.addCallback('link', $.proxy(this.definedlinks.load, this)); + this.modal.addCallback('link', $.proxy(this.definedlinks.load, this)); - }, - load: function() - { - var $select = $(''); + $('#redactor-modal-link-insert').prepend($select); - this.definedlinks.storage = {}; + this.definedlinks.storage = {}; - $.getJSON(this.opts.definedLinks, $.proxy(function(data) - { - $.each(data, $.proxy(function(key, val) + $.getJSON(this.opts.definedLinks, $.proxy(function(data) { - this.definedlinks.storage[key] = val; - $select.append($('