<script>
  jQuery(function($) {
    var $ = jQuery;
    
    $(".youtubesettings").hide();
    $(".vimeosettings").hide();

    $(document).on('keyup paste', "#video", function() {
      setTimeout(function () {
        var type = $("#video").val();

        if (/youtube.com/.test(type)){
          type = 'youtube';
        } else if (/vimeo.com/.test(type)) {
            type = 'vimeo';
        } else if (/[A-Za-z0-9_]+/.test(type)) {
          var id = new String(type.match(/[A-Za-z0-9_]+/));
          if (id.length == 11) {
            type = 'youtube';
          } else if ($.isNumeric(type)) {
            type = 'vimeo';
          }
        }

        $(".youtubesettings").hide();
        $(".vimeosettings").hide();

        switch(type) {
          case "youtube":
            $(".youtubesettings").show();
            break;
          case "vimeo":
            $(".vimeosettings").show();
        }
      }, 100);
    });
  });
</script>