This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setLocalJSON(objName, objValue) { | |
if (typeof objName == 'string') { | |
if (objValue.constructor == {}.constructor) { | |
localStorage.setItem('objJSON-' + objName, JSON.stringify(objValue)); | |
} else { | |
console.error('setLocalJSON accepts only json objects.'); | |
return false; | |
}; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getLocalJSON(objName) { | |
if (typeof objName == 'string') { | |
if (localStorage.getItem('objJSON-' + objName) !== null) { | |
let objValue = localStorage.getItem('objJSON-' + objName); | |
return JSON.parse(objValue); | |
} else { | |
return {}; | |
}; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// salvarComo.js v1.0.1 | |
/*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ | |
var saveAs=saveAs||function(e){"use strict";if(typeof e==="undefined"||typeof navigator!=="undefined"&&/MSIE [1-9]\./.test(navigator.userAgent)){return}var t=e.document,n=function(){return e.URL||e.webkitURL||e},r=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in r,a=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},i=/constructor/i.test(e.HTMLElement)||e.safari,f=/CriOS\/[\d]+/.test(navigator.userAgent),u=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},s="application/octet-stream",d=1e3*40,c=function(e){var t=function(){if(typeof e==="string"){n().revokeObjectURL(e)}else{e.remove()}};setTimeout(t,d)},l=function(e,t,n){t=[].concat(t);var r=t.length;while(r--){var o=e["on"+t[r]];if(typeof o==="function"){try{o.call(e,n||e)}catch(a){u(a)}}}},p=function(e){if(/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)){return n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get-time-in-string.js v1.1 | |
function getTimeInString(text, newDate = new Date()){ | |
let _fullYear = newDate.getFullYear() | |
, _month = newDate.getMonth() + 1 | |
, _date = newDate.getDate() | |
, _hours = newDate.getHours() | |
, _minutes = newDate.getMinutes() | |
, _seconds = newDate.getSeconds(); | |
_month = ( _month > 9 ? _month : '0' + _month.toString() ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String.prototype.htmlEntities = function( reverse = 0 ){ | |
let thisString = this; | |
let entities = [' ', '<', '>', '"', '\'', '¢', '£', '¥', '€', '©', '®']; | |
let htmlEntities = [' ', '<', '>', '"', ''', '¢', '£', '¥', '€', '©', '®']; | |
if( reverse == 0 ){ | |
thisString = thisString.replace(/&/g, 'ΠπϖⲠⲡhE'); | |
for(let i = 0; i < 11; i++){ | |
thisString = thisString.replace( new RegExp( entities[i] , 'g'), htmlEntities[i] ).replace(/ΠπϖⲠⲡhE/g, '&'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- to-simple-text.js v1.2.3 e RegExp --> | |
<!doctype html> | |
<html lang="pt-br"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//jquery-mask-latin-characters | |
$('input[name="nome"]').mask( | |
'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', | |
{translation:{'A':{pattern:/[ \.a-zA-ZÀÁÂÃÄÅàáâãäåÈÉÊËèéêëÌÍÎÏìíîïÒÓÔÕÖòóôõöÙÚÛÜùúûüÇçÑñ]/,optional:true}}} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//phone | |
let SPMaskBehavior=function(s){return 11===s.replace(/\D/g,'').length?'(00) 00000-0000':'(00) 0000-00009'},spOptions={onKeyPress:function(s,a,e,n){e.mask(SPMaskBehavior.apply({},arguments),n)}};$('.sp_celphones').mask(SPMaskBehavior,spOptions); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// browser-exit-confirmation.js v1 | |
window.onbeforeunload = function(event){ | |
event = event || window.event; | |
return 'Sure?'; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
regex negative set: | |
regex: [^;] | |
input: ABC;DEF | |
output: ABCDEF | |
('ABC;DEF').match(/[^;]+/g) |
OlderNewer