(function () {
    if(!window["partnerModules"])
        window["partnerModules"] = [];
    window["partnerModules"].push("torx");
    var app = angular.module("torx", []);
    app.run([function () {
        function show() {
            $("body, html").css({
                "opacity": 1
            });
        }
        show();

        //function postMessageHandler(e) {
        //    try {
        //        var message = JSON.parse(e.data);
        //        //console.log("message", message);
        //        if (message.command == "RequestSuccess" && message.url.indexOf("/api/wizdom/noticeboard/views/65450b2d-6b64-4d83-acf6-297789fe6083") == 0) {
        //            $timeout(show, 0);
        //            var timeTaken = new Date().getTime() - window.performance.timing.navigationStart;
        //            console.log("Noticeboard show " +
        //                (timeTaken) +
        //                " millisec after navigation start");
        //            document.title += " (" + (new Date().getTime() - window.performance.timing.navigationStart) + ")";
        //        }
        //    } catch (ex) {
                
        //    }
        //}

        //if (typeof window.addEventListener != 'undefined')
        //    window.addEventListener('message', postMessageHandler, false);
        //else if (typeof window["attachEvent"] != 'undefined')
        //    window["attachEvent"]('onmessage', postMessageHandler);
    }]);

    app.directive('webpart',
        function() {
            return {
                restrict: 'E',
                transclude: true,
                replace: true,
                scope: {},
                template: '<div class="ms-webpartzone-cell"><div class="ms-webpart-chrome" ng-transclude></div></div>'
            };
        });

    app.directive('webpartTitle',
        function() {
            return {
                require: '^webpart',
                restrict: 'E',
                replace: true,
                transclude: true,
                scope: {},
                template: '<div class="ms-webpart-chrome-title"><h2 ng-transclude></h2></div>',
            };
        });

    app.directive('webpartContent',
        function () {
            return {
                require: '^webpart',
                restrict: 'E',
                replace: true,
                transclude: true,
                scope: {},
                template: '<div class="ms-WPBody ms-WPBorder ms-wpContentDivSpace" ng-transclude></div>'
            };
        });
})();