123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- * @ngdoc function
- * @name domainManagerApp.controller:AboutCtrl
- * @description
- * # AboutCtrl
- * Controller of the domainManagerApp
- */
- angular.module('goApp.slideshow', ['ngFx', 'ngAnimate', 'goApp.data'])
- .controller('SlideshowController',['$scope', '$rootScope', '$famous', '$timeline', '$location', '$route', '$timeout', 'Data', '$mixpanel', function ($scope, $rootScope, $famous, $timeline, $location, $route, $timeout, Data, $mixpanel) {
- 'use strict';
- console.log('> Loading Slideshow');
-
- var link = $location.url();
- $scope.pageData = Data.getPageData(link);
- $rootScope.$on('data:loaded', function(data) {
- if(!$scope.$$phase) {
- $scope.$apply(function(){
- $scope.pageData = Data.getPageData(link);
- $scope.showSlider();
- $mixpanel.track('Page View', { "Page": $scope.pageData.link });
- });
- }
- });
-
- $timeout(function(){
- $scope.showView = true;
- },100);
-
- $scope.fadeOut = function() {
- $scope.showView = false;
- $timeout(function(){
- $scope.showView = false;
- $location.path("/");
- },800);
- };
- $scope.index = 0;
- $scope.images = [];
- $scope.showSlider = function() {
- var show = false;
- if($scope.pageData.slides !== undefined) {
- if($scope.pageData.slides.length > 0) {
- show = true;
- for (var i = 0; i < $scope.pageData.slides.length; i++) {
- $scope.images.push($scope.pageData.slides[i].url);
- }
- } else {
- show = false;
- }
- if(!$scope.$$phase) {
- $scope.$apply(function(){
- $scope.slider = show;
- });
- } else {
- $scope.slider = show;
- }
- $timeout(function(){
-
- },250);
- }
- };
-
- $scope.updateTsPrevious = function() {
- $scope.tsPrevious = +new Date();
-
- };
- $scope.updateTsNext = function() {
- $scope.tsNext = +new Date();
-
- };
- $scope.resizeImages = function() {
- var allImages = [];
- var clientHeight = document.getElementById('slider').clientHeight;
- $('img').each(function(idx, img) {
- allImages.push(img);
- });
- console.log('> Starting image resize process (resizing to ' + clientHeight + 'px)');
- for(var i = 0, max = allImages.length; i < max; i++){
- console.log('> resizing image');
- allImages[i].style.height = (clientHeight-25) + 'px';
- allImages[i].style.maxHeight = 'none';
- allImages[i].style.width = 'auto';
- }
- };
- $scope.showSlider();
- }]);
|