String.prototype.replaceAll = function(s1, s2) { return this.replace(new RegExp(s1, "gm"), s2); }; function showLoginPassword(){ $('#loginUserPassword').dialog('open'); } function resetFrom(fromId) { document.getElementById(fromId).reset(); } function onlyResetFrom(fromId) { document.getElementById(fromId).reset(); } function closeDialog(formId, dialogId) { resetFrom(formId); $("#" + dialogId).dialog('close'); } function symbolsFilterFileName(keyCode) { // In addition to upper or lower characters and number, only allow "-" & "_" & " "; var IsTitle=/[^0-9a-zA-Z_ -]/g; return IsTitle.test(keyCode); } function symbolsFilter(keyCode) { // In addition to upper or lower characters and number, only allow "-" & "_" & " "; // Add Simplied and Traditional Chinese; var IsTitle=/[^0-9a-zA-Z\u4E00-\u9fa5$~*_ \\/.()-]/g; return IsTitle.test(keyCode); } function limitNumberField(theField, number, type){ theField.val("0"+theField.val()); if(theField.val() == "" || theField.val() == null || (false==parseInt(theField.val())) || theField.val() < 0){ theField.val(type == "cost" ? "0.00" : "0"); }else if(theField.val() > number){ theField.val(type == "cost" ? (Math.round(number*100)/100).toFixed(2) : number); }else{ theField.val(type == "cost" ? (Math.round((parseFloat(theField.val()))*100)/100).toFixed(2) : Math.floor(theField.val())); } } function showErrorMessage(theField, message) { if(theField.find(".error").size() == 0){ theField.append("" + message + ""); }else { theField.find(".error").html(message).show(); } } function showMessage(id, message) { $("#"+id).html(message); $("#"+id).slideDown(); } function hideMessage(id) { $("#"+id).html(""); $("#"+id).slideUp(); } function formatPrice(num) { var result; var negative = false; if(num.indexOf("-") > -1) { negative = true; } num = parseFloat(num.replace("-", "")).toFixed(2) + ""; var l = num.split(".")[0].split("").reverse(), r = num.split(".")[1]; t = ""; for(var i = 0; i < l.length; i ++ ) { t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : ""); } result = t.split("").reverse().join("") + "." + r; return negative? "-" + result: result; } // preview analytics function reLoadGA(Account, theField) { var progressWidth = 0; if(theField != null) { $("#analyticsSearch li").removeClass("active"); theField.addClass("active"); }else{ Account = $("#analyticsSearch li.active input:hidden").val(); } $("#analyticsDashboard").hide(); $("#analyticsContent .progress").show(); $("#analyticsContent .progressTitle").show(); $("body").everyTime('8ds', 'percentage', function () { progressWidth += 25; $("#analyticsContent .progress-bar").css("width", progressWidth + "%"); }, 4); $("#previewContentFrame").css("height", "460px"); $("#previewContentFrame").attr("src", "${pageContext.request.contextPath}/ec/admin/GAInDashboard.action?googleAnalyticsAccountId=" + Account + "&startDateString=" + $("#startDateSj").val() + '&endDateString=' + $("#endDateSj").val()); if(theField != null) { $("#analyticsSearch li").removeClass("active"); theField.addClass("active"); } setTimeout(function() { $("#analyticsContent .progress").hide(); $("#analyticsContent .progressTitle").hide(); $("#analyticsContent .progress-bar").css("width", "0%"); $("#analyticsDashboard").show(); }, 4000); } // page list function function changeEXorCo(theElement){ if($(theElement).find(".glyphicon").attr("class")=='glyphicon glyphicon-folder-open'){ $(theElement).find(".glyphicon").attr("class","glyphicon glyphicon-folder-close"); return false; }else{ $(theElement).find(".glyphicon").attr("class","glyphicon glyphicon-folder-open"); return true; } } function getSameNode(account){ var theElement = $(account).parent().parent(); var showOrNot = changeEXorCo(theElement); var untilParentList = theElement.nextUntil(".parent","div"); if(theElement.attr("class")=='parent' || theElement.attr("class")=='child_bg2'){ hideOrShow(untilParentList,showOrNot); }else if(theElement.attr("class")=='child_bg1' || theElement.attr("class")=='child_bg22'){ var untilSameList1 = $(theElement).nextUntil(".child_bg1","div"); var untilSameList2 = $(theElement).nextUntil(".child_bg2","div"); if(untilParentList.length' + '' + '' + '' + sFileName + ' (' + data["fileSize"] + 'KB)' + '' + ''; document.getElementById('preview').style.display = ""; return false; }