refactor: remove jquery and fancybox

todo https://github.com/dimsemenov/photoswipe
This commit is contained in:
curben 2019-05-22 11:13:21 +09:30
parent 08fb7897e1
commit 4791c98a00
8 changed files with 1 additions and 61 deletions

View File

@ -101,10 +101,6 @@ theme_config:
# https://github.com/hexojs/hexo-generator-feed # https://github.com/hexojs/hexo-generator-feed
#rss: /atom.xml #rss: /atom.xml
# Media display enhancement
# https://github.com/fancyapps/fancyBox
fancybox: false
# Profile # Profile
nickname: curben's blog nickname: curben's blog
description: Troubleshooting, tips & tricks, etc. description: Troubleshooting, tips & tricks, etc.

View File

@ -1,14 +1,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" data-sri-fallback="/js/jquery.min.js" integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" data-sri-fallback="/js/clipboard.min.js" integrity="sha384-8CYhPwYlLELodlcQV713V9ZikA3DlCVaXFDpjHfP8Z36gpddf/Vrt47XmKDsCttu" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" data-sri-fallback="/js/clipboard.min.js" integrity="sha384-8CYhPwYlLELodlcQV713V9ZikA3DlCVaXFDpjHfP8Z36gpddf/Vrt47XmKDsCttu" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/cloudinary-core/2.6.3/cloudinary-core-shrinkwrap.min.js" data-sri-fallback="/js/cloudinary-core-shrinkwrap.min.js" integrity="sha384-AtUi14V2IZNnJArkg9+Z7S73y5MplnidfGOr3uLWrW2VTnQKUnJnRZl0IdvfTueI" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/cloudinary-core/2.6.3/cloudinary-core-shrinkwrap.min.js" data-sri-fallback="/js/cloudinary-core-shrinkwrap.min.js" integrity="sha384-AtUi14V2IZNnJArkg9+Z7S73y5MplnidfGOr3uLWrW2VTnQKUnJnRZl0IdvfTueI" crossorigin="anonymous"></script>
<% if (theme.fancybox) { %>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" data-sri-fallback="/fancybox/jquery.fancybox.min.js" integrity="sha384-Zm+UU4tdcfAm29vg+MTbfu//q5B/lInMbMCr4T8c9rQFyOv6PlfQYpB5wItcXWe7" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" data-sri-fallback="/fancybox/jquery.fancybox.min.css" integrity="sha384-Q8BgkilbsFGYNNiDqJm69hvDS7NCJWOodvfK/cwTyQD4VQA0qKzuPpvqNER1UC0F" crossorigin="anonymous">
<% } %>
<%/* javascript of Typing theme */%> <%/* javascript of Typing theme */%>
<%- js('js/typing') %> <%- js('js/typing') %>

View File

@ -2,7 +2,7 @@
<div class="article-gallery"> <div class="article-gallery">
<div class="article-gallery-photos"> <div class="article-gallery-photos">
<% post.photos.forEach(function(photo, i) { %> <% post.photos.forEach(function(photo, i) { %>
<a class="article-gallery-img fancybox" href="<%- url_for(photo) %>" rel="gallery_<%= post._id %>"> <a class="article-gallery-img" href="<%- url_for(photo) %>" rel="gallery_<%= post._id %>">
<img src="<%- url_for(photo) %>" itemprop="image"> <img src="<%- url_for(photo) %>" itemprop="image">
</a> </a>
<% }) %> <% }) %>

View File

@ -968,11 +968,6 @@ blockquote {
font-size: 2em; font-size: 2em;
} }
.article a.fancybox,
.article a.fancybox-item {
border: 0;
}
.article .caption { .article .caption {
color: #cacdd0; color: #cacdd0;
display: block; display: block;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,30 +1,3 @@
(($) => {
// Fancybox caption
$('.article-entry').each((i) => {
$(this).find('img').each(() => {
// Don't insert fancybox element to cloudinary's cld-responsive img class
if ($(this).hasClass('cld-responsive') || $(this).parent().hasClass('fancybox')) return
const alt = this.alt
if (alt) {
$(this).after('<span class="caption">' + alt + '</span>')
}
$(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>')
})
$(this).find('.fancybox').each(() => {
$(this).attr('rel', 'article' + i)
})
})
if ($.fancybox) {
$('.fancybox').fancybox()
}
})(jQuery)
// Search button function // Search button function
const searchClick = document.getElementById('searchClick') const searchClick = document.getElementById('searchClick')
searchClick.onclick = function() { searchClick.onclick = function() {