How to use closest method in elementium

Best Python code snippet using elementium_python

small-camera-tree.js

Source:small-camera-tree.js Github

copy

Full Screen

...32 initialize: function(options) {33 this.setOptions(options);34 // scrollbar 默认scroll容器的类名为 scrollbarPanel35 var tem = this.options;36 // tem.scrollbar = jQuery(tem.node).html("").closest("div"+ tem.scrollbarNode);37 // tem.scrollbar.tinyscrollbar({thumbSize : 72});38 jQuery(this.options.node).empty();39 this.loadTemplate();40 41 if(tem.orgId && tem.orgId != "null"){42 this.getOrgPathList(tem.orgId);43 }44 this.updateScrollBar();45 },46 getOrgPathList:function(currentOrgId){47 var self = this;48 ajaxModel.getData(self.options.getParentsUrl, {49 orgId: currentOrgId50 }).then(function(res) {51 if (res.code === 200) {52 self.options.orgPathList = res.data.orgPathList.reverse();53 } else {54 notify.warn("网络或服务器异常!");55 }56 });57 },58 loadTemplate:function() {59 var self = this;60 ajaxModel.getTml(self.options.templateUrl).then(function(tmp){61 var tem = self.options;62 self.addHelper();63 tem.template = Handlebars.compile(tmp);64 // if(tem.mode ==="create"){65 self.loadData({"masterOrgId":self.options.defaultRootId},jQuery(tem.node),true);66 // }else if(tem.mode ==="edit"){67 // }68 });69 70 },71 addHelper:function(){72 Handlebars.registerHelper('isTree', function(type,options) {73 if(type === "tree"){return options.fn(); }74 });75 Handlebars.registerHelper("mills2str", function(num) {76 // 依赖base.js Toolkit77 return Toolkit.mills2str(num);78 });79 // 如果是虚拟组织 id则为虚拟组织的 strOrgId (主要用于 编辑回显用)80 Handlebars.registerHelper('changeId', function(id,vid,options) {81 if(vid){82 return vid ;83 }else{84 return id ;85 }86 });87 // 判断是否是虚拟组织 88 Handlebars.registerHelper('isVirtual', function(sid,options) {89 // 如果是虚拟组织 则添加自定义属性 data-vid vorg_id90 if(!sid){return;}91 if(sid.indexOf("vorg_") !== -1){92 return 'data-orgid='+ sid.match(/\d+/)[0] + ' data-vid='+ sid ;93 }94 95 });96 Handlebars.registerHelper('hasNoRight', function(cameraScore,options) {97 var userScore = $("#userEntry").attr("data-score") - 0;98 return userScore < cameraScore ? "disabled" : "";99 });100 },101 render:function(data){102 return this.options.template(data);103 },104 updateScrollBar:function(){105 return ;106 this.options.scrollbar.tinyscrollbar_update('relative');107 },108 bindEvent:function(parentNode,initFlag){109 var self = this;110 var target = parentNode.find("ul li.tree span");111 if(initFlag){112 target = parentNode.find("ul li span");113 }114 // 树节点 span单击事件115 target.on("click",function(event){116 self.addClickEffect(jQuery(this));117 self.processTreeClick(jQuery(this));118 return false;119 });120 // 树节点 span双击事件121 target.on("dblclick",function(event){122 self.processTreeDblClick(jQuery(this));123 });124 // + 点击事件125 target.closest("li").children("i.fold").click(function(){126 var current = jQuery(this).closest("li");127 if(current.attr("data-type") === "tree"){128 if(!current.attr("data-loaded")){129 self.loadData({"masterOrgId":current.attr("data-orgid") || current.attr("data-id")},current,false);130 }else{131 self.toggle(current.children("ul"));132 }133 }134 current.toggleClass("active");135 return false;136 });137 // 叶子节点单击事件138 parentNode.find("ul li.leaf span").on("click",function(event){139 self.addClickEffect(jQuery(this));140 self.processLeafClick(jQuery(this));141 return false;142 });143 // 叶子节双击事件144 parentNode.find("ul li.leaf span").on("dblclick",function(event){145 self.processLeafDblClick(jQuery(this));146 return false;147 });148 // 叶子节点前的图片点击事件149 parentNode.find("ul li.leaf i.leaf").on("click",function(event){150 // 直接调用span的点击事件151 self.processLeafClick(jQuery(this).closest("li").children("span"));152 return false;153 });154 // 选择框点击事件155 if(self.options.selectable){156 parentNode.find("li>i.checkbox").click(function(){157 var tem = jQuery(this);158 if(tem.hasClass("icon0")){159 tem.removeClass("icon0").addClass("icon1");160 }else if(tem.hasClass("icon1")){161 tem.removeClass("icon1").removeClass("icon0");162 }else{ 163 tem.addClass("icon0");164 }165 self.walkUp(tem);166 self.walkDown(tem);167 return false;168 });169 } 170 // 自动展开当前部门171 self.autoExpand();172 },173 autoExpand:function(){174 var self = this;175 176 // 当前部门 暂不展开 length > 0 即可展开177 if(self.options.orgPathList.length > 1){178 jQuery(self.options.node).find("li").each(function(index,item){179 if(parseInt(jQuery(item).attr("data-id"),10) === parseInt(self.options.orgPathList[0],10)){180 self.options.orgPathList.shift();181 jQuery(item).children("i.fold").click();182 }183 });184 }185 186 },187 /*188 * 向上查找189 */ 190 walkUp:function(item){191 var current = item;192 var caller = arguments.callee;193 if(current.closest("li").is("li.root") ){194 return;195 }196 if(current.closest("li").is("li") ){197 var parent = current.closest("li").closest("ul").closest("li").children("i.checkbox");198 if(!(current.hasClass("icon0") || current.hasClass("icon1"))){199 parent.removeClass("icon0").removeClass("icon1");200 caller(parent);201 }else{202 if(current.hasClass("icon0")){203 var result = true;204 current.closest("li").siblings("li").children("i.checkbox").each(function(index,checkbox){205 if(!jQuery(checkbox).hasClass("icon0")){206 result = false;207 }208 });209 var ckb = item.closest("li").closest("ul").closest("li").children("i.checkbox");210 if(result){211 ckb.addClass("icon0").removeClass("icon1");212 }else{213 ckb.removeClass("icon0").removeClass("icon1");214 }215 caller(parent);216 }217 if(current.hasClass("icon1")){218 var result1 = true;219 current.closest("li").siblings("li").children("i.checkbox").each(function(index,checkbox){220 if(!jQuery(checkbox).hasClass("icon1")){221 result1 = false;222 }223 });224 var ckb1 = item.closest("li").closest("ul").closest("li").children("i.checkbox");225 if(result1){226 ckb1.addClass("icon1").removeClass("icon0");227 }else{228 ckb1.removeClass("icon0").removeClass("icon1");229 }230 caller(parent);231 }232 }233 }234 },235 /*236 * 向下查找237 */238 walkDown:function(item){239 var caller = arguments.callee;240 var current = item;241 if(current.closest("li").is("li.tree")){242 if(!(current.hasClass("icon0") || current.hasClass("icon1"))){243 current.closest("li").children("ul").children("li").children("i.checkbox").each(function(index,tem){244 var child = jQuery(tem);245 child.removeClass("icon0").removeClass("icon1");246 caller(child);247 });248 }else{249 if(current.hasClass("icon0")){250 current.closest("li").children("ul").children("li").children("i.checkbox").each(function(index,tem){251 var child = jQuery(tem);252 if(!child.hasClass("icon0")){253 child.addClass("icon0").removeClass("icon1");254 }255 caller(child);256 });257 }258 if(current.hasClass("icon1")){259 current.closest("li").children("ul").children("li").children("i.checkbox").each(function(index,tem){260 var child = jQuery(tem);261 if(!child.hasClass("icon1")){262 child.addClass("icon1").removeClass("icon0");263 }264 caller(child);265 });266 }267 268 }269 }270 },271 /*272 * 获取改变的数据(需要删除的放在数组前边 [正式,临时] 默认放在正式里边)273 */ 274 getEditData:function(){275 276 var outData = {"formal":[],"temp":[]};277 var self = this;278 (function walk(item){279 // item 为li元素280 var caller = arguments.callee;281 var current = item;282 if(current.attr("data-default")){283 // 正式 -> 临时284 if(current.attr("data-default") === "1" && current.children("i.checkbox").is(".icon0") && !current.children("i.checkbox").is(".icon1")){285 // 若为 虚拟组织286 if(current.attr("data-vid")){287 outData.temp.push({288 "id":current.attr("data-orgid"),289 "resourceType":"2",290 "isResource":"0",291 "isReject":"0",292 "isDelete":"0",293 "vOrgId":current.attr("data-vid")294 });295 }else{296 outData.temp.push({297 "id":current.attr("data-id"),298 "resourceType":"2",299 "isResource":"0",300 "isReject":"0",301 "isDelete":"0"302 });303 }304 305 }306 // 正式 -> 无307 if(current.attr("data-default") === "1" && !current.children("i.checkbox").is(".icon0") && !current.children("i.checkbox").is(".icon1")){308 // 删除数据309 if(current.attr("data-vid")){310 outData.formal.unshift({311 "id":current.attr("data-orgid"),312 "resourceType":"2",313 "isResource":"0",314 "isReject":"0",315 "isDelete":"1",316 "vOrgId":current.attr("data-vid")317 });318 }else{319 outData.formal.unshift({320 "id":current.attr("data-id"),321 "resourceType":"2",322 "isResource":"0",323 "isReject":"0",324 "isDelete":"1"325 });326 }327 328 // 遍历其子节点329 current.children("ul").children("li").children("i.checkbox").each(function(index,tem){330 var child = jQuery(tem);331 // 临时332 if(child.is("i.icon0")){333 if(child.closest("li").attr("data-res") === "camera"){334 // console.log("摄像机:"+child.closest("li").attr("data-name")+" 临时>>添加")335 outData.temp.push({336 "id":child.closest("li").attr("data-id"),337 "resourceType":"2",338 "isResource":"1",339 "isReject":"0",340 "isDelete":"0"341 });342 }else{343 // 若为虚拟组织344 if(child.closest("li").attr("data-vid")){345 outData.temp.push({346 "id":child.closest("li").attr("data-orgid"),347 "resourceType":"2",348 "isResource":"0",349 "isReject":"0",350 "isDelete":"0",351 "vOrgId":child.closest("li").attr("data-vid")352 });353 }else{354 outData.temp.push({355 "id":child.closest("li").attr("data-id"),356 "resourceType":"2",357 "isResource":"0",358 "isReject":"0",359 "isDelete":"0"360 });361 }362 363 364 }365 // 正式 366 }else if(child.is("i.icon1")){367 if(child.closest("li").attr("data-res") === "camera"){368 // console.log("摄像机:"+child.closest("li").attr("data-name")+" 正式>>添加")369 outData.formal.push({370 "id":child.closest("li").attr("data-id"),371 "resourceType":"2",372 "isResource":"1",373 "isReject":"0",374 "isDelete":"0"375 });376 }else{377 if(child.closest("li").attr("data-vid")){378 outData.formal.push({379 "id":child.closest("li").attr("data-orgid"),380 "resourceType":"2",381 "isResource":"0",382 "isReject":"0",383 "isDelete":"0",384 "vOrgId":child.closest("li").attr("data-vid")385 });386 }else{387 outData.formal.push({388 "id":child.closest("li").attr("data-id"),389 "resourceType":"2",390 "isResource":"0",391 "isReject":"0",392 "isDelete":"0"393 });394 } 395 396 }397 398 }else{399 // 遍历展开过的400 if(child.closest("li").attr("data-loaded")){401 caller(child.closest("li"));402 }403 }404 });405 }406 // 临时 -> 正式 407 if(current.attr("data-default") === "0" && current.children("i.checkbox").is(".icon1") && !current.children("i.checkbox").is(".icon0")){408 if(current.attr("data-vid")){409 outData.formal.push({410 "id":current.attr("data-orgid"),411 "resourceType":"2",412 "isResource":"0",413 "isReject":"0",414 "isDelete":"0",415 "vOrgId":current.attr("data-vid")416 });417 }else{418 outData.formal.push({419 "id":current.attr("data-id"),420 "resourceType":"2",421 "isResource":"0",422 "isReject":"0",423 "isDelete":"0"424 });425 }426 427 }428 // 临时 -> 无 429 if(current.attr("data-default") === "0" && !current.children("i.checkbox").is(".icon1") && !current.children("i.checkbox").is(".icon0")){430 if(current.attr("data-vid")){431 outData.formal.unshift({432 "id":current.attr("data-orgid"),433 "resourceType":"2",434 "isResource":"0",435 "isReject":"0",436 "isDelete":"1",437 "vOrgId":current.attr("data-vid")438 });439 }else{440 outData.formal.unshift({441 "id":current.attr("data-id"),442 "resourceType":"2",443 "isResource":"0",444 "isReject":"0",445 "isDelete":"1"446 });447 }448 449 // 遍历其子节点450 current.children("ul").children("li").children("i.checkbox").each(function(index,tem){451 var child = jQuery(tem);452 // 临时453 if(child.is("i.icon0")){454 if(child.closest("li").attr("data-res") === "camera"){455 // console.log("摄像机:"+child.closest("li").attr("data-name")+" >>默认非勾选")456 outData.temp.push({457 "id":child.closest("li").attr("data-id"),458 "resourceType":"2",459 "isResource":"1",460 "isReject":"0",461 "isDelete":"0"462 });463 }else{464 // 该组织为虚拟组织465 if(child.closest("li").attr("data-vid")){466 outData.temp.push({467 "id":child.closest("li").attr("data-orgid"),468 "resourceType":"2",469 "isResource":"0",470 "isReject":"0",471 "isDelete":"0",472 "vOrgId":child.closest("li").attr("data-vid")473 });474 }else{475 outData.temp.push({476 "id":child.closest("li").attr("data-id"),477 "resourceType":"2",478 "isResource":"0",479 "isReject":"0",480 "isDelete":"0"481 });482 }483 484 485 }486 // 正式 487 }else if(child.is("i.icon1")){488 if(child.closest("li").attr("data-res") === "camera"){489 // console.log("摄像机:"+child.closest("li").attr("data-name")+" >>默认非勾选")490 outData.formal.push({491 "id":child.closest("li").attr("data-id"),492 "resourceType":"2",493 "isResource":"1",494 "isReject":"0",495 "isDelete":"0"496 });497 }else{498 if(child.closest("li").attr("data-vid")){499 outData.formal.push({500 "id":child.closest("li").attr("data-orgid"),501 "resourceType":"2",502 "isResource":"0",503 "isReject":"0",504 "isDelete":"0",505 "vOrgId":child.closest("li").attr("data-vid")506 });507 }else{508 outData.formal.push({509 "id":child.closest("li").attr("data-id"),510 "resourceType":"2",511 "isResource":"0",512 "isReject":"0",513 "isDelete":"0"514 });515 }516 517 518 }519 520 }else{521 // 遍历展开过的522 if(child.closest("li").attr("data-loaded")){523 caller(child.closest("li"));524 }525 }526 });527 }528 }else{529 // 初始未勾选530 // 选为临时531 if(current.children("i.checkbox").is(".icon0")){532 // 虚拟组织533 if(current.attr("data-vid")){534 outData.temp.push({535 "id":current.attr("data-orgid"),536 "resourceType":"2",537 "isResource":"0",538 "isReject":"0",539 "isDelete":"0",540 "vOrgId":current.attr("data-vid")541 });542 }else{543 outData.temp.push({544 "id":current.attr("data-id"),545 "resourceType":"2",546 "isResource":"0",547 "isReject":"0",548 "isDelete":"0"549 });550 }551 552 // 选为正式的553 }else if(current.children("i.checkbox").is(".icon1")){554 if(current.attr("data-vid")){555 outData.formal.push({556 "id":current.attr("data-orgid"),557 "resourceType":"2",558 "isResource":"0",559 "isReject":"0",560 "isDelete":"0",561 "vOrgId":current.attr("data-vid")562 });563 }else{564 outData.formal.push({565 "id":current.attr("data-id"),566 "resourceType":"2",567 "isResource":"0",568 "isReject":"0",569 "isDelete":"0"570 });571 }572 573 }else{574 // 遍历其子节点575 current.children("ul").children("li").children("i.checkbox").each(function(index,tem){576 var child = jQuery(tem);577 var parentLi= child.closest("li"); 578 // 无 -> 临时 579 if(child.is("i.icon0") && !parentLi.attr("data-default")){580 if(child.closest("li").attr("data-res") === "camera"){581 // console.log("摄像机:"+child.closest("li").attr("data-name")+" 无>>临时");582 outData.temp.push({583 "id":child.closest("li").attr("data-id"),584 "resourceType":"2",585 "isResource":"1",586 "isReject":"0",587 "isDelete":"0"588 });589 }else{590 // console.log("组织:"+child.closest("li").attr("data-name")+" 无>>临时");591 // 虚拟组织592 if(child.closest("li").attr("data-vid")){593 outData.temp.push({594 "id":child.closest("li").attr("data-orgid"),595 "resourceType":"2",596 "isResource":"0",597 "isReject":"0",598 "isDelete":"0",599 "vOrgId":child.closest("li").attr("data-vid")600 });601 }else{602 outData.temp.push({603 "id":child.closest("li").attr("data-id"),604 "resourceType":"2",605 "isResource":"0",606 "isReject":"0",607 "isDelete":"0"608 });609 }610 611 612 } 613 }614 // 无 -> 正式615 if(child.is("i.icon1") && !parentLi.attr("data-default")){616 if(child.closest("li").attr("data-res") === "camera"){617 // console.log("摄像机:"+child.closest("li").attr("data-name")+" 无>>正式")618 outData.formal.push({619 "id":child.closest("li").attr("data-id"),620 "resourceType":"2",621 "isResource":"1",622 "isReject":"0",623 "isDelete":"0"624 });625 }else{626 // console.log("组织:"+child.closest("li").attr("data-name")+" 无>>正式")627 if(child.closest("li").attr("data-vid")){628 outData.formal.push({629 "id":child.closest("li").attr("data-orgid"),630 "resourceType":"2",631 "isResource":"0",632 "isReject":"0",633 "isDelete":"0",634 "vOrgId":child.closest("li").attr("data-vid")635 });636 }else{637 outData.formal.push({638 "id":child.closest("li").attr("data-id"),639 "resourceType":"2",640 "isResource":"0",641 "isReject":"0",642 "isDelete":"0"643 });644 }645 646 647 } 648 }649 // 临时 -> 正式650 if(child.is("i.icon1") && !child.is("i.icon0") && parentLi.attr("data-default") === "0"){651 if(child.closest("li").attr("data-res") === "camera"){652 // console.log("摄像机:"+child.closest("li").attr("data-name")+" >>临时 -->> 正式")653 outData.formal.push({654 "id":child.closest("li").attr("data-id"),655 "resourceType":"2",656 "isResource":"1",657 "isReject":"0",658 "isDelete":"0"659 });660 }else{661 // console.log("组织:"+child.closest("li").attr("data-name")+" >>临时 -->> 正式")662 if(child.closest("li").attr("data-vid")){663 outData.formal.push({664 "id":child.closest("li").attr("data-orgid"),665 "resourceType":"2",666 "isResource":"0",667 "isReject":"0",668 "isDelete":"0",669 "vOrgId":child.closest("li").attr("data-vid")670 });671 }else{672 outData.formal.push({673 "id":child.closest("li").attr("data-id"),674 "resourceType":"2",675 "isResource":"0",676 "isReject":"0",677 "isDelete":"0"678 });679 }680 681 }682 683 }684 // 临时 -> 无685 if(!child.is("i.icon0") && !child.is("i.icon1") && parentLi.attr("data-default") === "0"){686 if(child.closest("li").attr("data-res") === "camera"){687 // console.log("摄像机:"+child.closest("li").attr("data-name")+" >>临时 - >> 无")688 outData.formal.unshift({689 "id":child.closest("li").attr("data-id"),690 "resourceType":"2",691 "isResource":"1",692 "isReject":"0",693 "isDelete":"1"694 });695 }else{696 // console.log("组织:"+child.closest("li").attr("data-name")+" >>临时 - >> 无")697 698 if(child.closest("li").attr("data-vid")){699 outData.formal.unshift({700 "id":child.closest("li").attr("data-orgid"),701 "resourceType":"2",702 "isResource":"0",703 "isReject":"0",704 "isDelete":"1",705 "vOrgId":child.closest("li").attr("data-vid")706 });707 }else{708 outData.formal.unshift({709 "id":child.closest("li").attr("data-id"),710 "resourceType":"2",711 "isResource":"0",712 "isReject":"0",713 "isDelete":"1"714 });715 }716 717 718 }719 720 }721 // 正式 -> 临时 722 if(child.is("i.icon0") && !child.is("i.icon1") && parentLi.attr("data-default") === "1"){723 if(child.closest("li").attr("data-res") === "camera"){724 // console.log("摄像机:"+child.closest("li").attr("data-name")+" >>正式 -->> 临时")725 outData.temp.push({726 "id":child.closest("li").attr("data-id"),727 "resourceType":"2",728 "isResource":"1",729 "isReject":"0",730 "isDelete":"0"731 });732 }else{733 // console.log("组织:"+child.closest("li").attr("data-name")+" >>正式 -->> 临时")734 if(child.closest("li").attr("data-vid")){735 outData.temp.push({736 "id":child.closest("li").attr("data-orgid"),737 "resourceType":"2",738 "isResource":"0",739 "isReject":"0",740 "isDelete":"0",741 "vOrgId":child.closest("li").attr("data-vid")742 });743 }else{744 outData.temp.push({745 "id":child.closest("li").attr("data-id"),746 "resourceType":"2",747 "isResource":"0",748 "isReject":"0",749 "isDelete":"0"750 });751 }752 753 754 }755 756 }757 // 正式 -> 无758 if(!child.is("i.icon1") && !child.is("i.icon0") && parentLi.attr("data-default") === "1"){759 if(child.closest("li").attr("data-res") === "camera"){760 // console.log("摄像机:"+child.closest("li").attr("data-name")+" >>正式 -->无")761 outData.formal.unshift({762 "id":child.closest("li").attr("data-id"),763 "resourceType":"2",764 "isResource":"1",765 "isReject":"0",766 "isDelete":"1"767 });768 }else{769 // console.log("组织:"+child.closest("li").attr("data-name")+" >>正式 -->无")770 // 虚拟组织771 if(child.closest("li").attr("data-vid")){772 outData.formal.unshift({773 "id":child.closest("li").attr("data-orgid"),774 "resourceType":"2",775 "isResource":"0",776 "isReject":"0",777 "isDelete":"1",778 "vOrgId":child.closest("li").attr("data-vid")779 });780 }else{781 outData.formal.unshift({782 "id":child.closest("li").attr("data-id"),783 "resourceType":"2",784 "isResource":"0",785 "isReject":"0",786 "isDelete":"1"787 });788 }789 790 791 }792 793 }794 if(!child.is("i.icon0") && !child.is("i.icon1")){795 // 遍历展开过的796 if(child.closest("li").attr("data-loaded")){797 caller(child.closest("li"));798 }799 }800 });801 }802 }803 804 })(jQuery(self.options.node).children("ul").children("li"));805 // console.log(outData.length)806 return outData;807 },808 /*809 * 添加摄像机权限810 */811 getCreateData:function(){812 var outData ={"formal":[],"temp":[]};813 var self = this;814 // 匹配数组id ()815 (function walk(item){816 // item 为li元素817 var caller = arguments.callee;818 var current = item;819 // 当前元素勾选820 if(current.children("i.checkbox").is(".icon0")){821 // 如果是虚拟组织822 if(current.attr("data-vid")){823 outData.temp.push({824 "id":current.attr("data-orgid"),825 "resourceType":"2",826 "isResource":"0",827 "isReject":"0",828 "isDelete":"0",829 "vOrgId":current.attr("data-vid")830 });831 // 非虚拟组织832 }else{833 outData.temp.push({834 "id":current.attr("data-id"),835 "resourceType":"2",836 "isResource":"0",837 "isReject":"0",838 "isDelete":"0"839 });840 }841 842 }else if(current.children("i.checkbox").is(".icon1")){843 // 虚拟组织844 if(current.attr("data-vid")){845 outData.formal.push({846 "id":current.attr("data-orgid"),847 "resourceType":"2",848 "isResource":"0",849 "isReject":"0",850 "isDelete":"0",851 "vOrgId":current.attr("data-vid")852 });853 }else{854 outData.formal.push({855 "id":current.attr("data-id"),856 "resourceType":"2",857 "isResource":"0",858 "isReject":"0",859 "isDelete":"0"860 });861 }862 863 }else{864 current.children("ul").children("li").children("i.checkbox").each(function(index,tem){865 var child = jQuery(tem);866 if(child.is("i.icon0")){867 // 摄像机868 if(child.closest("li").attr("data-res") === "camera"){869 outData.temp.push({870 "id":child.closest("li").attr("data-id"),871 "resourceType":"2",872 "isResource":"1",873 "isReject":"0",874 "isDelete":"0"875 });876 }else{877 // 组织878 // 虚拟组织879 if(child.closest("li").attr("data-vid")){880 outData.temp.push({881 "id":child.closest("li").attr("data-orgid"),882 "resourceType":"2",883 "isResource":"0",884 "isReject":"0",885 "isDelete":"0",886 "vOrgId":child.closest("li").attr("data-vid")887 });888 }else{889 outData.temp.push({890 "id":child.closest("li").attr("data-id"),891 "resourceType":"2",892 "isResource":"0",893 "isReject":"0",894 "isDelete":"0"895 });896 }897 }898 899 }else if(child.is("i.icon1")){900 // 摄像机901 if(child.closest("li").attr("data-res") === "camera"){902 outData.formal.push({903 "id":child.closest("li").attr("data-id"),904 "resourceType":"2",905 "isResource":"1",906 "isReject":"0",907 "isDelete":"0"908 });909 }else{910 // 组织911 // 虚拟组织912 if(child.closest("li").attr("data-vid")){913 outData.formal.push({914 "id":child.closest("li").attr("data-orgid"),915 "resourceType":"2",916 "isResource":"0",917 "isReject":"0",918 "isDelete":"0",919 "vOrgId":child.closest("li").attr("data-vid")920 });921 }else{922 outData.formal.push({923 "id":child.closest("li").attr("data-id"),924 "resourceType":"2",925 "isResource":"0",926 "isReject":"0",927 "isDelete":"0"928 });929 }930 }931 932 }else{933 // 只遍历展开过的934 if(child.closest("li").attr("data-loaded")){935 caller(child.closest("li"));936 }937 938 }939 });940 }941 942 })(jQuery(self.options.node).children("ul").children("li"));943 return outData;944 },945 /*946 * 添加点击样式947 */948 addClickEffect:function(element) {949 var node = element.closest("li");950 (function(el) {951 if(!el.is(".cur")){952 el.addClass("cur");953 }954 el.siblings("li").removeClass("cur").find("li").removeClass("cur");955 if (el.closest("ul").closest("li").attr("data-id")) {956 arguments.callee(el.closest("ul").closest("li"));957 }958 })(node);959 node.find("li").removeClass("cur");960 },961 /*962 * 处理叶子节点点击事件963 */964 processLeafClick:function(el){965 this.options.leafClick(el);966 },967 processLeafDblClick:function(el){968 this.options.leafDblClick(el);969 },970 processTreeClick:function(el){971 this.options.treeClick(el);972 },973 processTreeDblClick:function(el){974 this.options.treeDblClick(el);975 },976 /*977 * 控制元素的显示/隐藏978 */979 toggle:function(el){980 if(el.css("display") === "none"){981 el.css("display","block");982 }else{983 el.css("display","none");984 }985 this.updateScrollBar();986 },987 /*988 * 输出改变的数据989 */ 990 getOutPutData:function(){991 if(this.options.mode ==="create"){992 return this.getCreateData();993 }else if(this.options.mode ==="edit"){994 return this.getEditData();995 }else{996 return [];997 }998 },999 /*1000 * 初始化默认勾选改部门下的资源1001 */1002 selectEl:function(){1003 // 默认将当前所在组织勾选1004 var self = this;1005 if(self.options.mode === "create"){1006 // 默认勾选该组织1007 if(self.options.orgId){1008 jQuery(self.options.node).find("li[data-id='"+self.options.orgId+"']").each(function(index,item){1009 var el = jQuery(item);1010 if(el.attr("data-res") === "org"){1011 var checkbox = el.children("i.checkbox");1012 if(!checkbox.hasClass("icon1") && !checkbox.attr("data-check")){1013 checkbox.addClass("icon1");1014 checkbox.attr("data-check","1");1015 }1016 }1017 });1018 }1019 }else{1020 // 编辑状态,勾选默认值1021 var orgs = self.options.defaultOrgs;1022 var cameras = self.options.defaultCameras;1023 // 正式组织1024 for(var i = orgs.formal.length-1;i>=0;i--){1025 // 默认组织勾选 并添加 data-default 属性1026 jQuery(self.options.node).find("li[data-id='"+orgs.formal[i]+"']").each(function(index,item){1027 var el = jQuery(item);1028 if(el.attr("data-res") === "org"){1029 var checkbox = el.children("i.checkbox");1030 if(!checkbox.hasClass("icon1") && !checkbox.attr("data-check")){1031 checkbox.addClass("icon1").removeClass("icon0");1032 checkbox.attr("data-check","1");1033 }1034 el.attr("data-default","1");1035 }1036 });1037 }1038 // 临时组织1039 for(var i1 = orgs.temp.length-1;i1>=0;i1--){1040 // 默认组织勾选 并添加 data-default 属性1041 jQuery(self.options.node).find("li[data-id='"+orgs.temp[i1]+"']").each(function(index,item){1042 var el = jQuery(item);1043 if(el.attr("data-res") === "org"){1044 var checkbox = el.children("i.checkbox");1045 if(!checkbox.hasClass("icon0") && !checkbox.attr("data-check")){1046 checkbox.addClass("icon0").removeClass("icon1");1047 checkbox.attr("data-check","1");1048 }1049 el.attr("data-default","0");1050 }1051 });1052 }1053 //筛选摄像机(正式)1054 for(var j = cameras.formal.length-1;j>=0;j--){1055 // 默认摄像机勾选 并添加 data-default 属性1056 jQuery(self.options.node).find("li[data-id='"+cameras.formal[j]+"']").each(function(index,item){1057 var el = jQuery(item);1058 if(el.attr("data-res") === "camera"){1059 var checkbox = el.children("i.checkbox");1060 if(!checkbox.hasClass("icon1") && !checkbox.attr("data-check")){1061 checkbox.addClass("icon1").removeClass("icon0");1062 checkbox.attr("data-check","1");1063 }1064 el.attr("data-default","1");1065 }1066 });1067 }1068 // 临时 摄像机1069 for(var j1 = cameras.temp.length-1;j1>=0;j1--){1070 // 默认摄像机勾选 并添加 data-default 属性1071 jQuery(self.options.node).find("li[data-id='"+cameras.temp[j1]+"']").each(function(index,item){1072 var el = jQuery(item);1073 if(el.attr("data-res") === "camera"){1074 var checkbox = el.children("i.checkbox");1075 if(!checkbox.hasClass("icon0") && !checkbox.attr("data-check")){1076 checkbox.addClass("icon0").removeClass("icon1");1077 checkbox.attr("data-check","1");1078 }1079 el.attr("data-default","0");1080 }1081 });1082 }1083 }1084 1085 1086 },1087 /**1088 * 构建url地址 添加额外的参数1089 */1090 addExtraParams:function(url,params){1091 if(url.indexOf("?") !== -1){1092 url = url + "&" + jQuery.param(params);1093 }else{1094 url = url + "?" + jQuery.param(params);1095 }1096 return url;1097 },1098 /**1099 * 分多次插入dom结构 防止浏览器卡死1100 * @author chencheng1101 * @date 2015-03-231102 * @param {Function} callback [description]1103 * @return {[type]} [description]1104 */1105 multiInsertDom:function(params,callback){1106 var cameras = params.cameras,1107 parentNode = params.parentNode,1108 pSize = 30,1109 curPage = 1,1110 pages = Math.ceil(cameras.length / pSize);1111 delete params.parentNode;1112 delete params.cameras;1113 // 如果返回数据中包含组织和摄像机,先处理组织1114 if(params.orgs.length > 0){1115 parentNode.append(params.context.render(params));1116 if(pages === 0){1117 callback(); // 只有组织1118 }1119 }1120 delete params.orgs;1121 1122 (function(){1123 var caller = arguments.callee ,1124 temArr = cameras.slice((curPage - 1) * pSize, curPage * pSize);1125 params.cameras = temArr;1126 parentNode.append(params.context.render(params));1127 if(curPage <= pages){1128 if(curPage === pages){1129 callback();1130 return;1131 }1132 curPage ++;1133 setTimeout(caller,100);1134 }1135 })();1136 },1137 /*1138 * 向页面中添加html1139 */1140 appendHTML:function(receiveData,receiveData2,parentNode,context,init){1141 parentNode.attr("data-loaded",1);1142 var level = 1,1143 selectClass = "";1144 if(!init){1145 level = parseInt(parentNode.attr("data-tree-level"),10)+1;1146 }1147 if(context.options.selectable){1148 if(parentNode.children("i.checkbox").is("i.icon0")){1149 selectClass = "icon0";1150 }else if(parentNode.children("i.checkbox").is("i.icon1")){1151 selectClass = "icon1";1152 }1153 }1154 context.multiInsertDom({1155 "orgs":receiveData,1156 "cameras":receiveData2,1157 "level":level,1158 "init": init,1159 "context":context,1160 "selectable": context.options.selectable,1161 "selected": selectClass,1162 "parentNode":parentNode1163 },function(){1164 if(context.options.selectable){1165 context.selectEl();1166 }1167 context.updateScrollBar();1168 context.bindEvent(parentNode,init);1169 });1170 1171 },1172 /*1173 * 加载数据1174 */1175 loadData:function(params,parentNode,initFlag){ 1176 // 解决click事件 防止重复请求1177 parentNode.children("i.fold").unbind("click");1178 var self = this,1179 url = self.options.url,1180 getRootFlag = false,1181 requestType = "get"; 1182 if(parseInt(params.masterOrgId,10) === 0){1183 url = self.options.rootUrl;1184 params = null;1185 getRootFlag = true;1186 }1187 if(self.options.queryKey !== ""){1188 params.name = self.options.queryKey;1189 url = self.options.searchUrl;1190 requestType = "post";1191 }1192 // 如果是虚拟组织1193 if(parentNode.attr("data-vid")){1194 url = self.addExtraParams(url,{"vOrgId":parentNode.attr("data-vid")});1195 }1196 var custom = {1197 type:requestType,1198 setTimeout:60000,1199 beforeSend:function(){1200 parentNode.append("<ul id='loading'><li><div class='no-data'><i class='loading-img'/></i>正在加载…</div></li></ul>");1201 },1202 complete:function(){1203 if(parentNode.children("ul#loading")){1204 parentNode.children("ul#loading").remove();1205 }1206 // 回复click事件1207 parentNode.children("i.fold").on("click",function(event){1208 // self.processTreeClick(jQuery(this));1209 var current = jQuery(this).closest("li");1210 if(current.attr("data-type") === "tree"){1211 if(!current.attr("data-loaded")){1212 self.loadData({"masterOrgId":current.attr("data-id")},current,false);1213 }else{1214 self.toggle(current.children("ul"));1215 }1216 }1217 current.toggleClass("active");1218 return false;1219 });1220 }1221 };1222 ajaxModel.getData(url, params, custom).then(function(res) {1223 var receiveData = [],...

Full Screen

Full Screen

jr-insta-admin.js

Source:jr-insta-admin.js Github

copy

Full Screen

...15 // Hide Custom Url if image link is not set to custom url16 $('body').on('change', '.jr-container select[id$="images_link"]', function (e) {17 var images_link = $(this);18 if (images_link.val() != 'custom_url') {19 images_link.closest('.jr-container').find('input[id$="custom_url"]').val('').parent().animate({20 opacity: 'hide',21 height: 'hide'22 }, 200);23 } else {24 images_link.closest('.jr-container').find('input[id$="custom_url"]').parent().animate({25 opacity: 'show',26 height: 'show'27 }, 200);28 }29 });30 $('body').on('change', '.jr-container input[id$="keep_ratio"]', function (e) {31 var keep_ratio = $(this);32 if (keep_ratio.is(":checked")){33 showClosestSetting(keep_ratio, '.slick_img_size');34 } else {35 hideClosestSetting(keep_ratio, '.slick_img_size');36 }37 });38 $('body').on('change', '.jr-container input[id$="m_keep_ratio"]', function (e) {39 var keep_ratio = $(this);40 if (keep_ratio.is(":checked")){41 showClosestSetting(keep_ratio, '.m_slick_img_size');42 } else {43 hideClosestSetting(keep_ratio, '.m_slick_img_size');44 }45 });46 // Modify options based on template selections47 $('body').on('change', '.jr-container .desk_settings select[id$="template"]', function (){48 modifySettings(this, false);49 });50 $('body').on('change', '.jr-container .mob_settings select[id$="m_template"]', function (){51 modifySettings(this, true);52 });53 function modifySettings(this_object, is_mob){54 var template = $(this_object);55 var prefix = "";56 if (is_mob){57 prefix = "m_";58 }59 if (template.val() === 'thumbs' || template.val() === 'thumbs-no-border') {60 hideClosestSetting(template, '.' + prefix + 'jr-slider-options');61 template.closest('.jr-container').find('input[id$="' + prefix +'columns"]').closest('p').animate({62 opacity: 'show',63 height: 'show'64 }, 200);65 } else {66 showClosestSetting(template, '.' + prefix + 'jr-slider-options');67 template.closest('.jr-container').find('input[id$="' + prefix +'columns"]').closest('p').animate({68 opacity: 'hide',69 height: 'hide'70 }, 200);71 }72 if (template.val() != 'masonry') {73 hideClosestSetting(template, '.' + prefix + 'masonry_settings');74 hideClosestSetting(template, '.' + prefix + 'masonry_notice');75 } else {76 showClosestSetting(template, '.' + prefix + 'masonry_settings');77 showClosestSetting(template, '.' + prefix + 'masonry_notice');78 }79 if (template.val() != 'slick_slider') {80 hideClosestSetting(template, '.' + prefix + 'slick_settings');81 } else {82 showClosestSetting(template, '.' + prefix + 'slick_settings');83 }84 if (template.val() != 'highlight') {85 hideClosestSetting(template, '.' + prefix + 'highlight_settings');86 } else {87 showClosestSetting(template, '.' + prefix + 'highlight_settings');88 }89 if (template.val() != 'showcase'){90 hideClosestSetting(template, '.' + prefix + 'shopifeed_settings');91 $('.isw-linkto').animate({92 opacity: 'show',93 height: 'show'94 }, 200);95 } else {96 showClosestSetting(template, '.' + prefix + 'shopifeed_settings');97 $('.isw-linkto').animate({98 opacity: 'hide',99 height: 'hide'100 }, 200);101 }102 if (template.val() != 'slider' && template.val() != 'slider-overlay') {103 hideClosestSetting(template, '.' + prefix + 'slider_normal_settings');104 } else {105 showClosestSetting(template, '.' + prefix + 'slider_normal_settings');106 }107 if (template.val() === 'highlight' || template.val() === 'slick_slider' || template.val() === 'thumbs' || template.val() === 'thumbs-no-border') {108 hideClosestSetting(template, '.' + prefix + 'words_in_caption');109 } else {110 showClosestSetting(template, '.' + prefix + 'words_in_caption');111 }112 if (template.val() === 'thumbs' || template.val() === 'thumbs-no-border' || template.val() === 'slider' || template.val() === 'slider-overlay') {113 hideClosestSetting(template, 'select[id$="' + prefix + 'images_link"] option[value="popup"]');114 window.image_link_val = template.closest('.jr-container').find('select[id$="' + prefix + 'images_link"]').val();115 } else {116 showClosestSetting(template, 'select[id$="' + prefix + 'images_link"] option[value="popup"]');117 }118 }119 function showClosestSetting(closestFor, selector){120 closestFor.closest('.jr-container').find(selector).animate({121 opacity: 'show',122 height: 'show'123 }, 200);124 }125 function hideClosestSetting(closestFor, selector){126 closestFor.closest('.jr-container').find(selector).animate({127 opacity: 'hide',128 height: 'hide'129 }, 200);130 }131 // Modfiy options when search for is changed132 $('body').on('change', '.jr-container input:radio[id$="search_for"]', function (e) {133 var search_for = $(this);134 if (search_for.val() === 'hashtag') {135 search_for.closest('.jr-container').find('[id$="attachment"]:checkbox').closest('p').animate({136 opacity: 'hide',137 height: 'hide'138 }, 200);139 hideClosestSetting(search_for, 'select[id$="images_link"] option[value="user_url"]');140 hideClosestSetting(search_for, 'select[id$="images_link"] option[value="attachment"]');141 hideClosestSetting(search_for, 'select[id$="description"] option[value="username"]');142 search_for.closest('.jr-container').find('input[id$="blocked_users"]').closest('p').animate({143 opacity: 'show',144 height: 'show'145 }, 200);146 search_for.closest('.jr-container').find('input[id$="blocked_words"]').closest('p').animate({147 opacity: 'hide',148 height: 'hide'149 }, 200);150 search_for.closest('.jr-container').find('input[id$="show_feed_header"]').closest('p').animate({151 opacity: 'hide',152 height: 'hide'153 }, 200);154 $('#img_to_show').animate({opacity: 'hide', height: 'hide'}, 200);155 } else if (search_for.val() === 'username') {156 search_for.closest('.jr-container').find('[id$="attachment"]:checkbox').closest('p').animate({157 opacity: 'show',158 height: 'show'159 }, 200);160 showClosestSetting(search_for, 'select[id$="images_link"] option[value="user_url"]');161 showClosestSetting(search_for, 'select[id$="images_link"] option[value="attachment"]');162 showClosestSetting(search_for, 'select[id$="description"] option[value="username"]');163 search_for.closest('.jr-container').find('input[id$="blocked_users"]').closest('p').animate({164 opacity: 'hide',165 height: 'hide'166 }, 200);167 search_for.closest('.jr-container').find('input[id$="blocked_words"]').closest('p').animate({168 opacity: 'show',169 height: 'show'170 }, 200);171 search_for.closest('.jr-container').find('input[id$="show_feed_header"]').closest('p').animate({172 opacity: 'show',173 height: 'show'174 }, 200);175 $('#img_to_show').animate({opacity: 'hide', height: 'hide'}, 200);176 } else if (search_for.val() === 'account') {177 search_for.closest('.jr-container').find('[id$="attachment"]:checkbox').closest('p').animate({178 opacity: 'hide',179 height: 'hide'180 }, 200);181 hideClosestSetting(search_for, 'select[id$="images_link"] option[value="user_url"]');182 hideClosestSetting(search_for, 'select[id$="images_link"] option[value="attachment"]');183 hideClosestSetting(search_for, 'select[id$="description"] option[value="username"]');184 search_for.closest('.jr-container').find('input[id$="blocked_users"]').closest('p').animate({185 opacity: 'hide',186 height: 'hide'187 }, 200);188 search_for.closest('.jr-container').find('input[id$="blocked_words"]').closest('p').animate({189 opacity: 'show',190 height: 'show'191 }, 200);192 search_for.closest('.jr-container').find('input[id$="show_feed_header"]').closest('p').animate({193 opacity: 'hide',194 height: 'hide'195 }, 200);196 hideClosestSetting(search_for, 'select[id$="orderby"] option[value="popular-ASC"]');197 hideClosestSetting(search_for, 'select[id$="orderby"] option[value="popular-DESC"]');198 $('#img_to_show').animate({opacity: 'show', height: 'show'}, 200);199 } else if (search_for.val() === 'account_business') {200 search_for.closest('.jr-container').find('[id$="attachment"]:checkbox').closest('p').animate({201 opacity: 'hide',202 height: 'hide'203 }, 200);204 hideClosestSetting(search_for, 'select[id$="images_link"] option[value="user_url"]');205 hideClosestSetting(search_for, 'select[id$="images_link"] option[value="attachment"]');206 hideClosestSetting(search_for, 'select[id$="description"] option[value="username"]');207 search_for.closest('.jr-container').find('input[id$="blocked_users"]').closest('p').animate({208 opacity: 'hide',209 height: 'hide'210 }, 200);211 search_for.closest('.jr-container').find('input[id$="blocked_words"]').closest('p').animate({212 opacity: 'show',213 height: 'show'214 }, 200);215 search_for.closest('.jr-container').find('input[id$="show_feed_header"]').closest('p').animate({216 opacity: 'show',217 height: 'show'218 }, 200);219 showClosestSetting(search_for, 'select[id$="orderby"] option[value="popular-ASC"]');220 showClosestSetting(search_for, 'select[id$="orderby"] option[value="popular-DESC"]');221 $('#img_to_show').animate({opacity: 'show', height: 'show'}, 200);222 }223 });224 // Hide blocked images if not checked attachments225 $('body').on('change', '.jr-container [id$="attachment"]:checkbox', function (e) {226 var attachment = $(this);227 if (this.checked) {228 showClosestSetting(attachment, 'select[id$="images_link"] option[value="attachment"]')229 } else {230 hideClosestSetting(attachment, 'select[id$="images_link"] option[value="attachment"]')231 }232 });233 // Toggle advanced options234 $('body').on('click', '.jr-advanced', function (e) {235 e.preventDefault();236 var advanced_container = $(this).parent().next();237 if (advanced_container.is(':hidden')) {238 $(this).html('[ - Close ]');239 } else {240 $(this).html('[ + Open ]');241 }242 advanced_container.toggle();243 });244 // Remove blocked images with ajax245 $('body').on('click', '.jr-container .jr-delete-instagram-dupes', function (e) {246 e.preventDefault();247 var $this = $(this),248 username = $(this).data("username"),249 ajaxNonce = $(this).closest('.jr-container').find('input[name=delete_insta_dupes_nonce]').val();250 $.ajax({251 type: 'POST',252 url: ajaxurl,253 data: {254 action: 'jr_delete_insta_dupes',255 username: username,256 _ajax_nonce: ajaxNonce257 },258 beforeSend: function () {259 $this.prop('disabled', true);260 $this.closest('.jr-container').find('.jr-spinner').addClass('spinner').css({261 'visibility': 'visible',262 'float': 'none'263 });264 },265 success: function (data, textStatus, XMLHttpRequest) {266 $this.closest('.jr-container').find('.deleted-dupes-info').text('Removed Duplicates: ' + data.deleted);267 },268 complete: function () {269 $this.prop('disabled', false);270 $this.closest('.jr-container').find('.jr-spinner').addClass('spinner').css({271 'visibility': 'hidden',272 'float': 'none'273 });274 },275 error: function (XMLHttpRequest, textStatus, errorThrown) {276 }277 });278 });279 // Delete account with ajax280 $('.wis-delete-account').on('click', function (e) {281 e.preventDefault();282 var c = confirm(wis.remove_account);283 if (!c) {284 return false;285 }286 var $item = $(this),287 $tr = $item.closest('tr'),288 $spinner = $('#wis-delete-spinner-' + $item.data('item_id'));289 $.ajax({290 url: ajaxurl,291 type: 'post',292 data: {293 action: 'wis_delete_account',294 item_id: $item.data('item_id'),295 is_business: $item.data('is_business'),296 _ajax_nonce: wis.nonce297 },298 beforeSend: function () {299 $spinner.addClass('is-active');300 },301 success: function (response) {...

Full Screen

Full Screen

StructureDrag.js

Source:StructureDrag.js Github

copy

Full Screen

1/** global: Craft */2/** global: Garnish */3/**4 * Structure drag class5 */6Craft.StructureDrag = Garnish.Drag.extend(7 {8 structure: null,9 maxLevels: null,10 draggeeLevel: null,11 $helperLi: null,12 $targets: null,13 draggeeHeight: null,14 init: function(structure, maxLevels) {15 this.structure = structure;16 this.maxLevels = maxLevels;17 this.$insertion = $('<li class="draginsertion"/>');18 var $items = this.structure.$container.find('li');19 this.base($items, {20 handle: '.element:first, .move:first',21 helper: $.proxy(this, 'getHelper')22 });23 },24 getHelper: function($helper) {25 this.$helperLi = $helper;26 var $ul = $('<ul class="structure draghelper"/>').append($helper);27 $helper.css('padding-' + Craft.left, this.$draggee.css('padding-' + Craft.left));28 $helper.find('.move').removeAttr('title');29 return $ul;30 },31 onDragStart: function() {32 this.$targets = $();33 // Recursively find each of the targets, in the order they appear to be in34 this.findTargets(this.structure.$container);35 // How deep does the rabbit hole go?36 this.draggeeLevel = 0;37 var $level = this.$draggee;38 do {39 this.draggeeLevel++;40 $level = $level.find('> ul > li');41 } while ($level.length);42 // Collapse the draggee43 this.draggeeHeight = this.$draggee.height();44 this.$draggee.velocity({45 height: 046 }, 'fast', $.proxy(function() {47 this.$draggee.addClass('hidden');48 }, this));49 this.base();50 this.addListener(Garnish.$doc, 'keydown', function(ev) {51 if (ev.keyCode === Garnish.ESC_KEY) {52 this.cancelDrag();53 }54 });55 },56 findTargets: function($ul) {57 var $lis = $ul.children().not(this.$draggee);58 for (var i = 0; i < $lis.length; i++) {59 var $li = $($lis[i]);60 this.$targets = this.$targets.add($li.children('.row'));61 if (!$li.hasClass('collapsed')) {62 this.findTargets($li.children('ul'));63 }64 }65 },66 onDrag: function() {67 if (this._.$closestTarget) {68 this._.$closestTarget.removeClass('draghover');69 this.$insertion.remove();70 }71 // First let's find the closest target72 this._.$closestTarget = null;73 this._.closestTargetPos = null;74 this._.closestTargetYDiff = null;75 this._.closestTargetOffset = null;76 this._.closestTargetHeight = null;77 for (this._.i = 0; this._.i < this.$targets.length; this._.i++) {78 this._.$target = $(this.$targets[this._.i]);79 this._.targetOffset = this._.$target.offset();80 this._.targetHeight = this._.$target.outerHeight();81 this._.targetYMidpoint = this._.targetOffset.top + (this._.targetHeight / 2);82 this._.targetYDiff = Math.abs(this.mouseY - this._.targetYMidpoint);83 if (this._.i === 0 || (this.mouseY >= this._.targetOffset.top + 5 && this._.targetYDiff < this._.closestTargetYDiff)) {84 this._.$closestTarget = this._.$target;85 this._.closestTargetPos = this._.i;86 this._.closestTargetYDiff = this._.targetYDiff;87 this._.closestTargetOffset = this._.targetOffset;88 this._.closestTargetHeight = this._.targetHeight;89 }90 else {91 // Getting colder92 break;93 }94 }95 if (!this._.$closestTarget) {96 return;97 }98 // Are we hovering above the first row?99 if (this._.closestTargetPos === 0 && this.mouseY < this._.closestTargetOffset.top + 5) {100 this.$insertion.prependTo(this.structure.$container);101 }102 else {103 this._.$closestTargetLi = this._.$closestTarget.parent();104 this._.closestTargetLevel = this._.$closestTargetLi.data('level');105 // Is there a next row?106 if (this._.closestTargetPos < this.$targets.length - 1) {107 this._.$nextTargetLi = $(this.$targets[this._.closestTargetPos + 1]).parent();108 this._.nextTargetLevel = this._.$nextTargetLi.data('level');109 }110 else {111 this._.$nextTargetLi = null;112 this._.nextTargetLevel = null;113 }114 // Are we hovering between this row and the next one?115 this._.hoveringBetweenRows = (this.mouseY >= this._.closestTargetOffset.top + this._.closestTargetHeight - 5);116 /**117 * Scenario 1: Both rows have the same level.118 *119 * * Row 1120 * ----------------------121 * * Row 2122 */123 if (this._.$nextTargetLi && this._.nextTargetLevel == this._.closestTargetLevel) {124 if (this._.hoveringBetweenRows) {125 if (!this.maxLevels || this.maxLevels >= (this._.closestTargetLevel + this.draggeeLevel - 1)) {126 // Position the insertion after the closest target127 this.$insertion.insertAfter(this._.$closestTargetLi);128 }129 }130 else {131 if (!this.maxLevels || this.maxLevels >= (this._.closestTargetLevel + this.draggeeLevel)) {132 this._.$closestTarget.addClass('draghover');133 }134 }135 }136 /**137 * Scenario 2: Next row is a child of this one.138 *139 * * Row 1140 * ----------------------141 * * Row 2142 */143 else if (this._.$nextTargetLi && this._.nextTargetLevel > this._.closestTargetLevel) {144 if (!this.maxLevels || this.maxLevels >= (this._.nextTargetLevel + this.draggeeLevel - 1)) {145 if (this._.hoveringBetweenRows) {146 // Position the insertion as the first child of the closest target147 this.$insertion.insertBefore(this._.$nextTargetLi);148 }149 else {150 this._.$closestTarget.addClass('draghover');151 this.$insertion.appendTo(this._.$closestTargetLi.children('ul'));152 }153 }154 }155 /**156 * Scenario 3: Next row is a child of a parent node, or there is no next row.157 *158 * * Row 1159 * ----------------------160 * * Row 2161 */162 else {163 if (this._.hoveringBetweenRows) {164 // Determine which <li> to position the insertion after165 this._.draggeeX = this.mouseX - this.targetItemMouseDiffX;166 if (Craft.orientation === 'rtl') {167 this._.draggeeX += this.$helperLi.width();168 }169 this._.$parentLis = this._.$closestTarget.parentsUntil(this.structure.$container, 'li');170 this._.$closestParentLi = null;171 this._.closestParentLiXDiff = null;172 this._.closestParentLevel = null;173 for (this._.i = 0; this._.i < this._.$parentLis.length; this._.i++) {174 this._.$parentLi = $(this._.$parentLis[this._.i]);175 this._.parentLiX = this._.$parentLi.offset().left;176 if (Craft.orientation === 'rtl') {177 this._.parentLiX += this._.$parentLi.width();178 }179 this._.parentLiXDiff = Math.abs(this._.parentLiX - this._.draggeeX);180 this._.parentLevel = this._.$parentLi.data('level');181 if ((!this.maxLevels || this.maxLevels >= (this._.parentLevel + this.draggeeLevel - 1)) && (182 !this._.$closestParentLi || (183 this._.parentLiXDiff < this._.closestParentLiXDiff &&184 (!this._.$nextTargetLi || this._.parentLevel >= this._.nextTargetLevel)185 )186 )) {187 this._.$closestParentLi = this._.$parentLi;188 this._.closestParentLiXDiff = this._.parentLiXDiff;189 this._.closestParentLevel = this._.parentLevel;190 }191 }192 if (this._.$closestParentLi) {193 this.$insertion.insertAfter(this._.$closestParentLi);194 }195 }196 else {197 if (!this.maxLevels || this.maxLevels >= (this._.closestTargetLevel + this.draggeeLevel)) {198 this._.$closestTarget.addClass('draghover');199 }200 }201 }202 }203 },204 cancelDrag: function() {205 this.$insertion.remove();206 if (this._.$closestTarget) {207 this._.$closestTarget.removeClass('draghover');208 }209 this.onMouseUp();210 },211 onDragStop: function() {212 // Are we repositioning the draggee?213 if (this._.$closestTarget && (this.$insertion.parent().length || this._.$closestTarget.hasClass('draghover'))) {214 var $draggeeParent,215 moved;216 // Are we about to leave the draggee's original parent childless?217 if (!this.$draggee.siblings().length) {218 $draggeeParent = this.$draggee.parent();219 }220 if (this.$insertion.parent().length) {221 // Make sure the insertion isn't right next to the draggee222 var $closestSiblings = this.$insertion.next().add(this.$insertion.prev());223 if ($.inArray(this.$draggee[0], $closestSiblings) === -1) {224 this.$insertion.replaceWith(this.$draggee);225 moved = true;226 }227 else {228 this.$insertion.remove();229 moved = false;230 }231 }232 else {233 var $ul = this._.$closestTargetLi.children('ul');234 // Make sure this is a different parent than the draggee's235 if (!$draggeeParent || !$ul.length || $ul[0] !== $draggeeParent[0]) {236 if (!$ul.length) {237 var $toggle = $('<div class="toggle" title="' + Craft.t('app', 'Show/hide children') + '"/>').prependTo(this._.$closestTarget);238 this.structure.initToggle($toggle);239 $ul = $('<ul>').appendTo(this._.$closestTargetLi);240 }241 else if (this._.$closestTargetLi.hasClass('collapsed')) {242 this._.$closestTarget.children('.toggle').trigger('click');243 }244 this.$draggee.appendTo($ul);245 moved = true;246 }247 else {248 moved = false;249 }250 }251 // Remove the class either way252 this._.$closestTarget.removeClass('draghover');253 if (moved) {254 // Now deal with the now-childless parent255 if ($draggeeParent) {256 this.structure._removeUl($draggeeParent);257 }258 // Has the level changed?259 var newLevel = this.$draggee.parentsUntil(this.structure.$container, 'li').length + 1;260 var animateCss;261 if (newLevel != this.$draggee.data('level')) {262 // Correct the helper's padding if moving to/from level 1263 if (this.$draggee.data('level') == 1) {264 animateCss = {};265 animateCss['padding-' + Craft.left] = 38;266 this.$helperLi.velocity(animateCss, 'fast');267 }268 else if (newLevel == 1) {269 animateCss = {};270 animateCss['padding-' + Craft.left] = Craft.Structure.baseIndent;271 this.$helperLi.velocity(animateCss, 'fast');272 }273 this.setLevel(this.$draggee, newLevel);274 }275 // Make it real276 var $element = this.$draggee.children('.row').children('.element');277 var data = {278 structureId: this.structure.id,279 elementId: $element.data('id'),280 siteId: $element.data('site-id'),281 prevId: this.$draggee.prev().children('.row').children('.element').data('id'),282 parentId: this.$draggee.parent('ul').parent('li').children('.row').children('.element').data('id')283 };284 Craft.postActionRequest('structures/move-element', data, function(response, textStatus) {285 if (textStatus === 'success') {286 Craft.cp.displayNotice(Craft.t('app', 'New order saved.'));287 }288 });289 }290 }291 // Animate things back into place292 this.$draggee.velocity('stop').removeClass('hidden').velocity({293 height: this.draggeeHeight294 }, 'fast', $.proxy(function() {295 this.$draggee.css('height', 'auto');296 }, this));297 this.returnHelpersToDraggees();298 this.base();299 },300 setLevel: function($li, level) {301 $li.data('level', level);302 var indent = this.structure.getIndent(level);303 var css = {};304 css['margin-' + Craft.left] = '-' + indent + 'px';305 css['padding-' + Craft.left] = indent + 'px';306 this.$draggee.children('.row').css(css);307 var $childLis = $li.children('ul').children();308 for (var i = 0; i < $childLis.length; i++) {309 this.setLevel($($childLis[i]), level + 1);310 }311 }...

Full Screen

Full Screen

cmsmasters-theme-options-toggle.js

Source:cmsmasters-theme-options-toggle.js Github

copy

Full Screen

...28 $('#cmsmasters_project_video').show();29 30 31 if ($('input[name="cmsmasters_post_video_type"]:checked').val() === 'embedded') {32 $('#cmsmasters_post_video_link').closest('tr').show();33 } else {34 $('#cmsmasters_post_video_links-repeatable').closest('tr').show();35 }36 37 if ($('input[name="cmsmasters_project_video_type"]:checked').val() === 'embedded') {38 $('#cmsmasters_project_video_link').closest('tr').show();39 } else {40 $('#cmsmasters_project_video_links-repeatable').closest('tr').show();41 }42 } else if ($('#post-formats-select input.post-format:checked').val() === 'audio') {43 $('#cmsmasters_post_audio').show();44 } else {45 $('#cmsmasters_post_standard').show();46 47 $('#cmsmasters_project_images').show();48 }49 50 /* Post Format Change */51 $('#post-formats-select input.post-format').on('change', function () { 52 if ($(this).val() === 'image') {53 $('#cmsmasters_post_gallery, #cmsmasters_post_video, #cmsmasters_post_audio, #cmsmasters_project_images, #cmsmasters_project_video, #cmsmasters_post_standard').hide();54 55 $('#cmsmasters_post_image').show();56 } else if ($(this).val() === 'gallery') {57 $('#cmsmasters_post_image, #cmsmasters_post_video, #cmsmasters_post_audio, #cmsmasters_project_video, #cmsmasters_post_standard').hide();58 59 $('#cmsmasters_post_gallery').show();60 61 $('#cmsmasters_project_images').show();62 63 $('#cmsmasters_project_images .cmsmasters_tr_radio').show();64 65 $('#cmsmasters_project_images .cmsmasters_tr_checkbox').hide();66 } else if ($(this).val() === 'video') {67 $('#cmsmasters_post_image, #cmsmasters_post_gallery, #cmsmasters_post_audio, #cmsmasters_project_images, #cmsmasters_post_standard').hide();68 69 $('#cmsmasters_post_video').show();70 71 $('#cmsmasters_project_video').show();72 73 74 if ($('input[name="cmsmasters_post_video_type"]:checked').val() === 'embedded') {75 $('#cmsmasters_post_video_link').closest('tr').show();76 } else {77 $('#cmsmasters_post_video_links-repeatable').closest('tr').show();78 }79 80 if ($('input[name="cmsmasters_project_video_type"]:checked').val() === 'embedded') {81 $('#cmsmasters_project_video_link').closest('tr').show();82 } else {83 $('#cmsmasters_project_video_links-repeatable').closest('tr').show();84 }85 } else if ($(this).val() === 'audio') {86 $('#cmsmasters_post_image, #cmsmasters_post_gallery, #cmsmasters_post_video, #cmsmasters_project_images, #cmsmasters_project_video, #cmsmasters_post_standard').hide();87 88 $('#cmsmasters_post_audio').show();89 } else {90 $('#cmsmasters_post_image, #cmsmasters_post_gallery, #cmsmasters_post_video, #cmsmasters_post_audio, #cmsmasters_project_video').hide();91 92 $('#cmsmasters_post_standard').show();93 94 $('#cmsmasters_project_images').show();95 96 $('#cmsmasters_project_images .cmsmasters_tr_radio').hide();97 98 $('#cmsmasters_project_images .cmsmasters_tr_checkbox').show();99 }100 } );101 102 /* Post Video Type Change */103 $('input[name="cmsmasters_post_video_type"]').on('change', function () { 104 if ($('input[name="cmsmasters_post_video_type"]:checked').val() === 'embedded') {105 $('#cmsmasters_post_video_links-repeatable').closest('tr').hide();106 107 $('#cmsmasters_post_video_link').closest('tr').show();108 } else {109 $('#cmsmasters_post_video_link').closest('tr').hide();110 111 $('#cmsmasters_post_video_links-repeatable').closest('tr').show();112 }113 } );114 115 /* Project Video Type Change */116 $('input[name="cmsmasters_project_video_type"]').on('change', function () { 117 if ($('input[name="cmsmasters_project_video_type"]:checked').val() === 'embedded') {118 $('#cmsmasters_project_video_links-repeatable').closest('tr').hide();119 120 $('#cmsmasters_project_video_link').closest('tr').show();121 } else {122 $('#cmsmasters_project_video_link').closest('tr').hide();123 124 $('#cmsmasters_project_video_links-repeatable').closest('tr').show();125 }126 } );127 128 129 130 /* Layout Sidebar Field Load */131 if ($('input[name="cmsmasters_layout"]:checked').val() !== 'fullwidth') {132 $('#cmsmasters_sidebar_id').closest('tr').show();133 $('#cmsmasters_heading_block_disabled').closest('tr').hide();134 }135 136 /* Page Layout Change */137 $('input[name="cmsmasters_layout"]').on('change', function () { 138 if ($(this).val() === 'fullwidth') {139 $('#cmsmasters_sidebar_id').closest('tr').hide();140 $('#cmsmasters_heading_block_disabled').closest('tr').show();141 142 if ($('#page_template').val() === 'portfolio.php') {143 $('#cmsmasters_page_full_columns').closest('tr').show();144 }145 } else {146 $('#cmsmasters_sidebar_id').closest('tr').show();147 $('#cmsmasters_heading_block_disabled').closest('tr').hide();148 149 if ($('#page_template').val() === 'portfolio.php') {150 $('#cmsmasters_page_full_columns').closest('tr').hide();151 }152 }153 } );154 155 156 157 /* Heading Block Disabled Field Load */158 if (159 $('#cmsmasters_header_overlaps').is(':checked') && 160 $('input[name="cmsmasters_layout"]:checked').val() === 'fullwidth'161 ) {162 $('#cmsmasters_heading_block_disabled').closest('tr').show();163 }164 165 /* Heading Block Disabled Field Change */166 $('#cmsmasters_header_overlaps').on('change', function () { 167 if (168 $(this).is(':checked') && 169 $('input[name="cmsmasters_layout"]:checked').val() === 'fullwidth'170 ) {171 $('#cmsmasters_heading_block_disabled').closest('tr').show();172 } else {173 $('#cmsmasters_heading_block_disabled').closest('tr').hide();174 }175 } );176 177 $('input[name="cmsmasters_layout"]').on('change', function () { 178 if (179 $(this).val() === 'fullwidth' && 180 $('#cmsmasters_header_overlaps').is(':checked')181 ) {182 $('#cmsmasters_heading_block_disabled').closest('tr').show();183 } else {184 $('#cmsmasters_heading_block_disabled').closest('tr').hide();185 }186 } );187 188 189 190 /* Heading Block Title Load */191 if (192 $('#cmsmasters_heading_block_disabled').is(':checked') && 193 $('#cmsmasters_header_overlaps').is(':checked') && 194 $('input[name="cmsmasters_layout"]:checked').val() === 'fullwidth'195 ) {196 $('#cmsmasters_page_tabs > a[href="#cmsmasters_heading"]').hide();197 } else {198 $('#cmsmasters_page_tabs > a[href="#cmsmasters_heading"]').show();199 }200 201 /* Heading Block Title Change */202 $('#cmsmasters_heading_block_disabled').on('change', function () {203 if (204 $(this).is(':checked') && 205 $('#cmsmasters_header_overlaps').is(':checked') && 206 $('input[name="cmsmasters_layout"]:checked').val() === 'fullwidth'207 ) {208 $('#cmsmasters_page_tabs > a[href="#cmsmasters_heading"]').hide();209 } else {210 $('#cmsmasters_page_tabs > a[href="#cmsmasters_heading"]').show();211 }212 } );213 214 $('#cmsmasters_header_overlaps').on('change', function () { 215 if (216 $('#cmsmasters_heading_block_disabled').is(':checked') && 217 $(this).is(':checked') && 218 $('input[name="cmsmasters_layout"]:checked').val() === 'fullwidth'219 ) {220 $('#cmsmasters_page_tabs > a[href="#cmsmasters_heading"]').hide();221 } else {222 $('#cmsmasters_page_tabs > a[href="#cmsmasters_heading"]').show();223 }224 } );225 226 $('input[name="cmsmasters_layout"]').on('change', function () { 227 if (228 $('#cmsmasters_heading_block_disabled').is(':checked') && 229 $('#cmsmasters_header_overlaps').is(':checked') && 230 $(this).val() === 'fullwidth'231 ) {232 $('#cmsmasters_page_tabs > a[href="#cmsmasters_heading"]').hide();233 } else {234 $('#cmsmasters_page_tabs > a[href="#cmsmasters_heading"]').show();235 }236 } );237 238 239 240 /* Bottom Sidebar Field Load */241 if ($('#cmsmasters_bottom_sidebar').is(':checked')) {242 $('#cmsmasters_bottom_sidebar_id').closest('tr').show();243 $('#cmsmasters_bottom_sidebar_layout').closest('tr').show();244 }245 246 /* Bottom Sidebar Visibility Change */247 $('#cmsmasters_bottom_sidebar').on('change', function () { 248 if ($(this).is(':checked')) {249 $('#cmsmasters_bottom_sidebar_id').closest('tr').show();250 $('#cmsmasters_bottom_sidebar_layout').closest('tr').show();251 } else {252 $('#cmsmasters_bottom_sidebar_id').closest('tr').hide();253 $('#cmsmasters_bottom_sidebar_layout').closest('tr').hide();254 }255 } );256 257 258 259 /* Background Fields Load */260 if ($('#cmsmasters_bg_default').is(':not(:checked)')) {261 $('#cmsmasters_bg_col').closest('tr').show();262 $('#cmsmasters_bg_img_enable').closest('tr').show();263 264 if ($('#cmsmasters_bg_img_enable').is(':checked')) {265 $('#cmsmasters_bg_img').closest('tr').show();266 $('#cmsmasters_bg_rep_no-repeat').closest('tr').show();267 $('#cmsmasters_bg_pos').closest('tr').show();268 $('#cmsmasters_bg_att_scroll').closest('tr').show();269 $('#cmsmasters_bg_size_auto').closest('tr').show();270 }271 }272 273 /* Default Background Checkbox Change */274 $('#cmsmasters_bg_default').on('change', function () { 275 if ($(this).is(':checked')) {276 $('#cmsmasters_bg_col').closest('tr').hide();277 $('#cmsmasters_bg_img_enable').closest('tr').hide();278 $('#cmsmasters_bg_img').closest('tr').hide();279 $('#cmsmasters_bg_rep_no-repeat').closest('tr').hide();280 $('#cmsmasters_bg_pos').closest('tr').hide();281 $('#cmsmasters_bg_att_scroll').closest('tr').hide();282 $('#cmsmasters_bg_size_auto').closest('tr').hide();283 } else {284 $('#cmsmasters_bg_col').closest('tr').show();285 $('#cmsmasters_bg_img_enable').closest('tr').show();286 287 if ($('#cmsmasters_bg_img_enable').is(':checked')) {288 $('#cmsmasters_bg_img').closest('tr').show();289 $('#cmsmasters_bg_rep_no-repeat').closest('tr').show();290 $('#cmsmasters_bg_pos').closest('tr').show();291 $('#cmsmasters_bg_att_scroll').closest('tr').show();292 $('#cmsmasters_bg_size_auto').closest('tr').show();293 }294 }295 } );296 297 /* Background Visibility Change */298 $('#cmsmasters_bg_img_enable').on('change', function () { 299 if ($(this).is(':checked')) {300 $('#cmsmasters_bg_img').closest('tr').show();301 $('#cmsmasters_bg_rep_no-repeat').closest('tr').show();302 $('#cmsmasters_bg_pos').closest('tr').show();303 $('#cmsmasters_bg_att_scroll').closest('tr').show();304 $('#cmsmasters_bg_size_auto').closest('tr').show();305 } else {306 $('#cmsmasters_bg_img').closest('tr').hide();307 $('#cmsmasters_bg_rep_no-repeat').closest('tr').hide();308 $('#cmsmasters_bg_pos').closest('tr').hide();309 $('#cmsmasters_bg_att_scroll').closest('tr').hide();310 $('#cmsmasters_bg_size_auto').closest('tr').hide();311 }312 } );313 314 315 316 /* Heading Fields Load */317 if ($('input[name="cmsmasters_heading"]:checked').val() === 'custom') {318 $('#cmsmasters_heading_title').closest('tr').show();319 $('#cmsmasters_heading_subtitle').closest('tr').show();320 $('#cmsmasters_heading_icon').closest('tr').show();321 $('input[name="cmsmasters_heading_alignment"]').closest('tr').show();322 $('#cmsmasters_heading_height').closest('tr').show();323 $('#cmsmasters_breadcrumbs').closest('tr').show();324 } else if ($('input[name="cmsmasters_heading"]:checked').val() === 'default') {325 $('input[name="cmsmasters_heading_alignment"]').closest('tr').show();326 $('#cmsmasters_heading_height').closest('tr').show();327 $('#cmsmasters_breadcrumbs').closest('tr').show();328 }329 330 /* Heading Type Change */331 $('input[name="cmsmasters_heading"]').on('change', function () { 332 if ($(this).val() === 'default') {333 $('#cmsmasters_heading_title').closest('tr').hide();334 $('#cmsmasters_heading_subtitle').closest('tr').hide();335 $('#cmsmasters_heading_icon').closest('tr').hide();336 $('input[name="cmsmasters_heading_alignment"]').closest('tr').show();337 $('#cmsmasters_heading_height').closest('tr').show();338 $('#cmsmasters_breadcrumbs').closest('tr').show();339 } else if ($(this).val() === 'custom') {340 $('#cmsmasters_heading_title').closest('tr').show();341 $('#cmsmasters_heading_subtitle').closest('tr').show();342 $('#cmsmasters_heading_icon').closest('tr').show();343 $('input[name="cmsmasters_heading_alignment"]').closest('tr').show();344 $('#cmsmasters_heading_height').closest('tr').show();345 $('#cmsmasters_breadcrumbs').closest('tr').show();346 } else {347 $('#cmsmasters_heading_title').closest('tr').hide();348 $('#cmsmasters_heading_subtitle').closest('tr').hide();349 $('#cmsmasters_heading_icon').closest('tr').hide();350 $('input[name="cmsmasters_heading_alignment"]').closest('tr').hide();351 $('#cmsmasters_heading_height').closest('tr').hide();352 $('#cmsmasters_breadcrumbs').closest('tr').hide();353 }354 } );355 356 /* Heading Background Visibility Load */357 if ($('#cmsmasters_heading_bg_img_enable').is(':checked')) {358 $('#cmsmasters_heading_bg_img').closest('tr').show();359 $('input[name="cmsmasters_heading_bg_rep"]').closest('tr').show();360 $('input[name="cmsmasters_heading_bg_att"]').closest('tr').show();361 $('input[name="cmsmasters_heading_bg_size"]').closest('tr').show();362 }363 364 /* Heading Background Visibility Change */365 $('#cmsmasters_heading_bg_img_enable').on('change', function () { 366 if ($(this).is(':checked')) {367 $('#cmsmasters_heading_bg_img').closest('tr').show();368 $('input[name="cmsmasters_heading_bg_rep"]').closest('tr').show();369 $('input[name="cmsmasters_heading_bg_att"]').closest('tr').show();370 $('input[name="cmsmasters_heading_bg_size"]').closest('tr').show();371 } else {372 $('#cmsmasters_heading_bg_img').closest('tr').hide();373 $('input[name="cmsmasters_heading_bg_rep"]').closest('tr').hide();374 $('input[name="cmsmasters_heading_bg_att"]').closest('tr').hide();375 $('input[name="cmsmasters_heading_bg_size"]').closest('tr').hide();376 }377 } );378 } );...

Full Screen

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 elementium 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