I want jsTIfied to be a web app for iPhones!
The rom would be converted to base64 and pasted into a box.
I need a little help though as the JS is compressed.
Yes, the JS is compressed, partly for security-by-obscurity, partly for space/speed reasons. Please let me know what changes are necessary, and I'll get our resident mobile site maintainer on the changes so we can have jsTIfied in Cemetech6mobile. Smile Can you help me/us understand the limitations of iOS's browser that this would require?
It doesn't support the file API. and the skin needs to be changed to fit screen. otherwise it would work

however this ridiculous bit of code would work for rom


Code:

  keyStr = "ABCDEFGHIJKLMNOP" +
               "QRSTUVWXYZabcdef" +
               "ghijklmnopqrstuv" +
               "wxyz0123456789+/" +
               "=";

  function encode64(input) {
     input = escape(input);
     var output = "";
     var chr1, chr2, chr3 = "";
     var enc1, enc2, enc3, enc4 = "";
     var i = 0;

     do {
        chr1 = input.charCodeAt(i++);
        chr2 = input.charCodeAt(i++);
        chr3 = input.charCodeAt(i++);

        enc1 = chr1 >> 2;
        enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
        enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
        enc4 = chr3 & 63;

        if (isNaN(chr2)) {
           enc3 = enc4 = 64;
        } else if (isNaN(chr3)) {
           enc4 = 64;
        }

        output = output +
           keyStr.charAt(enc1) +
           keyStr.charAt(enc2) +
           keyStr.charAt(enc3) +
           keyStr.charAt(enc4);
        chr1 = chr2 = chr3 = "";
        enc1 = enc2 = enc3 = enc4 = "";
     } while (i < input.length);

     return output;
  }

  function decode64(input) {
     var output = "";
     var chr1, chr2, chr3 = "";
     var enc1, enc2, enc3, enc4 = "";
     var i = 0;

     // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
     var base64test = /[^A-Za-z0-9\+\/\=]/g;
     if (base64test.exec(input)) {
        alert("There were invalid base64 characters in the input text.\n" +
              "Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='\n" +
              "Expect errors in decoding.");
     }
     input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

     do {
        enc1 = keyStr.indexOf(input.charAt(i++));
        enc2 = keyStr.indexOf(input.charAt(i++));
        enc3 = keyStr.indexOf(input.charAt(i++));
        enc4 = keyStr.indexOf(input.charAt(i++));

        chr1 = (enc1 << 2) | (enc2 >> 4);
        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
        chr3 = ((enc3 & 3) << 6) | enc4;

        output = output + String.fromCharCode(chr1);

        if (enc3 != 64) {
           output = output + String.fromCharCode(chr2);
        }
        if (enc4 != 64) {
           output = output + String.fromCharCode(chr3);
        }

        chr1 = chr2 = chr3 = "";
        enc1 = enc2 = enc3 = enc4 = "";

     } while (i < input.length);

     return unescape(output);
  }

romtxt=prompt("paste base64 encoded rom");
if(romtxt) {
   localStorage.setItem("jstified_ROM", decode64(romtxt))
   location.reload();
}
Can it copy-and-paste that much text without crashing? Smile Also, it would need a tool to convert a ROM into base-64 encoded text; do such tools exist out there on the internet?
It just DID copy and paste that much (into notes) but it froze for about 10 seconds before it decided to actually paste. (3GS jailbroken 5.1.1)

About the base64 tools it would be really easy to make in python (the only language I know really well) and then there's py2exe.

Update: I think you should actually do:


Code:

var decoded=decode64(romtxt);
localStorage.setItem("jstified_ROM", decoded)
   location.reload();


because it's a little less at once for it to deal with Smile

Update: Base64 one liner:


Code:
print open("ti83p_112.rom", "rb").read().encode("base64")


of course you can do:

Code:
python -c 'print open("ti83p_112.rom", "rb").read().encode("base64")' > b64rom.txt
Please edit your posts when it's within 24 hours. Double (and in this case triple) posting is frowned upon.

On topic, I am the Mobile site maintainer. Are you trying to get jsTIfied to work on iPhones from Cemetech or from a different website where it'll be optimized for iPhones?

I think it would make better sense to adjust the template on Cemetechs' end so it'll work on iOS devices (iPad included) and route traffic here so they can join the forums if any errors are encountered or any suggestions arise.

Safari in iOS5 and under does not support file uploads, however it will in iOS6, and for that reason jsTIfied is not available on the mobile site. I'm sure there are apps for iOS5 that support uploads but there isn't a huge iOS demographic on the site that actually use jsTIfied. If you plan to change that, I'd be more than happy to get jsTIfied templated for C6M.
comicIDIOT wrote:

Safari in iOS5 and under does not support file uploads, however it will in iOS6, and for that reason jsTIfied is not available on the mobile site. I'm sure there are apps for iOS5 that support uploads but there isn't a huge iOS demographic on the site that actually use jsTIfied. If you plan to change that, I'd be more than happy to get jsTIfied templated for C6M.

in cydia, there is one (or two) tweak to active uploads in safari Razz
helder7 wrote:
comicIDIOT wrote:

Safari in iOS5 and under does not support file uploads, however it will in iOS6, and for that reason jsTIfied is not available on the mobile site. I'm sure there are apps for iOS5 that support uploads but there isn't a huge iOS demographic on the site that actually use jsTIfied. If you plan to change that, I'd be more than happy to get jsTIfied templated for C6M.

in cydia, there is one (or two) tweak to active uploads in safari Razz


Maybe it should actually read "there isn't a huge iOS demographic on the site, and none that actually attempt to use jsTIfied."
I just tested those Cydia tweaks and they don't do anything in HTML5 Sad

Also, in iOS6 beta the file uploads only allow you to upload from the photos/videos.

I apologize for the number of posts... I kind of got excited about the project and forgot about the rules 0x5 (oops, wrong forum Smile )

About the demographic thing, if you think about it an iPhone is about the same size as a calculator... and you already have it with you!

...oh wait, it won't be allowed on tests, unless your teacher is awesome like mine (he already had DCS7 on his calculator when I was planning to show it to him Very Happy )

My original plan was to have it hosted on Cemetech anyway.

Also, you should use on{mouse|touch}{down|up} instead of javascript links. That way, you could press multiple buttons at once, AND hold them down!
parrotgeek1 wrote:
Also, in iOS6 beta the file uploads only allow you to upload from the photos/videos.


Oh, that's right. Ha.

I think jsTIfied would be most practical on a tablet screen rather than a phone because you'd have more real estate. I'll start the process of creating the templates for jsTIfied for C6M and we'll see how it looks on a phone or tablet. Though uploading will be an issue I can't resolve.
I can chime in as needed for that. Smile Are you telling me that the JS *client-side* file API works on iOS, as long as you're dealing with photos or videos?
KermMartian wrote:
I can chime in as needed for that. Smile Are you telling me that the JS *client-side* file API works on iOS, as long as you're dealing with photos or videos?


Yup. But only photos & videos stored in the devices "Camera Roll" or Photo App. Not third parties, so you won't be able to trick iOS by renaming the ISO as TI-84.jpg, unless maybe you embedded a JPEG with the ISO image (much like JPEG's can actually contain ZIP archives)
Websites don't need apps. Apps need apps.
parrotgeek1 wrote:
Update: Base64 one liner:


Code:
print open("ti83p_112.rom", "rb").read().encode("base64")


of course you can do:

Code:
python -c 'print open("ti83p_112.rom", "rb").read().encode("base64")' > b64rom.txt
Or just use the tools that are available on most GNU systems (it's part of coreutils). Smile

Code:
$ base64 mycalc.rom > mycal_b64.rom
comicIDIOT wrote:
KermMartian wrote:
I can chime in as needed for that. Smile Are you telling me that the JS *client-side* file API works on iOS, as long as you're dealing with photos or videos?


Yup. But only photos & videos stored in the devices "Camera Roll" or Photo App. Not third parties, so you won't be able to trick iOS by renaming the ISO as TI-84.jpg, unless maybe you embedded a JPEG with the ISO image (much like JPEG's can actually contain ZIP archives)
Actually, I was considering encoding the ROM as an image, which is easy to do. Do they have to be JPEGs? Is a non-lossy type like PNG an option?
I would imagine it would work all the same. I've only done it with JPEGs though.
comicIDIOT wrote:
I would imagine it would work all the same. I've only done it with JPEGs though.
Possibly, but if you're talking about files needing to have valid EXIF data, they might very well restrict it to JPEG images. Do you know of any reference where Apple discusses this sort of thing?
I don't. And I just remembered seeing that jsTIfied threw an error that my browser doesnt support DOM storage under iOS. So, this plan may very well fail before we finish.

Which in hindsight, was what you were referring to.
comicIDIOT wrote:
I don't. And I just remembered seeing that jsTIfied threw an error that my browser doesnt support DOM storage under iOS. So, this plan may very well fail before we finish.

Which in hindsight, was what you were referring to.
Well, there are at least two separate JS APIs that are important to make this work. Actually at least three, and probably more:
1) The File API, which lets JS directly use files that you "upload" without them needing to go through an external server. This is vital for jsTIfied: The ROM must never leave the client (ie, and touch the Cemetech server or go anywhere off of the client's computer) to protect us from any liability.
2) The DOM Storage system, which it seemed parrotgeek's example was using. Are you sure this isn't available in mobile Safari?
3) The Canvas system, used to draw the calculator's screen fast.
KermMartian wrote:
Well, there are at least two separate JS APIs that are important to make this work. Actually at least three, and probably more:
1) The File API, which lets JS directly use files that you "upload" without them needing to go through an external server. This is vital for jsTIfied: The ROM must never leave the client (ie, and touch the Cemetech server or go anywhere off of the client's computer) to protect us from any liability.
2) The DOM Storage system, which it seemed parrotgeek's example was using. Are you sure this isn't available in mobile Safari?
3) The Canvas system, used to draw the calculator's screen fast.


  1. I can't verify that works but I can upload photo & video under Safari in iOS6 so long as it's in the devices official Photo app.
  2. Yup. "[My] browser doesn't support DOM Storage" (iPad, iPhone iOS5). I don't have iOS6 so we'll find out then.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement