1. chenlao's Avatar
    Thank you so much Jake for this updating.
    I installed gAPI+ and GL+, tried following js and not working:

    Code:
    	if (window.groovyAPI) {
    		document.getElementById("div1").innerHTML = "has groovyapi.";
    		//this is working
    	}
    
    	//use api from groovyapi+
    	//groovyAPI( 'getWidgetWeather', function(data) {	//not working either
    		
    	groovyAPI.do(
        		{read: "/private/var/mobile/Documents/widgetweather.xml" },
        		function(data) {
    		
    			document.getElementById("div2").innerHTML = "widgetweather.xml loaded.";
    			//not working
    
    		}
    	);
    Is anyone else got same issue, or any example I can learn more? Thanks in advance.

    BTW, I made my theme working in my ip6/ios8.1, with GL 1.7.3. Animation been turned off, and had crash around every 2 or 3 days, but got lots of Jetsam events. And several crashes per day if turn on animation. I do hope the new GL+ be stable.
    2014-12-26 11:31 PM
  2. GroovyCarrot's Avatar
    Did you not read any of the last 2-3 pages bro? This is really an Alpha release for devs and experienced power users only at this point. I don't foresee any kind of Cydia release until after 8.2 is released and then who knows, it may never hit Cydia.
    Yeah I'm really just waiting for feedback, depending on how big the voice is here - it may be a case that no one even looks at it until it goes onto Cydia
    2014-12-27 12:03 AM
  3. GroovyCarrot's Avatar
    Thank you so much Jake for this updating.
    I installed gAPI+ and GL+, tried following js and not working:

    Code:
    	if (window.groovyAPI) {
    		document.getElementById("div1").innerHTML = "has groovyapi.";
    		//this is working
    	}
    
    	//use api from groovyapi+
    	//groovyAPI( 'getWidgetWeather', function(data) {	//not working either
    		
    	groovyAPI.do(
        		{read: "/private/var/mobile/Documents/widgetweather.xml" },
        		function(data) {
    		
    			document.getElementById("div2").innerHTML = "widgetweather.xml loaded.";
    			//not working
    
    		}
    	);
    Is anyone else got same issue, or any example I can learn more? Thanks in advance.

    BTW, I made my theme working in my ip6/ios8.1, with GL 1.7.3. Animation been turned off, and had crash around every 2 or 3 days, but got lots of Jetsam events. And several crashes per day if turn on animation. I do hope the new GL+ be stable.
    Sorry that was poor on my part as it's:
    Code:
    groovyAPI.do(
        'getWidgetWeather',
        function(data) {
            // Handle data
        }
    );
    And you don't need to use the full path for {read:} as it looks only in the documents directory; for safety as the OS would only normally let you do this - in 1.0 though there is probably nothing stopping you from using ../../ to read files outside of the documents directory, but I will fix that bug before anything is publicly released

    This should work:
    Code:
    groovyAPI.do(
        {read: "widgetweather.xml"},
        function (file) {
             // Handle file.
        }
    );
    To elaborate a bit, groovyAPI is a JavaScript Object added to your theme, much like jQuery, and do() is a function property which is a wrapper of the WebKit communication API, which is quite long, a little excessive and wouldn't normally allow you to pass a function directly to it for execution
    Last edited by GroovyCarrot; 2014-12-27 at 12:13 AM.
    2014-12-27 12:08 AM
  4. chenlao's Avatar
    Thank you and groovyAPI.do('getWidgetWeather', function(data) {...)) is working.
    Looks like some old code of finding data from xml need change to reading from json, but that's not a big deal.

    One more thing is viewpoint is different now. If you have element with width=300 and left=100, the document width is 400 now. So this kind of css needs to fix as well.

    Happy holidays.
    Last edited by chenlao; 2014-12-27 at 02:00 AM.
    2014-12-27 12:50 AM
  5. Werty12's Avatar
    Did you not read any of the last 2-3 pages bro? This is really an Alpha release for devs and experienced power users only at this point. I don't foresee any kind of Cydia release until after 8.2 is released and then who knows, it may never hit Cydia.
    Ooohhhhh ok. So I'll just post about the errors I'm getting.
    2014-12-27 02:44 AM
  6. King_O_Hill's Avatar
    Ooohhhhh ok. So I'll just post about the errors I'm getting.
    Yes please bro! But what we don't want to see is "this doesn't work". We're looking for real errors that you may find. Thanks for understanding.

    Check out WW3 for iOS 9/10 - Widget-Weather 3.0
    2014-12-27 02:55 AM
  7. King_O_Hill's Avatar
    Thank you and groovyAPI.do('getWidgetWeather', function(data) {...)) is working.
    Looks like some old code of finding data from xml need change to reading from json, but that's not a big deal.

    One more thing is viewpoint is different now. If you have element with width=300 and left=100, the document width is 400 now. So this kind of css needs to fix as well.

    Happy holidays.
    Hey there bro, don't be offended, but you are quite knowledgable for someone that just signed up a few hours ago. Where have you been all this time? If you don't mind me asking, what's your iOS experience?

    Check out WW3 for iOS 9/10 - Widget-Weather 3.0
    2014-12-27 03:46 AM
  8. chenlao's Avatar
    Hey there bro, don't be offended, but you are quite knowledgable for someone that just signed up a few hours ago. Where have you been all this time? If you don't mind me asking, what's your iOS experience?
    Not at all. Actually I don't know much about IOS development, but good at html/js cause I'm doing java/web development (after many years C/C++ programming).
    I was tired with iphone's original lockscreen and found GroovyLock is exactly what I want, and found this thread, and then I modified one theme to show my album - it's kind of reminder for myself that still have many places to go.
    GroovyLock (HTML LockScreen Platform)-img_1892.png
    (picture I took on road to Antolope Canyon)

    Signed up today is because I'm off today, Glad found GL+ for IOS8 here, and I'd like give a try, after got ip6 couple weeks ago.

    BTW, it's good for developers to discuss the implementation, or different solutions. But for end user, I think usability and stability of tweak are most important.
    2014-12-27 06:03 AM
  9. chevymusclecar's Avatar
    Awesome Chen! Is that running on GL+? Would be cool if you can post it?
    2014-12-27 06:20 AM
  10. NewD's Avatar
    Hey guys and gals. Though I put this in the UniAW7 thread.. it probably more accurately should go here. So I'll repost for those adventuresome Intermediate Coders who want to dive into being able to use the advantages of the GL+.

    Our awesome GroovyLock developer, Jake (GroovyCarrot) is so brilliant, so he often speaks in 'developer speak' which though completely accurate doesn't always give 'me' enough details or exact examples - broken down for me to 'chew on' then apply...

    If you want to attempt to do some converting to GL+ stability, let me give you a few tips... that I've discovered with the help of looking at Dacal, Ian and Jake's coding in the new UniAW7rc10_Groovylock widget Ian allowed me to post over in the UniAW7 thread. These insights are gleaned also from conferring with my superb sounding boards, ChevyMuscleCar and King_O_Hill....

    First -- do NOT attempt to mess with any mods based on the 02_WidgetWeather_Base. It's pretty complex and Dacal and Chevy and Eric and Simon are working on that one in Dacal's absence for the holidays - and in time they might come up with a prototype for us.

    But several other mods are based on UniAW7_rc9 and 10.. in their design. They can be more 'easily' converted.. And I use that word 'easily' a little too freely... None of this is easy... the main thing to remember is that only widgets that are CURRENTLY CODED to read the new WidgetWeather2's xml file are even candidates for being converted. Older WW1, UniAW6 or Locale/WOEID-based widgets by Mone, Oldster and Schnedi and even the Lockscreen conversions to GroovyLock by June'siPhone's LockBuilder aren't candidates for use any time soon with this new method..

    Okay... so when working with a newer UniAW7-based widget (Dacal's code) that uses WW2 widgetweather.xml files... You look for 3 areas of code in the main.js files...

    STEP 1A---
    The first area of the code that needs to be updated is the 'parsing' area, where objects are established.. You need to replace these lines in 'function updateWeather ()':
    Code:
    jQuery.get('file:///private/var/mobile/Documents/widgetweather.xml', function(data) {
        $(data).find('currentcondition').each( function() {
            obj.temp =$(this).find('temp').text();
            obj.chill =$(this).find('chill').text();
            //-----however many more data objects are in your mod here----
    ..with these lines in the same 'function updateWeather ()' area - note the 'JQuery' and '$(data).find' lines are gone:
    Code:
        obj.temp = data.xml.currentcondition.temp.value;
        obj.chill = data.xml.currentcondition.chill.value;
        //-----however many more data objects you need for your mod here----
    STEP 1B---
    Then replace:
    Code:
    function updateWeather();
    ..with..:
    Code:
    function updateWeather(data);
    STEP 2---
    Add a new function with the call to GroovyAPI right above the 'function init()' line..
    Code:
    function getWeatherData () {
    // Tell GL+ to pass the xml data into the updateWeather function:
    if (XML_TEST == false) {
    groovyAPI.do("getWidgetWeather", "updateWeather");
    } else {
    $.getJSON("json.txt", function(data) {
    updateWeather(data);
    });
    }
    }

    STEP 3---
    In this final step you'll need to call for Step 2's new function, 'getWeatherData()', in the area where you see the weather source switch. So change this:
    Code:
    switch(WeatherSource) {
        case "widgetweather":
        updateWeather();
        break;
    to this:
    Code:
    switch(WeatherSource) {
        case "widgetweather":
        getWeatherData();
        break;
    As with all coding updates.. there's some trial and error.... But what Dacal referred to as 'easy conversions' (for him LOL!) are what I've outlined above. Good luck, Intermediate coders!
    Last edited by NewD; 2014-12-27 at 08:42 PM.
    2014-12-27 08:11 AM
  11. jawonder's Avatar
    Very nice NewdestinyX, gonna play with some LS and SB today .
    2014-12-27 12:59 PM
  12. TiLT1oNE's Avatar
    Thank you and groovyAPI.do('getWidgetWeather', function(data) {...)) is working.
    Looks like some old code of finding data from xml need change to reading from json, but that's not a big deal.

    One more thing is viewpoint is different now. If you have element with width=300 and left=100, the document width is 400 now. So this kind of css needs to fix as well.

    Happy holidays.
    Nice to have you here bro
    2014-12-27 05:09 PM
  13. NewD's Avatar
    Not at all. Actually I don't know much about IOS development, but good at html/js cause I'm doing java/web development (after many years C/C++ programming).
    <snip>
    Signed up today is because I'm off today, Glad found GL+ for IOS8 here, and I'd like give a try, after got ip6 couple weeks ago.

    BTW, it's good for developers to discuss the implementation, or different solutions. But for end user, I think usability and stability of tweak are most important.
    Welcome to the forum, Chenlao. Will be great to have another person versed in html/css/js around! Again, welcome!
    2014-12-27 05:24 PM
  14. GroovyCarrot's Avatar
    Just to point out a bug with the forum when you write ", " it seems to get removed in the code tags. What Grant meant was:
    Code:
    groovyAPI.do('getWidgetWeather','updateWeather');
    And yes this is a pretty good demonstration that you can actually pass through a string as the callback parameter to execute a function you've already defined. Otherwise you can pass in a function and gAPI+ will know what to do with it.

    Something else worth mentioning. If you want UIKit compatibility, that is to say that gAPI won't be available but at least you can read a local file as you would normally, you can always just check if the groovyAPI var is available in your script:

    Code:
    var weather = new Object();
    if (groovyAPI) {
        // WebKit specific code here.
        weather.update = function() {
            groovyAPI.do(
                'getWidgetWeather',
                function(data) {
                    // Print out data to the DOM.
                    $('body').html('<pre>'+JSON.stringify(data, null, '\t')+'</pre>');
                }
            );
        }
    }
    else {
        // Use UIKit (old) code here.
        weather.update = function() {
            jQuery.get(...);
        }
    }
    
    setTimeout(1000, weather.update());
    2014-12-27 05:31 PM
  15. NewD's Avatar
    Just to point out a bug with the forum when you write ", " it seems to get removed in the code tags. What Grant meant was:
    The code tags also remove ',' as well Jake.. Look at your post now too.. And my post edited to make them single quotes... Damn.. That's a pretty important part of the code.. Maybe we'll just remove the code tag to make it display correctly..

    Edited:
    Moved that getWeather function OUT of the code tags in my explanation so they'll display properly.
    Last edited by NewD; 2014-12-27 at 08:44 PM.
    2014-12-27 08:25 PM
  16. King_O_Hill's Avatar
    Not at all. Actually I don't know much about IOS development, but good at html/js cause I'm doing java/web development (after many years C/C++ programming).
    I was tired with iphone's original lockscreen and found GroovyLock is exactly what I want, and found this thread, and then I modified one theme to show my album - it's kind of reminder for myself that still have many places to go.
    Thanks for the reply bud. We'd love to see someone that does this for more than a hobby be around to see different perspectives on code. It would be great if you could share something so we can rip it apart! Haha!

    Welcome aboard!

    Check out WW3 for iOS 9/10 - Widget-Weather 3.0
    2014-12-27 10:31 PM
  17. chenlao's Avatar
    Awesome Chen! Is that running on GL+? Would be cool if you can post it?
    Theme has to be converted for GL+. Just saw the converting tip from NewdestinyX and that's great. One more note if the old theme uses elements overflow and css translate, the document height could be great than viewpoint height. The simple solution is hide/show them with touch.
    Here's my new one (well, 2x screen resolution of ip6 is 375x667):
    GroovyLock (HTML LockScreen Platform)-img_1996.png

    So far it's running well, no crash. And here's something I found:
    - Looks theme be reloaded every time wake up screen
    - Some time the loading WW xml stuck, usually happened after long sleep. My guess is could be conflict with WW when it writing the xml file? I think it will be nice if can catch the exception - we can load data to the weather object first then render it if no exception.
    - Few times the weather wall (image for the layer) didn't show up (and I pretty sure the weather code is correct). And font color became black.
    - No transparent background yet.

    Thanks again for GroovyCarrot's great work, and thanks everyone's warm-hearted welcome.
    2014-12-28 12:13 AM
  18. NewD's Avatar
    Theme has to be converted for GL+. Just saw the converting tip from NewdestinyX and that's great. One more note if the old theme uses elements overflow and css translate, the document height could be great than viewpoint height. The simple solution is hide/show them with touch.

    So far it's running well, no crash. And here's something I found:
    - Looks theme be reloaded every time wake up screen
    - Some time the loading WW xml stuck, usually happened after long sleep. My guess is could be conflict with WW when it writing the xml file? I think it will be nice if can catch the exception - we can load data to the weather object first then render it if no exception.
    - Few times the weather wall (image for the layer) didn't show up (and I pretty sure the weather code is correct). And font color became black.
    - No transparent background yet.

    Thanks again for GroovyCarrot's great work, and thanks everyone's warm-hearted welcome.
    Yes, those things you listed happen to all LS widgets running in GL+ at this point. We're only in beta at this point. iOS 8 seems to be losing some things from memory while in deep sleep.

    If you run the same widget as Wallpaper.html in GB+ then it stays on all the time.
    2014-12-28 01:12 AM
  19. GroovyCarrot's Avatar
    You know to convert a lockscreen you can pretty much just replace:
    Code:
    jQuery.get("file://path/to/file.xml", 
    groovyAPI.do({read:"file.xml"}, 
    2014-12-28 12:50 PM
  20. TiLT1oNE's Avatar
    We only have to change that single line to make our LS/SB compatible to GL+/GB+?
    2014-12-28 01:06 PM
1,343 ... 242505152535462 ...
LINK TO POST COPIED TO CLIPBOARD