1. 添加html: <div>[Title]</div> 到计算列中。
2.添加contentwebpart到页面并添加下列代码:
<style type="text/css">
DIV.ms-acal-item {
HEIGHT: auto !important
}
DIV.ms-acal-mdiv {
BACKGROUND-COLOR: lightgrey
}
DIV.ms-acal-item DIV {
MARGIN: 0px
}
DIV.ms-acal-item DIV DIV DIV {
PADDING-BOTTOM: 0px !important; MARGIN: 0px; PADDING-LEFT: 3px !important; PADDING-RIGHT: 3px !important; PADDING-TOP: 0px !important
}</style><script type="text/javascript">
//
// Text to HTML - Calendar views
//
function removeLinkHtml(htmlstring) {
var str = "";
str = htmlstring;
var beforeTag = "";
var afterTag = "";
if( str.indexOf("<") < 0 ) {
return str;
}
beforeTag = str.substring(0,str.indexOf("<"));
afterTag = str.substring(str.indexOf(">")+1);
return removeLinkHtml(beforeTag + afterTag);
}
function RenderCalendarItems() {
var calDiv;
var theDivs = document.getElementsByTagName("DIV");
for (i = 0; i < theDivs.length; i++) {
if (theDivs[i].className == "ms-acal-rootdiv") {
calDiv = theDivs[i];
}
}
if (calDiv) {
var theCalDivs = calDiv.getElementsByTagName("DIV");
for (i = 0; i < theCalDivs.length; i++) {
if (theCalDivs[i].className == "ms-acal-sdiv" || theCalDivs[i].className == "ms-acal-mdiv") {
var link = theCalDivs[i].getElementsByTagName("a")[0];
if (link) {
var linkInnerText = link.innerText || link.textContent;
var linkText = removeLinkHtml(linkInnerText);
//Replace link content with a div
var tempDIV = document.createElement("DIV");
tempDIV.style.cursor = "pointer";
tempDIV.style.margin = 0;
tempDIV.style.padding = 0;
tempDIV.style.border = 0;
tempDIV.innerHTML = linkInnerText;
link.innerHTML = "";
link.appendChild(tempDIV);
//Set nested div inside tempDIV to margin:0 and position:none
var nestedDiv = tempDIV.getElementsByTagName("DIV")[0];
if( nestedDiv ) {
nestedDiv.style.margin = 0;
nestedDiv.style.position = "static";
}
// Filter out html to set link title
var itemTitle = theCalDivs[i].parentNode.title;
itemTitle = itemTitle.substring(0, itemTitle.indexOf("<"));
theCalDivs[i].parentNode.title = itemTitle + linkText;
}
}
}
}
}
function WaitForCalendarToLoad() {
// we will slightly rewrite this existing function as defined originally in SP.UI.ApplicationPages.Calendar.debug.js
SP.UI.ApplicationPages.CalendarNotify.$4a = function () {
ULSSPg: ;
if (SP.UI.ApplicationPages.CalendarNotify.$2B_0) {
SP.UI.Notify.removeNotification(SP.UI.ApplicationPages.CalendarNotify.$2B_0);
SP.UI.ApplicationPages.CalendarNotify.$2B_0 = null;
}
RenderCalendarItems();
}
}
_spBodyOnLoadFunctionNames.push('WaitForCalendarToLoad');</script>
浙公网安备 33010602011771号