X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=root%2Fjs%2Fcomponentload.js;h=2df5feca77625f08d56e80a1bcdea5c8d6172e5d;hb=65a0c9c6c2ffa577d6068b7b8c181e84b1bd23bc;hp=35f529abbffe79b24c94e59084fb7b0c531abb70;hpb=ea39d630fa8c1b151593464f5e44a9c96c6103ef;p=scpubgit%2Fstemmaweb.git diff --git a/root/js/componentload.js b/root/js/componentload.js index 35f529a..2df5fec 100644 --- a/root/js/componentload.js +++ b/root/js/componentload.js @@ -36,7 +36,11 @@ function loadTradition( textid, textname, editable ) { if( stemmata.length ) { selectedStemmaID = 0; load_stemma( selectedStemmaID, basepath ); - } + } else { + $('#open_stemma_edit').hide(); + $('#run_stexaminer').hide(); + show_stemmapager(); // to grey out both buttons + } // Set up the relationship mapper button $('#run_relater').attr( 'action', basepath + "/relation/" + textid ); }); @@ -67,11 +71,29 @@ function load_textinfo() { } } +function show_stemmapager () { + $('.pager_left_button').unbind('click').css( 'opacity', '0.5' ); + $('.pager_right_button').unbind('click').css( 'opacity', '0.5' ); + if( selectedStemmaID > 0 ) { + $('.pager_left_button').click( function () { + load_stemma( selectedStemmaID - 1 ); + }).css( 'opacity' , '1.0' ); + } + if( selectedStemmaID + 1 < stemmata.length ) { + $('.pager_right_button').click( function () { + load_stemma( selectedStemmaID + 1 ); + }).css( 'opacity' , '1.0' ); + } +} + + function load_stemma( idx ) { + // Load the stemma at idx + selectedStemmaID = idx; if( idx > -1 ) { - selectedStemmaID = idx; $('#stemma_graph').empty(); $('#stemma_graph').append( stemmata[idx] ); + show_stemmapager(); // Stexaminer submit action var stexpath = basepath + "/stexaminer/" + selectedTextID + "/" + idx; $('#run_stexaminer').attr( 'action', stexpath );