JavaScript BBCode One-liners
Name:
Anonymous
2010-05-03 23:16
(function(s) { var t = "[spoiler]", ct = "[/spoiler]", e = s.length-1; return s.length == 2 || s.length == 1 ? t + s + ct : t + s[0] + arguments.callee(s.substring(1,e)) + s[e] + ct; })();
Name:
Anonymous
2010-05-03 23:57
(function(s) {
var t = "[spoiler]",
ct = "[/spoiler]",
e = s.length-1;
return s.length == 1 || s.length == 2 ?
t + ct + s :
t + ct + s[0] + s[e] + arguments.callee(s.substring(1,e));
})();
Name:
Anonymous
2010-05-04 0:23
>>1
usually "one-liner" means one statement. your function contains two, which makes it a two-liner.
Name:
Anonymous
2010-05-04 1:13
I'm about to replace you with a very short shell script.
Name:
Anonymous
2010-05-04 10:49
>>3
Fine.
(function(s) { return s.length == 2 || s.length == 1 ? "[spoiler]" + s + "[/spoiler]" : "[spoiler]" + s[0] + arguments.callee(s.substring(1,s.length-1)) + s[s.length-1] + "[/spoiler]"; })("EXPERT ONE-LINER");
Name:
Anonymous
2010-05-04 13:17
Name:
Anonymous
2010-05-04 13:31
EXPERT SUPERSCRIPT
Name:
Anonymous
2010-05-04 18:12
Bookmarlet:
javascript:(function(s) { return s.length == 2 || s.length == 1 ? "[spoiler]" + s + "[/spoiler]" : "[spoiler]" + s[0] + arguments.callee(s.substring(1,s.length-1)) + s[s.length-1] + "[/spoiler]"; })(prompt("Text:"));
Name:
Anonymous
2013-01-19 14:37
/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.