X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=root%2Fjs%2Frelationship-full.js;h=3ca852c0a404994f63b3330750b9ed2a568496c3;hb=3f9d7ae52124ba47d54d45a7c8e9f57455c9d389;hp=cd3d867d0ed8ed8d01c2470ff8a913cba3f2cd5f;hpb=f761f9a7802815a5e3aa1068cd7aa17dd83ff8e5;p=scpubgit%2Fstemmaweb.git diff --git a/root/js/relationship-full.js b/root/js/relationship-full.js index cd3d867..3ca852c 100644 --- a/root/js/relationship-full.js +++ b/root/js/relationship-full.js @@ -5,36 +5,16 @@ var start_element_height = 0; var reltypes = {}; var readingdata = {}; -function getTextPath() { - var currpath = window.location.pathname; - // Get rid of trailing slash - if( currpath.lastIndexOf('/') == currpath.length - 1 ) { - currpath = currpath.slice( 0, currpath.length - 1) - }; - // Get rid of query parameters - if( currpath.lastIndexOf('?') != -1 ) { - currpath = currpath.slice( 0, currpath.lastIndexOf('?') ); - }; - var path_elements = currpath.split('/'); - var textid = path_elements.pop(); - var basepath = path_elements.join( '/' ); - var path_parts = [ basepath, textid ]; - return path_parts; -} - function getRelativePath() { - var path_parts = getTextPath(); - return path_parts[0]; + return basepath; } function getTextURL( which ) { - var path_parts = getTextPath(); - return path_parts[0] + '/' + path_parts[1] + '/' + which; + return basepath + textid + '/' + which; } function getReadingURL( reading_id ) { - var path_parts = getTextPath(); - return path_parts[0] + '/' + path_parts[1] + '/reading/' + reading_id; + return basepath + textid + '/reading/' + reading_id; } // Make an XML ID into a valid selector @@ -222,7 +202,7 @@ function svgEnlargementLoaded() { function add_relations( callback_fn ) { var basepath = getRelativePath(); var textrelpath = getTextURL( 'relationships' ); - $.getJSON( basepath + '/definitions', function(data) { + $.getJSON( basepath + 'definitions', function(data) { var rel_types = data.types.sort(); $.getJSON( textrelpath, function(data) {