Skip to content

Commit

Permalink
Merge pull request #54 from youranreus/dev3.0
Browse files Browse the repository at this point in the history
version 3.2.8
  • Loading branch information
youranreus authored Dec 23, 2021
2 parents 17fa748 + b8ba4a7 commit 54d1b7d
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 34 deletions.
2 changes: 1 addition & 1 deletion components/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"></script>
<script src="<?php echo G::staticUrl("static/js/G$minInfix.js"); ?>?v=3.2.7.3"></script>
<script>
<?php $this->options->customFooterJS(); ?>
</script>
Expand Down
3 changes: 2 additions & 1 deletion components/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
<?php $this->options->customHeaderJS(); ?>

window.G_CONFIG = {
katex: <?php echo $this->options->enableKatex == 1 ? 'true' : 'false' ?>
katex: <?php echo $this->options->enableKatex == 1 ? 'true' : 'false' ?>,
imgUrl: "<?php echo G::staticUrl('static/img/'); ?>"
};
</script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @package G
* @author 季悠然
* @version 3.2.7R
* @version 3.2.8
* @link https://季悠然.space
*/

Expand Down
2 changes: 1 addition & 1 deletion libs/G.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class G
*
* @var string
*/
public static $version = "3.2.7R";
public static $version = "3.2.8";

/**
* 主题配置
Expand Down
15 changes: 15 additions & 0 deletions redirect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php
/**
* 重定向
*
* @package custom
*/
?>

<div style="display: flex;height: 100vh;justify-content: center; align-items: center;">
<h2 style="opacity: 0.3; font-weight: 200;font-size: 2.5rem">跳转中...</h2>
</div>

<script type="text/javascript">
setTimeout(()=>{window.location.href= '<?php echo $this->fields->redirectURL ;?>'},<?php echo $this->fields->redirectSecond ;?>)
</script>
Binary file added static/img/loading2.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 55 additions & 29 deletions static/js/G.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,15 @@ let ajaxComment = () =>{
else
{
afterSendComment(false);
showToast('评论失败,' + newComment.querySelector('.container').innerHTML);
let msg = newComment.querySelector('.container') ? newComment.querySelector('.container').innerHTML : newComment.childNodes[0].childNodes[0].childNodes[0].innerText;
showToast('评论失败,' + msg.replaceAll('<br>', ''));
}
})
.catch((error) => {
let newComment = document.createElement('div');
newComment.innerHTML = error;
showToast('评论失败,' + newComment.querySelector('.container').innerHTML);
let msg = newComment.querySelector('.container') ? newComment.querySelector('.container').innerHTML : newComment.childNodes[0].childNodes[0].childNodes[0].innerText;
showToast('评论失败,' + msg.replaceAll('<br>', ''));
});
return false;
};
Expand Down Expand Up @@ -414,7 +416,7 @@ let doLazyload = () => {
let banners = document.getElementsByClassName("article-banner");
let pics = document.querySelectorAll("img:not(img#header-background,img#profile-avatar)");
preLazy(banners, "style", "origin");
preLazy(pics, "src", "origin", "https://cdn.jsdelivr.net/gh/youranreus/[email protected]/G/IMG/loading2.gif");
preLazy(pics, "src", "origin", window.G_CONFIG.imgUrl + "loading2.gif");
lazyload(banners, function (element, observe) {
lazyBanner(element, observe);
});
Expand Down Expand Up @@ -443,32 +445,32 @@ 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();
};
// 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 @@ -515,6 +517,30 @@ document.addEventListener('pjax:complete', () => {

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]"
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();
});

window.onbeforeunload = function () {
Expand Down
2 changes: 1 addition & 1 deletion static/js/G.min.js

Large diffs are not rendered by default.

0 comments on commit 54d1b7d

Please sign in to comment.