How to use gB method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

calendar.js

Source:calendar.js Github

copy

Full Screen

1var Sunday = "星期日";2var Monday = "星期一";3var Tuesday = "星期二";4var Wednesday = "星期三";5var Thursday = "星期四";6var Friday = "星期五";7var Saturday = "星期六";8var Sun = "日";9var Mon = "一";10var Tue = "二";11var Wed = "三";12var Thu = "四";13var Fri = "五";14var Sat = "六";15var January = "一月";16var February = "二月";17var March = "三月";18var April = "四月";19var May = "五月";20var June = "六月";21var July = "七月";22var Aguest = "八月";23var September = "九月";24var October = "十月";25var November = "十一月";26var December = "十二月";27var Jan = "一月";28var Feb = "二月";29var Mar = "三月";30var Apr = "四月";31var Jun = "六月";32var Jul = "七月";33var Agu = "八月";34var Sep = "九月";35var Oct = "十月";36var Nov = "十一月";37var Dec = "十二月";38var calendar_help = "帮助";39var calendar_about1 = "选择日期:\r\n- 点击 \xab, \xbb 按钮选择年份\r\n- 点击 ";40var calendar_about2 = " 按钮选择月份\r\n- 长按以上按钮可从菜单中快速选择年份或月份";41var calendar_about_time = "\r\n\r\n选择时间:\r\n- 点击小时或分钟可使改数值加一\r\n- 按住Shift键点击小时或分钟可使改数值减一\r\n- 点击拖动鼠标可进行快速选择";42var prev_year = "上一年 (按住出菜单)";43var prev_month = "上一月 (按住出菜单)";44var go_today = "转到今日";45var next_month = "下一月 (按住出菜单)";46var next_year = "下一年 (按住出菜单)";47var sel_date = "选择日期";48var drag_to_move = "拖动";49var part_today = "(今日)";50var day_first = "最左边显示";51var calendar_close = "关闭";52var calendar_today = "今日";53var time_part = "(Shift-)点击鼠标或拖动改变值";54var calendar_wk = "周";55var calendar_day = "日";56var calendar_time = "时间";57!58function(a) {59 "function" == typeof define ? define("xvDate", [], function(b, c, d) {60 var e = {};61 a(e), d.exports = e.xvDate62 }) : a(window)63}(function(a) {64 var b = {};65 a.xvDate = function(a) {66 var c = a.triggerId || a.targetId;67 if ("object" == typeof c && c.length) for (var d = [], e = 0; e < c.length; e++) d.push(b.getId(c[e])), b.enable(d[e], d, a);68 else d = b.getId(c), b.enable(d, d, a)69 }, b.fn = b.prototype = {70 init: function(a) {71 var b = !1;72 this.creatView(a), this.initTimes(b)73 },74 gb: {},75 creatView: function(a) {76 var c, d = a || {},77 e = this,78 f = d.targetId || "dates",79 g = b.getId(f);80 if (e.gb.algin = d.alignId ? b.getId(d.alignId) : g, e.gb.format = d.format || "-", e.gb.hms = "off" === d.hms ? null : !0, e.gb.zIndex = d.zIndex || 9999,e.gb.position = d.position || 'position', e.gb.trigger = d.trigger, e.limitTime(d.min, "minTime"), e.limitTime(d.max, "maxTime"), e.gb.datesBox) e.gb.target === g || e.ishd(e.gb.datesBox) ? e.shde(e.gb.datesBox) : (b.removeEvent(document, "click", e.docArea), e.shde(e.gb.datesBox, 2)), e.gb.target = g, e.setPosition(e.gb.algin, e.gb.datesBox, {81 left: 0,82 top: 083 }), e.setPosition(e.gb.algin, e.gb.datesBox), c = {84 that: e85 }, b.removeEvent(document, "click", e.docArea), b.addEvent(document, "click", e.docArea, c), e.gb.datesBox.style.zIndex = e.gb.zIndex;86 else {87 var h = e.gb.datesBox = e.creatEle("div");88 e.gb.datesBox.id = "xv_Dates_box", e.gb.target = g, e.gb.datesBox.className = "dates_box", e.gb.datesBox.style.display = "block", e.gb.datesBox.style.zIndex = e.gb.zIndex,e.gb.datesBox.style.position = e.gb.position, e.append(e.gb.datesBox), h.innerHTML = "<div class='dates_box_top'><div class='dates_yy dates_choose'><span class='prev_choose choose_btn' id='xv_Yy_prev'><i class='sign'></i></span><span class='ipt_wrap' id='xv_Year_wrap'><input class='dlt_status' style='width:32px;margin-left:4px;' id='xv_Ipt_year' type='text'><small>年</small><i class='sign'></i></span><span class='next_choose choose_btn' id='xv_Yy_next'><i class='sign'></i></span><div class='dates_yy_list' id='xv_Dates_yy_list' style='display:none'>" +89 function() {90 for (var a = "", b = 1970; 2100 > b; b++) a += "<span dateValue = " + b + ">" + b + "</span>";91 return a92 }() + "</div></div><div class='dates_mm dates_choose'><span class='prev_choose choose_btn' id='xv_Mm_prev'><i class='sign'></i></span><span class='ipt_wrap' id='xv_Moth_wrap'><input class='dlt_status' style='width:16px;margin-left:10px;' id='xv_Ipt_month' type='text'><small>月</small><i class='sign'></i></span><span class='next_choose choose_btn' id='xv_Mm_next'><i class='sign'></i></span><div class='dates_mm_list' id='xv_Dates_mm_list' style='display:none'>" +93 function() {94 for (var a = "", b = 1; 13 > b; b++) a += 10 > b ? "<span dateValue =" + b + ">0" + b + "月</span>" : "<span dateValue =" + b + ">" + b + "月</span>";95 return a96 }() + "</div></div></div>" + this.viewTb() + "<div class='dates_bottom'><ul id='dates_hms' class='dates_hms' style='display:block' ><li class='time_tag'>时间</li><li><input type='text' id='xv_Hours' class='dlt_status'><span>:</span></li><li><input type='text' id='xv_Minutes' class='dlt_status'><span>:</span></li><li><input type='text' id='xv_Seconds' class='dlt_status'><span>&nbsp;</span></li></ul><div class='dates_btn'><a id='xv_Dates_clear'>清空</a><a id='xv_Dates_today'>今天</a><a id='xv_Dates_ok'>确认</a></div></div>", e.handleTime(), e.gb.datesHms = b.getId("dates_hms"), e.setPosition(e.gb.algin, e.gb.datesBox, {97 left: 0,98 top: 099 }), e.setPosition(e.gb.algin, e.gb.datesBox), c = {100 that: e101 }, b.addEvent(document, "click", e.docArea, c)102 }103 var i = this.gb.datesHms;104 i ? this.shde(i, 2) : this.shde(i, 1);105 var j = d.triggerId || d.targetId;106 if ("object" == typeof j && j.length) {107 e.gb.trigger = [];108 for (var k = 0; k < j.length; k++) e.gb.trigger.push(b.getId(j[k]))109 } else e.gb.trigger = b.getId(j)110 },111 docArea: function(a) {112 var b = a.srcElement || a.target,113 c = a.datas.that,114 d = !c.ishd(c.gb.datesBox) && !c.contain(c.gb.datesBox, b) && b !== c.gb.target && !c.isExistObj(c.gb.trigger, b);115 d && c.shde(c.gb.datesBox, 1)116 },117 limitTime: function(a, b) {118 var c = this.checkTime(a);119 c ? this.gb[b] = this.datesSplit(c) : this.gb[b] = null120 },121 datesSplit: function(a) {122 return a ? (datesTimeArr = a.split(" "), datesArr = datesTimeArr[0].split(/[-\/]/), timesArr = this.gb.hms && datesTimeArr[1] ? datesTimeArr[1].split(":") : null, {123 year: datesArr[0],124 month: datesArr[1],125 date: datesArr[2],126 hours: timesArr ? timesArr[0] : 0,127 minutes: timesArr ? timesArr[1] : 0,128 seconds: timesArr ? timesArr[2] : 0129 }) : a130 },131 handleTime: function() {132 var a = this;133 a.gb.td = b.getId("dates_table").getElementsByTagName("td");134 for (var c = a.gb.els = {135 yearWrap: b.getId("xv_Year_wrap"),136 monthWrap: b.getId("xv_Moth_wrap"),137 yyList: b.getId("xv_Dates_yy_list"),138 mmList: b.getId("xv_Dates_mm_list"),139 yyConList: b.getId("xv_Dates_yy_list").getElementsByTagName("span"),140 mmConList: b.getId("xv_Dates_mm_list").getElementsByTagName("span"),141 yyPrev: b.getId("xv_Yy_prev"),142 yyNext: b.getId("xv_Yy_next"),143 mmPrev: b.getId("xv_Mm_prev"),144 mmNext: b.getId("xv_Mm_next"),145 datesClear: b.getId("xv_Dates_clear"),146 datesToday: b.getId("xv_Dates_today"),147 datesOk: b.getId("xv_Dates_ok"),148 iptYear: b.getId("xv_Ipt_year"),149 iptMonth: b.getId("xv_Ipt_month"),150 iptHours: b.getId("xv_Hours"),151 iptMinutes: b.getId("xv_Minutes"),152 iptSeconds: b.getId("xv_Seconds")153 }, d = [c.iptYear, c.iptMonth, c.iptHours, c.iptMinutes, c.iptSeconds], e = 0; e < d.length; e++) b.addEvent(d[e], "click", a.focusStatus);154 b.addEvent(c.iptYear, "blur", function() {155 var b = "^((19[0-9]{2})|(2[0-9]{3}))$",156 c = this,157 d = a.checkFocus(b, c, a.gb.time.year);158 d && (a.gb.time.year = d, a.insertDate())159 }), b.addEvent(c.iptMonth, "blur", function() {160 var b = "^((0[1-9])|(1[0-2])|[1-9])$",161 c = this,162 d = a.checkFocus(b, c, a.formatTime(a.gb.time.month));163 d && (a.gb.time.month = d, a.insertDate())164 }), b.addEvent(c.iptHours, "blur", function() {165 var b = "^(([0-1][0-9])|(2[0-3])|[0-9])$",166 c = this;167 a.gb.time.hours = a.checkFocus(b, c, "00")168 }), b.addEvent(c.iptMinutes, "blur", function() {169 var b = "^(([0-5][0-9])|[0-9])$",170 c = this;171 a.gb.time.minutes = a.checkFocus(b, c, "00")172 }), b.addEvent(c.iptSeconds, "blur", function() {173 var b = "^(([0-5][0-9])|[0-9])$",174 c = this;175 a.gb.time.seconds = a.checkFocus(b, c, "00")176 }), b.addEvent(c.datesClear, "click", function() {177 a.gb.target.value = ""178 }), b.addEvent(c.datesOk, "click", function() {179 var b = a.gb.hms ? "hms" : "ymd",180 c = a.gb.time;181 a.compareTime(c.year, c.month, c.date, b) && a.getOkTime()182 }), b.addEvent(c.datesToday, "click", function() {183 var b = !0;184 a.initTimes(b)185 }), b.addEvent(c.yearWrap, "click", a.yearLst, {186 els: c,187 that: a188 }), b.addEvent(a.gb.datesBox, "click", a.ymLst, {189 els: c,190 that: a191 }), a.ymClick(c.yyConList, c.yyList, "year"), a.ymClick(c.mmConList, c.mmList, "month"), b.addEvent(c.monthWrap, "click", function() {192 "none" === c.mmList.style.display ? document.activeElement !== c.iptMonth && (c.mmList.style.display = "block") : c.mmList.style.display = "none"193 });194 var f = {195 mmPrev: [-1, "month"],196 mmNext: [1, "month"],197 yyPrev: [-1, "year"],198 yyNext: [1, "year"]199 };200 for (e in f) b.addEvent(c[e], "click", a.datesBtn, {201 that: a,202 direction: f[e][0],203 type: f[e][1]204 });205 for (e = 0; e < a.gb.td.length; e++) b.addEvent(a.gb.td[e], "click", a.getDate, {206 that: a207 })208 },209 getDate: function(a) {210 var b, c = this.innerHTML,211 d = a.datas.that,212 e = parseInt(this.getAttribute("m"), 10);213 b = 1 === d.gb.time.month && 12 === e ? d.gb.time.year - 1 : 12 === d.gb.time.month && 1 === e ? d.gb.time.year + 1 : d.gb.time.year, d.compareTime(b, e, c) && (d.gb.time.year = b, d.gb.time.month = e, d.gb.time.date = c, d.insertDate(), d.getOkTime())214 },215 yearLst: function(a) {216 var b = a.datas.els,217 c = a.datas.that;218 if ("none" === b.yyList.style.display) {219 if (document.activeElement !== b.iptYear) {220 b.yyList.style.display = "block";221 for (var d = 0; d < b.yyConList.length; d++) if (b.yyConList[d].getAttribute("dateValue") === c.gb.time.year) {222 var e = b.yyConList[d].offsetTop;223 e > 170 && (b.yyList.scrollTop = e)224 }225 }226 } else b.yyList.style.display = "none"227 },228 ymLst: function(a) {229 var b = a.srcElement || a.target,230 c = a.datas.els,231 d = a.datas.that;232 d.contain(c.yearWrap, b) || d.ishd(c.yyList) || (c.yyList.style.display = "none"), d.contain(c.monthWrap, b) || d.ishd(c.mmList) || (c.mmList.style.display = "none")233 },234 focusStatus: function() {235 this.focus && (this.select(), this.className = "")236 },237 combineTime: function(a, b) {238 var c;239 if (!a) return !1;240 var d = a.year.toString(),241 e = this.formatTime(a.month.toString()),242 f = this.formatTime(a.date.toString()),243 g = this.formatTime(a.hours.toString()),244 h = this.formatTime(a.minutes.toString()),245 i = this.formatTime(a.seconds.toString());246 switch (b) {247 case "hms":248 c = d + e + f + g + h + i;249 break;250 case "ymd":251 c = d + e + f;252 break;253 case "ym":254 c = d + e;255 break;256 case "y":257 c = d;258 break;259 default:260 c = d + e + f261 }262 return parseInt(c, 10)263 },264 compareTime: function(a, b, c, d) {265 var e = this,266 f = e.gb.time,267 g = e.combineTime({268 year: a,269 month: b,270 date: c,271 hours: f.hours,272 minutes: f.seconds,273 seconds: f.minutes274 }, d),275 h = e.combineTime(e.gb.minTime, d) || "",276 i = e.combineTime(e.gb.maxTime, d) || "";277 return h && !i ? h > g ? null : !0 : !h && i ? g > i ? null : !0 : h && i && (g > i || h > g) ? null : !0278 },279 initTimes: function(a) {280 var b, c, d, e, f, g, h, i, j = this.gb.target,281 k = this.checkTime(j.value);282 k && (k = this.datesSplit(k)), a ? (i = new Date, b = i.getDate(), c = i.getFullYear(), d = i.getMonth() + 1, e = i.getHours(), f = i.getMinutes(), g = i.getSeconds()) : !a && k ? (b = k.date, c = k.year, d = k.month, e = k.hours, f = k.minutes, g = k.seconds) : a || this.gb.minTime || this.gb.maxTime || k ? k || !this.gb.minTime && !this.gb.maxTime || (h = this.gb.minTime || this.gb.maxTime, b = h.date, c = h.year, d = h.month, e = h.hours, f = h.minutes, g = h.seconds) : (i = new Date, b = i.getDate(), c = i.getFullYear(), d = i.getMonth() + 1, e = 0, f = 0, g = 0), this.gb.time = {283 year: c,284 month: d,285 date: b,286 hours: e,287 minutes: f,288 seconds: g289 }, this.insertDate()290 },291 viewTb: function() {292 var a = ["日", "一", "二", "三", "四", "五", "六"],293 b = [],294 c = 0,295 d = this.creatEle("table"),296 e = this.creatEle("thead"),297 f = this.creatEle("tbody");298 d.className = "dates_table", d.id = "dates_table";299 for (var g = 1; 8 > g; g++) {300 var h = this.creatEle("th");301 this.append(h, e), h.innerHTML = a[g - 1]302 }303 for (g = 1; 7 > g; g++) {304 b[g] = this.creatEle("tr"), this.append(b[g], f);305 for (var i = 1; 8 > i; i++) {306 var j = this.creatEle("td");307 j.setAttribute("index", c++), this.append(j, b[g])308 }309 }310 return this.append(e, d), this.append(f, d), d.outerHTML311 },312 insertDate: function() {313 var a, b, c = this.gb.els,314 d = this.gb.time,315 e = c.yyConList,316 f = c.mmConList,317 g = c.iptYear,318 h = c.iptMonth,319 i = c.iptHours,320 j = c.iptMinutes,321 k = c.iptSeconds,322 l = d.year,323 m = parseInt(d.month, 10),324 n = d.date,325 o = d.hours,326 p = d.minutes,327 q = d.seconds,328 r = this.gb.td,329 s = new Date;330 s.setFullYear(l, m - 1), s.setDate(1);331 var t = s.getDay(),332 u = this.getDays(l, m - 1);333 this.dateStatus(f, m, "current"), this.dateStatus(e, l, "current");334 for (var v = 0; u > v; v++) r[t + v].innerHTML = v + 1, r[t + v].className = "", v + 1 === n ? r[t + v].className = "current_day" : n > u && (r[t + u - 1].className = "current_day", this.gb.time.date = u), r[t + v].setAttribute("m", m), r[t + v].setAttribute("y", l);335 for (v = 0; t > v; v++) r[t - v - 1].className = "other_day", r[t - v - 1].innerHTML = this.getDays(l, m - 2) - v, m - 1 > 0 ? (a = m - 1, b = l) : (a = 12, b = l - 1), r[t - v - 1].setAttribute("m", a), r[t - v - 1].setAttribute("y", b);336 for (v = 0; v < r.length - t - u; v++) r[t + u + v].className = "other_day", r[t + u + v].innerHTML = v + 1, m + 1 > 12 ? (a = 1, b = l + 1) : (a = m + 1, b = l), r[t + u + v].setAttribute("m", a), r[t + u + v].setAttribute("y", b);337 var w = this.combineTime(this.gb.minTime) || "",338 x = this.combineTime(this.gb.maxTime) || "",339 y = {340 year: l,341 month: m,342 date: n,343 hours: this.gb.time.hours,344 minutes: this.gb.time.minutes,345 seconds: q346 };347 if (w) {348 for (v = 0; v < r.length; v++) y.year = r[v].getAttribute("y"), y.date = r[v].innerHTML, y.month = r[v].getAttribute("m"), this.combineTime(y) < w && (r[v].className = "disable_day");349 for (v = 0; v < e.length; v++) e[v].getAttribute("dateValue") < this.gb.minTime.year && (e[v].className = "disable_day");350 for (v = 0; v < f.length; v++) d.year + this.formatTime(f[v].getAttribute("dateValue")) < this.combineTime(this.gb.minTime, "ym") && (f[v].className = "disable_day")351 }352 if (x) {353 for (v = 0; v < r.length; v++) y.year = r[v].getAttribute("y"), y.date = r[v].innerHTML, y.month = r[v].getAttribute("m"), this.combineTime(y) > x && (r[v].className = "disable_day");354 for (v = 0; v < e.length; v++) e[v].getAttribute("dateValue") > this.gb.maxTime.year && (e[v].className = "disable_day");355 for (v = 0; v < f.length; v++) d.year + this.formatTime(f[v].getAttribute("dateValue")) > this.combineTime(this.gb.maxTime, "ym") && (f[v].className = "disable_day")356 }357 g.value = l, h.value = this.formatTime(m), i.value = this.formatTime(o), j.value = this.formatTime(p), k.value = this.formatTime(q)358 },359 ymClick: function(a, b, c) {360 function d() {361 "month" === c ? (f = this.getAttribute("dateValue"), e = h.gb.time.year, g = h.gb.time.date) : "year" === c && (e = this.getAttribute("dateValue"), f = h.gb.time.month, g = h.gb.time.date), h.compareTime(e, f, g) && (h.gb.time.year = e, h.gb.time.month = f, h.gb.time.date = g, h.removeStatus(a), this.className = "current", b.style.display = "none", h.insertDate())362 }363 for (var e, f, g, h = this, i = 0; i < a.length; i++) a[i].onclick = d364 },365 ishd: function(a) {366 return "none" === a.style.display ? !0 : null367 },368 shde: function(a, b) {369 b ? 1 === b ? a.style.display = "none" : 2 === b && (a.style.display = "block") : a.style.display = "block" === a.style.display ? "none" : "block"370 },371 isExistObj: function(a, b) {372 if ("object" == typeof a && a.length) {373 for (var c = 0; c < a.length; c++) if (a[c] === b) return !0374 } else if (a === b) return !0;375 return !1376 },377 checkFocus: function(a, b, c, d) {378 b.className = "dlt_status";379 var e = b.value,380 f = new RegExp(a);381 return f.test(e) ? (this.gb.time[d] = this.formatTime(e), b.value = this.gb.time[d]) : b.value = c, b.value382 },383 datesBtn: function(a) {384 var b = a.datas.that,385 c = b.gb.time.year,386 d = b.gb.time.month,387 e = parseInt(c, 10),388 f = parseInt(d, 10),389 g = b.gb.time.date,390 h = a.datas.type,391 i = a.datas.direction;392 if ("month" === h) {393 1 === f && 0 > i ? (d = 12, c = e + i) : 12 === f && i > 0 ? (d = 1, c = e + 1) : d = f + i;394 var j = b.getDays(c, d - 1);395 g > j && (g = j)396 } else "year" === h && (c = e + i);397 b.gb.time.year = c, b.gb.time.month = d, b.gb.time.date = g, b.insertDate()398 },399 removeStatus: function(a) {400 for (var b = 0; b < a.length; b++) a[b].className = ""401 },402 dateStatus: function(a, b, c) {403 for (var d = 0; d < a.length; d++) a[d].className = "", a[d].getAttribute("dateValue") === b && (a[d].className = c)404 },405 getOkTime: function() {406 var a, b, c = {},407 d = this.gb.format;408 for (var e in this.gb.time) c[e] = this.formatTime(this.gb.time[e]);409 b = " " + c.hours + ":" + c.minutes + ":" + c.seconds, a = this.gb.hms ? b : "", this.gb.target.value = c.year + d + c.month + d + c.date + a, this.shde(this.gb.datesBox)410 },411 checkTime: function(a) {412 var b = "[-/]",413 c = this.gb.hms ? "(\\s){1}((0?[0-9])|(1[0-9])|(2[0-3])):([0-5][0-9]):([0-5][0-9])" : "",414 d = a ? a.replace(/^(\s*)|(\s*)$/g, "").replace(/(\s)+/g, " ") : "",415 e = new RegExp("^((19[0-9]{2})|(2[0-9]{3}))" + b + "((0?[1-9])|(1[0-2]))" + b + "((0?[1-9])|(1[0-9])|(2[0-9])|(3[0-1]))" + c + "$");416 return e.test(d) ? d : !1417 },418 formatTime: function(a) {419 return /^(\d){1}$/.test(a) ? "0" + a : a420 },421 getDays: function(a, b) {422 var c;423 0 > b ? (b = 11, a -= 1) : b > 11 && (b = 0, a += 1), b + 1 === 2 && (c = a % 4 === 0 && a % 100 !== 0 || a % 400 === 0 ? 29 : 28);424 var d = [31, c, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];425 return d[b]426 },427 creatEle: function(a, b) {428 var c = b || document;429 return c.createElement(a)430 },431 append: function(a, b) {432 var c = b || document.body;433 return c.appendChild(a)434 },435 setPosition: function(a, b, c) {436 if (c && "object" == typeof c) return b.style.left = 0, b.style.top = 0, !1;437 var d = this.getOffset(a),438 e = d.left,439 f = d.top,440 g = b.offsetHeight,441 h = a.offsetHeight,442 i = this.resetSizeAttr("scrollTop"),443 j = this.resetSizeAttr("offsetHeight"),444 k = f - i;445 j - k > g ? b.style.top = f + h - 1 + "px" : b.style.top = f - g + 1 + "px", b.style.left = e + "px"446 },447 resetSizeAttr: function(a, b) {448 var c = b || document.body;449 return c[a] || document.documentElement && document.documentElement[a]450 },451 getOffset: function(a, b) {452 var c = b || {453 left: 0,454 top: 0455 };456 return a && (c.left += a.offsetLeft, c.top += a.offsetTop, a.offsetParent && (a = a.offsetParent, arguments.callee(a, c))), c457 },458 contain: function(a, b) {459 return document.all ? a.contains(b) : 20 === a.compareDocumentPosition(b) || a === b ? !0 : null460 }461 }, b.enable = function(c, d, e) {462 b.addEvent(c, "click", function() {463 a.xvDate.Dates ? a.xvDate.Dates.init(e, d) : a.xvDate.Dates = new b.fn.init(e, d)464 })465 }, b.getId = function(a, b) {466 var c = b ? b : document;467 return c.getElementById(a)468 }, b.addEvent = function(a, b, c, d) {469 a["evt" + b + c] = a["evt" + b + c] || null, a["evt" + b + c] || (a["evt" + b + c] = function(b) {470 b = b || window.event, b.datas = d || {}, c.call(a, b)471 }), a.addEventListener ? a.addEventListener(b, a["evt" + b + c], !1) : a.attachEvent && a.attachEvent("on" + b, a["evt" + b + c])472 }, b.removeEvent = function(a, b, c) {473 "undefined" != typeof a.removeEventListener ? a.removeEventListener(b, a["evt" + b + c], !1) : "undefined" != typeof a.detachEvent && c && a["evt" + b + c] && a.detachEvent("on" + b, a["evt" + b + c])474 }, b.fn.init.prototype = b.fn...

Full Screen

Full Screen

popupTest.js

Source:popupTest.js Github

copy

Full Screen

1describe('Test popup', function() {2 const position = Jodit.modules.Helpers.position;3 let textBox;4 const elms = [];5 beforeEach(function() {6 textBox = document.createElement('div');7 Object.assign(textBox.style, {8 position: 'fixed',9 display: 'flex',10 flexWrap: 'wrap',11 top: 0,12 left: 0,13 width: '100%',14 height: '100%',15 background: 'red'16 });17 document.body.appendChild(textBox);18 for (let i = 0; i < 4; i += 1) {19 for (let j = 0; j < 4; j += 1) {20 const elmBox = document.createElement('div');21 Object.assign(elmBox.style, {22 width: '25%',23 height: '25%',24 background:25 'rgb(' +26 (i * 30 + 128) +27 ',' +28 (j * 30 + 28) +29 ', ' +30 (i * 10 + j * 10 + 100) +31 ')'32 });33 textBox.appendChild(elmBox);34 elms.push(elmBox);35 }36 }37 });38 afterEach(function() {39 textBox && textBox.remove();40 elms.length = 0;41 });42 const aliases = {43 leftTop: function () { return elms[0]},44 rightTop: function () { return elms[3]},45 leftBottom: function () { return elms[12]},46 rightBottom: function () { return elms[15]},47 center: function () { return elms[5]},48 }49 const openPopup = function(getBound, content, strategy) {50 const editor = getJodit();51 const popup = new Jodit.modules.Popup(editor);52 if (strategy) {53 popup.strategy = strategy;54 }55 popup.setContent(content || 'Test content').open(getBound);56 return {57 left: parseInt(popup.container.style.left, 10),58 top: parseInt(popup.container.style.top, 10),59 width: popup.container.offsetWidth,60 height: popup.container.offsetHeight61 };62 };63 describe('Open popup on some target', function() {64 describe('Usual case - there is enough space under element', function() {65 it('should show popup under element', function() {66 const div = appendTestDiv();67 div.innerText = 'test';68 const gb = function() {69 return position(div);70 };71 const pos = openPopup(gb);72 expect(pos.left).equals(gb().left);73 expect(pos.top).equals(gb().top + gb().height);74 });75 });76 describe('Corners', function() {77 describe('Change default strategy', function() {78 it('should show popup to match the strategy', function() {79 const gb = function() {80 return position(aliases.center());81 };82 const pos = openPopup(gb, false, 'rightBottom');83 expect(pos.left + pos.width).equals(gb().left + gb().width);84 expect(pos.top).equals(gb().top + gb().height);85 });86 });87 describe('Left-Top', function() {88 it('should show popup under element', function() {89 const gb = function() {90 return position(aliases.leftTop());91 };92 const pos = openPopup(gb);93 expect(pos.left).equals(gb().left);94 expect(pos.top).equals(gb().top + gb().height);95 });96 });97 describe('Right-Top', function() {98 describe('Small popup', function() {99 it('should show popup under element', function() {100 const gb = function() {101 return position(aliases.rightTop());102 };103 const pos = openPopup(gb);104 expect(pos.left).equals(gb().left);105 expect(pos.top).equals(106 gb().top + gb().height107 );108 });109 });110 describe('Big popup', function() {111 it("should show popup under element but right corner should be under target's right-bottom corner", function() {112 const gb = function() {113 return position(aliases.rightTop());114 };115 const pos = openPopup(gb, 'testO'.repeat(30));116 expect(pos.left + pos.width).equals(117 gb().left + gb().width118 );119 expect(pos.top).equals(gb().top + gb().height);120 });121 });122 });123 describe('Left-Bottom', function() {124 describe('Small popup', function() {125 it('should show popup above element', function() {126 const gb = function() {127 return position(aliases.leftBottom());128 };129 const pos = openPopup(gb);130 expect(pos.left).equals(gb().left);131 expect(pos.top + pos.height).equals(gb().top);132 });133 });134 });135 describe('Right-Bottom', function() {136 describe('Small popup', function() {137 it('should show popup above element', function() {138 const gb = function() {139 return position(aliases.rightBottom());140 };141 const pos = openPopup(gb);142 expect(pos.left).equals(gb().left);143 expect(pos.top + pos.height).equals(gb().top);144 });145 });146 describe('Big popup', function() {147 it("should show popup above the element but right corner should be above target's right-top corner", function() {148 const gb = function() {149 return position(aliases.rightBottom());150 };151 const pos = openPopup(gb, 'testO'.repeat(30));152 expect(pos.left + pos.width).equals(153 gb().left + gb().width154 );155 expect(pos.top + pos.height).equals(gb().top);156 });157 });158 });159 });160 });...

Full Screen

Full Screen

greybox.js

Source:greybox.js Github

copy

Full Screen

1/****2Last Modified: Sun 26 Feb 2006 09:24:10 PM CET3 GreyBox - The pop-up window thingie4 Copyright Amir Salihefendic 20065 AUTHOR6 4mir Salihefendic (http://amix.dk) - amix@amix.dk7 VERSION8 1.629 LICENSE10 LGPL (read more in LGPL.txt)11 SITE12 http://amix.dk/greybox13****/14var GB_HEADER = null;15var GB_WINDOW = null;16var GB_IFRAME = null;17var GB_OVERLAY = null;18var GB_TIMEOUT = null;19var GB_HEIGHT = 400;20var GB_WIDTH = 400;21var GB_caption = null;22//The url that was visited last23var GB_last_win_url = null;24function GB_show(caption, url /* optional */, height, width) {25 try {26 if(height != 'undefined')27 GB_HEIGHT = height;28 if(width != 'undefined')29 GB_WIDTH = width;30 initIfNeeded();31 GB_IFRAME.src = url;32 GB_IFRAME.opener = this;33 GB_caption.innerHTML = caption;34 GB_setPosition();35 if(GB_ANIMATION) {36 positionRightVertically(GB_HEADER, -(GB_HEIGHT));37 positionRightVertically(GB_WINDOW, -(GB_HEIGHT+22));38 }39 showElement(GB_OVERLAY);40 showElement(GB_HEADER);41 showElement(GB_WINDOW);42 GB_setWidth();43 if(GB_ANIMATION) {44 GB_animateOut(-GB_HEIGHT);45 }46 return false;47 }48 catch (e) {49 return false;50 }51}52function GB_hide() {53 GB_IFRAME.src = "";54 hideElement(GB_WINDOW);55 hideElement(GB_HEADER);56 hideElement(GB_OVERLAY);57}58function GB_setPosition() {59 positionRightVertically(GB_HEADER, 0);60 positionRightVertically(GB_WINDOW, 22);61}62function GB_animateOut(top) {63 if(top+getScrollTop() < 0) {64 positionRightVertically(GB_WINDOW, top+22);65 positionRightVertically(GB_HEADER, top);66 GB_TIMEOUT = window.setTimeout(function() { GB_animateOut(top+50); }, 1);67 }68 else {69 GB_WINDOW.style.top = getScrollTop()+22+"px";70 GB_HEADER.style.top = getScrollTop()+"px";71 clearTimeout(GB_TIMEOUT);72 }73}74function GB_setWidth() {75 var array_page_size = GB_getWindowSize();76 //Set size77 GB_WINDOW.style.width = GB_WIDTH + "px";78 GB_IFRAME.style.width = GB_WIDTH + "px";79 GB_HEADER.style.width = GB_WIDTH + "px";80 GB_WINDOW.style.height = GB_HEIGHT + "px";81 GB_IFRAME.style.height = GB_HEIGHT - 5 + "px";82 GB_OVERLAY.style.width = array_page_size[0] + "px";83 var max_height = Math.max(getScrollTop()+array_page_size[1], getScrollTop()+GB_HEIGHT+30);84 GB_OVERLAY.style.height = max_height + "px";85 GB_WINDOW.style.left = ((array_page_size[0] - GB_WINDOW.offsetWidth) /2) + "px";86 GB_HEADER.style.left = ((array_page_size[0] - GB_HEADER.offsetWidth) /2) + "px";87 88}89function GB_init() {90 //Create the overlay91 GB_OVERLAY = DIV({'id': 'GB_overlay'});92 if(GB_overlay_click_close)93 GB_OVERLAY.onclick = GB_hide;94 getBody().insertBefore(GB_OVERLAY, getBody().firstChild);95 //Create the window96 GB_WINDOW = DIV({'id': 'GB_window'});97 GB_HEADER = DIV({'id': 'GB_header'});98 GB_caption = DIV({'id': 'GB_caption'}, "");99 var close = DIV({'id': 'GB_close'}, IMG({'src': GB_IMG_DIR + 'close.gif', 'alt': 'Close window'}));100 close.onclick = GB_hide;101 ACN(GB_HEADER, close, GB_caption);102 getBody().insertBefore(GB_WINDOW, GB_OVERLAY.nextSibling);103 getBody().insertBefore(GB_HEADER, GB_OVERLAY.nextSibling);104}105function initIfNeeded() {106 if(GB_OVERLAY == null) {107 GB_init();108 GB_addOnWinResize(GB_setWidth);109 window.onscroll = function() { GB_setPosition(); GB_setWidth(); };110 } 111 //Remove the old iFrame112 var new_frame = IFRAME({'id': 'GB_frame', 'name': 'GB_frame'});113 if (GB_IFRAME != null)114 removeElement(GB_IFRAME);115 ACN(GB_WINDOW, new_frame);116 GB_IFRAME = new_frame;117}118function GB_getWindowSize(){119 var window_width, window_height;120 if (self.innerHeight) { // all except Explorer121 window_width = self.innerWidth;122 window_height = self.innerHeight;123 } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode124 window_width = document.documentElement.clientWidth;125 window_height = document.documentElement.clientHeight;126 } else if (document.body) { // other Explorers127 window_width = document.body.clientWidth;128 window_height = document.body.clientHeight;129 } 130 return [window_width, window_height];131}132function GB_addOnWinResize(func) {133 var oldonrezise = window.onresize;134 if (typeof window.onresize != 'function')135 window.onresize = func;136 else {137 window.onresize = function() {138 oldonrezise();139 func();140 }141 }142}143function positionRightVertically(elm, value) {144 elm.style.top = getScrollTop()+value+"px";145}146function getScrollTop() {147 //From: http://www.quirksmode.org/js/doctypes.html148 var theTop;149 if (document.documentElement && document.documentElement.scrollTop)150 theTop = document.documentElement.scrollTop;151 else if (document.body)152 theTop = document.body.scrollTop;153 return theTop;...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var gB = require('fast-check-monorepo').gB;2gB();3var gB = require('fast-check-monorepo').gB;4gB();5var gB = require('fast-check-monorepo').gB;6gB();7var gB = require('fast-check-monorepo').gB;8gB();9var gB = require('fast-check-monorepo').gB;10gB();11var gB = require('fast-check-monorepo').gB;12gB();13var gB = require('fast-check-monorepo').gB;14gB();15var gB = require('fast-check-monorepo').gB;16gB();17var gB = require('fast-check-monorepo').gB;18gB();19var gB = require('fast-check-monorepo').gB;20gB();21var gB = require('fast-check-monorepo').gB;22gB();23var gB = require('fast-check-monorepo').gB;24gB();25var gB = require('fast-check-monorepo').gB;26gB();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { gB } = require('fast-check-monorepo');2console.log(gB());3const { gB } = require('fast-check-monorepo');4console.log(gB());5const { gB } = require('fast-check-monorepo');6console.log(gB());7const { gB } = require('fast-check-monorepo');8console.log(gB());9const { gB } = require('fast-check-monorepo');10console.log(gB());11const { gB } = require('fast-check-monorepo');12console.log(gB());

Full Screen

Using AI Code Generation

copy

Full Screen

1var gB = require('fast-check-monorepo').gB;2var gB = require('fast-check-monorepo').gB;3gB('hello');4var gB = require('fast-check-monorepo').gB;5var gB = require('fast-check-monorepo').gB;6gB('hello');

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2const { gB } = require('fast-check-monorepo');3const { gB } = require('fast-check-monorepo');4module.exports = {5};6const fc = require('fast-check');7const { gB } = require('fast-check-monorepo');8module.exports = {9};10const fc = require('fast-check');11const { gB } = require('fast-check-monorepo');12module.exports = {13};14const fc = require('fast-check');15const { gB } = require('fast-check-monorepo');16module.exports = {17};18const fc = require('fast-check');19const { gB } = require('fast-check-monorepo');20module.exports = {21};22const fc = require('fast-check');23const { gB } = require('fast-check-monorepo');24module.exports = {25};26const fc = require('fast-check');27const { gB } = require('fast-check-monorepo');28module.exports = {29};30const fc = require('fast-check');31const { gB } = require('fast-check-monorepo');32module.exports = {33};34const fc = require('fast-check');35const { gB } = require('fast-check-monorepo');36module.exports = {37};38const fc = require('fast-check');39const { gB } = require('

Full Screen

Using AI Code Generation

copy

Full Screen

1console.log("gB: ", gB);2console.log("gB: ", gB);3console.log("gB: ", gB);4console.log("gB: ", gB);5console.log("gB: ", gB);6console.log("gB: ", gB);7console.log("gB: ", gB);8console.log("gB: ", gB);

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful