?? laconic.js
字號:
function dispatch(mActionCode, form, actionObject){
if (actionObject) {
if (actionObject.type && actionObject.type == 'button') {
actionObject.disabled = true;
} else {
actionObject.style.display = 'none';
}
}
if (!form)
form = document.forms[0];
form.actionCode.value = mActionCode;
form.method = 'post';
form.submit();
}
function dispatchCallBackWindow(mActionCode, keepOpen){
form = document.forms[0];
form.method = 'post';
form.actionCode.value = mActionCode;
form.target = parent.opener.name;
form.submit();
if (!keepOpen) {
self.close();
}
}
function disableFormElements(form) {
if (!form)
form = document.forms[0];
for (var i = 0; i < form.elements.length ; i++) {
var element = form.elements[i];
if (element.type) {
if (element.type == 'text' || element.type == 'textarea') {
element.readOnly = true;
if (element.className.indexOf("Num") >= 0) {
element.className = 'readOnlyNum';
} else if (element.className.indexOf("Char") >= 0){
element.className = 'readOnlyChar';
} else {
element.className = 'readOnlyOther';
}
} else if (element.type == 'radio' ||element.type == 'checkbox'||element.type == 'select-one') {
element.disabled = true;
}
}
}
}
function hideElements(objects) {
if (objects && objects.length) {
for (var i = 0; i < objects.length; i++) {
objects[i].style.display = "none";
}
} else if (objects) {
objects.style.display = "none";
}
}
function showElements(objects) {
if (objects && objects.length) {
for (var i = 0; i < objects.length; i++) {
objects[i].style.display = "";
}
} else if (objects) {
objects.style.display = "";
}
}
function hideTableColumnCountFromEnd(table, hideColumnFromLast, skipRow) {
for (var i = 0; i < table.rows.length;i++){
if (i != skipRow-1)
table.rows[i].cells[table.rows[i].cells.length-hideColumnFromLast].style.display = "none";
}
}
function hideTableColumnCountFromStart(table, hideColumnFrom, skipRow) {
for (var i = 0; i < table.rows.length;i++){
if (i != skipRow-1)
table.rows[i].cells[hideColumnFrom-1].style.display = "none";
}
}
function toggleQuery(isLoad) {
if (document.all.queryMode.value == 'QUERY' && !isLoad){
document.all.queryMode.value = 'CREATE';
Dispatch('init');
} else if (!isLoad){
document.all.queryMode.value = 'QUERY';
Dispatch('init');
} else if (document.all.queryMode.value == 'QUERY' && isLoad) {
document.all.queryButton.disabled = true;
document.all.queryImg.style.display = '';
document.all.createButton.disabled = false;
} else {
document.all.queryButton.disabled = false;
document.all.queryImg.style.display = 'none';
document.all.createButton.disabled = true;
}
}
function trim(inputString) {
// Removes leading and trailing spaces from the passed string. Also removes
// consecutive spaces and replaces it with one space. If something besides
// a string is passed in (null, custom object, etc.) then return the input.
if (typeof inputString != "string") { return inputString; }
var retValue = inputString;
var ch = retValue.substring(0, 1);
while (ch == " ") { // Check for spaces at the beginning of the string
retValue = retValue.substring(1, retValue.length);
ch = retValue.substring(0, 1);
}
ch = retValue.substring(retValue.length-1, retValue.length);
while (ch == " ") { // Check for spaces at the end of the string
retValue = retValue.substring(0, retValue.length-1);
ch = retValue.substring(retValue.length-1, retValue.length);
}
while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings
}
return retValue; // Return the trimmed string back to the user
} // Ends the "trim" function
function openWindow(findURL, needRefresh, actionCode, rowIndex, subRowIndex, windowWidth, windowHeight) {
if (findURL == '') {
findURL = document.forms[0].action;
}
if (needRefresh){
dispatch('refresh-Data');
}
if (rowIndex && rowIndex != '') {
actionCode = actionCode + '-' + rowIndex;
}
if(subRowIndex != '' && subRowIndex != ''){
actionCode = actionCode + '-'+ subRowIndex;
}
var URL = findURL + '?actionCode='+actionCode;
var findWindow = window.open(URL ,'findWindow',
'scrollbars=yes,width='+windowWidth+',height='+windowHeight+',status=no,resizable=yes,top=100,right=500,dependent=yes,alwaysRaised=yes'
);
findWindow.opener = window;
findWindow.focus();
}
function openWindowTwo(findURL, needRefresh, actionCode, rowIndex, subRowIndex, windowWidth, windowHeight) {
if (findURL == '') {
findURL = document.forms[0].action;
}
if (needRefresh){
dispatch('refresh-Data');
}
if (rowIndex && rowIndex != '') {
actionCode = actionCode + '-' + rowIndex;
}
if(subRowIndex != '' && subRowIndex != ''){
actionCode = actionCode + '-'+ subRowIndex;
}
var URL = findURL + '?actionCode='+actionCode;
var findWindow = window.open(URL ,'findWindowTwo',
'scrollbars=yes,width='+windowWidth+',height='+windowHeight+',status=no,resizable=yes,top=100,right=500,dependent=yes,alwaysRaised=yes'
);
findWindow.opener = window;
findWindow.focus();
}
function filterWindow(findURL, needRefresh, actionCode, rowIndex, subRowIndex, windowWidth, windowHeight, object) {
re = /^[ ]+|[ ]+$/g; //regular expression
str = object.value;
newstr = str.replace(re,"");
if (newstr != '') {
actionCode = actionCode + '-' + newstr;
openWindow(findURL, needRefresh, actionCode, rowIndex, subRowIndex, windowWidth, windowHeight);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -