Index: lams_central/web/includes/javascript/common.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/common.js,v diff -u -r1.9 -r1.10 --- lams_central/web/includes/javascript/common.js 21 May 2015 23:39:24 -0000 1.9 +++ lams_central/web/includes/javascript/common.js 12 Oct 2015 21:22:18 -0000 1.10 @@ -1,10 +1,8 @@ - - - var instructionsWindow = null; - /** - * Launches the popup window for the instruction files - */ - function launchInstructionsPopup(url) { +/** + * Launches the popup window for the instruction files + */ +var instructionsWindow = null; +function launchInstructionsPopup(url) { // add the mac test back in when we have the platform detection working. // if(mac){ // window.open(url,'instructions','resizable,width=796,height=570,scrollbars'); @@ -15,98 +13,100 @@ instructionsWindow = window.open(url,'instructions','resizable,width=796,height=570,scrollbars'); instructionsWindow.window.focus(); // } - } +} - function launchPopup(url,title) { - var wd = null; - if(wd && wd.open && !wd.closed){ - wd.close(); - } - wd = window.open(url,title,'resizable,width=796,height=570,scrollbars'); - wd.window.focus(); - } +function launchPopup(url,title) { + var wd = null; + if(wd && wd.open && !wd.closed){ + wd.close(); + } + wd = window.open(url,title,'resizable,width=796,height=570,scrollbars'); + wd.window.focus(); +} - function filterData(src,target){ - if(src.value != null){ - //replace specified string for characters that are sensitive to HTML interpreters - var srcV = src.value; - //must replace & first, otherwise, this will conflict with others. - srcV = srcV.replace(/&/g,"&"); - srcV = srcV.replace(//g,">"); - srcV = srcV.replace(/"/g,"""); - srcV = srcV.replace(/\\/g,"'"); - target.value = srcV; - //for windows system - if(src.value.indexOf("\r\n") != -1) - target.value=srcV.replace(/\r\n/g,"
"); - //for *nix system - else if(src.value.indexOf("\n") != -1) - target.value=srcV.replace(/\n/g,"
"); - +function filterData(src,target){ + if(src.value != null) { + //replace specified string for characters that are sensitive to HTML interpreters + var srcV = src.value; + //must replace & first, otherwise, this will conflict with others. + srcV = srcV.replace(/&/g,"&"); + srcV = srcV.replace(//g,">"); + srcV = srcV.replace(/"/g,"""); + srcV = srcV.replace(/\\/g,"'"); + target.value = srcV; + //for windows system + if (src.value.indexOf("\r\n") != -1) { + target.value=srcV.replace(/\r\n/g,"
"); + //for *nix system + } else if (src.value.indexOf("\n") != -1) { + target.value=srcV.replace(/\n/g,"
"); } } - function trimAll( strValue ) { - var replaceExpr = /^(\s*)$/; +} +function trimAll( strValue ) { + var replaceExpr = /^(\s*)$/; - //check for all spaces - if(replaceExpr.test(strValue)) { - strValue = strValue.replace(replaceExpr, ''); - if( strValue.length == 0) - return strValue; - } + //check for all spaces + if(replaceExpr.test(strValue)) { + strValue = strValue.replace(replaceExpr, ''); + if( strValue.length == 0) { + return strValue; + } + } - //check for leading & trailing spaces - replaceExpr = /^(\s*)([\W\w]*)(\b\s*$)/; - if(replaceExpr.test(strValue)) { - //remove leading and trailing whitespace characters - strValue = strValue.replace(replaceExpr, '$2'); - } - return strValue; - } + //check for leading & trailing spaces + replaceExpr = /^(\s*)([\W\w]*)(\b\s*$)/; + if(replaceExpr.test(strValue)) { + //remove leading and trailing whitespace characters + strValue = strValue.replace(replaceExpr, '$2'); + } + + return strValue; +} - function isEmpty( strValue ) { +function isEmpty( strValue ) { - var strTemp = strValue; - strTemp = trimAll(strTemp); - if(strTemp.length > 0){ - return false; - } - return true; - } + var strTemp = strValue; + strTemp = trimAll(strTemp); + if (strTemp.length > 0) { + return false; + } + return true; +} - // refresh the parent window if the parent window is a tool monitoring window - function refreshParentMonitoringWindow() { - if ( window.opener && ! window.opener.closed && window.opener.name.indexOf("MonitorActivity") >= 0 ) { - var monitoringURL = String(window.opener.location); - var currentTab = window.opener.selectedTabID; - if ( currentTab ) { - var indexStart = monitoringURL.indexOf("¤tTab="); - if ( indexStart != -1 ) { - var indexEnd = monitoringURL.indexOf("&",indexStart+1); - if ( indexEnd == -1 ) { - monitoringURL = monitoringURL.substring(0,indexStart); - } else { - monitoringURL = monitoringURL.substring(0,indexStart)+monitoringURL.substring(indexEnd); - } +// refresh the parent window if the parent window is a tool monitoring window +function refreshParentMonitoringWindow() { + if ( window.opener && ! window.opener.closed && window.opener.name.indexOf("MonitorActivity") >= 0 ) { + var monitoringURL = String(window.opener.location); + var currentTab = window.opener.selectedTabID; + if ( currentTab ) { + var indexStart = monitoringURL.indexOf("¤tTab="); + if ( indexStart != -1 ) { + var indexEnd = monitoringURL.indexOf("&",indexStart+1); + if ( indexEnd == -1 ) { + monitoringURL = monitoringURL.substring(0,indexStart); + } else { + monitoringURL = monitoringURL.substring(0,indexStart)+monitoringURL.substring(indexEnd); } - monitoringURL = monitoringURL+"¤tTab="+currentTab; } - window.opener.location.href = monitoringURL; + monitoringURL = monitoringURL+"¤tTab="+currentTab; } + window.opener.location.href = monitoringURL; } +} - //does Ajax call (pure JavaScript without relying on frameworks) - function doAjaxCall(url) { - var xmlhttp; - if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari - xmlhttp = new XMLHttpRequest(); - } else {// code for IE6, IE5 - xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); - } - xmlhttp.open("POST", url, false); - xmlhttp.send(); - } +//does Ajax call (pure JavaScript without relying on frameworks) +function doAjaxCall(url) { + var xmlhttp; + if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari + xmlhttp = new XMLHttpRequest(); + } else {// code for IE6, IE5 + xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); + } + xmlhttp.open("POST", url, false); + xmlhttp.send(); +} function getNumberOfWords(value, isRemoveHtmlTags) {