diff options
-rw-r--r-- | Gemfile | 1 | ||||
-rw-r--r-- | Gemfile.lock | 3 | ||||
-rw-r--r-- | app/assets/javascripts/app/views/publisher_view.js | 2 | ||||
-rw-r--r-- | config/application.rb | 2 | ||||
-rw-r--r-- | vendor/assets/javascripts/jquery.textchange.js | 76 |
5 files changed, 6 insertions, 78 deletions
@@ -86,6 +86,7 @@ gem 'rails-assets-punycode', '1.3.1' # jQuery plugins +gem 'rails-assets-jquery-textchange', '0.2.3' gem 'rails-assets-perfect-scrollbar', '0.4.11' # Localization diff --git a/Gemfile.lock b/Gemfile.lock index cdfcbb3fd..b26e349bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -357,6 +357,8 @@ GEM railties (= 4.1.6) sprockets-rails (~> 2.0) rails-assets-jquery (1.11.1) + rails-assets-jquery-textchange (0.2.3) + rails-assets-jquery rails-assets-perfect-scrollbar (0.4.11) rails-assets-jquery (>= 1.10) rails-assets-punycode (1.3.1) @@ -574,6 +576,7 @@ DEPENDENCIES rack-ssl (= 1.4.1) rails (= 4.1.6) rails-assets-jquery (= 1.11.1) + rails-assets-jquery-textchange (= 0.2.3) rails-assets-perfect-scrollbar (= 0.4.11) rails-assets-punycode (= 1.3.1) rails-i18n (= 4.0.3) diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js index 876ad8339..2f20a3b44 100644 --- a/app/assets/javascripts/app/views/publisher_view.js +++ b/app/assets/javascripts/app/views/publisher_view.js @@ -8,7 +8,7 @@ //= require ./publisher/aspect_selector_blueprint_view //= require ./publisher/getting_started_view //= require ./publisher/uploader_view -//= require jquery.textchange +//= require jquery-textchange app.views.Publisher = Backbone.View.extend({ diff --git a/config/application.rb b/config/application.rb index a54bdeb32..f9c14f113 100644 --- a/config/application.rb +++ b/config/application.rb @@ -57,7 +57,7 @@ module Diaspora inbox.js jquery.js jquery_ujs.js - jquery.textchange.js + jquery-textchange.js mailchimp.js main.js mobile.js diff --git a/vendor/assets/javascripts/jquery.textchange.js b/vendor/assets/javascripts/jquery.textchange.js deleted file mode 100644 index 3affea18e..000000000 --- a/vendor/assets/javascripts/jquery.textchange.js +++ /dev/null @@ -1,76 +0,0 @@ -/*! - * jQuery TextChange Plugin - * http://www.zurb.com/playground/jquery-text-change-custom-event - * - * Copyright 2010, ZURB - * Released under the MIT License - */ -(function ($) { - - $.event.special.textchange = { - - setup: function (data, namespaces) { - $(this).data('lastValue', this.contentEditable === 'true' ? $(this).html() : $(this).val()); - $(this).bind('keyup.textchange', $.event.special.textchange.handler); - $(this).bind('cut.textchange paste.textchange input.textchange', $.event.special.textchange.delayedHandler); - }, - - teardown: function (namespaces) { - $(this).unbind('.textchange'); - }, - - handler: function (event) { - $.event.special.textchange.triggerIfChanged($(this)); - }, - - delayedHandler: function (event) { - var element = $(this); - setTimeout(function () { - $.event.special.textchange.triggerIfChanged(element); - }, 25); - }, - - triggerIfChanged: function (element) { - var current = element[0].contentEditable === 'true' ? element.html() : element.val(); - if (current !== element.data('lastValue')) { - element.trigger('textchange', [element.data('lastValue')]); - element.data('lastValue', current); - } - } - }; - - $.event.special.hastext = { - - setup: function (data, namespaces) { - $(this).bind('textchange', $.event.special.hastext.handler); - }, - - teardown: function (namespaces) { - $(this).unbind('textchange', $.event.special.hastext.handler); - }, - - handler: function (event, lastValue) { - if ((lastValue === '') && lastValue !== $(this).val()) { - $(this).trigger('hastext'); - } - } - }; - - $.event.special.notext = { - - setup: function (data, namespaces) { - $(this).bind('textchange', $.event.special.notext.handler); - }, - - teardown: function (namespaces) { - $(this).unbind('textchange', $.event.special.notext.handler); - }, - - handler: function (event, lastValue) { - if ($(this).val() === '' && $(this).val() !== lastValue) { - $(this).trigger('notext'); - } - } - }; - -})(jQuery);
\ No newline at end of file |