1(function (angular) { 2 'use strict'; 3 angular.module('ngstars', []) 4 .directive('ngstars', ['$compile', '$http', function ($compile, $http) { 5 return { 6 restrict: 'EA', 7 scope: { 8 fieldId: "@", 9 fname: "@", 10 starsno: "=", 11 step: "=", 12 size: "@", 13 minimumrating: "=", 14 maximumrating: "=", 15 selectedstarcolor: "@", 16 unselectedstarcolor: "@", 17 clearcaption: "@", 18 starcaptions: "=", 19 starcaptionclasses: "=", 20 showcaption: "@", 21 showclear: "@", 22 value: "=", 23 isEnabled: "=", 24 onStarsChange: "&", 25 glyphicon: "=", 26 }, 27 link: function (scope, element, attrs, ctrls) { 28 // parse data for starcaption and starcaption clases 29 var starCap = {}; 30 if (scope.starcaptions) 31 $.each(scope.starcaptions, function (i) { 32 starCap[scope.starcaptions[i].value] = scope.starcaptions[i].name; 33 }); 34 35 var starCapCls = {}; 36 if (scope.starcaptionclasses) 37 $.each(scope.starcaptionclasses, function (i) { 38 starCapCls[scope.starcaptionclasses[i].value] = scope.starcaptionclasses[i].name; 39 }); 40 41 // init 42 element.rating({ 43 stars: scope.starsno ? scope.starsno : dnnsfjQuery.fn.rating.defaults.stars, 44 min: scope.minimumrating ? scope.minimumrating : 0 , 45 max: scope.maximumrating ? scope.maximumrating : (scope.starno ? scope.starno : dnnsfjQuery.fn.rating.defaults.stars), 46 step: scope.step ? scope.step : 0.5 , 47 size: scope.size ? scope.size : dnnsfjQuery.fn.rating.defaults.size, 48 showClear: scope.showclear == 'True' ? false : true, 49 disabled: !scope.isEnabled, 50 showCaption: scope.showcaption == 'True' ? false : true, 51 starCaptionClasses: starCapCls ? starCapCls : dnnsfjQuery.fn.rating.defaults.starCaptionClasses, 52 starCaptions: starCap ? starCap : dnnsfjQuery.fn.rating.defaults.starCaptions, 53 glyphicon: scope.glyphicon, 54 clearCaption: scope.clearcaption ? scope.clearcaption : dnnsfjQuery.fn.rating.defaults.clearCaption 55 }); 56 57 element.attr('data-val', scope.value || scope.minimumrating || 0); 58 element.parent().css('color', scope.unselectedstarcolor) 59 element.parent().children().first().css('color', scope.selectedstarcolor) 60 61 // onchange 62 $('[name="' + element[0].name + '"]').on('rating.change', function (event, value, caption) { 63 scope.onStarsChange({ 'value': value, 'name': scope.fname }); 64 $(this).attr('data-val', value); 65 $(this).attr('value', value); 66 }); 67 } 68 }; 69 }]) 70})(window.dnnsfAngular15 || window.angular);
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.