Stump the Panel: SharePoint Q&A

Immediate solutions for common SharePoint questions
It is currently Fri May 24, 2013 4:09 am

All times are UTC - 5 hours [ DST ]


Forum rules


What you are viewing is an archive of Stump the Panel. It remains for reference purposes. Please post all new questions on NothingButSharePoint.com
https://www.nothingbutsharepoint.com/sites/eusp/Forum



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Calendar view and 12:00 AM
PostPosted: Thu Mar 24, 2011 4:50 pm 
Offline

Joined: Thu Jan 07, 2010 10:58 pm
Posts: 10
I'm using a calendar view to display items that don't have a valid start or end time and therefore I get 12:00 AM displayed on each item. Can I use jQuery to replace the 12:00 AM with spaces?


Top
 Profile  
 
 Post subject: Re: Calendar view and 12:00 AM
PostPosted: Fri Mar 25, 2011 8:12 am 
Offline
User avatar

Joined: Mon Jan 04, 2010 1:15 am
Posts: 1839
Location: North Carolina
Sure, if you can isolate the selectors, you can use jquery to cut that out.


Top
 Profile  
 
 Post subject: Re: Calendar view and 12:00 AM
PostPosted: Fri Mar 25, 2011 3:29 pm 
Offline

Joined: Thu Jan 07, 2010 10:58 pm
Posts: 10
I would have thought that something like the following would work...

<script type="text/javascript">
var el=$('td class="ms-cal-monthitem"');
el.html(el.html().replace(/12:00 AM/ig, ""));
</script>


Top
 Profile  
 
 Post subject: Re: Calendar view and 12:00 AM
PostPosted: Mon Mar 28, 2011 11:33 am 
Offline

Joined: Thu Jan 07, 2010 10:58 pm
Posts: 10
Latest effort is to add the following via a Content Editor Web part... and while it works in a simple HTML page, it doesn't work on my SharePoint page...

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>

<script>
(function($){
$.fn.replaceText = function(str,restr){
var re = new RegExp("("+str+")",'ig');
return this.each(function(){
$(this).contents().filter(function(){
return this.nodeType != 1;
}).each(function(){
var output = $(this).text().replace(re,restr);
if (output != $(this).text()) {
$(this).wrap("<p></p>").parent('p').html(output).contents().unwrap();
}
});
});
}
})(jQuery);
$(function(){
$('#demo').replaceText("12:00 AM","");
});

</script>


Top
 Profile  
 
 Post subject: Re: Calendar view and 12:00 AM
PostPosted: Mon Mar 28, 2011 4:00 pm 
Offline

Joined: Thu Jan 07, 2010 10:58 pm
Posts: 10
This got it done...

$(function(){
$("#MontlyViewDefault_CalendarView nobr b:contains('12:00 AM')").text('');
});


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group