PageSourceSearch

https://www.blackandwhitecabs.com.au/wp-content/themes/bridge/fare…/directives/directives.js?ver=1790275616

js blackandwhitecabs.com.au collected 2026-09-24 19:01:22 UTC 4,506 bytes, 123 lines download raw bytes

1app.directive('animateStart', function(){
2    return {
3       restrict: 'A',
4       link: function(scope, element, attribute){
5       		setInterval(animateMe, 2000);
6       		function animateMe() {
7       			element.animate({ left: -25 }, 100).animate({ left: 0 }, 100).animate({ left: 25 }, 100).animate({ left: 0 }, 100);
8       		}
9       }
10    };
11});
12
13app.directive('sendLink', function() {
14  return {
15  	restrict: 'E',
16    templateUrl: dir_path + 'fare_estimator_app/templates/send-link.html',
17    controller: function( $scope, $element, commonService) {
18      $scope.onSendLinkCitySelected = function(city, e) {
19        jQuery("#send_link_state").find("span.form-control").html(city);        
20        jQuery("#send_link_state").find("span.form-control").removeClass("inp-error");        
21      }
22
23      $scope.removeError = function(e) {
24        if(jQuery(e.target).attr("id") == "send_link_state") {
25          jQuery(e.target).find("span.form-control").html("City");        
26        }
27
28        if(jQuery(e.target).attr("id") == "send_link_mobile") {
29          jQuery(e.target).attr("placeholder" ,"Mobile number");        
30        }
31        jQuery(e.target).removeClass("inp-error");
32      }
33
34      /*
35      * function to send link
36      */
37      $scope.sendLinkSMS = function(v) {
38        var e = false;
39         /*
40         if($scope.sendlink_state.selected == undefined) {
41          e = true;
42          jQuery("#send_link_state").find("span.form-control").html("Please select city");
43          jQuery("#send_link_state").find("span.form-control").addClass("inp-error");
44         } 
45         */
46         if(jQuery("input[name='sendlinkmobile']").val() == "") {
47          e = true;
48          jQuery("#send_link_mobile").attr("placeholder", "Please enter mobile number");
49          jQuery("#send_link_mobile").addClass("inp-error");
50         }
51
52         if(jQuery("input[name='sendlinkmobile']").hasClass("ng-invalid")) {
53          e = true;
54          jQuery("#send_link_mobile").attr("placeholder", "Please enter mobile number");
55          jQuery("#send_link_mobile").addClass("inp-error");
56         } 
57
58         if(e == false && v == true) {
59          commonService.sendLink($scope);
60        }
61      }
62    }
63  };
64});
65
66app.directive('australianNumber', function() {
67   var AUS_PHONE_REGEX = /(^1300(| )[0-9]{3}(| )[0-9]{3}$)|(^1[800|900|902]{3}(| )[0-9]{3}(| )[0-9]{3}$)|(^0[2|3|7|8]{1}(| )[0-9]{4}(| )[0-9]{4}$)|(^13(| )[0-9]{4}$)|(^04[0-9]{2}(| )[0-9]{3}(| )[0-9]{3}$)/;
68
69    return {
70        restrict: 'A',
71        require: 'ngModel',
72        link: function (scope, element, attrs, ctrl) {
73
74            ctrl.$validators.phoneNumber = function (value) {
75                if (ctrl.$isEmpty(value)) {
76                    return true;
77                }
78                value = blockNonNumberOnInput(value);
79                return AUS_PHONE_REGEX.test(stripCountryCodeAndWhitespaces(value));
80            };
81
82            function blockNonNumberOnInput(val) {
83                // accept 0-9, +, - and brackets
84                return val.toString().replace(/[^0-9()\+\-\( )]/g, '');
85            }
86
87            function stripCountryCodeAndWhitespaces(val) {
88                val = val.replace(/[()\+\-\( )]/g, '');  // Acceptable characters and whitespaces
89                return val.replace(/^61/, '0');          // Australian country code
90            }
91
92            function onInputBlur() {
93                var updatedNumber = stripCountryCodeAndWhitespaces(element.val());
94                element.val(updatedNumber);
95                ctrl.$setViewValue(updatedNumber);
96            }
97
98            function onInputKeyup() {
99                var el = element[0];
100
101                // need to retain the caret position as user is typing
102                var start = el.selectionStart;
103                var end = el.selectionEnd;
104
105                el.value = blockNonNumberOnInput(el.value);
106                el.setSelectionRange(start, end);
107
108                // Need to explicitly set the model back to empty to prevent showing an error when there's nothing in the input
109                if(el.value === '') {
110                    ctrl.$setViewValue('');
111                }
112            }
113
114            element.on('input', onInputKeyup);
115            element.on('blur', onInputBlur);
116
117            // re-format the input value as soon as it's available so it is consistent across SF and local
118            scope.$watch(ctrl, function() {
119               element.triggerHandler('blur');
120            });
121        }
122    };
123  });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.