//闇€寮曞叆jquery cookie 鎻掍欢 function xconfirm(title, content, classname,onconfirm,oncancel) { var modal = $('#modal-confirm') modal.find('.modal-title').text(title) modal.find('.modal-body p').text(content) if (classname != null && classname !=undefined) { modal.addClass(classname) } if (null != oncancel || undefined != oncancel) { //modal.find("#btnModalCancel").attr("onclick",function() {oncancel();}) modal.find("#btnModalCancel").click(function() {oncancel()}) } if (null != onconfirm || undefined != onconfirm) { //modal.find("#btnModalSubmit").attr("onclick",function() {onconfirm();}) modal.find("#btnModalSubmit").click(function() {onconfirm()}) }else { modal.find("#btnModalSubmit").click(function() {modal.modal("hide");}) } modal.modal('show'); } // Explicitly save/update a url parameter using HTML5's replaceState(). function updateQueryStringParam(key, value) { baseUrl = [location.protocol, '//', location.host, location.pathname].join(''); urlQueryString = document.location.search; var newParam = key + '=' + value, params = '?' + newParam; // If the "search" string exists, then build params from it if (urlQueryString) { keyRegex = new RegExp('([\?&])' + key + '[^&]*'); // If param exists already, update it if (urlQueryString.match(keyRegex) !== null) { params = urlQueryString.replace(keyRegex, "$1" + newParam); } else { // Otherwise, add it to end of query string params = urlQueryString + '&' + newParam; } } return baseUrl + params //window.history.replaceState({}, "", baseUrl + params); } function getUrlParameter(sParam) { var sPageURL = window.location.search.substring(1), sURLVariables = sPageURL.split('&'), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split('='); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]); } } return ""; } function appendFormdata(formData, data, name){ if (null == formData) { formData = new FormData() } name = name || ''; if (typeof data === 'object'){ $.each(data, function(index, value){ if (name == ''){ appendFormdata(formData, value, index); } else { appendFormdata(formData, value, name + '['+index+']'); } }) } else { formData.append(name, data); } return formData; } function isString(x) { return Object.prototype.toString.call(x) === "[object String]" } var xcommon = function () { showstr = function (str, replace) { if (str === null || typeof (str) === "undefined") { if (typeof (replace) === 'undefined') { return ""; } else { return replace; } } return str; } showlongstr = function (str, replace) { return '' + showstr(str, replace) + ''; } showenable = function (val) { if (val === 1 || val === "1") { return ''; } else if (val === 0 || val === "0") { return ''; } else if (val === -1 || val === "-1") return ''; else { return ""; } } showyes = function (val) { if (val === 1 || val === "1" || val === true) { return '