How to use itemElement method in Best

Best JavaScript code snippet using best

ui.list.edit.decorator.switchable.js

Source:ui.list.edit.decorator.switchable.js Github

copy

Full Screen

1/​**2 * DevExtreme (ui/​list/​ui.list.edit.decorator.switchable.js)3 * Version: 19.1.74 * Build date: Fri Oct 11 20195 *6 * Copyright (c) 2012 - 2019 Developer Express Inc. ALL RIGHTS RESERVED7 * Read about DevExtreme licensing here: https:/​/​js.devexpress.com/​Licensing/​8 */​9"use strict";10var $ = require("../​../​core/​renderer"),11 eventsEngine = require("../​../​events/​core/​events_engine"),12 noop = require("../​../​core/​utils/​common").noop,13 EditDecorator = require("./​ui.list.edit.decorator"),14 abstract = EditDecorator.abstract,15 eventUtils = require("../​../​events/​utils"),16 pointerEvents = require("../​../​events/​pointer"),17 feedbackEvents = require("../​../​events/​core/​emitter.feedback");18var LIST_EDIT_DECORATOR = "dxListEditDecorator",19 POINTER_DOWN_EVENT_NAME = eventUtils.addNamespace(pointerEvents.down, LIST_EDIT_DECORATOR),20 ACTIVE_EVENT_NAME = eventUtils.addNamespace(feedbackEvents.active, LIST_EDIT_DECORATOR),21 LIST_ITEM_CONTENT_CLASS = "dx-list-item-content",22 SWITCHABLE_DELETE_READY_CLASS = "dx-list-switchable-delete-ready",23 SWITCHABLE_MENU_SHIELD_POSITIONING_CLASS = "dx-list-switchable-menu-shield-positioning",24 SWITCHABLE_DELETE_TOP_SHIELD_CLASS = "dx-list-switchable-delete-top-shield",25 SWITCHABLE_DELETE_BOTTOM_SHIELD_CLASS = "dx-list-switchable-delete-bottom-shield",26 SWITCHABLE_MENU_ITEM_SHIELD_POSITIONING_CLASS = "dx-list-switchable-menu-item-shield-positioning",27 SWITCHABLE_DELETE_ITEM_CONTENT_SHIELD_CLASS = "dx-list-switchable-delete-item-content-shield",28 SWITCHABLE_DELETE_BUTTON_CONTAINER_CLASS = "dx-list-switchable-delete-button-container";29var SwitchableEditDecorator = EditDecorator.inherit({30 _init: function() {31 this._$topShield = $("<div>").addClass(SWITCHABLE_DELETE_TOP_SHIELD_CLASS);32 this._$bottomShield = $("<div>").addClass(SWITCHABLE_DELETE_BOTTOM_SHIELD_CLASS);33 this._$itemContentShield = $("<div>").addClass(SWITCHABLE_DELETE_ITEM_CONTENT_SHIELD_CLASS);34 eventsEngine.on(this._$topShield, POINTER_DOWN_EVENT_NAME, this._cancelDeleteReadyItem.bind(this));35 eventsEngine.on(this._$bottomShield, POINTER_DOWN_EVENT_NAME, this._cancelDeleteReadyItem.bind(this));36 this._list.$element().append(this._$topShield.toggle(false)).append(this._$bottomShield.toggle(false))37 },38 handleClick: function() {39 return this._cancelDeleteReadyItem()40 },41 _cancelDeleteReadyItem: function() {42 if (!this._$readyToDeleteItem) {43 return false44 }45 this._cancelDelete(this._$readyToDeleteItem);46 return true47 },48 _cancelDelete: function($itemElement) {49 this._toggleDeleteReady($itemElement, false)50 },51 _toggleDeleteReady: function($itemElement, readyToDelete) {52 if (void 0 === readyToDelete) {53 readyToDelete = !this._isReadyToDelete($itemElement)54 }55 this._toggleShields($itemElement, readyToDelete);56 this._toggleScrolling(readyToDelete);57 this._cacheReadyToDeleteItem($itemElement, readyToDelete);58 this._animateToggleDelete($itemElement, readyToDelete)59 },60 _isReadyToDelete: function($itemElement) {61 return $itemElement.hasClass(SWITCHABLE_DELETE_READY_CLASS)62 },63 _toggleShields: function($itemElement, enabled) {64 this._list.$element().toggleClass(SWITCHABLE_MENU_SHIELD_POSITIONING_CLASS, enabled);65 this._$topShield.toggle(enabled);66 this._$bottomShield.toggle(enabled);67 if (enabled) {68 this._updateShieldsHeight($itemElement)69 }70 this._toggleContentShield($itemElement, enabled)71 },72 _updateShieldsHeight: function($itemElement) {73 var $list = this._list.$element(),74 listTopOffset = $list.offset().top,75 listHeight = $list.outerHeight(),76 itemTopOffset = $itemElement.offset().top,77 itemHeight = $itemElement.outerHeight(),78 dirtyTopShieldHeight = itemTopOffset - listTopOffset,79 dirtyBottomShieldHeight = listHeight - itemHeight - dirtyTopShieldHeight;80 this._$topShield.height(Math.max(dirtyTopShieldHeight, 0));81 this._$bottomShield.height(Math.max(dirtyBottomShieldHeight, 0))82 },83 _toggleContentShield: function($itemElement, enabled) {84 if (enabled) {85 $itemElement.find("." + LIST_ITEM_CONTENT_CLASS).first().append(this._$itemContentShield)86 } else {87 this._$itemContentShield.detach()88 }89 },90 _toggleScrolling: function(readyToDelete) {91 var scrollView = this._list.$element().dxScrollView("instance");92 if (readyToDelete) {93 scrollView.on("start", this._cancelScrolling)94 } else {95 scrollView.off("start", this._cancelScrolling)96 }97 },98 _cancelScrolling: function(args) {99 args.event.cancel = true100 },101 _cacheReadyToDeleteItem: function($itemElement, cache) {102 if (cache) {103 this._$readyToDeleteItem = $itemElement104 } else {105 delete this._$readyToDeleteItem106 }107 },108 _animateToggleDelete: function($itemElement, readyToDelete) {109 if (readyToDelete) {110 this._enablePositioning($itemElement);111 this._prepareDeleteReady($itemElement);112 this._animatePrepareDeleteReady($itemElement);113 eventsEngine.off($itemElement, pointerEvents.up)114 } else {115 this._forgetDeleteReady($itemElement);116 this._animateForgetDeleteReady($itemElement).done(this._disablePositioning.bind(this, $itemElement))117 }118 },119 _enablePositioning: function($itemElement) {120 $itemElement.addClass(SWITCHABLE_MENU_ITEM_SHIELD_POSITIONING_CLASS);121 eventsEngine.on($itemElement, ACTIVE_EVENT_NAME, noop);122 eventsEngine.one($itemElement, pointerEvents.up, this._disablePositioning.bind(this, $itemElement))123 },124 _disablePositioning: function($itemElement) {125 $itemElement.removeClass(SWITCHABLE_MENU_ITEM_SHIELD_POSITIONING_CLASS);126 eventsEngine.off($itemElement, ACTIVE_EVENT_NAME)127 },128 _prepareDeleteReady: function($itemElement) {129 $itemElement.addClass(SWITCHABLE_DELETE_READY_CLASS)130 },131 _forgetDeleteReady: function($itemElement) {132 $itemElement.removeClass(SWITCHABLE_DELETE_READY_CLASS)133 },134 _animatePrepareDeleteReady: abstract,135 _animateForgetDeleteReady: abstract,136 _getDeleteButtonContainer: function($itemElement) {137 $itemElement = $itemElement || this._$readyToDeleteItem;138 return $itemElement.children("." + SWITCHABLE_DELETE_BUTTON_CONTAINER_CLASS)139 },140 _deleteItem: function($itemElement) {141 $itemElement = $itemElement || this._$readyToDeleteItem;142 this._getDeleteButtonContainer($itemElement).detach();143 if ($itemElement.is(".dx-state-disabled, .dx-state-disabled *")) {144 return145 }146 this._list.deleteItem($itemElement).always(this._cancelDelete.bind(this, $itemElement))147 },148 _isRtlEnabled: function() {149 return this._list.option("rtlEnabled")150 },151 dispose: function() {152 if (this._$topShield) {153 this._$topShield.remove()154 }155 if (this._$bottomShield) {156 this._$bottomShield.remove()157 }158 this.callBase.apply(this, arguments)159 }160});...

Full Screen

Full Screen

customSelect.js

Source:customSelect.js Github

copy

Full Screen

1/​*2 * To change this template, choose Tools | Templates3 * and open the template in the editor.4 *5 * viban terence6 * 20.12.20107 */​8var customSelect = new Select();9function Select(){10 var idSel;11 var idList;12 var listElements;13 var scrollbar;14 var scrollbarVar;15 var boxes= new Array('listBoxDay', 'listBoxMonth', 'listBoxYear', 'listBoxSex', 'listBoxCountry');16 this.init = function(){17 var arrowElements = $$('.arrowSelectInactive');18 var selectedItems= $$('.itemSelected');19 var listboxes = $$('.listBox');20 this.eventClick = this.toggleDropDown.bindAsEventListener(this);21 this.eventSelect = this.SelectOption.bindAsEventListener(this);22 this.eventMouseOver = this.onMouseOverCustomSelect.bindAsEventListener(this);23 this.eventMouseOut = this.onMouseOutCustomSelect.bindAsEventListener(this);24 this.eventOnBlur = this.onBlur.bindAsEventListener(this);25 selectedItems.each(function(item){26 var itemElement = $(item);27 if(itemElement){28 customSelect.registerToggleEvent(itemElement);29 }30 });31 arrowElements.each(function(item){32 var itemElement = $(item);33 if(itemElement){34 customSelect.registerToggleEvent(itemElement);35 }36 });37 }38 this.registerEventListerners = function(element){39 Event.observe(element, "mouseover", this.eventMouseOver);40 Event.observe(element, "mouseout", this.eventMouseOut);41 Event.observe(element, "click", this.eventSelect);42 }43 this.UnregisterEventListerners = function(element){44 Event.stopObserving(element, "mouseover", this.eventMouseOver);45 Event.stopObserving(element, "mouseout", this.eventMouseOut);46 Event.stopObserving(element, "click", this.eventSelect);47 }48 this.registerToggleEvent = function(element){49 Event.observe(element, "click", this.eventClick);50 }51 this.UnregisterToggleEvent = function(element){52 Event.stopObserving(element, "click", this.eventClick);53 }54 this.registerOnEvent = function(element){55 Event.observe(element, "blur", this.eventOnBlur);56 }57 this.UnregisterOnEvent = function(element){58 Event.stopObserving(element, "blur", this.eventOnBlur);59 }60 this.toggleDropDown = function(e){61 var eventTriggerElement = Event.element(e);62 var classNames = eventTriggerElement.classNames();63 var listBox;64 var selBox;65 var scroll;66 67 classNames.each(function(item){68 if(item.indexOf('idList_') != -1){69 listBox = item.substr(7);70 }else if(item.indexOf('idSel_') != -1){71 selBox = item.substr(6);72 }73 });74 75 idList = $(listBox);76 idSel= $(selBox);77 78 boxes.each(function(item){79 if(item != listBox){80 var itemElement = $(item);81 if(itemElement){82 itemElement.removeClassName('arrowDown');83 itemElement.addClassName('arrowUp');84 }85 }86 });87 if(idList){88 if(idList.hasClassName('arrowDown')){89 idList.removeClassName('arrowDown');90 idList.addClassName('arrowUp');91 }else{92 if(listBox.indexOf('Day') != -1){93 misc.testForScrollbar('listDayBox');94 }else if(listBox.indexOf('Month') != -1){95 misc.testForScrollbar('listMonthBox');96 }else if(listBox.indexOf('Year') != -1){97 misc.testForScrollbar('listYearBox');98 }else if(listBox.indexOf('Country') != -1){99 misc.testForScrollbar('listCountryBox');100 }101 idList.removeClassName('arrowUp');102 idList.addClassName('arrowDown');103 listElements = $$('li.' + listBox + '_options');104 listElements.each(function(item){105 var itemElement = $(item);106 if(itemElement){107 customSelect.registerEventListerners(itemElement);108 }109 });110 }111 } 112 }113 this.SelectOption = function(e){114 var eventTriggerElement = Event.element(e);115 116 listElements.each(function(item){117 var itemElement = $(item);118 if(itemElement.hasClassName('selectedItem')){119 itemElement.removeClassName('selectedItem');120 }121 });122 if(!eventTriggerElement.hasClassName('selectedItem')){123 eventTriggerElement.addClassName('selectedItem');124 }125 126 var content = eventTriggerElement.innerHTML;127 128 idSel.innerHTML = content;129 idList.removeClassName('arrowDown');130 if(scrollbar){131 scrollbar.removeClassName('arrowDown');132 scrollbar.addClassName('arrowUp');133 }134 idList.addClassName('arrowUp');135 }136 this.onMouseOverCustomSelect = function(e){137 var eventTriggerElement = Event.element(e);138 eventTriggerElement.addClassName('customSelectOver');139 }140 this.onMouseOutCustomSelect = function(e){141 var eventTriggerElement = Event.element(e);142 eventTriggerElement.removeClassName('customSelectOver');143 }144 this.onBlur = function(e){145 var eventTriggerElement = Event.element(e);146 }147 this.destroyEventListerners = function(){148 var arrowElements = $$('.arrowSelectInactive');149 var selectedItems= $$('.itemSelected');150 var listboxes = $$('.listBox');151 boxes.each(function(item){152 var itemElement = $(item);153 if(itemElement){154 if(itemElement.hasClassName('arrowDown')){155 itemElement.removeClassName('arrowDown');156 itemElement.addClassName('arrowUp');157 }158 }159 });160 selectedItems.each(function(item){161 var itemElement = $(item);162 if(itemElement){163 customSelect.UnregisterToggleEvent(itemElement);164 }165 });166 arrowElements.each(function(item){167 var itemElement = $(item);168 if(itemElement){169 customSelect.UnregisterToggleEvent(itemElement);170 }171 });172 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var request = require('request');2request(url, function (error, response, body) {3 if (!error && response.statusCode == 200) {4 }5});6var request = require('request');7request(url, function (error, response, body) {8 if (!error && response.statusCode == 200) {9 }10});11var request = require('request');12request(url, function (error, response, body) {13 if (!error && response.statusCode == 200) {14 }15});16var request = require('request');17request(url, function (error, response, body) {18 if (!error && response.statusCode == 200) {19 }20});21var request = require('request');22request(url, function (error, response, body) {23 if (!error && response.statusCode == 200) {24 }25});26var request = require('request');

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Web Analytics Tools to Help You Understand Your Users

Whether you are a businessman, or a blogger, or you have just launched your online portal for your next venture, it’s important to know how your website is behaving across all browsers and platforms. When you put so much money for the online presence you would want to know whether that amount is getting you something or not.

Top 10 Books Every Tester Should Read

While recently cleaning out my bookshelf, I dusted off my old copy of Testing Computer Software written by Cem Kaner, Hung Q Nguyen, and Jack Falk. I was given this book back in 2003 by my first computer science teacher as a present for a project well done. This brought back some memories and got me thinking how much books affect our lives even in this modern blog and youtube age. There are courses for everything, tutorials for everything, and a blog about it somewhere on medium. However nothing compares to a hardcore information download you can get from a well written book by truly legendary experts of a field.

9 Reasons Why Manual Testing Is Going To Prevail The Industry?

A quality analyst unfortunately often earns the reputation of being a bad guy. It often becomes frustrating for a developer when someone tells them, their code is wrong and a major part of an application crashed because of that. But the truth is, testers care about the software same as developers. The end result of both of them working together is an enjoyable bug free application.

Effective Strategies for Cross Browser Testing of a Web Application

When end users are surfing the web, either for studies or for general purpose like online shopping or bill payment, only one thing matters to them. The site should work perfectly. It’s bad news for a developer or a site owner if their site does not work perfectly in the browser preferred by the user. Instead of switching browsers they tend to move to a different website that serves the same purpose. That is the reason, cross browser testing has become an important job to perform before deploying a developed website, to ensure that the developed site runs properly in all browsers in different devices and operating systems. This post will focus on certain strategies that will make cross browser testing much easier and efficient.

Top 15 Best Books for JavaScript Beginners

This article is a part of our Content Hub. For more in-depth resources, check out our content hub on Selenium JavaScript Tutorial.

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