entry-layout.js 4.76 KB
$(function() {
  $('#content').height($(window).height() - 20);
  $(window).resize(function() {
    $('#content').height($(window).height() - 20);
    resize_splitters();
  });
  if ($.fn.splitter) {
    $('#content').bind('resize', function(e) {
      resize_splitters();
      e.stopPropagation();
    });
    $('#content').bind('resize', function(e) {
      e.stopPropagation();
    });
  }
});

function ShowProgressAnimation() {
  $("#wait-dialog").dialog('open');
}

function HideProgressAnimation() {
  $("#wait-dialog").dialog('close');
}

function resize_splitters() {
  $('#semantics-hsplit').trigger('resize');
}

function createWaitDialog() {
    $("#wait-dialog").dialog({ autoOpen: false,
                               modal   : 'true',
                               closeOnEscape: 'false',
                               closeText: '',
                               bgiframe: 'true',
                               resizable: 'false',
                               open: function (event, ui) {
                                   $('#wait-dialog').css('overflow', 'hidden');
                               }});
    $(".ui-dialog-titlebar").hide();
}

function refresh_column_headers() {}

function load_content(id) {
    initiateFrameFilters();

	ShowProgressAnimation();

    $('#new_frames').load(ajax_new_frames, 'id='+id, function(data){
        window.lemma_id = id;

        loadSchemataAndExamples();

        createSplitter('framesSplit','new-frame-tables', 'tabs');

  		if(document.getElementById("lemma_example_show")) {
  		  draw_nkjp_table(document.getElementById("lemma_example_show"), '', window.nkjp_lemma_examples, 'NkjpLemmaTableRow', 'nkjpLemma_')
          $("tr.NkjpLemmaTableRow").click(function(){
            selectLemmaNkjpTr(this.id)});
        }
  		addPinnedExamplesDialog();
  	    $('#lemma_desc').load(ajax_get_lemma_desc, 'id='+id);
      });
      $('#semantics').load(ajax_semantics, 'id='+id);
}

function createSplitter(split_id, top_id, bottom_id) {
  $('#'+split_id).height($('#content').height() - 50);
  if ($.fn.splitter) {
	$(window).resize(function() {
		$('#'+split_id).height($('#content').height() - 50);
	});
    $('#'+top_id).bind('resize', function(e) {
      e.stopPropagation();
    });
    $('#'+bottom_id).bind('resize', function(e) {
      e.stopPropagation();
    });
    $('#'+split_id).splitter({
      type: "h",
      minTop: 200,
      minBottom: 50,
      sizeBottom: 170,
      resizeToWidth: true
    });
  }
}

var hSplitterId = 'semantics-hsplit';
var topSplitId = 'semantics-hsplit-top';
var bottomSplitId = 'semantics-hsplit-bottom';
var topVSplitterId = 'semantics-vsplit-top';
var bottomVSplitterId = 'semantics-vsplit-bottom';
var topLeftSplitId = 'frames';
var topRightSplitId = 'schemas';
var bottomLeftSplitId = 'control';

function createHSplitter() {
  $('#'+hSplitterId).height($('#content').height() - 50);

  if ($.fn.splitter) {

	$(window).resize(function() {
		$('#'+hSplitterId).height($('#content').height() - 50);
	});

    $('#'+hSplitterId).bind('resize', function(e) {
		  var resizeEvt;
	      clearTimeout(resizeEvt);
	      resizeEvt = setTimeout(function() {
	        	$('#'+topVSplitterId).trigger('resize', $('#'+topLeftSplitId).width());
	            $('#'+bottomVSplitterId).trigger('resize', $('#'+bottomLeftSplitId).width()+7);
	        }, 50);
		  e.stopPropagation();
	});

    $('#'+topSplitId).bind('resize', function(e) {
    	$('#'+topVSplitterId).height($('#'+topSplitId).height());
    	$('#'+topVSplitterId).children().each(function () {
    		$(this).height($('#'+topSplitId).height() - 7);
    	});

    	$('#'+bottomVSplitterId).height($('#'+bottomSplitId).height());
    	$('#'+bottomVSplitterId).children().each(function () {
    		$(this).height($('#'+bottomSplitId).height() - 7);
    	});
        e.stopPropagation();
    });
    $('#'+bottomSplitId).bind('resize', function(e) {
      e.stopPropagation();
    });
    $('#'+hSplitterId).splitter({
      type: "h",
      minTop: 200,
      minBottom: 100,
      sizeBottom: 170,
      resizeToWidth: true,
      outline: true
    });
  }
}

function createVTopSplitter() {
  var w=$('#'+topVSplitterId).width();

  $('#'+topVSplitterId).height(2*$('#content').height()/3);

  if ($.fn.splitter) {
    $('#'+topLeftSplitId).bind('resize', function(e) {
    	$('#'+topVSplitterId).height($('#'+topSplitId).height());
    	$('#'+topVSplitterId).children().each(function () {
    		$(this).height($('#'+topSplitId).height() - 7);
    	});
    	$('#'+topRightSplitId).width($('#'+topRightSplitId).width() - 20);
        e.stopPropagation();
    });
    $('#'+topRightSplitId).bind('resize', function(e) {
      e.stopPropagation();
    });
    $('#'+topVSplitterId).splitter({
      type: "v",
      minLeft: 50,
      sizeLeft: w/2,
      resizeToWidth: true,
      outline: true
    });
  }
}