Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #47 from nawroth/externalconsole

Added button for opening console in external window.
  • Loading branch information...
commit 19c61d1139936e41c8f6ec51e450315d59e45696 2 parents a50b56a + d34fb62
@simpsonjulian simpsonjulian authored
View
BIN  src/main/resources/css/external.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
2  src/main/resources/css/neo.css
@@ -124,7 +124,7 @@ div.navheader
position: absolute;
right: 0;
top: 160px;
- width: 154px;
+ width: 180px;
text-align: right;
font-size: 0.9375em;
border-top: 1px solid #DDDDDD;
View
33 src/main/resources/js/cypherconsole.js
@@ -23,6 +23,7 @@
jQuery( document ).ready( function()
{
+ if ( jQuery.browser.msie ) return;
createCypherConsoles( jQuery );
});
@@ -43,11 +44,18 @@ function createCypherConsoles( $ )
var command = context.find( 'span.command > strong' ).eq(0).text();
if ( !command ) return;
var button = $( '<button class="cypherconsole" type="button"><img src="css/utilities-terminal.png" /> ' + title + '</button>' );
+ var url = getUrl( database, command );
+ var link = $( '<button class="cypherconsole" type="button" title="Open the console in a new window."><img style="position:relative;right:-0.3em;" src="css/external.png" />&#8201;</button>' );
+ link.click( function()
+ {
+ window.open( url, '_blank' );
+ });
button.click( function()
{
- handleCypherClick( button, database, command, title );
+ handleCypherClick( button, link, url, title );
});
button.insertAfter( this );
+ link.insertAfter( button );
});
$( RESOURCE_FILES ).each( function()
@@ -57,7 +65,19 @@ function createCypherConsoles( $ )
// $.get( target );
});
- function handleCypherClick( button, database, command, title )
+ function getUrl( database, command )
+ {
+ var url = REQUEST_BASE;
+ url += "init=" + encodeURIComponent( database );
+ url += "&query=" + encodeURIComponent( command );
+ if ( window.neo4jVersion != undefined )
+ {
+ url += "&version=" + encodeURIComponent( neo4jVersion );
+ }
+ return url;
+ }
+
+ function handleCypherClick( button, link, url, title )
{
var iframe=$( "#console" );
if ( iframe.length )
@@ -70,15 +90,8 @@ function createCypherConsoles( $ )
currentButton = null;
return;
}
- var url= REQUEST_BASE;
- url += "init=" + encodeURIComponent( database );
- url += "&query=" + encodeURIComponent( command );
- if ( window.neo4jVersion != undefined )
- {
- url += "&version=" + encodeURIComponent( neo4jVersion );
- }
iframe = $( "<iframe/>" ).attr( "id", "console" ).addClass( "console" ).attr( "src", url );
- button.after( iframe );
+ link.after( iframe );
currentButton = button;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.