Advertisement
private775

SP: JavaScript to snatch "+ Add new" in calendar

Oct 9th, 2015
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2. function updateCal(){
  3.     if(typeof SP.UI.ApplicationPages.CalendarMouseHandler==="function"){
  4.         SP.UI.ApplicationPages.CalendarMouseHandler.prototype.old$92_1 = SP.UI.ApplicationPages.CalendarMouseHandler.prototype.$92_1;
  5.         SP.UI.ApplicationPages.CalendarMouseHandler.prototype.$92_1 = function($p0) {
  6.             var callParent = true;
  7.             var node = $p0.target;
  8.             if(node.tagName === "A"){
  9.                 var evtid = node.getAttribute("evtid");
  10.                 if(evtid && evtid === "new_item"){
  11.                     //callParent = false;
  12.                     alert("add new link clicked");
  13.                 }
  14.             }
  15.             if(callParent){
  16.                 this.old$92_1($p0);
  17.             }
  18.         };
  19.     }
  20. }
  21. _spBodyOnLoadFunctionNames.push("updateCal");
  22. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement