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.

41 lines
1.1 KiB

  1. /*! UIkit 2.3.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
  2. (function($, UI){
  3. var FormFile = function(element, options) {
  4. var $this = this, $element = $(element);
  5. if($element.data("formfile")) return;
  6. this.options = $.extend({}, FormFile.defaults, options);
  7. this.element = $element;
  8. this.input = this.element.find("input[type='text']:first");
  9. this.file = this.element.find("input[type='file']:first");
  10. this.file.on("change", function(){
  11. $this.input.val(this.value.replace(/^.*[\/\\]/g, ''));
  12. });
  13. this.element.data("formfile", this);
  14. };
  15. FormFile.defaults = {};
  16. UI["formfile"] = FormFile;
  17. // init code
  18. $(document).on("click.formfile.uikit", "[data-uk-form-file]", function(e) {
  19. var ele = $(this);
  20. if (!ele.data("formfile")) {
  21. e.preventDefault();
  22. var obj = new FormFile(ele, UI.Utils.options(ele.attr("data-uk-form-file")));
  23. ele.trigger("click");
  24. }
  25. });
  26. })(jQuery, jQuery.UIkit);