Есть такой код, во всплывающем окне вылезает список с выбором города.
Но появляется этот список с огромной задержкой.
Если файл открываешь напрямую с адресной строки (т.е. без модального окна), то загрузка мгновенная.
В браузере вот это в консоле [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check
Как ускорить?
[CODE]<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
if($APPLICATION->editArea === false)
{
$APPLICATION->editArea = new CEditArea();
}
$APPLICATION->editArea->includeAreaIndex = array(100);
$APPLICATION->ShowHeadScripts();
$city = "";
if(intval($_SESSION["CITY_ID"]) > 0)
{
$city = $_SESSION["CITY_ID"];
}
elseif(strlen($_SESSION["CITY_NAME"]) <= 0)
{
$city = 2006;
}
$APPLICATION->IncludeComponent(
"bitrix:sale.ajax.locations",
"location_city",
array(
"AJAX_CALL" => "N",
"COUNTRY_INPUT_NAME" => "COUNTRY",
"REGION_INPUT_NAME" => "REGION",
"CITY_INPUT_NAME" => "CITY",
"CITY_OUT_LOCATION" => "Y",
"LOCATION_VALUE" => $city,// $_SESSION["CITY_ID"] > 0 ? $_SESSION["CITY_ID"] : 2006, // Москва
"ORDER_PROPS_ID" => $arProp["ID"],
"COUNTRY" => "4",
"SIZE1" => $arProp["SIZE1"]
),
null,
array("HIDE_ICONS" => "Y")
);
?>
[/CODE]
Вот еще код
[CODE]<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
if($APPLICATION->editArea === false)
{
$APPLICATION->editArea = new CEditArea();
}
$APPLICATION->editArea->includeAreaIndex = array(100);
$APPLICATION->ShowHeadScripts();
?>
<sc ript>
$('.button.blue').on('click', function (e) {
e.preventDefault();
$.colorbox.close();
});
$('.button.gray').on('click', function (e) {
e.preventDefault();
$.colorbox({href: "/ajax/location.php"});
});
</sc ript>
<div class="accept_city" id="tooltip-city">
<span class="icon-close"></span>
<span class="tooltip-city-text">Ваш город - <?=$_SESSION["CITY_NAME"];?>?</span>
<div class="tooltip-buttons">
<button class="button blue">Да</button>
<button class="button gray">Нет</button>
</div>
</div>
[/CODE]
и еще
[CODE]$(function()
{
var initCityTooltip = function () {
var $overlay = $('#overlay');
var $tooltip = $('#tooltip-city');
var $link = $('.header-city-link');
var offset = $link.offset();
var $close = $('.icon-close', $tooltip);
/*$(window).resize(function()
{
var $link_r = $('.header-city-link');
var offset_r = $link_r.offset();
$("#colorbox").css( "left", offset_r.left - 80+"px !important");
});*/
$link.on('click', function (e) {
e.preventDefault();
var $panel = 0;
if($("#bx-panel").hasClass("bx-panel-folded"))
{
$panel = 39;
}
else if($("#bx-panel").height() > 0)
{
$panel = 147;
}
var offset = $link.offset();
$.colorbox({
href: "/ajax/accept_city.php",
//left: offset.left - 380,
top: 30 + $panel
});
});
};
initCityTooltip();
});
[/CODE]
Но появляется этот список с огромной задержкой.
Если файл открываешь напрямую с адресной строки (т.е. без модального окна), то загрузка мгновенная.
В браузере вот это в консоле [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check
Как ускорить?
[CODE]<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
if($APPLICATION->editArea === false)
{
$APPLICATION->editArea = new CEditArea();
}
$APPLICATION->editArea->includeAreaIndex = array(100);
$APPLICATION->ShowHeadScripts();
$city = "";
if(intval($_SESSION["CITY_ID"]) > 0)
{
$city = $_SESSION["CITY_ID"];
}
elseif(strlen($_SESSION["CITY_NAME"]) <= 0)
{
$city = 2006;
}
$APPLICATION->IncludeComponent(
"bitrix:sale.ajax.locations",
"location_city",
array(
"AJAX_CALL" => "N",
"COUNTRY_INPUT_NAME" => "COUNTRY",
"REGION_INPUT_NAME" => "REGION",
"CITY_INPUT_NAME" => "CITY",
"CITY_OUT_LOCATION" => "Y",
"LOCATION_VALUE" => $city,// $_SESSION["CITY_ID"] > 0 ? $_SESSION["CITY_ID"] : 2006, // Москва
"ORDER_PROPS_ID" => $arProp["ID"],
"COUNTRY" => "4",
"SIZE1" => $arProp["SIZE1"]
),
null,
array("HIDE_ICONS" => "Y")
);
?>
[/CODE]
Вот еще код
[CODE]<?
require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
if($APPLICATION->editArea === false)
{
$APPLICATION->editArea = new CEditArea();
}
$APPLICATION->editArea->includeAreaIndex = array(100);
$APPLICATION->ShowHeadScripts();
?>
<sc ript>
$('.button.blue').on('click', function (e) {
e.preventDefault();
$.colorbox.close();
});
$('.button.gray').on('click', function (e) {
e.preventDefault();
$.colorbox({href: "/ajax/location.php"});
});
</sc ript>
<div class="accept_city" id="tooltip-city">
<span class="icon-close"></span>
<span class="tooltip-city-text">Ваш город - <?=$_SESSION["CITY_NAME"];?>?</span>
<div class="tooltip-buttons">
<button class="button blue">Да</button>
<button class="button gray">Нет</button>
</div>
</div>
[/CODE]
и еще
[CODE]$(function()
{
var initCityTooltip = function () {
var $overlay = $('#overlay');
var $tooltip = $('#tooltip-city');
var $link = $('.header-city-link');
var offset = $link.offset();
var $close = $('.icon-close', $tooltip);
/*$(window).resize(function()
{
var $link_r = $('.header-city-link');
var offset_r = $link_r.offset();
$("#colorbox").css( "left", offset_r.left - 80+"px !important");
});*/
$link.on('click', function (e) {
e.preventDefault();
var $panel = 0;
if($("#bx-panel").hasClass("bx-panel-folded"))
{
$panel = 39;
}
else if($("#bx-panel").height() > 0)
{
$panel = 147;
}
var offset = $link.offset();
$.colorbox({
href: "/ajax/accept_city.php",
//left: offset.left - 380,
top: 30 + $panel
});
});
};
initCityTooltip();
});
[/CODE]