| Server IP : 10.200.247.200 / Your IP : 216.73.217.19 Web Server : Apache System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64 User : jeremy ( 1001) PHP Version : 8.4.25 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/usa_sites/usagrantapplication.org/vx/js/ |
Upload File : |
app.directive('animateDifference',
function($timeout, $filter) {
return {
scope: {
difference: '=',
tagFilter: '=filter',
durations: '=duration'
},
link: function(scope, element, attrs, tagFilter) {
scope.display = 0;
if(scope.durations <= 0) {
scope.durations = 1;
}
scope.$watch('difference', function(newVal, oldVal) {
if(!newVal) {
newVal = 0.0001;
}
if(!oldVal) {
oldVal = 0.0001;
}
jQuery({someValue: oldVal}).animate({someValue: newVal}, {
duration: (scope.durations * 1000),
step: function(e) {
$timeout(function(){
scope.$apply(function(){
scope.display = "$"+e.toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1,");
});
});
}
});
});
},
template: function(scope, element, attrs){
return '<span>{{ display }}</span>';
}
};
}
);
app.directive('numeric', function() {
return function(scope, element, attrs) {
var keyCode = [8, 9, 13, 37, 39, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 110];
element.bind("keydown", function(event) {
if ($.inArray(event.which, keyCode) === -1) {
scope.$apply(function() {
scope.$eval(attrs.onlyNum);
event.preventDefault();
});
event.preventDefault();
}
});
};
});
app.directive('classOnScroll', function ($window) {
return {
restrict: 'A',
scope: {
offset: "@",
scrollClass: "@"
},
link: function(scope, element) {
angular.element($window).bind("scroll", function() {
if(this.pageYOffset >= parseInt(scope.offset)) {
element.addClass(scope.scrollClass);
if(scope.scrollClass.search("layer-top") > 0) {
$('#header').removeClass('dropshadow-light');
}
}
else {
element.removeClass(scope.scrollClass);
if(scope.scrollClass.search("layer-top") > 0) {
$('#header').addClass('dropshadow-light');
}
}
});
}
};
});
app.directive('spinner', [function spinnerLoad() {
return {
restrict: 'A',
link: function spinnerLoadLink(scope, elem, attrs) {
scope.$watch('ngSrc', function watchNgSrc() {
elem.hide();
var html = "";
html += '<div class="spinner relative block center-center" style="width:100%; height:100%">';
html += '<div class="relative iblock center-center" style="">';
html += '<i class="fa fa-spinner fa-lg fa-spin f16 gray"></i>';
html += '</div>';
html += '<div class="relative iblock center-center" style="width:0px; height:100%; margin-left:-3px;">';
html += '</div>';
html += '</div>';
elem.after(html);
});
elem.on('load', function onLoad() {
elem.show();
elem.next('div.spinner').remove();
});
}
};
}]);
app.directive('nullToEmpty', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$parsers.push(function(value) {
if(value == null || value == "null" || value == 'undefined') {
value = "";
}
return value;
});
}
};
});
app.directive('removePastTense', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$parsers.push(function(value) {
return '' + value.replace("Disassembled", "Disassemble");
});
}
};
});
app.directive('stringToNumber', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$parsers.push(function(value) {
return '' + value;
});
ngModel.$formatters.push(function(value) {
return parseFloat(value);
});
}
};
});
app.directive('stringToDate', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$parsers.push(function(value) {
var localDate = new Date(value);
var localTime = localDate.getTime();
var localOffset = localDate.getTimezoneOffset() * 60000;
return new Date(localTime + localOffset);
});
ngModel.$formatters.push(function(value) {
var localDate = new Date(value);
var localTime = localDate.getTime();
var localOffset = localDate.getTimezoneOffset() * 60000;
return new Date(localTime + localOffset);
});
}
};
});
app.directive('prettify', function($filter) {
return {
require: 'ngModel',
link: function(scope, $element, attrs, ngModel) {
ngModel.$parsers.push(function(value) {
var prettified = value.replace(/[\_\-]/g, " ");
prettified = (prettified + '').replace(/^([a-z])|\s+([a-z])/g, function ($1) {
return $1.toUpperCase();
});
$element.val(prettified);
return prettified;
});
}
};
});
app.directive('uglyify', function() {
return {
require: 'ngModel',
link: function(scope, $element, attrs, ngModel) {
ngModel.$parsers.push(function(value) {
var formatted = value.replace(/ /g, "_").toLowerCase();
$element.val(formatted);
});
}
};
});
app.directive('formatSimpleDate', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
ngModel.$parsers.push(function(value) {
var newDate = new Date(value);
return newDate.getFullYear()+"-"+newDate.getMonth()+"-"+newDate.getDay();
});
}
};
});
app.directive('formatDate', function ($filter) {
return {
restrict: 'A',
require: 'ngModel',
link: function (scope, element, attrs, ngModel) {
ngModel.$formatters.push(function (value) {
return new Date(value);
});
}
};
});
app.directive('phoneInput', function($filter, $browser) {
return {
require: 'ngModel',
link: function($scope, $element, $attrs, ngModelCtrl) {
var listener = function() {
var value = $element.val().replace(/[^0-9]/g, '');
$element.val($filter('tel')(value, false));
};
ngModelCtrl.$parsers.push(function(viewValue) {
return viewValue.replace(/[^0-9]/g, '').slice(0,10);
});
ngModelCtrl.$render = function() {
$element.val($filter('tel')(ngModelCtrl.$viewValue, false));
};
$element.bind('change', listener);
$element.bind('keydown', function(event) {
var key = event.keyCode;
if (key == 91 || (15 < key && key < 19) || (37 <= key && key <= 40)){
return;
}
$browser.defer(listener);
});
$element.bind('paste cut', function() {
$browser.defer(listener);
});
}
};
});
app.directive('ngElementReady', [function() {
return {
priority: -1000,
restrict: "A",
link: function($scope, $element, $attributes) {
}
};
}]);
app.filter('trustAsResourceUrl', ['$sce', function($sce) {
return function(val) {
return $sce.trustAsResourceUrl(val);
};
}]);
app.directive('errSrc', function() {
return {
link: function(scope, element, attrs) {
scope.$watch(function() {
return attrs['ngSrc'];
}, function (value) {
if (!value) {
element.attr('src', attrs.errSrc);
}
});
element.bind('error', function() {
element.attr('src', attrs.errSrc);
});
}
}
});