From 08a21f49f2eaf9cfc19ceb67b196cc36ba689305 Mon Sep 17 00:00:00 2001 From: buli <137736985@qq.com> Date: 星期五, 13 五月 2022 20:52:25 +0800 Subject: [PATCH] FIxSWOPageIssue --- force-app/main/default/staticresources/CommonUtilJs.js | 225 +++++--------------------------------------------------- 1 files changed, 21 insertions(+), 204 deletions(-) diff --git a/force-app/main/default/staticresources/CommonUtilJs.js b/force-app/main/default/staticresources/CommonUtilJs.js index e54b2b6..72814f3 100644 --- a/force-app/main/default/staticresources/CommonUtilJs.js +++ b/force-app/main/default/staticresources/CommonUtilJs.js @@ -1,217 +1,34 @@ function keyCheck(keyCodes, num, str){ - if(keyCodes == 46 || keyCodes == 8 || keyCodes == 37 || keyCodes == 39 || keyCodes == 9){ - return true; - } - else if(str.value.length < num && ((keyCodes >= 48 && keyCodes <= 57) || (keyCodes >= 95 && keyCodes <= 105))){ - return true; - } - else{ - return false; - } + if(keyCodes == 46 || keyCodes == 8 || keyCodes == 37 || keyCodes == 39 || keyCodes == 9){ + return true; + } + else if(str.value.length < num && ((keyCodes >= 48 && keyCodes <= 57) || (keyCodes >= 95 && keyCodes <= 105))){ + return true; + } + else{ + return false; + } } function keyCheckAmount(keyCodes, num, str){ - if(keyCodes == 46 || keyCodes == 8 || keyCodes == 37 || keyCodes == 39 || keyCodes == 9){ - return true; - } - else if(str.value.length < num && ((keyCodes >= 48 && keyCodes <= 57) || (keyCodes >= 95 && keyCodes <= 105) || keyCodes == 110 || keyCodes == 190)){ - return true; - } - else{ - return false; - } + if(keyCodes == 46 || keyCodes == 8 || keyCodes == 37 || keyCodes == 39 || keyCodes == 9){ + return true; + } + else if(str.value.length < num && ((keyCodes >= 48 && keyCodes <= 57) || (keyCodes >= 95 && keyCodes <= 105) || keyCodes == 110 || keyCodes == 190)){ + return true; + } + else{ + return false; + } } function onKeyEvent(e) { e = e || window.event; if(e.keyCode == 13){ //Enter 銈兗 - return false; //鐒″姽 + if (e.target.type.toUpperCase() != "TEXTAREA") { + return false; //鐒″姽 + } } return true; } - -function escapeVfId(vfId) { - return '#' + vfId.replace(/(:|\.)/g,'\\$1'); -} - -//function escapeURI(pOrg) { -// var rtn = pOrg -// rtn = rtn.split("!").join("%21"); -// rtn = rtn.split("#").join("%23"); -// rtn = rtn.split("$").join("%24"); -// rtn = rtn.split("%").join("%25"); -// rtn = rtn.split("'").join("%27"); -// rtn = rtn.split("(").join("%28"); -// rtn = rtn.split(")").join("%29"); -// rtn = rtn.split("*").join("%2A"); -// rtn = rtn.split("+").join("%2B"); -// rtn = rtn.split(",").join("%2C"); -// rtn = rtn.split("-").join("%2D"); -// rtn = rtn.split(".").join("%2E"); -// rtn = rtn.split("/").join("%2F"); -// rtn = rtn.split(":").join("%3A"); -// rtn = rtn.split(";").join("%3B"); -// rtn = rtn.split("=").join("%3D"); -// rtn = rtn.split("?").join("%3F"); -// rtn = rtn.split("@").join("%40"); -// rtn = rtn.split("_").join("%5F"); -// rtn = rtn.split("~").join("%7E"); -// rtn = rtn.split(" ").join("+"); -// return rtn; -//} - -function isArray(o){ - return o != null && typeof o === "object" && 'pop' in o && 'join' in o; -} - -function scrollbarWidth() { - var $inner = jQuery('<div style="width: 100%; height:200px;">test</div>'), - $outer = jQuery('<div style="width:200px;height:150px; position: absolute; top: 0; left: 0; visibility: hidden; overflow:hidden;"></div>').append($inner), - inner = $inner[0], - outer = $outer[0]; - - jQuery('body').append(outer); - var width1 = inner.offsetWidth; - $outer.css('overflow', 'scroll'); - var width2 = outer.clientWidth; - $outer.remove(); - - return (width1 - width2); -} - -function setButtonDisable(object, status){ - if(!(object.id == 'idGetActive' || object.id == 'Page:mainForm:idDayEdit:idReportDate')) { - object.disabled = status; - } - if(object.id != 'idGetActive' && object.tagName.toLowerCase() == "input" && (object.type.toLowerCase() == "button" || object.type.toLowerCase() == "submit")) { - if(status == true) { - object.style.cursor = "default"; - object.style.backgroundPosition = "0 -90px"; - object.style.borderColor = "#C4C4C4"; - object.style.color = "#909090"; - - } else { - object.style.backgroundPosition = ""; - object.style.color = ""; - object.style.cursor = "pointer"; - object.style.borderColor = "#B5B5B5 #B5B5B5 #7F7F7F"; - } - } -} - -function setButtonsDisable(jObj, status){ - jObj.each(function(index) { - setButtonDisable(this, status); - }); -} - -function number_format_common (number, decimals, dec_point, thousands_sep) { - number = (number + '').replace(/[^0-9+\-Ee.]/g, ''); - var n = !isFinite(+number) ? 0 : +number, - prec = !isFinite(+decimals) ? 0 : Math.abs(decimals), - sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep, - dec = (typeof dec_point === 'undefined') ? '.' : dec_point, - s = '', - toFixedFix = function (n, prec) { - var k = Math.pow(10, prec); - return '' + Math.round(n * k) / k; - }; - // Fix for IE parseFloat(0.55).toFixed(0) = 0; - s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.'); - if (s[0].length > 3) { - s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep); - } - if ((s[1] || '').length < prec) { - s[1] = s[1] || ''; - s[1] += new Array(prec - s[1].length + 1).join('0'); - } - return ( s.join(dec)); -} - -function toNum( input) { - return number_format_common( input, 2, ".", ""); -} - -function toNumComma( input) { - return number_format_common( input, 2, ".", ","); -} - -function localParseFloat( input) { - input += ""; - input = input.split(" "); - if (input.length > 1) { - input = input[1]; - } else { - input = input[0]; - } - input = input.replace(/,/g, ""); - input = input.replace(/ /g, ""); - if ( input == '' || isNaN( input)) { - input = 0.00; - } - input = parseFloat(input); - return input; -} -function localParseInt( input) { - input += ""; - input = input.split(" "); - if (input.length > 1) { - input = input[1]; - } else { - input = input[0]; - } - input = input.replace(/,/g, ""); - input = input.replace(/ /g, ""); - if ( input == '' || isNaN( input)) { - input = 0; - } - input = parseInt(input); - return input; -} - -function SFDCAddRemote(sessionId) { - var binding = new XMLHttpRequest(); - var request = - '<?xml version="1.0" encoding="utf-8"?>' + - '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'+ - '<env:Header>' + - '<urn:SessionHeader xmlns:urn="http://soap.sforce.com/2006/04/metadata">' + - '<urn:sessionId>'+sessionId+'</urn:sessionId>' + - '</urn:SessionHeader>' + - '</env:Header>' + - '<env:Body>' + - '<createMetadata xmlns="http://soap.sforce.com/2006/04/metadata">' + - '<metadata xsi:type="RemoteSiteSetting">' + - '<fullName>SoapApi_'+window.location.hostname.split('.')[1]+'</fullName>' + - '<description>for Metadata API</description>' + - '<disableProtocolSecurity>false</disableProtocolSecurity>' + - '<isActive>true</isActive>' + - '<url>https://' + window.location.hostname + '</url>' + - '</metadata>' + - '</createMetadata>' + - '</env:Body>' + - '</env:Envelope>'; - binding.open('POST', 'https://' + window.location.hostname + '/services/Soap/m/31.0'); - binding.setRequestHeader('SOAPAction','""'); - binding.setRequestHeader('Content-Type', 'text/xml'); - binding.onreadystatechange = - function() { - if(this.readyState==4 && this.status == 200) { - var parser = new DOMParser(); - var doc = parser.parseFromString(this.response, 'application/xml'); - var errors = doc.getElementsByTagName('errors'); - if (errors != null && errors.length > 0) { - var messageText = ''; - for(var errorIdx = 0; errorIdx < errors.length; errorIdx++) - messageText+= errors.item(errorIdx).getElementsByTagName('message').item(0).innerHTML + '\n'; - alert("Error:"+messageText); - } else { - alert("Remote Site Added! Please Refresh!"); - } - } - } - binding.send(request); -} - -//TODO javascript DML 銉°儍銈汇兗銈歌〃绀虹敤銇仺銇撱倣鍏ㄩ儴澶夋洿銇欍倠蹇呰銇屻倞銇俱仚銆傘亾銇撱伅銇傘仯銇︺伨銇� var getConnectDMLErrorMessages = function (results) { var messages = [], i = 0, -- Gitblit v1.9.1