Skip to content

Commit

Permalink
adding support for custom errors returned from submitting the marks a…
Browse files Browse the repository at this point in the history
…nd cleaning up feature dection
  • Loading branch information
Adam Miller authored and Adam Miller committed Jun 1, 2011
1 parent f2e72ce commit 645ef82
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
14 changes: 7 additions & 7 deletions ffdemo/static/assets/js/markUp_app.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions ffdemo/static/assets/js/vendor/app.js
Expand Up @@ -144,13 +144,8 @@
} );

$( document ).ready( function () {
// duplicated from the inline script for clarity
function browserSupportsRequiredFeatures() {
// detect canvas and native JSON support
return !!( 'getContext' in document.createElement( 'canvas' ) ) &&
!!( 'JSON' in window );
}
if ( browserSupportsRequiredFeatures ) {
// browserSupportsRequiredFeatures is defined inline so that it can be run immedietly
if ( browserSupportsRequiredFeatures && browserSupportsRequiredFeatures() ) {
// run the app
app.run( '#/' );
}
Expand Down
17 changes: 11 additions & 6 deletions ffdemo/static/assets/js/vendor/jquery.markApp.capture.js
Expand Up @@ -509,12 +509,17 @@
// hide loader
context.fn.hideLoader();
}

},
error: function( data ) {
if(data.error) {
context.fn.showError( data.error );
} else {
error: function( jqXHR, textStatus, errorThrown ) {
try{
// try to parse out an error message
var data = JSON.parse( jqXHR.responseText );
if( data.error ) {
context.fn.showError( data.error );
} else {
context.fn.showError( context.fn.getString( 'submit-error' ) );
}
} catch( e ) {
context.fn.showError( context.fn.getString( 'submit-error' ) );
}
}
Expand Down Expand Up @@ -613,7 +618,7 @@
var x, y;
if( lC.mark == null || lC.mark.strokes.length == 0 ) {
// draw the guide from the closest screen edge
x = context.mouseX > $( window ).width() / 2 ? lC.layerManager.layers['liveDrawingLayer'].canvas.width : 0,
x = context.mouseX > $( window ).width() / 2 ? lC.layerManager.layers['liveDrawingLayer'].canvas.width : 0;
y = context.mouseY;
} else {
// draw the guide from the last point in the previous stroke
Expand Down

0 comments on commit 645ef82

Please sign in to comment.