"use strict";

angular.module("angular-mobile-docs")
    .controller("MobileDocCtrl", function ($scope, FetchService, $location, $routeParams, initVersion) {
        // TODO: Should be injected via constant
        $scope.config = {
            version: initVersion
        };

        // Register search inside of this scope
        $scope.search = "";

        // Init
        $scope.versions = FetchService.getVersionList();
        $scope.api = FetchService.getFileList($scope.config.version);


        $scope.leftMenuActive = false;
        $scope.rightMenuActive = false;

        $scope.swipeRight = function () {
            $scope.rightMenuActive = false;
            if (!$scope.rightMenuActive) {
                $scope.leftMenuActive = true;
            }
        }

        $scope.swipeLeft = function () {
            $scope.leftMenuActive = false;
            if (!$scope.leftMenuActive) {
                $scope.rightMenuActive = true;
            }
        }

        // Could be done in the html
        $scope.handleLeftMenuClick = function () {
            $scope.leftMenuActive = $scope.leftMenuActive;
        }

        // Could be done in the html
        $scope.handleRightMenuClick = function () {
            $scope.rightMenuActive = $scope.leftMenuActive;
        }


        $scope.filterVersions = function (item) {
            return !!(item.match(/^(1.0.[2-9])|(1.[1-9][0-9]?.\w+)/));
        }

        $scope.$watch('config.version', function (currentValue, oldValue) {
            function calculateRoute(newVersion) {
                var url = "/" + newVersion;

                if ($routeParams.name) {
                    url += "/api/" + $routeParams.name;
                }

                return url;
            }

            $scope.api = FetchService.getFileList($scope.config.version);
            $location.path(calculateRoute(currentValue));
        });
    })
;
@@ -631,38 +631,19 @@
     
-$scope.rightMenuActive = false
+alert('jo')
 ;%0A  
@@ -735,32 +735,76 @@
 ;%0A            %7D%0A
+            $scope.rightMenuActive = false;%0A
         %7D%0A%0A     
@@ -843,51 +843,8 @@
 ) %7B%0A
-            $scope.leftMenuActive = false;%0A
     
@@ -920,32 +920,32 @@
 uActive = true;%0A
-
             %7D%0A  
@@ -934,32 +934,75 @@
 ;%0A            %7D%0A
+            $scope.leftMenuActive = false;%0A
         %7D%0A%0A     

Fix swipe functions