;
  var videos = [];

  for (var i=0, j=tag.find('form input'); i<j.length; i++) {
    var matches = j[i].name.match(/(\w+)\[(\d+)\]/);
    var video = {id: matches[2]};
        video[matches[1]] = j[i].value;

    videos.push(video);
  }

  api('POST', 'tag_videos/' + tag.attr('tag-id'), {videos: JSON.stringify(videos)}, function () {
    tag.trigger('opened.mdui.panel');
    snackbar('保存成功');
  });
}
</script>
</html>