Comments breaking code
I know that bookmarklets are supposed to be single line, I have a code that have single line comments and it result in broken syntax.
if(true){ //hello
alert(1)
}
if(true){ //hello alert(1) } (Syntax error)
I suggest wrapping single line comments with multiline comments like:
/*//hello*/
good idea.. i wonder if this is something that the user should do though... if the user puts:
if (true) { // hello
}
and the software changes it to
if (true) { /* hello */
}
i think that's kind of breaking what the user is expecting. not sure, but i think this might be a wont-fix.
What do you think, @victornpb ?
Sorry for replying late, what i suggested not was replacing it but rather wrapping it so it could be unwrapped in edit mode.
You may need to add some symbols in order to correctly "parse" it with a regular expression.
//hello
/*//hello*/
replace(/\/\/(.*)/,'\/\*//$1*\\')
/*//hello*/
//hello
replace(/\/\*\/\/(.*)\*\//g, '\/\/$1')