我有一个脚本可以创建我所有帖子的存档,有一些帮助我们设法让它在更改域名后再次工作,从https到https,你可以在这里阅读Blogger javascript not working http to https
现在的问题是不加载文本格式,它输出未格式化的文本看起来很难看。
尝试将CSS作为一个单独的脚本,但没有区别(也没有意义)。
这是脚本所在的页面:qazxsw poi
脚本的样式部分可以在下面的末尾找到
https://www.tecnoriales.com/p/sitemap.html
它应该使用Trebuchet MS字体加载带格式的文本,使用大胆的月份和日期,每个项目只使用一行,而不是两行。
事实证明,这与你的CSS声明或我怀疑的类似的东西没有任何问题。问题出在您的Feed脚本调用上。而不是在每个末尾使用<script>
var LoadTheArchive = function(TotalFeed) {
var PostTitles = new Array();
var PostURLs = new Array();
var PostYears = new Array();
var PostMonths = new Array();
var PostDays = new Array();
if ("entry" in TotalFeed.feed) {
var PostEntries = TotalFeed.feed.entry.length;
for (var PostNum = 0; PostNum < PostEntries; PostNum++) {
var ThisPost = TotalFeed.feed.entry[PostNum];
PostTitles.push(ThisPost.title.$t);
PostYears.push(ThisPost.published.$t.substring(0, 4));
PostMonths.push(ThisPost.published.$t.substring(5, 7));
PostDays.push(ThisPost.published.$t.substring(8, 10));
var ThisPostURL;
for (var LinkNum = 0; LinkNum < ThisPost.link.length; LinkNum++) {
if (ThisPost.link[LinkNum].rel == "alternate") {
ThisPostURL = ThisPost.link[LinkNum].href;
break
}
}
PostURLs.push(ThisPostURL);
}
}
DisplaytheTOC(PostTitles, PostURLs, PostYears, PostMonths, PostDays);
}
var DisplaytheTOC = function(PostTitles, PostURLs, PostYears, PostMonths, PostDays) {
var MonthNames = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"];
var NumberOfEntries = PostTitles.length;
var currentMonth = "";
var currentYear = "";
for (var EntryNum = 0; EntryNum < NumberOfEntries; EntryNum++) {
NameOfMonth = MonthNames[parseInt(PostMonths[EntryNum], 10) - 1]
if (currentMonth != NameOfMonth || currentYear != PostYears[EntryNum]) {
currentMonth = NameOfMonth;
currentYear = PostYears[EntryNum];
document.write("<div class='dateStyle'><br />" + currentMonth + " " + currentYear + " </div>");
}
document.write('<a href ="' + PostURLs[EntryNum] + '"><div class=dayStyle>' + parseInt(PostDays[EntryNum], 10) + ": </div>" + PostTitles[EntryNum] + "</a><br />");
}
}
</script>
<script src="https://tecnoriales.com/feeds/posts/default?max-results=500&alt=json-in-script&callback=LoadTheArchive" />
<script src="https://tecnoriales.com/feeds/posts/default?max-results=150&start-index=151&alt=json-in-script&callback=LoadTheArchive" />
<script src="https://tecnoriales.com/feeds/posts/default?max-results=150&start-index=301&alt=json-in-script&callback=LoadTheArchive" />
<script src="https://tecnoriales.com/feeds/posts/default?max-results=150&start-index=451&alt=json-in-script&callback=LoadTheArchive" />
<script src="https://tecnoriales.com/feeds/posts/default?max-results=150&start-index=601&alt=json-in-script&callback=LoadTheArchive" />
<script src="https://tecnoriales.com/feeds/posts/default?max-results=150&start-index=851&alt=json-in-script&callback=LoadTheArchive" />
<script src="https://tecnoriales.com/feeds/posts/default?max-results=150&start-index=1001&alt=json-in-script&callback=LoadTheArchive" />
<!--CUSTOMIZATION-->
<style type="text/css">
.dateStyle {
color: #000;
font-weight: bold;
font-size: 15px;
font-family: Trebuchet MS, sans-serif;
margin: 0;
}
.dayStyle {
color: #000;
font-weight: bold;
font-family: Trebuchet MS, sans-serif;
display: inline-block;
}
</style>
,而是使用/>
,如下面的代码示例所示。
因为它们被错误地调用,所以它也阻止了CSS正常工作,因为它是在脚本下面定义的。
></script>