Adding javascript to sherpoint master page

How can i include this in a master page ?  This code should hide the empty lists , but since i noob , i don't now how and where to add this script.
Thanks
<script type="text/javascript">
function HideEmptyWebParts()
var itemsfound = new Array;
var elements = document.getElementsByTagName('*');
for(var i=0;i<elements.length;i++)
if(elements[i].className == 'ms-vb')
itemsfound.push(elements[i]);
for (var i=0;i<itemsfound.length;i++)
if (itemsfound[i].innerHTML.indexOf("There are no items to show in this view of the")>-1)
itemsfound[i].parentNode.parentNode.parentNode.parentNode.innerHTML="<div class='ms- vb'>Not enough data to produce a dashboard.</div>";
_spBodyOnLoadFunctionNames.push("HideEmptyWebParts")
</script>

Hi,
Please upload js file in Sharepoint style library and on master page add the reference of JS like below
<script type="text/javascript" src="../jQuery/jquery-1.3.2.js"></script>

Similar Messages

  • Per site, list driven footer and other content areas on a SharePoint 2010 master page?

    So I worked with a vendor to provide a js, a powershell script and <div> content holders in a master page that would pull the content dynamically based on the site or subsite, and more specifically from a custom list in that site. To explain, if I
    have a root site collection but want to be able to have the end user control the site content, such as a custom top navigation (above the global) and custom footer, and custom place holder content that would appear under the navigation; I would like to have
    that content pulled from a list.
    My goal is to not have a "custom master page" for the many many sites we have in our environment. I am using twitter bootstrap as the foundation for the master pages, then a set number of page layouts pending whether they want left nav to show
    or not. I also typically just use the v4.master for the system pages, but am not sure if that is a best practice either being that the list display forms for a publishing site are ugly so need customized per list.
    Has any one done anything like this and if so could you point me in the right direction? Any guidance would be greatly appreciated. Right now am working within SP2010 but will be testing for SP2013 in the near future. 

    Hi,
    Based on my understanding, you might want to display dynamic content in the pages which reference a specific master page, the content stores in a custom list, users
    can update the master page by updating the corresponding list items.
    Then there would be two main steps in a solution like this:
    1. Data retrieving of a list: JavaScript Client Object Model can help to query the needed items from a list;
    JavaScript Client Object Model
    http://msdn.microsoft.com/en-us/library/office/hh185006(v=office.14).aspx
    More information about JavaScript Client Object Model:
    How to: Create, Update, and Delete List Items Using JavaScript
    http://msdn.microsoft.com/en-us/library/office/hh185011(v=office.14).aspx 
    2. Modify the master page: With the data retrieved, we can then change the HTML source code of a page using JavaScript.
    About how to
    modify the HTML using JavaScript:
    http://www.w3schools.com/js/js_htmldom_html.asp
    http://njarb.com/2011/06/update-html-content-using-javascript/
    We can apply the custom JavaScript to the master page, then when users open a page which references this master page, the JavaScript will run, get data from the custom
    list, change the HTML source of the current page and display the content you want.
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • CS 5.5 problem with PDF links of master page TOC

    Hi
    Lately i moved from ID CS5 to CS5.5 working on Windows 7.
    All spreads of my document are based on a master page. This mater page includes a pane with a TOC. This TOC serves as navigation pane.
    When exporting the document to interactive PDF, the TOC appears on all spreads but the TOC links function well on the first spread and will not function on the next pages.
    The interactive PDF export settings include: "open in full screen mode" and "buttons and Media = include all".
    I made a test, and added hyperlink on the master page next to the TOC, now the TOC links turnned active on all pages but the PDF will not open in full screen although i did not change the export settings. If i remove this extra hyperlink the TOC links problem returns.
    I used the same document a lot in the past (with CS5) and did not have any such problem.
    Hope i managed to describe this case well.
    Highly appreciate your help.
    RGDs
    Tamir

    Thanks Steve
    I trashed the two preference files as instructed.
    Expoerted the file to IDML.
    Opened the IDML file and saved it as an ID file.
    The problem still exist.
    RGDs
    Tamir

  • Put pictures in master page

    How do you load pictures into master page

    Hello
    You can simply load the images on the master page using File > Place, and you can browse through the images and put them on the master page.
    Please let us know if you are having any particular issues in adding the images on master page.
    Regards,
    Prateek

  • Breadcrumbs: Master Page vs. SSL

    I am exploring the option of inserting breadcrumbs as a master page placeholder. But I have noticed that the placeholder version of the breadcrumbs does not offer the same parameters as in SSL. Options for top/bottom and right/center/left are missing.
    I would rather retain more control over this - and the option to make future changes with the more complete parameters in the SSL. However, I don't know if there is some compelling reason to do it in master pages, something that I might not have knowledge of now as I learn these features?
    Any insights would be appreciated.
    Thanks,
    Douglas

    Hi all
    Jeff is correct. When Breadcrumbs are added via the Single Source Layout recipe, they are added to each and every HTML topic. Because you are doing this on a global basis, you see the options for placement.
    When adding them via a Master Page, you are free to insert the placeholder wherever you like on the Master Page. So there is no need to provide placement options as the placement is determined by where you insert the placeholder. Additonally, if using the Master Page method, you may be more choosy about exactly which topics receive the breadcrumbs.
    Cheers... Rick

  • How do I modify the "Number of Pages" setting for an existing Master Page via javascript?

    I'm learning javascripting for InDesign and I have been tinkering with the stock scripts in the tutorials. I'm developing the ability set properties and such, playing with how Javascript works, and I wanted to change the number of pages in a master page as part of an exercise. Does anyone know how to do this? I have been able to add new masters, controlling the number of pages in them with this:
    myDocument.masterSpreads.add( {pagesPerSpread:2,} )
    but what I really want is to modify the master that InDesign automatically generates with a new document, to have 2 pages. Granted, I can just start off with a document with facing pages, but I don't really see the fun in that...

    Jump_Over wrote:
    Hi,
    check this:
    var mSpread = app.activeDocument.masterSpreads[0],
    count = mSpread.pages.length,
    mSet = 2,
    run = mSet - count;
    // to avoid 0-page error
    mSet = Math.max(mSet,1);
    if (run > 0) {
              while (run --)
              mSpread.pages.add();
    else while (run) {
              mSpread.pages[-1].remove();
              run ++
    edit the variable mSet to modify pages length
    Jarek
    Message was edited by: Jump_Over I added Math.max filter to avoid errors
    Thanks, this is exactly what I wanted. Well, almost. I wish there were a way to simply set the number of pages in a master spread to a specific number the same way there is in the interface, but this will work just as well.

  • Adding new elements to a Master Page and sharing them to existing pages

    I need to include new navigation elements on the master page
    and I want it to show up on pages I've already created. I've added
    the new elements on a layer of their own which is part of the
    master page, but the Share Layer to Pages... option is dimmed.

    jcbluesman wrote:
    > I'm using CS4, Jim, and here's a link to the .png
    > (
    http://idisk.mac.com/jconstant-Public/deimos.png
    >
    > The 3 tabs in the upper right on the master page are the
    ones I'm trying to
    > share across the existing pages. I created them in PS
    (also CS4), then imported
    > the .psd into this FW document, if that makes any
    difference.
    >
    > Thanks,
    > Jim
    >
    OK there are two related as I see it.
    Each of your pages consists of a solid, opaque bitmap for a
    main image.
    Master Pages, by default, are at the bottom of the layer
    stack. Your
    tabs ARE present, you just can't see them because they are
    covered up by
    the bitmap.
    Assuming you don't have those page images as multi-object
    elements,
    where you can edit the blue backgrounds, there are still two
    things you
    can do, both of which are pretty easy.
    Go into each page and temporarily reduce the opacity of Layer
    1.
    Use the marquee tool to draw a selection around the area of
    the tabs.
    Delete the selection.
    Return the lay back to full opacity.
    OR
    Try dragging the Master page to the top of the layer stack in
    each page.
    Hide or delete the Master page background.
    This option is a little trickier, but I was able to do it.
    Wait for the
    black bar to appear before you release the mouse. You may
    need to try
    this a few times before it works.
    HTH
    Jim Babbage - .:Community MX:. & .:Adobe Community
    Expert:.
    http://www.communityMX.com/
    CommunityMX - Free Resources:
    http://www.communitymx.com/free.cfm
    .:Adobe Community Expert for Fireworks:.
    Adobe Community Expert
    http://tinyurl.com/2a7dyp
    .:Author:.
    Lynda.com -
    http://movielibrary.lynda.com/authors/author/?aid=188
    Peachpit Press -
    http://www.peachpit.com/authors/bio.aspx?a=d98ed798-5ef0-45a8-a70d-4b35fa14c9a4
    Layers Magazine -
    http://www.layersmagazine.com/author/jim-babbage

  • How to use Ajax Web method in v4.master page to pass value to server side from JavaScript?

    Hi,
    I am customizing my v4.master page. Just adding jquery "Multiselect" dropdown .
    I want to pass selected value to code behind to perform some database activities.
    Here no code behind for me. Just i have added "Server side script" as a code behind.
    How to pass the value?
    Anyone give me the idea on it.
    Thanks & Regards
    Poomani Sankaran

    try using asp.net variables as per below links:
    http://sharepoint.stackexchange.com/questions/88777/how-to-use-a-variable-in-the-masterpage
    http://sharepoint.stackexchange.com/questions/80074/how-can-i-use-the-current-language-as-a-variable-in-my-masterpage
    https://msdn.microsoft.com/en-us/library/ms476046%28v=office.12%29.aspx
    http://www.dotnetfunda.com/articles/show/1507/how-to-access-master-page-variableproperty-from-the-content-page
    Please mark answer as correct if it is correct else vote for it if you find it useful Happy SharePointing

  • Injecting javascript in Master page

    How to inject javascript in Master Page using CSOM/JSOM?
    Would want to write some console app. which will inject the javascript in master page.
    Thanks

    Depends a little on what you want to do with the JavaScript. Is it going to impact the general page, or a single web part.
    One general way is to add a Content Editor web part and set it's source to a text file in a library. Your CSOM could upload/update that text file.
    Mike Smith TechTrainingNotes.blogspot.com
    Books:
    SharePoint 2007 2010 Customization for the Site Owner,
    SharePoint 2010 Security for the Site Owner

  • Photoshop button added to master page does not apply to correct spot on pages attached

    When working on the master page on the tutorial for Muse, after adding the photoshop button, it does not align correctly to the pages that are attached with the master file? It ends up underneath the footer and expanding the page longer than i fixed it to? How can I fix this?

    Try to optimize the image that you are using, this can happen if you are using original file size being large enough to expand.
    http://helpx.adobe.com/muse/topics/graphics.html
    http://tv.adobe.com/watch/learn-adobe-muse-cc/optimizing-graphics-assets-in-muse/
    Thanks,
    Sanjit

  • Using Version ES4 Livecycle added master page

    Using Version ES4 Livecycle added master page and now the master page is showing on PDF view as a blank page. How to remove?

    There is probably a better way to do this, but I found a work around.  I set the fields on the master page to "Use Global Data" in the Binding tab.  This means that the value for that field will be the same for any field with the same name.  Then, on my main page, I have a hidden field with the same name that I can populate with ColdFusion and the value will also show in the master page.
    If anyone has a more elegant way to do this, please respond.  I am new to LiveCycle and I'm sure there are a lot of features that I am not aware of that could help me.

  • Adding javascript to page open and page close in acrobat 8.1.2

    Reading the Acrobat Javascript Object Specification on page 22 it says that you can add javascript to the "page open" and "page close" events of a document.
    It then says that under the menu "Document -> Set page action" you can add scripts for those events
    I am using Acrobat 8.1.2 and under the document menu there is no "Set page action". And there is nowhere where I can find any "set page action" menu...
    whats the deal?
    How can i set the page open and page close events in acrobat professional 8.1.2?????????????
    Marc

    - open the Navigation Panel 'Pages'
    - select the page and open the page properties
    - in the actions tab you can set the page actions

  • Adding Custom Breadcrumb for SharePoint 2013 Custom Master-Page With A Custom Separator.

    Hi All,
    I have successfully converted an HTML file to a SharePoint 2013 Custom Master-Page with relevant style sheets. But when I used within the SharePoint site I could not find the breadcrumb. So I want to know how to do that? For that breadcrumb I need a custom
    separator like an arrow like in the below.
    As you can see the separator is a custom built one. To have this custom separator in my HTML I have used the following code snippet.
    <div class="breadcrumb-desktop">
    <span class="breadcrumb-links"><a href="#">SharePoint Site Home</a></span>
    <span class="breadcrumb-links"><a href="#">Sub Link 01</a></span> Active Page
    </div>
    The styles are as like in the below.
    .breadcrumb-desktop {
    width: 100%;
    font-family: Arial;
    padding: 23px 0 40px;
    float: left;
    font-size: 0.75em;
    line-height: 1.25;
    .breadcrumb-desktop > span.breadcrumb-links:after {
    content: " \203A ";
    white-space: pre;
    I have tried the following code snippet within the SharePoint site as
    <!--MS:<asp:sitemappath runat="server" sitemapproviders="SPSiteMapProvider,SPXmlContentMapProvider" rendercurrentnodeaslink="false" hideinteriorrootnodes="true">-->
    <!--ME:</asp:sitemappath>-->
    But it did not display as I wanted.
    So how am I supposed to insert these to my Custom Master-Page's breadcrumb and style them? Please could someone help me to solve this?
    Thanks and regards,
    Chiranthaka

    Hi Chiranthaka,
    Please use the following code snippet in your html master page.
    <div class="CustomBreadcrumbs">
    You are here:
    <!--SPM:<SharePoint:AjaxDelta id="DeltaPlaceHolderPageTitleInTitleArea" runat="server">-->
    <!--SPM:<asp:ContentPlaceHolder id="PlaceHolderTitleBreadcrumb" runat="server">-->
    <!--MS:<asp:sitemappath runat="server" sitemapproviders="SPSiteMapProvider,SPXmlContentMapProvider" rendercurrentnodeaslink="false" hideinteriorrootnodes="true">-->
    <!--ME:</asp:sitemappath>-->
    <!--SPM:</asp:ContentPlaceHolder>-->
    <!--SPM:</SharePoint:AjaxDelta>-->
    </div>
    Here is a thread for your reference:
    https://social.msdn.microsoft.com/Forums/office/en-US/daabd903-df98-41da-80d8-6a942d06980e/add-breadcrumb-to-custom-master-page-html-file?forum=sharepointcustomization
    We can also customize a breadcrumb control, then add it in master page.
    http://msreddysharepoint.blogspot.com/2013/01/custom-breadcrumb-navigation-in.html
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Problem to change the master page height using javascript

    Hi everyone,
    I've been trying it but no luck... appreciate any helps possible.. Thanks!
    I've a masterpage called 'UILayout':
    Long(Height)=100mm, Short(Width)=100mm
    I've a button click event with the script to set the Long to 160mm:
    ====================================
    //display current height
    var curHeight = xfa.form.form1.pageSet.UILayout.medium["long"];
    xfa.host.messageBox("Current Height = " + curHeight);
    //set height to 160mm
    xfa.form.form1.pageSet.UILayout.medium["long"]="160mm";
    //relayout the pageArea
    xfa.layout.relayoutPageArea(0);
    ====================================
    Doesn't work, I wrote another button click event to retrieve the height, and it returned 160mm. But the layout just doesn't refresh with the changed height....i'm using LC Designer 8.2, form saved as Dynamic XML PDF , compability set to 7.0.5, view in Acrobat Pro 7.1. Thanks...

    I do not think you will be able to adjust the Master page size as it is tied to the Content Area size as well. I tried to adjust the pageisze and the content size but it was ignored. I can get at the properties to change them but that is it.

  • Master page runs when I added small thumbnails in the page?

    Hi,
    The site has only 1 Master page which are the Top & Bottom Logo, align horizontally center.
    A page called "Archive" – thumbnails work to add for the entire page.
    It happens when I add all my current thumbnails, the Top Logo runs a slightly off to the left, where as the Bottom Logo is fine.
    How do I solve this issue?
    Thanks for advanced.
    Siny

    Hi Anshul,
    The url for the HOME & INTRODUCTION are the correct Master page
    http://delvetica.businesscatalyst.com/index.html
    http://delvetica.businesscatalyst.com/introduction.html
    The one that runs off is the ARCHIVE
    http://delvetica.businesscatalyst.com/index.html

Maybe you are looking for

  • Button not working in browser

    I am coding a video player in Netbeans 6.8. just find two problems: 1. the browser button not working in browser when I run the project from Netbeans under "run in browser" mode. however under "standard execution" mode, everything is fine. 2. can not

  • Problem in DB Link creation ( Oracle warehouse builder 3i  )

    I am facing a problem in DB Link creation. Backend: Oracle 8i Server on my machine DW Software: Oracle warehouse builder 3i ( client , repository asistant.....) Operating system: Windows NT 4 SERVICE PACK 6 I wants to use the scott database( default

  • Application-client.xml - resourceBundle

    Hi.. I have a problem creating a standalone application client... I have crated an application-client.xml file containing ejb-refs to 2 Sessionbeans : Like this -> <ejb-ref> <ejb-ref-name>bean/AdvisorProxy</ejb-ref-name> <ejb-ref-type>Session</ejb-re

  • How to keep scale for height when resizing width?

    Hi i have a serious of images different sizes/ ratios, which need to display at a fixed width of 50. Great works... but how do I resize the height to keep it at its original ratio? this.attachMovie(small_image, "number1_mcs" + loop , this.getNextHigh

  • SUN Fire V440 + StroEdge 3310 Volume manager!

    1. it is not possible to run disk management commands, the output is like: # vxdisk list vxdisk: not found # vxprint -st vxprint: not found But i think the local disks for the SUN server is managed by Disksuite the out put of /etc/vfstab is: # more v