From b23d05eeaca3cf9563e505c8f4fbf657fdcb5299 Mon Sep 17 00:00:00 2001 From: jpl Date: Mon, 27 Mar 2017 12:12:13 +0200 Subject: Refs #2813: fixing js listener for IE --- app/assets/javascripts/forms.coffee | 32 ++++++------ app/assets/javascripts/main_menu.coffee | 92 ++++++++++++++++----------------- 2 files changed, 61 insertions(+), 63 deletions(-) (limited to 'app/assets/javascripts') diff --git a/app/assets/javascripts/forms.coffee b/app/assets/javascripts/forms.coffee index 33da921b6..d350d4745 100644 --- a/app/assets/javascripts/forms.coffee +++ b/app/assets/javascripts/forms.coffee @@ -17,23 +17,21 @@ else labelCont.text(labelCont.data('checkedvalue')) -# @submitMover = -> -# if $('.page-action').children('.formSubmitr').length > 0 -# $('.page-action').children('.formSubmitr').remove() -# -# $('.formSubmitr').appendTo('.page-action') -# -# # IE fix -# isIE = false || !!document.documentMode -# isEdge = !isIE && !!window.StyleMedia -# -# if isIE || isEdge -# $('.formSubmitr').each -> -# target = $(this).attr('form') -# -# $(this).on 'click', -> -# $('#' + target).submit() +@submitMover = -> + if $('.page-action').children('.formSubmitr').length > 0 + $('.page-action').children('.formSubmitr').remove() + + $('.formSubmitr').appendTo('.page-action') + + # IE fix + isIE = false || !!document.documentMode + isEdge = !isIE && !!window.StyleMedia + + if isIE || isEdge + $(document).on 'click', '.formSubmitr', -> + target = $(this).attr('form') + $('#' + target).submit() $(document).on 'ready page:load', togglableFilter -# $(document).on 'ready page:load', submitMover +$(document).on 'ready page:load', submitMover $(document).on 'ready page:load', switchInput diff --git a/app/assets/javascripts/main_menu.coffee b/app/assets/javascripts/main_menu.coffee index 6f882e92c..dee846ffb 100644 --- a/app/assets/javascripts/main_menu.coffee +++ b/app/assets/javascripts/main_menu.coffee @@ -1,46 +1,46 @@ -# $(document).on 'ready page:load', -> -# -# link = [] -# $(document).on 'page:before-change', -> -# link = [] -# -# $el = $('#main_nav') -# # Opening/closing left-side menu -# $el.find('.openMenu').on 'click', (e) -> -# $(this).parent().addClass 'open' -# -# $el.find('.closeMenu').on 'click', (e) -> -# $(this).closest('.nav-menu').removeClass 'open' -# -# # Opening menu panel according to current url -# selectedItem = $el.find('.active') -# selectedItem.closest('.panel-collapse').addClass 'in' -# selectedItem.closest('.panel-title').children('a').attr('aria-expanded') == true -# -# -# data = $('.page-action .small')[0].innerHTML -# -# stickyContent = '