Skip to content

Commit

Permalink
Merge pull request #62 from youranreus/dev3.0
Browse files Browse the repository at this point in the history
version 3.2.9
  • Loading branch information
youranreus authored Feb 2, 2022
2 parents 54d1b7d + f9fb6f8 commit fb7a98e
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 111 deletions.
136 changes: 68 additions & 68 deletions components/OwO.php

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions components/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</nav>
</div>
<p id="footer-meta" class="clear">
<span class="left"><a class="icp" href="//beian.miit.gov.cn" rel="noopener noreferrer"><?php echo G::getICP(); ?></a></span>
<span class="left"><a class="icp" href="<?php $this->options->icpUrl(); ?>" rel="noopener noreferrer"><?php echo G::getICP(); ?></a></span>
<span class="right"><?php echo $this->options->buildYear . " - " . date("Y"); ?> &copy <?php $this->options->title(); ?></span>
</p>
</footer>
Expand All @@ -39,7 +39,7 @@
<script src="<?php echo G::staticUrl("static/js/tocbot.min.js"); ?>?v=3.211"></script>
<script src="<?php echo G::staticUrl("static/js/lib$minInfix.js"); ?>?v=3.10018"></script>
<script src="<?php echo G::staticUrl("static/js/prism.js"); ?>?v=1.03" data-manual></script>
<script src="<?php echo G::staticUrl("static/js/G$minInfix.js"); ?>?v=3.2.7.3"></script>
<script src="<?php echo G::staticUrl("static/js/G$minInfix.js"); ?>?v=3.2.8.2"></script>
<script>
<?php $this->options->customFooterJS(); ?>
</script>
Expand Down
8 changes: 6 additions & 2 deletions components/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
<?php if($this->options->enableKatex == 1): ?>
<link rel="stylesheet" href="<?php echo G::staticUrl('static/css/katex.min.css'); ?>">
<?php endif; ?>
<link rel="stylesheet" href="<?php echo G::staticUrl('static/css/G.css'); ?>?v=3.2327">
<link rel="stylesheet" href="<?php echo G::staticUrl('static/css/G.css'); ?>?v=3.2337">
<link rel="stylesheet <?php if (!isset($_COOKIE['night']) || $_COOKIE['night'] != '1') {
echo 'alternate';
} ?>" href="<?php echo G::staticUrl("static/css/dark$minInfix.css"); ?>?v=3.227" title="dark">
} ?>" href="<?php echo G::staticUrl("static/css/dark$minInfix.css"); ?>?v=3.228" title="dark">

<style>
/* 设置自定义背景[颜色/图片] */
Expand All @@ -48,6 +48,10 @@
katex: <?php echo $this->options->enableKatex == 1 ? 'true' : 'false' ?>,
imgUrl: "<?php echo G::staticUrl('static/img/'); ?>"
};

function custom_callback() {
<?php echo $this->options->customPjaxCallback; ?>
}
</script>
</head>
<body>
Expand Down
6 changes: 6 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ function themeConfig($form)
$icp = new Typecho_Widget_Helper_Form_Element_Text('icp', null, null, _t('ICP备案号'), _t('没有可以不填哟'));
$form->addInput($icp);

$icpUrl = new Typecho_Widget_Helper_Form_Element_Text('icpUrl', null, 'https://beian.miit.gov.cn', _t('备案号指向链接'), _t('默认指向工信部'));
$form->addInput($icpUrl);

$background = new Typecho_Widget_Helper_Form_Element_Text('background', null, null, _t('背景图片'), _t('可填颜色代码或者图片url'));
$form->addInput($background);

Expand Down Expand Up @@ -120,6 +123,9 @@ function themeConfig($form)
$customFooterJS = new Typecho_Widget_Helper_Form_Element_Textarea('customFooterJS', null, null, _t('自定义底部JS'), _t('body结束前'));
$form->addInput($customFooterJS);

$customPjaxCallback = new Typecho_Widget_Helper_Form_Element_Textarea('customPjaxCallback', null, null, _t('自定义Pjax回调函数'), _t('如果你不知道这个是啥,留着就好'));
$form->addInput($customPjaxCallback);

$advanceSetting = new Typecho_Widget_Helper_Form_Element_Textarea('advanceSetting', null, null, _t('高级设置'), _t('看着就很高级'));
$form->addInput($advanceSetting);

Expand Down
2 changes: 1 addition & 1 deletion libs/shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function shortcode_dplayer($atts, $content = '')
return "
<div id='dplayer-" . $args["id"] . "' class='dp'></div>
<script>
let dplayer" . $args["id"] . " = new DPlayer({
var dplayer" . $args["id"] . " = new DPlayer({
container: document.getElementById('dplayer-" . $args["id"] . "'),
preload:'auto',
autoplay: false,
Expand Down
6 changes: 4 additions & 2 deletions link.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@
<?php endif; ?>
</div>


<?php $this->need('components/footer.php'); ?>
<?php if ($this->fields->enableComment == 1): ?>
<?php $this->need('components/comments.php'); ?>
<?php endif; ?>
<?php $this->need('components/footer.php'); ?>
2 changes: 1 addition & 1 deletion static/css/G.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/css/G.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/css/G.less
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ h3.archive-title {
position: relative;

div {
&:not(.PAP-banner-background, .PAP-banner-mask) {
&:not(.PAP-banner-background):not(.PAP-banner-mask) {
position: absolute;
bottom: 1.5rem;
left: 1.5rem;
Expand Down
38 changes: 6 additions & 32 deletions static/js/G.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,14 @@ let ajaxComment = () =>{
else
{
afterSendComment(false);
let msg = newComment.querySelector('.container') ? newComment.querySelector('.container').innerHTML : newComment.childNodes[0].childNodes[0].childNodes[0].innerText;
showToast('评论失败,' + msg.replaceAll('<br>', ''));
let msg = newComment.querySelector('.container') ? newComment.querySelector('.container').innerText : newComment.childNodes[0].childNodes[0].childNodes[0].innerText;
showToast('评论失败,' + msg);
}
})
.catch((error) => {
let newComment = document.createElement('div');
newComment.innerHTML = error;
let msg = newComment.querySelector('.container') ? newComment.querySelector('.container').innerHTML : newComment.childNodes[0].childNodes[0].childNodes[0].innerText;
let msg = newComment.querySelector('.container') ? newComment.querySelector('.container').innerText : newComment.childNodes[0].childNodes[0].childNodes[0].innerText;
showToast('评论失败,' + msg.replaceAll('<br>', ''));
});
return false;
Expand Down Expand Up @@ -407,14 +407,15 @@ let pageInit = () => {
throwOnError: true
});
}
custom_callback();
};

/**
* lazyload加载
*/
let doLazyload = () => {
let banners = document.getElementsByClassName("article-banner");
let pics = document.querySelectorAll("img:not(img#header-background,img#profile-avatar)");
let pics = document.querySelectorAll("img:not(#header-background):not(#profile-avatar)");
preLazy(banners, "style", "origin");
preLazy(pics, "src", "origin", window.G_CONFIG.imgUrl + "loading2.gif");
lazyload(banners, function (element, observe) {
Expand Down Expand Up @@ -445,33 +446,6 @@ let sendLike = () => {
});
}

// window.onload = function () {
// console.log("G.js onload");
// let pjax = new Pjax({
// elements: "a:not(a[target='_blank'], a[no-pjax])", // default is "a[href], form[action]"
// selectors: ["#main", "title"],
// timeout: 10000,
// cacheBust: false,
// scrollRestoration: true
// });

// if (document.getElementById("sliderbar-video") !== undefined && document.getElementById("sliderbar-video") !== null) {
// let photo = document.getElementById("sliderbar-photo");
// let video = document.getElementById("sliderbar-video");
// photo.style.height = document.querySelector('#categoryList').offsetHeight + 'px';
// if (photo.offsetHeight >= photo.offsetWidth)
// video.style.height = photo.offsetHeight + 'px';
// else
// video.style.height = photo.offsetWidth + 'px';
// }
// else if (document.getElementById("sliderbar-photo")!== undefined && document.getElementById("sliderbar-photo") !== null){
// document.getElementById("sliderbar-photo").style.height = document.querySelector('#categoryList').offsetHeight + 'px';
// }
// autoDarkMode();
// toolbarInit();
// pageInit();
// };

/**
* pjax发送回调
*/
Expand Down Expand Up @@ -519,7 +493,7 @@ window.ready(function () {
doLazyload();
console.log("G.js ready");
let pjax = new Pjax({
elements: "a:not(a[target='_blank'], a[no-pjax])", // default is "a[href], form[action]"
elements: "a:not([target='_blank']):not([no-pjax])", // default is "a[href], form[action]"
selectors: ["#main", "title"],
timeout: 10000,
cacheBust: false,
Expand Down
2 changes: 1 addition & 1 deletion static/js/G.min.js

Large diffs are not rendered by default.

0 comments on commit fb7a98e

Please sign in to comment.