Example usage for com.google.gwt.query.client GQuery clone

List of usage examples for com.google.gwt.query.client GQuery clone

Introduction

In this page you can find the example usage for com.google.gwt.query.client GQuery clone.

Prototype

public GQuery clone() 

Source Link

Document

Clone matched DOM Elements and select the clones.

Usage

From source file:com.dotweblabs.friendscube.app.client.local.LoginPage.java

License:Apache License

private void initAdditionalJS() {
    $("#create-btn").on("click", new Function() {
        public boolean f(Event e) {
            $(".create-icon").toggleClass("uk-icon-spinner uk-icon-spin");
            return true;
        }// ww w .j  a  v  a 2 s  .c o m
    });
    $("#login-btn").on("click", new Function() {
        public boolean f(Event e) {
            $(".login-icon").toggleClass("uk-icon-spinner uk-icon-spin");
            return true;
        }
    });
    $("#cancel").on("click", new Function() {
        public void f() {
            $(".email-modal").val("");
            $("#confirm-pass").val("");
            $("#pass").val("");
        }
    });
    $(".toggle-pass").on("click", new Function() {
        public boolean f(Event e) {
            e.preventDefault();
            if ($("#pass-box").hasClass("showpass")) {
                GQuery oldElem = $("#pass-box");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "text");
                oldElem.replaceWith(newElem);
                $("#pass-box").removeClass("showpass");
                $("#create-pw").text("Hide");
            } else {
                GQuery oldElem = $("#pass-box");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "password");
                oldElem.replaceWith(newElem);
                $("#pass-box").addClass("showpass");
                $("#create-pw").text("Show");
            }
            return true;
        }
    });
    $(".renew-pw").on("click", new Function() {
        public boolean f(Event e) {
            e.preventDefault();
            if ($("#pass").hasClass("showpass")) {
                GQuery oldElem = $("#pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "text");
                oldElem.replaceWith(newElem);
                $("#pass").removeClass("showpass");
                $("#renew-pw").text("Hide");
            } else {
                GQuery oldElem = $("#pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "password");
                oldElem.replaceWith(newElem);
                $("#pass").addClass("showpass");
                $("#renew-pw").text("Show");
            }
            return true;
        }
    });
    $(".logpass").on("click", new Function() {
        public boolean f(Event e) {
            e.preventDefault();
            if ($("#login-pass").hasClass("showpass")) {
                GQuery oldElem = $("#login-pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "text");
                oldElem.replaceWith(newElem);
                $("#login-pass").removeClass("showpass");
                $("#log-pw").text("Hide");
            } else {
                GQuery oldElem = $("#login-pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "password");
                oldElem.replaceWith(newElem);
                $("#login-pass").addClass("showpass");
                $("#log-pw").text("Show");
            }
            return true;
        }
    });
    $(".confirm-pw").on("click", new Function() {
        public boolean f(Event e) {
            e.preventDefault();
            if ($("#confirm-pass").hasClass("showpass")) {
                GQuery oldElem = $("#confirm-pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "text");
                oldElem.replaceWith(newElem);
                $("#confirm-pass").removeClass("showpass");
                $("#confirm-pw").text("Hide");
            } else {
                GQuery oldElem = $("#confirm-pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "password");
                oldElem.replaceWith(newElem);
                $("#confirm-pass").addClass("showpass");
                $("#confirm-pw").text("Show");
            }
            return true;
        }
    });
    //Logger.consoleLog("loaded JS");
}