+ Reply
Results 1 to 10 of 10

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: [Need Help] HTML Lockscreen Help (making one)

is a discussion within the

Skinning / Themes Discussion

forums, a part of the

Design and Media For the iPhone / iPod Touch

section;
Having some issues with a lockscreen I just made. I am probably going to dig through a few I've got to see if they're including something I haven't thought of
...
  1. #1
    What's Jailbreak?
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Default [Need Help] HTML Lockscreen Help (making one)
    Having some issues with a lockscreen I just made. I am probably going to dig through a few I've got to see if they're including something I haven't thought of but I've got one problem and a few questions...

    Here's a screenshot: http://i.imgur.com/skWVDzr.jpg

    My problem:
    It's an HTML lockscreen and uses a few CSS features that I was surprised it supported - things like webkit's transforms (didn't seem to work with translate3d, but I may have been doing it wrong) and gradients. The lockscreen isn't "updating" or "refreshing" though when I hit the sleep/wake button to check it. It will update if I unlock the screen and re-lock it. Is there anything I need to be including to keep it updating in the background?

    My questions:
    Does iOS's mobile safari (which is what I assume is the engine running the HTML lockscreen?) support the new Battery Status API? ( Battery Status API ) It'd be really cool to come up with a way to retrieve the battery level from the device using javascript and use CSS to style say a fuel gauge needle to show empty or full or somewhere in between based on the value.

    Is there anything else useful I can retrieve from the device through javascript to include on a lockscreen? I've seen people pull weather based on a zip code or something in the lockscreen's HTML, but I haven't planned on including weather on my lockscreens (although I may at some point).

  2. #2
    My iPhone is a Part of Me
    Join Date
    Oct 2010
    Location
    UK
    Posts
    900
    Thanks
    5
    Thanked 68 Times in 66 Posts

    Hi, you might like to take a look at Cydget in Cydia. This enables you to have your own HTML / JavaScript code with access to Objective C libraries from your Lockscreen. A good example of how this is implemented is if you install Places Cydget which uses touch screen buttons, system clock and website images. For websites on your lockscreen, have a look at the easily alterable FaceBook Mobile Cydget. These Cydgets are stored at /System/Library/LockCydgets. You can alter the Cydget's index.html file to incorporate web cameras, weather radars and websites. The PerPageHtml Lockscreen weather themes like UniAW6.3_LS_(Accuweather).zip and HTC_UniAW6_with_forecast.rar also work, but as they are some 30MB in size, don't put them in
    /System/Library/LockCydgets as this is system memory, instead create a .cydget link to them.

  3. The Following User Says Thank You to DC_Dave For This Useful Post:

    Jato_BZ (06-08-2013)

  4. #3
    What's Jailbreak?
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Any ideas on why my lockscreen isn't updating the time while its "asleep?" I have to unlock and relock it for it to display the current time.

  5. #4
    My iPhone is a Part of Me
    Join Date
    Oct 2010
    Location
    UK
    Posts
    900
    Thanks
    5
    Thanked 68 Times in 66 Posts

    Hi, your car theme would be good when driving, also would be clever to use GPS to match the car speed. If you post your code, maybe someone might be able to figure out your update issue for you.

  6. #5
    What's Jailbreak?
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 3 Times in 2 Posts

    Yeah I was going to but it got late last night. Here's the LockBackground.html

    Auto lockscreen - Pastebin.com

  7. #6
    My iPhone is a Part of Me
    Join Date
    Oct 2010
    Location
    UK
    Posts
    900
    Thanks
    5
    Thanked 68 Times in 66 Posts

    Hi, looking at other themes, some use the setInterval command to refresh the time. (1000 = 1second)
    In your code, you could add

    setInterval(myTime, 1000);

    where myTime is the name of your function to fetch the current time.
    So from your Pastebin


    <script type="text/javascript">

    myTime();

    setInterval(myTime, 1000);

    function myTime() {

    var currentTime = new Date();
    var hours = currentTime.getHours();
    var minutes = currentTime.getMinutes();

    if (minutes < 10)
    minutes = "0" + minutes;

    var suffix = "AM";

    if (hours >= 12) {
    suffix = "PM";
    hours = hours - 12;
    }

    if (hours == 0) {
    hours = 12;
    }

    document.write("<h1 class=time>" + hours + "." + minutes + " " , "</h1>");
    }
    </script>


    If use iFile web viewer, the above patch writes the time every second, not too sure how you get it to work on the lockscreen correctly though.

  8. #7
    What's Jailbreak?
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 3 Times in 2 Posts

    thanks for your suggestions so far - I'll be giving that a shot and posting an edit/update on whether or not it worked. I tried using a meta tag refresh interval but that didn't work.


    update: the screen just blacks out after 1 second now... still hunting
    Last edited by bokou; 06-08-2013 at 06:53 PM.

  9. #8
    King Kong ain't got nothing on me! King_O_Hill's Avatar
    Join Date
    Apr 2011
    Location
    USA
    Posts
    8,130
    Thanks
    37,540
    Thanked 15,125 Times in 5,498 Posts

    You are building this like it is for a computer browser instead of for an iPhone. Just post the entire widget here and maybe we can help you.
    Widget-Weather App Now Available! Also with MyLocation Support!
    Check out the thread here - Widget-Weather
    To install the Widget-Weather app, just go to Cydia and install. This will also remove MyLocation, as it is built in!
    Want to protect your JailBreak! Add this repo http://cydia.myrepospace.com/iLEXiNFO/ & Install "iLEX R.A.T."
    It will allow you to bring your phone back to a fresh jailbroken state!

  10. The Following User Says Thank You to King_O_Hill For This Useful Post:

    Jato_BZ (06-09-2013)

  11. #9
    My iPhone is a Part of Me
    Join Date
    Oct 2010
    Location
    UK
    Posts
    900
    Thanks
    5
    Thanked 68 Times in 66 Posts

    Quote Originally Posted by bokou View Post
    update: the screen just blacks out after 1 second now... still hunting
    Hi, yes i got stuck on that too, if you open your LockBackground.html with iFiles web viewer, you can see the time increase every second though. Im sure these experienced guys here can help more than me.

  12. #10
    What's Jailbreak?
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 3 Times in 2 Posts

    King o hill, it's an HTML lockscreen - it doesn't use widgets or anything like that. It's structured with HTML, styled with CSS and uses Javascript for functions like pulling and displaying time, etc.

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts