1// For old browsers 2(function () { 3 var method; 4 var noop = function () { 5 }; 6 var methods = [ 7 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeline', 'timelineEnd', 'timeStamp', 'trace', 'warn' 8 ]; 9 var length = methods.length; 10 var console = (window.console = window.console || {}); 11 while (length--) { 12 method = methods[length]; 13 // Only stub undefined methods. 14 if (!console[method]) { 15 console[method] = noop; 16 } 17 } 18 19}()); 20 21$(document).ready(function () { 22 $('input[type=text]#amount_minor_unit').blur(function () { 23 $(this).val(('00' + $(this).val()).substring($(this).val().length, $(this).val().length + 2)); 24 }); 25 26 // Click event to open the tooltip 27 $('a.ringgo-tooltip-click').click(function () { 28 // Toggle the use of the show-tooltip class so that we can hide/show it 29 $(this).toggleClass('show-tooltip'); 30 }); 31 32 $('a.ringgo-tooltip,a.ringgo-tooltip-click').each(function () { 33 // Tooltips on mobile do not always stay on the screen, and therefore require a little nudge in the right direction... No pun intended 34 var offsetLeft = 15; // Set the default to 15 so that if the object doesn't exist then it will not crash 35 if ($(this).find('.tooltiptext').length) { 36 offsetLeft = $(this).find('.tooltiptext').offset().left; 37 } 38 // Loop to continuously move the tooltip to the right for as long as it is off the screen. 39 while (offsetLeft <= 10) { 40 // Retrieve the tooltip's left property 41 var leftTooltip = $(this).find('.tooltiptext').css('left'); 42 // As the tooltip is off screen, the offset is negative and therefore nudge it over to the right by 10px 43 leftTooltip = parseInt($(this).find('.tooltiptext').css('left')) + 10; 44 // Move the tooltip 45 $(this).find('.tooltiptext').css('left', leftTooltip + 'px');
46 // Retrieve the new offset so that we know when it is now on screen and that we do not loop forever 47 offsetLeft = $(this).find('.tooltiptext').offset().left; 48 } 49 }); 50 51 $('ul.error-notification p').each(function () { 52 var text = $(this).text(); 53 var regex = /(.*)(time)(.*?)(passed)(.*?)((\d+)( minutes? ))?((\d+)( seconds?))/gi; 54 if (regex.exec(text) !== null) { 55 var minutes = parseInt(text.replace(regex, '$7')); 56 var seconds = parseInt(text.replace(regex, '$10')); 57 var obj = $(this); 58 59 if (!$.isNumeric(minutes)) { 60 minutes = 0; 61 } 62 63 this.interval = setInterval(function () { 64 var newText; 65 if (minutes === 0 && seconds === 0) { 66 newText = 'Please try again'; 67 } else { 68 seconds--; 69 if (seconds < 0) { 70 minutes--; 71 seconds = 59; 72 } 73 if (minutes > 1) { 74 newText = text.replace(regex, '$1$2$3$4$5' + minutes + ' minutes ' + seconds + ' seconds'); 75 } else if (minutes === 1) { 76 newText = text.replace(regex, '$1$2$3$4$5' + minutes + ' minute ' + seconds + ' seconds'); 77 } else { 78 newText = text.replace(regex, '$1$2$3$4$5' + seconds + ' seconds'); 79 } 80 } 81 $(obj).text(newText); 82 }, 1000) 83 } 84 }); 85}); 86 87// Add Array.indexOf() capability for IE8/9 88if (!Array.prototype.indexOf) { 89 Array.prototype.indexOf = function (elt /*, from*/) { 90 var len = this.length >>> 0; 91 92 var from = Number(arguments[1]) || 0; 93 from = (from < 0) 94 ? Math.ceil(from) 95 : Math.floor(from); 96 if (from < 0) 97 from += len; 98 99 for (; from < len; from++) { 100 if (from in this && 101 this[from] === elt) 102 return from; 103 } 104 return -1; 105 }; 106} 107 108function scrollToPos($element, speed) { 109 $('html, body').animate({scrollTop: $element.offset().top}, speed); 110} 111 112 113Permits = { 114 proofByPost: function () { 115 var $proofByPost = $('input[name=PostProof]'); 116 117 if ($proofByPost.is(':checked')) { 118 hideProofs(true); 119 $('.proofaddress-wrapper').show(400); 120 $('#proofaddress').show(400); 121 $('#CurrentProofFieldset').hide(400); 122 } else { 123 showProofs(); 124 $('.proofaddress-wrapper').hide(400); 125 $('#proofaddress').hide(400); 126 $('#CurrentProofFieldset').show(400); 127 } 128 129 setTimeout(function () { 130 window.scrollTo(0, $proofByPost.offset().top - 30); 131 }, 450); 132 } 133}; 134 135 136window.Utils = { 137 138 ajaxMessageRemove: function (name) { 139 if (name) { 140 $('.ajaxMessage-' + name).remove(); 141 // Without the param remove all the messages 142 } else { 143 $('.ajaxMessage').remove(); 144 } 145 }, 146 147 ajaxMessage: function (message, name, spinner) { 148 var spinner = spinner || false; 149 150 var msg = ''; 151 152 msg += '<span class="ajaxMessage-' + name + ' ajaxMessage">'; 153 if (spinner) { 154 msg += '<img src="/images/ajax-loader.gif" alt="Loading..." /> '; 155 } 156 157 msg += message; 158 msg += '</span>'; 159 160 return msg; 161 } 162 163}; 164 165/** 166 * links acting as pseudo form submits 167 * trigger on hyperlink by adding class="pseudo-submit" 168 * allow the link to add custom params (eg to signify a different submit action etc) by adding a query string representation 169 * to the data-submit="" attribute (eg data-attribute="action=foo&additionalparam=bar") 170 */ 171setupPseudoSubmit = function () { 172 $('a.pseudo-submit').on('click', function (e) { 173 e.preventDefault(); 174 var form = $(this).closest('form'), 175 params = []; 176 177 if ($(this).data('submit')) { 178 params = $.deparam($(this).data('submit')); 179 $.each(params, function (name, value) { 180 form.append('<input type="hidden" name="' + name + '" value="' + value + '" />'); 181 }); 182 } 183 184 form.submit(); 185 }); 186} 187 188$(function () { 189 setupPseudoSubmit(); 190 191 $('.confirm-form').submit(function () { 192 return confirm("Are you sure you want to complete this action?"); 193 }); 194}); 195 196function setCookie(name, value, expiryInDays) { 197 console.log('set cookie - ' + name); 198 const date = new Date(); 199 date.setTime(date.getTime() + (expiryInDays * 24 * 60 * 60 * 1000)); 200 let expires = "expires=" + date.toUTCString(); 201 document.cookie = name + "=" + value + ";" + expires + ";path=/"; 202} 203 204function getCookie(cname) { 205 let name = cname + "=";
206 let ca = document.cookie.split(';'); 207 for (let i = 0; i < ca.length; i++) { 208 let c = ca[i]; 209 while (c.charAt(0) === ' ') { 210 c = c.substring(1); 211 } 212 if (c.indexOf(name) === 0) { 213 return c.substring(name.length, c.length); 214 } 215 } 216 return ""; 217}
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.