212
I Use This!
Very Low Activity

News

Analyzed about 16 hours ago. based on code collected about 16 hours ago.
Posted almost 14 years ago by l
lol
Posted almost 14 years ago by Plefand
Posted almost 14 years ago by Rafał Kukawski
@Dj: thanks for your feedback. Changed the function according to your suggestions. You can see the changes on github.
Posted almost 14 years ago by Dj
Note that the regex for double encode is not correct because it does not inglude html entities for uppercase characters, like Ñ replace [a-z][\da-z] with [a-zA-Z][\da-z]
Posted almost 14 years ago by Dj
Instead of replace '+' with '%20', replace it with an space directly, then is not redundant and decodeURIComponent() will has less characters to proccess
Posted about 14 years ago by Brett Zamir
Yeah. Date.parse() is now apparently treating "11" as 1911. And since Date.parse() might vary across browsers, we should I think be using our own implementation anyways rather than allowing for different behavior by browser. Thoughts?
Posted about 14 years ago by Jason
Try this in Firefox 5: console.log(strtotime("06/28/2011")); console.log(strtotime("06/28/11")); You get 1309237200 -1846522800 It isn't properly detecting 2 digit years.
Posted about 14 years ago by ?
'
Posted about 14 years ago by Dj
Why not use first regex instead the second one? (without [^>\r\n]?) return (str + '').replace(/(\r\n|\n\r|\r|\n)/g, breakTag + '$1'); return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
Posted about 14 years ago by Dj
Here one optimized version. Using recursion calling self.htmlentities() will cause to load the table again and check source values, which does not make sense because you are using the same table. So instead of recursion, use a simple loop working in ... [More] the same scope. function htmlentities (string, quote_style, charset, double_encode) { string = string !== undefined ? string + '' : ''; var hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style), char; if (hash_map === false) { return false; } if (quote_style && quote_style === 'ENT_QUOTES') { hash_map["'"] = '''; } if (!!double_encode || double_encode == null) { for (char in hash_map) { string = string.split(char).join(hash_map[char]); } return string; } else { return string.replace(/([\s\S]*?)(&(?:#\d+|#x[\da-f]+|[a-z][\da-z]*);|$)/g, function (ignore, text, entity) { for (char in hash_map) { text = text.split(char).join(hash_map[char]); } return text + entity; }); } } [Less]