Created
June 2, 2020 07:26
-
-
Save bxtimur/8d38d5858f8e880ce3bc514c333afd65 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddEventHandler("main", "OnEndBufferContent", "deleteKernel"); | |
function deleteKernel(&$content) { | |
global $APPLICATION; | |
if (strpos($APPLICATION->GetCurDir(), "/bitrix/") !== false) { | |
return; | |
} | |
$arPatternsToRemove = Array( | |
//Убираем лишние скрипты битрикса*/ | |
'/<script.+?src=".+?bitrix\/js\/main\/core\/core[^"]+"><\/script\>/', | |
'/<script.+?>BX\.(setCSSList|setJSList)\(\[.+?\]\).*?<\/script>/', | |
'/<script.+?src=".+?loadext[\w\d_\.\/]+\.js\?\d+"><\/script\>/', | |
'/<script[^>]+?>.+?bx-core.+?<\/script>/', | |
'/<script.+?src=".+?kernel_main[\w\d_\-\/]+\.js\?\d+"><\/script\>/', | |
'/<script.+?>if\(\!window\.BX\)window\.BX.+?<\/script>/', | |
'/<script[^>]+?>\(window\.BX\|\|top\.BX\)\.message[^<]+<\/script>/', | |
//Убираем лишние стили битрикса | |
'/<link.+?href=".+?kernel_main\/kernel_main_v1\.css\?\d+"[^>]+>/', | |
'/<link.+?href=".+?bitrix\/js\/main\/core\/css\/core[^"]+"[^>]+>/', | |
'/<link.+?href=".+?bitrix\/js\/ui\/fonts\/opensans\/ui\.font\.opensans\.min\.css\?\d+"[^>]+>/', | |
'/<link.+?href=".+?bitrix\/templates\/[\w\d_-]+\/styles.css[^"]+"[^>]+>/', | |
'/<link.+?href=".+?bitrix\/templates\/[\w\d_-]+\/template_styles.css[^"]+"[^>]+>/', | |
); | |
$content = preg_replace($arPatternsToRemove, "", $content); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment