Showing posts with label javascript. Show all posts
Showing posts with label javascript. Show all posts

Sunday, November 16, 2014

How to stop Silverlight videos via Javascript

I was exploring on how to stop the video that is being played within silverlight via javascript. I couldn't find any straight cut sample on stop function. However, updating or resetting source seems to do the trick !!!

You have to set id for your object tag

<object id=''videoID" ......>

Then I used jquery to set the source

$('#videoID').get(0).source = "<your xap file location>"

You can achieve the same using javascript as below

var videoElement=document.getElementById("videoID");
videoElement.source="<your xap file location>"

Saturday, August 6, 2011

Hide the “People and Group” section from breadcrumb in userdisp.aspx

If you want to hide any breadcrumb in sharepoint application pages, Then you are at the right spot. This can be done via javascript.

But Microsoft will not support/recommend modifying the OOTB application pages. 
So we can tweak the application page with a word of caution. It is entirely upto you to decide whether to follow it or not.

Here is the code for reference.

I'm hiding the "People and Group” in userdisp.aspx for those users from a different domain.

<input type="hidden" value="<%=Request.ServerVariables["Auth_User"]%>" id="user_name">

<script language="javascript">
var username=document.getElementById("user_name").value;
     alert(username);
   var domainname =username.substring(0,username.indexOf("\\"));
    alert(domainname.toLowerCase());

if(domainname.toLowerCase()=="Domain_name")//Please give Domain_name in lower case
{
var child=document.getElementById("ctl00_PlaceHolderTitleBreadcrumb_ContentMap").childNodes;

for(i=0;i<child.length;i++)
{
 if(child[i].hasChildNodes);
{
    var spantag=child[i].childNodes;
   
    for(j=0;j<spantag.length;j++)
    {
        if(spantag[j].tagName=="A")
        {
         var anchtag=spantag[j];
         hrefattrb=anchtag.getAttribute("href");
        
         if(hrefattrb.indexOf("people.aspx")!=-1)
         {
         anchtag.style.display="none";
         child[i].style.display="none";
         child[i+1].style.display="none";
         }
        
        }
    }
}
}
}
<script>