1function formatedNumberToFloat(price, currencyFormat, currencySign){ price = price.replace(currencySign, ''); if (currencyFormat === 1) 2 return parseFloat(price.replace(',', '').replace(' ', '')); else if (currencyFormat === 2) 3 return parseFloat(price.replace(' ', '').replace(',', '.')); else if (currencyFormat === 3) 4 return parseFloat(price.replace('.', '').replace(' ', '').replace(',', '.')); else if (currencyFormat === 4) 5 return parseFloat(price.replace(',', '').replace(' ', '')); return price; } 6function formatNumber(value, numberOfDecimal, thousenSeparator, virgule){ value = value.toFixed(numberOfDecimal); var val_string = value+''; var tmp = val_string.split('.'); var abs_val_string = (tmp.length === 2) ? tmp[0] : val_string; var deci_string = ('0.' + (tmp.length === 2 ? tmp[1] : 0)).substr(2); var nb = abs_val_string.length; for (var i = 1 ; i < 4; i++) 7 if (value >= Math.pow(10, (3 * i))) 8 abs_val_string = abs_val_string.substring(0, nb - (3 * i)) + thousenSeparator + abs_val_string.substring(nb - (3 * i)); if (parseInt(numberOfDecimal) === 0) 9 return abs_val_string; return abs_val_string + virgule + (deci_string > 0 ? deci_string : '00'); } 10function formatCurrency(price, currencyFormat, currencySign, currencyBlank){ var blank = ''; price = parseFloat(price.toFixed(10)); price = ps_round(price, priceDisplayPrecision); if (currencyBlank > 0) 11 blank = ' '; if (currencyFormat == 1) 12 return currencySign + blank + formatNumber(price, priceDisplayPrecision, ',', '.'); if (currencyFormat == 2) 13 return (formatNumber(price, priceDisplayPrecision, ' ', ',') + blank + currencySign); if (currencyFormat == 3) 14 return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '.', ',')); if (currencyFormat == 4) 15 return (formatNumber(price, priceDisplayPrecision, ',', '.') + blank + currencySign); if (currencyFormat == 5) 16 return (currencySign + blank + formatNumber(price, priceDisplayPrecision, '\'', '.')); return price; } 17function ps_round_helper(value, mode){ if (value >= 0.0){ tmp_value = Math.floor(value + 0.5); if ((mode == 3 && value == (-0.5 + tmp_value)) || 18 (mode == 4 && value == (0.5 + 2 * Math.floor(tmp_value / 2.0))) || 19 (mode == 5 && value == (0.5 + 2 * Math.floor(tmp_value / 2.0) - 1.0))) 20 tmp_value -= 1.0; } else { tmp_value = Math.ceil(value - 0.5); if ((mode == 3 && value == (0.5 + tmp_value)) || 21 (mode == 4 && value == (-0.5 + 2 * Math.ceil(tmp_value / 2.0))) || 22 (mode == 5 && value == (-0.5 + 2 * Math.ceil(tmp_value / 2.0) + 1.0))) 23 tmp_value += 1.0; } 24 return tmp_value; } 25function ps_log10(value){ return Math.log(value) / Math.LN10; } 26function ps_round_half_up(value, precision){ var mul = Math.pow(10, precision); var val = value * mul; var next_digit = Math.floor(val * 10) - 10 * Math.floor(val); if (next_digit >= 5) 27 val = Math.ceil(val); else 28 val = Math.floor(val); return val / mul; }
29function ps_round(value, places){ if (typeof(roundMode) === 'undefined') 30 roundMode = 2; if (typeof(places) === 'undefined') 31 places = 2; var method = roundMode; if (method === 0) 32 return ceilf(value, places); else if (method === 1) 33 return floorf(value, places); else if (method === 2) 34 return ps_round_half_up(value, places); else if (method == 3 || method == 4 || method == 5){ var precision_places = 14 - Math.floor(ps_log10(Math.abs(value))); var f1 = Math.pow(10, Math.abs(places)); if (precision_places > places && precision_places - places < 15){ var f2 = Math.pow(10, Math.abs(precision_places)); if (precision_places >= 0) 35 tmp_value = value * f2; else 36 tmp_value = value / f2; tmp_value = ps_round_helper(tmp_value, roundMode); f2 = Math.pow(10, Math.abs(places - precision_places)); tmp_value /= f2; } else { if (places >= 0) 37 tmp_value = value * f1; else 38 tmp_value = value / f1; if (Math.abs(tmp_value) >= 1e15) 39 return value; } 40 tmp_value = ps_round_helper(tmp_value, roundMode); if (places > 0) 41 tmp_value = tmp_value / f1; else 42 tmp_value = tmp_value * f1; return tmp_value; } } 43function autoUrl(name, dest){ var loc; var id_list; id_list = document.getElementById(name); loc = id_list.options[id_list.selectedIndex].value; if (loc != 0) 44 location.href = dest+loc; return ; } 45function autoUrlNoList(name, dest){ var loc; loc = document.getElementById(name).checked; location.href = dest + (loc == true ? 1 : 0); return ; } 46function toggle(e, show){ e.style.display = show ? '' : 'none'; } 47function toggleMultiple(tab){ var len = tab.length; for (var i = 0; i < len; i++) 48 if (tab[i].style) 49 toggle(tab[i], tab[i].style.display == 'none'); } 50function showElemFromSelect(select_id, elem_id){ var select = document.getElementById(select_id); for (var i = 0; i < select.length; ++i){ var elem = document.getElementById(elem_id + select.options[i].value); if (elem != null) 51 toggle(elem, i == select.selectedIndex); } } 52function openCloseAllDiv(name, option){ var tab = $('*[name='+name+']'); for (var i = 0; i < tab.length; ++i) 53 toggle(tab[i], option); } 54function toggleDiv(name, option){ $('*[name='+name+']').each(function(){ if (option == 'open'){ $('#buttonall').data('status', 'close'); $(this).hide(); } else { $('#buttonall').data('status', 'open'); $(this).show(); } }) } 55function toggleButtonValue(id_button, text1, text2){ if ($('#'+id_button).find('i').first().hasClass('process-icon-compress')){ $('#'+id_button).find('i').first().removeClass('process-icon-compress').addClass('process-icon-expand'); $('#'+id_button).find('span').first().html(text1); } else { $('#'+id_button).find('i').first().removeClass('process-icon-expand').addClass('process-icon-compress'); $('#'+id_button).find('span').first().html(text2); } } 56function toggleElemValue(id_button, text1, text2){ var obj = document.getElementById(id_button); if (obj) 57 obj.value = ((!obj.value || obj.value == text2) ? text1 : text2); } 58function addBookmark(url, title){ if (window.sidebar && window.sidebar.addPanel) 59 return window.sidebar.addPanel(title, url, ""); else if ( window.external && ('AddFavorite' in window.external)) 60 return window.external.AddFavorite( url, title); } 61function writeBookmarkLink(url, title, text, img){ var insert = ''; if (img) 62 insert = writeBookmarkLinkObject(url, title, '<img src="' + img + '" alt="' + escape(text) + '" title="' + removeQuotes(text) + '" />') + ' '; insert += writeBookmarkLinkObject(url, title, text); if (window.sidebar || window.opera && window.print || (window.external && ('AddFavorite' in window.external))) 63 $('.add_bookmark, #header_link_bookmark').append(insert); } 64function writeBookmarkLinkObject(url, title, insert){ if (window.sidebar || window.external) 65 return ('<a href="javascript:addBookmark(\'' + escape(url) + '\', \'' + removeQuotes(title) + '\')">' + insert + '</a>'); else if (window.opera && window.print) 66 return ('<a rel="sidebar" href="' + escape(url) + '" title="' + removeQuotes(title) + '">' + insert + '</a>'); return (''); } 67function checkCustomizations(){ var pattern = new RegExp(' ?filled ?'); if (typeof customizationFields != 'undefined') 68 for (var i = 0; i < customizationFields.length; i++){ if (parseInt(customizationFields[i][1]) == 1 && ($('#' + customizationFields[i][0]).html() == '' || $('#' + customizationFields[i][0]).text() != $('#' + customizationFields[i][0]).val()) && !pattern.test($('#' + customizationFields[i][0]).attr('class'))) 69 return false; } 70 return true; } 71function emptyCustomizations(){ customizationId = null; if(typeof(customizationFields) == 'undefined') return; $('.customization_block .success').fadeOut(function(){ $(this).remove(); }); $('.customization_block .error').fadeOut(function(){ $(this).remove(); }); for (var i = 0; i < customizationFields.length; i++){ $('#' + customizationFields[i][0]).html(''); $('#' + customizationFields[i][0]).val(''); } } 72function ceilf(value, precision){ if (typeof(precision) === 'undefined') 73 precision = 0; var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision); var tmp = value * precisionFactor; var tmp2 = tmp.toString(); if (tmp2[tmp2.length - 1] === 0) 74 return value; return Math.ceil(value * precisionFactor) / precisionFactor; } 75function floorf(value, precision){ if (typeof(precision) === 'undefined') 76 precision = 0; var precisionFactor = precision === 0 ? 1 : Math.pow(10, precision); var tmp = value * precisionFactor; var tmp2 = tmp.toString(); if (tmp2[tmp2.length - 1] === 0) 77 return value; return Math.floor(value * precisionFactor) / precisionFactor; } 78function setCurrency(id_currency){ $.ajax({ type: 'POST', headers: { "cache-control": "no-cache" }, url: baseDir + 'index.php' + '?rand=' + new Date().getTime(), data: 'controller=change-currency&id_currency='+ parseInt(id_currency), success: function(msg){ location.reload(true); } }); } 79function isArrowKey(k_ev){ var unicode=k_ev.keyCode? k_ev.keyCode : k_ev.charCode; if (unicode >= 37 && unicode <= 40) 80 return true; return false; } 81function removeQuotes(value){ value = value.replace(/\\"/g, ''); value = value.replace(/"/g, ''); value = value.replace(/\\'/g, ''); value = value.replace(/'/g, ''); return value; } 82function sprintf(format){ for(var i=1; i < arguments.length; i++) 83 format = format.replace(/%s/, arguments[i]); return format; } 84function fancyMsgBox(msg, title){ if (title) msg = "<h2>" + title + "</h2><p>" + msg + "</p>"; msg += "<br/><p class=\"submit\" style=\"text-align:right; padding-bottom: 0\"><input class=\"button\" type=\"button\" value=\"OK\" onclick=\"$.fancybox.close();\" /></p>"; if(!!$.prototype.fancybox) 85 $.fancybox( msg, {'autoDimensions': false, 'autoSize': false, 'width': 500, 'height': 'auto', 'openEffect': 'none', 'closeEffect': 'none'} ); } 86function fancyChooseBox(question, title, buttons, otherParams){ var msg, funcName, action; msg = ''; if (title) 87 msg = "<h2>" + title + "</h2><p>" + question + "</p>"; msg += "<br/><p class=\"submit\" style=\"text-align:right; padding-bottom: 0\">"; var i = 0; for (var caption in buttons) { if (!buttons.hasOwnProperty(caption)) continue; funcName = buttons[caption]; if (typeof otherParams == 'undefined') otherParams = 0; otherParams = escape(JSON.stringify(otherParams)); action = funcName ? "$.fancybox.close();window['" + funcName + "'](JSON.parse(unescape('" + otherParams + "')), " + i + ")" : "$.fancybox.close()"; msg += '<button type="submit" class="button btn-default button-medium" style="margin-right: 5px;" value="true" onclick="' + action + '" >'; msg += '<span>' + caption + '</span></button>' 88 i++; } 89 msg += "</p>"; if(!!$.prototype.fancybox) 90 $.fancybox(msg, {'autoDimensions': false, 'width': 500, 'height': 'auto', 'openEffect': 'none', 'closeEffect': 'none'}); } 91function toggleLayer(whichLayer, flag){ if (!flag) 92 $(whichLayer).hide(); else 93 $(whichLayer).show(); } 94function openCloseLayer(whichLayer, action){ if (!action){ if ($(whichLayer).css('display') == 'none') 95 $(whichLayer).show(); else 96 $(whichLayer).hide(); } 97 else if (action == 'open') 98 $(whichLayer).show(); else if (action == 'close') 99 $(whichLayer).hide(); } 100function updateTextWithEffect(jQueryElement, text, velocity, effect1, effect2, newClass){ if(jQueryElement.text() !== text){ if(effect1 === 'fade') 101 jQueryElement.fadeOut(velocity, function(){ $(this).addClass(newClass); if(effect2 === 'fade') $(this).text(text).fadeIn(velocity); else if(effect2 === 'slide') $(this).text(text).slideDown(velocity); else if(effect2 === 'show') $(this).text(text).show(velocity, function(){}); }); else if(effect1 === 'slide') 102 jQueryElement.slideUp(velocity, function(){ $(this).addClass(newClass); if(effect2 === 'fade') $(this).text(text).fadeIn(velocity); else if(effect2 === 'slide') $(this).text(text).slideDown(velocity); else if(effect2 === 'show') $(this).text(text).show(velocity); }); else if(effect1 === 'hide') 103 jQueryElement.hide(velocity, function(){ $(this).addClass(newClass); if(effect2 === 'fade') $(this).text(text).fadeIn(velocity); else if(effect2 === 'slide') $(this).text(text).slideDown(velocity); else if(effect2 === 'show') $(this).text(text).show(velocity); }); } } 104function dbg(value){ var active = false; var firefox = true; if (active) 105 if (firefox) 106 console.log(value); else 107 alert(value); } 108function print_r(element, limit, depth){ depth = depth?depth:0; limit = limit?limit:1; returnString = '<ol>'; for(property in element){ if (property != 'domConfig'){ returnString += '<li><strong>'+ property + '</strong> <small>(' + (typeof element[property]) +')</small>'; if (typeof element[property] == 'number' || typeof element[property] == 'boolean') 109 returnString += ' : <em>' + element[property] + '</em>'; if (typeof element[property] == 'string' && element[property]) 110 returnString += ': <div style="background:#C9C9C9;border:1px solid black; overflow:auto;"><code>' + element[property].replace(/</g, '&lt;').replace(/>/g, '&gt;') + '</code></div>'; if ((typeof element[property] == 'object') && (depth < limit)) 111 returnString += print_r(element[property], limit, (depth + 1)); returnString += '</li>'; } } 112 returnString += '</ol>'; if(depth == 0){ winpop = window.open("", "","width=800,height=600,scrollbars,resizable");
112 winpop.document.write('<pre>'+returnString+ '</pre>'); winpop.document.close(); } 113 return returnString; } 114function in_array(value, array){ for (var i in array) 115 if ((array[i] + '') === (value + '')) 116 return true; return false; } 117function isCleanHtml(content){ var events = 'onmousedown|onmousemove|onmmouseup|onmouseover|onmouseout|onload|onunload|onfocus|onblur|onchange'; events += '|onsubmit|ondblclick|onclick|onkeydown|onkeyup|onkeypress|onmouseenter|onmouseleave|onerror|onselect|onreset|onabort|ondragdrop|onresize|onactivate|onafterprint|onmoveend'; events += '|onafterupdate|onbeforeactivate|onbeforecopy|onbeforecut|onbeforedeactivate|onbeforeeditfocus|onbeforepaste|onbeforeprint|onbeforeunload|onbeforeupdate|onmove'; events += '|onbounce|oncellchange|oncontextmenu|oncontrolselect|oncopy|oncut|ondataavailable|ondatasetchanged|ondatasetcomplete|ondeactivate|ondrag|ondragend|ondragenter|onmousewheel'; events += '|ondragleave|ondragover|ondragstart|ondrop|onerrorupdate|onfilterchange|onfinish|onfocusin|onfocusout|onhashchange|onhelp|oninput|onlosecapture|onmessage|onmouseup|onmovestart'; events += '|onoffline|ononline|onpaste|onpropertychange|onreadystatechange|onresizeend|onresizestart|onrowenter|onrowexit|onrowsdelete|onrowsinserted|onscroll|onsearch|onselectionchange'; events += '|onselectstart|onstart|onstop'; var script1 = /<[\s]*script/im; var script2 = new RegExp('('+events+')[\s]*=', 'im'); var script3 = /.*script\:/im; var script4 = /<[\s]*(i?frame|embed|object)/im; if (script1.test(content) || script2.test(content) || script3.test(content) || script4.test(content)) 118 return false; return true; } 119function getStorageAvailable() { test = 'foo'; storage = window.localStorage || window.sessionStorage;
119 try { storage.setItem(test, test); storage.removeItem(test); return storage; } 120 catch (error) { return null; } } 121$(document).ready(function(){ $('form').submit(function() { $(this).find('.hideOnSubmit').hide(); }); $.fn.checkboxChange = function(fnChecked, fnUnchecked) { if ($(this).prop('checked') && fnChecked) 122 fnChecked.call(this); else if(fnUnchecked) 123 fnUnchecked.call(this); if (!$(this).attr('eventCheckboxChange')){ $(this).on('change', function() { $(this).checkboxChange(fnChecked, fnUnchecked); }); $(this).attr('eventCheckboxChange', true); } }; $('a._blank, a.js-new-window').attr('target', '_blank'); });
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.