Add winery source code
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.repository / src / main / webapp / jsp / setupTriggerRemoveByDELKey.jsp
1 <%--
2 /*******************************************************************************
3  * Copyright (c) 2012-2013 University of Stuttgart.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and the Apache License 2.0 which both accompany this distribution,
7  * and are available at http://www.eclipse.org/legal/epl-v10.html
8  * and http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Contributors:
11  *    Oliver Kopp - initial API and implementation and/or initial documentation
12  *******************************************************************************/
13 --%>
14 <%--
15 JavaScript snippet binding the delete button to a trigger of the "Remove" button in case there is only one such button and that no input field is selected
16 --%>
17
18         var removeButtons = $("button:contains('Remove')");
19         if (removeButtons.length == 1) {
20                 requirejs(["keyboardjs"], function(KeyboardJS) {
21                         KeyboardJS.on("del", function() {
22                                 if ($(document.activeElement).is("body")) {
23                                         // we are not in an input field etc.
24                                         removeButtons.trigger("click");
25                                 }
26                         });
27                 });
28         }