编辑文件后,我使用ctrl + s或通过Autosave保存它,关闭文件,如果您打开此文件,则取消上次执行的操作(ctrl + z 和 ctrl + y)继续起作用。您能告诉我如何禁用此功能吗?在 Vscode 更新之前,情况并非如此。
主页
/
user-283260
Анастасия's questions
window.addEventListener('DOMContentLoaded', function() {
const scrollUpButton = document.querySelector('.backToTop');
if (scrollUpButton) {
scrollUpButton.addEventListener('click', function name() {
window.scrollTo({
top: 0,
behavior: 'smooth',
});
});
window.addEventListener('scroll', function() {
const scrolled = window.pageYOffset || document.documentElement.scrollTop;
if (scrolled >= 800) {
scrollUpButton.classList.add('backToTop_visible');
} else {
scrollUpButton.classList.remove('backToTop_visible');
}
});
}
});
.backToTop {
display: none;
position: fixed;
width: 45px;
height: 45px;
background-color: #000;
line-height: 45px;
text-align: center;
color: #fff;
top: auto;
left: auto;
right: 60px;
bottom: 120px;
cursor: pointer;
border-radius: 2px;
transition: opacity .3s ease-in;
opacity: 0.6;
}
.backToTop::before {
display: inline-block;
position: relative;
vertical-align: middle;
content: '';
background-image: url("../img/sprites/svgSprites.svg#backToTop");
background-repeat: no-repeat;
background-size: 20px 20px;
width: 20px;
height: 20px;
}
.backToTop:hover {
opacity: 1;
}
.backToTop_visible {
display: block;
}
<div class="backToTop page__backToTop icon_backToTop"></div>
该文件有一个路径,例如:
C:\Users\Nastya\Desktop\Project\app\views\pages\button.html
C:\Users\Nastya\Desktop\Project\app\views\pages\gallery.html
C:\Users\Nastya\Desktop\Project\app\views\pages\heading.html
C:\Users\Nastya\Desktop\Project\app\views\pages\index.html
C:\Users\Nastya\Desktop\Project\app\views\pages\paragraph.html
C:\Users\Nastya\Desktop\Project\app\views\pages\table.html
C:\Users\Nastya\Desktop\Project\app\views\pages\blog\index.html
C:\Users\Nastya\Desktop\Project\app\views\pages\blog\cat\index.html
如何获得:
/button/
/gallery/
/heading/
/
/paragraph/
/table/
/blog/
/blog/cat/
不知道下一步该怎么做?
function resolve(paths) {
var ret = path.dirname(paths);
var base = path.basename(paths, path.extname(paths));
if (base != 'index') ret = path.join(ret, base);
return ret;
}
事实证明:
C:\Users\Nastya\Desktop\Project\app\views\pages\button
C:\Users\Nastya\Desktop\Project\app\views\pages\gallery
C:\Users\Nastya\Desktop\Project\app\views\pages\heading
C:\Users\Nastya\Desktop\Project\app\views\pages
C:\Users\Nastya\Desktop\Project\app\views\pages\paragraph
C:\Users\Nastya\Desktop\Project\app\views\pages\table
C:\Users\Nastya\Desktop\Project\app\views\pages\blog
C:\Users\Nastya\Desktop\Project\app\views\pages\blog\cat
你好!有代码,wordpreswp_link_pages
上的替代方法,用于显示多页帖子的页面导航链接。你能告诉我如何为链接添加属性吗?应该是这样的,例如:class="page-link"
<a class="page-link" href="#">1</a>
function kama_link_pages(){
$text_num_page = '';
$num_pages = 10;
$stepLink = 10;
$dotright_text = '…';
$dotright_text2 = '…';
$backtext = '« назад';
$nexttext = 'вперед »';
$first_page_text = '« к началу';
$last_page_text = 'в конец »';
global $page, $numpages;
$paged = (int) $page;
$max_page = $numpages;
if( $max_page <= 1 )
return false;
if( empty($paged) || $paged == 0) $paged = 1;
$pages_to_show = intval($num_pages);
$pages_to_show_minus_1 = $pages_to_show-1;
$half_page_start = floor($pages_to_show_minus_1/2);
$half_page_end = ceil($pages_to_show_minus_1/2);
$start_page = $paged - $half_page_start;
$end_page = $paged + $half_page_end;
if( $start_page <= 0)
$start_page = 1;
if( ($end_page - $start_page) != $pages_to_show_minus_1 )
$end_page = $start_page + $pages_to_show_minus_1;
if( $end_page > $max_page ){
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = (int) $max_page;
}
if( $start_page <= 0 ) $start_page = 1;
$out = '<div class="wp-pagenavi">'. "\n";
if( $text_num_page ){
$text_num_page = preg_replace ('!{current}|{last}!', '%s', $text_num_page );
$out .= sprintf ("<span class='pages'>$text_num_page</span>", $paged,$max_page );
}
if( $backtext && $paged != 1 )
$out.= _wp_link_page($paged-1) . $backtext .'</a>';
if( $start_page >= 2 && $pages_to_show < $max_page ) {
$out .= _wp_link_page(1) . ( $first_page_text ?: 1 ) .'</a>';
if( $dotright_text && $start_page != 2 )
$out.= '<span class="extend">'. $dotright_text .'</span>';
}
for( $i = $start_page; $i <= $end_page; $i++ ){
if( $i == $paged )
$out .= '<span class="current">'. $i .'</span>';
else
$out .= _wp_link_page($i) . $i .'</a>';
}
if( $stepLink && $end_page < $max_page ){
for( $i=$end_page+1; $i<=$max_page; $i++ ){
if( $i % $stepLink == 0 && $i !== $num_pages ){
if( ++$dd == 1 )
$out.= '<span class="extend">'. $dotright_text2 .'</span>';
$out .= _wp_link_page($i) . $i .'</a>';
}
}
}
if( $end_page < $max_page ) {
if( $dotright_text && $end_page != ($max_page-1) )
$out.= '<span class="extend">'. $dotright_text2 .'</span>';
$out .= _wp_link_page($max_page) . ( $last_page_text ?: $max_page ) .'</a>';
}
if( $nexttext && $paged != $end_page )
$out .= _wp_link_page($paged+1) . $nexttext .'</a>';
$out .= '</div>';
return $out;
}