<commit_before><? 
defined('C5_EXECUTE') or die(_("Access Denied."));
$btl = $a->getAddBlockTypes($c, $ap );
$blockTypes = $btl->getBlockTypeList();
$ci = Loader::helper('concrete/urls');
$ch = Loader::helper('concrete/interface');
$form = Loader::helper('form');

?>

<script type="text/javascript" src="<?=ASSETS_URL_JAVASCRIPT?>/quicksilver.js"></script>
<script type="text/javascript" src="<?=ASSETS_URL_JAVASCRIPT?>/jquery.liveupdate.js"></script>


<script type="text/javascript">
<? if (ENABLE_MARKETPLACE_SUPPORT) { ?>

ccm_isRemotelyLoggedIn = '<?=UserInfo::isRemotelyLoggedIn()?>';
ccm_remoteUID = <?=UserInfo::getRemoteAuthUserId() ?>;
ccm_remoteUName = '<?=UserInfo::getRemoteAuthUserName()?>';
ccm_loginInstallSuccessFn = function() { jQuery.fn.dialog.closeTop(); };

function ccm_loginSuccess(jsObj) {
	ccm_isRemotelyLoggedIn = true;
	ccm_remoteUID = jsObj.uID;
	ccm_remoteUName = jsObj.uName;
	jQuery.fn.dialog.closeTop();
	ccm_updateMarketplaceTab();
	ccmAlert.notice('Marketplace Login', ccmi18n.marketplaceLoginSuccessMsg);
}
function ccm_logoutSuccess() {
	ccm_isRemotelyLoggedIn = false;
	ccm_updateMarketplaceTab();
	ccmAlert.notice('Marketplace Logout', ccmi18n.marketplaceLogoutSuccessMsg);
}
function ccm_updateLoginArea() {
	if (ccm_isRemotelyLoggedIn) {
		$("#ccm-marketplace-logged-in").show();
		$("#ccm-marketplace-logged-out").hide();
	} else {
		$("#ccm-marketplace-logged-in").hide();
		$("#ccm-marketplace-logged-out").show();
	}
}
function ccm_updateMarketplaceTab() {
	$("#ccm-add-marketplace-tab div.ccm-block-type-list").html(ccmi18n.marketplaceLoadingMsg);
	$.ajax({
        url: CCM_TOOLS_PATH+'/marketplace/refresh_block',
        type: 'POST',
        success: function(html){
			$("#ccm-add-marketplace-tab div.ccm-block-type-list").html(html);
			ccm_updateLoginArea();
			ccmLoginHelper.bindInstallLinks();
        },
	});
}

ccm_showBlockTypeDescription = function(btID) {
	$("#ccm-bt-help" + btID).show();
}

var ccm_areaActiveTab = "ccm-add";

$("#ccm-area-tabs a").click(function() {
	$("li.ccm-nav-active").removeClass('ccm-nav-active');
	$("#" + ccm_areaActiveTab + "-tab").hide();
	ccm_areaActiveTab = $(this).attr('id');
	$(this).parent().addClass("ccm-nav-active");
	$("#" + ccm_areaActiveTab + "-tab").show();
});

$(document).ready(function(){
	ccm_updateMarketplaceTab();
});

<? } ?>

$('input[name=ccmBlockTypeSearch]').focus(function() {
	if ($(this).val() == '<?=t("Search")?>') {
		$(this).val('');
	}
	$(this).css('color', '#000');

	if (!ccmLiveSearchActive) {
		$('#ccmBlockTypeSearch').liveUpdate('ccm-block-type-list');
		ccmLiveSearchActive = true;
		$("#ccm-block-type-clear-search").show();
	}
});

ccmBlockTypeSearchFormCheckResults = function() {
	return false;
}

ccmBlockTypeSearchClear = function() {
	$("input[name=ccmBlockTypeSearch]").val('');
	$("#ccm-block-type-list li.ccm-block-type").addClass("ccm-block-type-available");
	$("#ccm-block-type-list li.ccm-block-type").removeClass("ccm-block-type-selected");
}

var ccmLiveSearchActive = false;
if (typeof(ccmBlockTypeBound) == 'undefined') {
	var ccmBlockTypeBound = false;
}
ccmBlockTypeSearchResultsSelect = function(which, e) {
	e.preventDefault();
	e.stopPropagation();
	$("input[name=ccmBlockTypeSearch]").blur();
	// find the currently selected item
	var obj = $("li.ccm-block-type-selected");
	var foundblock = false;
	if (obj.length == 0) {
		$($("#ccm-block-type-list li.ccm-block-type-available")[0]).addClass('ccm-block-type-selected');
	} else {
		if (which == 'next') {
			var nextObj = obj.nextAll('li.ccm-block-type-available');
			if (nextObj.length > 0) {
				obj.removeClass('ccm-block-type-selected');
				$(nextObj[0]).addClass('ccm-block-type-selected');
			}
		} else if (which == 'previous') {
			var prevObj = obj.prevAll('li.ccm-block-type-available');
			if (prevObj.length > 0) {
				obj.removeClass('ccm-block-type-selected');
				$(prevObj[0]).addClass('ccm-block-type-selected');
			}
		}
		
		var currObj = $("li.ccm-block-type-selected");
		// handle scrolling
		// this is buggy. needs fixing
		/*
		var currPos = currObj.position();
		var currDialog = currObj.parents('div.ccm-dialog-content');
		var docViewTop = currDialog.scrollTop() + 80;
		var docViewBottom = docViewTop + currDialog.innerHeight();
	
		var elemTop = currObj.offset().top;
		var elemBottom = elemTop + currObj.innerHeight();

		console.log(elemBottom);
		console.log(docViewBottom);
		if ((elemBottom - docViewBottom)) {
			var cd = currDialog.get(0);
			cd.scrollTop += 50;
		}
		*/

	}	
	return true;
	
}

$(function() {
	if (!ccmBlockTypeBound) {
		ccmBlockTypeBound = true;
		$(window).css('overflow', 'hidden');
		$(window).keydown(function(e) {
			if (e.keyCode == 9) {
				e.stopPropagation();
				e.preventDefault();
				$("input[name=ccmBlockTypeSearch]").focus();
				return true;
			}
			if (e.keyCode == 8) {
				$("input[name=ccmBlockTypeSearch]").val('');
				e.stopPropagation();
				e.preventDefault();
				return true;
			}
			if (e.keyCode == 40) {
				ccmBlockTypeSearchResultsSelect('next', e);
			} else if (e.keyCode == 38) {
				ccmBlockTypeSearchResultsSelect('previous', e);
			} else if (e.keyCode == 13) {
				var obj = $("li.ccm-block-type-selected");
				if (obj.length > 0) {
					obj.find('a').click();
				}
			}<commit_msg>fixing block style shit<commit_after><? 
defined('C5_EXECUTE') or die(_("Access Denied."));
$btl = $a->getAddBlockTypes($c, $ap );
$blockTypes = $btl->getBlockTypeList();
$ci = Loader::helper('concrete/urls');
$ch = Loader::helper('concrete/interface');
$form = Loader::helper('form');

?>

<script type="text/javascript" src="<?=ASSETS_URL_JAVASCRIPT?>/quicksilver.js"></script>
<script type="text/javascript" src="<?=ASSETS_URL_JAVASCRIPT?>/jquery.liveupdate.js"></script>


<script type="text/javascript">
<? if (ENABLE_MARKETPLACE_SUPPORT) { ?>

ccm_isRemotelyLoggedIn = '<?=UserInfo::isRemotelyLoggedIn()?>';
ccm_remoteUID = <?=UserInfo::getRemoteAuthUserId() ?>;
ccm_remoteUName = '<?=UserInfo::getRemoteAuthUserName()?>';
ccm_loginInstallSuccessFn = function() { jQuery.fn.dialog.closeTop(); };

function ccm_loginSuccess(jsObj) {
	ccm_isRemotelyLoggedIn = true;
	ccm_remoteUID = jsObj.uID;
	ccm_remoteUName = jsObj.uName;
	jQuery.fn.dialog.closeTop();
	ccm_updateMarketplaceTab();
	ccmAlert.notice('Marketplace Login', ccmi18n.marketplaceLoginSuccessMsg);
}
function ccm_logoutSuccess() {
	ccm_isRemotelyLoggedIn = false;
	ccm_updateMarketplaceTab();
	ccmAlert.notice('Marketplace Logout', ccmi18n.marketplaceLogoutSuccessMsg);
}
function ccm_updateLoginArea() {
	if (ccm_isRemotelyLoggedIn) {
		$("#ccm-marketplace-logged-in").show();
		$("#ccm-marketplace-logged-out").hide();
	} else {
		$("#ccm-marketplace-logged-in").hide();
		$("#ccm-marketplace-logged-out").show();
	}
}
function ccm_updateMarketplaceTab() {
	$("#ccm-add-marketplace-tab div.ccm-block-type-list").html(ccmi18n.marketplaceLoadingMsg);
	$.ajax({
        url: CCM_TOOLS_PATH+'/marketplace/refresh_block',
        type: 'POST',
        success: function(html){
			$("#ccm-add-marketplace-tab div.ccm-block-type-list").html(html);
			ccm_updateLoginArea();
			ccmLoginHelper.bindInstallLinks();
        },
	});
}

ccm_showBlockTypeDescription = function(btID) {
	$("#ccm-bt-help" + btID).show();
}

var ccm_areaActiveTab = "ccm-add";

$("#ccm-area-tabs a").click(function() {
	$("li.ccm-nav-active").removeClass('ccm-nav-active');
	$("#" + ccm_areaActiveTab + "-tab").hide();
	ccm_areaActiveTab = $(this).attr('id');
	$(this).parent().addClass("ccm-nav-active");
	$("#" + ccm_areaActiveTab + "-tab").show();
});

$(document).ready(function(){
	ccm_updateMarketplaceTab();
});

<? } ?>

$('input[name=ccmBlockTypeSearch]').focus(function() {
	if ($(this).val() == '<?=t("Search")?>') {
		$(this).val('');
	}
	$(this).css('color', '#000');

	if (!ccmLiveSearchActive) {
		$('#ccmBlockTypeSearch').liveUpdate('ccm-block-type-list');
		ccmLiveSearchActive = true;
		$("#ccm-block-type-clear-search").show();
	}
});

ccmBlockTypeSearchFormCheckResults = function() {
	return false;
}

ccmBlockTypeSearchClear = function() {
	$("input[name=ccmBlockTypeSearch]").val('');
	$("#ccm-block-type-list li.ccm-block-type").addClass("ccm-block-type-available");
	$("#ccm-block-type-list li.ccm-block-type").removeClass("ccm-block-type-selected");
}

var ccmLiveSearchActive = false;
if (typeof(ccmBlockTypeBound) == 'undefined') {
	var ccmBlockTypeBound = false;
}
ccmBlockTypeSearchResultsSelect = function(which, e) {
	e.preventDefault();
	e.stopPropagation();
	$("input[name=ccmBlockTypeSearch]").blur();
	// find the currently selected item
	var obj = $("li.ccm-block-type-selected");
	var foundblock = false;
	if (obj.length == 0) {
		$($("#ccm-block-type-list li.ccm-block-type-available")[0]).addClass('ccm-block-type-selected');
	} else {
		if (which == 'next') {
			var nextObj = obj.nextAll('li.ccm-block-type-available');
			if (nextObj.length > 0) {
				obj.removeClass('ccm-block-type-selected');
				$(nextObj[0]).addClass('ccm-block-type-selected');
			}
		} else if (which == 'previous') {
			var prevObj = obj.prevAll('li.ccm-block-type-available');
			if (prevObj.length > 0) {
				obj.removeClass('ccm-block-type-selected');
				$(prevObj[0]).addClass('ccm-block-type-selected');
			}
		}
		
	}	

	var currObj = $("li.ccm-block-type-selected");
	// handle scrolling
	// this is buggy. needs fixing

	var currPos = currObj.position();
	var currDialog = currObj.parents('div.ccm-dialog-content');
	var docViewTop = currDialog.scrollTop();
	var docViewBottom = docViewTop + currDialog.innerHeight();

	var elemTop = currObj.position().top;
	var elemBottom = elemTop + docViewTop + currObj.innerHeight();

	console.log(elemTop + '-' + docViewTop + '-' + elemBottom + '-' + docViewBottom);
	
	if ((docViewBottom - elemBottom) < 0) {
		currDialog.get(0).scrollTop += currDialog.get(0).scrollTop + currObj.height();
	} else if (elemTop < 0) {
		currDialog.get(0).scrollTop -= currDialog.get(0).scrollTop + currObj.height();
	}


	return true;
	
}

$(function() {
	if (!ccmBlockTypeBound) {
		ccmBlockTypeBound = true;
		$(window).css('overflow', 'hidden');
		$(window).keydown(function(e) {
			if (e.keyCode == 9) {
				e.stopPropagation();
				e.preventDefault();
				$("input[name=ccmBlockTypeSearch]").focus();
				return true;
			}
			if (e.keyCode == 8) {
				$("input[name=ccmBlockTypeSearch]").val('');
				e.stopPropagation();
				e.preventDefault();
				return true;
			}
			if (e.keyCode == 40) {
				ccmBlockTypeSearchResultsSelect('next', e);
			} else if (e.keyCode == 38) {
				ccmBlockTypeSearchResultsSelect('previous', e);
			} else if (e.keyCode == 13) {
				var obj = $("li.ccm-block-type-selected");
				if (obj.length > 0) {
					obj.find('a').click();
				}
			}
{'fraction_non_alphanumeric': 0.19977678571428573, 'fraction_numerical': 0.005673363095238095, 'mean_word_length': 4.821873308067136, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6535040', 'n_tokens_mistral': 4223, 'n_tokens_neox': 3983, 'n_words': 545}