How to use chooser.stop method in qawolf

Best JavaScript code snippet using qawolf

bus_stop_chooser.js

Source:bus_stop_chooser.js Github

copy

Full Screen

1//2// Bus Stop Chooser3//4/* globals L */5/* exported BusStopChooser */6var BusStopChooser = (function() {7 'use strict';8 var DEFAULT_ENDPOINT = 'https://smartcambridge.org/api/v1/';9 var OSM_TILES = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';10 var OSM_MAX_ZOOM = 19;11 var OSM_ATTRIBUTION = 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> ' +12 'contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a></a>';13 var DEBUG = false;14 var stop_icon = L.divIcon({15 className: 'bus_stop_chooser_stop',16 iconSize: [20, 40],17 iconAnchor: [2, 38],18 tooltipAnchor: [2, -20],19 popupAnchor: [10, -40],20 });21 var stop_icon_selected = L.divIcon({22 className: 'bus_stop_chooser_stop_selected',23 iconSize: [20, 40],24 iconAnchor: [2, 38],25 tooltipAnchor: [2, -20],26 popupAnchor: [10, -40],27 });28 function debounce(func, wait, immediate) {29 // Debounce a function call30 // https://davidwalsh.name/javascript-debounce-function31 var timeout;32 return function() {33 debug_log('Called wrapped function');34 var context = this, args = arguments;35 var later = function() {36 debug_log('Called later');37 timeout = null;38 if (!immediate) {39 func.apply(context, args);40 }41 };42 var callNow = immediate && !timeout;43 clearTimeout(timeout);44 timeout = setTimeout(later, wait);45 if (callNow) {46 func.apply(context, args);47 }48 };49 }50 function formatted_stop_name(indicator, common_name) {51 // Fix up abbreviations52 switch (indicator) {53 case 'opp':54 indicator = 'opposite';55 break;56 case 'o/s':57 case 'os':58 indicator = 'outside';59 break;60 case 'adj':61 case 'adjacent':62 indicator = 'adjacent to';63 break;64 case 'nr':65 indicator = 'near';66 break;67 case 'cnr':68 indicator = 'corner';69 break;70 }71 if (indicator === undefined) {72 indicator = '';73 }74 // indicators that come before the common name75 var prefixes = [76 'opposite', 'outside', 'adjacent to', 'near', 'behind', 'inside', 'by', 'in',77 'at', 'on', 'before', 'just before', 'after', 'just after', 'corner of'78 ];79 if ( prefixes.indexOf(indicator) >= 0) {80 return indicator.charAt(0).toUpperCase() + indicator.slice(1) + ' ' + common_name;81 }82 else {83 return common_name + ' (' + indicator + ')';84 }85 }86 function debug_log() {87 if (DEBUG) {88 var args = [].slice.call(arguments);89 args.unshift('[BusStopChooser]');90 console.log.apply(console, args);91 }92 }93 return {94 create: function(params) {95 var lat = params.lat || 52.204;96 var lng = params.lng || 0.124;97 var zoom = params.zoom || 15;98 var multi_select = params.multi_select || false;99 var popups = params.popups || false;100 var location = params.location || false;101 var zoom_threshold = params.zoom_threshold || 15;102 var on_click_stop_callback = params.on_click_stop_callback || undefined;103 var stops_callback = params.stops_callback || undefined;104 var api_endpoint = params.api_endpoint || DEFAULT_ENDPOINT;105 var api_token = params.api_token;106 var map;107 var osm = new L.TileLayer(OSM_TILES, {108 attribution: OSM_ATTRIBUTION,109 maxZoom: OSM_MAX_ZOOM110 });111 var selected_stops = L.featureGroup();112 var other_stops = L.markerClusterGroup({113 disableClusteringAtZoom: 18114 });115 var warning_div = document.createElement('div');116 warning_div.className = 'bus_stop_chooser_warning';117 warning_div.style.display = 'none';118 var spinner_img = document.createElement('div');119 spinner_img.className = 'bus_stop_chooser_spinner';120 spinner_img.style.display = 'none';121 var locateControl = L.Control.extend({122 onAdd: function () {123 var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control leaflet-control-custom bus_stop_chooser_locate');124 var a = L.DomUtil.create('a', '', container);125 a.href = '#';126 a.title = 'Zoom to curent position';127 container.onclick = function(){128 map.locate({setView: true, maxZoom: zoom_threshold});129 return false;130 };131 return container;132 }133 });134 function render(raw_parent_el, current) {135 var parent_el = raw_parent_el;136 if (typeof parent_el === 'string') {137 parent_el = document.getElementById(parent_el);138 }139 var current_stops = [];140 if (current && current.stops) {141 current_stops = current.stops.slice();142 }143 // Catch some annoying problems144 debug_log('width', parent_el.clientWidth, 'height', parent_el.clientHeight, (parent_el.clientHeight));145 if ((parent_el.clientWidth < 10) || (parent_el.clientHeight < 10)) {146 console.warn('BusStopChooser: parent_el has small or zero height or width so may not display');147 }148 debug_log('multi_select', multi_select, 'current stops', current_stops);149 if ((!multi_select) && current_stops && current_stops.length > 1) {150 console.warn('BusStopChooser: got multiple current stops with multi_select=false');151 console.warn('BusStopChooser: using only the first current stop');152 current_stops.splice(1);153 }154 parent_el.appendChild(warning_div);155 parent_el.appendChild(spinner_img);156 map = new L.Map(parent_el).addLayer(osm);157 selected_stops.addTo(map);158 other_stops.addTo(map);159 if (location && 'geolocation' in navigator) {160 map.addControl(new locateControl({position: 'topleft'}));161 }162 // Add any current stops163 if (current_stops.length > 0) {164 debug_log('Got', current_stops.length, 'Initial stops');165 add_stops(current_stops, true);166 }167 // Set initial view from current.map, else current.stops, else params168 if (current && current.map ) {169 debug_log('Setting view from current.map');170 map.setView([current.map.lat, current.map.lng], current.map.zoom);171 }172 else if (selected_stops.getLayers().length > 0) {173 debug_log('Setting view from current.stops');174 var bounds = selected_stops.getBounds().pad(0.2); // LatLngBounds175 map.fitBounds(bounds, { maxZoom: zoom_threshold }); // draw map around current.stops, with max zoom applied.176 }177 else {178 debug_log('Setting view from parameters or default');179 map.setView([lat, lng], zoom);180 }181 debug_log(map.getBounds());182 // Load initial stops and subsequent pan and zoom183 process_pan_and_zoom();184 map.on('moveend', process_pan_and_zoom);185 do_stops_callback();186 }187 function getData() {188 // Return data189 debug_log('called getData');190 var stops = [];191 selected_stops.eachLayer(function(marker) {192 stops.push(marker.properties.stop);193 });194 return {195 map: {196 lng: map.getCenter().lng,197 lat: map.getCenter().lat,198 zoom: map.getZoom(),199 },200 stops: stops,201 };202 }203 function process_pan_and_zoom(e) {204 // Handler for pan and zoom ('moveend') events205 debug_log('Processing pan and zoom, arg', e);206 spinner_img.style.display = 'block';207 if (map.getZoom() < zoom_threshold) {208 // Remove all non-selected markers, warn user209 warning_div.innerHTML = 'Zoom in to see bus stops';210 if (selected_stops.getLayers().length > 0) {211 warning_div.innerHTML = 'Zoom in to see unselected bus stops';212 }213 warning_div.style.display = 'block';214 other_stops.remove();215 //other_stops.clearLayers();216 spinner_img.style.display = 'none';217 }218 else {219 warning_div.style.display = 'none';220 other_stops.addTo(map);221 if (e) {222 safe_get_bus_stops(function() {223 spinner_img.style.display = 'none';224 debug_log('Finished retrieving updated bus stops');225 });226 }227 else {228 get_bus_stops(function(){229 spinner_img.style.display = 'none';230 debug_log('Finished retrieving initial bus stops');231 });232 }233 }234 }235 function get_bus_stops(callback, uri, new_stops) {236 // Retrieve stop information from the API237 //debug_log('get_bus_stops, uri', uri, 'new_stops', new_stops);238 if (!uri) {239 // Build an initial URL (for the first page)240 var bounds = map.getBounds().pad(0.7).toBBoxString();241 var qs = '?bounding_box=' + encodeURIComponent(bounds);242 qs += '&page_size='+encodeURIComponent(500);243 uri = api_endpoint + 'transport/stops/' + qs;244 }245 if (!new_stops) {246 new_stops = [];247 }248 var xhr = new XMLHttpRequest();249 xhr.open('GET', uri, true);250 if (api_token) {251 xhr.setRequestHeader('Authorization', 'Token ' + api_token);252 }253 xhr.send();254 xhr.onreadystatechange = function() {255 if(xhr.readyState === XMLHttpRequest.DONE) {256 if (xhr.status !== 200) {257 console.warn('BusStopChooser: API error:', xhr.status, xhr.statusText);258 }259 else {260 var api_response = JSON.parse(xhr.responseText);261 //debug_log('got', api_response.results.length, 'results');262 new_stops = new_stops.concat(api_response.results);263 //debug_log('accumulated', new_stops.length, 'results');264 // Keep going if there are more...265 if (api_response.next) {266 get_bus_stops(callback, api_response.next, new_stops);267 }268 // Otherwise269 else {270 add_stops(new_stops, false);271 callback();272 }273 }274 }275 };276 }277 var safe_get_bus_stops = debounce(get_bus_stops, 750);278 function add_stops(stops, add_selected) {279 // Add new stops, remove any too far off the map280 debug_log('Processing', stops.length, 'stops, selected', add_selected);281 var seen_stop_ids = [];282 // Get all the stop_ids we already know about283 var displayed_stop_ids = [];284 selected_stops.eachLayer(function(marker) {285 displayed_stop_ids.push(marker.properties.stop.stop_id);286 });287 other_stops.eachLayer(function(marker) {288 displayed_stop_ids.push(marker.properties.stop.stop_id);289 });290 debug_log('Currently displaying', displayed_stop_ids);291 // Add markers for stops we aren't currently displaying292 for (var ctr = 0; ctr < stops.length; ctr++) {293 var stop = stops[ctr];294 debug_log('Processing', stop.stop_id);295 seen_stop_ids.push(stop.stop_id);296 // Ignore it if it's already displayed297 if (displayed_stop_ids.indexOf(stop.stop_id) !== -1) {298 debug_log('Stop', stop.stop_id, 'already displayed - ignoring');299 continue;300 }301 //Add 'lng' and 'lat' aliases pending addition to API302 if (!stop.hasOwnProperty('lng')) {303 stop.lng = stop.longitude;304 }305 if (!stop.hasOwnProperty('lat')) {306 stop.lat = stop.latitude;307 }308 debug_log('Adding', stop.stop_id);309 var marker = L.marker([stop.lat, stop.lng])310 .on('click', process_stop_click);311 if (popups) {312 marker.bindPopup(formatted_stop_name(stop.indicator, stop.common_name));313 } else {314 marker.bindTooltip(formatted_stop_name(stop.indicator, stop.common_name));315 }316 marker.properties = { 'stop': stop };317 if (add_selected) {318 marker.setIcon(stop_icon_selected).addTo(selected_stops);319 } else {320 marker.setIcon(stop_icon).addTo(other_stops);321 }322 }323 // Delete anything we are displaying that we didn't see324 debug_log('seen_stop_ids', seen_stop_ids);325 other_stops.eachLayer(function(this_marker) {326 if (seen_stop_ids.indexOf(this_marker.properties.stop.stop_id) === -1) {327 debug_log('Removing', this_marker.properties.stop.stop_id);328 other_stops.removeLayer(this_marker);329 }330 });331 debug_log('Currently selected_stops', list_selected_stops());332 }333 function process_stop_click(e) {334 // Handler for clicks on stops335 var clicked_marker = e.target;336 // Work out if this stop was already selected337 var already_selected = false;338 selected_stops.eachLayer(function(marker) {339 if (clicked_marker === marker) {340 already_selected = true;341 }342 });343 if (on_click_stop_callback) {344 on_click_stop_callback(clicked_marker, !already_selected);345 }346 if (already_selected) {347 deselect_stop(clicked_marker);348 }349 else {350 select_stop(clicked_marker);351 }352 do_stops_callback();353 debug_log('Currently selected_stops', list_selected_stops());354 }355 function select_stop(marker) {356 // First remove anything currently selected if not multi_select357 // [*should* only ever be one, but who knows?]358 if (!multi_select) {359 selected_stops.eachLayer(function(m) {360 deselect_stop(m);361 });362 }363 other_stops.removeLayer(marker);364 marker.addTo(selected_stops);365 marker.setIcon(stop_icon_selected);366 if (popups) {367 //marker.openPopup();368 }369 debug_log('Selected', marker);370 }371 function deselect_stop(marker) {372 selected_stops.removeLayer(marker);373 marker.addTo(other_stops);374 marker.setIcon(stop_icon);375 if (popups) {376 //marker.openPopup();377 }378 debug_log('Deselected', marker);379 }380 function list_selected_stops() {381 // Return the stop_ids of currently selected stops382 var codes = [];383 selected_stops.eachLayer(function(marker) {384 codes.push(marker.properties.stop.stop_id);385 });386 return codes;387 }388 function do_stops_callback() {389 if (stops_callback) {390 stops_callback(selected_stops.getLayers().length);391 }392 }393 // Return our public methods394 return {395 render: render,396 getData: getData,397 valid: function () { return true; },398 value: getData399 };400 }401 };...

Full Screen

Full Screen

chooserdialogue.js

Source:chooserdialogue.js Github

copy

Full Screen

1var CHOOSERDIALOGUE = function() {2 CHOOSERDIALOGUE.superclass.constructor.apply(this, arguments);3};4Y.extend(CHOOSERDIALOGUE, Y.Base, {5 // The panel widget6 panel: null,7 // The submit button - we disable this until an element is set8 submitbutton : null,9 // The chooserdialogue container10 container : null,11 // Any event listeners we may need to cancel later12 listenevents : [],13 bodycontent : null,14 headercontent : null,15 instanceconfig : null,16 setup_chooser_dialogue : function(bodycontent, headercontent, config) {17 this.bodycontent = bodycontent;18 this.headercontent = headercontent;19 this.instanceconfig = config;20 },21 prepare_chooser : function () {22 if (this.panel) {23 return;24 }25 // Set Default options26 var paramkey,27 params = {28 bodyContent : this.bodycontent.get('innerHTML'),29 headerContent : this.headercontent.get('innerHTML'),30 width : '540px',31 draggable : true,32 visible : false, // Hide by default33 zindex : 100, // Display in front of other items34 lightbox : true, // This dialogue should be modal35 shim : true,36 render : false,37 closeButtonTitle : this.get('closeButtonTitle')38 };39 // Override with additional options40 for (paramkey in this.instanceconfig) {41 params[paramkey] = this.instanceconfig[paramkey];42 }43 // Create the panel44 this.panel = new M.core.dialogue(params);45 // Remove the template for the chooser46 this.bodycontent.remove();47 this.headercontent.remove();48 // Hide and then render the panel49 this.panel.hide();50 this.panel.render();51 // Set useful links52 this.container = this.panel.get('boundingBox').one('.choosercontainer');53 this.options = this.container.all('.option input[type=radio]');54 // Add the chooserdialogue class to the container for styling55 this.panel.get('boundingBox').addClass('chooserdialogue');56 },57 /**58 * Display the module chooser59 *60 * @param e Event Triggering Event61 * @return void62 */63 display_chooser : function (e) {64 var bb, dialogue, thisevent;65 this.prepare_chooser();66 // Stop the default event actions before we proceed67 e.preventDefault();68 bb = this.panel.get('boundingBox');69 dialogue = this.container.one('.alloptions');70 // This will detect a change in orientation and retrigger centering71 thisevent = Y.one('document').on('orientationchange', function() {72 this.center_dialogue(dialogue);73 }, this);74 this.listenevents.push(thisevent);75 // Detect window resizes (most browsers)76 thisevent = Y.one('window').on('resize', function() {77 this.center_dialogue(dialogue);78 }, this);79 this.listenevents.push(thisevent);80 // These will trigger a check_options call to display the correct help81 thisevent = this.container.on('click', this.check_options, this);82 this.listenevents.push(thisevent);83 thisevent = this.container.on('key_up', this.check_options, this);84 this.listenevents.push(thisevent);85 thisevent = this.container.on('dblclick', function(e) {86 if (e.target.ancestor('div.option')) {87 this.check_options();88 // Prevent duplicate submissions89 this.submitbutton.setAttribute('disabled', 'disabled');90 this.options.setAttribute('disabled', 'disabled');91 this.cancel_listenevents();92 this.container.one('form').submit();93 }94 }, this);95 this.listenevents.push(thisevent);96 this.container.one('form').on('submit', function() {97 // Prevent duplicate submissions on submit98 this.submitbutton.setAttribute('disabled', 'disabled');99 this.options.setAttribute('disabled', 'disabled');100 this.cancel_listenevents();101 }, this);102 // Hook onto the cancel button to hide the form103 thisevent = this.container.one('.addcancel').on('click', this.cancel_popup, this);104 this.listenevents.push(thisevent);105 // Hide will be managed by cancel_popup after restoring the body overflow106 thisevent = bb.one('button.closebutton').on('click', this.cancel_popup, this);107 this.listenevents.push(thisevent);108 // Grab global keyup events and handle them109 thisevent = Y.one('document').on('keydown', this.handle_key_press, this);110 this.listenevents.push(thisevent);111 // Add references to various elements we adjust112 this.jumplink = this.container.one('.jump');113 this.submitbutton = this.container.one('.submitbutton');114 // Disable the submit element until the user makes a selection115 this.submitbutton.set('disabled', 'true');116 // Ensure that the options are shown117 this.options.removeAttribute('disabled');118 // Display the panel119 this.panel.show();120 // Re-centre the dialogue after we've shown it.121 this.center_dialogue(dialogue);122 // Finally, focus the first radio element - this enables form selection via the keyboard123 this.container.one('.option input[type=radio]').focus();124 // Trigger check_options to set the initial jumpurl125 this.check_options();126 },127 /**128 * Cancel any listen events in the listenevents queue129 *130 * Several locations add event handlers which should only be called before the form is submitted. This provides131 * a way of cancelling those events.132 *133 * @return void134 */135 cancel_listenevents : function () {136 // Detach all listen events to prevent duplicate triggers137 var thisevent;138 while (this.listenevents.length) {139 thisevent = this.listenevents.shift();140 thisevent.detach();141 }142 },143 /**144 * Calculate the optimum height of the chooser dialogue145 *146 * This tries to set a sensible maximum and minimum to ensure that some options are always shown, and preferably147 * all, whilst fitting the box within the current viewport.148 *149 * @param dialogue Y.Node The dialogue150 * @return void151 */152 center_dialogue : function(dialogue) {153 var bb = this.panel.get('boundingBox'),154 winheight = bb.get('winHeight'),155 newheight, totalheight;156 if (this.panel.shouldResizeFullscreen()) {157 // No custom sizing required for a fullscreen dialog.158 return;159 }160 // Try and set a sensible max-height -- this must be done before setting the top161 // Set a default height of 640px162 newheight = this.get('maxheight');163 if (winheight <= newheight) {164 // Deal with smaller window sizes165 if (winheight <= this.get('minheight')) {166 newheight = this.get('minheight');167 } else {168 newheight = winheight;169 }170 }171 // If the dialogue is larger than a reasonable minimum height, we172 // disable the page scrollbars.173 if (newheight > this.get('minheight')) {174 // Disable the page scrollbars.175 if (this.panel.lockScroll && !this.panel.lockScroll.isActive()) {176 this.panel.lockScroll.enableScrollLock(true);177 }178 } else {179 // Re-enable the page scrollbars.180 if (this.panel.lockScroll && this.panel.lockScroll.isActive()) {181 this.panel.lockScroll.disableScrollLock();182 }183 }184 // Take off 15px top and bottom for borders, plus 40px each for the title and button area before setting the185 // new max-height186 totalheight = newheight;187 newheight = newheight - (15 + 15 + 40 + 40);188 dialogue.setStyle('maxHeight', newheight + 'px');189 dialogueheight = bb.getStyle('height');190 if (dialogueheight.match(/.*px$/)) {191 dialogueheight = dialogueheight.replace(/px$/, '');192 } else {193 dialogueheight = totalheight;194 }195 if (dialogueheight < this.get('baseheight')) {196 dialogueheight = this.get('baseheight');197 dialogue.setStyle('height', dialogueheight + 'px');198 }199 this.panel.centerDialogue();200 },201 handle_key_press : function(e) {202 if (e.keyCode === 27) {203 this.cancel_popup(e);204 }205 },206 cancel_popup : function (e) {207 // Prevent normal form submission before hiding208 e.preventDefault();209 this.hide();210 },211 hide : function() {212 // Cancel all listen events213 this.cancel_listenevents();214 this.container.detachAll();215 this.panel.hide();216 },217 check_options : function() {218 // Check which options are set, and change the parent class219 // to show/hide help as required220 this.options.each(function(thisoption) {221 var optiondiv = thisoption.get('parentNode').get('parentNode');222 if (thisoption.get('checked')) {223 optiondiv.addClass('selected');224 // Trigger any events for this option225 this.option_selected(thisoption);226 // Ensure that the form may be submitted227 this.submitbutton.removeAttribute('disabled');228 // Ensure that the radio remains focus so that keyboard navigation is still possible229 thisoption.focus();230 } else {231 optiondiv.removeClass('selected');232 }233 }, this);234 },235 option_selected : function() {236 }237},238{239 NAME : 'moodle-core-chooserdialogue',240 ATTRS : {241 minheight : {242 value : 300243 },244 baseheight: {245 value : 400246 },247 maxheight : {248 value : 660249 },250 closeButtonTitle : {251 validator : Y.Lang.isString,252 value : 'Close'253 }254 }255});256M.core = M.core || {};...

Full Screen

Full Screen

ISC_Grids.js

Source:ISC_Grids.js Github

copy

Full Screen

1/*2 * Isomorphic SmartClient3 * Version 8.2 (2011-12-05)4 * Copyright(c) 1998 and beyond Isomorphic Software, Inc. All rights reserved.5 * "SmartClient" is a trademark of Isomorphic Software, Inc.6 *7 * licensing@smartclient.com8 *9 * http://smartclient.com/license10 */11//12// This script will load all of the Isomorhic SmartClient Application Framework libraries for you13//14// The idea is that in your app file you can just load the script "Isomorphic_SmartClient.js" which15// in a production situation would be all of the scripts jammed together into a single file.16//17// However, it's easier to work on the scripts as individual files, this file will load all of the18// scripts individually for you (with a speed penalty).19// 20var libs = 21 [22 //"language/Array_util", // utility array methods, not commonly used23 "language/List", // equivalent functionality to a native Array, as a isc.Class24 "language/Tree", // generic isc.Tree implementation25 //"language/Tree_util", // additional, not commonly used Tree routines26 //"language/ObjectTree", // wrapper so you can treat an arbitrary object as a tree27 "language/Selection", // provides a selection of a list, including selecting based28 // on mouse events29 //>DetailViewer30 "widgets/DetailViewer", // show attributes of one or more objects as a vertical table31 //<DetailViewer32// "widgets/Toolbar", // collection of buttons33 "widgets/GridRenderer", // high speed, flexible, feature-rich table34 "widgets/ListGrid", // multi-column viewer for a list of objects35 "widgets/TreeGrid", // viewer for a tree of objects36 "widgets/GridToolStrip", 37 38 39 "widgets/RecordEditor", // specialized listViewer for editing a single record40 //"widgets/Finder", // specialized tree viewer that resembles the Macintosh isc.Finder41 //"widgets/Explorer", // specialized tree viewer that resembles the left part of a Windows Explorer42 //"widgets/ExplorerList", // specialized tree viewer that resembles the right part of a Windows Explorer43 //"widgets/ScrollingMenu", // specialized listViewer with menu type event-handling 44 // behaviour, but scrollable and ready for data-binding45 //>Menu 46 "widgets/Menu", // pull-down or context menus47 //<Menu48 //>MenuButton49 "widgets/MenuButton", // button that shows a menu on click50 //<MenuButton51 //>TreeMenuButton52 "widgets/TreeMenuButton", // Button/Menu with hierachichal, selectable data53 //<TreeMenuButton54 55 "widgets/TileLayout",56 "widgets/TileGrid", // displays a tiled list of items57 58 //>ColumnTree59 "widgets/ColumnTree", // displays a tree structure as Miller Columns, like iTunes60 //<ColumnTree61 62 //>TableView63 "widgets/TableView", // displays an iPhone-style table for selection64 //<TableView65 //>DOMGrids66 "language/DOMTree", // Tree model that understands DOMs (XML and HTML)67 "widgets/DOMGrid", // TreeGrid subclass specialized to show DOMs68 //<DOMGrids69 70 //>Menubar71 "widgets/Menubar", // set of menus shown as a menubar72 //<Menubar73 "language/CellSelection", // provides a selection of a grid, including selecting based 74 // on mouse events75 "widgets/FieldEditor",76 77 "widgets/FormulaBuilder",78 "widgets/HiliteEditor",79 "widgets/ReportChooser"80 ];81//<STOP PARSING 82// The following code only executes if the script is being dynamically loaded.83// the following statement allows a page that is not in the standard location to take advantage of84// dynamically loaded scripts by explicitly setting the window.isomorphiDir variable itself.85if (! window.isomorphicDir) window.isomorphicDir = "../isomorphic/";86// dynamic loading87function iscLoadLibs() {88 for(var i=0,l=libs.length;i<l;i++) {89 if (!libs[i]) continue;90 if (window.UNSUPPORTED_BROWSER_DETECTED == true) break;91 document.write("<"+"SCRIPT SRC=" + window.isomorphicDir + "client/" + libs[i]+".js><"+"/SCRIPT>");92 }93 window.defaultStatus = "";94}...

Full Screen

Full Screen

keynode.slidechooser.js

Source:keynode.slidechooser.js Github

copy

Full Screen

1/* 2 * This file is part of KeyNode.JS.3 * 4 * KeyNode.JS is free software: you can redistribute it and/or modify5 * it under the terms of the GNU General Public License as published by6 * the Free Software Foundation, either version 3 of the License, or7 * (at your option) any later version.8 * 9 * KeyNode.JS is distributed in the hope that it will be useful,10 * but WITHOUT ANY WARRANTY; without even the implied warranty of11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 * GNU General Public License for more details.13 *14 * You should have received a copy of the GNU General Public License15 * along with KeyNode.JS. If not, see <http://www.gnu.org/licenses/>.16 * 17 */18var SlideChooserAddon = {19 $slideChooser : null,20 $setup : $.keynode('getSetup'),21 lang : {22 de : {23 slidePreviewTitle: "Folie $1"24 },25 en : {26 slidePreviewTitle: "Slide $1"27 }28 },29 30 init : function () {31 // do not do anything before presenter.slideLength is available:32 if(presenter.slideLength < 0) {33 setTimeout(SlideChooserAddon.init, 500);34 return;35 }36 37 // init strings:38 if (navigator.language.indexOf("de") > -1) {39 SlideChooserAddon.strings = SlideChooserAddon.lang.de;40 } else {41 SlideChooserAddon.strings = SlideChooserAddon.lang.en;42 }43 var strings = SlideChooserAddon.strings;44 45 46 var $slideChooser = SlideChooserAddon.$slideChooser = $('<div id="SlideChooser"></div>');47 var $broad = $('<div class="broad"></div>');48 $(document.body).append( $slideChooser.append($broad) );49 50 51 var slideChooserMinOpacity = 0.5,52 iframeContainerMinOpacity = 0.7;53 54 $slideChooser55 .css({opacity: slideChooserMinOpacity})56 .mouseenter(function() { $slideChooser.stop().animate({opacity: 1}, 200); })57 .mouseleave(function() { $slideChooser.stop().animate({opacity: slideChooserMinOpacity}, 300); });58 59 60 for(var slideNo=0; slideNo<presenter.slideLength; slideNo++) {61 if(SlideChooserAddon.$setup===null)62 SlideChooserAddon.$setup=$.keynode('getSetup');63 var $iframe = $('<iframe />').attr('src', SlideChooserAddon.$setup.getPresentationURL()+'#slidechooser-slide-'+slideNo);64 var $blocker = $('<div class="click-blocker"></div>');65 var $container = $('<div class="slide-container"></div>');66 $broad.append( $container.append($iframe, $blocker) );67 68 $container69 .css({opacity: iframeContainerMinOpacity});70 $blocker71 .mouseenter(function() { $(this).parent().stop().animate({opacity: 1}, 200); })72 .mouseleave(function() { $(this).parent().stop().animate({opacity: iframeContainerMinOpacity}, 300); });73 74 $blocker[0].slideNo = slideNo;75 $blocker.attr('title', strings.slidePreviewTitle.replace(/\$1/, slideNo+1));76 $blocker.click(function(evt) {77 SlideChooserAddon.slideClick(evt, this.slideNo);78 });79 }80 81 var containerWidth = $container.width(),82 containerMargin= parseInt( $container.css('margin-right').replace(/px/, '') ),83 borderWidth = parseInt( $container.css('border-left-width').replace(/px/, '') )84 + parseInt( $container.css('border-right-width').replace(/px/, '') );85 $broad.css({86 width: ( (containerWidth+containerMargin+borderWidth)*presenter.slideLength + 5 ) + 'px'87 });88 },89 90 slideClick : function (event, slideNo) {91 console.log("slideClick: "+slideNo);92 event.preventDefault();93 94 var prevSlideNo = presenter.slideNumber;95 presenter.slideNumber = slideNo;96 presenter.GotoFolie(slideNo);97 98 var e = $.Event($.keynode('getEvents').presenter.slideChange);99 $(document).trigger(e, [prevSlideNo, slideNo]);100 }101};102103setTimeout(function() {104 SlideChooserAddon.init();105}, 1500); ...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require("qawolf");2const browser = await qawolf.launch();3const context = await browser.newContext();4const page = await context.newPage();5await qawolf.stop();6await browser.close();7const qawolf = require("qawolf");8const browser = await qawolf.launch();9const context = await browser.newContext();10const page = await context.newPage();11await qawolf.stop();12await browser.close();13const qawolf = require("qawolf");14const browser = await qawolf.launch();15const context = await browser.newContext();16const page = await context.newPage();17await qawolf.stop();18await browser.close();19const qawolf = require("qawolf");20const browser = await qawolf.launch();21const context = await browser.newContext();22const page = await context.newPage();23await qawolf.stop();24await browser.close();25const qawolf = require("qawolf");26const browser = await qawolf.launch();27const context = await browser.newContext();28const page = await context.newPage();29await qawolf.stop();30await browser.close();31const qawolf = require("qawolf");32const browser = await qawolf.launch();33const context = await browser.newContext();34const page = await context.newPage();35await qawolf.stop();36await browser.close();37const qawolf = require("qawolf");38const browser = await qawolf.launch();39const context = await browser.newContext();40const page = await context.newPage();41await qawolf.stop();42await browser.close();43const qawolf = require("qawolf");44const browser = await qawolf.launch();

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require('qawolf');2const browser = await qawolf.launch();3const context = await browser.newContext();4const page = await context.newPage();5await qawolf.register(page);6await page.click('input[name="q"]');7await page.fill('input[name="q"]', 'qawolf');8await page.press('input[name="q"]', 'Enter');9await page.click('text=QAWolf: Automate your end-to-end tests with ease');10await page.click('text=Learn more');

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require('qawolf');2(async () => {3 const browser = await qawolf.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 await qawolf.register(page);7 await page.click('text=Example Domain');8 await page.click('text=More information...');9 await qawolf.stop();10 await browser.close();11})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const qawolf = require("qawolf");2(async () => {3 const browser = await qawolf.launch();4 const context = await browser.newContext();5 const page = await context.newPage();6 const chooser = await qawolf.createChooser();7 await chooser.stop();8 await browser.close();9})();10const qawolf = require("qawolf");11(async () => {12 const browser = await qawolf.launch();13 const context = await browser.newContext();14 const page = await context.newPage();15 const chooser = await qawolf.createChooser();16 await chooser.stop();17 await browser.close();18})();19const qawolf = require("qawolf");20(async () => {21 const browser = await qawolf.launch();22 const context = await browser.newContext();23 const page = await context.newPage();24 const chooser = await qawolf.createChooser();25 await chooser.stop();26 await browser.close();27})();28const qawolf = require("qawolf");29(async () => {30 const browser = await qawolf.launch();31 const context = await browser.newContext();32 const page = await context.newPage();33 const chooser = await qawolf.createChooser();34 await chooser.stop();35 await browser.close();36})();37const qawolf = require("qawolf");38(async () => {39 const browser = await qawolf.launch();40 const context = await browser.newContext();41 const page = await context.newPage();42 const chooser = await qawolf.createChooser();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch, firefox, chromium, webkit } = require('qawolf');2(async () => {3 const browser = await chromium.launch({ headless: false });4 const context = await browser.newContext();5 const page = await context.newPage();6 await page.click('input[name="q"]');7 await page.fill('input[name="q"]', 'qawolf');8 await page.click('text=Search');9 await page.click('text=QAWolf: End-to-End Testing for Web Apps');10 await page.click('text=Docs');11 await page.click('text=Getting Started');12 await page.click('text=QAWolf');13 await page.click('text=Create a Test');14 await page.click('text=QAWolf');15 await page.click('text=Create a Test');16 await page.click('text=QAWolf');17 await page.click('text=Create a Test');18 await page.click('text=QAWolf');19 await page.click('text=Create a Test');20 await page.close();21 await browser.close();22})();23const { launch, firefox, chromium, webkit } = require('qawolf');24(async () => {25 const browser = await chromium.launch({ headless: false });26 const context = await browser.newContext();27 const page = await context.newPage();28 await page.click('input[name="q"]');29 await page.fill('input[name="

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chooser } = require('qawolf');2const { chromium } = require('playwright');3const { test } = require('qawolf');4test('test', async () => {5 const browser = await chromium.launch();6 const page = await browser.newPage();7 await chooser.stop();8 await page.close();9 await browser.close();10});11{12 "scripts": {13 },14 "dependencies": {15 }16}

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch, stop } = require("qawolf");2await stop(browser);3const { launch, stop } = require("qawolf");4await stop(browser);5const { launch, stop } = require("qawolf");6await stop(browser);7const { launch, stop } = require("qawolf");8await stop(browser);9const { launch, stop } = require("qawolf");10await stop(browser);11const { launch, stop } = require("qawolf");12await stop(browser);13const { launch, stop } = require("qawolf");14await stop(browser);15const { launch, stop } = require("qawolf");16await stop(browser);17const { launch, stop } = require("qawolf");18await stop(browser);19const { launch, stop } = require("qawolf");20await stop(browser);

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch, firefox } = require("qawolf");2const page = await browser.page();3await page.click("input[name='q']");4await page.type("input[name='q']", "hello world");5await browser.close();6const { chromium } = require("playwright");7const browser = await chromium.launch();8const context = await browser.newContext();9const page = await context.newPage();10await page.click("input[name='q']");11await page.type("input[name='q']", "hello world");12await browser.close();13const puppeteer = require("puppeteer");14const browser = await puppeteer.launch();15const page = await browser.newPage();16await page.click("input[name='q']");17await page.type("input[name='q']", "hello world");18await browser.close();19const puppeteer = require("puppeteer-core");20const browser = await puppeteer.launch();21const page = await browser.newPage();22await page.click("input[name='q']");23await page.type("input[name='q']", "hello world");24await browser.close();25const puppeteer = require("puppeteer-firefox");26const browser = await puppeteer.launch();27const page = await browser.newPage();28await page.click("input[name='q']");29await page.type("input[name='q']", "hello world");30await browser.close();31const puppeteer = require("puppeteer-sharp");32const browser = await puppeteer.launch();33const page = await browser.newPage();34await page.click("input[name='q']");35await page.type("input[name='q']", "hello world");36await browser.close();37const { chromium } = require("playwright-chromium");38const browser = await chromium.launch();39const context = await browser.newContext();40const page = await context.newPage();

Full Screen

Using AI Code Generation

copy

Full Screen

1const { launch, stop } = require("qawolf");2await stop(browser);3const { launch, stop } = require("qawolf");4describe("test", () => {5 let browser;6 beforeAll(async () => {7 });8 afterAll(async () => {9 await stop(browser);10 });11 it("test", async () => {12 });13});14const { launch, stop } = require("qawolf");15describe("test", () => {16 let browser;17 beforeAll(async () => {18 });19 afterAll(async () => {20 await stop(browser);21 });22 it("test", async () => {23 });24});25const { launch, stop } = require("qawolf");26describe("test", () => {27 let browser;28 beforeAll(async () => {29 });30 afterAll(async () => {31 await stop(browser);32 });33 it("test", async () => {34 });35});36const { launch, stop } = require("qawolf");37describe("test", () => {38 let browser;39 beforeAll(async () => {40 });41 afterAll(async () => {42 await stop(browser);43 });44 it("test", async () => {45 });46});47const { launch, stop } = require("qawolf");48describe("test", () => {49 let browser;50 beforeAll(async () => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const { chooser } = require("qawolf");2const { chromium } = require("playwright-chromium");3const { devices } = require("playwright-chromium");4const { firefox } = require("playwright-firefox");5const { webkit } = require("playwright-webkit");6const { webkit: devicesWebkit } = require("playwright-webkit");7const { chromium: devicesChromium } = require("playwright-chromium");8const { firefox: devicesFirefox } = require("playwright-firefox");9const { devices: devicesDevices } = require("playwright");10(async () => {11 const browser = await chromium.launch({12 });13 const context = await browser.newContext({14 });15 const page = await context.newPage();16 await page.click("input[name=\"q\"]");17 await page.fill("input[name=\"q\"]", "Hello world!");18 await page.press("input[name=\"q\"]", "Enter");19 await page.click("text=Images");20 await page.click("text=Videos");21 await page.click("text=News");22 await page.click("text=Shopping");23 await page.click("text=Maps");24 await page.click("text=Books");25 await page.click("text=Flights");26 await page.click("text=More");27 await page.click("text=Settings");28 await page.click("text=Tools");29 await page.click("text=Sign in");30 await page.click("text=Search tools");31 await page.click("text=Advertising");32 await page.click("text=Business");33 await page.click("text=About");34 await page.click("text=How Search works");35 await page.click("text=Privacy");36 await page.click("text=Terms");37 await page.click("text=Settings");38 await page.click("text=History");39 await page.click("text=Search history");40 await page.click("text=Saved");41 await page.click("text=More");42 await page.click("text=Advanced search");43 await page.click("text=Language tools");

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