Permalink
Browse files

fixes "strange urls"

  • Loading branch information...
1 parent 3bb7afc commit 91829e71e44874ad892d288e9f6b7d33eb504676 @clemos committed Jun 10, 2012
Showing with 15 additions and 10 deletions.
  1. +1 −1 .htaccess
  2. +12 −7 src/App.hx
  3. +2 −2 src/Editor.hx
View
2 .htaccess
@@ -16,6 +16,6 @@ RewriteRule ^app/(.*)$ /~%1/try-haxe/app/index.php?_url=$1 [L,QSA]
# try.haxe.org
RewriteCond %{HTTP_HOST} try\.haxe\.org
RewriteCond %{REQUEST_URI} !index.php
-RewriteRule ^app/(.*)$ /app/index.php?_url=$1 [L,QSA]
+RewriteRule ^app/(.*)$ /app/index.php?_url=$1&_root= [L,QSA]
RewriteRule app/(.*)$ app/index.php?_url=$1 [L,QSA]
View
19 src/App.hx
@@ -16,13 +16,18 @@ class App {
var url = params.get('_url');
params.remove('_url');
- var base :String = untyped __php__("$_SERVER['SCRIPT_NAME']");
- var spl = base.split("/");
- spl.pop();
-
- Api.base = spl.join("/");
- spl.pop();
- Api.root = spl.join("/");
+ if( params.exists('_root') ){
+ Api.root = params.get('_root');
+ Api.base = Api.root + "/app";
+ }else{
+ var base :String = untyped __php__("$_SERVER['SCRIPT_NAME']");
+ var spl = base.split("/");
+ spl.pop();
+
+ Api.base = spl.join("/");
+ spl.pop();
+ Api.root = spl.join("/");
+ }
var api = new Api();
View
4 src/Editor.hx
@@ -303,10 +303,10 @@ class Editor {
public function run(){
if( output.success ){
var run = output.href ;
- runner.attr("src" , run + "&r=" + Std.string(Math.random()) );
+ runner.attr("src" , run + "?r=" + Std.string(Math.random()) );
new JQuery(".link-btn, .fullscreen-btn")
.buttonReset()
- .attr("href" , run + "&r=" + Std.string(Math.random()) );
+ .attr("href" , run + "r=" + Std.string(Math.random()) );
}else{
runner.attr("src" , "about:blank" );

0 comments on commit 91829e7

Please sign in to comment.