PageSourceSearch

https://querenciapantaneira.com.br/assets/js/functions.js?1602871612

js querenciapantaneira.com.br collected 2026-10-06 04:42:14 UTC 2,176 bytes, 98 lines download raw bytes

1/**
2 * Reduzindo o tamanho da string
3 * @param  string str
4 * @param  number ln
5 * @return string
6 */
7function strLower(str,ln){
8
9	var str = new String(str);
10
11	if(str.length > ln){
12		str = str.substr(0,ln)+'...';
13	}
14
15	return str;
16}
17
18/**
19 * Função para substituir caractesres especiais.
20 * @param {str} string
21 * @return String
22 */
23function urllimpa(str) {
24
25	var specialChars = [
26		{val:'a',let:'áàãâä'},
27		{val:'e',let:'éèêë'},
28		{val:'i',let:'íìîï'},
29		{val:'o',let:'óòõôö'},
30		{val:'u',let:'úùûü'},
31		{val:'c',let:'ç'},
32		{val:'A',let:'ÁÀÃÂÄ'},
33		{val:'E',let:'ÉÈÊË'},
34		{val:'I',let:'ÍÌÎÏ'},
35		{val:'O',let:'ÓÒÕÔÖ'},
36		{val:'U',let:'ÚÙÛÜ'},
37		{val:'C',let:'Ç'},
38		{val:'',let:'?!()'}
39	];
40	var $spaceSymbol = '-';
41	var regex;
42	var returnString = str;
43
44	for (var i = 0; i < specialChars.length; i++) {
45		regex        = new RegExp('['+specialChars[i].let+']', 'g');
46		returnString = returnString.replace(regex, specialChars[i].val);
47		regex        = null;
48	}
49
50	return returnString.replace(/[^A-Za-z0-9]+/g,$spaceSymbol).replace(/^[\-]+/,'').replace(/[\-]+$/,'').toLowerCase();
51}
52
53/**
54 * Deixar um valor float no formato monetário
55 * @param  float num numero
56 * @return string
57 */
58function numberFormat(num){
59
60	x = 0;
61
62	if(num<0)
63	{
64		num = Math.abs(num);
65		x = 1;
66	}
67
68	if(isNaN(num)) num = '0';
69		cents = Math.floor((num*100+0.5)%100);
70		num = Math.floor((num*100+0.5)/100).toString();
71
72	if(cents < 10) cents = '0' + cents;
73		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
74		num = num.substring(0,num.length-(4*i+3))+'.'
75		+num.substring(num.length-(4*i+3));
76		ret = num + ',' + cents;
77		if (x == 1) ret = ' – ' + ret;return ret;
78}
79
80/**
81 * Retorna uma imagem
82 * @param  string img  Nome da imagem
83 * @param  string wh   Resolução
84 * @param  string attr Atributos
85 * @param  boolean     Cortar imagem
86 * @return string      <img />
87 */
88function image( img, wh, attr, crop ) {
89
90  var wh = wh.split('x');
91  var scrop = '';
92
93  if ( crop ) {
94    scrop = '&cropratio='+wh[0]+':'+wh[1];
95  }
96
97  return '<img src="'+site.base+'image.php?width='+wh[0]+'&height='+wh[1]+scrop+'&image='+site.url_files+img+'" '+attr+'/>';
98}

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.