﻿var iTalkApp = angular.module('iTalkApp', ['SignalR', 'matchmedia-ng', 'ngMaterial', 'ngMessages', 'customFilter'])
    .config(function ($locationProvider) {
        //$locationProvider.html5Mode({ enabled: true, requireBase: false });
    })
    .run(function ($rootScope, $window) {
        /**
        * @id friend or group id
        * return web api controll name
        */
        $rootScope.getControllerName = function (targetId) {
            return targetId > 0 ? 'chat' : 'groupChat';
        };

        $rootScope.isSameDay = function (date1, date2) {
            return new Date(date1).toLocaleDateString() == new Date(date2).toLocaleDateString();
        }

        $rootScope.toLocaleDateString = function (date) {
            return new Date(date).toLocaleDateString();
        }

        $rootScope.errors;

        $rootScope.showError = function (result, title) {
            var errorText = result.statusCode + ' : ' + result.message;
            if (title) {
                errorText = title + '\n' + errorText
            }

            alert(errorText);

            if (!$rootScope.errors) {
                $rootScope.errors = [];
            }

            $rootScope.errors.push(errorText);
        }

        //$rootScope.count = function (dict) {
        //    return Object.keys(dict).length;
        //}

        //$rootScope.copyObject = function (source, dest) {
        //    for (var name in source) {
        //        dest[name] = source[name];
        //    }
        //}

        $rootScope.scrollChatListToBottom = function (targetId, scrollOnlyNotAtTop) {
            setTimeout(function () {
                var md = angular.element("#chat-list-" + targetId);
                if (md[0].scrollTop === 0 || !scrollOnlyNotAtTop) {
                    md[0].scrollTop = md[0].scrollHeight;
                }
            }, 0);
        }

        $rootScope.open = function (url) {
            if (url) {
                if (angular.isString(url)) {
                }
                else {
                    url = angular.element(url).css('background-image');
                }
                $window.open(url);
            }
        }

        Array.prototype.find = function (callback) {
            for (var i = 0; i < this.length; i++) {
                if (callback(this[i], i, this)) {
                    return this[i];
                }
            }
        }

        $rootScope.isMobile = function () {
            // TODO : 暫時先這樣判斷
            return $.mobile;
        }
    })
@@ -122,16 +122,37 @@
 .config(
+%5B'$compileProvider', 
 function
@@ -154,24 +154,23 @@
 ction ($
-location
+compile
 Provider
@@ -169,24 +169,74 @@
 Provider) %7B%0A
+        $compileProvider.debugInfoEnabled(false);%0A
         //$l
@@ -306,16 +306,17 @@
 );%0A    %7D
+%5D
 )%0A    .r
@@ -318,16 +318,42 @@
    .run(
+%5B'$rootScope', '$window', 
 function
@@ -2625,9 +2625,10 @@
  %7D%0A    %7D
+%5D
 )

Enable Relase Mode