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
//I found it @ util.js / chrome 16. | |
function parseQueryParams(location) { | |
var params = {}; | |
var query = unescape(location.search.substring(1)); | |
var vars = query.split("&"); | |
for (var i=0; i < vars.length; i++) { | |
var pair = vars[i].split("="); | |
params[pair[0]] = pair[1]; | |
} |
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
//useful snippet to organize website code or widget code. | |
var MySite = {} | |
MySite.setupDOM = function(){ | |
//dom manipulation, etc... | |
} | |
MySite.setupEvents = function(){ | |
//binds, event handlers, event listeners |
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
getOrCreateDialog = function (id) { | |
$box = $('#' + id); | |
if (!$box.length) { | |
$box = $('<div id="' + id + '"><p></p></div>').hide().appendTo('body'); | |
} | |
return $box; | |
} | |
customAlert(message, title, options, callback){ | |
callback = callback || function(){}; |
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
validarCNPJ = function (cnpj) { | |
var numeros, | |
digitos, | |
soma, | |
i, | |
resultado, | |
pos, | |
tamanho, | |
digitos_iguais; |
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
var identificarResolucao = function() { | |
resolucao = "res" + screen.width; | |
areaVisivel = $("body").width(); | |
//$("#componente").prepend("<br>"+ resolucao); | |
classe = 'res'; | |
if (areaVisivel < 800) classe += '800'; | |
else if (areaVisivel < 960) classe += '960'; | |
else if (areaVisivel < 1024) classe += '1024'; | |
else if (areaVisivel < 1088) classe += '1088'; |
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
in_array = function(needle, haystack, argStrict) { | |
// Checks if the given value exists in the array | |
var found = false, | |
key, strict = !! argStrict; | |
for (key in haystack) { | |
if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) { | |
found = true; | |
break; | |
} |
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
getTweets = function(alvo, usuario, qtdMensagens){ | |
var o = {} | |
o.qtdMensagens = qtdMensagens; | |
o.caixaTwitter = $("#" + alvo); | |
o.caixaTwitter.append("<li><a href='#'>carregando tweets...</a></li>"); | |
$.jTwitter(usuario, o.qtdMensagens, function(data){ | |
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
$.extend({ | |
URLEncode: function (c) { | |
var o = ''; | |
var x = 0; | |
c = c.toString(); | |
var r = /(^[a-zA-Z0-9_.]*)/; | |
while (x < c.length) { | |
var m = r.exec(c.substr(x)); | |
if (m != null && m.length > 1 && m[1] != '') { | |
o += m[1]; |
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 enableScrollbar(event, ui) { | |
window.setTimeout(function() { | |
$(document) | |
.unbind('mousedown.dialog-overlay') | |
.unbind('mouseup.dialog-overlay'); | |
}, 100); | |
} | |
//when calling a dialog, override the open method | |
$(...).dialog({ |
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
kill = function (e) { | |
if (!e) e = window.event; | |
(e.stopPropagation) ? e.stopPropagation() : e.cancelBubble = true; | |
(e.preventDefault) ? e.preventDefault() : e.returnValue = false; | |
return false; | |
} |
OlderNewer