1function randomWord() { 2 var things = ["admiring", "adoring", "affectionate", "agitated", "amazing", 3 "angry", "awesome", "beautiful", "blissful", "bold", "boring", 4 "brave", "busy", "charming", "clever", "cool", "compassionate", "competent", 5 "confident", "dazzling", "determined", "sweet", "sad", "silly", 6 "relaxed", "romantic", "sad", "serene", "sharp", "quirky", "scared", 7 "sleepy", "stoic", "strange", "suspicious", "sweet", "tender", "thirsty", 8 "trusting", "unruffled", "upbeat", "vibrant", "vigilant", "vigorous", 9 "wizardly", "wonderful", "youthful", "zealous", "zen"]; 10 11 var names = ["austin", "borg", "bohr", "wozniak", "bose", "wu", "wing", "wilson", 12 "boyd", "guss", "jobs", "hawking", "hertz", "ford", "solomon", "spence", 13 "turing", "torvalds", "morse", "ford", "penicillin", "lovelace", "davinci", 14 "darwin", "buck", "brown", "benz", "boss", "allen", "gates", "bose", 15 "edison", "einstein", "feynman", "ferman", "franklin", "lincoln", "jefferson", 16 "mandela", "gandhi", "curie", "newton", "tesla", "faraday", "bell", 17 "aristotle", "hubble", "nobel", "pascal", "washington", "galileo"]; 18 19 var n1 = things[Math.floor(Math.random() * things.length)]; 20 var n2 = names[Math.floor(Math.random() * names.length)]; 21 return n1 + '_' + n2; 22} 23 24function copyClipboard(element) { 25 element.select(); 26 element.setSelectionRange(0, 99999); 27 document.execCommand("copy"); 28} 29 30function isValidURL(str) { 31 var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol 32 '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name 33 '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address 34 '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path 35 '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string 36 '(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator 37 return !!pattern.test(str); 38} 39 40function requestGeoPosition() { 41 // console.log('Requesting GeoLocation data from the browser...'); 42 if (navigator.geolocation) { 43 navigator.geolocation.watchPosition(showGeoPosition, logGeoLocationError, 44 {maximumAge: 600000, timeout: 8000, enableHighAccuracy: true}); 45 } else { 46 console.log('Browser does not support Geo Location'); 47 } 48} 49 50function logGeoLocationError(error) { 51 switch (error.code) { 52 case error.PERMISSION_DENIED: 53 console.log('User denied the request for GeoLocation.'); 54 break; 55 case error.POSITION_UNAVAILABLE: 56 console.log('Location information is unavailable.'); 57 break; 58 case error.TIMEOUT: 59 console.log('The request to get user location timed out.'); 60 break; 61 default: 62 console.log('An unknown error occurred.'); 63 break; 64 } 65} 66 67function showGeoPosition(position) { 68 var loc = position.coords.latitude + ',' + position.coords.longitude + ',' + position.coords.accuracy + ',' + position.timestamp; 69 console.log("Tracking geolocation for " + loc); 70 $('[name="geolocation"]').val(loc); 71} 72 73 74function preserveAnchorTagOnForm() { 75 $('#fm1').submit(function() { 76 var location = window.location; // Usamos window.location en lugar de self.document.location 77 78 var action = $('#fm1').attr('action'); 79 if (action === undefined) { 80 action = location.href; 81 } else { 82 action += location.search + encodeURIComponent(location.hash); 83 } 84 $('#fm1').attr('action', action); 85 }); 86} 87function preventFormResubmission() { 88 // Evitar fastidiar los formularios validados por otros validadores 89 $('form').not('.needs-validation').submit(function() { 90 $(':submit').attr('disabled', true); 91 var altText = $(':submit').attr('data-processing-text'); 92 if (altText) { 93 $(':submit').attr('value', altText); 94 } 95 return true; 96 }); 97} 98 99function writeToSessionStorage(value) { 100 if (typeof (Storage) !== "undefined") { 101 window.sessionStorage.removeItem("sessionStorage"); 102 window.sessionStorage.setItem('sessionStorage', value); 103 } else { 104 console.log("Browser does not support session storage for write-ops"); 105 } 106} 107 108function readFromSessionStorage() { 109 if (typeof (Storage) !== "undefined") { 110 var sessionStorage = window.sessionStorage.getItem("sessionStorage"); 111 112 window.localStorage.removeItem("sessionStorage"); 113 return sessionStorage; 114 } else { 115 console.log("Browser does not support session storage for read-ops"); 116 } 117 return null; 118} 119 120function resourceLoadedSuccessfully() { 121 $(document).ready(function() { 122 if (trackGeoLocation) { 123 requestGeoPosition(); 124 } 125 126 if ($(':focus').length === 0) { 127 $('input:visible:enabled:first').focus(); 128 } 129 130 preserveAnchorTagOnForm(); 131 preventFormResubmission(); 132 $('#fm1 input[name="username"],[name="password"]').trigger('input'); 133 $('#fm1 input[name="username"]').focus(); 134 135 $('.reveal-password').click(function(ev) { 136 if ($('.pwd').attr('type') !== 'text') { 137 $('.pwd').attr('type', 'text'); 138 $(".reveal-password-icon").removeClass("mdi mdi-eye").addClass("mdi mdi-eye-off"); 139 } else { 140 $('.pwd').attr('type', 'password'); 141 $(".reveal-password-icon").removeClass("mdi mdi-eye-off").addClass("mdi mdi-eye"); 142 } 143 ev.preventDefault(); 144 }); 145 146 147 if (typeof (jqueryReady) === 'function') { 148 jqueryReady(); 149 } 150 }); 151} 152
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.