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 this.$scope.onCloseButtonClick = ():void => {
53 this.$state.go("dashboard", {});
57 private init = ():void => {
58 let viewModelsHtmlBasePath:string = 'src/app/view-models/';
59 $('body').keyup((e):void=> {
60 if (e.keyCode == 27) { // escape key maps to keycode `27`
61 this.$state.go('dashboard');
66 private loadImages = (callback:Function):void => {
67 let src = $('.sdc-welcome-wrapper').css('background-image');
68 let url = src.match(/\((.*?)\)/)[1].replace(/('|")/g,'');
70 let img = new Image();
71 img.onload = function() {