moussa-e
10/6/2016 - 9:03 AM

JQuery #Javascript #MoussaElAnnan #JQuery

JQuery #Javascript #MoussaElAnnan #JQuery

/*
* Function that removes Null or Undefined properties form object.
* @param {obj} The object.
*/
removeNullPropertiesFromObject = function (objtProperties) {
    var obj = objtProperties;
    $.each(obj, function (key) {
        if (obj[key] === null || obj[key] === undefined) {
            delete obj[key];
        }
    });
    return obj;
}
$.each($("img"), function() {
		  var imgId = $(this).attr("id");
		  if(imgId == "form_pic_image"){
			   $( this ).replaceWith(function(){
				 return  "<img class='ms-crm-form-pic-image' id='form_pic_image' alt='Edit or remove the picture.' src='" + "../WebResources/gen_Client_logo_LARGE" + "'>";
			   });
     		  return false
		  }
		});
/*
* Function that disable copy, cut, paste.
*/
$(function () {
    $('#div1 input').bind('cut copy paste', function (e) {
        e.preventDefault();
    }).keydown(function (e) {
        if (e.ctrlKey && event.keyCode === 86) {
            e.preventDefault();
            return;
        } else {
            e.preventDefault();
              alert("Your not allowed to copy/cut/paste!");
            return;
        }
    });
});
/**
* Function that loads automatically the charts on the form.
*/
function loadNonLifeCharts() {
    $(document).ready(function () {
        var links = $('#tab1 span[id^="loadOnDemandMessage"');
        try {
            $.each(links, function (i, val) {
                var currentObject = $(this);
                setTimeout(function () {
                    currentObject.find('a').click();
                }, (i + 1) * 1000);
            });
        }
        catch (e) {
            //  alert(e);
        }
    });
}
/*
* Function that retrieves jQuery object
*/
getQueryObject = function () {
    if (typeof ($) === 'undefined') {
        $ = parent.$;
        jQuery = parent.jQuery;
    }
}