All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.belteshazzar.jquery.JQuery Maven / Gradle / Ivy

The newest version!
package com.belteshazzar.jquery;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.w3c.dom.Element;
import org.w3c.dom.events.EventListener;
import org.w3c.dom.events.EventTarget;
import org.w3c.dom.html.HTMLDocument;

import com.belteshazzar.jquery.functions.IntElementBooleanFunction;
import com.belteshazzar.jquery.functions.IntElementFunction;
import com.belteshazzar.jquery.functions.IntElementObjectFunction;
import com.belteshazzar.jquery.functions.IntElementVoidFunction;
import com.belteshazzar.jquery.functions.IntIntIntFunction;
import com.belteshazzar.jquery.functions.IntIntStringFunction;
import com.belteshazzar.jquery.functions.IntJQueryFunction;
import com.belteshazzar.jquery.functions.IntObjectObjectFunction;
import com.belteshazzar.jquery.functions.IntOffsetOffsetFunction;
import com.belteshazzar.jquery.functions.IntStringBooleanStringFunction;
import com.belteshazzar.jquery.functions.IntStringElementFunction;
import com.belteshazzar.jquery.functions.IntStringFunction;
import com.belteshazzar.jquery.functions.IntStringIntFunction;
import com.belteshazzar.jquery.functions.IntStringJQueryFunction;
import com.belteshazzar.jquery.functions.IntStringStringFunction;
import com.belteshazzar.jquery.functions.IntTweenVoidFunction;
import com.belteshazzar.jquery.functions.JQueryFunction;
import com.belteshazzar.jquery.functions.PromiseBooleanVoidFunction;
import com.belteshazzar.jquery.functions.PromiseIntIntVoidFunction;
import com.belteshazzar.jquery.functions.PromiseVoidFunction;
import com.belteshazzar.jquery.functions.VoidFunction;
import com.belteshazzar.jquery.functions.VoidFunctionFunction;
import com.belteshazzar.jquery.functions.callers.EventHandlerCaller;
import com.belteshazzar.jquery.functions.callers.IntElementBooleanFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntElementFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntElementObjectFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntIntIntFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntIntStringFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntJQueryFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntObjectObjectFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntOffsetOffsetFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntStringBooleanStringFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntStringElementFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntStringFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntStringIntFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntStringJQueryFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntStringStringFunctionCaller;
import com.belteshazzar.jquery.functions.callers.IntTweenVoidFunctionCaller;
import com.belteshazzar.jquery.functions.callers.PromiseBooleanVoidFunctionCaller;
import com.belteshazzar.jquery.functions.callers.PromiseIntIntVoidFunctionCaller;
import com.belteshazzar.jquery.functions.callers.PromiseVoidFunctionCaller;
import com.belteshazzar.jquery.functions.callers.VoidFunctionCaller;
import com.belteshazzar.jquery.functions.callers.VoidFunctionFunctionCaller;
import com.sun.webkit.dom.HTMLScriptElementImpl;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.concurrent.Worker.State;
import javafx.scene.web.WebEngine;
import netscape.javascript.JSException;
import netscape.javascript.JSObject;

public class JQuery {
	
	public static final String DEFAULT_JQUERY_LOCAL = JQuery.class.getResource("jquery-2.2.1.min.js").toExternalForm();
	public static final String DEFAULT_JQUERY_REMOTE = "https://code.jquery.com/jquery-2.2.2.min.js";
	public static final boolean DEFAULT_CLEAR_READY_FUNCTIONS = true;

	public static class Config {
		String src;
		boolean clearReadyFunctions;
		
		Config() {
			this.src = DEFAULT_JQUERY_LOCAL;
			this.clearReadyFunctions = DEFAULT_CLEAR_READY_FUNCTIONS;
		}
	}

	private static final List readyFunctions = new ArrayList();
	private static final Map eventHandlerMap = new HashMap();

	private static WebEngine webEngine;
	private static JSObject window = null;
	public static final Config config = new Config();
	
	public static void setEngine(WebEngine webEngine) {
		JQuery.webEngine = webEngine;
    	webEngine.getLoadWorker().stateProperty().addListener(
            new ChangeListener() {
                @Override
                public void changed(ObservableValue ov,
                    State oldState, State newState) {
                    if (newState == State.SUCCEEDED) {
                    	documentLoaded();
                    } else {
                    	window = null;
                    }
                }
            }
        );
    	
    	if (webEngine.getLoadWorker().getState()== State.SUCCEEDED) {
    		documentLoaded();
    	}
	}
	
	private static void documentLoaded() {
		try {
			@SuppressWarnings("unused")
			Object jQuery = webEngine.executeScript("jQuery");
			window = (JSObject)webEngine.executeScript("window");
			documentReady();
		} catch (JSException jsex) {
			HTMLDocument doc = (HTMLDocument)webEngine.getDocument();
			HTMLScriptElementImpl script = (HTMLScriptElementImpl)doc.createElement("script");
			((EventTarget)script).addEventListener("load", new EventListener() {

				@Override
				public void handleEvent(org.w3c.dom.events.Event evt) {
					Object jQuery = webEngine.executeScript("jQuery");
					if (!(jQuery instanceof JSObject)) {
						throw new IllegalStateException("JQuery hasn't been loaded into web page");
					}
					window = (JSObject)webEngine.executeScript("window");
					documentReady();
				}
				
			}, false);
			((EventTarget)script).addEventListener("error", new EventListener() {

				@Override
				public void handleEvent(org.w3c.dom.events.Event evt) {
					throw new IllegalStateException("failed to load jquery from: " + script.getSrc());
				}
				
			}, false);
			script.setSrc(JQuery.config.src);
			doc.getBody().appendChild(script);
		}
	}
	
	private static void documentReady() {
		for (VoidFunction f : readyFunctions) {
			f.apply();
		}
		if (JQuery.config.clearReadyFunctions) readyFunctions.clear();
	}

	static JSObject createFunction(IntStringStringFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntStringStringFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,s) { return obj.java.call(i,s); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(EventHandler handler) {
		JSObject obj = createObject();
		obj.setMember("java", new EventHandlerCaller(handler));
		obj.eval("(function(obj) { obj.fn = function(ev) { obj.java.call(ev); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntElementObjectFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntElementObjectFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,el) { return obj.java.call(i,el); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntStringFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntStringFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i) { return obj.java.call(i); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntStringBooleanStringFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntStringBooleanStringFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,s,b) { return obj.java.call(i,s,b); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntElementFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntElementFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,s,b) { return obj.java.call(i,s,b); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntJQueryFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntJQueryFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,s,b) { return obj.java.call(i,s,b); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntStringJQueryFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntStringJQueryFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,s,b) { return obj.java.call(i,s,b); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntStringElementFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntStringElementFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,s,b) { return obj.java.call(i,s,b); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntIntStringFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntIntStringFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,j) { return obj.java.call(i,j); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntIntIntFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntIntIntFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,j) { return obj.java.call(i,j); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(VoidFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new VoidFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function() { obj.java.call(); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntObjectObjectFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntObjectObjectFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,o) { return obj.java.call(i,o); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntTweenVoidFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntTweenVoidFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,t) { return obj.java.call(i,t); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntElementBooleanFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntElementBooleanFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,el) { return obj.java.call(i,el); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntOffsetOffsetFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntOffsetOffsetFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,os) { return obj.java.call(i,os); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(PromiseVoidFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new PromiseVoidFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(promise) { obj.java.call(promise); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(PromiseBooleanVoidFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new PromiseBooleanVoidFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(promise,finished) { obj.java.call(promise,finished); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(PromiseIntIntVoidFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new PromiseIntIntVoidFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(promise,i,j) { obj.java.call(promise,i,j); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(IntStringIntFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new IntStringIntFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function(i,s) { return obj.java.call(i,s); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createFunction(VoidFunctionFunction function) {
		JSObject obj = createObject();
		obj.setMember("java", new VoidFunctionFunctionCaller(function));
		obj.eval("(function(obj) { obj.fn = function() { return obj.java.call(); } })(this)");
		return (JSObject)obj.getMember("fn");
	}

	static JSObject createArray(Object[] values) {
		JSObject array = createArray();
		for (int i=0 ; i
", { // * "class": "my-div", // * on: { // * touchstart: function( event ) { // * // Do something // * } // * } // * }).appendTo( "body" ); // * // * $( "
", { // * "class": "test", // * text: "Click me!", // * click: function() { // * $( this ).toggleClass( "test" ); // * } // * }) // * .appendTo( "body" ); // * // */ public static JQuery $(String html, PlainObject attributes) { return new JQuery(window.call("jQuery", html, attributes.toJSObject())); } // https://api.jquery.com/jQuery/#jQuery-callback public static JQuery $(VoidFunction callback) { readyFunctions.add(callback); return new JQuery(null); } ///////////////////////////////////////////////////////////////////// public final int length; private final JSObject js; private JQuery(Object o) { if (o instanceof JSObject) { js = (JSObject)o; length = (int)js.getMember("length"); } else { js = null; this.length = 0; } } // https://api.jquery.com/add/#add-selector // https://api.jquery.com/add/#add-html public JQuery add(String selector) { return new JQuery(js.call("add", selector)); } // https://api.jquery.com/add/#add-elements public JQuery add(Element element) { return new JQuery(js.call("add", element)); } // https://api.jquery.com/add/#add-selection public JQuery add(JQuery selection) { return new JQuery(js.call("add", selection.js)); } // https://api.jquery.com/add/#add-selector-context public JQuery add(String selector, Element context) { return new JQuery(js.call("add", selector, context)); } // https://api.jquery.com/addBack/#addBack-selector public JQuery addBack() { return new JQuery(js.call("addBack")); } // https://api.jquery.com/addBack/#addBack-selector public JQuery addBack(String selector) { return new JQuery(js.call("addBack", selector)); } // https://api.jquery.com/addClass/#addClass-className public JQuery addClass(String classname) { js.call("addClass", classname); return this; } public JQuery addClass(IntStringStringFunction function) { js.call("addClass", createFunction(function)); return this; } // https://api.jquery.com/after/#after-content-content public JQuery after(String content) { js.call("after", content); return this; } // https://api.jquery.com/after/#after-content-content public JQuery after(Element content) { js.call("after", content); return this; } // https://api.jquery.com/after/#after-content-content public JQuery after(Element ... content) { js.call("after", createArray(content)); return this; } // https://api.jquery.com/after/#after-content-content public JQuery after(JQuery content) { js.call("after", content.js); return this; } // https://api.jquery.com/after/#after-function public JQuery after(IntStringFunction function) { return new JQuery(js.call("after", createFunction(function))); } // https://api.jquery.com/after/#after-function public JQuery after(IntElementFunction function) { return new JQuery(js.call("after", createFunction(function))); } // https://api.jquery.com/after/#after-function public JQuery after(IntJQueryFunction function) { return new JQuery(js.call("after", createFunction(function))); } // https://api.jquery.com/after/#after-function public JQuery after(IntStringStringFunction function) { return new JQuery(js.call("after", createFunction(function))); } // https://api.jquery.com/after/#after-function public JQuery after(IntStringElementFunction function) { return new JQuery(js.call("after", createFunction(function))); } // https://api.jquery.com/after/#after-function public JQuery after(IntStringJQueryFunction function) { return new JQuery(js.call("after", createFunction(function))); } // http://api.jquery.com/animate/ public JQuery animate(PlainObject properties) { return new JQuery(js.call("animate", properties.toJSObject())); } // http://api.jquery.com/animate/ public JQuery animate(PlainObject properties, VoidFunction complete) { return new JQuery(js.call("animate", properties.toJSObject(), createFunction(complete))); } // http://api.jquery.com/animate/ public JQuery animate(PlainObject properties, int duration) { return new JQuery(js.call("animate", properties.toJSObject(), duration)); } // http://api.jquery.com/animate/ public JQuery animate(PlainObject properties, int duration, VoidFunction complete) { return new JQuery(js.call("animate", properties.toJSObject(),duration, createFunction(complete))); } // http://api.jquery.com/animate/ public JQuery animate(PlainObject properties, int duration, String easing) { return new JQuery(js.call("animate", properties.toJSObject(), duration, easing)); } // http://api.jquery.com/animate/ public JQuery animate(PlainObject properties, int duration, String easing, VoidFunction complete) { return new JQuery(js.call("animate", properties.toJSObject(), duration, easing, createFunction(complete))); } // http://api.jquery.com/animate/ public JQuery animate(PlainObject properties, AnimationOptions options) { return new JQuery(js.call("animate", properties.toJSObject(), options.toJSObject())); } // https://api.jquery.com/append/#append-content-content public JQuery append(String content) { js.call("append", content); return this; } // https://api.jquery.com/append/#append-content-content public JQuery append(Element content) { js.call("append", content); return this; } // https://api.jquery.com/append/#append-content-content public JQuery append(Element ... content) { js.call("append", createArray(content)); return this; } // https://api.jquery.com/append/#append-content-content public JQuery append(JQuery content) { js.call("append", content.js); return this; } // https://api.jquery.com/append/#append-function public JQuery append(IntStringStringFunction function) { return new JQuery(js.call("append", createFunction(function))); } // https://api.jquery.com/append/#append-function public JQuery append(IntStringElementFunction function) { return new JQuery(js.call("append", createFunction(function))); } // https://api.jquery.com/append/#append-function public JQuery append(IntStringJQueryFunction function) { return new JQuery(js.call("append", createFunction(function))); } // https://api.jquery.com/appendTo/#appendTo-target public JQuery appendTo(String target) { js.call("appendTo", target); return this; } // https://api.jquery.com/appendTo/#appendTo-target public JQuery appendTo(Element target) { js.call("appendTo", target); return this; } // https://api.jquery.com/appendTo/#appendTo-target public JQuery appendTo(Element ... target) { js.call("appendTo", createArray(target)); return this; } // https://api.jquery.com/appendTo/#appendTo-target public JQuery appendTo(JQuery target) { js.call("appendTo", target.js); return this; } // https://api.jquery.com/attr/#attr1 public String attr(String attributeName) { return (String)js.call("attr", attributeName); } // https://api.jquery.com/attr/#attr1 public JQuery attr(String attributeName, String value) { js.call("attr", attributeName, value); return this; } public JQuery attr(String attributeName, Number value) { js.call("attr", attributeName, value); return this; } // https://api.jquery.com/attr/#attr-attributes public JQuery attr(PlainObject attributes) { js.call("attr", attributes.toJSObject()); return this; } // https://api.jquery.com/attr/#attr-attributeName-function public JQuery attr(String attributeName, IntStringStringFunction function) { js.call("attr", attributeName, createFunction(function)); return this; } // https://api.jquery.com/attr/#attr-attributeName-function public JQuery attr(String attributeName, IntStringIntFunction function) { js.call("attr", attributeName, createFunction(function)); return this; } // https://api.jquery.com/before/#before-content-content public JQuery before(String content) { js.call("before", content); return this; } // https://api.jquery.com/before/#before-content-content public JQuery before(Element content) { js.call("before", content); return this; } // https://api.jquery.com/before/#before-content-content public JQuery before(Element ... content) { js.call("before", createArray(content)); return this; } // https://api.jquery.com/before/#before-content-content public JQuery before(JQuery content) { js.call("before", content.js); return this; } // https://api.jquery.com/before/#before-function public JQuery before(IntStringFunction function) { return new JQuery(js.call("before", createFunction(function))); } // https://api.jquery.com/before/#before-function public JQuery before(IntElementFunction function) { return new JQuery(js.call("before", createFunction(function))); } // https://api.jquery.com/before/#before-function public JQuery before(IntJQueryFunction function) { return new JQuery(js.call("before", createFunction(function))); } // https://api.jquery.com/before/#before-function public JQuery before(IntStringStringFunction function) { return new JQuery(js.call("before", createFunction(function))); } // https://api.jquery.com/before/#before-function public JQuery before(IntStringElementFunction function) { return new JQuery(js.call("before", createFunction(function))); } // https://api.jquery.com/before/#before-function public JQuery before(IntStringJQueryFunction function) { return new JQuery(js.call("before", createFunction(function))); } // https://api.jquery.com/bind/#bind-eventType-eventData-handler public JQuery bind(String eventType, EventHandler handler) { JSObject jsHandler = createFunction(handler); eventHandlerMap.put(handler.hashCode(), jsHandler); js.call("bind", eventType, jsHandler); return this; } // https://api.jquery.com/bind/#bind-eventType-eventData-handler public JQuery bind(String eventType, Object eventData, EventHandler handler) { JSObject jsHandler = createFunction(handler); eventHandlerMap.put(jsHandler.hashCode(), jsHandler); js.call("bind", eventType, eventData, jsHandler); return this; } // https://api.jquery.com/blur/ public JQuery blur(EventHandler handler) { return bind("blur",handler); } // https://api.jquery.com/blur/ public JQuery blur(Object data, EventHandler handler) { return bind("blur",data,handler); } // https://api.jquery.com/blur/ public JQuery blur() { js.call("blur"); return this; } // https://api.jquery.com/change/ public JQuery change(EventHandler handler) { return bind("change",handler); } // https://api.jquery.com/change/ public JQuery change(Object data, EventHandler handler) { return bind("change",data,handler); } // https://api.jquery.com/change/ public JQuery change() { js.call("change"); return this; } // https://api.jquery.com/children/ public JQuery children() { return new JQuery(js.call("children")); } // https://api.jquery.com/children/ public JQuery children(String selector) { return new JQuery(js.call("children",selector)); } // https://api.jquery.com/clearQueue/ public JQuery clearQueue() { return new JQuery(js.call("clearQueue")); } // https://api.jquery.com/clearQueue/ public JQuery clearQueue(String queueName) { return new JQuery(js.call("clearQueue",queueName)); } // https://api.jquery.com/click/ public JQuery click(EventHandler handler) { return bind("click",handler); } // https://api.jquery.com/click/ public JQuery click(Object data, EventHandler handler) { return bind("click",data,handler); } // https://api.jquery.com/click/ public JQuery click() { js.call("click"); return this; } // https://api.jquery.com/clone/ public JQuery clone() { return clone(false,false); } // https://api.jquery.com/clone/ public JQuery clone(boolean withDataAndEvents) { return clone(withDataAndEvents,withDataAndEvents); } // https://api.jquery.com/clone/ public JQuery clone(boolean withDataAndEvents, boolean deepWithDataAndEvents) { return new JQuery(js.call("clone", withDataAndEvents,deepWithDataAndEvents)); } // https://api.jquery.com/closest/ public JQuery closest(String selector) { return new JQuery(js.call("closest", selector)); } // https://api.jquery.com/closest/ public JQuery closest(String selector, Element context) { return new JQuery(js.call("closest", selector, context)); } // https://api.jquery.com/closest/ public JQuery closest(JQuery selection) { return new JQuery(js.call("closest", selection)); } // https://api.jquery.com/closest/ public JQuery closest(Element element) { return new JQuery(js.call("closest", element)); } // https://api.jquery.com/contents/ public JQuery contents() { return new JQuery(js.call("contents")); } // https://api.jquery.com/contextmenu/ public JQuery contextmenu(EventHandler handler) { bind("contextmenu",handler); return this; } // https://api.jquery.com/contextmenu/ public JQuery contextmenu(Object eventData, EventHandler handler) { bind("contextmenu",eventData, handler); return this; } // https://api.jquery.com/contextmenu/ public JQuery contextmenu() { js.call("contextmenu"); return this; } // https://api.jquery.com/css/ public String css(String propertyName) { return (String)js.call("css", propertyName); } // https://api.jquery.com/css/#css-propertyNames public PlainObject css(String ... propertyNames) { return new PlainObject((JSObject)js.call("css", createArray(propertyNames))); } // https://api.jquery.com/css/ public JQuery css(String propertyName, String value) { js.call("css", propertyName, value); return this; } // https://api.jquery.com/css/ public JQuery css(String propertyName, IntStringStringFunction function) { js.call("css", propertyName, createFunction(function)); return this; } // https://api.jquery.com/css/ public JQuery css(PlainObject properties) { js.call("css", properties.toJSObject()); return this; } // https://api.jquery.com/data/ public JQuery data(String key, Object value) { js.call("data", key, value); return this; } // https://api.jquery.com/data/ public JQuery data(PlainObject obj) { js.call("data", obj.toJSObject()); return this; } // https://api.jquery.com/data/ public Object data(String key) { return js.call("data",key); } // https://api.jquery.com/data/ public Object data() { return js.call("data"); } // https://api.jquery.com/dblclick/ public JQuery dblclick(EventHandler handler) { return bind("dblclick",handler); } // https://api.jquery.com/dblclick/ public JQuery dblclick(Object data, EventHandler handler) { return bind("dblclick",data,handler); } // https://api.jquery.com/dblclick/ public JQuery dblclick() { js.call("dblclick"); return this; } // https://api.jquery.com/delay/ public JQuery delay(int duration) { js.call("delay", duration); return this; } // https://api.jquery.com/delay/ public JQuery delay(int duration, String queueName) { js.call("delay", duration, queueName); return this; } // https://api.jquery.com/delegate/ public JQuery delegate(String selector, String eventType, EventHandler handler) { js.call("delegate", selector, eventType, createFunction(handler)); return this; } // https://api.jquery.com/delegate/ public JQuery delegate(String selector, String eventType, Object eventData, EventHandler handler) { js.call("delegate", selector, eventType, eventData, createFunction(handler)); return this; } // https://api.jquery.com/delegate/ public JQuery delegate(String selector, PlainObject events) { js.call("delegate", selector, events.toJSObject()); return this; } // https://api.jquery.com/dequeue/ public JQuery dequeue() { js.call("dequeue"); return this; } // https://api.jquery.com/dequeue/ public JQuery dequeue(String queueName) { js.call("dequeue",queueName); return this; } // https://api.jquery.com/detach/ public JQuery detach() { js.call("detach"); return this; } // https://api.jquery.com/detach/ public JQuery detach(String selector) { js.call("detach",selector); return this; } // https://api.jquery.com/each/ public JQuery each(IntElementVoidFunction function) { for (int i=0 ; i0) { sb.append(this.get(0)); for (int i=1 ; i



© 2015 - 2024 Weber Informatics LLC | Privacy Policy