From 6c55b20e80ace277e827be06bd3b9d4b088e7b21 Mon Sep 17 00:00:00 2001 From: Jens Ulferts Date: Mon, 29 Aug 2016 12:18:43 +0200 Subject: [PATCH] replace prototype leftovers --- app/assets/javascripts/application.js.erb | 16 ++++++++-------- frontend/app/ui_components/expandable-search.js | 2 +- lib/redmine/wiki_formatting/textile/helper.rb | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/application.js.erb b/app/assets/javascripts/application.js.erb index dfad429073..d86a8e5478 100644 --- a/app/assets/javascripts/application.js.erb +++ b/app/assets/javascripts/application.js.erb @@ -156,10 +156,10 @@ var fileFieldCount = 1; function addFileField() { fileFieldCount++; if (fileFieldCount >= 10) return false; - var clone = $('attachment_template').cloneNode(true); - clone.writeAttribute('id', ''); - clone.innerHTML = clone.innerHTML.replace(/\[1\]/g, '['+ fileFieldCount + ']'); - jQuery('#attachments_fields')[0].appendChild(clone); + var clone = jQuery('#attachment_template').clone(true); + clone.removeAttr('id'); + clone.html(clone.html().replace(/\[1\]/g, '['+ fileFieldCount + ']')); + jQuery('#attachments_fields').append(clone); } function randomKey(size) { @@ -177,7 +177,7 @@ var projectIdentifierDefault; var projectIdentifierMaxLength; function generateProjectIdentifier() { - var identifier = $('project_name').getValue(); // project name + var identifier = jQuery('#project_name').val(); // project name var diacriticsMap = [ {'base':'a', 'letters':/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g}, {'base':'aa','letters':/[\uA733\uA732]/g}, @@ -300,12 +300,12 @@ jQuery(hideOnLoad); function addClickEventToAllErrorMessages() { jQuery('a.afocus').each(function() { - var target = $(this); + var target = jQuery(this); target.click(function(evt) { - var field = $(target.readAttribute('href').substr(1)); + var field = jQuery('#' + target.readAttribute('href').substr(1)); if (field === null) { // Cut off '_id' (necessary for select boxes) - field = $(target.readAttribute('href').substr(1).concat('_id')); + field = jQuery('#' + target.readAttribute('href').substr(1).concat('_id')); } if (field) { field.down('input, textarea, select').focus(); diff --git a/frontend/app/ui_components/expandable-search.js b/frontend/app/ui_components/expandable-search.js index a5b8ca9316..f63ebada80 100644 --- a/frontend/app/ui_components/expandable-search.js +++ b/frontend/app/ui_components/expandable-search.js @@ -60,7 +60,7 @@ module.exports = function(ENTER_KEY) { // Hide unless icon clicked if (elem.find(':active,:focus').length === 0) { setCollapsed(true); - $(elem).off('focusout'); + elem.off('focusout'); } }, 10); }); diff --git a/lib/redmine/wiki_formatting/textile/helper.rb b/lib/redmine/wiki_formatting/textile/helper.rb index 00420fee01..353937fe08 100644 --- a/lib/redmine/wiki_formatting/textile/helper.rb +++ b/lib/redmine/wiki_formatting/textile/helper.rb @@ -45,7 +45,7 @@ module Redmine title: ::I18n.t('js.inplace.link_formatting_help') javascript_tag(<<-EOF) - var wikiToolbar = new jsToolBar($('#{field_id}')); + var wikiToolbar = new jsToolBar(document.getElementById('#{field_id}')); wikiToolbar.setHelpLink(jQuery('#{escape_javascript help_button}')[0]); // initialize the toolbar later, so that i18n-js has a chance to set the translations // for the wiki-buttons first.