lunes, 25 de febrero de 2013

Improve Javascript skills

Javascript resources

Page loaded in javascript

Using anonimus function (due to the scope) the events fire where the page is loaded.

 

lunes, 18 de febrero de 2013

Catching the mouse wheel event


Simple Context Menu in Javascript

Right click to get a custom context menu. Click anywhere else to get the default context menu.

domingo, 17 de febrero de 2013

Working with Keycodes in Javascript

I've dicovered a new way for working with keycodes in javascript. Here is the code:

 

 

3 different ways with event click button in javascript


  
  
  

 

jueves, 14 de febrero de 2013

Some Nice Javascript programs


Clock which shows love
To-Do List

Some Theory about Repositories in SharePoint Applications

General Theory
List Design
Unit of Work
DataMapper
SharePoint List Repositories
Some Considerations
Some How-To´s
Project Object SharePoint Mapper
SharePoint Common FrameWork
SharePoint Guidance


Extend class String with Trim function in javascript

String.prototype.trim = function () {
    return this.replace(/^\s+/, '').replace(/\s+$/, '');
}

Authentication SharePoint 2010 based in Forms


using Microsoft.SharePoint;
using Microsoft.SharePoint.IdentityModel;

public class AuthenticationSharePoint : Authentication
{
    public bool IsValid( string url, Usuario usuario)
    {
        return SPClaimsUtility.AuthenticateFormsUser(new Uri(url), usuario.Login, usuario.Contrasenia);
    }
}

Clone Generic Object by Reflection in .NET


public static List GetAllProperties(Type type)
{
    BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly;
    var list = new List();

    if (type != null)
    {
        list.AddRange(type.GetProperties(flags));
        list.AddRange(GetAllProperties(type.BaseType));
    }

    return list;
}

public static T Clonar(T original)
{
    if (original == null) { throw new Exception("cannot be null object"); }

    var tipo = original.GetType();
    var resultado = Activator.CreateInstance(tipo);
    foreach (PropertyInfo propiedad in GetAllProperties(tipo))
    {
        propiedad.SetValue(resultado, propiedad.GetValue(original, null), null);
    }
    return (T)resultado;
}

ProgressBar in javasccript

 

 Progress Bar



    

domingo, 10 de febrero de 2013

Load CSS file Dynamically

function loadCSSFileDymanically(dir){
var link = document.createElement(“link”);
link.rel = "stylesheet";
link.type = "text/css";
link.href = dir;
var head = document.getElementsByTagName(“head”)[0];
head.appendChild(link);
}

Load JavaScript file Dynamically

function loadScriptDinamically(dir){
var script = document.createElement(“script”);
script.type = “text/javascript”;
script.src = dir;
document.body.appendChild(script);
}