1. glacius7's Avatar
    I couldn't get it to work.
    2015-01-03 07:22 AM
  2. King_O_Hill's Avatar
    Ian, it looks like your getting your data outside of any WebView and then applying it to display in WKWebView which is def plausible for a standalone app. But I'm not sure that it is doable with an actual HTML player like GL.

    I'm speculating a little here as I'm on the edge of my knowledge. Please let me know if I'm way off!

    Check out WW3 for iOS 9/10 - Widget-Weather 3.0
    2015-01-03 07:37 AM
  3. <Ian Nicoll/>'s Avatar
    Ian, it looks like your getting your data outside of any WebView and then applying it to display in WKWebView which is def plausible for a standalone app. But I'm not sure that it is doable with an actual HTML player like GL.

    I'm speculating a little here as I'm on the edge of my knowledge. Please let me know if I'm way off!
    I'm also at the edge regarding this stuff, but don't think so, I put the complete theme into the project and load the LockBackground.html file into the viewDidLoad method, so nothing is running before this point (when you open the app). So when the app is opened the lockBackground.html file is loaded into a WKWebView, then the javascript is run from the html file.
    I don't know how to first get the info then load it into the webview.

    That said I have VERY limited knowledge of this too.
    In the video you see it running immediately after I open the app, this is false and only did that because I had the app open a few seconds before I recorder it, normally I open the app and have to wait approximately 2 to 3 seconds for it to load.

    How did you come to the theory that I'm somehow running it before it goes to webview? Just curious.

    Here is my app code with my comments added:

    Code:
    #import "ViewController.h"
    
    @interface ViewController ()
    @end
    
    @implementation ViewController
    @synthesize contentWKWebView;
    
    - (void)viewDidLoad {
        [super viewDidLoad];
        
        // First I set the path to the file which in my case in in the app itself:
        NSString *filePath = [[NSBundle mainBundle]pathForResource:@"LockBackground" ofType:@"html"];
        
        // Then I set the url to the filepath:
        NSURL * fileURL = [NSURL fileURLWithPath:filePath isDirectory:NO];
        
        // Then I allocate some space/memory and initiate my url request:
        NSURLRequest * myNSURLRequest = [[NSURLRequest alloc]initWithURL:fileURL];
        
        // Then I load the request into my WKWebView:
        // my WKWebView is setup in my header file & I named it "contentWKWebView" like this:
        // (@property (weak, nonatomic) IBOutlet WKWebView *contentWKWebView;
        [contentWKWebView loadRequest:myNSURLRequest];
        
        // All this takes place in the viewDidLoad method, so nothing happens till the view loads (app is opened)
    }
    EDIT:

    Ah, maybe now I think I see your logic, you think it is all loaded at this point? Could be I guess, not sure though.

    Code:
    // Then I allocate some space/memory and initiate my url request:
        NSURLRequest * myNSURLRequest = [[NSURLRequest alloc]initWithURL:fileURL];
    I guess I could try running it in xCode with a break point after this line but how would I see the data output, don't think it will print to the console.

    EDIT again:

    Tried it with a break point, seems the urlRequest does nothing till it's called with:
    So I can't see how it's possibly loaded & run before the WKWebView.
    Code:
    [contentWKWebView loadRequest:myNSURLRequest];
    Last edited by <Ian Nicoll/>; 2015-01-03 at 09:49 AM.
    2015-01-03 09:15 AM
  4. TiLT1oNE's Avatar
    Thanks Ian!! I'd forgotten about of that code.. But it's really a 'workaround' as far as I'm concerned since it's less precise to the final dimensions of the screen. I like getting at the root cause - and as you well know that requires 'new images' (though I'll forgo them since I don't have the JS skill like you - are the master!! ) - and it requires change of the original containers and image heights and widths. The code I posted gets the css nearly all the way converted... But I love a quick fix too.. So thanks!! So glad to have your expertise here!!!!
    Hi Grant,

    Im glad that you confound me with the Master Coder Ian
    2015-01-03 12:46 PM
  5. <Ian Nicoll/>'s Avatar
    ^^ LOL, I'm nowhere near a "master coder" I would say I'm a novice to mediocreish.
    2015-01-03 01:19 PM
  6. rasputin007's Avatar
    I recently got an iPhone 5S (iOS 8.1.2) and also my son's iPad mini (iOS 8.1.1) to play with. Both are jailbroken and run cydget (yes, it still uses UIWebView).
    I never ever had any respring, but then some people just don't get them. I only run a few tweaks on both, like 20 Second Lockscreen, to being able to extend the lockscreen dim time and Winterboard because I use a 2 file/png image Theme to get rid of the chevron on the lockscreen, the text is also gone by editing the AWAY_LOCK_LABEL.
    However I wanted to run the same cydget theme on both, but did not like the fact that I had to have 2 versions of it, one for 640x1136 and one for 768x1024.
    So I looked for an alternative way to being able to run ONE theme on different sized lockscreens.
    Well, I found that alternative, which I just like to mention here.
    I use a graphical Setup. For the people that do not know what graphical Setup is, it is basically a system to change code without editing code. It is based on the use of databases, like Buuf and Weather Elements.
    So I added this to the graphical Setup menu.
    Code:
    <label for="idevice" >iPhone/iPad</label>
    	<select name="idevice" id="idevice">
    	<option value="640x960">iPhone 4/4S</option>
      	<option value="640x1136" >iPhone 5/5S</option>
        <option value="768x1024">iPad Mini</option>
      	</select>
    which looks like this on the iPad



    The selection, iPad mini here, will store "768x1024" in the database.
    When it comes to the theme html it will read the database value and asign these values to various css parts and other functions (e.g. sun and moon).
    Code:
      	obj.idevicew=obj.idevice.split('x')[0];
    	obj.ideviceh=obj.idevice.split('x')[1]; 
    	//a bit later
    	$('#body').css('height',obj.ideviceh+"px");
    	$('#body').css('width',obj.idevicew+"px");
    	$('#animationFrame').css('height',obj.ideviceh+"px");
    	$('#animationFrame').css('width',obj.idevicew+"px");
    Now I can use just one theme on different sized lockscreens and it works brilliant so far. Also makes it easier when I change code as I do not have to adjust multiple versions.
    I just wanted to mention this alternative as choice is freedom. I don't expect anyone to use this as graphical setup is way of the MMi mainstream, hence no example for download etc.
    Just a note that there are other ways to get ONE theme to work on different screen sizes without the need of different theme versions or different css file etc.
    I am very confident it also would work for iPhone 6 and 6+, but as I don't have any for testing I have not included them, which would be dead easy to do.
    Nothing is impossible only miracles take a bit longer!
    2015-01-03 01:41 PM
  7. Mav1971's Avatar
    Grant just wanted to say what a great job you are doing here, and it certainly is helping me learn more!
    2015-01-03 02:03 PM
  8. rasputin007's Avatar
    ^^ LOL, I'm nowhere near a "master coder" I would say I'm a novice to mediocreish.
    Same here. LOL
    As I got myself an "newer" Macbook Pro I can run Xcode 6.1.1 on it. I have no clue about Objective-C, but actually quite like the look of Swift as it is quite close to javascript and runs in Xcode with WKWebView and also with cycript (I think).
    Might be worth to have a look at, Ian, in case Objective-C gives you a headache.
    But then I never have been a friend of "closed" source tweaks, as you always depend on the creator to make changes for you. If you want to check something out you have to wait sometimes for days until you get a new version for testing, which might only take 3 minutes to do and during the days you waited you thought about a different solution. Always liked "open" source approach, a file you can see, code you can edit for testing, so anybody can do changes and test for better performance and improvements. That's why I currently use shell scripts to achieve what I want, e.g. automated weather.xml file update, reading plist files, getting values from database etc.
    Last edited by rasputin007; 2015-01-03 at 03:27 PM.
    Nothing is impossible only miracles take a bit longer!
    2015-01-03 03:16 PM
  9. NewD's Avatar
    EDIT again:

    Tried it with a break point, seems the urlRequest does nothing till it's called with:
    So I can't see how it's possibly loaded & run before the WKWebView.
    [contentWKWebView loadRequest:myNSURLRequest]
    Ian, this is certainly great testing and is helping me to believe in your thoughts that RSS feeds are still workable in a WK environment.. But it doesn't help us now convert our old widgets. As we have no LS player that can read the RSS feeds from the UniAW6x location.js file.. Plus - the future seems like it belongs to json and xml - so I think we should place our efforts there. Jake was genuinely surprised when he discovered that the reason why the widget was failing was because of a call to an RSS output feed API. He exclaimed, "that's such an old standard now. No wonder WK can't read it".

    But your Objective-C knowledge is really growing fast and I'm really eager to test your tweaks in the future. I absolutely love your Respring+! Thanks for all you do for us!
    Last edited by NewD; 2015-01-03 at 03:34 PM.
    2015-01-03 03:31 PM
  10. <Ian Nicoll/>'s Avatar
    Same here. LOL
    As I got myself an "newer" Macbook Pro I can run Xcode 6.1.1 on it. I have no clue about Objective-C, but actually quite like the look of Swift as it is quite close to javascript and runs in Xcode with WKWebView and also with cycript (I think).
    Might be worth to have a look at, Ian, in case Objective-C gives you a headache.
    But then I never have been a friend of "closed" source tweaks, as you always depend on the creator to make changes for you. If you want to check something out you have to wait sometimes for days until you get a new version for testing, which might only take 3 minutes to do and during the days you waited you thought about a different solution. Always liked "open" source approach, a file you can see, code you can edit for testing, so anybody can do changes and test for better performance and improvements. That's why I currently use shell scripts to achieve what I want, e.g. automated weather.xml file update, reading plist files, getting values from database etc.
    Hi Ras,

    I love your idea in the re-sizing, but due to the amount of animations etc in the UniAW not sure if I can use this, I know it would be a little bit of a headache setting up the .js file initially but to just have a single css file in the long run would make it worth the effort.

    I'm trying to learn Objective-C before looking at Swift, I was under the impression this is the correct way to go about it as I believe Swift is pretty similar to Objective-C, but Swift doesn't use semi-colons where Objective-c does. I actually have a full iOS8 coarse in Swift but am currently going through an iOS7 one in Objective-C atm, though after 30 minutes of watching the video's I get sleepy LOL..

    But I'm with you, it is for sure best if the widget maker can also make/support all relevant tweaks required, unfortunately I'm not nearly at that stage yet, maybe another year or so LOL..
    I have tried a few times to get a hold of source code for a few tweaks but no dev is willing to share, even privately they won't share anything, pity, I really don't know why.

    I still have the Objective-C code WyndWarrior shared in his original post of PerPageHTML, hopefully one day I can understand it better & re-invent it. Wynd was the only dev I ever saw share anything.

    All the best pal, I know you are probably just popping in but good to see you here again.
    Always good to see what your up to pal as you tend to think outside the box.
    2015-01-03 03:49 PM
  11. <Ian Nicoll/>'s Avatar
    Ian, this is certainly great testing and is helping me to believe in your thoughts that RSS feeds are still workable in a WK environment.. But it doesn't help us now convert our old widgets. As we have no LS player that can read the RSS feeds from the UniAW6x location.js file.. Plus - the future seems like it belongs to json and xml - so I think we should place our efforts there. Jake was genuinely surprised when he discovered that the reason why the widget was failing was because of a call to an RSS output feed API. He exclaimed, "that's such an old standard now. No wonder WK can't read it".

    But your Objective-C knowledge is really growing fast and I'm really eager to test your tweaks in the future. I absolutely love your Respring+! Thanks for all you do for us!
    Thanks Grant, but in this case I really don't understand why my app works in WKWebView, maybe I will understand it better as I learn.
    I have searched the web and can't find any articles/complaints referring the WKWebView and rss feeds, have you seen anything?
    2015-01-03 03:55 PM
  12. NewD's Avatar
    Yes, Ras!! Thanks so much for adding your knowledge to what we're trying to teach and learn here. I've always appreciated all you've taught me over the years! You and Ian and Dacal are my "gurus".. Thanks for stopping in to this "teaching/learning" thread I've tried to offer to the community. We "learn how" here - not ask others to do the work for us....

    To Ian's point: without Ian and Dacal's UniAW code, so freely shared, I would have never really learned JavaScript. I agree with you, Ian, that it would be so nice to have source code to learn Obj.C from. Though I do understand why tweak creators don't want to give out their code… It's their way to have their own trademark. And so many things get so easily leaked in our Internet world. "I" know I could implicitly trust "you"… with my code if I had developed it. But I also understand why tweak developers would be very reticent about sharing their source code.
    2015-01-03 03:59 PM
  13. NewD's Avatar
    Thanks Grant, but in this case I really don't understand why my app works in WKWebView, maybe I will understand it better as I learn.
    I have searched the web and can't find any articles/complaints referring the WKWebView and rss feeds, have you seen anything?
    I haven't yet, bro.. But you know me.. I'm an avid learner and reader. I'm about six months behind you in Objective-C where you started. I want to get over into that world too. But I'm a baby novice. I just now reached "mediocre coder" level (love that description by you -lol!) now in JavaScript and I can pretty much code from scratch and debug simpler things. But Objective-C is a huge mountain - as you well know. Maybe I'll see You at a ridge on the mountain one day. ;-)
    2015-01-03 04:03 PM
  14. rasputin007's Avatar
    I'm trying to learn Objective-C before looking at Swift, I was under the impression this is the correct way to go about it as I believe Swift is pretty similar to Objective-C, but Swift doesn't use semi-colons where Objective-c does. I actually have a full iOS8 coarse in Swift but am currently going through an iOS7 one in Objective-C atm, though after 30 minutes of watching the video's I get sleepy LOL..
    I know exactly how you feel, I start to fall asleep when I read the iBooks about Objective-C after a few pages.
    Sometimes I think I am just .
    Anyway I skip Objective-C, well, never got into it in the first place, and start with Swift, it makes more sense to me when looking at Swift code. There are luckily some good tutorials and examples (best teacher of all methods!) around, like Get your current address in Swift – Ramblings on Swift and IOS and WKWebView and JavaScript in iOS 8 - using Swift — KinderĂ¥s.com.
    The desire to keep YOUR code to yourself is as old as the internet, even if it is free software. I had that years ago when I was modding Motorolas, I had compiled executables (made in China), made for the Z6, but wanted them to work on the V8. No source code meant that I had to install Z6 libraries on the V8 in order to use those mods. Those Z6 libraries were about 3 MB in size and in those days every KB was precious as there was limited space in the firmwares. On other occasions italian themers started to "encrypt" their themes so that they could not be modified. In those days it also started that people added "their work" in their forum signature, which often was bigger then the post they wrote.
    Must be a human ego-thing, me, me, me and .... again ME.
    Here is an example of my shell script that reads a plist file from a Settings menu, reads the gps coordinates from a database and fetches the weather.xml file, in a 5 minute infinite loop. This shell script gets started with the LaunchDeamon every time you reboot.

    Code:
    #!/bin/bash
    while :
    do
    STATUS= ps -ax | grep 'myo.wug' | awk '{ print $1 }'
    
    plutil -key wug_Enabled /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/wug.txt
    if [ `cat /var/mobile/wug/wug.txt` = "0" ]
    then
    kill -s TERM $STATUS
    exit
    else
    if [ -f /var/mobile/wug/api.txt ]
    then
     :
    else
    plutil -key api_key /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/api.txt
    fi
    
    plutil -key language /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/lang.txt
    
    plutil -key alerts_Enabled /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/alert.txt
    if [ `cat /var/mobile/wug/alert.txt` = "1" ]
    then
    ALERT="/alerts"
    else
    ALERT=""
    fi
    
    plutil -key astronomy_Enabled /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/astro.txt
    if [ `cat /var/mobile/wug/astro.txt` = "1" ]
    then
    ASTRO="/astronomy"
    else
    ASTRO=""
    fi
    
    plutil -key conditions_Enabled /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/condi.txt
    if [ `cat /var/mobile/wug/condi.txt` = "1" ]
    then
    CONDI="/conditions"
    else
    CONDI=""
    fi
    
    plutil -key forecast_Enabled /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/fore.txt
    if [ `cat /var/mobile/wug/fore.txt` = "1" ]
    then
    FORE="/forecast"
    else
    FORE=""
    fi
    
    plutil -key forecast10day_Enabled /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/foreten.txt
    if [ `cat /var/mobile/wug/foreten.txt` = "1" ]
    then
    FORETEN="/forecast10day"
    else
    FORETEN=""
    fi
    
    plutil -key hourly_Enabled /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/hour.txt
    if [ `cat /var/mobile/wug/hour.txt` = "1" ]
    then
    HOUR="/hourly"
    else
    HOUR=""
    fi
    
    plutil -key hourly10day_Enabled /private/var/mobile/Library/Preferences/com.myo.wug.plist >/var/mobile/wug/hourten.txt
    if [ `cat /var/mobile/wug/hourten.txt` = "1" ]
    then
    HOURTEN="/hourly10day"
    else
    HOURTEN=""
    fi
    
    sqlite3 /private/var/mobile/Library/WebClips/MyGPS.webclip/Storage/file__0/0000000000000001.db "SELECT latitude FROM GPS" >/var/mobile/wug/lat.txt &&
    sqlite3 /private/var/mobile/Library/WebClips/MyGPS.webclip/Storage/file__0/0000000000000001.db "SELECT longitude FROM GPS" >/var/mobile/wug/long.txt &&
      LAT=`cat /var/mobile/wug/lat.txt` &&
      LNG=`cat /var/mobile/wug/long.txt` &&
      API=`cat /var/mobile/wug/api.txt` &&
      LANGU=`cat /var/mobile/wug/lang.txt` &&
      lynx -source "http://api.wunderground.com/api/$API$ALERT$ASTRO$CONDI$FORE$FORETEN$HOUR$HOURTEN/lang:$LANGU/q/$LAT,$LNG.xml" > /var/mobile/Documents/mywug.xml
    
    fi
    sleep 600
    done
    I live in the UK and widgetweather/weather.com is just not good enough for me, hence why I use WeatherUnderground.
    btw has anybody tried Living Earth, paid app in AppStore, based on WeatherUnderground, very cool, maybe one day I find a way to "hook" into that one like WidgetWeather does with Weather App.

    Yes, Ian, the animation is a problem atm. Each weather condition has its own html page with their own css and js files. I want to change the way animation is displayed, away from this big bulky one condition-one html file concept. I am more thinking of using Apple's own weather png's and use sprite png system - would love to use apng (animated png's), but too thick to get a libpng.dylib for mobile substrate.
    I have not done it yet, well, I got the png animation, but thought if the animation runs in containers then I could use the database width values to determine the container size for each screen size.
    I also found that using percentage instead of pixel values in the css helps to overcome different screen sizes. I tried that with the webclip html that generates the GPS coordinates and saves them in a database. That html page has a background picture, some text, the latitude and longitude values as well as the address for that GPS position from Google Maps. One html page displays very similar on 640x1136 and 768x1024, thanks to using percentage rather then pixel values for top, left, width in the css part.
    Nothing is impossible only miracles take a bit longer!
    2015-01-03 06:05 PM
  15. <Ian Nicoll/>'s Avatar
    Thanks again Ras,

    Ras, you should download and look at the UniAW7, it uses a few of the methods you talk about like percent instead of pixels.

    Funny, I was looking through Google just yesterday about pang's, was thinking of redoing my birds.if as an apng, found a small gifToApng command line tool that automatically converted gif's and the apng came out smaller than the gif, but couldn't get it working in Yosemite, don't know why.

    Thanks again for the code snippet, gonna keep it in my "special" folder on my Mac cause you never know.
    2015-01-03 07:49 PM
  16. NewD's Avatar
    Thanks again Ras,

    Ras, you should download and look at the UniAW7, it uses a few of the methods you talk about like percent instead of pixels.
    It's strange that using % instead of pixels hasn't always worked for me. For example in Dacal's Circle Weather LS mod I just modded for iPhone6.. The #body is set to 375/667 in pixels (I even tried 100%/100% - still the same result) and the Digital clock timer's contained which is set to 50%/50% (its original value) on height and width still has the clock way off center and too far down screen.. So it doesn't seem to be a perfect answer to auto-sizing body and containers..
    2015-01-03 07:54 PM
  17. NewD's Avatar
    Ian, I'm also stumped as to how to get the Frost.png upsized to iPhone 6.. I opened it in PhotoShop and upsized the image to 750 by 1334 and resaved over original. As I looked in the animation.js and main.js I didn't see any code that would override the style.css' definition of the body or cloudContainers which are both set to 375/667 right now. But the image of the frost remains at 320 x 568 no matter what I try. The image itself is the right size now.. Image and Canvas changed to 750 x 1334.. What am I missing, bro?
    2015-01-03 08:00 PM
  18. King_O_Hill's Avatar
    Grant, I used some percentages in the Brass Tacks clock iWidget. Take a look and see if that helps you.

    Ras, I was shocked to see you use 20 sec LS instead of just using a delay through Cycript!
    Last edited by King_O_Hill; 2015-01-03 at 08:03 PM.

    Check out WW3 for iOS 9/10 - Widget-Weather 3.0
    2015-01-03 08:01 PM
  19. <Ian Nicoll/>'s Avatar
    Ian, I'm also stumped as to how to get the Frost.png upsized to iPhone 6.. I opened it in PhotoShop and upsized the image to 750 by 1334 and resaved over original. As I looked in the animation.js and main.js I didn't see any code that would override the style.css' definition of the body or cloudContainers which are both set to 375/667 right now. But the image of the frost remains at 320 x 568 no matter what I try. The image itself is the right size now.. Image and Canvas changed to 750 x 1334.. What am I missing, bro?
    It's simply stretched up in the Animations6.css file.

    #frost {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 375px;
    height: 667px;

    background-color: transparent;
    opacity: 0.0;
    -webkit-animation-name: frost_animation;
    -webkit-animation-duration: 15s;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-delay: 1s;
    }
    2015-01-03 09:04 PM
  20. TiLT1oNE's Avatar
    Ian, I'm also stumped as to how to get the Frost.png upsized to iPhone 6.. I opened it in PhotoShop and upsized the image to 750 by 1334 and resaved over original. As I looked in the animation.js and main.js I didn't see any code that would override the style.css' definition of the body or cloudContainers which are both set to 375/667 right now. But the image of the frost remains at 320 x 568 no matter what I try. The image itself is the right size now.. Image and Canvas changed to 750 x 1334.. What am I missing, bro?
    I looked in that Animations.css from the Circle Weather mod, and all containers are at 320/568, I think you have to strech them all up to 375/667
    2015-01-03 11:04 PM
831 ... 67891018 ...
LINK TO POST COPIED TO CLIPBOARD