1/** 2 * VegaDays Framework: Utilities 3 * 4 * @package vegadays 5 * @since vegadays 1.0 6 */ 7 8 9/* Global variables manipulations 10---------------------------------------------------------------- */ 11 12// Global variables storage 13if (typeof VEGADAYS_STORAGE == 'undefined') var VEGADAYS_STORAGE = {}; 14 15// Get global variable 16function vegadays_storage_get(var_name) { 17 return vegadays_isset(VEGADAYS_STORAGE[var_name]) ? VEGADAYS_STORAGE[var_name] : ''; 18} 19 20// Set global variable 21function vegadays_storage_set(var_name, value) { 22 VEGADAYS_STORAGE[var_name] = value; 23} 24 25// Inc/Dec global variable with specified value 26function vegadays_storage_inc(var_name) { 27 var value = arguments[1]==undefined ? 1 : arguments[1]; 28 VEGADAYS_STORAGE[var_name] += value; 29} 30 31// Concatenate global variable with specified value 32function vegadays_storage_concat(var_name, value) { 33 VEGADAYS_STORAGE[var_name] += ''+value; 34} 35 36// Get global array element 37function vegadays_storage_get_array(var_name, key) { 38 return vegadays_isset(VEGADAYS_STORAGE[var_name][key]) ? VEGADAYS_STORAGE[var_name][key] : ''; 39} 40 41// Set global array element 42function vegadays_storage_set_array(var_name, key, value) { 43 if (!vegadays_isset(VEGADAYS_STORAGE[var_name])) VEGADAYS_STORAGE[var_name] = {}; 44 VEGADAYS_STORAGE[var_name][key] = value; 45} 46 47// Inc/Dec global array element with specified value 48function vegadays_storage_inc_array(var_name, key) { 49 var value = arguments[2]==undefined ? 1 : arguments[2]; 50 VEGADAYS_STORAGE[var_name][key] += value; 51} 52 53// Concatenate global array element with specified value 54function vegadays_storage_concat_array(var_name, key, value) { 55 VEGADAYS_STORAGE[var_name][key] += ''+value; 56} 57 58 59 60/* PHP-style functions 61---------------------------------------------------------------- */ 62function vegadays_isset(obj) { 63 return typeof(obj) != 'undefined'; 64} 65 66function vegadays_empty(obj) { 67 return typeof(obj) == 'undefined' || (typeof(obj)=='object' && obj == null) || (typeof(obj)=='array' && obj.length == 0) || (typeof(obj)=='string' && vegadays_alltrim(obj)=='') || obj===0; 68} 69 70function vegadays_is_array(obj) { 71 "use strict"; 72 return typeof(obj)=='array'; 73} 74 75function vegadays_is_object(obj) { 76 "use strict"; 77 return typeof(obj)=='object'; 78} 79 80function vegadays_clone_object(obj) { 81 if (obj == null || typeof(obj) != 'object') { 82 return obj; 83 } 84 var temp = {}; 85 for (var key in obj) { 86 temp[key] = vegadays_clone_object(obj[key]); 87 } 88 return temp; 89} 90 91function vegadays_merge_objects(obj1, obj2) { 92 "use strict"; 93 for (var i in obj2) 94 if ( obj2.hasOwnProperty( i ) ) 95 obj1[i] = obj2[i]; 96 return obj1; 97} 98 99// Generates a storable representation of a value 100function vegadays_serialize(mixed_val) { 101 "use strict"; 102 var obj_to_array = arguments.length==1 || argument[1]===true; 103 104 switch (typeof(mixed_val)) { 105 106 case "number": 107 if (isNaN(mixed_val) || !isFinite(mixed_val)) 108 return false; 109 else 110 return (Math.floor(mixed_val) == mixed_val ? "i" : "d") + ":" + mixed_val + ";"; 111 112 case "string": 113 return "s:" + mixed_val.length + ":\"" + mixed_val + "\";"; 114 115 case "boolean": 116 return "b:" + (mixed_val ? "1" : "0") + ";"; 117 118 case "object": 119 if (mixed_val == null) 120 return "N;"; 121 else if (mixed_val instanceof Array) { 122 var idxobj = { idx: -1 }; 123 var map = []; 124 for (var i=0; i<mixed_val.length; i++) { 125 idxobj.idx++; 126 var ser = vegadays_serialize(mixed_val[i]); 127 if (ser) 128 map.push(vegadays_serialize(idxobj.idx) + ser); 129 } 130 return "a:" + mixed_val.length + ":{" + map.join("") + "}"; 131 } else { 132 var class_name = vegadays_get_class(mixed_val); 133 if (class_name == undefined) 134 return false; 135 var props = new Array(); 136 for (var prop in mixed_val) { 137 var ser = vegadays_serialize(mixed_val[prop]); 138 if (ser) 139 props.push(vegadays_serialize(prop) + ser); 140 } 141 if (obj_to_array) 142 return "a:" + props.length + ":{" + props.join("") + "}"; 143 else 144 return "O:" + class_name.length + ":\"" + class_name + "\":" + props.length + ":{" + props.join("") + "}"; 145 } 146 147 case "undefined": 148 return "N;"; 149 } 150 return false;
151} 152 153// Returns the name of the class of an object 154function vegadays_get_class(obj) { 155 "use strict"; 156 if (obj instanceof Object && !(obj instanceof Array) && !(obj instanceof Function) && obj.constructor) { 157 var arr = obj.constructor.toString().match(/function\s*(\w+)/); 158 if (arr && arr.length == 2) return arr[1]; 159 } 160 return false; 161} 162 163 164 165/* String functions 166---------------------------------------------------------------- */ 167 168function vegadays_in_list(str, list) { 169 "use strict"; 170 var delim = arguments[2] ? arguments[2] : '|'; 171 var icase = arguments[3] ? arguments[3] : true; 172 var retval = false; 173 if (icase) { 174 if (typeof(str)=='string') str = str.toLowerCase(); 175 list = list.toLowerCase(); 176 } 177 var parts = list.split(delim); 178 for (var i=0; i<parts.length; i++) { 179 if (parts[i]==str) { 180 retval=true; 181 break; 182 } 183 } 184 return retval; 185} 186 187function vegadays_alltrim(str) { 188 "use strict"; 189 var dir = arguments[1] ? arguments[1] : 'a'; 190 var rez = ''; 191 var i, start = 0, end = str.length-1; 192 if (dir=='a' || dir=='l') { 193 for (i=0; i<str.length; i++) { 194 if (str.substr(i,1)!=' ') { 195 start = i; 196 break; 197 } 198 } 199 } 200 if (dir=='a' || dir=='r') { 201 for (i=str.length-1; i>=0; i--) { 202 if (str.substr(i,1)!=' ') { 203 end = i; 204 break; 205 } 206 } 207 } 208 return str.substring(start, end+1); 209} 210 211function vegadays_ltrim(str) { 212 "use strict"; 213 return vegadays_alltrim(str, 'l'); 214} 215 216function vegadays_rtrim(str) { 217 "use strict"; 218 return vegadays_alltrim(str, 'r'); 219} 220 221function vegadays_padl(str, len) { 222 "use strict"; 223 var ch = arguments[2] ? arguments[2] : ' '; 224 var rez = str.substr(0,len); 225 if (rez.length < len) { 226 for (var i=0; i<len-str.length; i++) 227 rez += ch; 228 } 229 return rez; 230} 231 232function vegadays_padr(str, len) { 233 "use strict"; 234 var ch = arguments[2] ? arguments[2] : ' '; 235 var rez = str.substr(0,len); 236 if (rez.length < len) { 237 for (var i=0; i<len-str.length; i++) 238 rez = ch + rez; 239 } 240 return rez; 241} 242 243function vegadays_padc(str, len) { 244 "use strict"; 245 var ch = arguments[2] ? arguments[2] : ' '; 246 var rez = str.substr(0,len); 247 if (rez.length < len) { 248 for (var i=0; i<Math.floor((len-str.length)/2); i++) 249 rez = ch + rez + ch; 250 } 251 return rez+(rez.length<len ? ch : ''); 252} 253 254function vegadays_replicate(str, num) { 255 "use strict"; 256 var rez = ''; 257 for (var i=0; i<num; i++) { 258 rez += str; 259 } 260 return rez; 261} 262 263 264 265/* Numbers functions 266---------------------------------------------------------------- */ 267 268// Round number to specified precision. 269// For example: num=1.12345, prec=2, rounded=1.12 270// num=12345, prec=-2, rounded=12300 271function vegadays_round_number(num) { 272 "use strict"; 273 var precision = arguments[1] ? arguments[1] : 0; 274 var p = Math.pow(10, precision); 275 return Math.round(num*p)/p; 276} 277 278// Clear number from any characters and append it with 0 to desired precision 279// For example: num=test1.12dd, prec=3, cleared=1.120 280function vegadays_clear_number(num) { 281 "use strict"; 282 var precision = arguments[1] ? arguments[1] : 0; 283 var defa = arguments[2] ? arguments[2] : 0; 284 var res = ''; 285 var decimals = -1; 286 num = ""+num; 287 if (num=="") num=""+defa; 288 for (var i=0; i<num.length; i++) { 289 if (decimals==0) break; 290 else if (decimals>0) decimals--; 291 var ch = num.substr(i,1); 292 if (ch=='.') { 293 if (precision>0) { 294 res += ch; 295 } 296 decimals = precision; 297 } else if ((ch>=0 && ch<=9) || (ch=='-' && i==0)) 298 res+=ch; 299 } 300 if (precision>0 && decimals!=0) { 301 if (decimals==-1) { 302 res += '.'; 303 decimals = precision; 304 } 305 for (i=decimals; i>0; i--) 306 res +='0'; 307 } 308 //if (isNaN(res)) res = clearNumber(defa, precision, defa); 309 return res; 310} 311 312// Convert number from decimal to hex 313function vegadays_dec2hex(n) { 314 "use strict"; 315 return Number(n).toString(16); 316} 317 318// Convert number from hex to decimal 319function vegadays_hex2dec(hex) { 320 "use strict"; 321 return parseInt(hex,16); 322} 323 324 325 326/* Array manipulations 327---------------------------------------------------------------- */ 328 329function vegadays_in_array(val, thearray) { 330 "use strict"; 331 var rez = false; 332 for (var i=0; i<thearray.length-1; i++) { 333 if (thearray[i] == val) { 334 rez = true; 335 break; 336 } 337 } 338 return rez; 339} 340 341function vegadays_sort_array(thearray) { 342 "use strict"; 343 var caseSensitive = arguments[1] ? arguments[1] : false;
344 for (var x=0; x<thearray.length-1; x++) { 345 for (var y=(x+1); y<thearray.length; y++) { 346 if (caseSensitive) { 347 if (thearray[x] > thearray[y]) { 348 tmp = thearray[x]; 349 thearray[x] = thearray[y]; 350 thearray[y] = tmp; 351 } 352 } else { 353 if (thearray[x].toLowerCase() > thearray[y].toLowerCase()) { 354 tmp = thearray[x]; 355 thearray[x] = thearray[y]; 356 thearray[y] = tmp; 357 } 358 } 359 } 360 } 361 return thearray; 362} 363 364 365 366/* Date manipulations 367---------------------------------------------------------------- */ 368 369// Return array[Year, Month, Day, Hours, Minutes, Seconds] 370// from string: Year[-/.]Month[-/.]Day[T ]Hours:Minutes:Seconds 371function vegadays_parse_date(dt) { 372 "use strict"; 373 dt = dt.replace(/\//g, '-').replace(/\./g, '-').replace(/T/g, ' ').split('+')[0]; 374 var dt2 = dt.split(' '); 375 var d = dt2[0].split('-'); 376 var t = dt2[1].split(':'); 377 d.push(t[0], t[1], t[2]); 378 return d; 379} 380 381// Return difference string between two dates 382function vegadays_get_date_difference(dt1) { 383 "use strict"; 384 var dt2 = arguments[1]!==undefined ? arguments[1] : ''; 385 var short_date = arguments[2]!==undefined ? arguments[2] : true; 386 var sec = arguments[3]!==undefined ? arguments[3] : false; 387 var a1 = vegadays_parse_date(dt1); 388 dt1 = Date.UTC(a1[0], a1[1], a1[2], a1[3], a1[4], a1[5]); 389 if (dt2 == '') { 390 dt2 = new Date(); 391 var a2 = [dt2.getFullYear(), dt2.getMonth()+1, dt2.getDate(), dt2.getHours(), dt2.getMinutes(), dt2.getSeconds()]; 392 } else 393 var a2 = vegadays_parse_date(dt2); 394 dt2 = Date.UTC(a2[0], a2[1], a2[2], a2[3], a2[4], a2[5]); 395 var diff = Math.round((dt2 - dt1)/1000); 396 var days = Math.floor(diff / (24*3600)); 397 diff -= days * 24 * 3600; 398 var hours = Math.floor(diff / 3600); 399 diff -= hours * 3600; 400 var minutes = Math.floor(diff / 60); 401 diff -= minutes * 60; 402 rez = ''; 403 if (days > 0) 404 rez += (rez!='' ? ' ' : '') + days + ' day' + (days > 1 ? 's' : ''); 405 if ((!short_date || rez=='') && hours > 0) 406 rez += (rez!='' ? ' ' : '') + hours + ' hour' + (hours > 1 ? 's' : ''); 407 if ((!short_date || rez=='') && minutes > 0) 408 rez += (rez!='' ? ' ' : '') + minutes + ' minute' + (minutes > 1 ? 's' : ''); 409 if (sec || rez=='') 410 rez += rez!='' || sec ? (' ' + diff + ' second' + (diff > 1 ? 's' : '')) : 'less then minute'; 411 return rez; 412} 413 414 415 416/* Colors functions 417---------------------------------------------------------------- */ 418 419function vegadays_hex2rgb(hex) { 420 hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16); 421 return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)}; 422} 423 424function vegadays_rgb2hex(color) { 425 "use strict"; 426 var aRGB; 427 color = color.replace(/\s/g,"").toLowerCase(); 428 if (color=='rgba(0,0,0,0)' || color=='rgba(0%,0%,0%,0%)') 429 color = 'transparent'; 430 if (color.indexOf('rgba(')==0) 431 aRGB = color.match(/^rgba\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i); 432 else 433 aRGB = color.match(/^rgb\((\d{1,3}[%]?),(\d{1,3}[%]?),(\d{1,3}[%]?)\)$/i); 434 435 if(aRGB) { 436 color = ''; 437 for (var i=1; i<=3; i++) 438 color += Math.round((aRGB[i][aRGB[i].length-1]=="%"?2.55:1)*parseInt(aRGB[i])).toString(16).replace(/^(.)$/,'0$1'); 439 } else 440 color = color.replace(/^#?([\da-f])([\da-f])([\da-f])$/i, '$1$1$2$2$3$3'); 441 return (color.substr(0,1)!='#' ? '#' : '') + color; 442} 443 444function vegadays_components2hex(r,g,b) { 445 "use strict"; 446 return '#'+ 447 Number(r).toString(16).toUpperCase().replace(/^(.)$/,'0$1') + 448 Number(g).toString(16).toUpperCase().replace(/^(.)$/,'0$1') + 449 Number(b).toString(16).toUpperCase().replace(/^(.)$/,'0$1'); 450} 451 452function vegadays_rgb2components(color) { 453 "use strict"; 454 color = vegadays_rgb2hex(color); 455 var matches = color.match(/^#?([\dabcdef]{2})([\dabcdef]{2})([\dabcdef]{2})$/i); 456 if (!matches) return false; 457 for (var i=1, rgb = new Array(3); i<=3; i++) 458 rgb[i-1] = parseInt(matches[i],16); 459 return rgb; 460} 461 462function vegadays_hex2hsb(hex) { 463 "use strict"; 464 return vegadays_rgb2hsb(vegadays_hex2rgb(hex)); 465} 466 467function vegadays_hsb2hex(hsb) { 468 var rgb = vegadays_hsb2rgb(hsb); 469 return vegadays_components2hex(rgb.r, rgb.g, rgb.b); 470} 471 472function vegadays_rgb2hsb(rgb) { 473 "use strict"; 474 var hsb = {}; 475 hsb.b = Math.max(Math.max(rgb.r,rgb.g),rgb.b); 476 hsb.s = (hsb.b <= 0) ? 0 : Math.round(100*(hsb.b - Math.min(Math.min(rgb.r,rgb.g),rgb.b))/hsb.b); 477 hsb.b = Math.round((hsb.b /255)*100); 478 if ((rgb.r==rgb.g) && (rgb.g==rgb.b)) hsb.h = 0; 479 else if (rgb.r>=rgb.g && rgb.g>=rgb.b) hsb.h = 60*(rgb.g-rgb.b)/(rgb.r-rgb.b); 480 else if (rgb.g>=rgb.r && rgb.r>=rgb.b) hsb.h = 60 + 60*(rgb.g-rgb.r)/(rgb.g-rgb.b); 481 else if (rgb.g>=rgb.b && rgb.b>=rgb.r) hsb.h = 120 + 60*(rgb.b-rgb.r)/(rgb.g-rgb.r); 482 else if (rgb.b>=rgb.g && rgb.g>=rgb.r) hsb.h = 180 + 60*(rgb.b-rgb.g)/(rgb.b-rgb.r); 483 else if (rgb.b>=rgb.r && rgb.r>=rgb.g) hsb.h = 240 + 60*(rgb.r-rgb.g)/(rgb.b-rgb.g); 484 else if (rgb.r>=rgb.b && rgb.b>=rgb.g) hsb.h = 300 + 60*(rgb.r-rgb.b)/(rgb.r-rgb.g); 485 else hsb.h = 0; 486 hsb.h = Math.round(hsb.h); 487 return hsb; 488} 489 490function vegadays_hsb2rgb(hsb) { 491 var rgb = {}; 492 var h = Math.round(hsb.h); 493 var s = Math.round(hsb.s*255/100); 494 var v = Math.round(hsb.b*255/100); 495 if (s == 0) { 496 rgb.r = rgb.g = rgb.b = v; 497 } else { 498 var t1 = v; 499 var t2 = (255-s)*v/255; 500 var t3 = (t1-t2)*(h%60)/60; 501 if (h==360) h = 0; 502 if (h<60) { rgb.r=t1; rgb.b=t2; rgb.g=t2+t3; } 503 else if (h<120) { rgb.g=t1; rgb.b=t2; rgb.r=t1-t3; } 504 else if (h<180) { rgb.g=t1; rgb.r=t2; rgb.b=t2+t3; } 505 else if (h<240) { rgb.b=t1; rgb.r=t2; rgb.g=t1-t3; } 506 else if (h<300) { rgb.b=t1; rgb.g=t2; rgb.r=t2+t3; } 507 else if (h<360) { rgb.r=t1; rgb.g=t2; rgb.b=t1-t3; } 508 else { rgb.r=0; rgb.g=0; rgb.b=0; } 509 } 510 return { r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b) }; 511} 512 513function vegadays_color_picker(){ 514 "use strict"; 515 var id = arguments[0] ? arguments[0] : "iColorPicker"+Math.round(Math.random()*1000); 516 var colors = arguments[1] ? arguments[1] : 517 '#f00,#ff0,#0f0,#0ff,#00f,#f0f,#fff,#ebebeb,#e1e1e1,#d7d7d7,#cccccc,#c2c2c2,#b7b7b7,#acacac,#a0a0a0,#959595,' 518 +'#ee1d24,#fff100,#00a650,#00aeef,#2f3192,#ed008c,#898989,#7d7d7d,#707070,#626262,#555,#464646,#363636,#262626,#111,#000,' 519 +'#f7977a,#fbad82,#fdc68c,#fff799,#c6df9c,#a4d49d,#81ca9d,#7bcdc9,#6ccff7,#7ca6d8,#8293ca,#8881be,#a286bd,#bc8cbf,#f49bc1,#f5999d,' 520 +'#f16c4d,#f68e54,#fbaf5a,#fff467,#acd372,#7dc473,#39b778,#16bcb4,#00bff3,#438ccb,#5573b7,#5e5ca7,#855fa8,#a763a9,#ef6ea8,#f16d7e,' 521 +'#ee1d24,#f16522,#f7941d,#fff100,#8fc63d,#37b44a,#00a650,#00a99e,#00aeef,#0072bc,#0054a5,#2f3192,#652c91,#91278f,#ed008c,#ee105a,' 522 +'#9d0a0f,#a1410d,#a36209,#aba000,#588528,#197b30,#007236,#00736a,#0076a4,#004a80,#003370,#1d1363,#450e61,#62055f,#9e005c,#9d0039,' 523 +'#790000,#7b3000,#7c4900,#827a00,#3e6617,#045f20,#005824,#005951,#005b7e,#003562,#002056,#0c004b,#30004a,#4b0048,#7a0045,#7a0026'; 524 var colorsList = colors.split(','); 525 var tbl = '<table class="colorPickerTable"><thead>'; 526 for (var i=0; i<colorsList.length; i++) { 527 if (i%16==0) tbl += (i>0 ? '</tr>' : '') + '<tr>'; 528 tbl += '<td style="background-color:'+colorsList[i]+'"> </td>'; 529 } 530 tbl += '</tr></thead><tbody>' 531 + '<tr style="height:60px;">' 532 + '<td colspan="8" id="'+id+'_colorPreview" style="vertical-align:middle;text-align:center;border:1px solid #000;background:#fff;">' 533 + '<input style="width:55px;color:#000;border:1px solid rgb(0, 0, 0);padding:5px;background-color:#fff;font:11px Arial, Helvetica, sans-serif;" maxlength="7" />' 534 + '<a href="#" id="'+id+'_moreColors" class="iColorPicker_moreColors"></a>' 535 + '</td>' 536 + '<td colspan="8" id="'+id+'_colorOriginal" style="vertical-align:middle;text-align:center;border:1px solid #000;background:#fff;">' 537 + '<input style="width:55px;color:#000;border:1px solid rgb(0, 0, 0);padding:5px;background-color:#fff;font:11px Arial, Helvetica, sans-serif;" readonly="readonly" />' 538 + '</td>' 539 + '</tr></tbody></table>'; 540 541 jQuery(document.createElement("div")) 542 .attr("id", id) 543 .css('display','none') 544 .html(tbl) 545 .appendTo("body") 546 .addClass("iColorPickerTable") 547 .on('mouseover', 'thead td', function(){ 548 "use strict"; 549 var aaa = vegadays_rgb2hex(jQuery(this).css('background-color')); 550 jQuery('#'+id+'_colorPreview').css('background',aaa); 551 jQuery('#'+id+'_colorPreview input').val(aaa); 552 }) 553 .on('keypress', '#'+id+'_colorPreview input', function(key){ 554 "use strict"; 555 var aaa = jQuery(this).val()
556 if (aaa.length<7 && ((key.which>=48 && key.which<=57) || (key.which>=97 && key.which<=102) || (key.which===35 || aaa.length===0))) { 557 aaa += String.fromCharCode(key.which); 558 } else if (key.which == 8 && aaa.length>0) { 559 aaa = aaa.substring(0, aaa.length-1); 560 } else if (key.which===13 && (aaa.length===4 || aaa.length===7)) { 561 var fld = jQuery('#'+id).data('field'); 562 var func = jQuery('#'+id).data('func'); 563 if (func!=null && func!='undefined') { 564 func(fld, aaa); 565 } else { 566 fld.val(aaa).css('backgroundColor', aaa).trigger('change'); 567 } 568 jQuery('#'+id+'_Bg').fadeOut(500); 569 jQuery('#'+id).fadeOut(500); 570 571 } else { 572 key.preventDefault(); 573 return false; 574 } 575 if (aaa.substr(0,1)==='#' && (aaa.length===4 || aaa.length===7)) { 576 jQuery('#'+id+'_colorPreview').css('background',aaa); 577 } 578 }) 579 .on('click', 'thead td', function(e){ 580 "use strict"; 581 var fld = jQuery('#'+id).data('field'); 582 var func = jQuery('#'+id).data('func'); 583 var aaa = vegadays_rgb2hex(jQuery(this).css('background-color')); 584 if (func!=null && func!='undefined') { 585 func(fld, aaa); 586 } else { 587 fld.val(aaa).css('backgroundColor', aaa).trigger('change'); 588 } 589 jQuery('#'+id+'_Bg').fadeOut(500); 590 jQuery('#'+id).fadeOut(500); 591 e.preventDefault(); 592 return false; 593 }) 594 .on('click', 'tbody .iColorPicker_moreColors', function(e){ 595 "use strict"; 596 var thead = jQuery(this).parents('table').find('thead'); 597 var out = ''; 598 if (thead.hasClass('more_colors')) { 599 for (var i=0; i<colorsList.length; i++) { 600 if (i%16==0) out += (i>0 ? '</tr>' : '') + '<tr>'; 601 out += '<td style="background-color:'+colorsList[i]+'"> </td>'; 602 } 603 thead.removeClass('more_colors').empty().html(out+'</tr>'); 604 jQuery('#'+id+'_colorPreview').attr('colspan', 8); 605 jQuery('#'+id+'_colorOriginal').attr('colspan', 8); 606 } else { 607 var rgb=[0,0,0], i=0, j=-1; // Set j=-1 or j=0 - show 2 different colors layouts 608 while (rgb[0]<0xF || rgb[1]<0xF || rgb[2]<0xF) { 609 if (i%18==0) out += (i>0 ? '</tr>' : '') + '<tr>'; 610 i++; 611 out += '<td style="background-color:'+vegadays_components2hex(rgb[0]*16+rgb[0],rgb[1]*16+rgb[1],rgb[2]*16+rgb[2])+'"> </td>'; 612 rgb[2]+=3; 613 if (rgb[2]>0xF) { 614 rgb[1]+=3; 615 if (rgb[1]>(j===0 ? 6 : 0xF)) { 616 rgb[0]+=3; 617 if (rgb[0]>0xF) { 618 if (j===0) { 619 j=1; 620 rgb[0]=0; 621 rgb[1]=9; 622 rgb[2]=0; 623 } else { 624 break; 625 } 626 } else { 627 rgb[1]=(j < 1 ? 0 : 9); 628 rgb[2]=0; 629 } 630 } else { 631 rgb[2]=0; 632 } 633 } 634 } 635 thead.addClass('more_colors').empty().html(out+'<td style="background-color:#ffffff" colspan="8"> </td></tr>'); 636 jQuery('#'+id+'_colorPreview').attr('colspan', 9); 637 jQuery('#'+id+'_colorOriginal').attr('colspan', 9); 638 } 639 jQuery('#'+id+' table.colorPickerTable thead td') 640 .css({ 641 'width':'12px', 642 'height':'14px', 643 'border':'1px solid #000', 644 'cursor':'pointer' 645 }); 646 e.preventDefault(); 647 return false; 648 }); 649 jQuery(document.createElement("div")) 650 .attr("id", id+"_Bg") 651 .on('click', function(e) { 652 "use strict"; 653 jQuery("#"+id+"_Bg").fadeOut(500); 654 jQuery("#"+id).fadeOut(500); 655 e.preventDefault(); 656 return false; 657 }) 658 .appendTo("body"); 659 jQuery('#'+id+' table.colorPickerTable thead td') 660 .css({ 661 'width':'12px', 662 'height':'14px', 663 'border':'1px solid #000', 664 'cursor':'pointer' 665 }); 666 jQuery('#'+id+' table.colorPickerTable') 667 .css({'border-collapse':'collapse'}); 668 jQuery('#'+id) 669 .css({ 670 'border':'1px solid #ccc', 671 'background':'#333', 672 'padding':'5px', 673 'color':'#fff', 674 'z-index':999999 675 }); 676 jQuery('#'+id+'_colorPreview') 677 .css({'height':'50px'}); 678 return id; 679} 680 681function vegadays_color_picker_show(id, fld, func) { 682 "use strict"; 683 if (id===null || id==='') { 684 id = jQuery('.iColorPickerTable').attr('id'); 685 } 686 var eICP = fld.offset(); 687 var w = jQuery('#'+id).width(); 688 var h = jQuery('#'+id).height(); 689 var l = eICP.left + w < jQuery(window).width()-10 ? eICP.left : jQuery(window).width()-10 - w; 690 var t = eICP.top + fld.outerHeight() + h < jQuery(document).scrollTop() + jQuery(window).height()-10 ? eICP.top + fld.outerHeight() : eICP.top - h - 13; 691 jQuery("#"+id) 692 .data({field: fld, func: func}) 693 .css({ 694 'top':t+"px", 695 'left':l+"px", 696 'position':'absolute', 697 'z-index':100001 698 }) 699 .fadeIn(500); 700 jQuery("#"+id+"_Bg") 701 .css({ 702 'position':'fixed', 703 'z-index':100000, 704 'top':0, 705 'left':0, 706 'width':'100%', 707 'height':'100%' 708 }) 709 .fadeIn(500); 710 var def = fld.val().substr(0, 1)=='#' ? fld.val() : vegadays_rgb2hex(fld.css('backgroundColor')); 711 jQuery('#'+id+'_colorPreview input,#'+id+'_colorOriginal input').val(def); 712 jQuery('#'+id+'_colorPreview,#'+id+'_colorOriginal').css('background',def); 713} 714 715 716 717/* Cookies manipulations 718---------------------------------------------------------------- */ 719 720function vegadays_get_cookie(name) { 721 "use strict";
722 var defa = arguments[1]!=undefined ? arguments[1] : null; 723 var start = document.cookie.indexOf(name + '='); 724 var len = start + name.length + 1; 725 if ((!start) && (name != document.cookie.substring(0, name.length))) { 726 return defa; 727 } 728 if (start == -1) 729 return defa; 730 var end = document.cookie.indexOf(';', len); 731 if (end == -1) 732 end = document.cookie.length; 733 return unescape(document.cookie.substring(len, end)); 734} 735 736 737function vegadays_set_cookie(name, value, expires, path, domain, secure) { 738 "use strict"; 739 var expires = arguments[2]!=undefined ? arguments[2] : 0; 740 var path = arguments[3]!=undefined ? arguments[3] : '/'; 741 var domain = arguments[4]!=undefined ? arguments[4] : ''; 742 var secure = arguments[5]!=undefined ? arguments[5] : ''; 743 var today = new Date(); 744 today.setTime(today.getTime()); 745 if (expires) { 746 expires = expires * 1000 * 60 * 60 * 24; 747 } 748 var expires_date = new Date(today.getTime() + (expires)); 749 document.cookie = name + '=' 750 + escape(value) 751 + ((expires) ? ';expires=' + expires_date.toGMTString() : '') 752 + ((path) ? ';path=' + path : '') 753 + ((domain) ? ';domain=' + domain : '') 754 + ((secure) ? ';secure' : ''); 755} 756 757 758function vegadays_del_cookie(name, path, domain) { 759 "use strict";
760 var path = arguments[1]!=undefined ? arguments[1] : '/'; 761 var domain = arguments[2]!=undefined ? arguments[2] : ''; 762 if (vegadays_get_cookie(name)) 763 document.cookie = name + '=' + ((path) ? ';path=' + path : '') 764 + ((domain) ? ';domain=' + domain : '') 765 + ';expires=Thu, 01-Jan-1970 00:00:01 GMT'; 766} 767 768 769 770/* ListBox and ComboBox manipulations 771---------------------------------------------------------------- */ 772 773function vegadays_clear_listbox(box) { 774 "use strict"; 775 for (var i=box.options.length-1; i>=0; i--) 776 box.options[i] = null; 777} 778 779function vegadays_add_listbox_item(box, val, text) { 780 "use strict"; 781 var item = new Option(); 782 item.value = val; 783 item.text = text; 784 box.options.add(item); 785} 786 787function vegadays_del_listbox_item_by_value(box, val) { 788 "use strict"; 789 for (var i=0; i<box.options.length; i++) { 790 if (box.options[i].value == val) { 791 box.options[i] = null; 792 break; 793 } 794 } 795} 796 797function vegadays_del_listbox_item_by_text(box, txt) { 798 "use strict"; 799 for (var i=0; i<box.options.length; i++) { 800 if (box.options[i].text == txt) { 801 box.options[i] = null; 802 break; 803 } 804 } 805} 806 807function vegadays_find_listbox_item_by_value(box, val) { 808 "use strict"; 809 var idx = -1; 810 for (var i=0; i<box.options.length; i++) { 811 if (box.options[i].value == val) { 812 idx = i; 813 break; 814 } 815 } 816 return idx; 817} 818 819function vegadays_find_listbox_item_by_text(box, txt) { 820 "use strict"; 821 var idx = -1; 822 for (var i=0; i<box.options.length; i++) { 823 if (box.options[i].text == txt) { 824 idx = i; 825 break; 826 } 827 } 828 return idx; 829} 830 831function vegadays_select_listbox_item_by_value(box, val) { 832 "use strict"; 833 for (var i = 0; i < box.options.length; i++) { 834 box.options[i].selected = (val == box.options[i].value); 835 } 836} 837 838function vegadays_select_listbox_item_by_text(box, txt) { 839 "use strict"; 840 for (var i = 0; i < box.options.length; i++) { 841 box.options[i].selected = (txt == box.options[i].text); 842 } 843} 844 845function vegadays_get_listbox_values(box) { 846 "use strict"; 847 var delim = arguments[1] ? arguments[1] : ','; 848 var str = ''; 849 for (var i=0; i<box.options.length; i++) { 850 str += (str ? delim : '') + box.options[i].value; 851 } 852 return str; 853} 854 855function vegadays_get_listbox_texts(box) { 856 "use strict"; 857 var delim = arguments[1] ? arguments[1] : ','; 858 var str = ''; 859 for (var i=0; i<box.options.length; i++) { 860 str += (str ? delim : '') + box.options[i].text; 861 } 862 return str; 863} 864 865function vegadays_sort_listbox(box) { 866 "use strict"; 867 var temp_opts = new Array(); 868 var temp = new Option(); 869 for(var i=0; i<box.options.length; i++) { 870 temp_opts[i] = box.options[i].clone(); 871 } 872 for(var x=0; x<temp_opts.length-1; x++) { 873 for(var y=(x+1); y<temp_opts.length; y++) { 874 if(temp_opts[x].text > temp_opts[y].text) { 875 temp = temp_opts[x]; 876 temp_opts[x] = temp_opts[y]; 877 temp_opts[y] = temp; 878 } 879 } 880 } 881 for(var i=0; i<box.options.length; i++) { 882 box.options[i] = temp_opts[i].clone(); 883 } 884} 885 886function vegadays_get_listbox_selected_index(box) { 887 "use strict"; 888 for (var i = 0; i < box.options.length; i++) { 889 if (box.options[i].selected) 890 return i; 891 } 892 return -1; 893} 894 895function vegadays_get_listbox_selected_value(box) { 896 "use strict"; 897 for (var i = 0; i < box.options.length; i++) { 898 if (box.options[i].selected) { 899 return box.options[i].value; 900 } 901 } 902 return null; 903} 904 905function vegadays_get_listbox_selected_text(box) { 906 "use strict"; 907 for (var i = 0; i < box.options.length; i++) { 908 if (box.options[i].selected) { 909 return box.options[i].text; 910 } 911 } 912 return null; 913} 914 915function vegadays_get_listbox_selected_option(box) { 916 "use strict"; 917 for (var i = 0; i < box.options.length; i++) { 918 if (box.options[i].selected) { 919 return box.options[i]; 920 } 921 } 922 return null; 923} 924 925 926 927/* Radio buttons manipulations 928---------------------------------------------------------------- */ 929 930function vegadays_get_radio_value(radioGroupObj) { 931 "use strict"; 932 for (var i=0; i < radioGroupObj.length; i++) 933 if (radioGroupObj[i].checked) return radioGroupObj[i].value; 934 return null; 935} 936 937function vegadays_set_radio_checked_by_num(radioGroupObj, num) { 938 "use strict"; 939 for (var i=0; i < radioGroupObj.length; i++) 940 if (radioGroupObj[i].checked && i!=num) radioGroupObj[i].checked=false; 941 else if (i==num) radioGroupObj[i].checked=true; 942} 943 944function vegadays_set_radio_checked_by_value(radioGroupObj, val) { 945 "use strict"; 946 for (var i=0; i < radioGroupObj.length; i++) 947 if (radioGroupObj[i].checked && radioGroupObj[i].value!=val) radioGroupObj[i].checked=false; 948 else if (radioGroupObj[i].value==val) radioGroupObj[i].checked=true; 949} 950 951 952 953/* Form manipulations 954---------------------------------------------------------------- */ 955
956/* 957// Usage example: 958var error = vegadays_form_validate(jQuery(form_selector), { // -------- Options --------- 959 error_message_show: true, // Display or not error message 960 error_message_time: 5000, // Time to display error message 961 error_message_class: 'sc_infobox sc_infobox_style_error', // Class, appended to error message block 962 error_message_text: 'Global error text', // Global error message text (if don't write message in checked field) 963 error_fields_class: 'error_fields_class', // Class, appended to error fields 964 exit_after_first_error: false, // Cancel validation and exit after first error 965 rules: [ 966 { 967 field: 'author', // Checking field name 968 min_length: { value: 1, message: 'The author name can\'t be empty' }, // Min character count (0 - don't check), message - if error occurs 969 max_length: { value: 60, message: 'Too long author name'} // Max character count (0 - don't check), message - if error occurs 970 }, 971 { 972 field: 'email', 973 min_length: { value: 7, message: 'Too short (or empty) email address' }, 974 max_length: { value: 60, message: 'Too long email address'}, 975 mask: { value: '^([a-z0-9_\\-]+\\.)*[a-z0-9_\\-]+@[a-z0-9_\\-]+(\\.[a-z0-9_\\-]+)*\\.[a-z]{2,6}$', message: 'Invalid email address'} 976 }, 977 { 978 field: 'comment', 979 min_length: { value: 1, message: 'The comment text can\'t be empty' }, 980 max_length: { value: 200, message: 'Too long comment'} 981 }, 982 { 983 field: 'pwd1', 984 min_length: { value: 5, message: 'The password can\'t be less then 5 characters' }, 985 max_length: { value: 20, message: 'Too long password'} 986 }, 987 { 988 field: 'pwd2', 989 equal_to: { value: 'pwd1', message: 'The passwords in both fields must be equals' } 990 } 991 ] 992}); 993*/ 994 995function vegadays_form_validate(form, opt) { 996 "use strict"; 997 var error_msg = ''; 998 form.find(":input").each(function() { 999 "use strict"; 1000 if (error_msg!='' && opt.exit_after_first_error) return; 1001 for (var i = 0; i < opt.rules.length; i++) { 1002 if (jQuery(this).attr("name") == opt.rules[i].field) { 1003 var val = jQuery(this).val(); 1004 var error = false; 1005 if (typeof(opt.rules[i].min_length) == 'object') { 1006 if (opt.rules[i].min_length.value > 0 && val.length < opt.rules[i].min_length.value) { 1007 if (error_msg=='') jQuery(this).get(0).focus(); 1008 error_msg += '<p class="error_item">' + (typeof(opt.rules[i].min_length.message)!='undefined' ? opt.rules[i].min_length.message : opt.error_message_text ) + '</p>' 1009 error = true; 1010 } 1011 } 1012 if ((!error || !opt.exit_after_first_error) && typeof(opt.rules[i].max_length) == 'object') { 1013 if (opt.rules[i].max_length.value > 0 && val.length > opt.rules[i].max_length.value) { 1014 if (error_msg=='') jQuery(this).get(0).focus(); 1015 error_msg += '<p class="error_item">' + (typeof(opt.rules[i].max_length.message)!='undefined' ? opt.rules[i].max_length.message : opt.error_message_text ) + '</p>' 1016 error = true; 1017 } 1018 } 1019 if ((!error || !opt.exit_after_first_error) && typeof(opt.rules[i].mask) == 'object') { 1020 if (val.length > 0 && opt.rules[i].mask.value != '') { 1021 var regexp = new RegExp(opt.rules[i].mask.value); 1022 if (!regexp.test(val)) { 1023 if (error_msg=='') jQuery(this).get(0).focus(); 1024 error_msg += '<p class="error_item">' + (typeof(opt.rules[i].mask.message)!='undefined' ? opt.rules[i].mask.message : opt.error_message_text ) + '</p>' 1025 error = true; 1026 } 1027 } 1028 } 1029 if ((!error || !opt.exit_after_first_error) && typeof(opt.rules[i].state) == 'object') { 1030 if (opt.rules[i].state.value=='checked' && !jQuery(this).get(0).checked) { 1031 if (error_msg=='') jQuery(this).get(0).focus(); 1032 error_msg += '<p class="error_item">' + (typeof(opt.rules[i].state.message)!='undefined' ? opt.rules[i].state.message : opt.error_message_text ) + '</p>' 1033 error = true; 1034 } 1035 } 1036 if ((!error || !opt.exit_after_first_error) && typeof(opt.rules[i].equal_to) == 'object') { 1037 if (opt.rules[i].equal_to.value != '' && val!=jQuery(jQuery(this).get(0).form[opt.rules[i].equal_to.value]).val()) { 1038 if (error_msg=='') jQuery(this).get(0).focus(); 1039 error_msg += '<p class="error_item">' + (typeof(opt.rules[i].equal_to.message)!='undefined' ? opt.rules[i].equal_to.message : opt.error_message_text ) + '</p>' 1040 error = true; 1041 } 1042 } 1043 if (opt.error_fields_class != '') jQuery(this).toggleClass(opt.error_fields_class, error); 1044 } 1045 } 1046 }); 1047 if (error_msg!='' && opt.error_message_show) { 1048 var error_message_box = form.find(".result"); 1049 if (error_message_box.length == 0) error_message_box = form.parent().find(".result"); 1050 if (error_message_box.length == 0) { 1051 form.append('<div class="result"></div>'); 1052 error_message_box = form.find(".result"); 1053 } 1054 if (opt.error_message_class) error_message_box.toggleClass(opt.error_message_class, true); 1055 error_message_box.html(error_msg).fadeIn(); 1056 setTimeout(function() { error_message_box.fadeOut(); }, opt.error_message_time); 1057 } 1058 return error_msg!=''; 1059} 1060 1061 1062 1063/* Document manipulations 1064---------------------------------------------------------------- */ 1065 1066// Animated scroll to selected id 1067function vegadays_document_animate_to(id) { 1068 if (id.indexOf('#')==-1) id = '#' + id; 1069 var obj = jQuery(id).eq(0); 1070 if (obj.length == 0) return; 1071 var oft = jQuery(id).offset().top; 1072 var st = jQuery(window).scrollTop(); 1073 var speed = Math.min(1600, Math.max(400, Math.round(Math.abs(oft-st) / jQuery(window).height() * 100))); 1074 jQuery('body,html').animate( {scrollTop: oft - jQuery('#wpadminbar').height() - jQuery('header.fixedTopMenu .topWrap').height()}, speed, 'swing'); 1075} 1076 1077// Change browser address without reload page 1078function vegadays_document_set_location(curLoc){ 1079 try { 1080 history.pushState(null, null, curLoc); 1081 return; 1082 } catch(e) {}
1083 location.href = curLoc; 1084} 1085 1086// Add hidden elements init functions after tab, accordion, toggles activate 1087function vegadays_add_hidden_elements_handler(key, handler) { 1088 vegadays_storage_set_array('init_hidden_elements', key, handler); 1089} 1090 1091// Init hidden elements after tab, accordion, toggles activate 1092function vegadays_init_hidden_elements(cont) { 1093 if (VEGADAYS_STORAGE['init_hidden_elements']) { 1094 for (key in VEGADAYS_STORAGE['init_hidden_elements']) { 1095 VEGADAYS_STORAGE['init_hidden_elements'][key](cont); 1096 } 1097 } 1098} 1099 1100 1101 1102/* Browsers detection 1103---------------------------------------------------------------- */ 1104 1105function vegadays_browser_is_mobile() { 1106 var check = false; 1107 (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true})(navigator.userAgent||navigator.vendor||window.opera); 1108 return check; 1109} 1110function vegadays_browser_is_ios() { 1111 return navigator.userAgent.match(/iPad|iPhone|iPod/i) != null; 1112} 1113function vegadays_is_retina() { 1114 var mediaQuery = '(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)'; 1115 return (window.devicePixelRatio > 1) || (window.matchMedia && window.matchMedia(mediaQuery).matches); 1116} 1117 1118 1119/* Files functions 1120---------------------------------------------------------------- */ 1121 1122function vegadays_get_file_name(path) { 1123 path = path.replace(/\\/g, '/'); 1124 var pos = path.lastIndexOf('/'); 1125 if (pos >= 0) 1126 path = path.substr(pos+1); 1127 return path; 1128} 1129 1130function vegadays_get_file_ext(path) { 1131 var pos = path.lastIndexOf('.'); 1132 path = pos >= 0 ? path.substr(pos+1) : ''; 1133 return path; 1134} 1135 1136 1137 1138/* Images functions 1139---------------------------------------------------------------- */ 1140 1141// Return true, if all images in the specified container are loaded 1142function vegadays_check_images_complete(cont) { 1143 var complete = true; 1144 cont.find('img').each(function() { 1145 if (!complete) return; 1146 if (!jQuery(this).get(0).complete) complete = false; 1147 }); 1148 return complete; 1149}
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.