Tuesday, 17 October 2017

Disable mouse right click

Professional Way

$(document).keydown(function(event){
    if(event.keyCode==123){
        return false;
    }
    else if (event.ctrlKey && event.shiftKey && event.keyCode==73){        
             return false;
    }
});

$(document).on("contextmenu",function(e){        
   e.preventDefault();
});


It's unprofessional

document.oncontextmenu = document.body.oncontextmenu = function() {return false;}

Sunday, 6 August 2017

Create Account URL & Forgot Password URL In theme level


REGISTER
#set ($CreateAccountURL = $portletURLFactory.create($request, "58", $page.getPlid(), "RENDER_PHASE"))
            $CreateAccountURL.setPortletMode("view")
            $CreateAccountURL.setWindowState("maximized")
            $CreateAccountURL.setParameter("struts_action", "/login/create_account")
            $CreateAccountURL.setParameter("", "")
                <a href="$CreateAccountURL">REGISTER</a>


 
FORGOT PASSWORD
#set ($forgetpasswordURL = $portletURLFactory.create($request, "58", $page.getPlid(), "RENDER_PHASE"))
            $forgetpasswordURL.setPortletMode("view")
            $forgetpasswordURL.setWindowState("maximized")
            $forgetpasswordURL.setParameter("struts_action", "/login/forgot_password")
            $forgetpasswordURL.setParameter("", "")
                <a href="$forgetpasswordURL">FORGOT PASSWORD</a>

Wednesday, 26 July 2017

Mobile & tab device rotation page refresh



Device rotation page will get refresh


jquery_var(window).on("orientationchange",function(event){
                  console.log('window change');
                  var width = 768;
                  var windowwidth = jquery_var(window).width();
                  var windowheight = jquery_var(window).height();
                 
                  console.log('width...'+width);
                  console.log('windowwidth...'+windowwidth);
                  console.log('windowheight...'+windowheight);
                 
                  if(((windowwidth <= width) && (windowheight >= width)) || ((windowwidth >= width) && (windowheight <= width)))
                  {
                        console.log('Inside.. condition ...');
                        window.location.reload(true);
                  }
            });

Monday, 24 July 2017

Window size measurement


<div id="divInitial"></div>
<div id="divResize"></div>

$("#divInitial").text("Initial Window width: " + $(window).width() + ", height: " + $(window).height() + ".");

//Event to handle resizing
$(window).resize(function () {
    var winwidth = $(window).width();
    var width = winwidth+"px"
    var winheight = $(window).height();
    var height = winheight +"px"
    //alert("width:"+ width + " and height:"+ height);
    $("#divResize").text("Window width: " + width + ", height: " + height + ".");
});

Monday, 3 July 2017

Mobile & tablet view Portlet place change

if(jquery_var(window).width() <= 768){
         var div1 = jquery_var("#p_p_id_invitationAppportlet_WAR_employerwatchListportlet_");
         jquery_var('#p_p_id_companyInfoportlet_WAR_companyInfoportlet_').insertBefore(div1);
 }

Bootstrap accordion only mobile & tablet



<script>
if(jquery_var(window).width() <= 768){
    jquery_var('#pan').addClass('panel');
    jquery_var('#pan-head').addClass('panel-heading');
    jquery_var('#pan-title').addClass('panel-title');
    jquery_var('#pan-click').addClass('pull-right clickable');
    jquery_var('#pan-body').addClass('panel-body panel-body-white');
}
</script>

Add & Remove Attribute
jquery_var("#Id").removeAttr("readonly");