2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
23 export interface IWelcomeViewMode {
24 onCloseButtonClick():void;
27 export class WelcomeViewModel {
29 firstLoad:boolean = true;
30 alreadyAnimated:Array<number> = [];
37 constructor(private $scope:IWelcomeViewMode,
38 private $state:ng.ui.IStateService
42 window.setTimeout(():void => {
43 this.loadImages(():void=> {
44 window.setTimeout(():void =>{
45 $(".sdc-welcome-new-page").addClass("animated fadeIn");
51 private initScope = ():void => {
52 let timeout = window.setTimeout(():void => {
53 this.$state.go("dashboard", {});
55 this.$scope.onCloseButtonClick = ():void => {
56 window.clearTimeout(timeout);
57 this.$state.go("dashboard", {});
61 private init = ():void => {
62 let viewModelsHtmlBasePath:string = 'src/app/view-models/';
63 $('body').keyup((e):void=> {
64 if (e.keyCode == 27) { // escape key maps to keycode `27`
65 this.$state.go('dashboard');
70 private loadImages = (callback:Function):void => {
71 let src = $('.sdc-welcome-wrapper').css('background-image');
72 let url = src.match(/\((.*?)\)/)[1].replace(/('|")/g,'');
74 let img = new Image();
75 img.onload = function() {