-
Add a command to site action dropdown
-
Adding a custom menu item to ECB menu
-
Debugging WSS components
Under normal conditions, WSS provides error messages intended for end users in a production environment. This means that WSS doesn’t automatically provide rich diagnostic information or helpful error messages to assist you when you are debugging your code. While you are developing WSS components such as custom application pages, you must modify the web.config file for the current Web application to enable debugging support and error messages that contain stack traces. Here’s a fragment of the web.config file that shows the three important attributes that have been changed from their default values to enable rich
-
Factory vs Constructor
In A better javascript constructor, factory, I said factory is a better way to create object. We have seen jQuery can build a jQuery object using factory. But internally jQuery using constructor/prototype. Let me be clear about what do I mean by factory and constructor in javascript. Both factory and constructor can return build object. Factory has a return statement, but constructor has no return statement. Because of this, factory has be called with and without new, the effects are identical. Constructor has to be call with "new". It would return null reference without "new", and moreover it will run in the context of caller, sometimes the caller is global object. Good factory has no such problem, because it's designer's intention be called this way. But internally jQuery use constructor, see my post. Because constructor has use good feature : prototype. but factory can not. the demo code is as below.
function AnimalConstructor() {}; AnimalConstructor.prototype = { name: "fred" } var an = new AnimalConstructor(); alert(an.name); AnimalConstructor.prototype.age = 18; alert(an.age); //show 18
-
jQuery mini
I am fasinated by the jQuery library. I do so much more with so less code. Here I try to mimic jQuery several features: chain operation, extentsion, constructor.
<p> chain operation is pretty easy to mimic. We just need to add "return this;" to the end of a method. Here is my first try</p> <pre data-sub="prettyprint:_"> var jQuery = function() { } jQuery.prototype = { version: "1.0", showVersion: function() { alert(this.version); return this; }, work: function() { alert("work"); return this; }