ID:71539
 
Resolved
Fixed in 442
BYOND Version:441
Operating System:Windows XP Pro
Web Browser:Firefox 3.0.10
Status: Resolved (442)

This issue has been resolved.
Descriptive Problem Summary:

Wit the new feature I decided to give it a test using what Tom provided in the notes.

Numbered Steps to Reproduce Problem:

Login, click newtext

Code Snippet (if applicable) to Reproduce Problem:
src.key displays as src.ckey when used.
#define LP(str) list2params(list(str))
var/Preload = {"<script type="text/javascript">
function replace(v) {
document.getElementById('foo').innerHTML = v;
}
</script>
<div id="foo">This text can change.</div>
<p>And this can't.</p>
"}


mob/Login()
. = ..()
usr << output(Preload,"browser1")
mob/verb/newtext()
usr << output(LP(src.key),"browser1:replace")


Expected Results:

Browser1:
Inuyashaisbest


And this can't.
Actual Results:
inuyashaisbest

And this can't.

Does the problem occur:
Every time? Or how often?
In other games?
In other user accounts?
On other computers?

When does the problem NOT occur?

Workarounds:




EDIT
ok, found out, its not src.key doing it, no capitals show in the browser if sent like that.


EDIT2
//#define LP(str) list2params(list(str))
var/Preload = {"<script type="text/javascript">
function replace(v) {
document.getElementById('foo').innerHTML = v;
}
</script>
<div id="foo">This text can change.</div>
<p>And this can't.</p>
"}


mob/Login()
. = ..()
src << output(Preload,"browser1")
mob/verb/newtext(T as text)
src << output(,"browser1:replace(\"[T]\")")

If used like this, Capitals are shown, HOWEVER you will get a error popup when it changed

EDIT3//@#$//
var/Preload = {"
<SCRIPT LANGUAGE="JavaScript">
<!--

function stopError() {
return true;
}

window.onerror = stopError;

// -->

function replace(v) {
document.getElementById('foo').innerHTML = v;
}
</script>
<div id="foo">This text can change.</div>
<p>And this can't.</p>
"}


mob/Login()
. = ..()
src << output(Preload,"browser1")
mob/verb/newtext(T as text)
src << output(,"browser1:replace(\"[T]\")")

This works flawlessly. Although its just hiding an error (Stop error code from http://www.webreference.com/)
I can confirm this problem. The string returned by url_encode() is correct, but something happens after it is sent that drops it into lowercase.

PS: Awesome discovery in edit 2/3!

Edit: Heheh. Found something else neat. You don't need to override window.onerror if you have the function being called return another function. The args you give in output() are then passed to that function. Ex:
function UpdateText(p) {
theSpan.innerText = p;
return function(v) { alert(v); };
}
...
world << output("Ahoy", "browser:UpdateText('SOMETHING!')")


Not only does it update the span text, but it shows a message box with the word "ahoy". The following would have the very same effect:
return alert;

Of course, you can always return an empty function.
return function(){};
</<>