Download pool/shard008/JavaScript/0050154_angular-smart-timeago.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard008/JavaScript/0050154_angular-smart-timeago.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard008/JavaScript/0050154_angular-smart-timeago.js
-
curl -L -o 0050154_angular-smart-timeago.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard008/JavaScript/0050154_angular-smart-timeago.js
1.24 kB
| var ngSmartTimeago = angular.module("ngSmartTimeago", []); | |
| ngSmartTimeago.constant("ngSmartTimeagoConfig", { | |
| attr: "datetime" | |
| }); | |
| ngSmartTimeago.directive("timeago", ["ngSmartTimeagoConfig", "$timeout", | |
| function(ngSmartTimeagoConfig, $timeout) { | |
| var scope_option = {}; | |
| scope_option[ngSmartTimeagoConfig.attr] = "@"; | |
| return { | |
| restrict: "E", | |
| scope: scope_option, | |
| link: function(scope, element, attrs) { | |
| var options = angular.extend( | |
| {}, | |
| ngSmartTimeagoConfig, | |
| {selector: "timeago"} | |
| ); | |
| element.timeago(options); | |
| scope.$watch(ngSmartTimeagoConfig.attr, function() { | |
| element.data("timeago").refresh(); | |
| }); | |
| // Clear timer before destroying scope | |
| scope.$on('$destroy', function() { | |
| element.data("timeago").stopTimer(); | |
| }); | |
| } | |
| }; | |
| } | |
| ]); | |
| ngSmartTimeago.filter('timeago',["smartTimeagoInstance", function(smartTimeagoInstance){ | |
| return function (input) { | |
| return smartTimeagoInstance.timeAgoInWords(input); | |
| }; | |
| }]); | |
| ngSmartTimeago.factory("smartTimeagoInstance", ["$window", function($window) { | |
| var instance = new $window.jQuery.fn.timeago.Constructor(); | |
| return instance; | |
| }]); | |