Skip to content

Commit

Permalink
fixes "strange urls"
Browse files Browse the repository at this point in the history
  • Loading branch information
clemos committed Jun 10, 2012
1 parent 3bb7afc commit 91829e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .htaccess
Expand Up @@ -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]
19 changes: 12 additions & 7 deletions src/App.hx
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions src/Editor.hx
Expand Up @@ -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" );
Expand Down

0 comments on commit 91829e7

Please sign in to comment.