1(function(angular) { 2 var mi = angular.module('utils', ['ngSanitize']); 3 mi.factory('utils', utilsFactory); 4 5 function utilsFactory($sce,$location, $anchorScroll) { 6 7 8 function trustDangerousSnippet(snippet) { 9 return $sce.trustAsHtml(snippet); 10 } 11 12 function trustAsResourceUrl(url) { 13 return $sce.trustAsResourceUrl(url); 14 } 15 16 function goToTop() { 17 var old = $location.hash(); 18 $location.hash('page'); 19 20 // call $anchorScroll() 21 $anchorScroll(); 22 $location.hash(old); 23 } 24 25 function cutWord(str, maxLength) { 26 if (str != undefined) { 27 str += ' '; 28 var trimmedString = str.substr(0, maxLength); 29 trimmedString = trimmedString.substr(0, Math.min(trimmedString.length, trimmedString.lastIndexOf(" "))); 30 return trimmedString; 31 } else { 32 return ""; 33 34 } 35 } 36 37 function setQuery(q) { 38 this.q = q; 39 } 40 41 function getQuery() { 42 return this.q; 43 } 44 45 return { 46 trustDangerousSnippet: trustDangerousSnippet, 47 trustAsResourceUrl: trustAsResourceUrl, 48 goToTop: goToTop, 49 cutWord: cutWord, 50 setQuery: setQuery, 51 getQuery: getQuery 52 }; 53 54 } 55 56})(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.