From 2e2efec5e78425d34599191eb81fac3da15016df Mon Sep 17 00:00:00 2001 From: wvengen Date: Mon, 25 Apr 2016 20:25:49 +0200 Subject: [PATCH] Get rid of coffeescript. --- Gemfile | 1 - Gemfile.lock | 1 - .../{bootstrap.js.coffee => bootstrap.js} | 3 +- vendor/assets/javascripts/touchclick.js | 4 ++ .../assets/javascripts/touchclick.js.coffee | 72 ------------------- 5 files changed, 6 insertions(+), 75 deletions(-) rename app/assets/javascripts/{bootstrap.js.coffee => bootstrap.js} (83%) create mode 100644 vendor/assets/javascripts/touchclick.js delete mode 100644 vendor/assets/javascripts/touchclick.js.coffee diff --git a/Gemfile b/Gemfile index 05ccdd2c..f398f4c5 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,6 @@ gem "rails", '~> 4.2' gem 'sass-rails' -gem 'coffee-rails' gem 'less-rails' gem 'uglifier', '>= 1.0.3' # See https://github.com/sstephenson/execjs#readme for more supported runtimes diff --git a/Gemfile.lock b/Gemfile.lock index c5867c1b..d8053ccb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -477,7 +477,6 @@ DEPENDENCIES capistrano-rails capistrano-rvm capybara - coffee-rails connection_pool coveralls daemons diff --git a/app/assets/javascripts/bootstrap.js.coffee b/app/assets/javascripts/bootstrap.js similarity index 83% rename from app/assets/javascripts/bootstrap.js.coffee rename to app/assets/javascripts/bootstrap.js index 94406798..680605d9 100644 --- a/app/assets/javascripts/bootstrap.js.coffee +++ b/app/assets/javascripts/bootstrap.js @@ -1,3 +1,4 @@ -jQuery -> +$(function() { $("a[rel~=popover], .has-popover").popover() $("a[rel~=tooltip], .has-tooltip").tooltip() +}); diff --git a/vendor/assets/javascripts/touchclick.js b/vendor/assets/javascripts/touchclick.js new file mode 100644 index 00000000..ee7048d6 --- /dev/null +++ b/vendor/assets/javascripts/touchclick.js @@ -0,0 +1,4 @@ +!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;gc&&a.type.match("mouse")},h=function(a){var b,c;return b=d(a),c=b.closest('*[data-touchclick="true"]'),c.length?c:b},p=function(a){return m=g(a),i(a)?void 0:h(a.target).addClass(e)},o=function(a){var b;return b=g(a),!b||Math.abs(b.x-m.x)>k||Math.abs(b.y-m.y)>k?h(a.target).removeClass(e):void 0},n=function(a){var b;return b=h(a.target),b.hasClass(e)&&!i(a)?(a.type="touchclick",b.trigger(a).removeClass(e)):void 0},f=function(a){var b;return b=d(this),l&&b[a]("click",function(a){return a.preventDefault()}),window.navigator.pointerEnabled?(b[a]("pointerdown",p),b[a]("pointerup",n)):(b[a]("touchstart mousedown",p),b[a]("touchmove mouseout",o),b[a]("touchend mouseup",n))},d.event.special.touchclick={setup:function(){return f.call(this,"on")},teardown:function(){return f.call(this,"off")}}},{jquery:1}]},{},[2]); \ No newline at end of file diff --git a/vendor/assets/javascripts/touchclick.js.coffee b/vendor/assets/javascripts/touchclick.js.coffee deleted file mode 100644 index fa96fbea..00000000 --- a/vendor/assets/javascripts/touchclick.js.coffee +++ /dev/null @@ -1,72 +0,0 @@ -###! -Copyright (c) 2013 Derek Petersen https://github.com/tuxracer/touchclick MIT License -https://github.com/tuxracer/touchclick/raw/3.1.0/src/touchclick.coffee -### - -$ = if typeof jQuery is 'function' then jQuery else require 'jquery' - -activeClass = 'touchactive' -preventDefaultClick = false - -# Store a timestamp of when the last touch event occurred -lastTouched = 0 - -# Support devices with both touch and mouse (e.g. Windows 8, Chromebook Pixel) -ignoreEvent = (e) -> - currentTimestamp = Math.round (new Date()).getTime() / 1000 - secondsSinceTouch = currentTimestamp - lastTouched - - if e.type.match 'touchstart|touchmove|touchend' - lastTouched = currentTimestamp - - secondsSinceTouch < 3 and e.type.match 'mouse' - -getTouchclickEl = (target) -> - $targetEl = $ target - # For delegated events you can optionally provide an element - # that will have the active style added when touch is active - # by adding data-touchclick="true" - $touchclickEl = $targetEl.closest '*[data-touchclick="true"]' - - if $touchclickEl.length - $touchclickEl - else - $targetEl - -touchstart = (e) -> - getTouchclickEl(e.target).addClass(activeClass) unless ignoreEvent e - -touchmove = (e) -> - getTouchclickEl(e.target).removeClass(activeClass) - -touchend = (e) -> - $touchclickEl = getTouchclickEl e.target - - if $touchclickEl.hasClass(activeClass) and not ignoreEvent e - e.type = 'touchclick' - - $touchclickEl - .trigger(e) - .removeClass(activeClass) - -events = (type) -> - $el = $ this - - if preventDefaultClick - $el[type] 'click', (e) -> - e.preventDefault() - - if window.navigator.pointerEnabled - $el[type] 'pointerdown', touchstart - $el[type] 'pointerup', touchend - else - $el[type] 'touchstart mousedown', touchstart - $el[type] 'touchmove mouseout', touchmove - $el[type] 'touchend mouseup', touchend - -$.event.special.touchclick = - setup: -> - events.call this, 'on' - - teardown: -> - events.call this, 'off'