From 61694606d640cac824c36ee5bca709b6cc0ecb10 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期六, 21 十一月 2020 16:44:49 +0800 Subject: [PATCH] # --- src/main/webapp/static/js/common.js | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 101 insertions(+), 0 deletions(-) diff --git a/src/main/webapp/static/js/common.js b/src/main/webapp/static/js/common.js index 53a1d93..75edf6a 100644 --- a/src/main/webapp/static/js/common.js +++ b/src/main/webapp/static/js/common.js @@ -157,3 +157,104 @@ return http }) : "object" == typeof module && module.exports ? module.exports = http : n.http = http }(this); + +/** + * 鑾峰彇url閿�煎 + */ +function getUrlVal(key) { + var reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)', 'i'); + var r = window.location.search.substr(1).match(reg); + if (r != null) { + return unescape(r[2]); + } + return null; +} + +function getDateFormat(value){ + var date = new Date();// 鑾峰彇褰撳墠鏃堕棿 + date.setDate(date.getDate() + value);// 璁剧疆澶╂暟 -1 澶� + return date.Format("MM-dd"); +} +/** + * 鏃ユ湡鏍煎紡鍖� + */ +Date.prototype.Format = function (fmt) { + var o = { + "M+": this.getMonth() + 1, //鏈堜唤 + "d+": this.getDate(), //鏃� + "h+": this.getHours(), //灏忔椂 + "m+": this.getMinutes(), //鍒� + "s+": this.getSeconds(), //绉� + "q+": Math.floor((this.getMonth() + 3) / 3), //瀛e害 + "S": this.getMilliseconds() //姣 + }; + if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length)); + for (var k in o) + if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length))); + return fmt; +} + +// 鍏ㄥ睆 ----------------------------------------------------------------------- + +//寮�濮嬪叏灞� +function full() { + var docElm = document.documentElement; + //W3C + if (docElm.requestFullscreen) { + docElm.requestFullscreen(); + } + //FireFox + else if (docElm.mozRequestFullScreen) { + docElm.mozRequestFullScreen(); + } + //Chrome绛� + else if (docElm.webkitRequestFullScreen) { + docElm.webkitRequestFullScreen(); + } + //IE11 + else if (elem.msRequestFullscreen) { + elem.msRequestFullscreen(); + } +} + +//閫�鍑哄叏灞� +function exitFull() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } + else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } + else if (document.webkitCancelFullScreen) { + document.webkitCancelFullScreen(); + } + else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } +} + +//浜嬩欢鐩戝惉 +document.addEventListener("fullscreenchange", function () { + try { + fullscreenState.innerHTML = (document.fullscreen) ? "" : "not "; + } catch (e) {} +}, false); +document.addEventListener("mozfullscreenchange", function () { + fullscreenState.innerHTML = (document.mozFullScreen) ? "" : "not "; +}, false); +document.addEventListener("webkitfullscreenchange", function () { + fullscreenState.innerHTML = (document.webkitIsFullScreen) ? "" : "not "; +}, false); +document.addEventListener("msfullscreenchange", function () { + fullscreenState.innerHTML = (document.msFullscreenElement) ? "" : "not "; +}, false); +document.onkeyup = function (e) { + if (window.event)//濡傛灉window.event瀵硅薄瀛樺湪锛屽氨浠ユ浜嬩欢瀵硅薄涓哄噯 + e = window.event; + var key = e.charCode || e.keyCode; + if (key === 13 || key === 49 || key === 97) { + full(); + } else if (key === 50 || key === 98) { + exitFull(); + } +} -- Gitblit v1.9.1