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
/* | |
Syntax : Array importCSV(String text) | |
example : importCSV('ab,cd,ed\n"ab","cd","ef"') | |
*/ | |
function importCSV(text){ | |
text = text.replace(/^[\n\r]+/, "").replace(/[\n\r]+$/, "") + "\n"; | |
var table = [], | |
row = [], | |
indbl = false, | |
start = 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
function toASCII(str){ | |
var newstr = "", | |
graph_table = { | |
"\u0132" : "IJ", | |
"\u0152" : "OE", | |
"\u00C6" : "AE", | |
"\u00D8" : "O" | |
} | |
str = str.normalize("NFD"); | |
for(var i=0, code, char;i<str.length;i++){ |
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
/* | |
Returns a [R,G,B] array. [R,G,B] are [0,255] numbers. [h,s,l] are [0,1] numbers | |
*/ | |
function(h, s, l){ | |
s=l < 0.5 ? l * (1 + s) : l + s - l * s, | |
l = 2 * l - s; | |
return [h+1/3,h,h-1/3].map(function(t,c){ | |
return (((c=s-l,t+=t<0?1:t>1?-1:0)<1/6?l+6*c*t:.5>t?s:t<2/3?l+c*(2/3-t)*6:l)*255)+.5|0; | |
}); | |
} |
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
/* | |
Returns a [R,G,B,A] array. [R,G,B] are [0,255] numbers and A is a [0,1] number | |
*/ | |
function(a){ | |
return [ | |
( v=255, // We set a variable inside the array to save "var" | |
c = "0x"+ // Convert from hexadecimal to decimal | |
/\w{8}/.exec( // We take the first eight alphanumerical characters | |
a.replace( // We convert short hexadecimal to long hexadecimal (RGB(A)->RRGGBB(AA)) | |
!a[6] && /./g, // We only convert if it's a short hexadecimal |
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
/**** | |
This function create a matrix of cells from a table. It take care of merged cells (cells with "rowspan>1" or "colspan>1" attributes). | |
====| Syntax |==== | |
@Array getMatrixOfCells(@TableElement table, [Optional @Boolean alwaysInterpretZeroRowSpan]) | |
table : A <TABLE> HTML Element | |
alwaysInterpretZeroRowSpan : Optional (default : false). If set to true, "rowspan=0" attributes are always interpreted as if it was implemented in the browser (even if it's not) |