How to use getConfig method in stryker-parent

Best JavaScript code snippet using stryker-parent

multimedia.js

Source:multimedia.js Github

copy

Full Screen

...38 };39 40 var config = $.extend(defaults, options || {});41 this.getConfig = function(){return config;};42 this.setConfig = function(variable,data){obj.getConfig().variable=data};43 44 this.Inicializate = function()45 {46 if (obj.getConfig().Imagen==true)47 {48 $( obj.getConfig().BtImagen ).click(function() {49 obj.AbrirPopupMultimedia("Cargando im\u00e1genes...","mul_multimedia_foto.php");50 });51 obj.CargarImagenes();52 }53 if (obj.getConfig().Video==true)54 {55 $( obj.getConfig().BtVideo ).click(function() {56 obj.AbrirPopupMultimedia("Cargando videos...","mul_multimedia_video.php");57 });58 obj.CargarVideos();59 }60 if (obj.getConfig().Audio==true)61 {62 $( obj.getConfig().BtAudio ).click(function() {63 obj.AbrirPopupMultimedia("Cargando audios...","mul_multimedia_audio.php");64 });65 obj.CargarAudios();66 } 67 if (obj.getConfig().Archivos==true)68 {69 $( obj.getConfig().BtArchivo ).click(function() {70 obj.AbrirPopupMultimedia("Cargando archivos...","mul_multimedia_archivo.php");71 });72 obj.CargarArchivos();73 } 74 75 return true;76 };77 78 this.CargarImagenes = function(){obj.CargarMultimedia("Cargando im\u00e1genes",obj.getConfig().IdLstImagen,1);}79 this.CargarVideos = function(){obj.CargarMultimedia("Cargando videos",obj.getConfig().IdLstVideo,2);}80 this.CargarAudios = function(){obj.CargarMultimedia("Cargando audios",obj.getConfig().IdLstAudio,3);}81 this.CargarArchivos = function(){obj.CargarMultimedia("Cargando archivos",obj.getConfig().IdLstArchivos,4);}82 83 this.CargarListadoTipo = function(tipo)84 {85 switch(tipo)86 {87 case 1:88 obj.CargarImagenes();89 break; 90 case 2:91 obj.CargarVideos();92 break; 93 case 3:94 obj.CargarAudios();95 break; 96 case 4:97 obj.CargarArchivos();98 break; 99 100 } 101 102 }103 this.CargarMultimedia = function(txt,idListado,tipo)104 {105 $("#MsgGuardando").html(txt);106 $("#MsgGuardando").show();107 var param = "prefijo="+$(obj.getConfig().IdPrefijo).val();108 param += "&codigo="+$(obj.getConfig().IdCodigo).val();109 param += "&tipo="+tipo;110 111 $.ajax({112 type: "POST",113 url: "mul_multimedia_general_lst.php",114 data: param,115 dataType:"html",116 success: function(msg){ 117 jQuery(idListado).html(msg);118 obj.AplicarOrdenMultimedia(tipo);119 jQuery("#MsgGuardando").hide();120 jQuery("#MsgGuardando").html("Guardando...");121 }122 });123 124 }125 this.AbrirPopupMultimedia = function(txt,archivo)126 {127 if ($(obj.getConfig().IdCodigo).val()=="")128 {129 alert("Debe guardar antes de subir un archivo multimedia");130 return false; 131 }132 133 var param;134 $("#MsgGuardando").html(txt)135 $("#MsgGuardando").show();136 $.ajax({137 type: "POST",138 url: archivo,139 data: param,140 success: function(msg){141 $($(obj.getConfig().IdPopup)).dialog({ 142 height: 500, 143 width: 800, 144 zIndex: 999999999,145 position: 'center', 146 resizable: false,147 title: "Multimedia", 148 open: function(type, data) {$($(obj.getConfig().IdPopup)).html(msg);},149 beforeclose: function(event, ui) {$($(obj.getConfig().IdPopup)).html("");}150 151 });152 $("#MsgGuardando").hide();153 $("#MsgGuardando").html("Guardando...");154 }155 });156 }// Fin Multimedia157 this.AplicarOrdenMultimedia = function(tipoSortable)158 {159 160 var id, connect, tipo;161 switch(tipoSortable)162 {163 case 1:164 tipo = obj.getConfig().IdLstOrdenImagen;165 connect = obj.getConfig().ClassConnectOrdenImagen;166 break; 167 case 2:168 tipo = obj.getConfig().IdLstOrdenVideo;169 connect = obj.getConfig().ClassConnectOrdenVideo;170 break; 171 case 3:172 tipo = obj.getConfig().IdLstOrdenAudio;173 connect = obj.getConfig().ClassConnectOrdenAudio;174 break; 175 case 4:176 tipo = obj.getConfig().IdLstOrdenArchivos;177 connect = obj.getConfig().ClassConnectOrdenArchivos;178 break; 179 180 }181 182 $(function() {183 $(tipo).sortable(184 { 185 tolerance: 'pointer',186 scroll: true , 187 handle: $(obj.getConfig().HandleSortable),188 connectWith: connect,189 axis: 'y',190 cursor: 'pointer',191 opacity: 0.6, 192 update: function() {193 194 var order = $(this).sortable("serialize");195 order += "&prefijo="+$(obj.getConfig().IdPrefijo).val();196 order += "&codigo="+$(obj.getConfig().IdCodigo).val();197 order += "&accion=2";198 $("#MsgGuardando").show();199 $.post(fileupd, order, function(msg){200 if (msg.IsSucceed)201 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");202 else203 alert(msg.Msg) 204 $("#MsgGuardando").hide();205 }, "json");206 } 207 });208 209 });// fin functio()210 211 212 }// Fin sortable Multimedia213 214 215 this.EliminarMultimedia = function(multimedia,tipo)216 {217 if (!confirm("Esta seguro que desea eliminar el archivo multimedia?"))218 return false;219 220 $("#MsgGuardando").html("Eliminando...");221 $("#MsgGuardando").show();222 var param = "prefijo="+$(obj.getConfig().IdPrefijo).val();223 param += "&codigo="+$(obj.getConfig().IdCodigo).val();224 param += "&tipo="+tipo; 225 param += "&multimediacod="+multimedia;226 param += "&accion=3";227 228 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");229 var param, url;230 $.ajax({231 type: "POST",232 url: fileupd,233 data: param,234 dataType:"json",235 success: function(msg){ 236 if (msg.IsSucceed)237 {238 obj.CargarListadoTipo(tipo);239 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);240 }else241 {242 alert(msg.Msg); 243 }244 $("#MsgGuardando").hide();245 $("#MsgGuardando").html("Guardando...");246 }247 });248 249 250 }// Fin eliminar Multimedia251 252 this.RelacionarMultimedia = function(txt,multimediacod,tipo)253 {254 $("#MsgGuardando").html(txt);255 $("#MsgGuardando").show();256 $.blockUI({ message: '<h1 class="h1block"><img src="images/cargando.gif" /> '+txt+'...</h1>',baseZ: 9999999999 }) 257 var param = "prefijo="+$(obj.getConfig().IdPrefijo).val();258 param += "&codigo="+$(obj.getConfig().IdCodigo).val();259 param += "&tipo="+tipo; 260 param += "&multimediacod="+multimediacod; 261 param += "&accion=4";262 263 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");264 $.ajax({265 type: "POST",266 url: fileupd,267 data: param,268 dataType:"json",269 success: function(msg){ 270 if (msg.IsSucceed)271 {272 obj.CargarListadoTipo(tipo);273 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);274 }else275 {276 alert(msg.Msg); 277 }278 $("#MsgGuardando").hide();279 $("#MsgGuardando").html("Guardando...");280 $.unblockUI();281 }282 });283 }284 this.SubirRelacionarMultimedia = function(txt,tipo,form)285 {286 $("#MsgGuardando").show();287 var param, url;288 $.blockUI({ message: '<h1 class="h1block"><img src="images/cargando.gif" /> '+txt+'...</h1>',baseZ: 9999999999 }) 289 param = $("#"+form).serialize(); 290 param += "&prefijo="+$(obj.getConfig().IdPrefijo).val();291 param += "&codigo="+$(obj.getConfig().IdCodigo).val();292 param += "&tipo="+tipo; 293 param += "&accion=1";294 295 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");296 $.ajax({297 type: "POST",298 url: fileupd,299 data: param,300 dataType:"json",301 success: function(msg){ 302 if (msg.IsSucceed)303 {304 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);305 $(ObjMultimedia.getConfig().IdPopup).dialog("close");306 obj.CargarListadoTipo(tipo);307 }else308 {309 alert(msg.Msg); 310 }311 $.unblockUI();312 $("#MsgGuardando").hide();313 $("#MsgGuardando").html("Guardando...");314 }315 });316 }317 this.ModificarHome = function(multimediahome,txt,multimediacod)318 {319 $("#MsgGuardando").show();320 var param, url;321 $.blockUI({ message: '<h1 class="h1block"><img src="images/cargando.gif" /> '+txt+'...</h1>',baseZ: 9999999999 }) 322 param = "prefijo="+$(obj.getConfig().IdPrefijo).val();323 param += "&codigo="+$(obj.getConfig().IdCodigo).val();324 param += "&multimediahome="+multimediahome; 325 param += "&multimediacod="+multimediacod; 326 param += "&accion=5";327 328 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");329 $.ajax({330 type: "POST",331 url: fileupd,332 data: param,333 dataType:"json",334 success: function(msg){ 335 if (msg.IsSucceed)336 {337 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);338 }else339 {340 alert(msg.Msg); 341 }342 $.unblockUI();343 $("#MsgGuardando").hide();344 $("#MsgGuardando").html("Guardando...");345 }346 });347 }348 this.SeleccionarSubirMultimediaPreview = function(multimediacod)349 {350 $("#MsgGuardando").show();351 var param, url;352 param = "prefijo="+$(obj.getConfig().IdPrefijo).val();353 param += "&codigo="+$(obj.getConfig().IdCodigo).val();354 param += "&multimediacod="+multimediacod; 355 param += "&accion=5";356 357 obj.AbrirPopupMultimedia("Cargando formulario...","mul_multimedia_general_preview_fotos_am.php");358 }359 this.AbrirPopupDominio = function(multimediacod)360 {361 var param, url;362 param = "multimediacod="+multimediacod; 363 364 $("#MsgGuardando").html("Cargando...")365 $("#MsgGuardando").show();366 $.ajax({367 type: "POST",368 url: "mul_multimedia_general_dominio.php",369 data: param,370 success: function(msg){371 $($(obj.getConfig().IdPopup)).dialog({ 372 height: 100, 373 width: 800, 374 zIndex: 999999999,375 position: 'center', 376 resizable: false,377 title: "Multimedia", 378 open: function(type, data) {$($(obj.getConfig().IdPopup)).html(msg);}379 });380 $("#MsgGuardando").hide();381 $("#MsgGuardando").html("Guardando...");382 }383 });384 }// Fin Multimedia385 this.ModificarTitulo = function(txt,multimediacod)386 {387 $("#MsgGuardando").show();388 var param, url;389 param = "prefijo="+$(obj.getConfig().IdPrefijo).val();390 param += "&codigo="+$(obj.getConfig().IdCodigo).val();391 param += "&multimediatitulo="+$("#multimediatitulo_"+multimediacod).val(); 392 param += "&multimediacod="+multimediacod; 393 param += "&accion=6";394 395 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");396 $.ajax({397 type: "POST",398 url: fileupd,399 data: param,400 dataType:"json",401 success: function(msg){ 402 if (msg.IsSucceed)403 {404 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);405 }else406 {407 alert(msg.Msg); 408 }409 $("#MsgGuardando").hide();410 }411 });412 }413 this.ModificarDescripcion = function(txt,multimediacod)414 {415 $("#MsgGuardando").show();416 var param, url;417 param = "prefijo="+$(obj.getConfig().IdPrefijo).val();418 param += "&codigo="+$(obj.getConfig().IdCodigo).val();419 param += "&multimediadesc="+$("#multimediadesc_"+multimediacod).val(); 420 param += "&multimediacod="+multimediacod; 421 param += "&accion=7";422 423 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");424 $.ajax({425 type: "POST",426 url: fileupd,427 data: param,428 dataType:"json",429 success: function(msg){ 430 if (msg.IsSucceed)431 {432 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);433 }else434 {435 alert(msg.Msg); 436 }437 $("#MsgGuardando").hide();438 }439 });440 }441 this.RelacionarPreview = function(multimediacod,multimediacodrelacion)442 {443 $("#MsgGuardando").show();444 var param, url;445 $.blockUI({ message: '<h1 class="h1block"><img src="images/cargando.gif" /> Seleccionando preview...</h1>',baseZ: 9999999999 }) 446 param = "prefijo="+$(obj.getConfig().IdPrefijo).val();447 param += "&codigo="+$(obj.getConfig().IdCodigo).val();448 param += "&multimediacod="+ObjMultimedia.IdMultimedia; 449 param += "&multimediacodRelacion="+multimediacod; 450 param += "&accion=8";451 452 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");453 $.ajax({454 type: "POST",455 url: fileupd,456 data: param,457 dataType:"json",458 success: function(msg){ 459 if (msg.IsSucceed)460 {461 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);462 if (obj.getConfig().Video==true)463 obj.CargarVideos();464 if (obj.getConfig().Audio==true)465 obj.CargarAudios();466 if (obj.getConfig().Archivos==true)467 obj.CargarArchivos();468 }else469 {470 alert(msg.Msg); 471 }472 $.unblockUI();473 $("#MsgGuardando").hide();474 $("#MsgGuardando").html("Guardando...");475 }476 });477 }478 this.EliminarPreview = function(multimediacod)479 {480 if (!confirm("Esta seguro que desea eliminar el preview?"))481 return false;482 483 $("#MsgGuardando").show();484 var param, url;485 $.blockUI({ message: '<h1 class="h1block"><img src="images/cargando.gif" /> Eliminando preview...</h1>',baseZ: 9999999999 }) 486 param = "prefijo="+$(obj.getConfig().IdPrefijo).val();487 param += "&codigo="+$(obj.getConfig().IdCodigo).val();488 param += "&multimediacod="+multimediacod; 489 param += "&accion=9";490 491 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");492 $.ajax({493 type: "POST",494 url: fileupd,495 data: param,496 dataType:"json",497 success: function(msg){ 498 if (msg.IsSucceed)499 {500 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);501 if (obj.getConfig().Video==true)502 obj.CargarVideos();503 if (obj.getConfig().Audio==true)504 obj.CargarAudios();505 if (obj.getConfig().Archivos==true)506 obj.CargarArchivos();507 508 }else509 {510 alert(msg.Msg); 511 }512 $.unblockUI();513 $("#MsgGuardando").hide();514 $("#MsgGuardando").html("Guardando...");515 }516 });517 }518 519 520 this.SubirRelacionarMultimediaPreview = function(multimediacod)521 {522 $("#MsgGuardando").show();523 var param, url;524 $.blockUI({ message: '<h1 class="h1block"><img src="images/cargando.gif" /> Subiendo preview...</h1>',baseZ: 9999999999 }) 525 param = $("#form_mul_multimedia_img").serialize(); 526 param += "&prefijo="+$(obj.getConfig().IdPrefijo).val();527 param += "&codigo="+$(obj.getConfig().IdCodigo).val();528 param += "&multimediacod="+ObjMultimedia.IdMultimedia; 529 param += "&accion=10";530 531 $($(obj.getConfig().IdMsgAccion)).html("&nbsp;");532 $.ajax({533 type: "POST",534 url: fileupd,535 data: param,536 dataType:"json",537 success: function(msg){ 538 if (msg.IsSucceed)539 {540 $($(obj.getConfig().IdMsgAccion)).html(msg.Msg);541 $(ObjMultimedia.getConfig().IdPopup).dialog("close");542 if (obj.getConfig().Video==true)543 obj.CargarVideos();544 if (obj.getConfig().Audio==true)545 obj.CargarAudios();546 if (obj.getConfig().Archivos==true)547 obj.CargarArchivos();548 }else549 {550 alert(msg.Msg); 551 }552 $.unblockUI();553 $("#MsgGuardando").hide();554 $("#MsgGuardando").html("Guardando...");555 }556 });557 }558 559 };560 ...

Full Screen

Full Screen

shapes.js

Source:shapes.js Github

copy

Full Screen

...15 .append('circle')16 // .style('stroke', 'black')17 // .style('fill', 'black')18 .attr('class', 'start-state')19 .attr('r', getConfig().state.sizeUnit)20 .attr('cx', getConfig().state.padding + getConfig().state.sizeUnit)21 .attr('cy', getConfig().state.padding + getConfig().state.sizeUnit);22/**23 * Draws a start state as a black circle24 *25 * @param {any} g26 */27export const drawDivider = (g) =>28 g29 .append('line')30 .style('stroke', 'grey')31 .style('stroke-dasharray', '3')32 .attr('x1', getConfig().state.textHeight)33 .attr('class', 'divider')34 .attr('x2', getConfig().state.textHeight * 2)35 .attr('y1', 0)36 .attr('y2', 0);37/**38 * Draws a an end state as a black circle39 *40 * @param {any} g41 * @param {any} stateDef42 */43export const drawSimpleState = (g, stateDef) => {44 const state = g45 .append('text')46 .attr('x', 2 * getConfig().state.padding)47 .attr('y', getConfig().state.textHeight + 2 * getConfig().state.padding)48 .attr('font-size', getConfig().state.fontSize)49 .attr('class', 'state-title')50 .text(stateDef.id);51 const classBox = state.node().getBBox();52 g.insert('rect', ':first-child')53 .attr('x', getConfig().state.padding)54 .attr('y', getConfig().state.padding)55 .attr('width', classBox.width + 2 * getConfig().state.padding)56 .attr('height', classBox.height + 2 * getConfig().state.padding)57 .attr('rx', getConfig().state.radius);58 return state;59};60/**61 * Draws a state with descriptions62 *63 * @param {any} g64 * @param {any} stateDef65 * @returns66 */67export const drawDescrState = (g, stateDef) => {68 const addTspan = function (textEl, txt, isFirst) {69 const tSpan = textEl70 .append('tspan')71 .attr('x', 2 * getConfig().state.padding)72 .text(txt);73 if (!isFirst) {74 tSpan.attr('dy', getConfig().state.textHeight);75 }76 };77 const title = g78 .append('text')79 .attr('x', 2 * getConfig().state.padding)80 .attr('y', getConfig().state.textHeight + 1.3 * getConfig().state.padding)81 .attr('font-size', getConfig().state.fontSize)82 .attr('class', 'state-title')83 .text(stateDef.descriptions[0]);84 const titleBox = title.node().getBBox();85 const titleHeight = titleBox.height;86 const description = g87 .append('text') // text label for the x axis88 .attr('x', getConfig().state.padding)89 .attr(90 'y',91 titleHeight +92 getConfig().state.padding * 0.4 +93 getConfig().state.dividerMargin +94 getConfig().state.textHeight95 )96 .attr('class', 'state-description');97 let isFirst = true;98 let isSecond = true;99 stateDef.descriptions.forEach(function (descr) {100 if (!isFirst) {101 addTspan(description, descr, isSecond);102 isSecond = false;103 }104 isFirst = false;105 });106 const descrLine = g107 .append('line') // text label for the x axis108 .attr('x1', getConfig().state.padding)109 .attr('y1', getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2)110 .attr('y2', getConfig().state.padding + titleHeight + getConfig().state.dividerMargin / 2)111 .attr('class', 'descr-divider');112 const descrBox = description.node().getBBox();113 const width = Math.max(descrBox.width, titleBox.width);114 descrLine.attr('x2', width + 3 * getConfig().state.padding);115 // const classBox = title.node().getBBox();116 g.insert('rect', ':first-child')117 .attr('x', getConfig().state.padding)118 .attr('y', getConfig().state.padding)119 .attr('width', width + 2 * getConfig().state.padding)120 .attr('height', descrBox.height + titleHeight + 2 * getConfig().state.padding)121 .attr('rx', getConfig().state.radius);122 return g;123};124/** Adds the creates a box around the existing content and adds a panel for the id on top of the content. */125/**126 * Function that creates an title row and a frame around a substate for a composit state diagram.127 * The function returns a new d3 svg object with updated width and height properties;128 *129 * @param {any} g The d3 svg object for the substate to framed130 * @param {any} stateDef The info about the131 * @param {any} altBkg132 */133export const addTitleAndBox = (g, stateDef, altBkg) => {134 const pad = getConfig().state.padding;135 const dblPad = 2 * getConfig().state.padding;136 const orgBox = g.node().getBBox();137 const orgWidth = orgBox.width;138 const orgX = orgBox.x;139 const title = g140 .append('text')141 .attr('x', 0)142 .attr('y', getConfig().state.titleShift)143 .attr('font-size', getConfig().state.fontSize)144 .attr('class', 'state-title')145 .text(stateDef.id);146 const titleBox = title.node().getBBox();147 const titleWidth = titleBox.width + dblPad;148 let width = Math.max(titleWidth, orgWidth); // + dblPad;149 if (width === orgWidth) {150 width = width + dblPad;151 }152 let startX;153 // const lineY = 1 - getConfig().state.textHeight;154 // const descrLine = g155 // .append('line') // text label for the x axis156 // .attr('x1', 0)157 // .attr('y1', lineY)158 // .attr('y2', lineY)159 // .attr('class', 'descr-divider');160 const graphBox = g.node().getBBox();161 // descrLine.attr('x2', graphBox.width + getConfig().state.padding);162 if (stateDef.doc) {163 // cnsole.warn(164 // stateDef.id,165 // 'orgX: ',166 // orgX,167 // 'width: ',168 // width,169 // 'titleWidth: ',170 // titleWidth,171 // 'orgWidth: ',172 // orgWidth,173 // 'width',174 // width175 // );176 }177 startX = orgX - pad;178 if (titleWidth > orgWidth) {179 startX = (orgWidth - width) / 2 + pad;180 }181 if (Math.abs(orgX - graphBox.x) < pad) {182 if (titleWidth > orgWidth) {183 startX = orgX - (titleWidth - orgWidth) / 2;184 }185 }186 const lineY = 1 - getConfig().state.textHeight;187 // White color188 g.insert('rect', ':first-child')189 .attr('x', startX)190 .attr('y', lineY)191 .attr('class', altBkg ? 'alt-composit' : 'composit')192 .attr('width', width)193 .attr(194 'height',195 graphBox.height + getConfig().state.textHeight + getConfig().state.titleShift + 1196 )197 .attr('rx', '0');198 title.attr('x', startX + pad);199 if (titleWidth <= orgWidth) title.attr('x', orgX + (width - dblPad) / 2 - titleWidth / 2 + pad);200 // Title background201 g.insert('rect', ':first-child')202 .attr('x', startX)203 .attr(204 'y',205 getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding206 )207 .attr('width', width)208 // Just needs to be higher then the descr line, will be clipped by the white color box209 .attr('height', getConfig().state.textHeight * 3)210 .attr('rx', getConfig().state.radius);211 // Full background212 g.insert('rect', ':first-child')213 .attr('x', startX)214 .attr(215 'y',216 getConfig().state.titleShift - getConfig().state.textHeight - getConfig().state.padding217 )218 .attr('width', width)219 .attr('height', graphBox.height + 3 + 2 * getConfig().state.textHeight)220 .attr('rx', getConfig().state.radius);221 return g;222};223const drawEndState = (g) => {224 g.append('circle')225 // .style('stroke', 'black')226 // .style('fill', 'white')227 .attr('class', 'end-state-outer')228 .attr('r', getConfig().state.sizeUnit + getConfig().state.miniPadding)229 .attr(230 'cx',231 getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding232 )233 .attr(234 'cy',235 getConfig().state.padding + getConfig().state.sizeUnit + getConfig().state.miniPadding236 );237 return (238 g239 .append('circle')240 // .style('stroke', 'black')241 // .style('fill', 'black')242 .attr('class', 'end-state-inner')243 .attr('r', getConfig().state.sizeUnit)244 .attr('cx', getConfig().state.padding + getConfig().state.sizeUnit + 2)245 .attr('cy', getConfig().state.padding + getConfig().state.sizeUnit + 2)246 );247};248const drawForkJoinState = (g, stateDef) => {249 let width = getConfig().state.forkWidth;250 let height = getConfig().state.forkHeight;251 if (stateDef.parentId) {252 let tmp = width;253 width = height;254 height = tmp;255 }256 return g257 .append('rect')258 .style('stroke', 'black')259 .style('fill', 'black')260 .attr('width', width)261 .attr('height', height)262 .attr('x', getConfig().state.padding)263 .attr('y', getConfig().state.padding);264};265export const drawText = function (elem, textData) {266 // Remove and ignore br:s267 const nText = textData.text.replace(common.lineBreakRegex, ' ');268 const textElem = elem.append('text');269 textElem.attr('x', textData.x);270 textElem.attr('y', textData.y);271 textElem.style('text-anchor', textData.anchor);272 textElem.attr('fill', textData.fill);273 if (typeof textData.class !== 'undefined') {274 textElem.attr('class', textData.class);275 }276 const span = textElem.append('tspan');277 span.attr('x', textData.x + textData.textMargin * 2);278 span.attr('fill', textData.fill);279 span.text(nText);280 return textElem;281};282const _drawLongText = (_text, x, y, g) => {283 let textHeight = 0;284 const textElem = g.append('text');285 textElem.style('text-anchor', 'start');286 textElem.attr('class', 'noteText');287 let text = _text.replace(/\r\n/g, '<br/>');288 text = text.replace(/\n/g, '<br/>');289 const lines = text.split(common.lineBreakRegex);290 let tHeight = 1.25 * getConfig().state.noteMargin;291 for (const line of lines) {292 const txt = line.trim();293 if (txt.length > 0) {294 const span = textElem.append('tspan');295 span.text(txt);296 if (tHeight === 0) {297 const textBounds = span.node().getBBox();298 tHeight += textBounds.height;299 }300 textHeight += tHeight;301 span.attr('x', x + getConfig().state.noteMargin);302 span.attr('y', y + textHeight + 1.25 * getConfig().state.noteMargin);303 }304 }305 return { textWidth: textElem.node().getBBox().width, textHeight };306};307/**308 * Draws a note to the diagram309 *310 * @param text - The text of the given note.311 * @param g - The element the note is attached to.312 */313export const drawNote = (text, g) => {314 g.attr('class', 'state-note');315 const note = g.append('rect').attr('x', 0).attr('y', getConfig().state.padding);316 const rectElem = g.append('g');317 const { textWidth, textHeight } = _drawLongText(text, 0, 0, rectElem);318 note.attr('height', textHeight + 2 * getConfig().state.noteMargin);319 note.attr('width', textWidth + getConfig().state.noteMargin * 2);320 return note;321};322/**323 * Starting point for drawing a state. The function finds out the specifics about the state and324 * renders with approprtiate function.325 *326 * @param {any} elem327 * @param {any} stateDef328 */329export const drawState = function (elem, stateDef) {330 const id = stateDef.id;331 const stateInfo = {332 id: id,333 label: stateDef.id,334 width: 0,335 height: 0,336 };337 const g = elem.append('g').attr('id', id).attr('class', 'stateGroup');338 if (stateDef.type === 'start') drawStartState(g);339 if (stateDef.type === 'end') drawEndState(g);340 if (stateDef.type === 'fork' || stateDef.type === 'join') drawForkJoinState(g, stateDef);341 if (stateDef.type === 'note') drawNote(stateDef.note.text, g);342 if (stateDef.type === 'divider') drawDivider(g);343 if (stateDef.type === 'default' && stateDef.descriptions.length === 0)344 drawSimpleState(g, stateDef);345 if (stateDef.type === 'default' && stateDef.descriptions.length > 0) drawDescrState(g, stateDef);346 const stateBox = g.node().getBBox();347 stateInfo.width = stateBox.width + 2 * getConfig().state.padding;348 stateInfo.height = stateBox.height + 2 * getConfig().state.padding;349 idCache.set(id, stateInfo);350 // stateCnt++;351 return stateInfo;352};353let edgeCount = 0;354export const drawEdge = function (elem, path, relation) {355 const getRelationType = function (type) {356 switch (type) {357 case stateDb.relationType.AGGREGATION:358 return 'aggregation';359 case stateDb.relationType.EXTENSION:360 return 'extension';361 case stateDb.relationType.COMPOSITION:362 return 'composition';363 case stateDb.relationType.DEPENDENCY:364 return 'dependency';365 }366 };367 path.points = path.points.filter((p) => !Number.isNaN(p.y));368 // The data for our line369 const lineData = path.points;370 // This is the accessor function we talked about above371 const lineFunction = line()372 .x(function (d) {373 return d.x;374 })375 .y(function (d) {376 return d.y;377 })378 .curve(curveBasis);379 const svgPath = elem380 .append('path')381 .attr('d', lineFunction(lineData))382 .attr('id', 'edge' + edgeCount)383 .attr('class', 'transition');384 let url = '';385 if (getConfig().state.arrowMarkerAbsolute) {386 url =387 window.location.protocol +388 '//' +389 window.location.host +390 window.location.pathname +391 window.location.search;392 url = url.replace(/\(/g, '\\(');393 url = url.replace(/\)/g, '\\)');394 }395 svgPath.attr(396 'marker-end',397 'url(' + url + '#' + getRelationType(stateDb.relationType.DEPENDENCY) + 'End' + ')'398 );399 if (typeof relation.title !== 'undefined') {400 const label = elem.append('g').attr('class', 'stateLabel');401 const { x, y } = utils.calcLabelPosition(path.points);402 const rows = common.getRows(relation.title);403 let titleHeight = 0;404 const titleRows = [];405 let maxWidth = 0;406 let minX = 0;407 for (let i = 0; i <= rows.length; i++) {408 const title = label409 .append('text')410 .attr('text-anchor', 'middle')411 .text(rows[i])412 .attr('x', x)413 .attr('y', y + titleHeight);414 const boundstmp = title.node().getBBox();415 maxWidth = Math.max(maxWidth, boundstmp.width);416 minX = Math.min(minX, boundstmp.x);417 log.info(boundstmp.x, x, y + titleHeight);418 if (titleHeight === 0) {419 const titleBox = title.node().getBBox();420 titleHeight = titleBox.height;421 log.info('Title height', titleHeight, y);422 }423 titleRows.push(title);424 }425 let boxHeight = titleHeight * rows.length;426 if (rows.length > 1) {427 const heightAdj = (rows.length - 1) * titleHeight * 0.5;428 titleRows.forEach((title, i) => title.attr('y', y + i * titleHeight - heightAdj));429 boxHeight = titleHeight * rows.length;430 }431 const bounds = label.node().getBBox();432 label433 .insert('rect', ':first-child')434 .attr('class', 'box')435 .attr('x', x - maxWidth / 2 - getConfig().state.padding / 2)436 .attr('y', y - boxHeight / 2 - getConfig().state.padding / 2 - 3.5)437 .attr('width', maxWidth + getConfig().state.padding)438 .attr('height', boxHeight + getConfig().state.padding);439 log.info(bounds);440 //label.attr('transform', '0 -' + (bounds.y / 2));441 // Debug points442 // path.points.forEach(point => {443 // g.append('circle')444 // .style('stroke', 'red')445 // .style('fill', 'red')446 // .attr('r', 1)447 // .attr('cx', point.x)448 // .attr('cy', point.y);449 // });450 // g.append('circle')451 // .style('stroke', 'blue')452 // .style('fill', 'blue')...

Full Screen

Full Screen

api.js

Source:api.js Github

copy

Full Screen

...10const getMultipartConfig = params => { return { headers: { 'Content-Type':'multipart/form-data;charset=UTF-8', 'token':sms_store('sms-token') } }; };11export const requestLogin = params => { return openapi_server.post(`login`, params); };12export const ssoLogin = params => { return openapi_server.post(`login/sso`, params); };13export const requestCaptcha = force => { return openapi_server.get(`captcha/` + force); };14export const getStudentList = params => { return util.checkToken(openapi_server.post(`base/getStudentList`, params, getConfig())); };15export const syncBase = params => { return util.checkToken(openapi_server.post(`base/sync`, params, getConfig())); };16export const getExamYearTermList = params => { return util.checkToken(openapi_server.post(`exam/getTermList`, params, getConfig())); };17export const getExamExamTypeList = params => { return util.checkToken(openapi_server.post(`exam/getTypeList`, params, getConfig())); };18export const getExamGradeList = params => { return util.checkToken(openapi_server.post(`exam/getGradeList`, params, getConfig())); };19export const getExamSubjectList = params => { return util.checkToken(openapi_server.post(`exam/getSubjectList`, params, getConfig())); };20export const getExamClassList = params => { return util.checkToken(openapi_server.post(`exam/getClassList`, params, getConfig())); }21export const searchExam = params => { return util.checkToken(openapi_server.post(`exam/search`, params, getConfig())); };22export const getSimpleExamList = params => { return util.checkToken(openapi_server.post(`exam/getSimpleList`, params, getConfig())); };23export const getRecentExams = (pages, params) => { return util.checkToken(openapi_server.post(`exam/recent/` + pages, params, getConfig())); };24export const addExam = params => { return util.checkToken(openapi_server.post(`exam/add`, params, getConfig())); };25export const updateExam = params => { return util.checkToken(openapi_server.post(`exam/update`, params, getConfig())); };26export const syncExam = params => { return util.checkToken(openapi_server.post(`exam/sync`, params, getConfig())); };27export const closeExam = examid => { return util.checkToken(openapi_server.get(`exam/close/` + examid, getConfig())); };28export const getExamInfo = examid => { return util.checkToken(openapi_server.get(`exam/` + examid, getConfig())); };29export const deleteExam = examid => { return util.checkToken(openapi_server.get(`exam/delete/` + examid, getConfig())); };30export const getAnalysisConfig = params => { return util.checkToken(openapi_server.post(`sys/analysis-config/search`, params, getConfig())); };31export const getAnalysisScoreLevelConfig = params => { return util.checkToken(openapi_server.post(`sys/analysis-score-level/search`, params, getConfig())); };32export const setAnalysisConfig = params => { return util.checkToken(openapi_server.post(`sys/analysis-config/addUpdate`, params, getConfig())); };33export const setAnalysisScoreLevelConfig = (examid, gradeid, subjecttype, subjectid, volumeid, params) => { return util.checkToken(openapi_server.post(`sys/analysis-score-level/batchAdd/` + examid + `/` + gradeid + `/` + subjecttype + `/` + subjectid + `/` + volumeid, params, getConfig())); };34export const getExamSubjectScoreList = params => { return util.checkToken(openapi_server.post(`exam-subject-score/search`, params, getConfig())); };35export const setExamSubjectScore = params => { return util.checkToken(openapi_server.post(`exam-subject-score/save`, params, getConfig())); };36export const getPubStatusList = params => { return util.checkToken(openapi_server.post(`exam-subject-score/getPubStatusList`, params, getConfig())); };37export const publishExamSubjectScore = params => { return util.checkToken(openapi_server.post(`exam-subject-score/publish`, params, getConfig())); };38export const unPublishExamSubjectScore = params => { return util.checkToken(openapi_server.post(`exam-subject-score/unpublish`, params, getConfig())); };39export const getExamQuestionScoreList = params => { return util.checkToken(openapi_server.post(`exam-part-score/search`, params, getConfig())); };40export const setExamQuestionScore = (examsubjectscoreid, params) => { return util.checkToken(openapi_server.post(`exam-part-score/batchAdd/` + examsubjectscoreid, params, getConfig())); };41export const importExamQuestionScore = (examid, params) => { return util.checkToken(openapi_server.post(`exam-part-score/import/` + examid, params, getMultipartConfig())); };42export const exportExamQuestionScore = params => { return util.checkToken(openapi_server.post(`exam-part-score/export`, params, getConfig())); };43export const importStudentTotalScore = (fullscoreid, params) => { return util.checkToken(openapi_server.post(`student-subject-score/import/` + fullscoreid, params, getMultipartConfig())); };44export const getSubjectIndividualList = params => { return util.checkToken(openapi_server.post(`student-subject-score/getIndividualList`, params, getConfig())); };45export const getStudentTotalScoreList = params => { return util.checkToken(openapi_server.post(`student-subject-score/search`, params, getConfig())) };46export const setStudentTotalScore = params => { return util.checkToken(openapi_server.post(`student-subject-score/save`, params, getConfig())) };47export const getEnteredStudentList = params => { return util.checkToken(openapi_server.post(`student-subject-score/getScoreEnteredList`, params, getConfig())) };48export const getUnenteredStudentList = params => { return util.checkToken(openapi_server.post(`student-subject-score/getScoreUnenteredList`, params, getConfig())) };49export const getExamMissedStudentList = params => { return util.checkToken(openapi_server.post(`student-subject-score/getExamMissedList`, params, getConfig())) };50export const exportPersonalExamTotalScore = params => { return util.checkToken(openapi_server.post(`student-subject-score/export/book/word`, params, getConfig())) };51export const getUpdateScoreProposalList = params => { return util.checkToken(openapi_server.post(`student-subject-score/review/search`, params, getConfig())) };52export const requestUpdateScoreProposal = params => { return util.checkToken(openapi_server.post(`student-subject-score/review/request`, params, getConfig())) };53export const deleteUpdateScoreProposal = params => { return util.checkToken(openapi_server.post(`student-subject-score/review/batchDelete`, params, getConfig())) };54export const acceptUpdateScoreProposal = params => { return util.checkToken(openapi_server.post(`student-subject-score/review/batchAccept`, params, getConfig())) };55export const rejectUpdateScoreProposal = params => { return util.checkToken(openapi_server.post(`student-subject-score/review/batchReject`, params, getConfig())) };56export const getReviewStudentList = params => { return util.checkToken(openapi_server.post(`student-subject-score/review/getStudentList`, params, getConfig())) };57export const getStudentPartScoreList = params => { return util.checkToken(openapi_server.post(`student-part-score/search`, params, getConfig())) };58export const importQuestionScore = (examid, params) => { return util.checkToken(openapi_server.post(`student-part-score/import/` + examid, params, getMultipartConfig())); };59export const getScoreRankStat = (params) => { return util.checkToken(openapi_server.post(`rank-stats/getList`, params, getConfig())); };60export const exportScoreRankStat = (params) => { return util.checkToken(openapi_server.post(`rank-stats/export`, params, getConfig())); };61export const exportScoreRankStatForCompare = (params) => { return util.checkToken(openapi_server.post(`rank-stats/export/compare`, params, getConfig())); };62export const getSubjectAvgScoreList = params => { return util.checkToken(openapi_server.post(`subject-average-score/getList`, params, getConfig())); };63export const exportSubjectAvgScore = params => { return util.checkToken(openapi_server.post(`subject-average-score/export`, params, getConfig())); };64export const exportSubjectAvgScoreByClass = params => { return util.checkToken(openapi_server.post(`subject-average-score/export/class`, params, getConfig())); };65export const getStudentTopCountStatList = params => { return util.checkToken(openapi_server.post(`class-top-count-stats/getList`, params, getConfig())); };66export const exportStudentTopCountStat = params => { return util.checkToken(openapi_server.post(`class-top-count-stats/export`, params, getConfig())); };67export const exportStudentTopCountStatForCompare = params => { return util.checkToken(openapi_server.post(`class-top-count-stats/export/compare`, params, getConfig())); };68export const getRankZoneStatList = params => { return util.checkToken(openapi_server.post(`rank-zone-stats/getList`, params, getConfig())); };69export const exportRankZoneStat = params => { return util.checkToken(openapi_server.post(`rank-zone-stats/export`, params, getConfig())); };70export const getLevelZoneStatList = params => { return util.checkToken(openapi_server.post(`level-zone-stats/getList`, params, getConfig())); };71export const exportLevelZoneStat = params => { return util.checkToken(openapi_server.post(`level-zone-stats/export`, params, getConfig())) };72export const getEqualityStatList = params => { return util.checkToken(openapi_server.post(`equality-stats/getList`, params, getConfig())) };73export const exportExqualityStat = params => { return util.checkToken(openapi_server.post(`equality-stats/export`, params, getConfig())) };74export const exportExqualityStatForCompare = params => { return util.checkToken(openapi_server.post(`equality-stats/export/compare`, params, getConfig())) };75export const exportExqualityStatByClass = params => { return util.checkToken(openapi_server.post(`equality-stats/export/class`, params, getConfig())) };76export const getScoreZoneStatList = params => { return util.checkToken(openapi_server.post(`score-zone-stats/getList`, params, getConfig())); };77export const exportScoreZoneStat = params => { return util.checkToken(openapi_server.post(`score-zone-stats/export`, params, getConfig())); };78export const getPartRateStatList = params => { return util.checkToken(openapi_server.post(`part-gain-rate-stats/getList`, params, getConfig())); };79export const exportPartRateStat = params => { return util.checkToken(openapi_server.post(`part-gain-rate-stats/export`, params, getConfig())); };80export const getSubjectDifficultyStatList = params => { return util.checkToken(openapi_server.post(`difficulty-stats/getList`, params, getConfig())); };81export const exportSubjectDifficultyStat = params => { return util.checkToken(openapi_server.post(`difficulty-stats/export`, params, getConfig())); };82export const getQuestionDifficultyStatList = params => { return util.checkToken(openapi_server.post(`part-difficulty-stats/getList`, params, getConfig())); };83export const exportQuestionDifficultyStat = params => { return util.checkToken(openapi_server.post(`part-difficulty-stats/export`, params, getConfig())); };84export const getStudentStatList = params => { return util.checkToken(openapi_server.post(`student-stats/getList`, params, getConfig())); };85// ECO API86const getEcoBaseAPIConfig = params => {87 return {88 baseURL: ECOAPI_SERVER + 'openapi-base',89 headers: {90 'access-token':sms_store('sms-token'),91 'Content-Type':'application/json',92 'Tenant-Id':TENANT_ID93 }94 };95};96const getEcoScoreAPIConfig = params => {97 return {98 baseURL: ECOAPI_SERVER + 'openapi-score',...

Full Screen

Full Screen

facade.js

Source:facade.js Github

copy

Full Screen

...12import L1Cache from '../l1-cache'13const Config = {14 halt: {15 get(uid: string, dc: number): boolean {16 const val = getConfig(uid).halt[dc]17 if (typeof val !== 'boolean') {18 Config.halt.set(uid, dc, false)19 return false20 }21 return val22 },23 set(uid: string, dc: number, val: boolean) {24 getConfig(uid).halt[dc] = val25 }26 },27 // invoke(method: string, params: Object = {}, opts: Object = {}) {28 //29 // },30 seq: {31 get(uid: string, dc: number) {32 const seq = getConfig(uid).seq[dc]33 if (typeof seq !== 'number') {34 Config.seq.set(uid, dc, 1)35 return 136 }37 return seq38 },39 set(uid: string, dc: number, newSeq: number) {40 getConfig(uid).seq[dc] = newSeq41 }42 },43 apiConfig: {44 get(uid: string) {45 return getConfig(uid).apiConfig46 }47 },48 thread: {49 set(uid: string, dc: DCNumber, thread: NetworkerThread) {50 getConfig(uid).thread[dc] = thread51 },52 get(uid: string, dc: DCNumber) {53 return fromNullable(getConfig(uid).thread[dc])54 },55 },56 storage: {57 get(uid: string, key: string): Promise<mixed> {58 return getConfig(uid).storage.get(key)59 },60 set(uid: string, key: string, value: any): Promise<void> {61 return getConfig(uid).storage.set(key, value)62 },63 has(uid: string, key: string): Promise<boolean> {64 return getConfig(uid).storage.has(key)65 },66 remove(uid: string, ...keys: string[]): Promise<void> {67 return getConfig(uid).storage.remove(...keys)68 },69 },70 storageAdapter: {71 get: {72 authKey(uid: string, dc: number) {73 return getConfig(uid).storageAdapter.getAuthKey(dc)74 },75 authID(uid: string, dc: number) {76 return getConfig(uid).storageAdapter.getAuthID(dc)77 },78 salt(uid: string, dc: number) {79 return getConfig(uid).storageAdapter.getSalt(dc)80 },81 dc(uid: string) {82 return getConfig(uid).storageAdapter.getDC()83 },84 nearestDC(uid: string) {85 return getConfig(uid).storageAdapter.getNearestDC()86 },87 },88 set: {89 authKey(uid: string, dc: number, data: number[]) {90 return getConfig(uid).storageAdapter.setAuthKey(dc, data)91 },92 authID(uid: string, dc: number, data: number[]) {93 return getConfig(uid).storageAdapter.setAuthID(dc, data)94 },95 salt(uid: string, dc: number, data: number[]) {96 return getConfig(uid).storageAdapter.setSalt(dc, data)97 },98 dc(uid: string, dc: number) {99 return getConfig(uid).storageAdapter.setDC(dc)100 },101 nearestDC(uid: string, dc: number) {102 return getConfig(uid).storageAdapter.setNearestDC(dc)103 },104 },105 remove: {106 authKey(uid: string, dc: number) {107 return getConfig(uid).storageAdapter.removeAuthKey(dc)108 },109 authID(uid: string, dc: number) {110 return getConfig(uid).storageAdapter.removeAuthID(dc)111 },112 salt(uid: string, dc: number) {113 return getConfig(uid).storageAdapter.removeSalt(dc)114 },115 dc(uid: string) {116 return getConfig(uid).storageAdapter.removeDC()117 },118 nearestDC(uid: string) {119 return getConfig(uid).storageAdapter.removeNearestDC()120 },121 },122 },123 fastCache: {124 get(uid: string, dc: DCNumber) {125 return getConfig(uid).fastCache[dc | 0]126 },127 init(uid: string, dc: DCNumber) {128 getConfig(uid).fastCache[dc | 0] = L1Cache.of()129 }130 },131 publicKeys: {132 get(uid: string, keyHex: string): PublicKey | false {133 return getConfig(uid).publicKeys[keyHex] || false134 },135 set(uid: string, keyHex: string, key: PublicKey) {136 getConfig(uid).publicKeys[keyHex] = key137 },138 init(uid: string, keys: PublicKey[]) {139 getConfig(uid).keyManager = KeyManager(uid, keys, Config.publicKeys)140 },141 select(uid: string, fingerprints: string[]) {142 return getConfig(uid).keyManager(fingerprints)143 },144 },145 authRequest: {146 get(uid: string, dc: number) {147 return getConfig(uid).authRequest[dc]148 },149 set(uid: string, dc: number, req: *) {150 getConfig(uid).authRequest[dc] = req151 },152 remove(uid: string, dc: number) {153 delete getConfig(uid).authRequest[dc]154 },155 },156 session: {157 get(uid: string, dc: number) {158 let session = getConfig(uid).session[dc]159 if (!Array.isArray(session)) {160 session = new Array(8)161 random(session)162 Config.session.set(uid, dc, session)163 }164 return session165 },166 set(uid: string, dc: number, session: number[]) {167 getConfig(uid).session[dc] = session168 }169 },170 rootEmitter: (uid: string) => getConfig(uid).rootEmitter,171 emit : (uid: string) => getConfig(uid).emit,172 layer : {173 apiLayer: (uid: string) => getConfig(uid).layer.apiLayer,174 mtLayer : (uid: string) => getConfig(uid).layer.mtLayer,175 },176 schema: {177 get : (uid: string) => getConfig(uid).schema,178 apiSchema: (uid: string) => getConfig(uid).schema.apiSchema,179 mtSchema : (uid: string) => getConfig(uid).schema.mtSchema,180 },181 timerOffset: {182 get: (uid: string) => getConfig(uid).timerOffset,183 set(uid: string, value: number) {184 getConfig(uid).timerOffset = value185 }186 },187 lastMessageID: {188 get: (uid: string) => getConfig(uid).lastMessageID,189 set(uid: string, value: [number, number]) {190 getConfig(uid).lastMessageID = value191 }192 },193 dcMap(uid: string, id: DCNumber) {194 const dc = getConfig(uid).dcMap.get(id)195 if (typeof dc !== 'string')196 throw new Error(`Wrong dc id! ${id}`)197 return dc198 },199 dcList(uid: string) {200 return [...getConfig(uid).dcMap.keys()]201 },202 common: getCrypto()203}...

Full Screen

Full Screen

advanced-animations.js

Source:advanced-animations.js Github

copy

Full Screen

...59 isDisabledOnReduced60 ) {61 return false;62 }63 if ( this.getConfig( 'translate_toggle' ) ) {64 if (65 this.getConfig( 'translate_x.size' ) ||66 this.getConfig( 'translate_x.sizes.to' )67 ) {68 config.translateX = {69 value: [70 this.getConfig( 'translate_x.sizes.from' ) || 0,71 this.getConfig( 'translate_x.size' ) ||72 this.getConfig( 'translate_x.sizes.to' ),73 ],74 duration: this.getConfig(75 'translate_duration.size'76 ),77 delay:78 this.getConfig( 'translate_delay.size' ) || 0,79 };80 }81 if (82 this.getConfig( 'translate_y.size' ) ||83 this.getConfig( 'translate_y.sizes.to' )84 ) {85 config.translateY = {86 value: [87 this.getConfig( 'translate_y.sizes.from' ) || 0,88 this.getConfig( 'translate_y.size' ) ||89 this.getConfig( 'translate_y.sizes.to' ),90 ],91 duration: this.getConfig(92 'translate_duration.size'93 ),94 delay:95 this.getConfig( 'translate_delay.size' ) || 0,96 };97 }98 }99 if ( this.getConfig( 'rotate_toggle' ) ) {100 if (101 this.getConfig( 'rotate_x.size' ) ||102 this.getConfig( 'rotate_x.sizes.to' )103 ) {104 config.rotateX = {105 value: [106 this.getConfig( 'rotate_x.sizes.from' ) || 0,107 this.getConfig( 'rotate_x.size' ) ||108 this.getConfig( 'rotate_x.sizes.to' ),109 ],110 duration: this.getConfig( 'rotate_duration.size' ),111 delay: this.getConfig( 'rotate_delay.size' ) || 0,112 };113 }114 if (115 this.getConfig( 'rotate_y.size' ) ||116 this.getConfig( 'rotate_y.sizes.to' )117 ) {118 config.rotateY = {119 value: [120 this.getConfig( 'rotate_y.sizes.from' ) || 0,121 this.getConfig( 'rotate_y.size' ) ||122 this.getConfig( 'rotate_y.sizes.to' ),123 ],124 duration: this.getConfig( 'rotate_duration.size' ),125 delay: this.getConfig( 'rotate_delay.size' ) || 0,126 };127 }128 if (129 this.getConfig( 'rotate_z.size' ) ||130 this.getConfig( 'rotate_z.sizes.to' )131 ) {132 config.rotateZ = {133 value: [134 this.getConfig( 'rotate_z.sizes.from' ) || 0,135 this.getConfig( 'rotate_z.size' ) ||136 this.getConfig( 'rotate_z.sizes.to' ),137 ],138 duration: this.getConfig( 'rotate_duration.size' ),139 delay: this.getConfig( 'rotate_delay.size' ) || 0,140 };141 }142 }143 if ( this.getConfig( 'scale_toggle' ) ) {144 if (145 this.getConfig( 'scale_x.size' ) ||146 this.getConfig( 'scale_x.sizes.to' )147 ) {148 config.scaleX = {149 value: [150 this.getConfig( 'scale_x.sizes.from' ) || 0,151 this.getConfig( 'scale_x.size' ) ||152 this.getConfig( 'scale_x.sizes.to' ),153 ],154 duration: this.getConfig( 'scale_duration.size' ),155 delay: this.getConfig( 'scale_delay.size' ) || 0,156 };157 }158 if (159 this.getConfig( 'scale_y.size' ) ||160 this.getConfig( 'scale_y.sizes.to' )161 ) {162 config.scaleY = {163 value: [164 this.getConfig( 'scale_y.sizes.from' ) || 0,165 this.getConfig( 'scale_y.size' ) ||166 this.getConfig( 'scale_y.sizes.to' ),167 ],168 duration: this.getConfig( 'scale_duration.size' ),169 delay: this.getConfig( 'scale_delay.size' ) || 0,170 };171 }172 }173 if (174 this.getConfig( 'translate_toggle' ) ||175 this.getConfig( 'rotate_toggle' ) ||176 this.getConfig( 'scale_toggle' )177 ) {178 this.widgetContainer.style.setProperty(179 'will-change',180 'transform'181 );182 this.animation = anime( config );183 }184 },185 runOnElementChange: debounce( function () {186 this.animation && this.animation.restart();187 this.initFloatingEffects();188 }, 200 ),189 } );190 elementorFrontend.hooks.addAction(...

Full Screen

Full Screen

floating-effects.js

Source:floating-effects.js Github

copy

Full Screen

...51 var isDisabledOnReduced = this.getElementSettings('jltma_transform_reduced_motion');52 if ( window.matchMedia( '(prefers-reduced-motion)' ).matches && isDisabledOnReduced ) {53 return false;54 }55 if ( this.getConfig( 'translate_toggle' ) ) {56 if ( this.getConfig( 'translate_x.size' ) || this.getConfig( 'translate_x.sizes.to' ) ) {57 config.translateX = {58 value: [ this.getConfig( 'translate_x.sizes.from' ) || 0, this.getConfig( 'translate_x.size' ) || this.getConfig( 'translate_x.sizes.to' ) ],59 duration: this.getConfig( 'translate_duration.size' ),60 delay: this.getConfig( 'translate_delay.size' ) || 061 };62 }63 if ( this.getConfig( 'translate_y.size' ) || this.getConfig( 'translate_y.sizes.to' ) ) {64 config.translateY = {65 value: [ this.getConfig( 'translate_y.sizes.from' ) || 0, this.getConfig( 'translate_y.size' ) || this.getConfig( 'translate_y.sizes.to' ) ],66 duration: this.getConfig( 'translate_duration.size' ),67 delay: this.getConfig( 'translate_delay.size' ) || 068 };69 }70 }71 if ( this.getConfig( 'rotate_toggle' ) ) {72 if ( this.getConfig( 'rotate_x.size' ) || this.getConfig( 'rotate_x.sizes.to' ) ) {73 config.rotateX = {74 value: [ this.getConfig( 'rotate_x.sizes.from' ) || 0, this.getConfig( 'rotate_x.size' ) || this.getConfig( 'rotate_x.sizes.to' ) ],75 duration: this.getConfig( 'rotate_duration.size' ),76 delay: this.getConfig( 'rotate_delay.size' ) || 077 };78 }79 if ( this.getConfig( 'rotate_y.size' ) || this.getConfig( 'rotate_y.sizes.to' ) ) {80 config.rotateY = {81 value: [ this.getConfig( 'rotate_y.sizes.from' ) || 0, this.getConfig( 'rotate_y.size' ) || this.getConfig( 'rotate_y.sizes.to' ) ],82 duration: this.getConfig( 'rotate_duration.size' ),83 delay: this.getConfig( 'rotate_delay.size' ) || 084 };85 }86 if ( this.getConfig( 'rotate_z.size' ) || this.getConfig( 'rotate_z.sizes.to' ) ) {87 config.rotateZ = {88 value: [ this.getConfig( 'rotate_z.sizes.from' ) || 0, this.getConfig( 'rotate_z.size' ) || this.getConfig( 'rotate_z.sizes.to' ) ],89 duration: this.getConfig( 'rotate_duration.size' ),90 delay: this.getConfig( 'rotate_delay.size' ) || 091 };92 }93 }94 if ( this.getConfig( 'scale_toggle' ) ) {95 if ( this.getConfig( 'scale_x.size' ) || this.getConfig( 'scale_x.sizes.to' ) ) {96 config.scaleX = {97 value: [ this.getConfig( 'scale_x.sizes.from' ) || 0, this.getConfig( 'scale_x.size' ) || this.getConfig( 'scale_x.sizes.to' ) ],98 duration: this.getConfig( 'scale_duration.size' ),99 delay: this.getConfig( 'scale_delay.size' ) || 0100 };101 }102 if ( this.getConfig( 'scale_y.size' ) || this.getConfig( 'scale_y.sizes.to' ) ) {103 config.scaleY = {104 value: [ this.getConfig( 'scale_y.sizes.from' ) || 0, this.getConfig( 'scale_y.size' ) || this.getConfig( 'scale_y.sizes.to' ) ],105 duration: this.getConfig( 'scale_duration.size' ),106 delay: this.getConfig( 'scale_delay.size' ) || 0107 };108 }109 }110 if ( this.getConfig( 'translate_toggle' ) || this.getConfig( 'rotate_toggle' ) || this.getConfig( 'scale_toggle' ) ) {111 this.widgetContainer.style.setProperty( 'will-change', 'transform' );112 this.animation = anime( config );113 }114 },115 runOnElementChange: debounce(116 function () {117 this.animation && this.animation.restart();118 this.initFloatingEffects();119 },120 200121 ),122 }123 );124 elementorFrontend.hooks.addAction(...

Full Screen

Full Screen

config_spec.js

Source:config_spec.js Github

copy

Full Screen

...23 it('setConfig is a function', function () {24 expect(setConfig).to.be.a('function');25 });26 it('getConfig returns an object', function () {27 expect(getConfig()).to.be.a('object');28 });29 it('sets and gets arbitrary configuarion properties', function () {30 setConfig({ baz: 'qux' });31 expect(getConfig('baz')).to.equal('qux');32 });33 it('only accepts objects', function () {34 setConfig('invalid');35 expect(getConfig('0')).to.not.equal('i');36 });37 it('sets multiple config properties', function () {38 setConfig({ foo: 'bar' });39 setConfig({ biz: 'buz' });40 var config = getConfig();41 expect(config.foo).to.equal('bar');42 expect(config.biz).to.equal('buz');43 });44 it('overwrites existing config properties', function () {45 setConfig({ foo: {biz: 'buz'} });46 setConfig({ foo: {baz: 'qux'} });47 expect(getConfig('foo')).to.eql({baz: 'qux'});48 });49 it('sets debugging', function () {50 setConfig({ debug: true });51 expect(getConfig('debug')).to.be.true;52 });53 it('sets bidderTimeout', function () {54 setConfig({ bidderTimeout: 1000 });55 expect(getConfig('bidderTimeout')).to.be.equal(1000);56 });57 it('gets user-defined publisherDomain', function () {58 setConfig({ publisherDomain: 'fc.kahuna' });59 expect(getConfig('publisherDomain')).to.equal('fc.kahuna');60 });61 it('gets default userSync config', function () {62 const DEFAULT_USERSYNC = {63 syncEnabled: true,64 pixelEnabled: true,65 syncsPerBidder: 5,66 syncDelay: 300067 };68 setDefaults({'userSync': DEFAULT_USERSYNC});69 expect(getConfig('userSync')).to.eql(DEFAULT_USERSYNC);70 });71 it('has subscribe functionality for adding listeners to config updates', function () {72 const listener = sinon.spy();73 getConfig(listener);74 setConfig({ foo: 'bar' });75 sinon.assert.calledOnce(listener);76 sinon.assert.calledWith(listener, { foo: 'bar' });77 });78 it('subscribers can unsubscribe', function () {79 const listener = sinon.spy();80 const unsubscribe = getConfig(listener);81 unsubscribe();82 setConfig({ logging: true });83 sinon.assert.notCalled(listener);84 });85 it('subscribers can subscribe to topics', function () {86 const listener = sinon.spy();87 getConfig('logging', listener);88 setConfig({ logging: true, foo: 'bar' });89 sinon.assert.calledOnce(listener);90 sinon.assert.calledWithExactly(listener, { logging: true });91 });92 it('topic subscribers are only called when that topic is changed', function () {93 const listener = sinon.spy();94 const wildcard = sinon.spy();95 getConfig('subject', listener);96 getConfig(wildcard);97 setConfig({ foo: 'bar' });98 sinon.assert.notCalled(listener);99 sinon.assert.calledOnce(wildcard);100 });101 it('sets priceGranularity', function () {102 setConfig({ priceGranularity: 'low' });103 expect(getConfig('priceGranularity')).to.be.equal('low');104 });105 it('set mediaTypePriceGranularity', function () {106 const customPriceGranularity = {107 'buckets': [{108 'min': 0,109 'max': 3,110 'increment': 0.01,111 'cap': true112 }]113 };114 setConfig({115 'mediaTypePriceGranularity': {116 'banner': 'medium',117 'video': customPriceGranularity,118 'native': 'medium'119 }120 });121 const configResult = getConfig('mediaTypePriceGranularity');122 expect(configResult.banner).to.be.equal('medium');123 expect(configResult.video).to.be.equal(customPriceGranularity);124 expect(configResult.native).to.be.equal('medium');125 });126 it('sets priceGranularity and customPriceBucket', function () {127 const goodConfig = {128 'buckets': [{129 'min': 0,130 'max': 3,131 'increment': 0.01,132 'cap': true133 }]134 };135 setConfig({ priceGranularity: goodConfig });136 expect(getConfig('priceGranularity')).to.be.equal('custom');137 expect(getConfig('customPriceBucket')).to.equal(goodConfig);138 });139 it('should log error for invalid priceGranularity', function () {140 setConfig({ priceGranularity: '' });141 const error = 'Prebid Error: no value passed to `setPriceGranularity()`';142 assert.ok(logErrorSpy.calledWith(error), 'expected error was logged');143 });144 it('should log a warning on invalid values', function () {145 setConfig({ bidderSequence: 'unrecognized sequence' });146 expect(logWarnSpy.calledOnce).to.equal(true);147 });148 it('should not log warnings when given recognized values', function () {149 setConfig({ bidderSequence: 'fixed' });150 setConfig({ bidderSequence: 'random' });151 expect(logWarnSpy.called).to.equal(false);...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

...10 },11 };12};13const getNoticeSiteList = ({ type, offset }) => {14 return axios.get(`/notice/site/list/${type}?offset=${offset}`, getConfig());15};16const getNotice = (params) => {17 return axios.get(`/notice`, {18 ...getConfig(),19 params,20 });21};22const getNoticeListBySite = ({ siteId, offset }) => {23 return axios.get(`/notice/site/${siteId}?offset=${offset}`, getConfig());24};25const getNoticeListByCategory = ({ siteId, offset }) => {26 return axios.get(`/notice/category/${siteId}?offset=${offset}`, getConfig());27};28const getRestaurant = ({ date, place }) => {29 return axios.get(`/restaurant?date=${date}&place=${place}`, getConfig());30};31const getSchedule = ({ year, month }) => {32 return axios.get(`/schedule?year=${year}&month=${month}`, getConfig());33};34const getSiteListCategory = () => {35 return axios.get(`/notice/site/list/category`, getConfig());36};37const getAllowSiteList = () => {38 return axios.get(`/allow/site/list`, getConfig());39};40const getAllowOnSiteList = () => {41 return axios.get(`/allow/on/site/list`, getConfig());42};43const setAllowSite = (site_id) => {44 return axios.post(`/allow/site/${site_id}`, {}, getConfig());45};46const unsetAllowSite = (site_id) => {47 return axios.delete(`/allow/site/${site_id}`, getConfig());48};49const getNoticeListByScrap = (list) => {50 return axios.get(`/notice/list/scrap`, { ...getConfig(), params: { list } });51};52const getPuase = () => {53 return axios.get(`/allow/pause`, getConfig());54};55const setPause = () => {56 return axios.post(`/allow/pause`, {}, getConfig());57};58const unsetPause = () => {59 return axios.delete(`/allow/pause`, getConfig());60};61const addUser = (type) => {62 return axios.post(`/user`, { type }, getConfig());63};64export {65 getNoticeSiteList,66 getNotice,67 getNoticeListByScrap,68 getNoticeListBySite,69 getNoticeListByCategory,70 getRestaurant,71 getSchedule,72 getSiteListCategory,73 getAllowSiteList,74 getAllowOnSiteList,75 setAllowSite,76 unsetAllowSite,...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParentConfig = require('stryker-parent').getConfig();2var strykerParentConfig = require('stryker-parent').getConfig();3var strykerParentConfig = require('stryker-parent').getConfig();4var strykerParentConfig = require('stryker-parent').getConfig();5var strykerParentConfig = require('stryker-parent').getConfig();6var strykerParentConfig = require('stryker-parent').getConfig();7var strykerParentConfig = require('stryker-parent').getConfig();8var strykerParentConfig = require('stryker-parent').getConfig();9var strykerParentConfig = require('stryker-parent').getConfig();10var strykerParentConfig = require('stryker-parent').getConfig();11var strykerParentConfig = require('stryker-parent').getConfig();12var strykerParentConfig = require('stryker-parent').getConfig();13var strykerParentConfig = require('stryker-parent').getConfig();14var strykerParentConfig = require('stryker-parent').getConfig();15var strykerParentConfig = require('stryker-parent').getConfig();16var strykerParentConfig = require('stryker-parent').getConfig();17var strykerParentConfig = require('stryker-parent').getConfig();

Full Screen

Using AI Code Generation

copy

Full Screen

1var parentConfig = require('stryker-parent').getConfig('test');2module.exports = function(config) {3 config.set(parentConfig);4 config.set({5 });6};7[2019-05-09 11:08:19.888] [INFO] 1 Mutant(s) generated8[2019-05-09 11:08:19.889] [INFO] 1 Mutant(s)

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var config = stryker.getConfig();3var stryker = require('stryker');4var config = stryker.getConfig();5var stryker = require('stryker-api');6var config = stryker.getConfig();7var stryker = require('stryker-mocha-runner');8var config = stryker.getConfig();9var stryker = require('stryker-mocha-framework');10var config = stryker.getConfig();11var stryker = require('stryker-typescript');12var config = stryker.getConfig();

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 stryker-parent 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