Skip to content

Commit

Permalink
优化首页js代码以及在 Android studio 和 android emulator 页面顶部添加 banner
Browse files Browse the repository at this point in the history
  • Loading branch information
inferjay committed Apr 9, 2024
1 parent 5310d3d commit 94a1c15
Show file tree
Hide file tree
Showing 14 changed files with 1,231 additions and 1,825 deletions.
258 changes: 125 additions & 133 deletions android-emulator.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!DOCTYPE html>
<html lang="zh_CN">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="icon" type="image/x-icon" href="static/image/favicon.ico">
Expand All @@ -21,6 +20,8 @@
<link rel="shortcut icon" href="static/image/favicon.png">
<link rel="apple-touch-icon" sizes="72x72" href="static/image/apple-touch-icon-72x72.png">
<link rel="apple-touch-icon" sizes="114x114" href="static/image/apple-touch-icon-114x114.png">
<script src="static/js/swiper.min.js"></script>
<link rel="stylesheet" href="static/css/swiper.min.css">
<link rel="stylesheet" href="https://cdn.staticfile.net/animate.css/4.1.1/animate.min.css" />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5517858206486320"
crossorigin="anonymous"></script>
Expand Down Expand Up @@ -197,6 +198,111 @@ <h4 class="pop-text"></h4>
</svg></span>
</div>
</div>
<section id="banner-slider">
<!-- Slider main container -->
<div class="swiper-container container mx-auto">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
<div class="swiper-slide">
<a href='https://aihunt.one?utm_source=androiddevtools.cn&amp;utm_medium=index-banner' target="_blank"
onclick="trackOutboundLink('https://aihunt.one', 'AIHunt', 'click');"
title="收录了国内外的众多 AI工具,包括AI写作工具、AI图像生成和处理、AI视频制作、AI音频转录、AI辅助编程、AI音乐生成、AI绘画设计、AI对话聊天等AI工具,以及AI学习开发的常用网站、教程、开源框架、开源模型和数据集等。">
<img src="/static/image/banner/aihunt.webp">
</a>
</div>
<div class="swiper-slide">
<a href="https://androidweekly.io?utm_source=androiddevtools.cn&amp;utm_medium=banner" target="_blank"
onclick="trackOutboundLink('https://androidweekly.io', 'AndroidWeekly', 'click');"
title="汇集互联网上每周Android开发的技术文章、开源项目、开发工具、视频教程、Android设计教程、设计资源等。">
<img src="/static/image/banner/androidweekly.webp">
</a>
</div>
<div class="swiper-slide">
<a href='http://www.materialdoc.cn?utm_source=androiddevtools.cn&amp;utm_medium=banner' target="_blank"
onclick="trackOutboundLink('https://www.materialdoc.cn', 'Materialdoc', 'click');"
title="Material Design 开发者参考文档">
<img src="/static/image/banner/materialdoc.webp">
</a>
</div>
<!-- AndroidDevTools 首页 Banner -->
<!-- <div class="swiper-slide">
<div class="ads-container">
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5517858206486320"
crossorigin="anonymous"></script>
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-5517858206486320"
data-ad-slot="4217675821"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div> -->
</div>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
</div>
<style>
:root {
--swiper-theme-color: var(--site-primary-color);
--swiper-navigation-size: 28px;
}

.swiper-container {
margin-top: 20px;
border-radius: 6px;
background-color: white;
}

.swiper-slide img {
width: 100%;
}

.swiper-pagination {
margin-bottom: 20px;

}

.swiper-pagination-bullet {
width: 12px;
height: 12px;
background: gray;
opacity: 0.6;
}

.swiper-pagination-bullet-active {
background: var(--swiper-theme-color);
}
</style>
<script>
var mySwiper = new Swiper('.swiper-container', {
// Optional parameters
direction: 'horizontal',
loop: true,
autoplay: {
delay: 4500,
disableOnInteraction: true,
},
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// If we need pagination
pagination: {
el: '.swiper-pagination',
clickable: true,
}
});
</script>
</section>
<section id="body">
<div class="container body-container pb-4">
<div class="row flex-column p-3">
Expand Down Expand Up @@ -3212,147 +3318,33 @@ <h2>Disclaimer</h2>
</div>
<!-- 评论JS代码 start (一个网页只需插入一次) -->
<link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">


<!-- 评论JS代码 end -->
<script src="https://cdn.staticfile.net/jquery/3.7.1/jquery.min.js"></script>
<script src="https://cdn.staticfile.net/bootstrap/4.6.2/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.staticfile.net/bootstrap/4.6.2/js/bootstrap.bundle.min.js"
crossorigin="anonymous"></script>
<script src="static/js/jquery.smooth-scroll.min.js"></script>
<script src="static/js/jquery-maven-artifact.min.js"></script>
<script src="static/js/jquery.toTop.min.js"></script>
<script src="static/js/google-analytics.js"></script>
<script src="static/js/unslider.min.js"></script>
<script async src="static/js/jquery-maven-artifact.min.js"></script>
<script async src="static/js/jquery.toTop.min.js"></script>
<script async src="static/js/unslider.min.js"></script>

<!-- 工具函数 -->
<script>
Array.prototype.randomDiffElement = function (last) {
if (this.length == 0) {
return;
} else if (this.length == 1) {
return this[0];
} else {
var num = 0;
do {
num = Math.floor(Math.random() * this.length);
} while (Array.isArray(last) ? last.includes(this[num]) : this[num] == last);
return this[num];
}
};
var isShow = function isShow(value) {
return value && value.isshow;
};
var now = new Date().getTime();
var isExpired = function (item) {
let start = Date.parse(item.start_time);
let end = Date.parse(item.end_time);
return item && start <= now && now <= end;
};
</script>
<!-- 右侧浮动广告 -->
<script>
let rightAdContainer = $('#auto-scroll-ad-box');
let rightAds = [
{
"title": "短期暴力提升,快速突破瓶颈。HenCoder Plus 作为一套全方位系统化的高级进阶课程,开课四期以来,吸纳了来自阿里、腾讯、百度、头条、滴滴等公司以及硅谷、台湾和日本的众多学员报名参加,多位学员在毕业一个月内先后入职阿里、腾讯、小米、头条等公司。学员年薪最高达到 80w,多位学员年薪达到 45w 左右。",
"link": "https://plus.hencoder.com",
"image": "https://i.loli.net/2019/05/23/5ce663bb003ec62326.gif",
"ad_tag": "AD-HenCoderPlus",
"isshow": true,
"start_time": "2019-3-30 00:30:00",
"end_time": "2021-8-5 00:00:00"
},
{
"title": "",
"link": "https://www.ucloud.cn/site/global.html?ytag=androiddevtools",
"image": "https://i.loli.net/2020/05/15/DOv28AnZ73qfmiE.png",
"ad_tag": "AD-UCloud",
"isshow": true,
"start_time": "2020-1-1 00:00",
"end_time": "2021-5-15 00:00"
}
];
rightAds.filter(isShow).filter(isExpired).forEach((item) => {
let { title, link, ad_tag, image } = item;
let adElement = `<div class="ad-float-right"><a href="${link}" title="${title}" onclick="trackOutboundLink('${link}', '${ad_tag}', 'click');" target="_blank"><img src="${image}"></a></div>`;
rightAdContainer.append(adElement);
});
</script>
<script async src="./static/js/utils.js"></script>

<!-- <script async src="./static/js/float-ad.js"></script> -->
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-NQH6H0E3Y6"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());

gtag('config', 'G-NQH6H0E3Y6');
var trackOutboundLink = function (url, category, action) {
var redirectTriggered = false;
gtag('send', 'event', category, action, url, {
'hitCallback': function () {
redirectTriggered = false;
window.open(url, '_blank');
}
});
};
</script>
<script src="./static/js/google-analytics.js"></script>
<!-- End Google Analytics -->
<!-- <script>
$(function() {
$('.zh-backtotop').toTop();
});
</script> -->
<script type="text/javascript">
$(function () {
// Syntax highlight code blocks.
//prettyPrint();

// Spy on scroll position for real-time updating of current section.
$('body').scrollspy();

// Use smooth-scroll for internal links.
$('a').smoothScroll();

// Enable tooltips on the header nav image items.
$('.menu').tooltip({
placement: 'bottom',
trigger: 'hover',
container: 'body',
delay: {
show: 500,
hide: 0
}
});
});
</script>
<!-- 右侧浮动广告 -->
<!-- <script async src="./static/js/right-float-ad.js"></script> -->
<!-- 顶层弹窗广告 -->
<!-- <script async src="./static/js/top-layer-pop-ad.js"></script> -->
<!-- 浮动广告 -->
<!-- add target attr to all a tag -->
<script type="text/javascript">
//bind a click
var utm_info = "utm_source=androiddevtools&utm_medium=website";
$(document).bind('DOMNodeInserted', function (event) {
$('a[href^="http"]').each(
function () {
if (!$(this).attr('target')) {
$(this).attr('target', '_blank')
}
var url = $(this).attr('href');
if (url.indexOf("androiddevtools.cn") != -1) {
$(this).attr('target', '_self')
} else {
if (url && url.indexOf(utm_info) == -1) {
if (url.indexOf("?") == -1) {
url += '?';
} else {
url += '&';
}
url += utm_info;
$(this).attr('href', url);
}
}
}
);
});
</script>
<!-- <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5e313f50a3c838b7"></script> -->
<script type="text/javascript" async src="./static/js/add-utm-info-to-link.js"> </script>
<!-- Recommend Books List -->
<!-- <script async src="./static/js/books.js"></script> -->
<script src="./static/js/smooth-scroll-to-top.js"></script>
</body>

</html>
Loading

0 comments on commit 94a1c15

Please sign in to comment.