Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. angular.module('Gloot', ["GlootService"]).config(['$provide', function($provide) {
  2.    
  3.     $provide.decorator('$browser', ['$delegate', function($delegate) {
  4.         var superUrl = $delegate.url;
  5.         $delegate.url = function(url, replace) {
  6.             if(url !== undefined) {
  7.                 return superUrl(url.replace(/\%20/g,"+"), replace);
  8.             } else {
  9.                 return superUrl().replace(/\+/g,"%20");
  10.             }
  11.         }
  12.         return $delegate;
  13.     }]);
  14.  
  15.     //$translateProvider.preferredLanguage('en');
  16.    
  17. }]).controller('GlootController', ['$scope', 'GlootService', '$q', '$timeout', function($scope, GlootService, $q, $timeout) {  
  18.  
  19.     /* PRIVATE MEMBERS --------------------------------------------------------------------------------- */
  20.  
  21.     var GlootWrapper = new _GlootWrapper($q, Gloot);
  22.  
  23.     /* $SCOPED MEMBERS --------------------------------------------------------------------------------- */
  24.  
  25.     $scope.count = 0;
  26.     $scope.respCount = 0;
  27.    
  28.     $scope.wrapper = GlootWrapper;
  29.     $scope.r = GlootResponses;
  30.  
  31.     $scope.joel = "";
  32.  
  33.     /* GLOBAL LOADING ---------------------------------------------------------------------------------- */
  34.  
  35.     var loading = {};
  36.     $scope.isLoading = function() {
  37.         if (arguments.length > 0)
  38.             for(var i=0;i<arguments.length;i++)
  39.                 if (loading[arguments[i]] === true)
  40.                     return true;
  41.             return false;
  42.     }
  43.  
  44.     /* TEST FORM ---------------------------------------------------------------------------------------- */
  45.  
  46.     $scope.testForm = {'name' : '', 'email' : '', 'pass' : '', error : {}, loading : false};
  47.     $scope.submitTestForm = function() {
  48.         console.log("KUK");
  49.         $scope.testForm['error'] = {};
  50.         var v = $scope.testForm;
  51.         if(v['name'].length <= 3) {
  52.             v['error']['name'] = 'Name must be at least three characters long!';
  53.             return;
  54.         }
  55.         $scope.testForm['loading'] = true;
  56.         $timeout(function() {
  57.             $scope.testForm['loading'] = false;
  58.         }, 2000);
  59.     }
  60.  
  61.     /* -------------------------------------------------------------------------------------------------- */
  62.  
  63.  
  64.     $scope.getGloot = function() {
  65.         return Gloot;
  66.     }
  67.  
  68.     $scope.onMouseMove = function() {
  69.         try {
  70.             $scope.count++;
  71.             $scope.wrapper.updateMouse($scope.count, $scope.count).then(function(resp) {
  72.                 $scope.joel = resp[0] + " : " + resp[1];
  73.             });
  74.         } catch(e) {
  75.             document.getElementById("kuk").innerHTML = e.toString();
  76.         }
  77.     }
  78.  
  79.     $scope.getDebugMarkup = function() {
  80.  
  81.     }
  82. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement