How to use isControl method in Puppeteer

Best JavaScript code snippet using puppeteer

Main.js

Source:Main.js Github

copy

Full Screen

1MWF.xApplication.cms = MWF.xApplication.cms || {};2MWF.xApplication.cms.Document = MWF.xApplication.cms.Document || {};3MWF.xApplication.cms.Document.options.multitask = true;4MWF.xDesktop.requireApp("cms.Document", "HotLinkForm", null, false);5MWF.xApplication.cms.Document.Main = new Class({6 Extends: MWF.xApplication.Common.Main,7 Implements: [Options, Events],8 options: {9 "style": "default",10 "name": "cms.Document",11 "icon": "icon.png",12 "width": "1200",13 "height": "680",14 "title": MWF.xApplication.cms.Document.LP.title,15 "documentId": "",16 "isControl": false,17 "readonly": true,18 "autoSave" : true,19 "saveOnClose" : true,20 "postPublish" : null,21 "postDelete" : null,22 "formId" : null,23 "formEditId" : null24 },25 onQueryLoad: function(){26 this.lp = MWF.xApplication.cms.Document.LP;27 if (this.status){28 this.options.documentId = this.status.documentId;29 this.options.readonly = (this.status.readonly=="true" || this.status.readonly==true) ? true : false;30 this.options.autoSave = (this.status.autoSave=="true" || this.status.autoSave==true) ? true : false;31 this.options.saveOnClose = (this.status.saveOnClose=="true" || this.status.saveOnClose==true) ? true : false;32 this.options.formId = this.status.formId;33 this.options.printFormId = this.status.printFormId;34 }35 if( this.options.documentId && this.options.documentId!=""){36 this.options.appId = "cms.Document"+this.options.documentId;37 }38 },39 loadApplication: function(callback){40 this.node = new Element("div", {"styles": this.css.content}).inject(this.content);41 MWF.require("MWF.widget.Mask", function(){42 this.mask = new MWF.widget.Mask({"style": "desktop"});43 this.formNode = new Element("div", {"styles": {"min-height": "100%"}}).inject(this.node);44 // MWF.xDesktop.requireApp("cms.Document", "Actions.RestActions", function(){45 this.action = MWF.Actions.get("x_cms_assemble_control"); //new MWF.xApplication.cms.Document.Actions.RestActions();46 if (!this.options.isRefresh){47 this.maxSize(function(){48 this.mask.loadNode(this.content);49 this.loadDocument();50 }.bind(this));51 }else{52 this.mask.loadNode(this.content);53 this.loadDocument();54 }55 if (callback) callback();56 //}.bind(this));57 }.bind(this));58 this.addEvent("queryClose", function(){59 this.refreshTaskCenter();60 }.bind(this));61 this.addKeyboardEvents();62 },63 refreshTaskCenter: function(){64 if (this.desktop.apps["cms.Explorer"]){65 if(this.desktop.apps["cms.Explorer"].content){66 this.desktop.apps["cms.Explorer"].content.unmask();67 }68 if( this.desktop.apps["cms.Explorer"] ){69 this.desktop.apps["cms.Explorer"].refreshAll();70 }71 }72 },73 addKeyboardEvents: function(){74 this.addEvent("keySave", function(e){75 this.keySave(e);76 }.bind(this));77 },78 keySave: function(e){79 if (this.appForm){80 if (!this.readonly){81 this.appForm.saveDocument();82 e.preventDefault();83 }84 }85 },86 reload: function(data){87 if (this.form){88 this.formNode.empty();89 MWF.release(this.form);90 this.form = null;91 }92 this.parseData(data);93 this.openDocument();94 },95 getDocument : function( callback ){96 var id = this.options.documentId;97 //if( this.options.anonymousAccess ){98 // this.action.getDocumentByAnonymous(id, function(json){99 // callback(json)100 // }.bind(this), function( error ){101 // this.notice( this.lp.documentGettedError + ":" + error.responseText , "error");102 // this.close();103 // }.bind(this));104 //}else if( this.options.readonly ){105 // this.action.viewDocument(id, function(json){106 // callback(json)107 // }.bind(this), function( error ){108 // this.notice( this.lp.documentGettedError + ":" + error.responseText , "error");109 // this.close();110 // }.bind(this));111 //}else{112 // this.action.getDocument(id, function(json){113 // callback(json)114 // }.bind(this), function( error ){115 // this.notice( this.lp.documentGettedError + ":" + error.responseText , "error");116 // this.close();117 // }.bind(this));118 //}119 var documentMethod = "getDocument";120 if( this.options.anonymousAccess ){121 documentMethod = "getDocumentByAnonymous"122 }else if( this.options.readonly && !this.options.printFormId){123 documentMethod = "viewDocument";124 }125 var attachmentMethod = "listAttachment";126 if( this.options.anonymousAccess ){127 attachmentMethod = "listAttachmentByAnonymous"128 }129 o2.Actions.invokeAsync([130 {"action": this.action, "name": documentMethod},131 {"action": this.action, "name": attachmentMethod }132 ], {"success": function(json_document, json_att){133 if (json_document ){134 if( json_att && typeOf( json_att.data ) === "array" ){135 json_document.data.attachmentList = json_att.data ;136 }else{137 json_document.data.attachmentList = [];138 }139 callback(json_document)140 }else{141 this.notice( this.lp.documentGettedError + ":" + error.responseText , "error");142 this.close();143 }144 }.bind(this), "failure": function(){145 this.notice( this.lp.documentGettedError + ":" + error.responseText , "error");146 this.close();147 }.bind(this)}, id);148 },149 loadDocument: function(){150 this.getDocument( function(json){151 json.data = json.data || [];152 this.parseData(json.data);153 this.loadForm( this.formId );154 }.bind(this) );155 },156 errorDocument: function(){157 if (this.mask) this.mask.hide();158 this.node.set("text", "openError");159 },160 loadForm : function( formId, flag ){161 var success = function(json){162 if( layout.mobile ){163 this.form = (json.data.mobileData) ? JSON.decode(MWF.decodeJsonString(json.data.mobileData)): null;164 if( !this.form ){165 this.form = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;166 }167 }else{168 this.form = (json.data.data) ? JSON.decode(MWF.decodeJsonString(json.data.data)): null;169 }170 //this.listAttachment();171 this.openDocument();172 if (this.mask) this.mask.hide();173 }.bind(this);174 var failure = function(error){175 //没有表单,重新获取分类表单176 if( !flag ){177 this.action.getCategory( this.document.categoryId, function(json){178 var d = json.data;179 this.formId = d.formId || d.readFormId;180 if( this.readonly == true && d.readFormId && d.readFormId != "" ){181 this.formId = d.readFormId;182 }183 this.loadForm( this.formId, true );184 }.bind(this));185 }else{186 this.notice( this.lp.formGettedError + ":" + error.responseText , "error");187 this.close();188 }189 }.bind(this);190 if( this.options.printFormId){191 this.action.getForm(this.options.printFormId, function( json ){192 success(json);193 }.bind(this), function(error){194 failure(error)195 }.bind(this));196 }else{197 if( this.options.anonymousAccess ){198 this.action.getFormByAnonymous(formId, function( json ){199 success(json);200 }.bind(this), function(error){201 failure(error)202 }.bind(this));203 }else{204 this.action.getForm(formId, function( json ){205 success(json);206 }.bind(this), function(error){207 failure(error)208 }.bind(this));209 }210 }211 },212 //listAttachment: function(){213 // if( this.document.attachmentList && this.document.attachmentList.length > 0 ){214 // this.action.listAttachment(this.options.documentId, function( json ){215 // if (this.mask) this.mask.hide();216 // this.attachmentList = json.data;217 // this.attachmentList.each(function(att){218 // att.lastUpdateTime = att.updateTime;219 // att.person = att.creatorUid;220 // })221 // this.openDocument();222 // }.bind(this), function(error){223 // this.notice( this.lp.attachmentGettedError + ":" + error.responseText, "error");224 // this.close();225 // }.bind(this));226 // }else{227 // if (this.mask) this.mask.hide();228 // this.attachmentList = [];229 // this.openDocument();230 // }231 //},232 isEmptyObject: function( obj ) {233 var name;234 for ( name in obj ) {235 return false;236 }237 return true;238 },239 parseData: function(data){240 var title = "";241 title = data.document.title;242 this.setTitle(title);243 data.document.subject = data.document.title;244 this.data = data.data;245 this.attachmentList = data.attachmentList || [];246 this.attachmentList.each(function(att){247 att.lastUpdateTime = att.updateTime;248 att.person = att.creatorUid;249 });250 if( this.isEmptyObject(this.data) ){251 this.data.isNew = true;252 }else{253 this.data.isNew = false;254 }255 this.document = data.document;256 var isAdmin = false;257 if( MWF.AC.isCMSManager() ){258 this.options.isControl = true;259 isAdmin = true;260 }261 if( data.isAppAdmin ){262 this.options.isControl = true;263 isAdmin = true;264 }265 if( data.isCategoryAdmin ){266 this.options.isControl = true;267 isAdmin = true;268 }269 if( data.isManager ){270 this.options.isControl = true;271 isAdmin = true;272 }273 this.isAdmin = isAdmin;274 ////系统管理员275 //if( MWF.AC.isAdministrator() ){276 // this.options.isControl = true;277 // isAdmin = true;278 //}279 ////栏目管理员280 //if(this.controllers && this.controllers.contains(this.desktop.session.user.name) ){281 // this.options.isControl = true;282 // isAdmin = true;283 //}284 //文档创建人285 if( data.isCreator || this.desktop.session.user.distinguishedName==this.document.creatorPerson ){286 this.options.isControl = true;287 }288 if( data.isEditor ){ //作者权限289 this.options.isControl = true;290 }291 if( this.options.readonly ){ //强制只读292 this.readonly = true;293 }else{294 this.readonly = true;295 if(this.options.isControl && this.document.docStatus != "archived"){296 this.readonly = false;297 }298 }299 this.formId = this.document.form || this.document.readFormId;300 if( this.readonly == true && this.document.readFormId && this.document.readFormId != "" ){301 this.formId = this.document.readFormId;302 if(this.options.formId){303 this.formId = this.options.formId304 }305 }else {306 if(this.options.formEditId){307 this.formId = this.options.formEditId308 }309 }310 if(this.readonly || this.document.docStatus == "published"){311 this.options.autoSave = false;312 this.options.saveOnClose = false;313 }314 //this.attachmentList = data.attachmentList;315 //this.inheritedAttachmentList = data.inheritedAttachmentList;316 var isControl = this.options.isControl;317 this.control = data.control || {318 "allowRead": true,319 "allowPublishDocument": isControl && this.document.docStatus == "draft",320 "allowSave": isControl && this.document.docStatus == "published",321 "allowPopularDocument": MWF.AC.isHotPictureManager() && this.document.docStatus == "published",322 "allowEditDocument": isControl && !this.document.wf_workId,323 "allowDeleteDocument": isControl && !this.document.wf_workId324 };325 },326 setPopularDocument: function(){327 var form = new MWF.xApplication.cms.Document.HotLinkForm(this, this.document, {328 documentId : this.options.documentId,329 summary : this.data.explain || "",330 onPostOk : function( id ){331 }.bind(this)332 },{333 app : this, lp : this.lp, css : this.css, actions : this.action334 });335 form.create();336 },337 openDocument: function(){338 if (this.form){339 MWF.xDesktop.requireApp("cms.Xform", "Form", function(){340 this.appForm = new MWF.CMSForm(this.formNode, this.form, {341 "readonly": this.readonly,342 "autoSave" : this.options.autoSave,343 "saveOnClose" : this.options.saveOnClose,344 "onPostPublish" : this.options.postPublish,345 "onAfterPublish" : this.options.afterPublish,346 "onPostDelete" : this.options.postDelete347 });348 this.appForm.businessData = {349 "data": this.data,350 "document": this.document,351 "control": this.control,352 "attachmentList": this.attachmentList,353 "status": {354 //"readonly": (this.options.readonly) ? true : false355 "readonly": this.readonly356 }357 };358 this.appForm.documentAction = this.action;359 this.appForm.app = this;360 this.appForm.load();361 }.bind(this));362 }363 },364 //errorDocument: function(){365 //366 //},367 recordStatus: function(){368 var status ={369 "documentId": this.options.documentId,370 "readonly": this.options.readonly,371 "autoSave" : this.options.autoSave,372 "saveOnClose" : this.options.saveOnClose373 };374 if( this.options.formId )status.formId = this.options.formId;375 if( this.options.printFormId )status.printFormId = this.options.printFormId;376 if(this.options.appId && this.options.appId!="")status.appId = this.options.appId;377 return status;378 },379 onPostClose: function(){380 if (this.appForm){381 this.appForm.modules.each(function(module){382 MWF.release(module);383 });384 MWF.release(this.appForm);385 }386 }...

Full Screen

Full Screen

personalize_elements.js

Source:personalize_elements.js Github

copy

Full Screen

1(function ($) {2 Drupal.personalize = Drupal.personalize || {};3 Drupal.personalize.executors = Drupal.personalize.executors || {};4 Drupal.personalize.executors.personalizeElements = {5 execute: function($option_set, choice_name, osid, preview) {6 if (typeof preview === 'undefined') { preview = false; }7 var element = Drupal.settings.personalize_elements.elements[osid];8 if (element == undefined) return;9 if (Drupal.personalizeElements.hasOwnProperty(element.variation_type) && typeof Drupal.personalizeElements[element.variation_type].execute === 'function') {10 if (preview && !element.previewable) {11 // If this variation is not previewable in the normal way, we can just reload12 // the page with the selected option.13 var base = Drupal.settings.basePath;14 var path = location.pathname && /^(?:[\/\?\#])*(.*)/.exec(location.pathname)[1] || '';15 var param = Drupal.settings.personalize.optionPreselectParam;16 document.location.href = base + path + '?' + param + '=' + osid + '--' + choice_name;17 }18 else {19 // Add the personalize data attribute for the option set.20 if ($option_set.length > 0) {21 $option_set.attr('data-personalize', osid);22 }23 var choices = Drupal.settings.personalize.option_sets[osid].options, selectedChoice = null, selectedContent = null, isControl = false, choiceIndex = null, choice = null;24 if (choice_name) {25 for (choiceIndex in choices) {26 choice = choices[choiceIndex];27 if (choice.option_id == choice_name) {28 selectedChoice = choice;29 break;30 }31 }32 }33 // This might be a "do nothing" option, either because it is the control option34 // or because it is an option with no content, in which case we treat is as the35 // control option.36 if (choice_name == Drupal.settings.personalize.controlOptionName || !selectedChoice || !selectedChoice.hasOwnProperty('personalize_elements_content')) {37 isControl = true;38 }39 else {40 selectedContent = selectedChoice.personalize_elements_content;41 }42 // runJS does not require a selector and editHtml can result in an43 // empty option set if the new html alters the DOM structure.44 if ($option_set.length == 0 && ['runJS','editHtml'].indexOf(element.variation_type) == -1) {45 return;46 } else if ($option_set.length > 1) {47 // Cannot perform personalization on sets of matched elements.48 return;49 }50 Drupal.personalizeElements[element.variation_type].execute($option_set, selectedContent, isControl, osid);51 Drupal.personalize.executorCompleted($option_set, choice_name, osid);52 }53 }54 }55 };56 Drupal.personalizeElements = {};57 Drupal.personalizeElements.runJS = {58 execute : function ($selector, selectedContent, isControl, osid) {59 if (!isControl) {60 // The contents of the selectedContent variable were written by someone61 // who was explicitly given permission to write JavaScript to be executed62 // on this site. Mitigating the evil of the eval.63 eval(selectedContent);64 }65 }66 };67 Drupal.personalizeElements.replaceHtml = {68 controlContent : {},69 execute : function($selector, selectedContent, isControl, osid) {70 // We need to keep track of how we've changed the element, if only71 // to support previewing different options.72 if (isControl && !this.controlContent.hasOwnProperty(osid)) {73 this.controlContent[osid] = $selector.html();74 }75 if (isControl) {76 $selector.html(this.controlContent[osid]);77 }78 else {79 $selector.html(selectedContent);80 Drupal.attachBehaviors($selector);81 }82 }83 };84 Drupal.personalizeElements.editHtml = {85 controlContent: {},86 getOuterHtml: function ($element) {87 if ($element.length > 1) {88 $element = $element.first();89 }90 // jQuery doesn't have an outerHTML so we need to clone the child and91 // give it a parent so that we can call that parent's html function.92 // This ensures we get only the html of the $selector and not siblings.93 var $element = $element.clone().wrap('<div>').parent();94 // Now return the child html of our wrapper parent tag.95 return $element.html();96 },97 // JQuery does not provide a public way to find events so we have to resort98 // to semi-documented structures.99 // http://blog.jquery.com/2011/11/08/building-a-slimmer-jquery/100 getElementEvents: function ($element) {101 if ($element.length === 0) return {};102 if ($._data) {103 // jQuery 1.8 and higher.104 return $._data($element.get(0), "events");105 } else if ($element.data) {106 // Older jQuery version.107 return $element.data('events');108 }109 return {};110 },111 addElementEvents: function($element, events) {112 for (var type in events) {113 var i, num = events[type].length;114 for (i = 0; i < num; i++) {115 var event = events[type][i];116 if (event.handler) {117 var eventBind = (event.namespace && event.namespace.length > 0) ? type + '.' + event.namespace : type;118 var dataBind = event.data ? event.data : {};119 $element.bind(eventBind, dataBind, event.handler);120 }121 }122 }123 },124 addElementData: function($element, data) {125 for (var key in data) {126 $.data($element.get(0), key, data[key]);127 }128 return $element;129 },130 getElement: function (osid) {131 return $('[data-personalize="' + osid + '"]');132 },133 execute : function($selector, selectedContent, isControl, osid) {134 // Keep track of how the element has been changed in order to preview135 // different options.136 if (isControl && !this.controlContent.hasOwnProperty(osid)) {137 this.controlContent[osid] = this.getOuterHtml($selector);138 }139 if ($selector.length === 0) {140 $selector = this.getElement(osid);141 }142 var events = this.getElementEvents($selector);143 var data = $selector.data();144 if (isControl) {145 $selector.replaceWith(this.controlContent[osid]);146 // Reset the $selector variable to the new element.147 $selector = this.getElement(osid);148 this.addElementEvents($selector, events);149 this.addElementData($selector, data);150 } else {151 if (selectedContent.charAt(0) != '<') {152 // We need this content to be wrapped in a tag so that it can be153 // marked with the osid for later selection.154 selectedContent = '<span>' + selectedContent + '</span>';155 }156 var $newContent = $(selectedContent).replaceAll($selector);157 // Add the data attribute to the new content.158 $newContent.attr('data-personalize', osid);159 this.addElementEvents($newContent, events);160 this.addElementData($newContent, data);161 }162 }163 };164 Drupal.personalizeElements.editText = {165 controlContent: {},166 execute : function($selector, selectedContent, isControl, osid) {167 // Keep track of how the element has been changed in order to preview168 // different options.169 if (isControl && !this.controlContent.hasOwnProperty(osid)) {170 this.controlContent[osid] = $selector.text();171 }172 if (isControl) {173 $selector.text(this.controlContent[osid]);174 } else {175 $selector.text(selectedContent);176 }177 }178 };179 Drupal.personalizeElements.addClass = {180 addedClasses : {},181 execute : function($selector, selectedContent, isControl, osid) {182 // We need to keep track of how we've changed the element, if only183 // to support previewing different options.184 if (!this.addedClasses.hasOwnProperty(osid)) {185 this.addedClasses[osid] = [];186 }187 for (var i in this.addedClasses[osid]) {188 if (this.addedClasses[osid].hasOwnProperty(i)) {189 $selector.removeClass(this.addedClasses[osid].shift());190 }191 }192 if (!isControl) {193 $selector.addClass(selectedContent);194 this.addedClasses[osid].push(selectedContent);195 }196 }197 };198 Drupal.personalizeElements.appendHtml = {199 execute : function($selector, selectedContent, isControl, osid) {200 var id = 'personalize-elements-append-' + osid;201 $('#' + id).remove();202 if (!isControl) {203 $selector.append('<span id="' + id + '">' + selectedContent + '</span>');204 Drupal.attachBehaviors($selector);205 }206 }207 };208 Drupal.personalizeElements.prependHtml = {209 execute : function($selector, selectedContent, isControl, osid) {210 var id = 'personalize-elements-prepend-' + osid;211 $('#' + id).remove();212 if (!isControl) {213 $selector.prepend('<span id="' + id + '">' + selectedContent + '</span>');214 Drupal.attachBehaviors($selector);215 }216 }217 };...

Full Screen

Full Screen

cncGenerator.js

Source:cncGenerator.js Github

copy

Full Screen

1import ManufacturingLayer from "./manufacturingLayer";2import DepthFeatureMap from "./depthFeatureMap";3import Device from "../core/device";4/**5 * GNCGenerator class6 */7export default class CNCGenerator {8 /**9 * Default Constructor of GNCGenerator object.10 * @param {Device} device Device object11 * @param {*} viewManagerDelegate 12 */13 constructor(device, viewManagerDelegate) {14 this.__device = device;15 this.__viewManagerDelegate = viewManagerDelegate;16 this.__svgData = new Map();17 }18 /**19 * Gets the SVG output20 * @returns {}21 * @memberof CNCGenerator22 */23 getSVGOutputs() {24 return this.__svgData;25 }26 /**27 * Generate the port layers28 * @memberof CNCGenerator29 * @returns {void}30 */31 generatePortLayers() {32 /*33 Step 1 - Get all the layers34 Step 2 - Get all the ports in each of the layers35 Step 3 - Create a manufacturing layer36 - Populate with the ports37 */38 // let components = this.__device.getComponents();39 let layers = this.__device.getLayers();40 let mfglayers = [];41 let isControl = false;42 for (let i in layers) {43 let layer = layers[i];44 let ports = [];45 let features = layer.features;46 if (layer.name === "control") {47 isControl = true;48 }49 for (let key in features) {50 let feature = features[key];51 //TODO: Include fabtype check also52 if (feature.getType() === "Port") {53 ports.push(key);54 }55 }56 if (ports.length === 0) {57 continue;58 }59 let manufacturinglayer = new ManufacturingLayer("ports_" + layer.name + "_" + i);60 // console.log("manufacturing layer :", manufacturinglayer);61 for (let fi in ports) {62 let featurekey = ports[fi];63 // console.log("Key:", featurekey);64 // console.log("rendered:feature", this.__viewManagerDelegate.view.getRenderedFeature(featurekey));65 let issuccess = manufacturinglayer.addFeature(this.__viewManagerDelegate.view.getRenderedFeature(featurekey));66 if (!issuccess) {67 console.error("Could not find the feature for the corresponding id: " + featurekey);68 }69 }70 if (isControl) {71 manufacturinglayer.flipX();72 isControl = false;73 }74 mfglayers.push(manufacturinglayer);75 }76 console.log("mfglayers:", mfglayers);77 let ref = this;78 mfglayers.forEach(function(mfglayer, index) {79 ref.__svgData.set(mfglayer.name, mfglayer.exportToSVG());80 mfglayer.flushData();81 });82 console.log("SVG Outputs:", this.__svgData);83 }84 /**85 * Generates separate mfglayers and svgs for each of the depth layers86 * @returns {void}87 * @memberof CNCGenerator88 */89 generateDepthLayers() {90 /*91 Step 1 - Go through each of the layers92 Step 2 - At each layer:93 Step 2.1 - Sort each of the features based on their depths94 Step 2.2 - Generate manufacturing layers for each of the depths95 */96 let layers = this.__device.getLayers();97 let mfglayers = [];98 let isControl = false;99 for (let i in layers) {100 let layer = layers[i];101 let features = layer.features;102 if (layer.name === "control") {103 isControl = true;104 }105 //Create the depthmap for this106 let featuredepthmap = new DepthFeatureMap(layer.name);107 for (let key in features) {108 let feature = features[key];109 //TODO: Modify the port check110 if (feature.fabType === "XY" && feature.getType() !== "Port") {111 let depth = feature.getValue("height");112 console.log("Depth of feature: ", key, depth);113 featuredepthmap.addFeature(depth, key);114 }115 }116 //Generate Manufacturing Layers for each depth117 let manufacturinglayer;118 for (let depth of featuredepthmap.getDepths()) {119 manufacturinglayer = new ManufacturingLayer(layer.name + "_" + i + "_" + depth);120 let depthfeatures = featuredepthmap.getFeaturesAtDepth(depth);121 for (let j in depthfeatures) {122 let featurekey = depthfeatures[j];123 let issuccess = manufacturinglayer.addFeature(this.__viewManagerDelegate.view.getRenderedFeature(featurekey));124 if (!issuccess) {125 console.error("Could not find the feature for the corresponding id: " + featurekey);126 }127 }128 if (isControl) {129 manufacturinglayer.flipX();130 }131 mfglayers.push(manufacturinglayer);132 }133 isControl = false;134 }135 console.log("XY Manufacturing Layers:", mfglayers);136 let ref = this;137 mfglayers.forEach(function(mfglayer, index) {138 ref.__svgData.set(mfglayer.name, mfglayer.exportToSVG());139 mfglayer.flushData();140 });141 }142 /**143 * Generates all the edge cuts144 * @returns {void}145 * @memberof CNCGenerator146 */147 generateEdgeLayers() {148 /*149 Step 1 - Go through each of the layers150 Step 2 - Get all the EDGE features in the drawing151 Step 3 - Generate separate SVGs152 */153 let layers = this.__device.getLayers();154 let mfglayers = [];155 let manufacturinglayer;156 let isControl = false;157 for (let i in layers) {158 let layer = layers[i];159 manufacturinglayer = new ManufacturingLayer(layer.name + "_" + i + "_EDGE");160 if (layer.name === "control") {161 isControl = true;162 }163 let features = layer.features;164 for (let key in features) {165 let feature = features[key];166 //TODO: Modify the port check167 if (feature.fabType === "EDGE") {168 console.log("EDGE Feature: ", key);169 let issuccess = manufacturinglayer.addFeature(this.__viewManagerDelegate.view.getRenderedFeature(key));170 if (!issuccess) {171 console.error("Could not find the feature for the corresponding id: " + key);172 }173 }174 }175 if (isControl) {176 manufacturinglayer.flipX();177 isControl = false;178 }179 mfglayers.push(manufacturinglayer);180 }181 console.log("EDGE Manufacturing Layers:", mfglayers);182 let ref = this;183 mfglayers.forEach(function(mfglayer, index) {184 ref.__svgData.set(mfglayer.name, mfglayer.exportToSVG());185 mfglayer.flushData();186 });187 }188 /**189 * Sets the device the CNCGenerator needs to work of190 * @param {Device} currentDevice191 * @returns {void}192 * @memberof CNCGenerator193 */194 setDevice(currentDevice) {195 this.__device = currentDevice;196 console.log("Currentdevice:", currentDevice);197 }198 /**199 * Flush all the data200 * @returns {void}201 * @memberof CNCGenerator202 */203 flushData() {204 this.__svgData.clear();205 }...

Full Screen

Full Screen

gallery.js

Source:gallery.js Github

copy

Full Screen

1var isControl=true;2var videoNow= -1;3var maxHight=$(window).height()-100;4var videoType= '';5var videoId= '';6var wgPicNow=0;7var nspicNow=0;8var imgAry= new Array();9var imgAry2= new Array();10var bigPicAry, bigPicInterval;11var area= 'galleryImg';12var $myImgAry;13$(function(){14 15 setDom();16 addEvt();17 function setDom() {18 $myImgAry= $('.'+ area+ ' a');19 setBigPicAry(area+ " a");20 trace('sd:'+ $myImgAry.length);21 videoType= YoukuVideo.ie()>9? 'video':'swf';22 YoukuVideo.play('XMTU4NDY1Nzk2NA==', 'videoContainer1', 'player1');23 YoukuVideo.play('XMTU4NDY1NzM3Ng==', 'videoContainer2', 'player2');24 YoukuVideo.play('XMTU4NDY1MDkyNA==', 'videoContainer3', 'player3');25 YoukuVideo.play('XMTU4NDY1MDQ3Mg==', 'videoContainer4', 'player4');26 // YoukuVideo.play('XMTU4NDY1NzY4OA==', 'videoContainer5', 'player5');27 // YoukuVideo.play('XOTIwMzgxODQ0', 'videoContainer5', 'player5');28 if(videoType=='video'){29 var _video5= '../media/video5.mp4'/*tpa=http://www.jeep.com.cn/grand_cherokee/media/video5.mp4*/;30 YoukuVideo.addVideo('videoContainer5', _video5);31 }else{32 YoukuVideo.swf('XMTU4NDY1NzY4OA==', 'videoContainer5', 'player5');33 }34 35 }36 function addEvt() {37 $(".galleryBtn a").click(titleClick);38 $('.galleryImg a').click(galleryImgClick);39 $('.galleryvd a').click(galleryVdClick);40 $('#videoClose').click(videoCloseClick);41 $('.blackAll .close').click(pubImgClose);42 $('#imgBg').click(pubImgClose);43 }44 function videoCloseClick() {45 trace('videoCloseClick.'+ isControl)46 if(isControl){47 isControl= false;48 delayControlTrue(300);49 if(videoType== 'video'){50 if( $id('videoContainer'+ (videoNow+1)).nodeName == 'video' || $id('videoContainer'+ (videoNow+1)).nodeName == 'VIDEO' ) $id('videoContainer'+ (videoNow+1)).pause();51 }52 else if(videoType== 'swf'){53 thisMovie('videoContainer'+ (videoNow+1)).jsSay("stop");54 }55 $('#videoPop .videoBox').eq(videoNow).hide();56 $('#videoPop').hide();57 videoNow= -1;58 }59 }60 function galleryVdClick() {61 videoNow= $(this).index();62 $('#videoPop').show();63 $('#videoPop .videoBox').eq(videoNow).show();64 trace('vd:'+ videoNow);65 // videoId= $('#videoPop .videoBox').eq(videoNow).find('')66 if( $id('videoContainer'+ (videoNow+1)).nodeName == 'video' || $id('videoContainer'+ (videoNow+1)).nodeName == 'VIDEO' ) $id('videoContainer'+ (videoNow+1)).play();67 }68 //nav69 function titleClick() 70 {71 var thisid = $(this).attr("data");72 $(".galleryBtn a").removeClass("on").eq($(this).index()).addClass("on");73 $(".galleryall").hide();74 $(".gallery"+thisid).show();75 if(thisid!= 'vd'){76 $myImgAry= $('.gallery'+ thisid+ ' a');77 area= 'gallery'+ (thisid=='all'? 'Img':thisid);78 setBigPicAry(area+ " a");79 }80 }81 function galleryImgClick() {82 if(isControl){83 isControl= false;84 wgPicNow= $myImgAry.index($(this));85 setBicLi($(this), wgPicNow, imgAry);86 }87 trace('imgs.click.'+ wgPicNow);88 }89 function setBigPicAry(_a) 90 {91 imgAry= [];92 $('.'+_a).each(function (i) {93 imgAry[i]= $(this).attr('data-url');94 })95 // trace(_a+ ': '+imgAry[0]);96 var wr='';97 $('.'+_a).each(function (i) {98 wr+='<li> <img src="'+imgAry[i]+'" /> </li>'99 });100 $('.blackBox ul').empty().append(wr);101 bigPicAry= $('.blackBox ul').find('li');102 }103 //close104 function pubImgClose() {105 bigPicAry.eq(wgPicNow).css({'display':'none'});106 wgPicNow= -1;107 $('.blackAll').hide();108 }109 //hover110 $('.galleryall a').hover(function(){111 $(this).find('img').attr('id','box');112 TweenMax.to($id('box'), 1, { scale:1.1, ease:Cubic.easeOut});113 },function(){114 TweenMax.to($id('box'), 1, { scale:1, ease:Cubic.easeOut});115 $(this).find('img').attr('id','');116 });117 118 119 function setBicLi(_this, _key, ary) {120 var alength=ary.length;121 var wgIndex=_key;122 123 $('.blackAll').show();124 setBigPicTop(bigPicAry.eq(wgIndex));125 }126 function setBigPicTop(_bigImg) 127 {128 _bigImg.css({'display':'block'});129 // trace('setBigPicTop.');130 if(_bigImg.height()<= 0){131 clearInterval(bigPicInterval);132 bigPicInterval= setInterval(function () {133 if(_bigImg.height()>0){134 _bigImg.css({'margin-top':Math.floor(_bigImg.height()/2)* -1});135 _bigImg.css({'opacity':1});136 isControl= true;137 clearInterval(bigPicInterval);138 if(_bigImg.height()>maxHight){139 setMyHight(_bigImg);140 }141 }142 }, 33);143 }else{144 isControl= true;145 _bigImg.css({'margin-top':Math.floor(_bigImg.height()/2)* -1, 'opacity':1});146 }147 }148 function setMyHight(_img) {149 var biLi=maxHight/_img.height();150 _img.find('img').css("width",biLi*940);151 var newHight=_img.find('img').height();152 _img.css('margin-top',Math.floor(newHight/2)* -1);153 }154 //left155 $('.blackBox .left').click(function(){156 if(isControl){157 isControl =false;158 159 bigPicAry.eq(wgPicNow).css({'display':'none'});160 wgPicNow= (wgPicNow> 0)? wgPicNow-1: bigPicAry.length-1;161 setBigPicTop(bigPicAry.eq(wgPicNow));162 }163 })164 //right165 $('.blackBox .right').click(function(){166 if(isControl){167 isControl =false;168 bigPicAry.eq(wgPicNow).css({'display':'none'});169 wgPicNow= (wgPicNow< bigPicAry.length-1)? wgPicNow+1: 0;170 setBigPicTop(bigPicAry.eq(wgPicNow));171 }172 })173 //动画部分174 function changeCam(_out, _in, _dir) {175 TweenLite.to(_out, 0.8, { left:100* _dir+ '%', ease:Cubic.easeInOut, onComplete:function() {176 _out.style.display= 'none';177 } });178 TweenLite.set(_in, { left:-100* _dir+ '%', display:'block'});179 TweenLite.to(_in, 0.8, { left:0, ease:Cubic.easeInOut });180 }181 //motion182})183function $id(_id) {184 return document.getElementById(_id);185} 186function trace(argument) {187 // console.log(argument);188}189function delayControlTrue (_delay) {190 _delay = _delay || 0;191 setTimeout(function () {192 isControl= true;193 }, _delay)194}195function thisMovie(flashName) {196 if (navigator.appName.indexOf("Microsoft") != -1) {197 return window[flashName];198 } else {199 return document[flashName];200 }201}202function asSay(argument) {203 if(argument=='swfPlayerReady'){204 setTimeout(function (){ 205 thisMovie('videoContainer'+ (videoNow+1)).jsSay('play');206 }, 100);207 }...

Full Screen

Full Screen

routes.js

Source:routes.js Github

copy

Full Screen

1/**2 Esta clase es la que se encarga de escuchar al cliente y ejecuta el controlador correspondiente3*/4var express = require('express');5var router = express.Router();6var passport = require('passport');7var auth = require('.././middleware/auth.min');8var user = require('.././controllers/userController');9var home = require('.././controllers/homeController');10var carrera = require('.././controllers/carreraController');11var ciclo = require('.././controllers/cicloController');12var materia = require('.././controllers/materiaController');13var maestro = require('.././controllers/maestroController');14var control = require('.././controllers/controlController');15var alumno = require('.././controllers/alumnoController');16//-----------------PRIVATE ROUTES--------------------17//UNIVERSAL CONTROLLER18router.post('/inicio', passport.authenticate('local', {19 successRedirect: '/inicio',20 failureRedirect: '/login',21 failureFlash: true22}));23router.get('/', home.index);24router.get('/login', home.index);25router.get('/inicio', auth.isLogged, home.home);26router.get('/salida', auth.isLogged, home.logOut);27//USER CONTROLLER28router.post('/registrar', [auth.isLogged, auth.isAuth], user.registrarUsuario);29router.get('/registrar', [auth.isLogged, auth.isAuth], user.registrar);30router.get('/actualizar', [auth.isLogged], user.getActualizar);31router.post('/actualizar', [auth.isLogged], user.actualizar);32router.get('/listaAlumno', [auth.isLogged, auth.isControl], user.listaAlumno);33router.post('/listaAlumno', [auth.isLogged, auth.isControl], user.getListaAlumnos);34router.post('/eliminarAlumno', [auth.isLogged, auth.isControl], user.eliminarAlumno);35router.post('/activarAlumno', [auth.isLogged, auth.isControl], user.activarAlumno);36router.get('/alumno/:matricula', [auth.isLogged, auth.isControl], user.editarAlumno);37router.post('/actualizarAlumno', [auth.isLogged, auth.isControl], user.actualizarAlumno);38router.get('/listaMaestro', [auth.isLogged, auth.isControl], user.getListaMaestro);39router.post('/listaMaestro', [auth.isLogged, auth.isControl], user.listaMaestro);40router.get('/maestro/:maestro', [auth.isLogged, auth.isControl], user.editarMaestro);41router.post('/actualizarMaestro', [auth.isLogged, auth.isControl], user.actualizarMaestro);42router.get('/materias/:maestro', [auth.isLogged, auth.isControl], user.asignarMaterias);43router.post('/planAcademico', [auth.isLogged, auth.isAuth], user.verAsignacion);44//CARRERA CONTROLLER45router.get('/registrarCarrera', [auth.isLogged, auth.isAdmin], carrera.getCarrera);46router.post('/registrarCarrera', [auth.isLogged, auth.isAdmin], carrera.registrarCarrera);47router.post('/eliminarCarrera', [auth.isLogged, auth.isAdmin], carrera.eliminarCarrera);48router.post('/activarCarrera', [auth.isLogged, auth.isAdmin], carrera.activarCarrera);49router.get('/editarCarrera/:id', [auth.isLogged, auth.isAdmin], carrera.editarCarrera);50router.post('/editarCarrera', [auth.isLogged, auth.isAdmin], carrera.postEditarCarrera);51//CICLO CONTROLLER52router.get('/registrarCiclo', [auth.isLogged, auth.isAdmin], ciclo.getCiclo);53router.post('/registrarCiclo', [auth.isLogged, auth.isAdmin], ciclo.registrarCiclo);54router.post('/eliminarCiclo', [auth.isLogged, auth.isAdmin], ciclo.eliminarCiclo);55router.post('/activarCiclo', [auth.isLogged, auth.isAdmin], ciclo.activarCiclo);56//MATERIA CONTROLLER57router.get('/registrarMateria', [auth.isLogged, auth.isControl], materia.getMateria);58router.post('/registrarMateria', [auth.isLogged, auth.isControl], materia.registrarMateria);59router.post('/activarMateria', [auth.isLogged, auth.isControl], materia.activarMateria);60router.post('/eliminarMateria', [auth.isLogged, auth.isControl], materia.eliminarMateria);61router.get('/editarMateria/:id', [auth.isLogged, auth.isControl], materia.editarMateria);62router.post('/editarMateria', [auth.isLogged, auth.isControl], materia.postEditarMateria);63router.post('/getMateriasBySemestre', [auth.isLogged, auth.isControl], materia.getMateriasBySemestre);64router.post('/postAsignar', [auth.isLogged, auth.isControl], materia.postAsignar);65router.post('/designarMarteria', [auth.isLogged, auth.isControl], materia.designarMarteria);66router.get('/planAcademico', [auth.isLogged, auth.isAuth], materia.planAcademico);67//MAESTRO CONTROLLER68router.get('/asignarCalificacion', [auth.isLogged, auth.isMaestro], maestro.buscarMaterias);69router.get('/detalleCalificacion', [auth.isLogged, auth.isMaestro], maestro.detalleMaterias);70router.post('/asignarCalificacion', [auth.isLogged, auth.isMaestro], maestro.getMateriasDelMaestro);71router.post('/detalleListaMateras', [auth.isLogged, auth.isMaestro], maestro.getDetalleMateriasDelMaestro);72router.get('/:idTurno/calificar/:idMateria', [auth.isLogged, auth.isMaestro], maestro.darCalificacion);73router.post('/grupoCalificado', [auth.isLogged, auth.isMaestro], maestro.grupoCalificado);74router.get('/:idTurno/actualizarNota/:id', [auth.isLogged, auth.isMaestro], maestro.actualizarNota);75router.get('/:idTurno/detalleNota/:id', [auth.isLogged, auth.isMaestro], maestro.detalleNota);76router.post('/actualizarCalificacion',[auth.isLogged, auth.isMaestro], maestro.actualizarCalificacion);77router.post('/eliminarMaestro', [auth.isLogged, auth.isAuth], maestro.eliminarMaestro);78router.post('/activarMaestro', [auth.isLogged, auth.isAuth], maestro.activarMaestro);79//CONTROL CONTROLLER80router.get('/calificaciones/:idMateria', [auth.isLogged, auth.isAuth], control.verCalificaciones);81router.get('/publicarNotas', [auth.isLogged, auth.isControl], control.publicarNotas);82router.post('/hacerPublicas', [auth.isLogged, auth.isControl], control.hacerPublicas);83router.get('/:idMatricula/calificaciones', [auth.isLogged, auth.isControl], control.verNotas);84router.post('/permitirAsignarNotas', [auth.isLogged, auth.isControl], control.permitirAsignarNotas);85router.get('/listaControl', [auth.isLogged, auth.isControl], control.getListaControl);86router.post('/listaControl', [auth.isLogged, auth.isControl], control.listaControl);87router.post('/eliminarControl', [auth.isLogged, auth.isAuth], control.eliminarControl);88router.get('/control/:idControl', [auth.isLogged, auth.isControl], control.detalleControl);89router.post('/actualizarControl', [auth.isLogged, auth.isControl], control.actualizarControl);90//ALUMNO CONTROLLER91router.get('/verMisMaterias', [auth.isLogged, auth.isAlumno], alumno.verMisMaterias);92router.get('/verMisCalificaciones',[auth.isLogged, auth.isAlumno], alumno.verMisNotas);93router.post('/verMisCalificaciones', [auth.isLogged, auth.isAlumno], alumno.resumenNotas);94router.get('/buscarAlumno', [auth.isLogged, auth.isControl], alumno.buscarAlumnoPorNombre);95router.post('/buscarAlumno', [auth.isLogged, auth.isControl], alumno.postBuscarAlumnoPorNombre);96router.post('/:idMatricula/calificaciones', [auth.isLogged, auth.isAuth], alumno.resultadoDelSemestre);97router.post('/pdf-:idMatricula', [auth.isLogged, auth.isAlumno], alumno.pdfFromHTMLString);98//-----------------PRIVATE ROUTES--------------------...

Full Screen

Full Screen

campaign_coolrun.js

Source:campaign_coolrun.js Github

copy

Full Screen

1var camCoolRunPopName= 'NONE',2 camCrPicsNow= -1,3 camCrPicsAry;4var cam= 'coolRun';5var swfPlayIntervar= 0;6var isLeicaLoaded= false;7var camChangeInterval= 0,8 camIsOpen= false;9$(index_leica_init);10function index_leica_init() {11 camCrPicsAry= $id('camCoolRunPics').getElementsByTagName('li');12 setDom();13 addEvt();14 function setDom() 15 {16 if(YoukuVideo.ie()>9) {17 isCanPlayType= true;18 camCoolRunPopName= 'VIDEO';19 }else{20 isCanPlayType= false;21 camCoolRunPopName= 'SWF';22 }23 // console.log('setDom.'+ YoukuVideo.ie());24 YoukuVideo.play('XMTU5OTE4MDUxNg==', 'camCrVideo', 960/432);25 }26 function addEvt() 27 {28 // $('#camCrPicsBt').click(camCrPicsBtClick);29 $('#camCrPicsBt2').click(camCrPicsBtClick);30 $('#camCoolRunPopClose').click(campPopCloseClick);31 $('#camCoolRunPopBg').click(campPopCloseClick);32 33 $('#camCoolRunRight').click(camCrRightClick);34 $('#camCoolRunLeft').click(camCrLeftClick);35 36 $('#coolRunVideoBt').click(coolRunVideoClick);37 // $('#camCrSignBt1,#camCrSignBt2').click(camCrSignBtClick);38 // $('#camRightArr').click(camRightClick);39 // $('#camLeftArr').click(camLeftClick);40 // clearInterval(camChangeInterval);41 // camChangeInterval= setInterval(camChangeLoop, 5000);42 }43 // function camChangeLoop() {44 // if(!camIsOpen){45 // camRightClick();46 // }47 // }48 // function camRightClick() {49 // if(isControl && !camIsOpen && cam== 'coolRun'){50 // isControl=false;51 // if(!isLeicaLoaded){52 // loadLeica(function() {53 // cam= 'leica';54 // delayControlTrue(810);55 // changeCam($id('camCoolRun'), $id('camLeica'), -1);56 // });57 // }else{58 // cam= 'leica';59 // delayControlTrue(810);60 // changeCam($id('camCoolRun'), $id('camLeica'), -1);61 // }62 // // clearInterval(camChangeInterval);63 // // camChangeInterval= setInterval(camChangeLoop, 5000);64 // }65 // else if(isControl && !camIsOpen && cam== 'leica'){66 // isControl=false;67 // delayControlTrue(810);68 // cam= 'coolRun';69 // changeCam($id('camLeica'), $id('camCoolRun'), -1);70 // // clearInterval(camChangeInterval);71 // // camChangeInterval= setInterval(camChangeLoop, 5000);72 // }73 // }74 // function camLeftClick() 75 // {76 // if(isControl && !camIsOpen && cam== 'leica'){77 // isControl=false;78 // delayControlTrue(810);79 // cam= 'coolRun';80 // changeCam($id('camLeica'), $id('camCoolRun'), 1);81 // // clearInterval(camChangeInterval);82 // // camChangeInterval= setInterval(camChangeLoop, 5000);83 // }84 // else if(isControl && !camIsOpen && cam== 'coolRun')85 // {86 // isControl=false;87 // if(!isLeicaLoaded){88 // loadLeica(function() {89 // cam= 'leica';90 // delayControlTrue(810);91 // changeCam($id('camCoolRun'), $id('camLeica'), 1);92 // });93 // }else{94 // cam= 'leica';95 // delayControlTrue(810);96 // changeCam($id('camCoolRun'), $id('camLeica'), 1);97 // }98 // // clearInterval(camChangeInterval);99 // // camChangeInterval= setInterval(camChangeLoop, 5000);100 // }101 // }102 function coolRunVideoClick() {103 if(isControl){104 isControl= false;105 delayControlTrue(500);106 camIsOpen= true;107 // console.log('coolRunVideoClick.'+ isCanPlayType);108 if(isCanPlayType)109 {110 camCoolRunPopName= 'VIDEO';111 $('#camCoolRunPop').show();112 $('#camCrVideoBox').show();113 $('#camCrVideoBox').css('top', Math.floor( ($('#camCoolRunPop').height() - $('#camCrVideoBox').height()) / 2) );114 setTimeout(function(){115 $('#camCrVideoBox').css('top', Math.floor( ($('#camCoolRunPop').height() - $('#camCrVideoBox').height()) / 2) );116 },1000);117 $id('camCrVideo').play();118 }119 else{120 camCoolRunPopName= 'SWF';121 $('#camCoolRunPop').show();122 $('#camCrVideoBox').show();123 $('#camCrVideoBox').css('top', Math.floor( ($('#camCoolRunPop').height() - $('#camCrVideoBox').height()) / 2) );124 setTimeout(function(){125 $('#camCrVideoBox').css('top', Math.floor( ($('#camCoolRunPop').height() - $('#camCrVideoBox').height()) / 2) );126 },1000);127 clearInterval(swfPlayIntervar);128 swfPlayIntervar= setInterval(function () {129 if(isVideoReady){130 clearInterval(swfPlayIntervar);131 thisMovie("camCrVideo").jsSay("play");132 }133 }, 100);134 }135 136 }137 }138 function camCrSignBtClick() {139 if(isControl){140 isControl= false;141 delayControlTrue(500);142 camIsOpen= true;143 camCoolRunPopName= 'SIGN';144 $('#camCoolRunPop').show();145 $('#camCoolRunSign').show();146 }147 }148 function camCrPicsBtClick() {149 if(isControl){150 isControl= false;151 delayControlTrue(400);152 camIsOpen= true;153 camCoolRunPopName= 'PICS';154 $('#camCoolRunPop').show();155 $('#camCoolRunPics').show();156 if(camCrPicsNow==-1) {157 openCamCrPics(camCrPicsAry, 0, camCrPicsNow);158 camCrPicsNow= 0;159 }160 }161 }162 163 164 165 function camCrRightClick() {166 if(isControl){167 isControl= false;168 delayControlTrue(300);169 if(camCrPicsNow> -1) attr(camCrPicsAry[camCrPicsNow], 'class', 'out');170 // $('#campLeicaPop').show();171 var _key= (camCrPicsNow<camCrPicsAry.length-1)? camCrPicsNow+ 1: 0;172 173 openCamCrPics(camCrPicsAry, _key, camCrPicsNow);174 camCrPicsNow= _key;175 }176 }177 function camCrLeftClick() {178 if(isControl){179 isControl= false;180 delayControlTrue(300);181 if(camCrPicsNow> -1) attr(camCrPicsAry[camCrPicsNow], 'class', 'out');182 // $('#campLeicaPop').show();183 var _key= (camCrPicsNow> 0)? camCrPicsNow- 1: camCrPicsAry.length-1;184 openCamCrPics(camCrPicsAry, _key, camCrPicsNow);185 camCrPicsNow= _key;186 }187 }188 189 function openCamCrPics(_bigAry, _key, _now) 190 {191 _bigAry[_key].style.display= 'block';192 attr(_bigAry[_key], 'class', 'show');193 if(_now> -1) _bigAry[_now].style.display= 'none';194 }195 function campPopCloseClick() 196 {197 if(camCoolRunPopName== 'SIGN') {198 $('#camCoolRunSign').hide();199 }200 else if(camCoolRunPopName== 'PICS') {201 $('#camCoolRunPics').hide();202 }203 else if(camCoolRunPopName== 'VIDEO'){204 $id('camCrVideo').pause();205 $('#camCrVideoBox').hide();206 }207 else if(camCoolRunPopName== 'SWF'){208 if(!isVideoReady) thisMovie("camCrVideo").jsSay("stop");209 setTimeout(function(){210 thisMovie("camCrVideo").jsSay("stop");211 }, 100);212 isVideoReady= false;213 $('#camCrVideoBox').hide();214 }215 $('#camCoolRunPop').hide();216 camCoolRunPopName= 'NONE';217 camIsOpen= false;218 }219 // function changeCam(_out, _in, _dir) {220 // TweenLite.to(_out, 0.8, { left:100* _dir+ '%', ease:Cubic.easeInOut, onComplete:function() {221 // _out.style.display= 'none';222 // } });223 // TweenLite.set(_in, { left:-100* _dir+ '%', display:'block'});224 // TweenLite.to(_in, 0.8, { left:0, ease:Cubic.easeInOut });225 // }226 // function loadLeica(_comp) 227 // {228 // $("#camLeica").load("index_cam_leica.html", function(){229 // trace("ajax camLeica comp.");230 // setTimeout(function () {231 // index_leica_init();232 // isLeicaLoaded= true;233 // _comp();234 // }, 100);235 // });236 // }...

Full Screen

Full Screen

StartControl.js

Source:StartControl.js Github

copy

Full Screen

1// Auto-generated. Do not edit!2// (in-package haptic_bridge.srv)3"use strict";4const _serializer = _ros_msg_utils.Serialize;5const _arraySerializer = _serializer.Array;6const _deserializer = _ros_msg_utils.Deserialize;7const _arrayDeserializer = _deserializer.Array;8const _finder = _ros_msg_utils.Find;9const _getByteLength = _ros_msg_utils.getByteLength;10//-----------------------------------------------------------11//-----------------------------------------------------------12class StartControlRequest {13 constructor(initObj={}) {14 if (initObj === null) {15 // initObj === null is a special case for deserialization where we don't initialize fields16 this.isControl = null;17 }18 else {19 if (initObj.hasOwnProperty('isControl')) {20 this.isControl = initObj.isControl21 }22 else {23 this.isControl = false;24 }25 }26 }27 static serialize(obj, buffer, bufferOffset) {28 // Serializes a message object of type StartControlRequest29 // Serialize message field [isControl]30 bufferOffset = _serializer.bool(obj.isControl, buffer, bufferOffset);31 return bufferOffset;32 }33 static deserialize(buffer, bufferOffset=[0]) {34 //deserializes a message object of type StartControlRequest35 let len;36 let data = new StartControlRequest(null);37 // Deserialize message field [isControl]38 data.isControl = _deserializer.bool(buffer, bufferOffset);39 return data;40 }41 static getMessageSize(object) {42 return 1;43 }44 static datatype() {45 // Returns string type for a service object46 return 'haptic_bridge/StartControlRequest';47 }48 static md5sum() {49 //Returns md5sum for a message object50 return '99bedf6bf4f1b97105db84a2d5232627';51 }52 static messageDefinition() {53 // Returns full string definition for message54 return `55 bool isControl56 57 `;58 }59 static Resolve(msg) {60 // deep-construct a valid message object instance of whatever was passed in61 if (typeof msg !== 'object' || msg === null) {62 msg = {};63 }64 const resolved = new StartControlRequest(null);65 if (msg.isControl !== undefined) {66 resolved.isControl = msg.isControl;67 }68 else {69 resolved.isControl = false70 }71 return resolved;72 }73};74class StartControlResponse {75 constructor(initObj={}) {76 if (initObj === null) {77 // initObj === null is a special case for deserialization where we don't initialize fields78 }79 else {80 }81 }82 static serialize(obj, buffer, bufferOffset) {83 // Serializes a message object of type StartControlResponse84 return bufferOffset;85 }86 static deserialize(buffer, bufferOffset=[0]) {87 //deserializes a message object of type StartControlResponse88 let len;89 let data = new StartControlResponse(null);90 return data;91 }92 static getMessageSize(object) {93 return 0;94 }95 static datatype() {96 // Returns string type for a service object97 return 'haptic_bridge/StartControlResponse';98 }99 static md5sum() {100 //Returns md5sum for a message object101 return 'd41d8cd98f00b204e9800998ecf8427e';102 }103 static messageDefinition() {104 // Returns full string definition for message105 return `106 107 `;108 }109 static Resolve(msg) {110 // deep-construct a valid message object instance of whatever was passed in111 if (typeof msg !== 'object' || msg === null) {112 msg = {};113 }114 const resolved = new StartControlResponse(null);115 return resolved;116 }117};118module.exports = {119 Request: StartControlRequest,120 Response: StartControlResponse,121 md5sum() { return '99bedf6bf4f1b97105db84a2d5232627'; },122 datatype() { return 'haptic_bridge/StartControl'; }...

Full Screen

Full Screen

NetworthTransformer.js

Source:NetworthTransformer.js Github

copy

Full Screen

1const _flatternAccounts = (viewRows, account) => {2 const { 3 accountId, 4 accountName, 5 isControl, 6 amount, 7 accounts 8 } = account;9 10 viewRows.push({11 accountId, 12 accountName,13 isControl,14 amount: (amount && amount.balance) || 0,15 showEditor: false16 });17 18 if(accounts && accounts.length > 0) {19 accounts.map(subAccount => _flatternAccounts(viewRows, subAccount)); 20 }21}22const transformResponse = (response) => {23 const {currency, assets, liabilities } = response;24 const viewRows = [];25 viewRows.push({ 26 accountId: null, 27 accountName: 'Net Worth',28 isControl: false,29 isTotalRow: true,30 amount: response.networthValue,31 showEditor: false32 });33 viewRows.push({ 34 accountId: null, 35 accountName: 'Assets',36 isControl: true,37 amount: undefined,38 showEditor: false39 });40 assets.accounts.forEach(account => {41 _flatternAccounts(viewRows, account);42 });43 viewRows.push({ 44 accountId: null, 45 accountName: 'Total Assets',46 isControl: false,47 isTotalRow: true,48 amount: assets.total,49 showEditor: false50 });51 viewRows.push({ 52 accountId: 0, 53 accountName: 'Liabilities',54 isControl: true,55 amount: undefined,56 showEditor: false57 });58 liabilities.accounts.forEach(account => {59 _flatternAccounts(viewRows, account);60 });61 viewRows.push({ 62 accountId: null, 63 accountName: 'Total Liabilities',64 isControl: false,65 isTotalRow: true,66 amount: liabilities.total,67 showEditor: false68 });69 return { viewRows, currency };70};71const NetworthTransformer = {72 _flatternAccounts,73 transformResponse74}...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({headless: false});4 const page = await browser.newPage();5 await page.click('input[name="q"]', {clickCount: 3});6 await page.type('input[name="q"]', 'puppeteer');7 await page.keyboard.press('Enter');8 await page.waitForNavigation();9 await page.screenshot({path: 'example.png'});10 await browser.close();11})();12const puppeteer = require('puppeteer');13(async () => {14 const browser = await puppeteer.launch({headless: false});15 const page = await browser.newPage();16 await page.click('input[name="q"]', {clickCount: 3});17 await page.type('input[name="q"]', 'puppeteer');18 await page.keyboard.press('Enter');19 await page.waitForNavigation();20 await page.screenshot({path: 'example.png'});21 await browser.close();22})();23const puppeteer = require('puppeteer');24(async () => {25 const browser = await puppeteer.launch({headless: false});26 const page = await browser.newPage();27 await page.click('input[name="q"]', {clickCount: 3});28 await page.type('input[name="q"]', 'puppeteer');29 await page.keyboard.press('Enter');30 await page.waitForNavigation();31 await page.screenshot({path: 'example.png'});32 await browser.close();33})();34const puppeteer = require('puppeteer');35(async () => {36 const browser = await puppeteer.launch({headless: false});37 const page = await browser.newPage();38 await page.click('input[name="q"]', {clickCount: 3});39 await page.type('input[name="q"]', 'puppeteer');40 await page.keyboard.press('Enter');41 await page.waitForNavigation();42 await page.screenshot({path: 'example.png

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch({headless: false});4 const page = await browser.newPage();5 await page.waitForSelector('input[name="q"]');6 await page.type('input[name="q"]', 'puppeteer');7 await page.keyboard.press('Enter');8 await page.waitForSelector('input[name="q"]');9 await page.waitFor(5000);10 await page.keyboard.press('Escape');11 await page.waitForSelector('input[name="q"]');12 await page.waitFor(5000);13 await page.keyboard.press('Escape');14 await page.waitForSelector('input[name="q"]');15 await page.waitFor(5000);16 await page.keyboard.press('Escape');17 await page.waitForSelector('input[name="q"]');18 await page.waitFor(5000);19 await page.keyboard.press('Escape');20 await page.waitForSelector('input[name="q"]');21 await page.waitFor(5000);22 await page.keyboard.press('Escape');23 await page.waitForSelector('input[name="q"]');24 await page.waitFor(5000);25 await page.keyboard.press('Escape');26 await page.waitForSelector('input[name="q"]');27 await page.waitFor(5000);28 await page.keyboard.press('Escape');29 await page.waitForSelector('input[name="q"]');30 await page.waitFor(5000);31 await page.keyboard.press('Escape');32 await page.waitForSelector('input[name="q"]');33 await page.waitFor(5000);34 await page.keyboard.press('Escape');35 await page.waitForSelector('input[name="q"]');36 await page.waitFor(5000);37 await page.keyboard.press('Escape');38 await page.waitForSelector('input[name="q"]');39 await page.waitFor(5000);40 await page.keyboard.press('Escape');41 await page.waitForSelector('input[name="q"]');42 await page.waitFor(5000);43 await page.keyboard.press('Escape');44 await page.waitForSelector('input[name="q"]');45 await page.waitFor(5000);46 await page.keyboard.press('Escape');47 await page.waitForSelector('input[name="q"]');48 await page.waitFor(5000);49 await page.keyboard.press('Escape');50 await page.waitForSelector('input[name="q"]');51 await page.waitFor(5000);52 await page.keyboard.press('Escape');53 await page.waitForSelector('input[name="q"]');

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.waitForSelector('input[name="q"]');6 await page.type('input[name="q"]', 'Puppeteer');7 await page.waitForSelector('input[name="btnK"]');8 await page.waitFor(1000);9 const isControl = await page.evaluate(() => {10 return document.querySelector('input[name="btnK"]').isControl;11 });12 console.log(isControl);13 await browser.close();14})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.focus('input[name="q"]');6 await page.keyboard.type('puppeteer');7 await page.click('input[name="btnK"]');8 await page.waitForNavigation();9 await page.screenshot({path: 'example.png'});10 await browser.close();11})();12const puppeteer = require('puppeteer');13(async () => {14 const browser = await puppeteer.launch();15 const page = await browser.newPage();16 await page.focus('input[name="q"]');17 await page.keyboard.type('puppeteer');18 await page.click('input[name="btnK"]');19 await page.waitForNavigation();20 await page.keyboard.isControl();21 await page.screenshot({path: 'example.png'});22 await browser.close();23})();24const puppeteer = require('puppeteer');25(async () => {26 const browser = await puppeteer.launch();27 const page = await browser.newPage();28 await page.focus('input[name="q"]');29 await page.keyboard.type('puppeteer');30 await page.click('input[name="btnK"]');31 await page.waitForNavigation();32 await page.keyboard.isControl({key: 'Control'});33 await page.screenshot({path: 'example.png'});34 await browser.close();35})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 const isControl = await page.evaluate(() => {6 return document.body.isControl;7 });8 console.log(isControl);9 await browser.close();10})();11const puppeteer = require('puppeteer');12(async () => {13 const browser = await puppeteer.launch();14 const page = await browser.newPage();15 const isContentEditable = await page.evaluate(() => {16 return document.body.isContentEditable;17 });18 console.log(isContentEditable);19 await browser.close();20})();21const puppeteer = require('puppeteer');22(async () => {23 const browser = await puppeteer.launch();24 const page = await browser.newPage();25 const isContentEditable = await page.evaluate(() => {26 return document.body.getAttribute('isContentEditable');27 });28 console.log(isContentEditable);29 await browser.close();30})();31const puppeteer = require('puppeteer');32(async () => {33 const browser = await puppeteer.launch();34 const page = await browser.newPage();35 const isContentEditable = await page.evaluate(() => {36 return document.body.getAttribute('contenteditable');37 });38 console.log(isContentEditable);39 await browser.close();40})();41const puppeteer = require('puppeteer');42(async () => {43 const browser = await puppeteer.launch();44 const page = await browser.newPage();45 const isContentEditable = await page.evaluate(() => {46 return document.body.getAttribute('contentEditable');47 });48 console.log(isContentEditable);49 await browser.close();50})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await page.type('#lst-ib', 'puppeteer');6 await page.keyboard.press('Enter');7 await page.waitForNavigation();8 await page.screenshot({ path: 'google.png' });9 await browser.close();10})();

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const { isMainThread } = require('worker_threads');3(async () => {4 const browser = await puppeteer.launch({headless: false});5 const page = await browser.newPage();6 await page.waitForSelector('input[title="Search"]');7 await page.click('input[title="Search"]');8 await page.keyboard.type('Hello World');9 await page.keyboard.press('Enter');10 await page.waitForNavigation();11 await page.screenshot({path: 'google.png'});12 await browser.close();13})();14const puppeteer = require('puppeteer');15const { isMainThread } = require('worker_threads');16(async () => {17 const browser = await puppeteer.launch({headless: false});18 const page = await browser.newPage();19 await page.waitForSelector('input[title="Search"]');20 await page.click('input[title="Search"]');21 await page.keyboard.type('Hello World');22 await page.keyboard.press('Enter');23 await page.waitForNavigation();24 await page.screenshot({path: 'google.png'});25 await browser.close();26})();27const puppeteer = require('puppeteer');28const { isMainThread } = require('worker_threads');29(async () => {30 const browser = await puppeteer.launch({headless: false});31 const page = await browser.newPage();32 await page.waitForSelector('input[title="Search"]');33 await page.click('input[title="Search"]');34 await page.keyboard.type('Hello World');35 await page.keyboard.press('Enter');36 await page.waitForNavigation();37 await page.screenshot({path: 'google.png'});38 await browser.close();39})();40const puppeteer = require('puppeteer');41const { isMainThread } = require('worker_threads');42(async () => {43 const browser = await puppeteer.launch({headless: false});44 const page = await browser.newPage();45 await page.waitForSelector('input[title="Search"]');46 await page.click('input[title

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