士昇 葉
{{t.name}}
{{t.name}}
{{t.name}}
{{t.name}}
-->' + '' + '
' }; }]) .controller('UserController', ['$scope', '$http', '$location', '$translate', '$filter', function($scope, $http, $location, $translate, $filter) { var self = this; $scope.service_url = [location.origin, '/private'].join(''); $scope.openTab = function(url, target) { window.open(url, target); } $scope.open1know = function() { window.location.href = location.origin; } $scope.toggleView = function(type) { $scope.viewType = type; if (type === 'created_course') $scope.viewItems = $scope.target.course.created; else if (type === 'subscribed_course') $scope.viewItems = $scope.target.course.subscribed; else if (type === 'created_group') $scope.viewItems = $scope.target.group.created; else if (type === 'joined_group') $scope.viewItems = $scope.target.group.joined; } $scope.changeLanguage = function(lang) { lang = lang.toLowerCase(); if (lang === 'zh-tw') lang = {title: '繁體中文',type: 'zh-tw'}; else if (lang === 'zh-cn') lang = {title: '简体中文',type: 'zh-cn'}; else if (lang === 'es-ar') lang = {title: 'Español (Argentina)',type: 'es-ar'}; else if (lang === 'es-pe') lang = {title: 'Español (Perú)',type: 'es-pe'}; else if (lang === 'de-de') lang = {title: 'Deutsch',type: 'de-de'}; else lang = {title: 'English',type: 'en-us'}; $scope.language = lang; $translate.use(lang.type); if ($scope.target.account) { ga('send', '/personal/profile', 'service', 'put'); $http.put([$scope.service_url, '/personal/profile'].join(''), {language: JSON.stringify(lang)}) .success(function(response, status) { window.scrollTo(0, 0); }); } } $scope.timeToFormat = function(time) { if (time !== null && time !== '') { time = Math.ceil(time); var format_time = [Math.floor(time / 3600), Math.floor((time % 3600) / 60), (time % 60)]; format_time[0] = format_time[0] > 0 && format_time[0] < 10 ? [format_time[0], '
h
'].join('') : (format_time[0] >= 10 ? [format_time[0], '
h
'].join('') : ''); format_time[1] = format_time[1] > 0 && format_time[1] < 10 ? [format_time[1], '
m
'].join('') : (format_time[1] >= 10 ? [format_time[1], '
m
'].join('') : ''); format_time[2] = format_time[2] > 0 && format_time[2] < 10 ? [format_time[2], '
s
'].join('') : (format_time[2] >= 10 ? [format_time[2], '
s
'].join('') : ''); return format_time.join(''); } else return '0'; } ga('send', '/user/:uqid.json', 'service', 'get'); $http.get([location.origin, '/user/53299390.json'].join('')) .success(function(response, status) { $scope.target = response; $scope.target.gained_desc = $scope.timeToFormat($scope.target.gained); $scope.toggleView('created_course'); $('.loading').hide(); $('.completed').show(); if (response.account) { $scope.language = response.account.language; $translate.use($scope.language.type); } else { var lang = 'en-us'; if (window.navigator.language !== undefined) lang = window.navigator.language.toLowerCase(); else if (window.navigator.systemLanguage !== undefined) lang = window.navigator.systemLanguage.toLowerCase(); if (lang === 'zh-tw') lang = {title: '繁體中文',type: 'zh-tw'}; else if (lang === 'zh-cn') lang = {title: '简体中文',type: 'zh-cn'}; else if (lang === 'es-ar') lang = {title: 'Español (Argentina)',type: 'es-ar'}; else if (lang === 'es-pe') lang = {title: 'Español (Perú)',type: 'es-pe'}; else if (lang === 'de-de') lang = {title: 'Deutsch',type: 'de-de'}; else lang = {title: 'English',type: 'en-us'}; $scope.language = lang; $translate.use($scope.language.type); } window.document.title = '士昇 葉 - ' +$filter('translate')('N027'); }); }])