Added check to see if URLs start with "http://", add it if they don't. #952
Conversation
…. Added support for dynamically redirecting.
@@ -341,7 +347,8 @@ class FlxPreloader extends NMEPreloader | |||
#if flash | |||
private function goToMyURL(?e:MouseEvent):Void | |||
{ | |||
Lib.getURL(new URLRequest(allowedURLs[0])); | |||
var prefix:String = allowedURLs[myURLIndex] == FlxPreloader.LOCAL ? "" : ~/^https?:\/\//.match(allowedURLs[myURLIndex]) ? "" : "http://"; |
Gama11
Mar 22, 2014
Member
I'm not normally against ternaries, but this line is too complicated for that to still be readable (double ternary here even). Also, it would be nice to have a comment here explaining the regex.
I'm not normally against ternaries, but this line is too complicated for that to still be readable (double ternary here even). Also, it would be nice to have a comment here explaining the regex.
@Gama11 is something like this better? |
Yeah, I think that's a lot more readable. Not sure about |
Kind of off-topic, but what is this "Travis CI build"? And why is it failing? |
It's a service for open-source projects for continous testing. In this case, it builds every demo and does a few basic unit tests for every commit, just to check everything works. The reason why it's currently failing is unrelated to your pull request. |
…it if they don't.
I added the same functionality to FlxG.openURL(). |
Not a bad idea, but in that case, the preloader should call |
Is it a redundancy, though? |
I wasn't saying to remove goToMyURL. Except for the local part, the logic in the two functions is almost identical though - the http-logic is redundant. |
The preloader now uses FlxG.openURL() for actual URL's |
Added check to see if URLs start with "http://", add it if they don't.
Also added support for dynamically redirecting (instead of always redirecting to the first site in the list).