(function( $ ) {
	'use strict';

	$(document).ready(function(){

		/*if($('article.strongs').hasClass('hebrew')){
			let height = $('div.strongsdef:nth-child(2)').height() + 1;
			$('div.strongsdef:nth-child(3)').css('height', height+'px');
			$('div.strongsdef:nth-child(4) .strongsbody').css('line-height', $('div.strongsdef:nth-child(5)').height()+'px');
		}*/

		$(document).on('click', 'article .arrow', function(e){
			if (e.target !== this){
				e.preventDefault();
				return;
			}

			var currentDrawer = $($(this).parent('div.drawer'));
			var currentID = $(currentDrawer).data('id');

			if(currentDrawer.hasClass('open')){
				currentDrawer.removeClass('open');
			}else{
				currentDrawer.addClass('loading');
				$.post(
					symatic.ajax_url,
					{action:'symatic_get_strongs', postid:currentID},
					function(response){
						if(response.success == true){
							$(currentDrawer).find('.drawer-content').html(response.data);
						}else{
							$(currentDrawer).find('.drawer-content').html('');
							alert(response.data);
						}
						currentDrawer.addClass('open').removeClass('loading');
					});
			}
		});

		$(document).on('click', '.drawer .annot', function(){
			var currentDrawer = $(this).parent('div.drawer');

			if(currentDrawer.hasClass('openannot')){
				currentDrawer.removeClass('openannot');
			}else{
				currentDrawer.addClass('openannot');
			}
		});
	});

})( jQuery );
