javascript tagged posts

Google Chrome – Read and Debug minimized JavaScript file

Category: Dev Comments: No comments


Minimized JavaScript files are perfect. Sometimes, however, is quite hard to debug it, especially if they are coming from plugins and so on.
Since several years I’m a Google Chrome guy and Chrome has a really good Developer Tool… An amazing tool is the “Pretty Print” ¬†and you can easily see minimized files in a readable way.

Once you click on the button you will see the files quite better :-)
Of course if the file is obfuscated you will not see everything, but it will help you to debug your applications


Read More

ECMA SharePoint 2010 – Checkout and Checkin with JavaScript

Category: #SharePoint Comments: No comments

With ECMA in SharePoint 2010 you can do things that normally – if you want to achieve programmatically – the costs time and money for the client.
One example is to set the CHECKOUT and CHECKIN status of a page. Few lines of JavaScript code and you’re done…

function checkOut(){
        var ctx = SP.ClientContext.get_current();
        var page = ctx.get_web().getFileByServerRelativeUrl(window.location.pathname);
        ctx.executeQueryAsync(Function.createDelegate(this, checkOut_Success),
                                            Function.createDelegate(this, checkOut_Fail));
function checkOut_Success(sender, args){
        alert(‘i am good’);
function checkOut_Fail(sender, args){
        alert(‘something wrong happened…’);


Read More

SharePoint 2010 – Modal Dialog and strange behavior with the dialog.master

Category: #SharePoint Comments: No comments

In SharePoint 2010 is available the object SP.UI.ModalDialog.You’ll have so the modal dialog windows of SharePoint 2010 available for your application page. That’s cool.

To open the modal dialog you execute the JavaScript code below (you can even add some callback event)

function OpenDialog(strPageURL, delegate, w, h) {
var dialogOptions = SP.UI.$create_DialogOptions();
dialogOptions.url = strPageURL; // URL of the Page
dialogOptions.width = w; // Width of the Dialog
dialogOptions.height = h; // Height of the Dialog
dialogOptions.dialogReturnValueCallback = Function.createDelegate(null, delegate); // Function to capture dialog closed event
SP.UI.ModalDialog.showModalDialog(dialogOptions); // Open the Dialog
return false;

To do that you have available the Dialog.master master page...

Read More