var _debug = true; var _placeholderSupport = function () { var t = document.createElement("input"); t.type = "text"; return (typeof t.placeholder !== "undefined"); } (); function addIEPlaceholders() { var arrInputs = document.getElementsByTagName("input"); var arrTextareas = document.getElementsByTagName("textarea"); var combinedArray = []; for (var i = 0;i < arrInputs.length;i++) combinedArray.push(arrInputs[i]); for (var i = 0;i < arrTextareas.length;i++) combinedArray.push(arrTextareas[i]); for (var i = 0;i < combinedArray.length;i++) { var curInput = combinedArray[i]; if (!curInput.type || curInput.type == "" || curInput.type == "text" || curInput.type == "textarea") HandlePlaceholder(curInput); else if (curInput.type == "password") ReplaceWithText(curInput); } if (!_placeholderSupport) { for (var i = 0;i < document.forms.length;i++) { var oForm = document.forms[i]; if (oForm.attachEvent) { oForm.attachEvent("onsubmit", function () { PlaceholderFormSubmit(oForm); }); } else if (oForm.addEventListener) oForm.addEventListener("submit", function () { PlaceholderFormSubmit(oForm); }, false); } } }; function PlaceholderFormSubmit(oForm) { for (var i = 0;i < oForm.elements.length;i++) { var curElement = oForm.elements[i]; HandlePlaceholderItemSubmit(curElement); } } function HandlePlaceholderItemSubmit(element) { if (element.name) { var curPlaceholder = element.getAttribute("placeholder"); if (curPlaceholder && curPlaceholder.length > 0 && element.value === curPlaceholder) { element.value = ""; window.setTimeout(function () { element.value = curPlaceholder; }, 100); } } } function ReplaceWithText(oPasswordTextbox) { if (_placeholderSupport) return; var oTextbox = document.createElement("input"); oTextbox.type = "text"; oTextbox.id = oPasswordTextbox.id; oTextbox.name = oPasswordTextbox.name; //oTextbox.style = oPasswordTextbox.style; oTextbox.className = oPasswordTextbox.className; for (var i = 0;i < oPasswordTextbox.attributes.length;i++) { var curName = oPasswordTextbox.attributes.item(i).nodeName; var curValue = oPasswordTextbox.attributes.item(i).nodeValue; if (curName !== "type" && curName !== "name") { oTextbox.setAttribute(curName, curValue); } } oTextbox.originalTextbox = oPasswordTextbox; oPasswordTextbox.parentNode.replaceChild(oTextbox, oPasswordTextbox); HandlePlaceholder(oTextbox); if (!_placeholderSupport) { oPasswordTextbox.onblur = function () { if (this.dummyTextbox && this.value.length === 0) { this.parentNode.replaceChild(this.dummyTextbox, this); } }; } } function HandlePlaceholder(oTextbox) { if (!_placeholderSupport) { var curPlaceholder = oTextbox.getAttribute("placeholder"); if (curPlaceholder && curPlaceholder.length > 0 && (oTextbox.value != curPlaceholder)) { Debug("Placeholder found for input box '" + oTextbox.name + "': " + curPlaceholder); Debug("Value found for input box '" + oTextbox.value + "': " + curPlaceholder); if (document.activeElement && oTextbox.name == document.activeElement.name) { Debug("Active Element and text field name are same '" + document.activeElement.name + "'and " + oTextbox.name); } else { if (oTextbox.value == "") { oTextbox.value = curPlaceholder; oTextbox.setAttribute("old_color", oTextbox.style.color); oTextbox.style.color = "#c0c0c0"; } oTextbox.onfocus = function () { Debug(" coming insideFocus this type'"); var _this = this; /* if (this.originalTextbox) { Debug("inside Original textbox in if condition '" + this.originalTextbox); _this = this.originalTextbox; _this.dummyTextbox = this; this.parentNode.replaceChild(this.originalTextbox, this); _this.focus(); }*/ Debug("input box '" + _this.name + "' focus"); Debug("input box '" + _this.value + "' Value"); _this.style.color = _this.getAttribute("old_color"); if (_this.value === curPlaceholder) _this.value = ""; }; oTextbox.onblur = function () { var _this = this; Debug("input box '" + _this.name + "' blur"); Debug("input box value in blur is '" + oTextbox.value + "' blur"); if (_this.value === "" && oTextbox.value == "") { _this.style.color = "#c0c0c0"; _this.value = curPlaceholder; _this.style.border = "1px solid #cccccc"; } }; } } else { Debug("input box '" + oTextbox.name + "' does not have placeholder attribute"); Debug("input box '" + oTextbox.value + "' does not have placeholder attribute and actual placeholder is" + oTextbox.getAttribute("placeholder")); if (oTextbox.value == curPlaceholder) { oTextbox.value = ""; } } } else { Debug("browser has native support for placeholder"); } } function Debug(msg) { if (typeof _debug !== "undefined" && _debug) { console.log(msg); } } var restrictInput = function (adfKeyPressEvent, allowedChars) { var nativeKeyPressEvent = adfKeyPressEvent.getNativeEvent(); var key = nativeKeyPressEvent.keyCode; var character = nativeKeyPressEvent.charCode; var control = nativeKeyPressEvent.ctrlKey; var alt = nativeKeyPressEvent.altKey; if (character !== 0 && !control && !alt) { var enteredChar = String.fromCharCode(key | character); if (!(allowedChars.indexOf(enteredChar) >= 0)) { adfKeyPressEvent.cancel(); } } }; var numeric2Decimal = function (el){ var ex = /^[0-9]+\.?[0-9]*$/; if(ex.test(el.value)==false){ el.value = el.value.substring(0,el.value.length - 1); } } var instaPayNumericInput = function (adfKeyPressEvent) { var allowedChars = "0123456789"; restrictInput(adfKeyPressEvent, allowedChars); }; var allowOnlyNumericInput = function (adfKeyPressEvent) { var allowedChars = "0123456789."; restrictInput(adfKeyPressEvent, allowedChars); }; var allowOnlyDateFormatInput = function (adfKeyPressEvent) { var allowedChars = "0123456789/-"; restrictInput(adfKeyPressEvent, allowedChars); }; var allowOnlyCharWithSpaceInput = function (adfKeyPressEvent) { var allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "; restrictInput(adfKeyPressEvent, allowedChars); }; var allowOnlyChar = function (adfKeyPressEvent) { var allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; restrictInput(adfKeyPressEvent, allowedChars); }; var allowOnlyAlphaNumeric = function (adfKeyPressEvent) { var allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; restrictInput(adfKeyPressEvent, allowedChars); }; /* for the notification dropdown*/ function myFunctionProfile(ID) { var div = document.getElementById(ID); if (div.style.display !== 'block') { div.style.display = 'block'; } else { div.style.display = 'none'; } } /* for the notification dropdown*/ function myFunctionProfile(ID) { var div = document.getElementById(ID); if (div.style.display !== 'block') { div.style.display = 'block'; } else { div.style.display = 'none'; } } function fncLoginNumber() { /* var valueNum = (document.getElementById("r1:0:s1:ot13::content").value); var valuePass = (document.getElementById("r1:0:s1:ot2::content").value); var x = document.getElementsByClassName("p_OraHiddenLabel"); if (valueNum != "") { x[0].classList.add("clsValidlabel"); } else if (valueNum == "") { x[0].classList.remove("clsValidlabel"); } if (valuePass != "") { x[1].classList.add("clsValidlabel"); } else if (valuePass == "") { x[1].classList.remove("clsValidlabel"); }*/ } /*On click window hide menu*/ window.onclick = function (event) { if (!event.target.matches('.dropBtn')) { var dropdowns = document.getElementsByClassName("notificationcontent"); var i; for (i = 0;i < dropdowns.length;i++) { var openDropdown = dropdowns[i]; if (openDropdown.style.display == 'block') { document.getElementById("notification").style.display = 'none'; } } } } function fncSHPassnew() { var textbox_elem = document.getElementById("d_pt:pasView:1:it1::content"); var ancid = document.getElementById("d_pt:pasView:1:cl1"); var para = textbox_elem.getAttribute("type"); if (para == "password") { textbox_elem.setAttribute("type", "text"); // ancid.innerHTML = "Hide"; ancid.classList.add("icon-watch_active"); } else { textbox_elem.setAttribute("type", "password"); //ancid.innerHTML = "Show"; ancid.classList.remove("icon-watch_active"); } } function fncSHPassCnf() { var textbox_elem = document.getElementById("d_pt:pasView:1:it2::content"); var ancid = document.getElementById("d_pt:pasView:1:cl2"); var para = textbox_elem.getAttribute("type"); if (para == "password") { textbox_elem.setAttribute("type", "text"); //ancid.innerHTML = "Hide"; ancid.classList.add("icon-watch_active"); } else { textbox_elem.setAttribute("type", "password"); // ancid.innerHTML = "Show"; ancid.classList.remove("icon-watch_active"); } } function fncSHPassnewLogin() { var textbox_elem = document.getElementById("r1:0:s1:ot2::content"); var ancid = document.getElementById("r1:0:s1:cl1"); var para = textbox_elem.getAttribute("type"); if (para == "password") { textbox_elem.setAttribute("type", "tel"); // ancid.innerHTML = "Hide"; ancid.classList.add("icon-watch_active"); } else { textbox_elem.setAttribute("type", "password"); //ancid.innerHTML = "Show"; ancid.classList.remove("icon-watch_active"); } } function ChangeMobileNumberPass() { var textbox_elem = document.getElementById("d_pt:mobVew:1:it4::content"); var ancid = document.getElementById("d_pt:mobVew:1:cl1"); var para = textbox_elem.getAttribute("type"); if (para == "password") { textbox_elem.setAttribute("type", "text"); // ancid.innerHTML = "Hide"; ancid.classList.add("icon-watch_active"); } else { textbox_elem.setAttribute("type", "password"); //ancid.innerHTML = "Show"; ancid.classList.remove("icon-watch_active"); } } function fncScroolTop() { document.getElementById("ancHeader").focus(); } function myUpload(btnCLASS) { document.querySelector(btnCLASS).click(); } function ScrolltOTopPage() { /* setTimeout(function(){ window.scrollTo(0, 0); }, 2000);*/ } function fncClickErrorOK() { document.getElementById("pt1:r1:2:dc1:cb1").focus(); } function fncDocOkClick() { document.getElementById("pt1:r1:4:dc1:cb14").focus(); } /* $(document).ready(function(){ $(".dateRefundFrom input").click(function(){ alert("The paragraph was clicked."); }); $(function() { $(".dateRefundFrom input").datepicker({ maxDate: new Date(), changeYear: true, yearRange: "2001:2018" }); }); }); */ function blockNoteWindow(event) { var src = event.getSource(); src.getPeer().ShouldShowHint = function () { return false; } } function disableEntry(evt) { evt.cancel(); } function addjsPdf(input) { console.log('calling addjsPdf method :: '); var doc = new jsPDF('p', 'pt', 'a4'); console.log('after initiating jspdf class :: '); var str1 = 'data:image/png;base64,'; var fields = input.split('$~'); var upiImgData = fields[0]; var jppImgData = fields[1]; var busName = fields[2]; var askQrText = fields[3]; var makeUpiText = fields[4]; var qrImgData = fields[5]; var askUpiText = fields[6]; var vpaName = fields[7]; var qrImg = str1.concat(qrImgData); var jppImg = str1.concat(jppImgData); var upiImg = str1.concat(upiImgData); //upi doc.addImage(upiImg, 'png', 40, 80, 85, 40); //jpp doc.addImage(jppImg, 'png', 460, 80, 90, 40); doc.setFontSize(22); doc.setFontStyle('bold'); doc.text(197, 180, busName);// business name doc.setFontStyle(''); doc.setLineWidth(1); doc.setDrawColor(216, 216, 216); doc.line(43, 210, 545, 210); doc.setFontSize(16); doc.setTextColor(140, 140, 140); // doc.text(40, 210, '-----------------------------------------------------------------------------------------------'); // make payment through UPI doc.setFontSize(18); doc.text(175, 240, askQrText); doc.text(205, 260, makeUpiText); //qr doc.setTextColor(''); doc.addImage(qrImg, 'png', 160, 290, 290, 290); doc.setTextColor(140, 140, 140); doc.text(175, 615, askUpiText); doc.setFontStyle('bold'); doc.setTextColor(''); doc.setFontSize(22); doc.text(189, 640, vpaName); console.log('after addig data to jspdf class :: '); doc.output('save', vpaName + '.pdf'); }