🐛 fix: share

This commit is contained in:
shenyu 2021-03-11 14:12:21 +08:00
parent 8de56d6a6e
commit 501ce9a842
3 changed files with 5 additions and 6 deletions

View File

@ -1,10 +1,9 @@
function generate(url, opts) {
var url = url.replace(/<%-sUrl%>/g, encodeURIComponent(opts.sUrl))
.replace(/<%-sTitle%>/g, opts.sTitle)
.replace(/<%-sDesc%>/g, opts.sDesc)
.replace(/<%-sTitle%>/g, encodeURIComponent(opts.sTitle))
.replace(/<%-sDesc%>/g, encodeURIComponent(opts.sDesc))
.replace(/<%-sPic%>/g, encodeURIComponent(opts.sPic));
window.open(url);
}
@ -30,7 +29,7 @@ function handleClick(type, opts) {
} else if (type === 'facebook') {
generate('https://www.facebook.com/sharer/sharer.php?u=<%-sUrl%>', opts)
} else if (type === 'twitter') {
generate('https://twitter.com/intent/tweet?text=<%-sTitle%>&url=<%-sUrl%>&via=<%-config.url%>', opts)
generate('https://twitter.com/intent/tweet?text=<%-sTitle%>&url=<%-sUrl%>', opts)
} else if (type === 'google') {
generate('https://plus.google.com/share?url=<%-sUrl%>', opts)
} else if (type === 'weixin') {

2
source/dist/main.js vendored
View File

@ -3,7 +3,7 @@ parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcel
},{}],"jSg4":[function(require,module,exports) {
!function(e){var o=e(".search-form-wrap"),a=!1;e(".nav-item-search").click(function(){var s;a||(a=!0,o.addClass("on"),s=function(){e(".local-search-input").focus()},setTimeout(function(){a=!1,s&&s()},200))}),e(document).mouseup(function(a){var s=e(".local-search");s.is(a.target)||0!==s.has(a.target).length||o.removeClass("on")}),e(".local-search").size()&&e.getScript("/js/search.js",function(){searchFunc("/search.xml","local-search-input","local-search-result")});var s;e(".share-outer").click(function(){return e(".share-wrap").fadeToggle()}),e("img.lazy").lazyload({effect:"fadeIn"}),e("#gallery").justifiedGallery({rowHeight:200,margins:5}),e(document).ready(function(e){e(".anchor").click(function(o){o.preventDefault(),e("main").animate({scrollTop:e(".cover").height()},"smooth")})}),(s=e("#totop")).hide(),e(".content").scroll(function(){e(".content").scrollTop()>1e3?e(s).stop().fadeTo(200,.6):e(s).stop().fadeTo(200,0)}),e(s).click(function(){return e(".content").animate({scrollTop:0},1e3),!1});var n=e(".content"),r=e(".sidebar");e(".navbar-toggle").on("click",function(){e(".content,.sidebar").addClass("anim"),n.toggleClass("on"),r.toggleClass("on")}),e("#reward-btn").click(function(){e("#reward").fadeIn(150),e("#mask").fadeIn(150)}),e("#reward .close, #mask").click(function(){e("#mask").fadeOut(100),e("#reward").fadeOut(100)}),1==sessionStorage.getItem("darkmode")?(e("body").addClass("darkmode"),e("#todark i").removeClass("ri-moon-line").addClass("ri-sun-line")):(e("body").removeClass("darkmode"),e("#todark i").removeClass("ri-sun-line").addClass("ri-moon-line")),e("#todark").click(function(){1==sessionStorage.getItem("darkmode")?(e("body").removeClass("darkmode"),e("#todark i").removeClass("ri-sun-line").addClass("ri-moon-line"),sessionStorage.removeItem("darkmode")):(e("body").addClass("darkmode"),e("#todark i").removeClass("ri-moon-line").addClass("ri-sun-line"),sessionStorage.setItem("darkmode",1))});console.log("%c%s%c%s%c%s","background-color: #49b1f5; color: #fff; padding: 8px; font-size: 14px;","主题不错⭐star 支持一下 ->","background-color: #ffbca2; padding: 8px; font-size: 14px;","https://github.com/Shen-Yu/hexo-theme-ayer","background-color: #eaf8ff;","\n\n _ __ _______ _____ \n / \\ \\ \\ / / ____| _ \\ \n / _ \\ \\ V /| _| | |_) | \n / ___ \\ | | | |___| _ < \n /_/ \\_\\ _| |_____|_| \\__\\ \n"),document.write('<script type="text/javascript" src="https://js.users.51.la/20544303.js"><\/script>')}(jQuery);
},{}],"BNiz":[function(require,module,exports) {
function e(e,t){e=e.replace(/<%-sUrl%>/g,encodeURIComponent(t.sUrl)).replace(/<%-sTitle%>/g,t.sTitle).replace(/<%-sDesc%>/g,t.sDesc).replace(/<%-sPic%>/g,encodeURIComponent(t.sPic));window.open(e)}function t(){$(".wx-share-modal").addClass("in ready"),$("#share-mask").show()}function s(){$(".wx-share-modal").removeClass("in ready"),$("#share-mask").hide()}function r(s,r){"weibo"===s?e("http://service.weibo.com/share/share.php?url=<%-sUrl%>&title=<%-sTitle%>&pic=<%-sPic%>",r):"qq"===s?e("http://connect.qq.com/widget/shareqq/index.html?url=<%-sUrl%>&title=<%-sTitle%>&source=<%-sDesc%>",r):"douban"===s?e("https://www.douban.com/share/service?image=<%-sPic%>&href=<%-sUrl%>&name=<%-sTitle%>&text=<%-sDesc%>",r):"qzone"===s?e("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=<%-sUrl%>&title=<%-sTitle%>&pics=<%-sPic%>&summary=<%-sDesc%>",r):"facebook"===s?e("https://www.facebook.com/sharer/sharer.php?u=<%-sUrl%>",r):"twitter"===s?e("https://twitter.com/intent/tweet?text=<%-sTitle%>&url=<%-sUrl%>&via=<%-config.url%>",r):"google"===s?e("https://plus.google.com/share?url=<%-sUrl%>",r):"weixin"===s&&t()}var c=function(){var e=document.querySelectorAll(".share-sns");if(e&&0!==e.length){var t=window.location.href,c=document.querySelector("title").innerHTML,o=document.querySelectorAll(".article-entry img").length?document.querySelector(".article-entry img").getAttribute("src"):"";""===o||/^(http:|https:)?\/\//.test(o)||(o=window.location.origin+o),e.forEach(function(e){e.onclick=function(s){r(e.getAttribute("data-type"),{sUrl:t,sPic:o,sTitle:c,sDesc:c})}}),document.querySelector("#mask").onclick=s,document.querySelector(".modal-close").onclick=s}};c();
function e(e,t){e=e.replace(/<%-sUrl%>/g,encodeURIComponent(t.sUrl)).replace(/<%-sTitle%>/g,encodeURIComponent(t.sTitle)).replace(/<%-sDesc%>/g,encodeURIComponent(t.sDesc)).replace(/<%-sPic%>/g,encodeURIComponent(t.sPic));window.open(e)}function t(){$(".wx-share-modal").addClass("in ready"),$("#share-mask").show()}function s(){$(".wx-share-modal").removeClass("in ready"),$("#share-mask").hide()}function o(s,o){"weibo"===s?e("http://service.weibo.com/share/share.php?url=<%-sUrl%>&title=<%-sTitle%>&pic=<%-sPic%>",o):"qq"===s?e("http://connect.qq.com/widget/shareqq/index.html?url=<%-sUrl%>&title=<%-sTitle%>&source=<%-sDesc%>",o):"douban"===s?e("https://www.douban.com/share/service?image=<%-sPic%>&href=<%-sUrl%>&name=<%-sTitle%>&text=<%-sDesc%>",o):"qzone"===s?e("http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=<%-sUrl%>&title=<%-sTitle%>&pics=<%-sPic%>&summary=<%-sDesc%>",o):"facebook"===s?e("https://www.facebook.com/sharer/sharer.php?u=<%-sUrl%>",o):"twitter"===s?e("https://twitter.com/intent/tweet?text=<%-sTitle%>&url=<%-sUrl%>",o):"google"===s?e("https://plus.google.com/share?url=<%-sUrl%>",o):"weixin"===s&&t()}var r=function(){var e=document.querySelectorAll(".share-sns");if(e&&0!==e.length){var t=window.location.href,r=document.querySelector("title").innerHTML,c=document.querySelectorAll(".article-entry img").length?document.querySelector(".article-entry img").getAttribute("src"):"";""===c||/^(http:|https:)?\/\//.test(c)||(c=window.location.origin+c),e.forEach(function(e){e.onclick=function(s){o(e.getAttribute("data-type"),{sUrl:t,sPic:c,sTitle:r,sDesc:r})}}),document.querySelector("#mask").onclick=s,document.querySelector(".modal-close").onclick=s}};r();
},{}],"epB2":[function(require,module,exports) {
"use strict";require("./css/style.styl"),require("./js/ayer"),require("./js/share");
},{"./css/style.styl":"MiQR","./js/ayer":"jSg4","./js/share":"BNiz"}]},{},["epB2"], null)

View File

@ -42,7 +42,7 @@
margin-bottom: 10px;
}</style>
<script>
window.TREE_DATA = {"groups":[{"label":"main.js","path":".\\source\\dist\\main.js","weight":5567,"formattedSize":"5.44 KB","formattedGzipSize":"2.23 KB","formattedTime":"28.36s","isTooLarge":false,"groups":[{"label":"source-src","path":".\\source-src","groups":[{"label":"main.js","path":".\\source-src\\main.js","weight":198,"time":221,"formattedTime":"221ms","formattedSize":"198 B","isTooLarge":false},{"label":"css","path":".\\source-src\\css","groups":[{"label":"style.styl","path":".\\source-src\\css\\style.styl","weight":1073,"time":28110,"formattedTime":"28.11s","formattedSize":"1.05 KB","isTooLarge":false}],"weight":1073,"formattedTime":"28.11s","formattedSize":"1.05 KB"},{"label":"js","path":".\\source-src\\js","groups":[{"label":"ayer.js","path":".\\source-src\\js\\ayer.js","weight":2547,"time":455,"formattedTime":"455ms","formattedSize":"2.49 KB","isTooLarge":false},{"label":"share.js","path":".\\source-src\\js\\share.js","weight":1729,"time":491,"formattedTime":"491ms","formattedSize":"1.69 KB","isTooLarge":false}],"weight":4276,"formattedTime":"946ms","formattedSize":"4.18 KB"}],"weight":5547,"formattedTime":"29.28s","formattedSize":"5.42 KB"}]},{"label":"main.css","path":".\\source\\dist\\main.css","weight":36685,"formattedSize":"35.83 KB","formattedGzipSize":"8.04 KB","formattedTime":"28.13s","isTooLarge":false,"groups":[{"label":"source-src","path":".\\source-src","groups":[{"label":"css","path":".\\source-src\\css","groups":[{"label":"style.styl","path":".\\source-src\\css\\style.styl","weight":1073,"time":28110,"formattedTime":"28.11s","formattedSize":"1.05 KB","isTooLarge":false}],"weight":1073,"formattedTime":"28.11s","formattedSize":"1.05 KB"}],"weight":1073,"formattedTime":"28.11s","formattedSize":"1.05 KB"}]}]};
window.TREE_DATA = {"groups":[{"label":"main.js","path":".\\source\\dist\\main.js","weight":5587,"formattedSize":"5.46 KB","formattedGzipSize":"2.22 KB","formattedTime":"306ms","isTooLarge":false,"groups":[{"label":"source-src","path":".\\source-src","groups":[{"label":"main.js","path":".\\source-src\\main.js","weight":198,"time":5,"formattedTime":"5ms","formattedSize":"198 B","isTooLarge":false},{"label":"css","path":".\\source-src\\css","groups":[{"label":"style.styl","path":".\\source-src\\css\\style.styl","weight":1073,"time":190,"formattedTime":"190ms","formattedSize":"1.05 KB","isTooLarge":false}],"weight":1073,"formattedTime":"190ms","formattedSize":"1.05 KB"},{"label":"js","path":".\\source-src\\js","groups":[{"label":"ayer.js","path":".\\source-src\\js\\ayer.js","weight":2547,"time":19,"formattedTime":"19ms","formattedSize":"2.49 KB","isTooLarge":false},{"label":"share.js","path":".\\source-src\\js\\share.js","weight":1749,"time":283,"formattedTime":"283ms","formattedSize":"1.71 KB","isTooLarge":false}],"weight":4296,"formattedTime":"302ms","formattedSize":"4.2 KB"}],"weight":5567,"formattedTime":"497ms","formattedSize":"5.44 KB"}]},{"label":"main.css","path":".\\source\\dist\\main.css","weight":36685,"formattedSize":"35.83 KB","formattedGzipSize":"8.04 KB","formattedTime":"200ms","isTooLarge":false,"groups":[{"label":"source-src","path":".\\source-src","groups":[{"label":"css","path":".\\source-src\\css","groups":[{"label":"style.styl","path":".\\source-src\\css\\style.styl","weight":1073,"time":190,"formattedTime":"190ms","formattedSize":"1.05 KB","isTooLarge":false}],"weight":1073,"formattedTime":"190ms","formattedSize":"1.05 KB"}],"weight":1073,"formattedTime":"190ms","formattedSize":"1.05 KB"}]}]};
</script>
<script>/* eslint-disable */
/**