function getDockedRect($target, searchSekector) {
var $targetCoordinates = getCoordinates($target);
var result = [];
$(searchSekector).each(function (i, el) {
var $el = $(el);
var coordinates = getCoordinates($el);
isDokked = !!(coordinates.top === $targetCoordinates.bottom
|| coordinates.bottom === $targetCoordinates.top
|| coordinates.left === $targetCoordinates.right
|| coordinates.right === $targetCoordinates.left);
if (isDokked) result.push(el);
});
return result;
}
function getCoordinates($target) {
var coordinates = $target.offset();
coordinates.bottom = coordinates.top + $target.height();
coordinates.right = coordinates.left + $target.width();
return coordinates;
}
$myBlock = $('#block_1');
var dockIds = getDockedRect($myBlock, '.rects').map(el => $(el).attr('id'));
alert('С #block_1 стоят рядом: ' + dockIds.join(','));
jQuery.getJSON(alaxMenu.URL, alaxMenu.params, function(resp) {
if (resp.success === true) {
jQuery('menu').append(resp.data);
}
});
wp_localize_script('views-counter', 'alaxMenu', array(
'url' => admin_url('admin-ajax.php'),
'params' => array(
'action' => 'ajax_menu',
'_ajax_nonce' => wp_create_nonce('ajax_menu_nonce'),
)
));
function get_ajax_menu( $post_object ) {
check_ajax_referer('ajax_menu_nonce');
wp_send_json_success(wp_nav_menu( array(
'theme_location' => 'ajax_load',
'container' => false,
'echo' => false,
'items_wrap' => false
) ));
}
add_action('wp_ajax_get_ajax_menu', 'get_ajax_menu');
add_action('wp_ajax_nopriv_get_ajax_menu', 'get_ajax_menu');
var port = chrome.runtime.connect({name: "ClickButton"});
port.postMessage();
chrome.runtime.onConnect.addListener(function(port) {
port.onMessage.addListener(function(msg) {
setInterval(function(){//code}, 30000);
}
}
var port = chrome.runtime.connect({name: "ClickButton"});
chrome.runtime.onConnect.addListener(function(port) {
setInterval(function(){//code}, 30000);
}