<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SUPERNOVA &#187; javascript</title>
	<atom:link href="http://blog.metrostarsystems.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.metrostarsystems.com</link>
	<description>Stellar Social Media &#38; Technology Solutions</description>
	<lastBuildDate>Sat, 04 Feb 2012 13:59:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>JavaScript Tip of the Day</title>
		<link>http://blog.metrostarsystems.com/2010/10/08/javascript-tip-of-the-day/</link>
		<comments>http://blog.metrostarsystems.com/2010/10/08/javascript-tip-of-the-day/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 20:10:50 +0000</pubDate>
		<dc:creator>Lee Kohn</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.metrostarsystems.com/?p=4015</guid>
		<description><![CDATA[Today I learned a neat trick for keeping the global namespace on a page clean.  Lets say you have the following code: var interval = createInterval('doStuff()',2000); var counter = 0; function doStuff() { alert(counter++); if(counter &#62; 5) clearInterval(interval); } This code will introduce 3 new global items which can be messy and undesirable.  The alternative<em> ... </em>]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
<p>Today I learned a neat trick for keeping the global namespace on a page clean.  Lets say you have the following code:<br />
<pre class="brush: js">var interval = createInterval('doStuff()',2000);
var counter = 0;
function doStuff() {
    alert(counter++);
    if(counter &gt; 5)
        clearInterval(interval);
}</pre><br />
This code will introduce 3 new global items which can be messy and undesirable.  The alternative to this which will keep the global namespace free of junk is to encapsulate the above code into an anonymous function like so:</p>
<p><pre class="brush: xml">(function() {
    var interval = createInterval('doStuff()',2000);
    var counter = 0;
    function doStuff() {
        alert(counter++);
        if(counter &gt; 5)
            clearInterval(interval);
    }
})();</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.metrostarsystems.com/2010/10/08/javascript-tip-of-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Injecting and Running Javascript in a Windows.Forms.WebBrowser control</title>
		<link>http://blog.metrostarsystems.com/2010/08/27/injecting-and-running-javascript-in-a-windows-forms-webbrowser-control-2/</link>
		<comments>http://blog.metrostarsystems.com/2010/08/27/injecting-and-running-javascript-in-a-windows-forms-webbrowser-control-2/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 04:01:01 +0000</pubDate>
		<dc:creator>Lee Kohn</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JS]]></category>
		<category><![CDATA[WebBrowser]]></category>
		<category><![CDATA[Windows.Forms]]></category>

		<guid isPermaLink="false">http://blog.metrostarsystems.com/?p=3771</guid>
		<description><![CDATA[Have you ever needed to inject some JavaScript into a web-page contained in a WebBrowser control and then run said code?  If you have then you&#8217;re in luck; here is some sample code which accomplishes exactly that in a console application (the same code works for a WinForms application with a few tweaks): using System;<em> ... </em>]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCSharp.js"></script>
<p>Have you ever needed to inject some JavaScript into a web-page contained in a WebBrowser control and then run said code?  If you have then you&#8217;re in luck; here is some sample code which accomplishes exactly that in a console application (the same code works for a WinForms application with a few tweaks):</p>
<p><pre class="brush: csharp">using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using mshtml;

namespace JSInjector
{
    class Program
    {
        [STAThread] //needed for COM compatibility
        static void Main(string[] args)
        {
            /*
            this is the javascript which will be injected
            it takes one parameter and returns it multiplied by the number of images in the page
             * */
            const string jsToInject = @&quot;
                function doStuff(foo)
                {
                    return document.images.length * foo;
                }&quot;;

            //create a new WebBrowser and point it to a website
            WebBrowser wb = new WebBrowser();
            wb.Navigate(&quot;http://metrostarsystems.com&quot;);

            byte loopCount = 0; //we wouldn't want an infinit loop would we?
            while (wb.ReadyState != WebBrowserReadyState.Complete)
            {
                if (loopCount &gt; 200)
                    throw new Exception(&quot;Page did not load after 20 seconds!&quot;);

                Application.DoEvents(); //needed by the WebBrowser so that events are processed

                Thread.Sleep(100); //if the page hasn't finished loading wait 1/10 of a second
                loopCount++;
            }

            HtmlElement scriptEle = wb.Document.CreateElement(&quot;script&quot;); //create the script element
            scriptEle.SetAttribute(&quot;type&quot;, &quot;text/javascript&quot;);

            /*
             Load the javascript into the script element.
             The type casting is necessary since the HtmlElement will not let you set the innerHtml or innerText of a script element
             Note: You must have a reference to the MSHTML (Microsoft HTML Object Library) COM dll in order to do the typecasting
             */
            ((IHTMLScriptElement)scriptEle.DomElement).text = jsToInject;

            wb.Document.Body.AppendChild(scriptEle); //add the script element to the page

            int jsParam = 5; //5 will be the parameter passed in to the JS function
            object returnedFromJs = wb.Document.InvokeScript(&quot;doStuff&quot;, new object[] { jsParam} ); //call the doStuff JS function with 5 as the argument and store the result

            Console.WriteLine(&quot;Returned &quot; + returnedFromJs);
        }
    }
}
</pre></p>
<p>To see this code in action check out our new visual search <a href="/visual-search/">here</a>!</p>
<p>-Lee</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.metrostarsystems.com/2010/08/27/injecting-and-running-javascript-in-a-windows-forms-webbrowser-control-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Walkthrough: DVWP Tooltip</title>
		<link>http://blog.metrostarsystems.com/2009/12/04/dvwp-tooltip/</link>
		<comments>http://blog.metrostarsystems.com/2009/12/04/dvwp-tooltip/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 16:54:08 +0000</pubDate>
		<dc:creator>Chris Lincoln</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Data View Web Part]]></category>
		<category><![CDATA[DVWP]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[tips & tricks]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[tooltip]]></category>
		<category><![CDATA[XSL]]></category>

		<guid isPermaLink="false">http://blog.metrostarsystems.com/?p=2240</guid>
		<description><![CDATA[Tooltips may be implemented to greatly improve user experience in many scenarios.  This walkthrough will provide a method with which tooltip functionality may be implemented on SharePoint Data View Web Parts (DVWPs) using XSL and JavaScript. Preparation Open the SharePoint site in SharePoint Designer 2007 Open the page on which the tooltip functionality will be implemented Enable either<em> ... </em>]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCSharp.js"></script>
<p><a href="http://blog.metrostarsystems.com/wp-content/uploads/2009/12/rowview_object_hiearchy.png"></a><a href="http://blog.metrostarsystems.com/wp-content/uploads/2009/12/dvwp_tooltip_example.jpg"></a>Tooltips may be implemented to greatly improve user experience in many scenarios.  This walkthrough will provide a method with which tooltip functionality may be implemented on SharePoint Data View Web Parts (DVWPs) using XSL and JavaScript.</p>
<h2>Preparation</h2>
<ol>
<li>Open the SharePoint site in SharePoint Designer 2007</li>
<li>Open the page on which the tooltip functionality will be implemented</li>
<li>Enable either Split or Code view</li>
</ol>
<h2>Create the Tooltip</h2>
<ol>
<li> Locate the DVWP in which the tooltip functionality will be implemented</li>
<li>Locate the XSL template &#8220;dvt_1.rowview&#8221; within the DVWP<br />
<table border="0" width="100%">
<tbody>
<tr>
<td style="border-bottom:1px gray solid" width="99%"></td>
<td style="background-color:#EAEAEA;border:1px gray solid;text-align:center;padding-left:10px;padding-right:10px">Example</td>
</tr>
<tr>
<td style="border-left:1px gray solid;border-bottom:1px gray solid;font-family:'Courier New', Courier, monospace" colspan="2">&lt;xsl:template name=&#8221;dvt_1.rowview&#8221;&gt;</td>
</tr>
</tbody>
</table>
<p>This XSL template specifies what is rendered for each List Item displayed in the DVWP.  A tooltip will be rendered for eash List Item and therefore should be added to this template.</li>
<li>Locate where the tooltip should appear<br />
No consideration for spacing of the tooltip should be taken into account.  The tooltip will utilize the position style value “absolute” to display over other page content.</li>
<li>Insert the blank tooltip<br />
<table border="0" width="100%">
<tbody>
<tr>
<td style="border-bottom:1px gray solid" width="99%"></td>
<td style="background-color:#EAEAEA;border:1px gray solid;text-align:center;padding-left:10px;padding-right:10px">Example</td>
</tr>
<tr>
<td style="border-left:1px gray solid;border-bottom:1px gray solid;font-family:'Courier New', Courier, monospace" colspan="2">&lt;div style=&#8221;position:absolute;display:none;margin-top:14px;white-space:<br />
»nowrap;overflow:visible;border:silver 1px solid;background-color:<br />
»white&#8221; class=&#8221;ms-listdescription&#8221;&gt;<br />
&lt;xsl:attribute name=&#8221;id&#8221;&gt;tooltip_&lt;xsl:value-of select=&#8221;@ID&#8221;/&gt;<br />
»&lt;/xsl:attribute&gt;<br />
&lt;xsl:attribute name=&#8221;onmouseenter&#8221;&gt;javascript:this.style.display=<br />
»&#8217;none&#8217;;&lt;/xsl:attribute&gt;<br />
&lt;/div&gt;</td>
</tr>
<tr>
<td style="border-top:1px gray solid;text-align:right" colspan="2">
<table style="border-left:1px gray solid;border-bottom:1px gray solid;border-right:1px gray solid;color:gray" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding-left:10px;padding-right:10px">» &#8211; unintended line break</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>The tooltip may be any HTML object and is not limited to the DIV object.  The tooltip HTML object must have the <em>id</em> attribute set as shown in the provided example.  The <em>position</em> and <em>display</em> style attributes should be set as shown in the provided example.  Setting the <em>position</em> style attribute to &#8220;absolute&#8221; allows the tooltip to display over other page content.  The <em>onmouseenter</em> attribute (as shown in the provided example) hides the tooltip if the user moves the cursor onto the tooltip.</p>
<p>If multiple DVWPs on the same page will use the tooltip functionality, the id attribute of tooltips must be made distinct in each DVWP.  For example, tooltips in a DVWP on the List &#8220;Transactions&#8221; could use the id attribute convention: tooltip_transactions_[List Item ID].  Thus, tooltip id attributes that may have been &#8220;tooltip_14&#8243; and &#8220;tooltip_14&#8243; may now be &#8220;tooltip_transactions_14&#8243; and &#8220;tooltip_reports_14&#8243;.</li>
<li>Set the tooltip text<br />
<table border="0" width="100%">
<tbody>
<tr>
<td style="border-bottom:1px gray solid" width="99%"></td>
<td style="background-color:#EAEAEA;border:1px gray solid;text-align:center;padding-left:10px;padding-right:10px">Example</td>
</tr>
<tr>
<td style="border-left:1px gray solid;border-bottom:1px gray solid;font-family:'Courier New', Courier, monospace" colspan="2">&lt;xsl:choose&gt;<br />
&lt;xsl:when test=&#8221;string-length(string(@Tooltip))=0&#8243;&gt;<br />
&lt;xsl:text&gt;No tooltip.&lt;/xsl:text&gt;<br />
&lt;/xsl:when&gt;<br />
&lt;xsl:otherwise&gt;<br />
&lt;xsl:value-of select=&#8221;@Tooltip&#8221; disable-output-escaping=&#8221;yes&#8221;/&gt;<br />
&lt;/xsl:otherwise&gt;<br />
&lt;/xsl:choose&gt;</td>
</tr>
</tbody>
</table>
<p>If the tooltip references a List Item column that is not required (i.e. may be empty), it is suggested that empty values be handled as shown in the provided example. List columns must be referenced by their internal name. Setting the <em>disable-output-escaping</em> attribute to &#8220;yes&#8221; will display special (i.e. escaped) characters properly (i.e. unescaped). Please note that the provided example references a custom (i.e. non-standard) column called &#8220;Tooltip&#8221;.</li>
</ol>
<p style="TEXT-ALIGN: left">The tooltip should be located like:</p>
<p style="text-align: center;"><a title="dvt_1.rowview HTML object hiearchy" href="http://blog.metrostarsystems.com/wp-content/uploads/2009/12/rowview_object_hiearchy.png" target="_blank"><img class="aligncenter" style="border-width: 0px;" title="dvt_1.rowview HTML object hiearchy" src="http://blog.metrostarsystems.com/wp-content/uploads/2009/12/rowview_object_hiearchy-1024x236.png" alt="dvt_1.rowview HTML object hiearchy" width="480" height="110" /></a></p>
<p>As a result of setting the position style attribute to &#8220;absolute&#8221;, the tooltip renders like:</p>
<p style="text-align: center;"><a title="dvt_1.rowview HTML object rendering" href="http://blog.metrostarsystems.com/wp-content/uploads/2009/12/rowview_object_rendering.png" target="_blank"><img class="size-large wp-image-2286 aligncenter" style="margin: 0px; border-width: 0px;" title="dvt_1.rowview HTML object rendering" src="http://blog.metrostarsystems.com/wp-content/uploads/2009/12/rowview_object_rendering-1024x256.png" alt="dvt_1.rowview HTML object rendering" width="480" height="120" /></a></p>
<h2>Create the Tooltip Triggers</h2>
<ol>
<li> Locate the DVWP in which the tooltip has been created</li>
<li>Locate the XSL template &#8220;dvt_1.rowview&#8221; within the DVWP<br />
<table border="0" width="100%">
<tbody>
<tr>
<td style="border-bottom:1px gray solid" width="99%"></td>
<td style="background-color:#EAEAEA;border:1px gray solid;text-align:center;padding-left:10px;padding-right:10px">Example</td>
</tr>
<tr>
<td style="border-left:1px gray solid;border-bottom:1px gray solid;font-family:'Courier New', Courier, monospace" colspan="2">&lt;xsl:template name=&#8221;dvt_1.rowview&#8221;&gt;</td>
</tr>
</tbody>
</table>
<p>This XSL template specifies what is rendered for each List Item displayed in the DVWP. Each tooltip trigger (i.e. system response to a user action) will show /hide the tooltip in the same row (i.e. TR object) as itself.  Therefore, the tooltip trigger should be located within this template.</li>
<li>Locate the HTML object that will trigger the display of tooltips in response to a specified user action.</li>
<li>Insert the tooltip triggers<br />
<table border="0" width="100%">
<tbody>
<tr>
<td style="border-bottom:1px gray solid" width="99%"></td>
<td style="background-color:#EAEAEA;border:1px gray solid;text-align:center;padding-left:10px;padding-right:10px">Example</td>
</tr>
<tr>
<td style="border-left:1px gray solid;border-bottom:1px gray solid;font-family:'Courier New', Courier, monospace" colspan="2">&lt;td&gt;<br />
&lt;xsl:attribute name=&#8221;onmouseenter&#8221;&gt;javascript:var tooltipObj=document.<br />
»getElementById(&#8216;tooltip_&lt;xsl:value-of select=&#8221;@ID&#8221;/&gt;&#8217;);tooltipObj.<br />
»style.left=event.clientX;tooltipObj.style.top=clientY;tooltipObj.<br />
»style.display=&#8221;;&lt;/xsl:attribute&gt;<br />
&lt;xsl:attribute name=&#8221;onmouseleave&#8221;&gt;javascript:document.getElementById(<br />
»&#8217;tooltip_&lt;xsl:value-of select=&#8221;@ID&#8221;/&gt;&#8217;).style.display=&#8217;none&#8217;;<br />
»&lt;/xsl:attribute&gt;<br />
&lt;xsl:value-of select=&#8221;@Title&#8221;/&gt;<br />
&lt;/td&gt;</td>
</tr>
<tr>
<td style="border-top:1px gray solid;text-align:right" colspan="2">
<table style="border-left:1px gray solid;border-bottom:1px gray solid;border-right:1px gray solid;color:gray" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="padding-left:10px;padding-right:10px">» &#8211; unintended line break</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>Tooltip triggers are inline JavaScript that find and display the tooltip appropriately. The tooltip is shown by setting its <em>display</em> style attribute to null and hidden by setting its <em>display</em> style attribute to &#8220;none&#8221;. The provided example shows the tooltip when the user moves the cursor onto the Title column&#8217;s parent TD and hides the tooltip when the user moves the cursor off the title column&#8217;s parent TD. Please note that the tooltip triggers are applied to the column&#8217;s parent TD to provide an optimal user experience.  The provided example displays the tooltip at the point where the user moved the cursor onto the parent TD (rather than always below the parent TD content).</li>
</ol>
<h2>Example</h2>
<p style="text-align: center;"><a title="DVWP Tooltip example" href="http://blog.metrostarsystems.com/wp-content/uploads/2009/12/dvwp_tooltip_example.jpg" target="_blank"><img class="  aligncenter" style="margin: 0px; border-width: 0px;" title="dvwp_tooltip_example" src="http://blog.metrostarsystems.com/wp-content/uploads/2009/12/dvwp_tooltip_example.jpg" alt="DVWP Tooltip example" width="556" height="86" /></a></p>
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://blog.metrostarsystems.com/2009/12/04/dvwp-tooltip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Show Elapsed Modified Time in a Document Library</title>
		<link>http://blog.metrostarsystems.com/2009/11/03/show-elapsed-modified-time-in-a-document-library/</link>
		<comments>http://blog.metrostarsystems.com/2009/11/03/show-elapsed-modified-time-in-a-document-library/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 19:10:23 +0000</pubDate>
		<dc:creator>Ross Beurmann</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Document Libraries]]></category>
		<category><![CDATA[Elapsed Time]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[sha]]></category>
		<category><![CDATA[share]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[SharePoint Designer 2007]]></category>
		<category><![CDATA[SharePoint WorkFlow]]></category>
		<category><![CDATA[[Today]]]></category>

		<guid isPermaLink="false">http://blog.metrostarsystems.com/?p=2031</guid>
		<description><![CDATA[Introduction The requirement has come to fruition to see the elapsed time from the &#8220;Modified Date&#8221; to &#8220;Now&#8221; on a reports document library. This is not possible in a calculated value unfortunately do to [Today] and [Me] values being consumed in a calculated value are considered &#8220;Volatile&#8221; by SharePoint out of the box. These use<em> ... </em>]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCSharp.js"></script>
<h1>Introduction</h1>
<p>The requirement has come to fruition to see the elapsed time from the &#8220;Modified Date&#8221; to &#8220;Now&#8221; on a reports document library.  This is not possible in a calculated value unfortunately do to [Today] and [Me] values being consumed in a calculated value are considered &#8220;Volatile&#8221; by SharePoint out of the box.  These use the core MOSS/WSS functions and since the list is 100% dynamic it doesn&#8217;t pull session or current state information before loading the list on page load.  Every possible solution was attempted prior to using this custom solution.  Although this is all &#8220;client side&#8221; customization all methods of using out of the box methods were tried prior to this solutions development, the downfall being that even when [Today] was able to be used in a calculated value it did not record the time, only the current date.</p>
<h1>Required Items</h1>
<p>This solution involves slight modification of Meta Data through a simple SharePoint Designer workflow, a short JavaScript function, and the creation of a &#8220;Last Updated&#8221; field that is a Date and Time field.  Below are step by step instructions with screen shots of how to properly customize any List or Document Library to use this functionality.  SharePoint Designer, .NET Frame Work 3.5, and WSS 3.0 are required to implement this solution.</p>
<h1>Elapsed Time</h1>
<p>Create or open an existing document library and go to settings.</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed1.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 1 Document Library Settings<br />
</strong></span></p>
<p>Click Create Column</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed2.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 2 Create Column<br />
</strong></span></p>
<p>Name the Column &#8220;Last Updated&#8221; (Red) and make it a Date &amp; Time column (Blue)</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed3.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 3 Configure Column</strong></span></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong><span id="more-2031"></span><br />
</strong></span></p>
<p>Click Save, and go back to the Document Library page.  Click Site Actions, and Edit Page.</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed4.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 4 Edit Page<br />
</strong></span></p>
<p>Click Add a Web Part and select a Content Editor Web Part and click add.</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed5.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 5 Add a Web Part<br />
</strong></span></p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed6.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 6 Content Editor Web Part<br />
</strong></span></p>
<p>Select Edit on the Content Editor Web Part and select Modified Shared Web Part</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed7.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 7 Modify Web Part<br />
</strong></span></p>
<p>Select source editor and copy the following into the source box and click save.</p>
<p>I used the below code from this website: http://www.endusersharepoint.com/2009/01/23/jquery-for-everyone-replacing-today/</p>
<p><strong>Source:<br />
</strong></p>
<p><em>&lt;script src=&#8221;http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;<br />
</em></p>
<p><em>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
</em></p>
<p><em>$(function() {<br />
</em></p>
<p><em> var str = &#8220;Last Updated&#8221;; //change this based on col header<br />
</em></p>
<p><em> var today = new Date();<br />
</em></p>
<p><em> today = Date.parse(today)/1000;<br />
</em></p>
<p><em> var a=0;<br />
</em></p>
<p><em> var headers = $(&#8220;table.ms-listviewtable:first&gt; tbody&gt; tr:first th&#8221;).get();<br />
</em></p>
<p><em> $.each(headers, function(i,e){<br />
</em></p>
<p><em> x = $(e).contents().find(&#8220;a[title*='"+str+"']&#8220;).length;<br />
</em></p>
<p><em> a = x &gt; 0 &amp;&amp; i &gt; a ? i : a;<br />
</em></p>
<p><em> });<br />
</em></p>
<p><em> var dArray = $(&#8220;table.ms-listviewtable:first&gt; tbody&gt; tr:gt(0)&#8221;).find(&#8220;&gt;td:eq(&#8220;+a+&#8221;)&#8221;).get()<br />
</em></p>
<p><em> $.each(dArray, function(i,e){       �<br />
</em></p>
<p><em>var d1 = Date.parse($(e).text())/1000;<br />
</em></p>
<p><em> var dd = (today-d1)/86400;<br />
</em></p>
<p><em> var dh = (dd-Math.floor(dd))*24;<br />
</em></p>
<p><em> var dm = (dh-Math.floor(dh))*60;<br />
</em></p>
<p><em> var time = ((Math.floor(dd) &gt; 0 ? Math.floor(dd) +&#8221; days, &#8221; : &#8220;&#8221;)+<br />
</em></p>
<p><em> (Math.floor(dh) &gt; 0 ? Math.floor(dh)+&#8221; hrs, &#8221; : &#8220;&#8221;)+<br />
</em></p>
<p><em> (Math.floor(dm)+&#8221; min&#8221;));<br />
</em></p>
<p><em> $(e).text(time);<br />
</em></p>
<p><em> });<br />
</em></p>
<p><em>});<br />
</em></p>
<p><em>&lt;/script&gt;<br />
</em></p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed8.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 8 Source Editor Selection<br />
</strong></span></p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed9.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 9 Source Editor Input<br />
</strong></span></p>
<p>Open the page in SharePoint Designer and create a new workflow file.</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed10.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 10 Create a Workflow<br />
</strong></span></p>
<p>Name the workflow as &#8220;SetLUAsModified&#8221; select the list to attach as the document library you are using and select on create and on edit as when the workflow will run.</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed11.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 11 Set Last Updated Time<br />
</strong></span></p>
<p>Click next and now create your Action, we are setting the last updated field to equal modified.  Go to the Actions Drop down and select set field in current item (Red), then set value 1 as &#8220;Last Updated&#8221; and Value 2 as &#8220;Current Item&#8221; &#8220;Modified&#8221; (Blue)</p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed12.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 12 Set Field<br />
</strong></span></p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed13.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 13 Set Last Updated<br />
</strong></span></p>
<p><img src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/110309_1910_ShowElapsed14.png" alt="" /></p>
<p><span style="color:#4f81bd; font-family:Tahoma; font-size:9pt"><strong>Figure 14 Set Modified<br />
</strong></span></p>
<p>Save the Workflow and go back to the site, add a document to the library or edit an existing document and the &#8220;Last Updated&#8221; field will change to 0 minutes.</p>
<p><img class="alignnone size-full wp-image-2060" title="testResult" src="http://blog.metrostarsystems.com/wp-content/uploads/2009/11/testResult2.jpg" alt="testResult" width="612" height="147" /></p>
<p>Figure 15 Test Results</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.metrostarsystems.com/2009/11/03/show-elapsed-modified-time-in-a-document-library/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Javascript to Manipulate a List Form Field</title>
		<link>http://blog.metrostarsystems.com/2007/09/10/using-javascript-to-manipulate-a-list-form-field-2/</link>
		<comments>http://blog.metrostarsystems.com/2007/09/10/using-javascript-to-manipulate-a-list-form-field-2/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 16:06:39 +0000</pubDate>
		<dc:creator>Jorge "El Che" Vasquez</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MOSS]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://blog.metrostarsystems.com/?p=208</guid>
		<description><![CDATA[This is a great post by the SharePoint Designer Team on using javascript to manipulate a list form field: http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCSharp.js"></script>
<p>This is a great post by the SharePoint Designer Team on using javascript to manipulate a list form field:</p>
<p><a href="http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx">http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.metrostarsystems.com/2007/09/10/using-javascript-to-manipulate-a-list-form-field-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Javascript to Manipulate a List Form Field</title>
		<link>http://blog.metrostarsystems.com/2007/06/25/using-javascript-to-manipulate-a-list-form-field/</link>
		<comments>http://blog.metrostarsystems.com/2007/06/25/using-javascript-to-manipulate-a-list-form-field/#comments</comments>
		<pubDate>Mon, 25 Jun 2007 15:14:56 +0000</pubDate>
		<dc:creator>Jorge "El Che" Vasquez</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://blog.metrostarsystems.com/?p=192</guid>
		<description><![CDATA[This is a good article on how to be able to set values on SharePoint Elements. http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx Thanks for the link Pirooz]]></description>
			<content:encoded><![CDATA[            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushJScript.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushXml.js"></script>
            <script type="text/javascript" src="http://blog.metrostarsystems.com/wp-content/plugins/wordpress-code-snippet/scripts/shBrushCSharp.js"></script>
<p>This is a good article on how to be able to set values on SharePoint Elements.</p>
<p><a href="http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx">http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx</a></p>
<p>Thanks for the link Pirooz <img src='http://blog.metrostarsystems.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.metrostarsystems.com/2007/06/25/using-javascript-to-manipulate-a-list-form-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

