A Twitch.tv viewer reward and games system.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

  1. /*! UIkit 2.3.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2. (function($, UI){
  3. var FormPassword = function(element, options) {
  4. var $this = this, $element = $(element);
  5. if($element.data("formPassword")) return;
  6. this.options = $.extend({}, FormPassword.defaults, options);
  7. this.element = $element.on("click", function(e) {
  8. e.preventDefault();
  9. if($this.input.length) {
  10. var type = $this.input.attr("type");
  11. $this.input.attr("type", type=="text" ? "password":"text");
  12. $this.element.text($this.options[type=="text" ? "lblShow":"lblHide"]);
  13. }
  14. });
  15. $this.input = this.element.next("input").length ? this.element.next("input") : this.element.prev("input");
  16. $this.element.text(this.options[$this.input.is("[type='password']") ? "lblShow":"lblHide"]);
  17. this.element.data("formPassword", this);
  18. };
  19. FormPassword.defaults = {
  20. "lblShow": "Show",
  21. "lblHide": "Hide"
  22. };
  23. UI["formPassword"] = FormPassword;
  24. // init code
  25. $(document).on("click.formpassword.uikit", "[data-uk-form-password]", function(e) {
  26. var ele = $(this);
  27. if (!ele.data("formPassword")) {
  28. e.preventDefault();
  29. var obj = new FormPassword(ele, UI.Utils.options(ele.attr("data-uk-form-password")));
  30. ele.trigger("click");
  31. }
  32. });
  33. })(jQuery, jQuery.UIkit);