You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by sv...@apache.org on 2019/05/09 06:32:56 UTC
[wicket] 03/11: JS removed Wicket.Browser.isGecko()
This is an automated email from the ASF dual-hosted git repository.
svenmeier pushed a commit to branch wicket-js-cleanup
in repository https://gitbox.apache.org/repos/asf/wicket.git
commit 454afca7cd42c178a4d2b360051d5a3b21a0b260
Author: Sven Meier <sv...@apache.org>
AuthorDate: Mon May 6 14:35:55 2019 +0200
JS removed Wicket.Browser.isGecko()
was used in modal.js only; changed example to use autocomplete instead
of LocalDateTimeField, because the latter doesn't contribute JS any more
since switch to LocalDate
---
.../wicket/ajax/res/js/wicket-ajax-jquery.js | 19 -----------------
.../ajax/builtin/modal/ModalContent1Page.html | 4 ----
.../ajax/builtin/modal/ModalContent1Page.java | 2 --
.../examples/ajax/builtin/modal/ModalPanel1.html | 2 +-
.../examples/ajax/builtin/modal/ModalPanel1.java | 20 ++++++++++++++++--
.../extensions/ajax/markup/html/modal/res/modal.js | 24 ++++------------------
6 files changed, 23 insertions(+), 48 deletions(-)
diff --git a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
index 3b631bd..79337d9 100644
--- a/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
+++ b/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js
@@ -829,11 +829,6 @@
}
calculatedRedirect += "/" + redirectUrl;
- if (Wicket.Browser.isGecko()) {
- // firefox 3 has problem with window.location setting relative url
- calculatedRedirect = window.location.protocol + "//" + window.location.host + calculatedRedirect;
- }
-
context.isRedirecting = true;
Wicket.Ajax.redirect(calculatedRedirect);
}
@@ -2067,9 +2062,6 @@
onScriptReady();
}
};
- } else if (Wicket.Browser.isGecko()) {
- // Firefox doesn't react on the checks above but still supports 'onload'
- scriptDomNode.onload = onScriptReady;
} else {
// as a final resort notify after the current function execution
window.setTimeout(onScriptReady, 10);
@@ -2551,15 +2543,6 @@
wb._isIE11 = isTrident && is11;
}
return wb._isIE11;
- },
-
- _isGecko: null,
- isGecko: function () {
- var wb = Wicket.Browser;
- if (wb._isGecko === null) {
- wb._isGecko = (/Gecko/).test(window.navigator.userAgent) && !Wicket.Browser.isSafari();
- }
- return wb._isGecko;
}
},
@@ -2611,7 +2594,6 @@
},
fire: function (element, event) {
- event = (event === 'mousewheel' && Wicket.Browser.isGecko()) ? 'DOMMouseScroll' : event;
jQuery(element).trigger(event);
},
@@ -2638,7 +2620,6 @@
jQuery(fn);
});
} else {
- type = (type === 'mousewheel' && Wicket.Browser.isGecko()) ? 'DOMMouseScroll' : type;
var el = element;
if (typeof(element) === 'string') {
el = document.getElementById(element);
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html
index 528940e..d8b4dc5 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html
@@ -20,9 +20,5 @@
<div wicket:id="modal"></div>
<a wicket:id="open">Open another modal dialog</a>
</p>
- <p>
- <div>An example of a component that uses header contributions</div>
- <div wicket:id="dateTimeField" />
- </p>
</body>
</html>
\ No newline at end of file
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java
index 94ba192..5cf8277 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java
@@ -65,8 +65,6 @@ public class ModalContent1Page extends WebPage
}
});
- add(new LocalDateTimeField("dateTimeField"));
-
final ModalWindow modal;
add(modal = new ModalWindow("modal"));
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.html
index ecaee62..6ae319e 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.html
@@ -3,7 +3,7 @@
<div style="margin: 1em">
This is panel content!
<p>
- Date text field to demonstrate AJAX header contribution <span wicket:id="dateTimeField"></span>
+ Ajax autocomplete to demonstrate AJAX header contribution -> <input wicket:id="edit" />
</p>
</div>
</wicket:panel>
\ No newline at end of file
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java
index 884077c..ba23e97 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalPanel1.java
@@ -16,8 +16,13 @@
*/
package org.apache.wicket.examples.ajax.builtin.modal;
-import org.apache.wicket.extensions.markup.html.form.datetime.LocalDateTimeField;
+import java.util.Arrays;
+import java.util.Iterator;
+
+import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteSettings;
+import org.apache.wicket.extensions.ajax.markup.html.autocomplete.AutoCompleteTextField;
import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.Model;
/**
* @author Matej Knopp
@@ -32,6 +37,17 @@ public class ModalPanel1 extends Panel
public ModalPanel1(String id)
{
super(id);
- add(new LocalDateTimeField("dateTimeField"));
+
+ AutoCompleteSettings settings = new AutoCompleteSettings();
+ settings.setShowListOnEmptyInput(true);
+
+ add(new AutoCompleteTextField<String>("edit", new Model<>(), settings)
+ {
+ @Override
+ protected Iterator<String> getChoices(String input)
+ {
+ return Arrays.asList("A", "B", "C").iterator();
+ }
+ });
}
}
diff --git a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
index 845391b..2b476bb 100644
--- a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
+++ b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
@@ -253,7 +253,7 @@
// HACK - IE doesn't support position:fixed. Gecko does, however for a reason
// we need to have background position: absolute, which makes the movement of
// the window really jerky if the window stays position: fixed
- if (Wicket.Browser.isIELessThan11() || Wicket.Browser.isGecko()) {
+ if (Wicket.Browser.isIELessThan11()) {
this.window.style.position = "absolute";
}
@@ -350,7 +350,7 @@
var scTop = 0;
var scLeft = 0;
- if (Wicket.Browser.isIELessThan11() || Wicket.Browser.isGecko()) {
+ if (Wicket.Browser.isIELessThan11()) {
scLeft = Wicket.Window.getScrollX();
scTop = Wicket.Window.getScrollY();
}
@@ -575,15 +575,7 @@
this.adjustOpenWindowsStatusOnShow();
- // show the window
- if (false && Wicket.Browser.isGecko() && this.isIframe()) {
- // HACK
- // gecko flickers when showing the window
- // unless the showing is postponed a little
- window.setTimeout(function() { doShow(); }, 0);
- } else {
- doShow();
- }
+ doShow();
// if the content supports focus and blur it, which means
// that the already focused element will lose it's focus
@@ -1144,7 +1136,7 @@
// HACK - it really sucks that we have to set this to absolute even for gecko.
// however background with position:fixed makes the text cursor in textfieds
// in modal window disappear
- if (Wicket.Browser.isIELessThan11() || Wicket.Browser.isGecko()) {
+ if (Wicket.Browser.isIELessThan11()) {
e.style.position = "absolute";
}
@@ -1687,14 +1679,6 @@
* page.
*/
mouseOut: function (e) {
- if (false && Wicket.Browser.isGecko()) {
- // other browsers handle this more gracefully
- e = Wicket.Event.fix(e);
-
- if (e.target.tagName === "HTML") {
- Wicket.Drag.mouseUp(e);
- }
- }
}
};