{"size": 2506, "ext": "js", "max_stars_repo_path": "html/index/celebrity-detail.js", "max_stars_repo_name": "snowdreams1006/iMovie", "max_stars_repo_stars_event_min_datetime": "2018-06-26T03:31:22.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-30T19:38:08.000Z", "max_issues_repo_path": "html/index/celebrity-detail.js", "max_issues_repo_name": "lan7916/iMovie", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "html/index/celebrity-detail.js", "max_forks_repo_name": "lan7916/iMovie", "max_forks_repo_forks_event_min_datetime": "2018-08-08T03:58:02.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-16T07:48:01.000Z"}
{"max_stars_count": 4, "max_issues_count": null, "max_forks_count": 4, "avg_line_length": 22.7818181818, "max_line_length": 89, "alphanum_fraction": 0.5618515563}
;
(function($) {
	mui.init({
		swipeBack: true
	});

	var vm = new Vue({
		el: '.mui-content',
		data: {
			mobileUrl: '',
			akaEn: '',
			name: '',
			works: [],
			gender: '',
			avatars: '',
			celebrityId: '',
			aka: '',
			nameEn: '',
			bornPlace: '',
			alt: '',
			preOrigin: {

			}
		},
		methods: {
			viewMovieDetail: function(item) {
				var movie_detail = plus.webview.getWebviewById("movieDetail");

				var directorNames = '';
				for(var i = 0, len = item.subject.directors.length; i < len; i++) {
					directorNames += item.subject.directors[i].name;
					if(i != len - 1) {
						directorNames += ' / ';
					}
				}

				var castNames = '';
				for(var i = 0, len = item.subject.casts.length; i < len; i++) {
					castNames += item.subject.casts[i].name;
					if(i != len - 1) {
						castNames += ' / ';
					}
				}

				mui.fire(movie_detail, 'movie_detail', {
					movieId: item.subject.id,
					title: item.subject.title,
					genres: item.subject.genres.join("/"),
					cover: item.subject.images.large,
					score: item.subject.rating.average,
					collect: item.subject.collect_count,
					year: item.subject.year,
					directors: directorNames,
					casts: castNames,
					origin: item
				});

				movie_detail.setStyle({
					titleNView: {
						titleText: item.subject.title
					}
				});
				setTimeout(function() {
					movie_detail.show("slide-in-right", 300, function() {
						plus.webview.currentWebview().close("none");
					});
				}, 150);
			}
		}
	});

	mui.plusReady(function() {
		var self = plus.webview.currentWebview();

		vm.celebrityId = self.celebrityId;
		vm.alt = self.alt;
		vm.avatars = self.avatars;
		vm.name = self.name;
		vm.preOrigin = self.origin;

		var celebrityId = self.celebrityId;
		if(!celebrityId) {
			return;
		}

		var celebrityAPI = plus.storage.getItem("api") + "/v2/movie/celebrity/" + celebrityId;

		plus.nativeUI.showWaiting("正在加载中...");

		mui.getJSON(celebrityAPI, function(resp) {
			vm.mobileUrl = resp.mobile_url;
			vm.akaEn = resp.aka_en;
			vm.works = resp.works;
			vm.gender = resp.gender;
			vm.aka = resp.aka.join("/");
			vm.nameEn = resp.name_en;
			vm.bornPlace = resp.born_place;

			plus.nativeUI.closeWaiting();
		});

		mui('.top-image-block').on('tap', 'img', function() {
			plus.nativeUI.previewImage([vm.avatars]);
		});

		mui.back = function() {
			self.close("auto", 300);
		}
	});
})(mui);