<?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>Buta no Ie &#187; js</title>
	<atom:link href="http://singchan.com/tag/js/feed/" rel="self" type="application/rss+xml" />
	<link>http://singchan.com</link>
	<description>The House of Pork and User Experience Development</description>
	<lastBuildDate>Tue, 11 Oct 2011 22:08:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SharePoint 2010: var $ conflict between CMSSiteManager.js and jQuery</title>
		<link>http://singchan.com/2010/11/06/sharepoint-2010-var-conflict-between-cmssitemanager-js-and-jquery/</link>
		<comments>http://singchan.com/2010/11/06/sharepoint-2010-var-conflict-between-cmssitemanager-js-and-jquery/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 18:27:18 +0000</pubDate>
		<dc:creator>Buta</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[CMSSiteManager.js]]></category>
		<category><![CDATA[conflict]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://singchan.com/?p=296</guid>
		<description><![CDATA[I ran into an issue recently on a SharePoint 2010 project where a page containing a Thumbnails list view was throwing a JavaScript error. I actually took the wrong path troubleshooting this and burned through a lot of time as a result. I had incorrectly assumed the error had something to do with our custom [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into an issue recently on a SharePoint 2010 project where a page containing a Thumbnails list view was throwing a JavaScript error. I actually took the wrong path troubleshooting this and burned through a lot of time as a result. I had incorrectly assumed the error had something to do with our custom master page.</p>
<p>Turns out the <em>CMSSiteManager.js</em> library that is used by the Thumbnails list view is also using the <strong>$</strong> variable! Argh!</p>
<p>Good thing the plug-in pattern we use only calls $ internally and not globally&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
(function($) {
  // plug-in goodness here...
})(jQuery);
</pre>
<p>Unfortunately our scripts for invoking the plug-ins was referencing <strong>$</strong>&#8230; <img src='http://singchan.com/wordpress/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<pre class="brush: plain; title: ; notranslate">
$(document).ready(function(){
  $('.foo').samplePlugin();
});
</pre>
<p>A quick replacement of <strong>$</strong> to <strong>jQuery</strong> did the trick:</p>
<pre class="brush: plain; title: ; notranslate">
jQuery(document).ready(function(){
  jQuery('.foo').samplePlugin();
});
</pre>
<p>If you have large blocks of inline jQuery code on your page, you&#8217;ll probably want to use jQuery.noConflict():</p>
<pre class="brush: plain; title: ; notranslate">
jQuery.noConflict()(function() {
    // code using $ as alias to jQuery
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://singchan.com/2010/11/06/sharepoint-2010-var-conflict-between-cmssitemanager-js-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SharePoint 2010: Fixing the MSDN Contextual Tab Web Part Walkthrough</title>
		<link>http://singchan.com/2010/07/31/sharepoint-2010-fixing-the-msdn-contextual-tab-web-part-walkthrough/</link>
		<comments>http://singchan.com/2010/07/31/sharepoint-2010-fixing-the-msdn-contextual-tab-web-part-walkthrough/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 21:49:54 +0000</pubDate>
		<dc:creator>Buta</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Ribbon]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Web Part]]></category>
		<category><![CDATA[2010]]></category>
		<category><![CDATA[contextual tab]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[ribbon]]></category>
		<category><![CDATA[ue]]></category>
		<category><![CDATA[user experience]]></category>
		<category><![CDATA[web part]]></category>

		<guid isPermaLink="false">http://singchan.com/?p=268</guid>
		<description><![CDATA[UPDATE!!! The latest versions of the CKSDev for SharePoint 2010 include an SPI for stubbing out a contextual web part! I highly recommend that anyone coding for SP2010 to install the CKS Dev Tools! http://cksdev.codeplex.com/ I haven&#8217;t had much opportunity to work with SharePoint 2010 in the past few months. However, I did get to [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong>UPDATE!!!</strong></p>
<p>The latest versions of the CKSDev for SharePoint 2010 include an SPI for stubbing out a contextual web part! I highly recommend that anyone coding for SP2010 to install the CKS Dev Tools!</p>
<p><a href="http://cksdev.codeplex.com/" title="CKS: Development Tools Editon" target="_blank">http://cksdev.codeplex.com/</a></p></blockquote>
<p>I haven&#8217;t had much opportunity to work with SharePoint 2010 in the past few months. However, I did get to try out the MSDN walkthrough for creating a custom web part with contextual ribbon tab recently. You can find the article here: <a href="http://msdn.microsoft.com/en-us/library/ff407578.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/ff407578.aspx</a></p>
<p>In a nutshell, what&#8217;s supposed to happen is when you click on the web part, there will be a custom tab that appears in the Ribbon. It all works great for the first instance of the custom web part you place onto a page, but if you try adding a second instance of the web part, your page blows up!</p>
<p>You&#8217;ll get the following error:<br />
<em>Item has already been added. Key in dictionary: &#8216;Ribbon.CustomContextualTabGroup&#8217;  Key being added: &#8216;Ribbon.CustomContextualTabGroup&#8217;</em></p>
<p>:-/ &#8230; looks like there wasn&#8217;t much QA done for the walkthrough. Anyways, to make a short story shorter&#8230; I posted a question on the <a href="http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/8604fda5-dad3-49e5-b820-af98ae2fb3cf" target="_blank">TechNet forums</a> and Dallas Tester from MS did get back to me with a bunch of suggestions.</p>
<p>Here are the changes you can make to allow for multiple instances of the custom web part to appear on the page without everything blowing up.</p>
<p><strong>Make the following modifications to the ContextualTabWebPart class.</strong></p>
<p>Add the global &#8216;_added&#8217; bool and OnInit event handler:</p>
<pre class="brush: csharp; title: ; notranslate">static bool _added = false;

protected override void OnInit(EventArgs e)
{
 base.OnInit(e);
 _added = false;
}</pre>
<p>Since we no longer have to get the unique component ID in the delay script, I changed DelayScript into a private string:</p>
<pre class="brush: csharp; title: ; notranslate">private string delayScript = @&quot;
 function _addCustomPageComponent()
 {
  for (var i = 0; i &lt; g_customWebPartIds.length; i++)
  {
    SP.Ribbon.PageManager.get_instance().addPageComponent(new ContextualTabWebPart.CustomPageComponent(g_customWebPartIds[i]));
  }
 }

 function _registerCustomPageComponent()
 {
  SP.SOD.registerSod(&quot;&quot;CustomContextualTabPageComponent.js&quot;&quot;, &quot;&quot;/_layouts/CustomContextualTabPageComponent.js&quot;&quot;);
  var isDefined = &quot;&quot;undefined&quot;&quot;;
  try
  {
   isDefined = typeof(ContextualTabWebPart.CustomPageComponent);
  }
  catch(e)
  {
  }
  EnsureScript(&quot;&quot;CustomContextualTabPageComponent.js&quot;&quot;,isDefined, _addCustomPageComponent);
 }
 SP.SOD.executeOrDelayUntilScriptLoaded(_registerCustomPageComponent, &quot;&quot;sp.ribbon.js&quot;&quot;);&quot;;</pre>
<p>Modify the OnPreRender event handler:</p>
<pre class="brush: csharp; title: ; notranslate">protected override void OnPreRender(EventArgs e)
{
 base.OnPreRender(e);

 ClientScriptManager csm = this.Page.ClientScript;
 string componentId = SPRibbon.GetWebPartPageComponentId(this); // the unique component id 

 // if this is the first instance of the custom web part,
 //we need to add the contextual tab to the ribbon
 if (!_added)
 {
  this.AddContextualTab();
  _added = true;
 }

 // we need to create an array which will store the IDs of all instances of our custom web part
 csm.RegisterClientScriptBlock(
  this.GetType(), &quot;DeclareCustomWebPartArray&quot;, &quot;var g_customWebPartIds = new Array();&quot;, true);

 // add this webpart's ID to our array
 csm.RegisterClientScriptBlock(
  this.GetType(), &quot;AddCustomWebPartId&quot; + componentId, &quot;g_customWebPartIds.push('&quot; + componentId + &quot;');&quot;, true);

 csm.RegisterClientScriptBlock(this.GetType(), &quot;ContextualTabWebPart&quot;, this.delayScript, true);
}</pre>
<p><strong>If you want to verify that the correct web part is trigger the Ribbon commands, you can modify the &#8216;<em>handleCommand</em>&#8216; method in &#8216;<em>CustomContextualTabPageComponent.js</em>&#8216;</strong></p>
<pre class="brush: jscript; title: ; notranslate">handleCommand: function ContextualTabWebPart_CustomPageComponent$handleCommand(commandId, properties, sequence) {
 if (commandId === 'CustomContextualTab.HelloWorldCommand') {
  alert(this._webPartPageComponentId + ' says: Hello, world!');
 }
 if (commandId === 'CustomContextualTab.GoodbyeWorldCommand') {
  alert(this._webPartPageComponentId + ' says: Good-bye, world!');
 }
}</pre>
<p>Here&#8217;s a <a href="http://singchan.com/wordpress/wp-content/uploads/2010/07/ContextualTabWebPart.zip">ZIP file of the entire solution</a> in case you&#8217;re too lazy to make the modifications yourself. <img src='http://singchan.com/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://singchan.com/2010/07/31/sharepoint-2010-fixing-the-msdn-contextual-tab-web-part-walkthrough/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Microsoft announces Internet Explorer 9 at PDC</title>
		<link>http://singchan.com/2009/11/20/microsoft-announces-internet-explorer-9-at-pdc/</link>
		<comments>http://singchan.com/2009/11/20/microsoft-announces-internet-explorer-9-at-pdc/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 16:25:29 +0000</pubDate>
		<dc:creator>Buta</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[ie9]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[ms]]></category>
		<category><![CDATA[pdc]]></category>
		<category><![CDATA[pdc09]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[SunSpider]]></category>

		<guid isPermaLink="false">http://singchan.com/?p=99</guid>
		<description><![CDATA[Microsoft has announced they&#8217;re busy working away on the next version of Internet Explorer. Some of the more interesting things included: Much better JavaScript performance! IE8 was a nice first step at improving JS performance on IE but still woefully behind the JS profilers and JIT compilers of Firefox, Safari, et al. Early builds of [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft has announced they&#8217;re busy working away on the next version of Internet Explorer. Some of the more interesting things included:</p>
<ul>
<li>Much better JavaScript performance! IE8 was a nice first step at improving JS performance on IE but still woefully behind the JS profilers and JIT compilers of Firefox, Safari, et al. Early builds of IE9 are already 4 times faster in the <a title="SunSpider JavaScript Benchmark" href="http://www2.webkit.org/perf/sunspider-0.9/sunspider.html" target="_blank">SunSpider benchmark</a> than that of IE8 and putting it about par with Firefox 3.5.</li>
<li>CSS Level 3! Again early builds apparently are able to pass the majority of the <a title="CSS3 Selectors Testsuite" href="http://www.css3.info/selectors-test/test.html" target="_blank">CSS3 Selectors Testsuite</a>, 41 out of 43. Of course, Firefox 3.5 and Safari 4 already completely pass this test. IE8 only passed 22 of these tests by the way.</li>
</ul>
<h3>Where&#8217;s more HTML5?</h3>
<p>Microsoft was very non-committal about this. They made a good start in IE8 with things like DOM storage, cross document messaging (XDM) and have a built in JSON API, but where&#8217;s &lt;video&gt; or more importantly &lt;canvas&gt;?</p>
<p>It&#8217;s a promising start for Microsoft with news about IE9&#8242;s JS performance and CSS3 compliance. Here&#8217;s hoping to Microsoft finding time to implement some of the HTML elements that competitors have already integrated into their browsers. Don&#8217;t need IE10 to STILL be playing catch-up.</p>
]]></content:encoded>
			<wfw:commentRss>http://singchan.com/2009/11/20/microsoft-announces-internet-explorer-9-at-pdc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

