hexo-butterfly-clock-anzhiyu
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -37,3 +37,3 @@ 'use strict' | ||
//脚本资源 | ||
const js_text = `<script src="${data.ip_api}"></script><script data-pjax src="${data.clock_js}"></script><script src="http://whois.pconline.com.cn/ipAreaCoordJson.jsp?callback=IPCallBack&coords=${data.rectangle}&level=3"></script>` | ||
const js_text = `<script src="${data.ip_api}"></script><script data-pjax src="${data.clock_js}"></script><script src="http://whois.pconline.com.cn/ipAreaCoordJson.jsp?callback=getIpInfo&coords=${data.rectangle}&level=3"></script>` | ||
//注入容器声明 | ||
@@ -40,0 +40,0 @@ var get_layout |
@@ -1,6 +0,2 @@ | ||
let IP = {} | ||
function IPCallBack(obj) { | ||
IP = obj | ||
} | ||
function getIpInfo() { | ||
function getIpInfo(obj) { | ||
fetch(`https://restapi.amap.com/v3/ip?key=${gaud_map_key}`) | ||
@@ -24,6 +20,6 @@ .then(res => res.json()) | ||
if (document.getElementById('hexo_electric_clock')) { | ||
var city = Array.isArray(data.city) ? IP.city : data.city | ||
var city = Array.isArray(data.city) ? (obj ? obj.city : '长沙') : data.city | ||
if (clock_default_rectangle_enable === 'true') { | ||
city = IP.city | ||
if (clock_default_rectangle_enable === 'true' && obj) { | ||
city = obj.city | ||
} | ||
@@ -269,3 +265,5 @@ var res_text2 = data2 | ||
var card_clock_loading_dom = document.getElementById('card-clock-loading') | ||
card_clock_loading_dom.innerHTML = '' | ||
if (card_clock_loading_dom) { | ||
card_clock_loading_dom.innerHTML = '' | ||
} | ||
clock_box.innerHTML = clock_box_html | ||
@@ -272,0 +270,0 @@ function updateTime() { |
{ | ||
"name": "hexo-butterfly-clock-anzhiyu", | ||
"version": "1.0.9", | ||
"version": "1.0.10", | ||
"description": "A clock card plugin for theme-butterfly", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
229232
964