Skip to content

Commit

Permalink
✨ 增加资源的pjax白名单处理
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Jan 29, 2023
1 parent ff159e9 commit e2a0ab2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions inc/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,16 @@ function pk_init_register_assets()
add_filter('style_loader_tag', 'pk_assets_href_handle', 10, 3);
function pk_assets_scr_handle($tag, $handle, $source)
{
if (str_starts_with($handle, 'puock')) {
if (str_starts_with($handle, 'puock') && strpos($source,'instant=true')===false)
{
$tag = str_replace(' src', ' data-no-instant src', $tag);
}
return $tag;
}

function pk_assets_href_handle($tag, $handle, $source)
{
if (str_starts_with($handle, 'puock')) {
if (str_starts_with($handle, 'puock') && strpos($source,'instant=true')===false) {
$tag = str_replace(' href', ' data-no-instant href', $tag);
}
return $tag;
Expand Down

0 comments on commit e2a0ab2

Please sign in to comment.