How to use parentsuntil method in Cypress

Best JavaScript code snippet using cypress

otherInfo.js

Source:otherInfo.js Github

copy

Full Screen

1function checkedState() {2 $(".otherManageNav ul").find("li").on("click", function() {3 if($(this).hasClass("current-item")) {4 //$(this).removeClass("current-item");5 } else {6 $(this).addClass("current-item").siblings().removeClass("current-item");7 }8 });9 $(".filterBox ul").find("li").on("mousedown", function() {10 $(this).addClass("selected");11 });12 $(".filterBox ul ").find("li").on("mouseup", function() {13 $(this).removeClass("selected");14 });15 //是否过期16 $(".checkbox-success input[type='checkbox']").on("change", function() {17 //过期的:18 if($(this).attr("checked") !== "checked") {19 $(".defaultList").hide();20 $(".disabledListInfo").show();21 detailText(); //已过期部分,"详情"文本的换行问题22 } else {23 //未过期的24 $(".defaultList").show();25 $(".disabledListInfo").hide();26 }27 });28}29//查询30function filterCodeInfo() {31 $("li.searchInfo.action-item").on("click", function() {32 var discountCode = $("li.discountCode").find("input[type='text']").val();33 var discountAmount = $("li.discountAmount").find("input[type='text']").val();34 var discountCodeMsg = $("ul.listInfo").find("li").find("dd.discountCodeMsg"); //折扣码35 var discountAmountMsg = $("ul.listInfo").find("li").find("dd.discountAmountMsg"); //折扣金额36 var salesMsg = $("ul.listInfo").find("li").find(".salesMsg"); //销售人员37 var detailMsg = $("ul.listInfo").find("li").find(".detailMsg"); //详情38 if(discountCode == "" || discountAmount == "") {}39 if(discountCode !== "" || discountAmount !== "") {40 //alert(discountCode+"+"+discountAmount);41 discountCodeMsg.text($.trim(discountCode));42 discountAmountMsg.text($.trim(discountAmount));43 }44 });45}46function salesAction() {47 $(".optionItem").on("mousedown", function() {48 $(this).addClass("option-active");49 });50 $(".optionItem").on("mouseup", function() {51 $(this).removeClass("option-active");52 });53 //添加54 $(".plusItem").on("click", function() {55 $("li.salesFilter").css("visibility", "visible");56 $("li.salesFilter").find("input").on("keydown", function() {57 if(event.keyCode == 13) {58 var salesNameTxt = $.trim($("li.salesFilter").find("input").val()); //当前输入框的值59 var salesInfo = $.trim($(".salesName").text()); //销售人员信息60 console.log(salesNameTxt);61 if($(".salesName").length > 0) {62 if(salesInfo.indexOf(salesNameTxt) !== -1) {63 alert("输入的销售人员信息不能一致");64 $("li.salesFilter").find("input").val(" ");65 } else {66 var e = `67 <li class="salesName">` + salesNameTxt + `68 </li>69 `;70 $(".rightInfo ul").append(e);71 //当前为背景为灰色72 $("li.salesName:last").addClass("selected").siblings("li.salesName").removeClass("selected");73 $("li.salesFilter").find("input").val(" "); //清空输入框的值74 salesNameState();75 }76 }77 }78 });79 minusAction();80 });81}82//移除83function minusAction() {84 $(".minusItem").on("click", function() {85 //移除当前选中的元素86 $(".rightInfo ul").find("li.salesName.selected").remove("");87 $("li.salesFilter").find("input").val("");88 });89}90//销售人员的选中状态91function salesNameState() {92 $(".rightInfo").find("ul").find("li.salesName").unbind("click").on("click", function() {93 if(!$(this).hasClass("selected")) {94 $(this).addClass("selected");95 } else {96 $(this).removeClass("selected");97 }98 });99}100function resetInfo() {101 $(".resetInfo").on("click", function() {102 $("ul.addInfo").find("input").val(" ");103 });104}105//跳转到用户管理页面106function toUsersManagePage() {107 var isSales = true;108 $("a#toUsersManagePage").on("click", function() {109 //对于销售人员:110 if(isSales == true) {111 $(this).attr("href", "UsersManageToSales.php");112 }113 //对于管理人员:114 if(isSales == false) {115 $(this).attr("href", "UsersManageToAdmin.php");116 }117 });118}119//"确认添加"按钮的状态120function addStatus() {121 $("ul.salesNav").find("li.salesFilter").find(".addBtn").on("mousedown", function() {122 $(this).addClass("selected");123 });124 $("ul.salesNav").find("li.salesFilter").find(".addBtn").on("mouseup", function() {125 $(this).removeClass("selected");126 });127}128//"折扣码"页面,列表的选中状态129function listStatus() {130 $("ul.listInfo").find("li").find("dl").on("click", function() {131 if($(this).hasClass("selected")) {132 $(this).removeClass("selected");133 } else {134 $(this).addClass("selected");135 }136 });137}138//详情文字的换行139function detailText() {140 //"折扣码"详情修改(未过期部分):141 var detailBox = $("ul.listInfo.defaultList").find("li").find("dl").find("dd.detailMsg");142 for(var j = 0; j < detailBox.length; j++) {143 if($(detailBox[j]).height() >= 32) {144 $("ul.listInfo.defaultList").find("li.listDetail").eq(j).find("dl").find("dd").css({145 "height": $(detailBox[j]).height(),146 "line-height": $(detailBox[j]).height() + "px"147 });148 }149 }150 //"折扣码","过期"部分详情:151 var detailBox2 = $("ul.listInfo.disabledListInfo").find("li").find("dl").find("dd.detailMsg");152 for(var j = 0; j < detailBox.length; j++) {153 // alert($(detailBox2[j]).height());154 if($(detailBox2[j]).height() >= 32) {155 $("ul.listInfo.disabledListInfo").find("li.listDetail").eq(j).find("dl").find("dd").css({156 "height": $(detailBox2[j]).height(),157 "line-height": $(detailBox2[j]).height() + "px"158 });159 }160 }161 //"分部"页详情162 var detailCell = $(".divisionRightInfo").find("ul.divisionMsg").find("li").find("dl").find("dd.divisionDetail");163 for(var i = 0; i < detailCell.length; i++) {164 if($(detailCell[i]).height() >= 32) {165 $(".divisionRightInfo").find("ul.divisionMsg").find("li").eq(i).find("dl").find("dd.divisionName").css({166 "height": $(detailCell[i]).height(),167 "line-height": $(detailCell[i]).height() + "px"168 });169 }170 }171}172//添加分部173function addDivisionInfo() {174 $("ul.addInfo").find(".actionFilerBox").find("a.filterInfo").on("click", function() {175 var divisionName = $("ul.addInfo").find("li").find("input[type='text'].divisionName").val();176 var divisionDetail = $("ul.addInfo").find("li").find("textarea.divisionDetail").val();177 if(divisionName == "") {178 alert("分部名称不能为空");179 } else {180 var e = `181 <li>182 <dl>183 <dd class="divisionName">` + divisionName + `</dd>184 <dd class="divisionDetail">` + divisionDetail + `</dd>185 </dl>186 </li>`;187 $(".divisionRightInfo").find("ul.divisionMsg").append(e);188 detailText();189 }190 });191}192//重置:193function resetDivisionInfo() {194 $("ul.addInfo").find(".actionFilerBox").find("a.resetInfo").on("click", function() {195 var divisionName = $("ul.addInfo").find("li").find("input[type='text'].divisionName").val(" ");196 var divisionDetail = $("ul.addInfo").find("li").find("textarea.divisionDetail").val(" ");197 });198}199//其他管理---其他200function otherManage() {201 toUsersManagePage(); //跳转到用户管理页面202 $(".optionItem").on("mousedown", function() {203 $(this).addClass("option-active");204 });205 $(".optionItem").on("mouseup", function() {206 $(this).removeClass("option-active");207 });208 $(".otherManageArea .manageCard ul li dl.manageCardNav dd.confirmManageInfo a").on("mousedown", function() {209 $(this).addClass("option-active");210 });211 $(".otherManageArea .manageCard ul li dl.manageCardNav dd.confirmManageInfo a").on("mouseup", function() {212 $(this).removeClass("option-active");213 });214 $(".manageCard.exchangeRateCard").find("ul").find("li").find("a.selected").on("mousedown", function() {215 $(this).addClass("current");216 });217 $(".manageCard.exchangeRateCard").find("ul").find("li").find("a.selected").on("mouseup", function() {218 $(this).removeClass("current");219 });220 addAction(); //添加221 // removeAction();//移除222 selectedStatus(); //选中状态223 divisionAutoWrap(); //分部详情的换行224 moreInfo(); //更多225 //MCO刷卡公司226 addMcoInfo();227 removeMcoInfo();228 selectedMcoInfo();229}230function selectedStatus() {231 $(document).on('click', '#customer-source-list dd', function() {232 if(!$(this).hasClass("selected")) {233 $(this).addClass("selected");234 } else {235 $(this).removeClass("selected");236 }237 });238}239//添加240function addAction() {241 var manageBox = $(".otherManageArea .manageCard.manageContent"); //顾客来源,货币,支付方式242 manageBox.find(".plusItem").on("click", function() {243 $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").css("display", "inline-block"); //可输入部分244 //点击确认245 $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").find("a").on("click", function() {246 //当前列表247 $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").css("display", "block");248 var inputText = $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").find("input").val();249 var listText = $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").find("dd").text();250 var currentInputTxt = $.trim(inputText); //当前输入框的值251 var currentListTxt = $.trim(listText); //销售人员信息252 if($(this).parentsUntil(".manageCard.manageContent").find("input").val() == "") {253 alert("请确认信息已输入");254 } else if(currentListTxt.indexOf(currentInputTxt) !== -1) {255 // alert("输入的销售人员信息不能一致");256 $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").find("input").val(" ");257 } else {258 var e = `259 <dd>` + currentInputTxt + `260 </dd>261 `;262 $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").find("dl").append(e);263 //当前为背景为灰色264 $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").find("dd:last").addClass("selected").siblings("dd").removeClass("selected");265 $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").find("input").val(" "); //清空输入框的值266 selectedStatus();267 }268 });269 //enter270 $(this).parentsUntil(".manageCard.manageContent").find("input").on("keydown", function() {271 if(event.keyCode == 13) {272 //当前列表273 $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").css("display", "block");274 var inputText = $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").find("input").val();275 var listText = $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").find("dd").text();276 var currentInputTxt = $.trim(inputText); //当前输入框的值277 var currentListTxt = $.trim(listText); //销售人员信息278 if(currentListTxt.indexOf(currentInputTxt) !== -1) {279 // alert("输入的销售人员信息不能一致");280 $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").find("input").val(" ");281 } else {282 var e = `283 <dd>` + currentInputTxt + `284 </dd>285 `;286 $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").find("dl").append(e);287 //当前为背景为灰色288 $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").find("dd:last").addClass("selected").siblings("dd").removeClass("selected");289 $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").find("input").val(" "); //清空输入框的值290 selectedStatus();291 }292 }293 });294 });295}296//移除297function removeAction() {298 $(".otherManageArea .manageCard.manageContent").find(".minusItem").on("click", function() {299 //移除当前选中的元素300 $(".otherManageArea .manageCard.manageContent").find("li.manegeDetailInfo").find("dd.selected").remove();301 $(".otherManageArea .manageCard.manageContent").find("dd.confirmManageInfo").find("input").val(" ");302 addAction();303 });304}305//分部部分"详情文字"的换行306function divisionAutoWrap() {307 //"分部"页-详情308 var detailCell = $(".otherManageArea .manageCard.divisionCard").find(".divisionRightInfo").find("ul.divisionMsg").find("li").find("dl").find("dd.divisionDetail");309 for(var i = 0; i < detailCell.length; i++) {310 if($(detailCell[i]).height() >= 32) {311 $(".otherManageArea .manageCard.divisionCard").find(".divisionRightInfo").find("ul.divisionMsg").find("li").eq(i).find("dl").find("dd.divisionName").css({312 "height": $(detailCell[i]).height(),313 "line-height": $(detailCell[i]).height() + "px"314 });315 $(".otherManageArea .manageCard.divisionCard").find(".divisionRightInfo").find("ul.divisionMsg").find("li").eq(i).css({316 "height": $(detailCell[i]).height(),317 "line-height": $(detailCell[i]).height() + "px"318 });319 }320 }321}322//更多323function moreInfo() {324 $(".manageCard").find("a.order-unfold").on("click", function() {325 var e = `326 <dd>` + "" + `327 </dd>328 `;329 $(this).parentsUntil(".manageCard.manageContent").find("li.manegeDetailInfo").find("dl").append(e);330 });331}332//MCO刷卡公司333function addMcoInfo() {334 var manageBox = $(".manageCard.creditCardCompanies");335 manageBox.find(".plusItem").on("click", function() {336 $(this).parentsUntil(".manageCard.creditCardCompanies").find("dd.confirmManageInfo").css("display", "inline-block"); //可输入部分337 //点击确认338 $(this).parentsUntil(".manageCard.creditCardCompanies").find("dd.confirmManageInfo").find("a").on("click", function() {339 //当前列表340 $(this).parentsUntil(".manageCard.creditCardCompanies").find("li.manegeDetailInfo").css("display", "block");341 var inputText = $(this).parentsUntil(".manageCard.creditCardCompanies").find("dd.confirmManageInfo").find("input").val();342 var listText = $(this).parentsUntil(".manageCard.creditCardCompanies").find("li.manegeDetailInfo").find("dd").text();343 var currentInputTxt = $.trim(inputText); //当前输入框的值344 var currentListTxt = $.trim(listText); //销售人员信息345 if($(this).parentsUntil(".manageCard.creditCardCompanies").find("input").val() == "") {346 alert("请确认信息已输入");347 }348 // else if(currentListTxt.indexOf(currentInputTxt) !== -1) {349 // // alert("输入的销售人员信息不能一致");350 // $(this).parentsUntil(".manageCard.creditCardCompanies").find("dd.confirmManageInfo").find("input").val(" ");351 // } 352 else {353 var e = `<li class="contentInfo">354 <dl class="detailContent">355 <dd class="orderInfo"></dd>356 <dd class="nameInfor">` + currentInputTxt + `</dd>357 </dl>358 </li>`359 $(this).parentsUntil(".manageCard.creditCardCompanies").find("dl.detailTitle").parent("li").parent("ul").append(e);360 var orderInfo = $(".otherManageArea .manageCard.creditCardCompanies ul li.manegeDetailInfo dl.companyInfor ul li.contentInfo dd.orderInfo");361 orderInfo.each(function(i, item) {362 $(item).text(i + 1);363 });364 //当前为背景为灰色365 // $(this).parentsUntil(".manageCard.creditCardCompanies").find("li.contentInfo:last").addClass("selected").siblings("li.contentInfo").removeClass("selected");366 $(this).parentsUntil(".manageCard.creditCardCompanies").find("dd.confirmManageInfo").find("input").val(" "); //清空输入框的值367// selectedMcoInfo();368 heightRange();369 }370 });371 //enter372 $(this).parentsUntil(".manageCard.manageContent").find("input").on("keydown", function() {373 $(this).parentsUntil(".manageCard.creditCardCompanies").find("li.manegeDetailInfo").css("display", "block");374 var inputText = $(this).parentsUntil(".manageCard.creditCardCompanies").find("dd.confirmManageInfo").find("input").val();375 var listText = $(this).parentsUntil(".manageCard.creditCardCompanies").find("li.manegeDetailInfo").find("dd").text();376 var currentInputTxt = $.trim(inputText); //当前输入框的值377 var currentListTxt = $.trim(listText); //销售人员信息378 if(event.keyCode == 13) {379 // if(currentListTxt.indexOf(currentInputTxt) !== -1) {380 // //alert("输入的销售人员信息不能一致");381 // $(this).parentsUntil(".manageCard.manageContent").find("dd.confirmManageInfo").find("input").val(" ");382 // } 383 // else {384 var e = `<li class="contentInfo">385 <dl class="detailContent">386 <dd class="orderInfo"></dd>387 <dd class="nameInfor">` + currentInputTxt + `</dd>388 </dl>389 </li>`390 $(this).parentsUntil(".manageCard.creditCardCompanies").find("dl.detailTitle").parent("li").parent("ul").append(e);391 var orderInfo = $(".otherManageArea .manageCard.creditCardCompanies ul li.manegeDetailInfo dl.companyInfor ul li.contentInfo dd.orderInfo");392 orderInfo.each(function(i, item) {393 $(item).text(i + 1);394 });395 //当前为背景为灰色396 //$(this).parentsUntil(".manageCard.creditCardCompanies").find("li.contentInfo:last").addClass("selected").siblings("li.contentInfo").removeClass("selected");397 $(this).parentsUntil(".manageCard.creditCardCompanies").find("dd.confirmManageInfo").find("input").val(" "); //清空输入框的值398 heightRange();399 // }400 }401 });402 });403}404function selectedMcoInfo() {405 $(document).on("click", ".manageCard.creditCardCompanies li .companyInfor ul li.contentInfo", function () { 406 if(!$(this).hasClass("selected")) {407 $(this).addClass("selected");408 } else {409 $(this).removeClass("selected");410 }411 });412}413function removeMcoInfo() {414 $(".otherManageArea .manageCard.creditCardCompanies").find(".minusItem").on("click", function() {415 //移除当前选中的元素416 $(".otherManageArea .manageCard.creditCardCompanies").find("li.contentInfo.selected").remove();417 var orderInfo = $(".otherManageArea .manageCard.creditCardCompanies ul li.manegeDetailInfo dl.companyInfor ul li.contentInfo dd.orderInfo");418 orderInfo.each(function(i, item) {419 $(item).text(i + 1);420 });421 if($(".manageCard.creditCardCompanies").find("li.contentInfo").length < 1) {422 localStorage.setItem("orderNum", 0);423 }424 $(".otherManageArea .manageCard.creditCardCompanies").find("dd.confirmManageInfo").find("input").val(" ");425 addMcoInfo();426 selectedMcoInfo();427 });...

Full Screen

Full Screen

main.js

Source:main.js Github

copy

Full Screen

1// MENU2$(".menu .nav form button").click(function () { 3 if ($(".menu .nav form input").css("display") == "none"){4 console.log($(".menu .nav form input").css("display"));5 $(".menu .nav form input").animate({6 width: 200,7 },500);8 $(".menu .nav form input").show(500);9 } 10 else if ($(".menu .nav form input").css("display") == "inline-block"){11 console.log($(".menu .nav form input").css("display"));12 $(".menu .nav form input").animate({13 width: "0",14 },200);15 $(".menu .nav form input").hide(500);16 }17});18// NOI DUNG19$(window).on("resize load", function(e) {20 // auto set height for .purple-theme and img in normal .noidung > div21 $(".noidung .img-wrapper").each(function (index, element) {22 let widthFirst = $(this).find("img").css("width");23 $(this).find(".pupple-theme").css("width", parseFloat(widthFirst));24 let width = parseFloat(widthFirst);25 if(window.innerWidth>767)26 $(this).find(".pupple-theme, img").css("height", 27 2/3 * parseFloat(width));28 else $(this).find(".pupple-theme, img").css("height", 29 1/2 * parseFloat(width));30 // $(this).parentsUntil(".noidung").find(".long .pupple-theme, .long .img-wrapper img")31 // .css("height", 1/3 * parseFloat(width));32 // console.log(width);33 // console.log($(this).parentsUntil(".noidung").find(".long .pupple-theme, .long .img-wrapper img").css("height"));34 });35 // and in .noidung div.long36 $(".noidung .long .img-wrapper").each(function (index, element) {37 let width = $(this).find(".pupple-theme").css("width");;38 if(window.innerWidth>767)39 $(this).parentsUntil(".noidung")40 .find(".long .pupple-theme, .long .img-wrapper img")41 .css("height", 1/4 * parseFloat(width));42 // else if(window.innerWidth>410)43 // $(this).parentsUntil(".noidung")44 // .find(".long .pupple-theme, .long .img-wrapper img")45 // .css("height", 1/2 * parseFloat(width));46 else $(this).find(".pupple-theme, img").css("height", 47 1/2 * parseFloat(width));48 });49 // auto set bg-color for every purple theme50 $(".noidung .img-wrapper").each(function (index, element) {51 let borderGround = $(this).css("border-bottom-color");52 let indexOfA = borderGround.indexOf('('), indexOfValue = borderGround.indexOf(')');53 borderGround= borderGround.slice(0,indexOfA) + "a" 54 + borderGround.slice(indexOfA,indexOfValue) + ", 0.502" 55 + borderGround.slice(indexOfValue);56 // console.log(borderGround);57 $(this).find(".pupple-theme").css("background-color", borderGround);58 });59 // auto set position for large icon for normal col divs and 60 // .long divs61 $(".noidung .content-wrapper-2 i:not(.fa-star), .noidung .long >div> i")62 .each(function (index, element) {63 // element == this64 let img_height = $(this).parentsUntil(".noidung")65 .find(".img-wrapper .pupple-theme")66 .css("height");67 $(this).css("margin-top", -30);68 // console.log(img_height);69 });70 // auto set position for .show-more 71 $(".noidung .content-wrapper .show-more").each(function (index, element) {72 // element == this73 let img_height = $(this).parentsUntil(".noidung")74 .find(".img-wrapper .pupple-theme")75 .css("height");76 $(this).css("top",30/100 * parseFloat(img_height));77 });78 // auto set position for img star icons79 $(".noidung .content-wrapper ul").each(function (index, element) {80 // element == this81 let img_height = $(this).parentsUntil(".noidung")82 .find(".img-wrapper .pupple-theme")83 .css("height");84 $(this).css("top",60/100 * parseFloat(img_height));85 });86 // with .long, auto set the img height as 1/3 img width87 $(".noidung .content-wrapper > img").each(function (index, element) {88 // element == this89 let img_height = $(this).parentsUntil(".noidung")90 .find(".img-wrapper .pupple-theme")91 .css("height");92 $(this).css("top",60/100 * parseFloat(img_height));93 });94 // with .long, auto set the position of .title-row and .title-row-295 $(".noidung .long .img-wrapper > img").each(function (index, element) {96 // element == this97 let img_height = $(this).css("height");98 // console.log(img_height);99 if(window.innerWidth>767 || window.innerWidth<635){100 $(this).parentsUntil(".noidung")101 .find(".long .title-row")102 .css("top", 80/100 * parseFloat(img_height));103 } else {104 $(this).parentsUntil(".noidung")105 .find(".long .title-row")106 .css("top", 86/100 * parseFloat(img_height));107 }108 // console.log(window.innerWidth);109 if(window.innerWidth<620) {110 $(this).parentsUntil(".noidung")111 .find(".long .title-row")112 .css({"background-color":"rgba(0,0,0,0.5)",113 "left": "17%",114 "width": "78.5%"});115 } else if(window.innerWidth<1200) {116 $(this).parentsUntil(".noidung")117 .find(".long .title-row")118 .css({"background-color":"transparent",119 "left": "13%",120 "width": "80%"});121 } else {122 $(this).parentsUntil(".noidung")123 .find(".long .title-row")124 .css({"background-color":"transparent",125 "left": "11.5%",126 "width": "80%"});127 }128 if(window.innerWidth <620){129 $(this).parentsUntil(".noidung").find(".long .title-row-2")130 .css({"top": 150/100 * parseFloat(img_height)});131 }132 else {133 $(this).parentsUntil(".noidung").find(".long .title-row-2")134 .css({"top": 107.8/100 * parseFloat(img_height)+10});135 }136 });137 138 //set equal height for every divs inside .row139 // let row_height = 0;140 // // console.log(row_height);141 // $(".noidung .row > div").each(function (index, element) {142 // // element == this143 // // console.log( $(this).css("height"));144 // if( row_height < parseFloat(this.scrollHeight)) {145 // row_height = parseFloat(this.scrollHeight);146 // // console.log("row height " +row_height);147 // // console.log("scroll Height "+ this.scrollHeight);148 // } 149 // });150 // console.log(row_height);151 // if(window.innerWidth>1200){152 // $(".noidung .row > div >div").each(function (index, element) {153 // // element == this154 // if (parseFloat($(this).css("height")) < row_height)155 // $(this).css("height", row_height);156 // // console.log($(this).css("height")+ "------" + this.scrollHeight+ " --- " + this.offsetHeight);157 // });158 // } else $(".noidung .row > div >div").css("height", "fit-content");159 // Set truncate for .content-wrapper-2 p and .content-row p160 $(".noidung .row > div").each(function (index, element) {161 // element == this162 let paragraph = $(this).find(".content-wrapper-2, .content-row")163 .find("p")[0] ;164 let hiddenText = $(this).find(".content-wrapper-2, .content-row")165 .find("span")[0] || "";166 // console.log(hiddenText.innerHTML);167 paragraph.innerHTML = hiddenText.innerHTML || paragraph.innerHTML;168 let wordsArray = paragraph.innerHTML.split(" "), hiddenContent = hiddenText.innerHTML 169 || paragraph.innerHTML;170 while(paragraph.scrollHeight > paragraph.offsetHeight){171 $(this).find(".content-wrapper-2, .content-row").find("span").remove();172 // hiddenContent = wordsArray[wordsArray.length-1]+ " " + hiddenContent;173 // console.log(hiddenContent);174 wordsArray.pop();175 if($(paragraph).parent().parent().hasClass("content-wrapper-2")){176 paragraph.innerHTML = wordsArray.join(" ") + "...";177 }178 if($(paragraph).parent().parent().hasClass("content-row")){179 paragraph.innerHTML = wordsArray.join(" ") + "<a><b>...read more</b></a>";180 }181 }182 // console.log(hiddenContent);183 $(paragraph).after(" <span style=\"display:none\">" + hiddenContent + "</span>");184 });185 // $(".noidung .row > div").each(function (index, element) {186 // // element == this187 // let widthOfPara = $(this).find(".content-row .right").css("width");188 // let marginOfStar = $(this).find(".title-row-2").css("left");189 // console.log(widthOfPara+ "---"+ marginOfStar);190 // });191});192//toggle color of start in .content-wrapper-2, title-row, .title-row-2193$(' .noidung .content-wrapper-2,' 194 + '.noidung .title-row , .noidung .title-row-2')195 .each(function (index, element) {196 // element == this197 // console.log(typeof element);198 $(this).find(' ul li img[alt=""]').each(function(index2,el){199 $(this).hover(function () {200 // over201 // console.log($(this).parentsUntil(".content-wrapper").eq(1)202 // .find('li img[alt=""]'));203 for(let i=0;i<=index2;i++){204 $(this).parentsUntil().eq(1)205 .find('li img[alt=""]').eq(i)206 .attr("src", "./imgs/noidung/start-icon.png");207 }208 }, function () {209 for(let i=0;i<=index2;i++){210 $(this).parentsUntil().eq(1)211 .find('li img[alt=""]').eq(i)212 .attr("src", "./imgs/noidung/star-icon2.png");213 }214 }215 );216 })217});218//toggle color of start in .content-wrapper219$('.noidung .content-wrapper')220 .each(function (index, element) {221 // element == this222 // console.log(typeof element);223 $(this).find(' ul li img[alt=""]').each(function(index2,el){224 $(this).hover(function () {225 // over226 // console.log($(this).parentsUntil(".content-wrapper").eq(1)227 // .find('li img[alt=""]'));228 for(let i=0;i<=index2;i++){229 $(this).parentsUntil().eq(1)230 .find('li img[alt=""]').eq(i)231 .attr("src", "./imgs/noidung/start-icon1.png");232 }233 }, function () {234 for(let i=0;i<=index2;i++){235 $(this).parentsUntil().eq(1)236 .find('li img[alt=""]').eq(i)237 .attr("src", "./imgs/noidung/star-icon3.png");238 }239 }240 );241 })242});243// $(".noidung .content-wrapper-2").each(function(i,e){244// $(this).find("ul li i.fa-star").each(function(i2,e2){245// console.log(i2);246// })247// }); 248//toggle color of stars in .content-wrapper-2249// $(".noidung .content-wrapper-2 ")250// .each(function (index, element) {251// // element == this252// $(this).find("ul li i.fa-star").each(function(index2, el){253// $(this).hover(function (e) {254// // over255// //console.log($(this).parentsUntil(".content-wrapper-2").eq(1).find('i.fa-star').eq(0));256// for(let i=0;i<=(index2);i++){257// $(this).parentsUntil(".content-wrapper-2")258// .eq(1).find('i.fa-star')259// .eq(i).css("color", "rgb(241, 158, 31)");260// }261// }, function () {262// for(let i=0;i<=(index2);i++){263// $(this).parentsUntil(".content-wrapper-2")264// .eq(1).find('i.fa-star')265// .eq(i).css("color", "");266// }267// }268// );269// });270// });271// Set hover for content-wraper272$(".noidung .img-wrapper, .noidung .content-wrapper ").hover(function (e) {273 // over274 // console.log($(e.currentTarget).parent());275 $(e.currentTarget).parent().find(".content-wrapper, .pupple-theme")276 .css("visibility","visible");277 }, function (e) {278 $(e.currentTarget).parent().find(".content-wrapper, .pupple-theme")279 .css("visibility","hidden");280 }281);282// In .long , toggle color of stars in .title-row and title-row-2283// $(".noidung .long .title-row, .noidung .long .title-row-2 ")284// .each(function (index, element) {285// // element == this286// $(this).find("ul li i.fa-star").each(function(index2, el){287// $(this).hover(function (e) {288// // over289// //console.log($(this).parentsUntil(".content-wrapper-2").eq(1).find('i.fa-star').eq(0));290// for(let i=0;i<=(index2);i++){291// $(this).parentsUntil(".title-row, .title-row-2")292// .eq(1).find('i.fa-star')293// .eq(i).css("color", "rgb(241, 158, 31)");294// }295// }, function () {296// for(let i=0;i<=(index2);i++){297// $(this).parentsUntil(".title-row, .title-row-2")298// .eq(1).find('i.fa-star')299// .eq(i).css("color", "");300// }301// }302// );303// });...

Full Screen

Full Screen

cashier.js

Source:cashier.js Github

copy

Full Screen

1$(document).ready(function() {2 $('#main-menu').find('li').removeClass('active');3 $($('#main-menu').find('li')[2]).addClass('active');4 $.ajax({5 url: 'ajaxGetCashiers',6 dataType: 'json',7 success: function(result) {8 loadCashiers(result);9 }10 });11});12$(document).on('click', '.delete-cashier', function(e) {13 e.preventDefault();14 $('.phone_C').text($(this).parentsUntil('.cashier-info').find('.phone-number').val());15 $('.name_C').text($(this).parentsUntil('.cashier-info').find('.cashier-name').val());16 $('.frame-check-delete').css('display', 'block');17 $('.yes-no').css({ 'transform': 'scale(1)', 'opacity': '1' });18});19$(document).on('click', '.edit-cashier', function(e) {20 e.preventDefault();21 $(this).parentsUntil('.cashier-info').find('input,textarea').prop('disabled', false);22 $(this).parentsUntil('.cashier-info').find('input:text:visible:first').focus();23 $(this).parentsUntil('.cashier-info').find('.edit-image').css('display', 'block');24 $(this).parent('.edit-delete').css('display', 'none');25 $(this).parent('.edit-delete').next('.save').css({ 'display': 'block' });26 $(this).parentsUntil('.cashier-info').find('.reset-password').css({ 'display': 'block' });27});28$(document).on('click', '#add-cashier', function(e) {29 e.preventDefault();30 $('#addCashier').modal('show');31 if (CKEDITOR.instances['editor1']) {32 CKEDITOR.instances['editor1'].destroy(true);33 }34 CKEDITOR.replace('editor1');35 $('#addCashier').attr('style', ' overflow: auto !important');36});37$(document).on('change', '#addCashier .input-edit', function(e) {38 e.preventDefault();39 $(this).parent('.edit-image').prev('img').attr('src', URL.createObjectURL($(this)[0]['files'][0]));40});41$(document).on('click', '.close-addC, .button-close-addC', function(e) {42 e.preventDefault();43 if (CKEDITOR.instances['editor1']) {44 CKEDITOR.instances['editor1'].destroy(true);45 }46 $('#default-img-cashier').attr('src', '../img/admin/nami.jpg');47 $('.notBlank').fadeOut();48});49$(document).on('click', '.bt-cancel', function(e) {50 e.preventDefault();51 $(this).parentsUntil('.cashier-info').find('.img-cashier').attr('src', $(this).parentsUntil('.cashier-info').find('.img-cashier').data('src'));52 $(this).parentsUntil('.cashier-info').find('.cashier-name').val($(this).parentsUntil('.cashier-info').find('.cashier-name').data('name'));53 $(this).parentsUntil('.cashier-info').find('.phone-number').val($(this).parentsUntil('.cashier-info').find('.phone-number').data('phone'));54 $(this).parentsUntil('.cashier-info').find('.datetimepicker').val($(this).parentsUntil('.cashier-info').find('.datetimepicker').data('date'));55 $(this).parentsUntil('.cashier-info').find('.description').val($(this).parentsUntil('.cashier-info').find('.description').data('add'));56 $(this).parentsUntil('.cashier-info').find('input,textarea').prop('disabled', true);57 $(this).parentsUntil('.cashier-info').find('.edit-image').css('display', 'none');58 $(this).parent('.save').css('display', 'none');59 $(this).parent('.save').prev('.edit-delete').css('display', 'block');60 $(this).parentsUntil('.cashier-info').find('.notBlank').fadeOut();61 $(this).parentsUntil('.cashier-info').find('.reset-password').css({ 'display': 'none' });62 $('.notBlank').fadeOut();63});64$(document).on('keypress', '#cname, #pcashier', function() {65 $(this).next('.notBlank').fadeOut();66});67$(document).on('keypress', '.cashier-name, .phone-number', function() {68 $(this).next('label').next('i').next('.notBlank').fadeOut();69});70$(document).on('click', '.addCashier', function(e) {71 e.preventDefault();72 var cname = $('#addCashier').find('#cname').val().trim();73 var cphone = $('#addCashier').find('#pcashier').val();74 var startd = $('#addCashier').find('.date').children('.form-control').val();75 var description = CKEDITOR.instances.editor1.getData().replace(/\s\s+/g, ' ').trim();76 $('#addCashier').find('.notBlank').children('label').text('Please fill out this field');77 if (cname == '') {78 $('#addCashier #cname').next('.notBlank').fadeIn();79 $('#addCashier #cname').focus();80 return false;81 } else if (cphone == '') {82 $('#addCashier #pcashier').next('.notBlank').fadeIn();83 $('#addCashier #pcashier').focus();84 return false;85 } else if (startd == '') {86 $('#addCashier .date').next('.notBlank').fadeIn();87 setTimeout(function() {88 $('#addCashier .date').next('.notBlank').fadeOut();89 }, 1500);90 return false;91 }92 cname = cname.toLowerCase();93 cname = cname.substr(0, 1).toUpperCase() + cname.substr(1);94 var formData = new FormData();95 formData.append('cname', cname);96 formData.append('cphone', cphone);97 formData.append('startd', startd);98 formData.append('description', description);99 formData.append('image', $('#addCashier').find('.input-edit').prop('files')[0]);100 $.ajax({101 url: 'ajaxAddCashier',102 type: 'POST',103 dataType: 'json',104 data: formData,105 contentType: false,106 processData: false,107 success: function(result) {108 if (result == 'duplicatedC') {109 $('#addCashier').find('.notBlank').children('label').text('Phone already exists');110 $('#addCashier #pcashier').next('.notBlank').fadeIn();111 $('#addCashier #pcashier').focus();112 return false;113 }114 loadCashiers(result);115 $('#addCashier').modal('hide');116 add_success();117 }118 });119});120$(document).on('click', '.bt-save', function(e) {121 e.preventDefault();122 var cname = $(this).parentsUntil('.cashier-info').find('.cashier-name').val().trim();123 var cphone = $(this).parentsUntil('.cashier-info').find('.phone-number').val();124 var old_cphone = $(this).parentsUntil('.cashier-info').find('.phone-number').attr('data-phone');125 var startd = $(this).parentsUntil('.cashier-info').find('.datetimepicker').val();126 var description = $(this).parentsUntil('.cashier-info').find('.description').val().trim();127 var current = $(this).parentsUntil('.cashier-info').find('.phone-number');128 if (cname == '') {129 $(this).parentsUntil('.cashier-info').find('.cashier-name').next('label').next('i').next('.notBlank').fadeIn();130 $(this).parentsUntil('.cashier-info').find('.cashier-name').focus();131 return false;132 } else if (cphone == '') {133 $(this).parentsUntil('.cashier-info').find('.phone-number').next('label').next('i').next('.notBlank').children('label').text('Please fill out this field');134 $(this).parentsUntil('.cashier-info').find('.phone-number').next('label').next('i').next('.notBlank').fadeIn();135 $(this).parentsUntil('.cashier-info').find('.phone-number').focus();136 return false;137 } else if (startd == '') {138 $(this).parentsUntil('.cashier-info').find('.datetimepicker').next('label').next('i').next('.notBlank').fadeIn();139 setTimeout(function() {140 $(this).parentsUntil('.cashier-info').find('.datetimepicker').next('label').next('i').next('.notBlank').fadeOut();141 }, 1500);142 return false;143 }144 var formData = new FormData();145 formData.append('cname', cname);146 formData.append('cphone', cphone);147 formData.append('old_cphone', old_cphone);148 formData.append('startd', startd);149 formData.append('description', description);150 formData.append('image', $(this).parentsUntil('.cashier-info').find('#input-edit').prop('files')[0]);151 $.ajax({152 url: 'ajaxEditCashier',153 type: 'POST',154 dataType: 'json',155 data: formData,156 contentType: false,157 processData: false,158 success: function(result) {159 if (result == 'duplicatedC') {160 current.next('label').next('i').next('.notBlank').children('label').text('Phone already exists');161 current.next('label').next('i').next('.notBlank').fadeIn();162 current.focus();163 return false;164 }165 loadCashiers(result);166 save_success();167 }168 });169});170$(document).on('click', '.yes-bt', function(e) {171 e.preventDefault();172 var cphone = $(this).parentsUntil('.check-delete').find('.phone_C').text();173 $.ajax({174 url: 'ajaxDeleteCashier',175 type: 'POST',176 dataType: 'json',177 data: {178 cphone: cphone,179 },180 success: function(result) {181 loadCashiers(result);182 delete_success();183 $('.frame-check-delete').css('display', 'none');184 $('.yes-no').css({ 'transform': 'scale(0)', 'opacity': '0' });185 }186 })187});188$(document).on('keypress', '#inputFocus', debounce(function(e) {189 e.preventDefault();190 $.ajax({191 url: 'ajaxSearchCashier',192 type: 'POST',193 dataType: 'json',194 data: { key_word: $(this).val() },195 success: function(result) {196 loadCashiers(result);197 }198 });199}, 1000));200$(document).on('click', '.reset-password', function(e) {201 e.preventDefault();202 var phonenumber = $(this).parentsUntil('.cashier-info').find('.phone-number').attr('data-phone');203 $.ajax({204 url: 'ajaxResetPassword',205 type: 'post',206 dataType: 'json',207 data: { phonenumber: phonenumber },208 success: function(result) {209 if (result == 'true') {210 save_success();211 }212 }213 });214});215function loadCashiers(result) {216 var template = '';217 for (var i = 0; i < result.length; i++) {218 template += '<div class="col-sm-12 cashier-info">' + '<div class="row">' + '<div class="col-lg-3 col-sm-12 cashier-img">' + '<i class="fas fa-unlock-alt reset-password" title="Reset password"></i>' + '<div class="image-main">';219 if (result[i]['tCashierManagement']['avatar'] == '') {220 result[i]['tCashierManagement']['avatar'] = 'nami.jpg';221 }222 template += '<img src="../img/cashiers/' + result[i]['tCashierManagement']['avatar'] + '" alt="" class="img-cashier" data-src="../img/cashiers/' +223 result[i]['tCashierManagement']['avatar'] + '">' + '<div class="edit-image">' + '<input type="file" name="input-edit" id="input-edit" class="input-edit" accept="image/gif, image/jpeg, image/jpg, image/png" />' +224 '<label for="input-edit">' + '<span class="hover-edit">' + '<i class="fas fa-pencil-alt"></i>' + '</span>' + '</label>' + '</div>' + '</div>' + '</div>' +225 '<div class="col-lg-4 col-sm-5">' + '<form>' + '<div class="form-group">' + '<input type="text" value="' + result[i]['tCashierManagement']['fullname'] + '" class="cashier-name" data-name="' + result[i]['tCashierManagement']['fullname'] +226 '">' + '<label class="control-label">Cashier name</label>' + '<i class="bar"></i>' + '<div class="notBlank">' + '<i class="fas fa-exclamation-circle icon-warn"></i>' + '<label for="" class="eBlank">Please fill out this field</label>' + '</div>' + '</div>' + '<div class="form-group">' + '<input type="text" value="' + result[i]['tCashierManagement']['phone'] + '" class="phone-number" data-phone="' +227 result[i]['tCashierManagement']['phone'] + '" maxlength="10">' + '<label class="control-label">Cashier phone number</label>' + '<i class="bar"></i>' + '<div class="notBlank">' + '<i class="fas fa-exclamation-circle icon-warn"></i>' + '<label for="" class="eBlank">Please fill out this field</label>' + '</div>' +228 '</div>' + '<div class="form-group">' + '<input type="text" class="datetimepicker" value="' + result[i]['tCashierManagement']['start_working'] + '" data-date="' + result[i]['tCashierManagement']['start_working'] + '">' +229 '<label class="control-label">Start working</label>' + '<i class="bar"></i>' + '<div class="notBlank">' + '<i class="fas fa-exclamation-circle icon-warn"></i>' + '<label for="" class="eBlank">Please fill out this field</label>' + '</div>' + '</div>' + '</form>' + '</div>' + '<div class="col-lg-4 col-sm-5">' + '<form>' + '<div class="form-group">' + '<label class="control-label">Total money paid</label>' +230 '<p class="price_format">' + result[i]['total_pay'] + '</p>' + '<i class="bar"></i>' + '</div>' + '<div class="form-group">' + '<textarea class="description" rows="6" data-add="' + result[i]['tCashierManagement']['address'] + '">' + result[i]['tCashierManagement']['address'] + '</textarea>' +231 '<label class="control-label">Address</label>' + '</div>' + '</form>' + '</div>' + '<div class="col-lg-1 col-sm-2 btn-cashier">' + '<div class="edit-delete">' + '<div class="btn1 shadow edit-cashier"><i class="fas fa-pencil-alt icon-cashier"></i></div>' +232 '<div class="btn1 shadow delete-cashier"><i class="fas fa-times icon-cashier"></i></i></div>' + '</div>' + '<div class="save">' + '<button type="button" class="btn btn-primary bt-save"><i class="far fa-save icon-save"></i>Save</button>' +233 '<button type="button" class="btn btn-danger bt-cancel"><i class="fas fa-ban icon-save"></i>Cancel</button>' + '</div>' + '</div>' + '</div>' + '</div>';234 }235 $('#cashiers-list').find('.cashier-info').remove();236 $('#cashiers-list').append(template);237 $('.cashier-info .form-group input, .cashier-info textarea').prop('disabled', true);238 var price_format = $('.price_format');239 for (var i = 0; i < price_format.length; i++) {240 $(price_format[i]).text(convertNumberToCurrency($(price_format[i]).text()));241 $(price_format[i]).append(' $');242 }243 $('.datetimepicker, .input-group.date').datepicker({244 todayBtn: true,245 daysOfWeekHighlighted: "0,6",246 autoclose: true,247 todayHighlight: true248 });...

Full Screen

Full Screen

blog_report.js

Source:blog_report.js Github

copy

Full Screen

1$(document).ready(function () {2 3 $(function(){4 var len = 27; // 超過27個字以"..."取代5 $(".br_reason").each(function(i){6 if($(this).text().length>len){7 $(this).attr("title",$(this).text());8 var text=$(this).text().substring(0,len-1)+"...";9 $(this).text(text);10 }11 });12 });13 14 $(function(){15 var len = 27; // 超過27個字以"..."取代16 $(".bmr_reason").each(function(i){17 if($(this).text().length>len){18 $(this).attr("title",$(this).text());19 var text=$(this).text().substring(0,len-1)+"...";20 $(this).text(text);21 }22 });23 });24 25 $(function(){26 var len = 27; // 超過27個字以"..."取代27 $("p.mem_id").each(function(i){28 if($(this).text().length>len){29 $(this).attr("title",$(this).text());30 var text=$(this).text().substring(0,len-1)+"...";31 $(this).text(text);32 }33 });34 });35 36 $(".updateReportStatusBtn").click(function(){37 $("#blogReportDialogMemID").val($(this).parentsUntil("tbody").find(".mem_id").html());38 $("#blogReportDialogBlogID").val($(this).parentsUntil("tbody").find(".blog_id").html());39 $("#blogOwner").val($(this).parentsUntil("tbody").find("input[name=hidden_blogOwner]").val());40 $(".blogReportDialogContentBlogID").html($(this).parentsUntil("tbody").find(".blog_id").html());41 $(".blogReportDialogContentBrStatus").html($(this).parentsUntil("tbody").find(".br_status").html());42 $(".blogReportDialogContentBrReason").html($(this).parentsUntil("tbody").find("input[name=hidden_blog_reason]").val());43 $("#blogReportManageDialog").dialog("open");44 });45 46 $("#blogReportManageDialog").dialog({47 autoOpen: false,48 closeOnEscape: false,49 hide: 'blind',50 show: 'blind',51 title: '審核視窗',52 modal: true,53 width: 600,54// height: 500,55 autofocus: false,56 resizable: false,57 draggable: false,58 buttons: {59 "送出": function () {60 $(this).dialog("close");61 sendblogReportResult();62 $(".blogReportManageDialogForm").submit();63 },64 "返回": function () {65 $(this).dialog("close");66 $(".ui.selection.dropdown").find("div.text").addClass("default");67 $("div.text.default").html("請審核該檢舉是否成功");68 }69 }70 });71 72 $(".updateReportMessageStatusBtn").click(function(){73 $("#blogMessageReportDialogMemID").val($(this).parentsUntil("tbody").find(".mem_id").html());74 $("#blogMessageReportDialogMessage_id").val($(this).parentsUntil("tbody").find(".message_id").html());75 $("#messageOwner").val($(this).parentsUntil("tbody").find("input[name=hidden_mem_id]").val());76 $(".blogMessageReportDialogContentMessageID").html($(this).parentsUntil("tbody").find(".message_id").html());77 $(".blogMessageReportDialogContentBmrStatus").html($(this).parentsUntil("tbody").find(".bmr_status").html());78 $(".blogMessageReportDialogContentBmrReason").html($(this).parentsUntil("tbody").find("input[name=hidden_reason]").val());79 $(".blogMessageReportDialogContentBlogMessage").html($(this).parentsUntil("tbody").find("input[name=hidden_message]").val());80 $("#blogMessageReportManageDialog").dialog("open");81 });82 83 $("#blogMessageReportManageDialog").dialog({84 autoOpen: false,85 closeOnEscape: false,86 hide: 'blind',87 show: 'blind',88 title: '審核視窗',89 modal: true,90 width: 600,91 autofocus: false,92 resizable: false,93 draggable: false,94 buttons: {95 "送出": function () {96 $(this).dialog("close");97 sendblogMessageReportResult();98 $(".blogMessageReportManageDialogForm").submit();99 },100 "返回": function () {101 $(this).dialog("close");102 $(".ui.selection.dropdown").find("div.text").addClass("default");103 $("div.text.default").html("請審核該檢舉是否成功");104 }105 }106 });107 108 109 $(function () {110 $('.ui.dropdown').dropdown({111 transition: 'horizontal flip',112 duration: 800,113 });114 });115 116 /* 取消AutoFocus */117 $.ui.dialog.prototype._focusTabbable = function () {};118 /* //取消AutoFocus */119 120 $(".item").click(function(){121 $("#blogReportDialogBrStatus").val($(this).attr("value"));122 $("#blogMessageReportDialogBmrStatus").val($(this).attr("value"));123 });124 ...

Full Screen

Full Screen

frontend1.js

Source:frontend1.js Github

copy

Full Screen

1(function( $ ) {2 $(function() {3 if ($('.pcfme-datepicker').length) {4 $('.pcfme-datepicker').datepicker({5 dateFormat : 'dd-mm-yy'6 });7 }8 9 var dateToday = new Date(); 10 11 if ($('.pcfme-datepicker-disable-past').length) {12 $('.pcfme-datepicker-disable-past').datepicker({13 dateFormat : 'dd-mm-yy',14 minDate: dateToday15 });16 }17 18 });19 20 $(function() {21 22 if ($('.pcfme-multiselect').length) {23 $('.pcfme-multiselect').chosen();24 }25 26 if ($('.pcfme-singleselect').length) {27 $('.pcfme-singleselect').chosen();28 }29 30 });31 32 33 $('.pcfme-opener').change(function(e){ 34 35 var this_obj=$(this);36 var id= this_obj.attr('id');37 var name= this_obj.attr('name');38 39 if (this_obj.attr('type')=='checkbox' ) { 40 41 if (this_obj.is(':checked')) 42 $('.open_by_'+id ).parentsUntil('tbody').hide(); 43 else44 $('.open_by_'+id ).parentsUntil('tbody').show();45 46 }else if ( this_obj.attr('type')=='radio'){47 48 $('.open_by_'+ $('input[name="'+name+'"]:checked').attr('id') ).parentsUntil('tbody').hide();49 //hide other 50 $('.open_by_'+ $('input[name="'+name+'"]:not(:checked)').attr('id') ) .parentsUntil('tbody').show();51 } else if (this_obj.hasClass('selectbox')){52 53 $('.open_by_'+ id+'_'+this_obj.val() ).parentsUntil('tbody').hide();54 //hide other 55 $("[class^='open_by_"+ id+"_'],[class*=' open_by_"+ id+"_']").not('.open_by_'+ id +'_'+this_obj.val()).parentsUntil('tbody').show();56 57 } 58 59 });60 61 62 63 $('.pcfme-opener').trigger('change');64 65 $('.pcfme-hider').change(function(e){ 66 67 var this_obj=$(this);68 var id= this_obj.attr('id');69 var name= this_obj.attr('name');70 71 if (this_obj.attr('type')=='checkbox' ) { 72 73 if (this_obj.is(':checked')) 74 $('.hide_by_'+id ).parentsUntil('tbody').show(); 75 else76 $('.hide_by_'+id ).parentsUntil('tbody').hide();77 78 }else if ( this_obj.attr('type')=='radio'){79 80 $('.hide_by_'+ $('input[name="'+name+'"]:checked').attr('id') ).parentsUntil('tbody').show();81 //hide other 82 $('.hide_by_'+ $('input[name="'+name+'"]:not(:checked)').attr('id') ) .parentsUntil('tbody').hide();83 } else if (this_obj.hasClass('selectbox')){84 85 $('.hide_by_'+ id+'_'+this_obj.val() ).parentsUntil('tbody').show();86 //hide other 87 $("[class^='hide_by_"+ id+"_'],[class*=' hide_by_"+ id+"_']").not('.hide_by_'+ id +'_'+this_obj.val()).parentsUntil('tbody').hide();88 89 } 90 91 });92 93 94 95 $('.pcfme-hider').trigger('change');...

Full Screen

Full Screen

admin_scripts.js

Source:admin_scripts.js Github

copy

Full Screen

1$ = jQuery.noConflict();2jQuery(function(jQuery) { 3 $('#navigation_arrows').val('verticalcentered');4 $('#navigaion_type').val('bullet');5 $('#nav_offset_vert').val('-25');6 $('#responsitive_w3').prop('disabled', true).val('480').css('backgroundColor', '#F0F0F0');7 $('#responsitive_w2').prop('disabled', true).val('768').css('backgroundColor', '#F0F0F0');8 $('#responsitive_w1').prop('disabled', true).val('960').css('backgroundColor', '#F0F0F0');9 /* Slider setup */10 checkSlider();11 addBindings();12 $('.option-tree-list-item-add').click(function(){13 setTimeout(addBindings,1000);14 setTimeout(checkSlider,1000);15 });16 function addBindings(){17 $('.rb_slide_type').unbind('change', checkSlider).bind('change', checkSlider);18 }19 function checkSlider(){20 var type = $('.list-sub-setting').find('.rb_slide_type').val();21 switch(type){22 case 'image':23 $('.rb_slide_hosted').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeOut(100);24 $('textarea').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeOut(100);25 $('.rb_slide_image').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeIn(100);26 break;27 case 'emb_video':28 $('.rb_slide_hosted').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeOut(100);29 $('.rb_slide_image').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeOut(100);30 $('textarea').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeIn(100);31 break;32 case 'self_video':33 $('.rb_slide_image').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeOut(100);34 $('textarea').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeOut(100);35 $('.rb_slide_hosted').parentsUntil('.option-tree-setting-wrap', '.format-settings').fadeIn(100);36 break;37 }38 }39 /* Project setup */40 $('#rb_project_type').unbind('change', checkProject).bind('change', checkProject);41 hideAllProject([$('#rb_project_image')]);42 function checkProject(){43 var type = $('#rb_project_type').val();44 switch(type){45 case 'image':46 hideAllProject([$('#rb_project_image')]);47 break;48 case 'video_emb':49 hideAllProject([$('#rb_project_video_emb')]);50 break;51 case 'video_self':52 hideAllProject([$('#rb_project_video_host_1'),$('#rb_project_video_host_2'),$('#rb_project_video_host_3'),$('#rb_project_video_host_4')]);53 break;54 case 'gallery':55 hideAllProject([$('#rb_project_gallery_settings_array')]);56 break;57 case 'audio':58 hideAllProject([$('#rb_project_audio_1'),$('#rb_project_audio_2')]);59 break;60 case 'link':61 hideAllProject([]);62 break;63 }64 }65 function hideAllProject(array){66 $('#rb_project_image').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);67 $('#rb_project_video_emb').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);68 $('#rb_project_video_emb').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);69 $('#rb_project_video_host_1').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);70 $('#rb_project_video_host_2').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);71 $('#rb_project_video_host_3').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);72 $('#rb_project_video_host_4').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);73 $('#rb_project_audio_1').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);74 $('#rb_project_audio_2').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);75 $('#rb_project_gallery_settings_array').parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeOut(100);76 for(var i=0; i<array.length; i++){77 array[i].parentsUntil('.ot-metabox-wrapper', '.format-settings').stop().fadeIn(100);78 }79 }80 ...

Full Screen

Full Screen

Authentication.test.js

Source:Authentication.test.js Github

copy

Full Screen

1describe('Sign up', () => {2 it('Successful user sign up authenticates the user and redirects to Explore page', () => {3 cy.visit('/')4 cy.get('button').contains('Sign Up').click()5 cy.get('.v-input').contains('Username').siblings().type('e2eTestUser')6 .parentsUntil('.v-form').next().contains('Email').siblings().type('e2eTestUser@gmail.com')7 .parentsUntil('.v-form').next().contains('Password').siblings().type('e2eTestUserPassword')8 .parentsUntil('.row').find('button').contains('Sign Up').click()9 10 cy.contains('.text-h2', 'Explore')11 })12 it("Alert the user if trying to sign up with credentials already in use", () => {13 cy.visit('/')14 cy.get('button').contains('Sign Up').click()15 cy.get('.v-input').contains('Username').siblings().type('e2eTestUser')16 .parentsUntil('.v-form').next().contains('Email').siblings().type('e2eTestUser@gmail.com')17 .parentsUntil('.v-form').next().contains('Password').siblings().type('e2eTestUserPassword')18 .parentsUntil('.row').find('button').contains('Sign Up').click()19 cy.contains('.v-snack__wrapper', 'Username already in use.')20 })21 it("Alert the user in case of missing username", () => {22 cy.visit('/')23 cy.get('button').contains('Sign Up').click()24 cy.get('.v-input').contains('Username').siblings()25 .parentsUntil('.v-form').next().contains('Email').siblings().type('e2eTestUser@gmail.com')26 .parentsUntil('.v-form').next().contains('Password').siblings().type('e2eTestUserPassword')27 .parentsUntil('.row').find('button').contains('Sign Up').click()28 29 cy.contains('.v-text-field__details', "Username can't stay empty.")30 })31 it("Alert the user in case of missing email", () => {32 cy.visit('/')33 cy.get('button').contains('Sign Up').click()34 cy.get('.v-input').contains('Username').siblings().type('e2eTestUser')35 .parentsUntil('.v-form').next().next().contains('Password').siblings().type('e2eTestUserPassword')36 .parentsUntil('.row').find('button').contains('Sign Up').click()37 38 cy.contains('.v-text-field__details', "Email can't stay empty.")39 })40 it("Alert the user in case of missing password", () => {41 cy.visit('/')42 cy.get('button').contains('Sign Up').click()43 cy.get('.v-input').contains('Username').siblings().type('e2eTestUser')44 .parentsUntil('.v-form').next().contains('Email').siblings().type('e2eTestUser@gmail.com')45 .parentsUntil('.row').find('button').contains('Sign Up').click()46 47 cy.contains('.v-text-field__details', "Password can't stay empty.")48 })49})50describe('Sign in', () => {51 it('Successfully signing in authenticates the user and redirects to Explore page', () => {52 cy.visit('/')53 cy.get('.v-input').contains('Email').siblings().type('e2eTestUser@gmail.com')54 .parentsUntil('.v-form').next().contains('Password').siblings().type('e2eTestUserPassword')55 .parentsUntil('.row').find('button').contains('Sign In').click()56 57 cy.contains('.text-h2', 'Explore')58 })59 60 it('Alert user in case of invalid input', () => {61 cy.visit('/')62 cy.get('.v-input').contains('Email').siblings().type('e2eTestUser@gmail')63 .parentsUntil('.v-form').next().contains('Password').siblings().type('e2eTestUserPassword')64 .parentsUntil('.row').find('button').contains('Sign In').click()65 66 cy.contains('.v-snack__wrapper', 'An error has happened signing in')67 })68 it('Alert user in case of no user exists with the given credentials', () => {69 cy.visit('/')70 cy.get('.v-input').contains('Email').siblings().type('anotherUser@gmail.com')71 .parentsUntil('.v-form').next().contains('Password').siblings().type('e2eTestUserPassword')72 .parentsUntil('.row').find('button').contains('Sign In').click()73 74 cy.contains('.v-snack__wrapper', 'No account exists with the given credentials')75 })...

Full Screen

Full Screen

slider.js

Source:slider.js Github

copy

Full Screen

1function InitializeSlider() {2 $('.activate-slider').each(function () {3 $(this).on('click', function () {4 $(this).parentsUntil(".container-slider").parent().find('.overlay-slider').css('width', '100%');5 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('overflow', 'hidden');6 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('width', '0%');7 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('min-height', '35vh');8 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('max-height', '100vh');9 });10 });11 $('.de-activate-slider').each(function () {12 $(this).on('click', function () {13 $(this).parentsUntil(".container-slider").parent().find('.overlay-slider').css('width', '0%');14 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('width', '100%');15 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('height', 'initial');16 });17 });18}19function ManualCloseSlider(divToActivate) {20 $("#" + divToActivate).parentsUntil(".container-slider").parent().find('.overlay-slider').css('width', '0%');21 $("#" + divToActivate).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('width', '100%');22 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('height', 'initial');23}24function ManualOpenSlider(divToActivate) {25 $("#" + divToActivate).parentsUntil(".container-slider").parent().find('.overlay-slider').css('width', '100%');26 $("#" + divToActivate).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('width', '0%');27 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('overflow', 'hidden');28 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('min-height', '35vh');29 $(this).parentsUntil(".container-slider").parent().find('.container-slider-inner').css('max-height', '100vh');...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test Suite', function() 2{3it('My FirstTest case',function() {4cy.get('tr td:nth-child(2)').each(($el, index, $list) => {5const text=$el.text()6if(text.includes("Python"))7{8cy.get('tr td:nth-child(2)').eq(index).next().then(function(price)9{10const priceText=price.text()11expect(priceText).to.equal('25')12})13}14})15})16})

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My first test', function() {2 it('Visits the Kitchen Sink', function() {3 cy.contains('type').click()4 cy.url().should('include', '/commands/actions')5 cy.get('.action-email')6 .parentsUntil('.action-form')7 .find('.action-label')8 .should('contain', 'Email')9 })10})11describe('My first test', function() {12 it('Visits the Kitchen Sink', function() {13 cy.contains('type').click()14 cy.url().should('include', '/commands/actions')15 cy.get('.action-disabled')16 .prev()17 .should('have.attr', 'disabled')18 })19})20describe('My first test', function() {21 it('Visits the Kitchen Sink', function() {22 cy.contains('type').click()23 cy.url().should('include', '/commands/actions')24 cy.get('.action-focus')25 .prevAll()26 .should('have.length', 2)27 })28})29describe('My first test', function() {30 it('Visits the Kitchen Sink', function() {31 cy.contains('type').click()32 cy.url().should('include', '/commands/actions')33 cy.get('.action-focus')34 .prevUntil('.action-cy')35 .should('have.length', 2)36 })37})38describe('My first test', function() {39 it('Visits the Kitchen Sink', function() {40 cy.contains('type').click()41 cy.url().should

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', function() {2 it('Does not do much!', function() {3 cy.get('div').parentsUntil('body').should('have.length', 4)4 })5})6describe('My First Test', function() {7 it('Does not do much!', function() {8 cy.get('div').parentsUntil('body').should('have.length', 4)9 })10})11describe('My First Test', function() {12 it('Does not do much!', function() {13 cy.get('div').parentsUntil('body').should('have.length', 4)14 })15})16describe('My First Test', function() {17 it('Does not do much!', function() {18 cy.get('div').parentsUntil('body').should('have.length', 4)19 })20})21describe('My First Test', function() {22 it('Does not do much!', function() {23 cy.get('div').parentsUntil('body').should('have.length', 4)24 })25})26describe('My First Test', function() {27 it('Does not do much!', function() {28 cy.get('div').parentsUntil('body').should('have.length', 4)29 })30})31describe('My First Test', function() {32 it('Does not do much!', function() {33 cy.get('div').parentsUntil('body').should('have.length', 4

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test Parent', () => {2 it('Test Parent', () => {3 cy.contains('type').parentsUntil('form').should('have.class', 'action')4 })5})6describe('Test Parent', () => {7 it('Test Parent', () => {8 cy.contains('type').parentsUntil('form').should('have.class', 'action')9 })10})11describe('Test Parent', () => {12 it('Test Parent', () => {13 cy.contains('type').parentsUntil('form').should('have.class', 'action')14 })15})16describe('Test Parent', () => {17 it('Test Parent', () => {18 cy.contains('type').parentsUntil('form').should('have.class', 'action')19 })20})21describe('Test Parent', () => {22 it('Test Parent', () => {23 cy.contains('type').parentsUntil('form').should('have.class', 'action')24 })25})26describe('Test Parent', () => {27 it('Test Parent', () => {28 cy.contains('type').parentsUntil('form').should('have.class', 'action')29 })30})31describe('Test Parent', () => {32 it('Test Parent', () => {33 cy.contains('type').parentsUntil('form').should('have.class', 'action')34 })35})36describe('Test Parent', () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1it('test', () => {2 cy.get('div').parentsUntil('body').should('contain', 'Hello World')3})4Cypress.Commands.add('parentsUntil', { prevSubject: 'optional' }, (subject, selector) => {5 if (subject) {6 return cy.wrap(subject).parentsUntil(selector)7 }8 return cy.get('body').parentsUntil(selector)9})10it('test', () => {11 cy.get('div').parentsUntil('body').should('contain', 'Hello World')12})

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Cypress Demo', function() {2 it('Cypress Demo Test Case', function() {3 cy.get('tr td:nth-child(2)').parentsUntil('table')4 })5})6describe('Cypress Demo', function() {7 it('Cypress Demo Test Case', function() {8 cy.get('tr td:nth-child(2)').parents()9 })10})11describe('Cypress Demo', function() {12 it('Cypress Demo Test Case', function() {13 cy.get('tr td:nth-child(2)').parents('table')14 })15})16describe('Cypress Demo', function() {17 it('Cypress Demo Test Case', function() {18 cy.get('tr td:nth-child(2)').parents('table')19 })20})21describe('Cypress Demo', function() {22 it('Cypress Demo Test Case', function() {23 cy.get('tr td:nth-child(2)').parents('table')24 })25})

Full Screen

Using AI Code Generation

copy

Full Screen

1cy.get('.parent').parentsUntil('.grandparent', 'div')2cy.get('.child1').parents('div')3cy.get('.child1').parent('div')4cy.get('.parent').nextUntil('.grandparent', 'div')5cy.get('.child1').next('div')6cy.get('.parent').prevUntil('.grandparent', 'div')7cy.get('.child1').prev('div')8cy.get('.child1').last('div')

Full Screen

Using AI Code Generation

copy

Full Screen

1it('Test', () => {2 cy.get('a[href="/docs"]').parentsUntil('nav').should('have.class', 'active')3})47. Cypress’s parents() method5it('Test', () => {6 cy.get('a[href="/docs"]').parents().should('have.class', 'active')7})88. Cypress’s closest() method9it('Test', () => {10 cy.get('a[href="/docs"]').closest('ul').should('have.class', 'nav')11})129. Cypress’s next() method13it('Test', () => {14 cy.get('a[href="/docs"]').next().should('have.class', 'active')15})1610. Cypress’s nextUntil() method17it('Test', () => {18 cy.get('a[href="/docs"]').nextUntil('li').should('have.class', 'active')19})2011. Cypress’s nextAll() method

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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