fix error

This commit is contained in:
chiu 2021-09-05 23:01:01 +08:00
parent 5ee197fdff
commit 4c3ffc2179
2 changed files with 46 additions and 42 deletions

View File

@ -39,27 +39,29 @@
</div>
<%= stylesheet_link_tag "calendar_widget1" %>
<script>
if(document.getElementById("calendar-widget_module") == null){
var tag = document.createElement('script');
tag.setAttribute("id", "calendar-widget_module");
tag.src = "/assets/calendar_widget.js";
tag.onload = function(){
$("div.widget-calendar-1[data-module=calendar]").each(function(index){
var calendar = $(this),
cmi = new CalendarModuleMonth1(new Date(), calendar,calendar.data("subpart-id"),"{{more_url}}",false);
cmi.currentMonth();
calendar.find("div.w-calendar-nav a").on("click",function(){
var el = $(this);
if(el.hasClass("w-calendar-nav-prev")){
cmi.prevMonth();
}else if(el.hasClass("w-calendar-nav-next")){
cmi.nextMonth();
}
return false;
$(document).ready(function(){
if(document.getElementById("calendar-widget_module") == null){
var tag = document.createElement('script');
tag.setAttribute("id", "calendar-widget_module");
tag.src = "/assets/calendar_widget.js";
tag.onload = function(){
$("div.widget-calendar-1[data-module=calendar]").each(function(index){
var calendar = $(this),
cmi = new CalendarModuleMonth1(new Date(), calendar,calendar.data("subpart-id"),"{{more_url}}",false);
cmi.currentMonth();
calendar.find("div.w-calendar-nav a").on("click",function(){
var el = $(this);
if(el.hasClass("w-calendar-nav-prev")){
cmi.prevMonth();
}else if(el.hasClass("w-calendar-nav-next")){
cmi.nextMonth();
}
return false;
})
})
})
}
var head = document.getElementsByTagName("head");
head[0].appendChild(tag);
}
var head = document.getElementsByTagName("head");
head[0].appendChild(tag);
}
});
</script>

View File

@ -55,27 +55,29 @@
</div>
<%= stylesheet_link_tag "calendar_widget2" %>
<script>
if(document.getElementById("calendar-widget_module2") == null){
var tag = document.createElement('script');
tag.setAttribute("id", "calendar-widget_module2");
tag.src = "/assets/calendar_widget2.js";
tag.onload = function(){
$("div.widget-calendar-2[data-module=calendar]").each(function(index){
var calendar = $(this),
cmi = new CalendarModuleMonth2(new Date(), calendar,calendar.data("subpart-id"),"{{more_url}}",false);
cmi.currentMonth();
calendar.find("div.w-calendar-nav a").on("click",function(){
var el = $(this);
if(el.hasClass("w-calendar-nav-prev")){
cmi.prevMonth();
}else if(el.hasClass("w-calendar-nav-next")){
cmi.nextMonth();
}
return false;
$(document).ready(function(){
if(document.getElementById("calendar-widget_module2") == null){
var tag = document.createElement('script');
tag.setAttribute("id", "calendar-widget_module2");
tag.src = "/assets/calendar_widget2.js";
tag.onload = function(){
$("div.widget-calendar-2[data-module=calendar]").each(function(index){
var calendar = $(this),
cmi = new CalendarModuleMonth2(new Date(), calendar,calendar.data("subpart-id"),"{{more_url}}",false);
cmi.currentMonth();
calendar.find("div.w-calendar-nav a").on("click",function(){
var el = $(this);
if(el.hasClass("w-calendar-nav-prev")){
cmi.prevMonth();
}else if(el.hasClass("w-calendar-nav-next")){
cmi.nextMonth();
}
return false;
})
})
})
}
var head = document.getElementsByTagName("head");
head[0].appendChild(tag);
}
var head = document.getElementsByTagName("head");
head[0].appendChild(tag);
}
});
</script>