diff --git a/src/afch.css b/src/afch.css index a6d7a75..de7d966 100644 --- a/src/afch.css +++ b/src/afch.css @@ -19,13 +19,21 @@ margin-bottom: 20px; } +.top-bar-element { + color: #FFFFFF; + font-size: 1em; + padding: 0.5em; + cursor: pointer; +} + +#afchClose { + font-size: 1.2em; + float: right; + margin-top: -0.4em; +} + #afchFeedback { position: absolute; - color: #FFFFFF; - font-size: 0.75em; - padding-left: 0.5em; - padding-top: 0.5em; - cursor: pointer; } #afchHeader { diff --git a/src/modules/submissions.js b/src/modules/submissions.js index 75c3e46..f8161ff 100644 --- a/src/modules/submissions.js +++ b/src/modules/submissions.js @@ -1,6 +1,7 @@ // ( function ( AFCH, $, mw ) { - var $afchWrapper, afchPage, afchSubmission, afchViews; + var $afchLaunchLink, $afch, $afchWrapper, + afchPage, afchSubmission, afchViews; AFCH.log( 'submissions.js executing...' ); @@ -264,35 +265,69 @@ return true; }; - // Wrapper for all AFCH windows/panels - $afchWrapper = $( '
' ) - .attr( 'id', 'afchWrapper' ) - .prependTo( '#mw-content-text' ) - .append( - // Build splash panel in JavaScript rather than via - // a template so we don't have to wait for the - // HTTP request to go through - $( '
' ) - .attr( 'id', 'afchReviewPanel' ) - .addClass( 'splash hidden' ) - .append( - $( '
' ) - .attr( 'id', 'afchInitialHeader' ) - .text( 'AFCH v' + AFCH.consts.version + ' / ' + AFCH.consts.versionName ) - ) - ); - - // Set up the link which opens the interface - $( '' ) + // This creates the link in the header which allows + // users to launch afch. When launched, the link fades + // away, like a unicorn. + $afchLaunchLink = $( '' ) .attr( 'id', 'afch-open' ) .appendTo( '#firstHeading' ) .text( 'Review submission ยป' ) - .on( 'click', function () { + .click( function () { $( this ).fadeOut(); - $( '#afchReviewPanel' ).removeClass( 'hidden' ); - setupReviewPanel(); + createAFCHInstance(); } ); + + function createAFCHInstance () { + /** + * global; wraps ALL afch-y things + */ + $afch = $( '
' ) + .attr( 'id', 'afch' ) + .prependTo( '#mw-content-text' ) + .append( + // Add the feedback link above the wrapper + $( '
' ) + .attr( 'id', 'afchFeedback' ) + .addClass( 'top-bar-element' ), + // Include the close link in the upper right + $( '
' ) + .attr( 'id', 'afchClose' ) + .addClass( 'top-bar-element' ) + .html( '×' ) + .click( function () { + // DIE DIE DIE + $afch.remove(); + // Show the launch link again + $afchLaunchLink.fadeIn(); + } ) + ); + + /** + * global; wrapper for specific afch panels + */ + $afchWrapper = $( '
' ) + .attr( 'id', 'afchPanelWrapper' ) + .appendTo( $afch ) + .append( + // Build splash panel in JavaScript rather than via + // a template so we don't have to wait for the + // HTTP request to go through + $( '
' ) + .attr( 'id', 'afchReviewPanel' ) + .addClass( 'splash' ) + .append( + $( '
' ) + .attr( 'id', 'afchInitialHeader' ) + .text( 'AFCH v' + AFCH.consts.version + ' / ' + AFCH.consts.versionName ) + ) + ); + + // Now set up the review panel and replace it with + // actually content, not just a splash screen + setupReviewPanel(); + } + function setupReviewPanel () { // Store this to a variable so we can wait for its success var loadViews = $.ajax( { @@ -384,6 +419,7 @@ fn( data ); } ); } + // These functions show the options before doing something // to a submission. diff --git a/src/templates/tpl-submissions.html b/src/templates/tpl-submissions.html index 0ad7d02..8b548fb 100644 --- a/src/templates/tpl-submissions.html +++ b/src/templates/tpl-submissions.html @@ -2,7 +2,6 @@
-
AFCH v{{version}} / {{versionName}} Reviewing "{{title}}" @@ -19,7 +18,6 @@
-
Accepting...
@@ -35,7 +33,6 @@
-
Declining...