Best JavaScript code snippet using backstopjs
ndhui.js
Source:ndhui.js
12var bd_nd_supervisor = true;3var bd_nd_issues_count = 0;4var bd_nd_untrusted = false;5var bd_nd_whitelist = false;6var bd_nd_statuses = new Array();7bd_nd_statuses["NetDefender.HTTP.Core"] = new Array();8bd_nd_statuses["NetDefender.HTTP.Core"]["NetDefender.Feature.HTTP.Core.Status"] = 1;9bd_nd_statuses["NetDefender.HTTP.Alert"] = new Array();10bd_nd_statuses["NetDefender.HTTP.AntiMalware"] = new Array();11bd_nd_statuses["NetDefender.HTTP.AntiMalware"]["NetDefender.Feature.HTTP.AntiMalware.ScanRequest"] = 1;12bd_nd_statuses["NetDefender.HTTP.AntiMalware"]["NetDefender.Feature.HTTP.AntiMalware.ScanResponse"] = 1;13bd_nd_statuses["NetDefender.HTTP.AntiMalware"]["NetDefender.Feature.HTTP.AntiMalware.ScanPOST"] = 1;14bd_nd_statuses["NetDefender.HTTP.AntiMalware"]["NetDefender.Feature.HTTP.AntiMalware.ScanIM"] = 1;15bd_nd_statuses["NetDefender.HTTP.AphParental"] = new Array();16bd_nd_statuses["NetDefender.HTTP.AphParental"]["NetDefender.Feature.HTTP.AphParental.Aph"] = 1;17bd_nd_statuses["NetDefender.HTTP.AphParental"]["NetDefender.Feature.HTTP.AphParental.Parental"] = 0;18bd_nd_statuses["NetDefender.HTTP.Chunked"] = new Array();19bd_nd_statuses["NetDefender.HTTP.Cloud"] = new Array();20bd_nd_statuses["NetDefender.HTTP.Cloud"]["NetDefender.Feature.HTTP.Cloud.Status"] = 1;21bd_nd_statuses["NetDefender.HTTP.Cloud"]["NetDefender.Feature.HTTP.Cloud.Default"] = 0;22bd_nd_statuses["NetDefender.HTTP.Cloud"]["NetDefender.Feature.HTTP.Cloud.Malware"] = 1;23bd_nd_statuses["NetDefender.HTTP.Cloud"]["NetDefender.Feature.HTTP.Cloud.Phishing"] = 1;24bd_nd_statuses["NetDefender.HTTP.Cloud"]["NetDefender.Feature.HTTP.Cloud.Fraud"] = 1;25bd_nd_statuses["NetDefender.HTTP.Cloud"]["NetDefender.Feature.HTTP.Cloud.Untrusted"] = 1;26bd_nd_statuses["NetDefender.HTTP.Cloud"]["NetDefender.Feature.HTTP.Cloud.Bank"] = 1;27bd_nd_statuses["NetDefender.HTTP.Deflate"] = new Array();28bd_nd_statuses["NetDefender.HTTP.GZip"] = new Array();29bd_nd_statuses["NetDefender.HTTP.HTMLExtractor"] = new Array();30bd_nd_statuses["NetDefender.HTTP.HUI"] = new Array();31bd_nd_statuses["NetDefender.HTTP.LinkScanner"] = new Array();32bd_nd_statuses["NetDefender.HTTP.LinkScanner"]["NetDefender.Feature.HTTP.LinkScanner.Status"] = 0;33bd_nd_statuses["NetDefender.HTTP.Privacy"] = new Array();34bd_nd_statuses["NetDefender.HTTP.Privacy"]["NetDefender.Feature.HTTP.Privacy.Status"] = 1;35bd_nd_statuses["NetDefender.HTTP.Resource"] = new Array();36bd_nd_statuses["NetDefender.HTTP.Settings"] = new Array();37bd_nd_statuses["NetDefender.HTTP.WBList"] = new Array();38bd_nd_statuses["NetDefender.HTTP.WBList"]["NetDefender.Feature.HTTP.WhitelistBlacklist.Status"] = 0;39bd_nd_statuses["NetDefender.HTTP.WordFiltering"] = new Array();40bd_nd_statuses["NetDefender.HTTP.WordFiltering"]["NetDefender.Feature.HTTP.WordFiltering.Status"] = 1;41bd_nd_statuses["NetDefender.HTTP.ZLib"] = new Array();42/*BEGIN_TRANSLATABLE_TEXT*/43var bd_nd_E893A5F3FE87409FB167F51A030D021C_strings = 44{45 settings_global_title : "",46 settings_global_desc : "Global",47 settings_adfilter_title : "Ad Filter",48 settings_adfilter_desc : "Removes annoying pop-up ads.",49 settings_aph_title : "Antiphishing Filter",50 settings_aph_desc : "Blocks pages that contain phishing.",51 settings_am_title : "Antimalware Filter",52 settings_am_desc : "Blocks pages that contain malware.",53 settings_ls_title : "Search advisor",54 settings_ls_desc : "Provides advanced warning of risky websites in your search results.",55 56 toolbar_status_ok : "This page <br/> is safe",57 toolbar_status_nok : "Page <br/>not safe",58 toolbar_status_err : "An error <br/> has ocurred",59 toolbar_status_disabled : "This page is <br/> not scanned",60 toolbar_status_untrusted : "Untrusted",61 toolbar_title : "<#FullProductName#>",62 tool_3_tooltip : "Sandbox",63 tool_3_tooltip_xp : "not supported in Windows XP",64 tool_settings_text : "Settings",65 tool_settings_tooltip : "Settings",66 tool_dragger : "Click to expand",67 fraud_link: "<#fraud_link#>"68};69 /*END_TRANSLATABLE_TEXT*/70var bd_nd_E893A5F3FE87409FB167F51A030D021C_body = document.getElementsByTagName("body");71var bd_nd_E893A5F3FE87409FB167F51A030D021C_isIE = (document.addEventListener) ? (-1 == navigator.appName.search(/Internet Explorer/i) ? false : true) : true;72var bd_nd_E893A5F3FE87409FB167F51A030D021C_settings = new function(bd_nd_statuses)73{74 this.bd_nd_hui_features = [ { status: 0,75 title: bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.settings_global_title,76 description: bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.settings_global_desc,77 user:"",78 plugins:[79 { name: "NetDefender.HTTP.Core",80 features: [ "NetDefender.Feature.HTTP.Core.Status"]81 }82 ]83 },84 { status: 0,85 title: bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.settings_aph_title,86 description: bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.settings_aph_desc,87 user: "%USER%",88 plugins:[89 { name: "NetDefender.HTTP.AphParental",90 features: [ "NetDefender.Feature.HTTP.AphParental.Aph"]91 }92 ]93 },94 { status: 0,95 title: bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.settings_am_title,96 description: bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.settings_am_desc,97 user: "",98 plugins:[99 { name: "NetDefender.HTTP.AntiMalware",100 features: [ "NetDefender.Feature.HTTP.AntiMalware.ScanRequest",101 "NetDefender.Feature.HTTP.AntiMalware.ScanResponse",102 "NetDefender.Feature.HTTP.AntiMalware.ScanPOST",103 "NetDefender.Feature.HTTP.AntiMalware.ScanIM"104 ]105 }106 ]107 },108 { status: 0,109 title: bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.settings_ls_title,110 description: bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.settings_ls_desc,111 user: "%USER%",112 plugins:[113 { name: "NetDefender.HTTP.LinkScanner",114 features: [ "NetDefender.Feature.HTTP.LinkScanner.Status"115 ]116 }117 ]118 }119 ];120 this.init = function(statuses)121 {122 var i;123 var cFeatures = bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeaturesCount();124 var feature;125 for (i = 0; i < cFeatures; i++)126 {127 feature = bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeature(i);128 feature.status = this.resolveStatus(statuses, feature);129 }130 }131 this.resolveStatus = function(statuses, feature)132 {133 var i, j;134 var k = false;135 for (i = 0; i < feature.plugins.length; i++)136 {137 for (j = 0; j < feature.plugins[i].features.length; j++)138 {139 if (undefined != statuses[feature.plugins[i].name] && undefined != statuses[feature.plugins[i].name][feature.plugins[i].features[j]])140 {141 k = true;142 if (1 == statuses[feature.plugins[i].name][feature.plugins[i].features[j]])143 {144 return 1;145 }146 }147 }148 }149 if (false == k)150 {151 return -1;152 }153 return 0;154 }155 this.getFeaturesCount = function()156 {157 return this.bd_nd_hui_features.length;158 }159 this.getFeature = function(index)160 {161 return this.bd_nd_hui_features[index];162 }163 this.settingsCallback = function(responseText, responseStatus, responseXML, self)164 {165 var status;166 var root;167 if (undefined != responseXML)168 {169 root = responseXML.documentElement;170 }171 if (200 == responseStatus && undefined != root && root.tagName == "module" && root.hasChildNodes())172 {173 status = 0;174 for (var i = 0; i < root.childNodes.length; i++)175 {176 if (1 == root.childNodes[i].getAttribute("status"))177 {178 status = 1;179 break;180 }181 }182 self.feature.status = status;183 self.callback(self.index, status);184 }185 else186 {187 self.callback(-1, 10001);188 }189 }190 191 this.changeStatusByIndex = function(index, callback)192 {193 var feature = this.getFeature(index);194 var xmlhttp = new bd_nd_E893A5F3FE87409FB167F51A030D021C_ajax(this.settingsCallback);195 if(!xmlhttp)196 {197 callback(-1, 10000);198 return;199 }200 xmlhttp.index = index;201 xmlhttp.feature = feature;202 xmlhttp.callback = callback;203 var params = "status=" + encodeURIComponent("<module uid=\"NetDefender.HTTP.Core\">");204 var i, j;205 var new_status = (1 == feature.status ? 0 : 1);206 for (i = 0; i < feature.plugins.length; i++)207 {208 for (j = 0; j < feature.plugins[i].features.length; j++)209 {210 params += encodeURIComponent("<plugin uid=\"" + feature.plugins[i].name + "\" feature=\"" + feature.plugins[i].features[j] + "\" user=\"" + feature.user + "\" pid=\"%PID%\" status=\"" + new_status + "\" />");211 }212 }213 params += encodeURIComponent("</module>");214 215 xmlhttp.sendRequest(params);216 }217}218function bd_nd_E893A5F3FE87409FB167F51A030D021C_ajax(callback)219{220 var that = this;221 this.bd_nd_E893A5F3FE87409FB167F51A030D021C_ajaxCallback = callback || function() { };222 (window.ActiveXObject) ? this.ajax = new ActiveXObject("Microsoft.XMLHTTP") : this.ajax = new XMLHttpRequest();223 this.sendRequest = function(params)224 {225 that.ajax.onreadystatechange = function()226 {227 if (that.ajax.readyState == 4)228 {229 that.bd_nd_E893A5F3FE87409FB167F51A030D021C_ajaxCallback(that.ajax.responseText, that.ajax.status, that.ajax.responseXML, that);230 }231 } 232 this.ajax.open("POST", window.location + Math.random(), true);233 this.ajax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");234 this.ajax.setRequestHeader("BDNDSS_B67EA559F21B487F861FDA8A44F01C50", "10000000aedc17ed5123e54a5123e812aedc17ed6243df71651458747923b9ab6fa25fc7ee27079d");235 this.ajax.send(params);236 }237}238function bd_nd_E893A5F3FE87409FB167F51A030D021C_webEvt()239{240 this.params = "";241 242 this.addEvent = function(action, value, source)243 {244 this.params = this.params + "<event><action><![" + "CDATA" + "[" + action + "]" + "]></action><source><![" + "CDATA" + "[" + source + "]" + "]></source><value><![" + "CDATA" + "[" + value + "]" + "]></value></event>";245 }246 247 this.getEventData = function()248 {249 this.params = "<module uid=\"NetDefender.HTTP.Core\">" + this.params + "</module>";250 this.params = "event=" + encodeURIComponent(this.params);251 return this.params;252 }253 254 this.sendEvents = function()255 {256 var ajax = new bd_nd_E893A5F3FE87409FB167F51A030D021C_ajax();257 ajax.sendRequest(this.getEventData());258 }259}260var bd_nd_E893A5F3FE87409FB167F51A030D021C_evt = new function()261{ 262 this.add = function(sEvent, fSubject, oElTarget)263 {264 oElTarget = oElTarget || window,265 sEvent = sEvent.toLowerCase();266 if(bd_nd_E893A5F3FE87409FB167F51A030D021C_isIE)267 {268 //IE specific exceptions:269 if(oElTarget == window && sEvent == 'onmousemove') oElTarget = document.getElementsByTagName('BODY')[0];270 if(oElTarget == document && sEvent == 'onmouseout'){ oElTarget = document.getElementsByTagName('HTML')[0]; sEvent = 'onmouseleave'; }271 oElTarget.attachEvent(sEvent, fSubject);272 }else273 {274 sEvent = sEvent.substr(2);275 oElTarget.addEventListener(sEvent, fSubject, false);276 }277 }278 this.del = function(sEvent, fSubject, oElTarget)279 {280 oElTarget = oElTarget || window;281 sEvent = sEvent.toLowerCase();282 if(bd_nd_E893A5F3FE87409FB167F51A030D021C_isIE)283 {284 //IE specific exceptions:285 if(oElTarget == window && sEvent == 'onmousemove') oElTarget = document.getElementsByTagName('BODY')[0];286 if(oElTarget == document && sEvent == 'onmouseout'){ oElTarget = document.getElementsByTagName('HTML')[0]; sEvent = 'onmouseleave'; }287 oElTarget.detachEvent(sEvent, fSubject);288 }else289 {290 sEvent = sEvent.substr(2);291 oElTarget.removeEventListener(sEvent, fSubject, false);292 }293 }294 this.getEventTarget = function(e)295 {296 if(!e)297 e = window.event;298 if(e.target)299 return e.target;300 return e.srcElement;301 } 302}303var bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM = new function()304{305 //gElm is an object which has the structure {'name': nodeName, 'attributes' : [{'name': attrName, 'valule': 'attrValue'}, ...]}306 this.create = function(gElm)307 {308 var attrName = null;309 var node = document.createElement(gElm.name);310 for(attrName in gElm.attributes)311 {312 if ('className' == attrName)313 {314 node.className = gElm.attributes[attrName];315 }316 else317 if ('innerHTML' == attrName)318 {319 node.innerHTML = gElm.attributes[attrName];320 }321 else322 {323 node.setAttribute(attrName, gElm.attributes[attrName]);324 }325 }326 return node;327 }328 329 //gElm is an DOM object referrence330 this.destroy = function(gElm)331 {332 return gElm.parentNode.removeChild(gElm);333 }334}335//hui object336var bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI = new function () {337 var that = this;338 var no_pos_fixed = false;339 var hui_container = null;340 var PREFIX = "nd_e506252a6b7649eb9640b54befbe7519";341 var STATUS_OK = 1;342 var STATUS_NOK = 2;343 var STATUS_ERR = 3;344 var STATUS_DISABLED = 4;345 var STATUS_UNTRUSTED = 5;346 var STR_STATUS_OK = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.toolbar_status_ok;347 var STR_STATUS_NOK = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.toolbar_status_nok;348 var STR_STATUS_ERR = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.toolbar_status_err;349 var STR_STATUS_DISABLED = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.toolbar_status_disabled;350 var STR_TITLE = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.toolbar_title;351 var STR_STATUS_UNTRUSTED = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.toolbar_status_untrusted;352 var hui_visible;353 var isUntrustedSite = false;354 var settings_visible;355 var isAlertPage = false;356 var isProductOn = false;357 var status;358 var title;359 var onoff;360 var dragger;361 var settingsPage;362 var settingsPageContent;363 this.GetID = function (id) {364 return PREFIX + "_" + id;365 }366 this.StripID = function (id) {367 return id.substr(PREFIX.length + 1);368 }369 this.CreateStatus = function (state) {370 var status_style;371 var status_html;372 status = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({373 name: 'div',374 attributes:375 {376 id: this.GetID('status'),377 className: this.GetID('status')378 }379 });380 switch (state) {381 case STATUS_OK:382 {383 status.style.backgroundPosition = "0px 0px";384 status.innerHTML = "<label id='labelstatus'>" + STR_STATUS_OK + "</label>";385 } break;386 case STATUS_NOK:387 {388 var fraud_link = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.fraud_link;389 var window_location = escape(window.location);390 var newlink = fraud_link.replace("{URL}", window_location);391 status.style.backgroundPosition = "-122px 0px";392 status.innerHTML = "<label id='labelstatus'>" + STR_STATUS_NOK + "</label><a href='" + newlink + "' id='fraudlink_nok' target='_blank'> </a>";393 } break;394 case STATUS_ERR:395 {396 status.style.backgroundPosition = "-244px 0px";397 status.innerHTML = "<label id='labelstatus'>" + STR_STATUS_ERR + "</label>";398 } break;399 case STATUS_UNTRUSTED:400 {401 var fraud_link = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.fraud_link;402 var window_location = escape(window.location);403 var newlink = fraud_link.replace("{URL}", window_location);404 status.style.backgroundPosition = "-244px 0px";405 status.innerHTML = "<label id='labelstatus'>" + STR_STATUS_UNTRUSTED + "</label><a href='" + newlink + "' id='fraudlink' target='_blank'> </a>";406 } break;407 case STATUS_DISABLED:408 {409 status.style.backgroundPosition = "-366px 0px";410 status.innerHTML = "<label id='labelstatus'>" + STR_STATUS_DISABLED + "</label>";411 } break;412 default:413 {414 status.style.backgroundPosition = "-366px 0px";415 status.innerHTML = "<label id='labelstatus'>" + STR_STATUS_DISABLED + "</label>";416 } break;417 }418 hui_container.appendChild(status);419 }420 this.CreateTitle = function () {421 title = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({422 name: 'div',423 attributes:424 {425 id: this.GetID('title'),426 className: this.GetID('title'),427 innerHTML : "<span class='notranslate'><label id='labeltitle'>"+STR_TITLE+"</label></span>"428 }429 });430 hui_container.appendChild(title);431 }432 this.CreateSeparator = function () {433 var separator;434 separator = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({435 name: 'div',436 attributes:437 {438 className: this.GetID('separator')439 }440 });441 hui_container.appendChild(separator);442 }443 this.CreateTool = function (id, html, tt, ev, enabled) {444 var tool;445 tool = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({446 name: 'a',447 attributes:448 {449 id: this.GetID(id),450 className: this.GetID('tool'),451 innerHTML: html,452 title: tt,453 style: "width:auto"454 }455 });456 if (enabled) {457 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseup", ev, tool);458 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseover", this.OnMouseOver, tool);459 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseout", this.OnMouseOut, tool);460 }461 else {462 tool.style.cursor = 'default'; //setAttribute("cursor", "none");463 }464 hui_container.appendChild(tool);465 return tool;466 }467 this.CreateOnOff = function (state, tt) {468 onoff = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({469 name: 'a',470 attributes:471 {472 id: this.GetID('onoff'),473 className: this.GetID('onoff') + " " + (state ? this.GetID('onoff_on') : this.GetID('onoff_off')) + (bd_nd_supervisor ? "" : "_unavailable"),474 title: tt475 }476 });477 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseup", this.OnOnOffClick, onoff);478 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseover", this.OnMouseOver, onoff);479 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseout", this.OnMouseOut, onoff);480 hui_container.appendChild(onoff);481 }482 this.CreateDragger = function (tt) {483 dragger = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({484 name: 'a',485 attributes:486 {487 id: this.GetID('dragger'),488 className: this.GetID('dragger'),489 title: tt490 }491 });492 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseup", this.OnDraggerClick, dragger);493 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseover", this.OnMouseOver, dragger);494 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseout", this.OnMouseOut, dragger);495 hui_container.appendChild(dragger);496 }497 this.OnMouseOut = function (e) {498 sender = bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.getEventTarget(e);499 sender = bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.getEventTarget(e);500 if (sender.className == '' || sender.nodeName.toLowerCase() == 'label') {501 sender = sender.parentNode;502 }503 classes = sender.className.split(' ');504 if (classes.length) {505 var lastClassName = classes.pop();506 var newClassName = '';507 if (classes.length) {508 newClassName = classes.join(' ');509 }510 newClassName += ' ';511 var pos = lastClassName.lastIndexOf('_hover');512 if (-1 != pos) {513 newClassName += lastClassName.substr(0, pos);514 sender.className = newClassName;515 return false;516 }517 }518 }519 this.OnMouseOver = function (e) {520 sender = bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.getEventTarget(e);521 if (sender.className == '' || sender.nodeName.toLowerCase() == 'label') {522 sender = sender.parentNode;523 }524 classes = sender.className.split(' ');525 if (classes.length) {526 var lastClassName = classes.pop();527 var newClassName = '';528 if (classes.length) {529 newClassName = classes.join(' ');530 }531 newClassName += ' ';532 var pos = lastClassName.lastIndexOf('_hover');533 if (-1 == pos) {534 //we have hover strip it down535 newClassName += lastClassName;536 newClassName += '_hover';537 sender.className = newClassName;538 return false;539 }540 }541 }542 this.OnDraggerClick = function (e) {543 if (false == isAlertPage)//colapse hui only if this not an alert page544 {545 if (hui_visible) {546 hui_visible = false;547 hui_container.style.top = '-47px';548 dragger.style.top = '0px';549 if (settings_visible) {550 settingsPage.style.display = "none";551 settings_visible = false;552 }553 }554 else {555 hui_visible = true;556 hui_container.style.top = '0px';557 dragger.style.top = '47px';558 }559 e.cancelBubble = true;560 }561 }562 this.CreateSettingsPage = function () {563 settingsPage = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({564 name: 'div',565 attributes:566 {567 className: this.GetID('settings_page')568 }569 });570 var settingsPageTop = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({571 name: 'div',572 attributes:573 {574 className: this.GetID('settings_page_top')575 }576 });577 var settingsPageBottom = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({578 name: 'div',579 attributes:580 {581 className: this.GetID('settings_page_bottom')582 }583 });584 var settingsPageUpBtn = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({585 name: 'a',586 attributes:587 {588 className: this.GetID('settings_page_upbtn')589 }590 });591 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onclick", this.OnTool4Click, settingsPageUpBtn);592 settingsPageContent = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({593 name: 'div',594 attributes:595 {596 className: this.GetID('settings_page_content')597 }598 });599 this.PopulateSettings(settingsPageContent);600 settingsPage.appendChild(settingsPageTop);601 settingsPage.appendChild(settingsPageContent);602 settingsPageBottom.appendChild(settingsPageUpBtn);603 settingsPage.appendChild(settingsPageBottom);604 hui_container.appendChild(settingsPage);605 if (bd_nd_supervisor)606 {607 this.updateStatuses(bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeature(0).status);608 }609 }610 this.PopulateSettings = function (settingsPage) {611 var paragraph = null;612 var btnStatus = null;613 var featureSpacer = null;614 var count = bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeaturesCount();615 var feature = null;616 for (var i = 1; i < count; i++) {617 feature = bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeature(i);618 paragraph = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({619 name: 'p',620 attributes:621 {622 className: this.GetID('settings_feature')623 }624 });625 btnStatus = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({626 name: 'a',627 attributes:628 {629 id: this.GetID(i)630 }631 });632 if (1 == feature.status) {633 btnStatus.className = this.GetID('settings_btn_status') + " " + (bd_nd_supervisor ? this.GetID('settings_btn_status_on') : this.GetID('settings_btn_status_on_unavailable'));634 } else {635 btnStatus.className = this.GetID('settings_btn_status') + " " + (bd_nd_supervisor ? this.GetID('settings_btn_status_off') : this.GetID('settings_btn_status_off_unavailable'));636 }637 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onclick", this.btnStatusClick, btnStatus);638 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseover", this.OnMouseOver, btnStatus);639 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onmouseout", this.OnMouseOut, btnStatus);640 paragraph.innerHTML = "<label class='labelstatustxt' ><strong>" + feature.title + "</strong><br/>" + feature.description + '</label>';641 paragraph.appendChild(btnStatus);642 if (i < count - 1) {643 featureSpacer = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({644 name: 'div',645 attributes:646 {647 className: this.GetID('settings_feature_spacer')648 }649 });650 paragraph.appendChild(featureSpacer);651 }652 settingsPage.appendChild(paragraph);653 }654 }655 656 this.updateStatuses = function(status)657 {658 var count = bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeaturesCount();659 for (var i = 1; i < count; i++)660 {661 var feature = bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeature(i);662 var buton = document.getElementById(this.GetID(i));663 buton.className = this.GetID('settings_btn_status') + " " + this.GetID('settings_btn_status') + (feature.status == -1 ? '_off_unavailable' : (feature.status == 1 ? '_on' : '_off') + (status == 1 ? '' : '_unavailable'));664 }665 }666 667 this.btnStatusClick = function (e) {668 //check if the product is off669 if (bd_nd_supervisor && bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeature(0).status) {670 var sender = bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.getEventTarget(e);671 var feature = null;672 if ('' == sender.id) {673 feature = bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.StripID(sender.parentNode.id);674 } else {675 feature = bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.StripID(sender.id);676 }677 if (null != feature && -1 != bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeature(feature).status) {678 bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.changeStatusByIndex(feature, bd_nd_E893A5F3FE87409FB167F51A030D021C_statusChanged);679 }680 }681 e.cancelBubble = true;682 return false;683 }684 this.OnOnOffClick = function (e) {685 if (bd_nd_supervisor) {686 bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.changeStatusByIndex(0, bd_nd_E893A5F3FE87409FB167F51A030D021C_onOffChanged);687 e.cancelBubble = true;688 }689 }690 this.OnTool0Click = function (e) {691 alert("TOOL0");692 e.cancelBubble = true;693 }694 this.OnTool1Click = function (e) {695 alert("TOOL1");696 e.cancelBubble = true;697 }698 this.OnTool2Click = function (e) {699 var webEvt = new bd_nd_E893A5F3FE87409FB167F51A030D021C_webEvt();700 var obj = bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.getEventTarget(e);701 if (obj.nodeName.toLowerCase() == "img") {702 obj = obj.parentNode;703 }704 webEvt.addEvent("click", "", obj.id);705 webEvt.sendEvents();706 e.cancelBubble = true;707 }708 this.IsSandBoxAvailable = function () {709 var OSName = "Win7";710 var OS = navigator.appVersion;711 if (navigator.appName != 'Microsoft Internet Explorer') {712 OS = navigator.userAgent;713 }714 if (OS.indexOf("Win") != -1) {715 if ((OS.indexOf("Windows NT 7.0") != -1) || (OS.indexOf("Windows NT 6.1") != -1)) {716 //win7717 return true;718 }719 else if ((OS.indexOf("Windows NT 6.0") != -1)) {720 // cica-i vista...721 return true;722 }723 }724 return false;725 }726 this.OnTool3Click = function (e) {727 var webEvt = new bd_nd_E893A5F3FE87409FB167F51A030D021C_webEvt();728 var obj = bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.getEventTarget(e);729 if (obj.nodeName.toLowerCase() == "img") {730 obj = obj.parentNode;731 }732 webEvt.addEvent("click", window.location, "clicksandbox");733 webEvt.sendEvents();734 e.cancelBubble = true;735 }736 this.OnTool4Click = function (e) {737 if (settings_visible) {738 settingsPage.style.display = "none";739 settings_visible = false;740 } else {741 settingsPage.style.display = "block";742 settings_visible = true;743 }744 e.cancelBubble = true;745 }746 this.getIEVersion = function () {747 var rv = -1;748 var ua = navigator.userAgent;749 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");750 if (re.exec(ua) != null) {751 rv = parseFloat(RegExp.$1);752 }753 return rv;754 }755 this.canEmbed = function () {756 var rv = -1;757 if (navigator.appName != 'Microsoft Internet Explorer') {758 return true;759 }760 var ua = navigator.userAgent;761 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");762 if (re.exec(ua) != null) {763 rv = parseFloat(RegExp.$1);764 }765 if (rv >= 8.0) {766 return true;767 }768 if (typeof(document.documentMode) != "undefined")769 {770 return true;771 }772 return false;773 }774 this.IsHuiVisible = function () {775 if (isAlertPage) {776 return true;777 }778 return hui_visible;779 }780 this.GetDocHeight = function () {781 var D = document;782 var max;783 max = (D.body.scrollHeight < D.documentElement.scrollHeight ? D.documentElement.scrollHeigh : D.body.scrollHeight);784 max = (max < D.body.offsetHeight ? D.body.offsetHeight : max);785 max = (max < D.documentElement.offsetHeight ? D.documentElement.offsetHeight : max);786 max = (max < D.body.clientHeight ? D.body.clientHeight : max);787 max = (max < D.documentElement.clientHeight ? D.documentElement.clientHeight : max);788 return max;789 }790 this.Init = function () {791 // document (not window) height must be at least hui height and window must have history (toolbars history len is always 0)792 if (that.GetDocHeight() < 82 && window.history.length == 0) {793 return 2;794 }795 //create statuses init796 if (typeof(bd_nd_E893A5F3FE87409FB167F51A030D021C_settings) == "undefined")797 {798 return 2;799 }800 bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.init(bd_nd_statuses);801 //check if I am in a frame802 if (typeof (window.top) != 'object') {803 if (window.parent != window) {804 //we are in a frame805 return 1;806 }807 }808 else809 if (window.top != window) {810 return 1;811 }812 //if another load still slips by, this ensures out toolbar is unique813 if (null != document.getElementById('tf_hui_container')) {814 return;815 }816 //check if this is IE8 or above. IF IE 7 than position fixed is not useful817 if (navigator.appName == "Microsoft Internet Explorer") {818 if (typeof (document.documentMode) == 'undefined' || document.documentMode < 8) {819 no_pos_fixed = true;820 }821 }822 //create hui container div823 if (no_pos_fixed == false) {824 hui_container = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({825 name: 'div',826 attributes:827 {828 id: 'tf_hui_container',829 dir: 'ltr',830 onselectstart: 'return false;'831 }832 });833 hui_container.style.position = "fixed";834 } else {835 hui_container = bd_nd_E893A5F3FE87409FB167F51A030D021C_DOM.create({836 name: 'div',837 attributes:838 {839 id: 'tf_hui_container',840 dir: 'ltr',841 onselectstart: 'return false;'842 }843 });844 }845 hui_visible = false;846 isUntrustedSite = false;847 settings_visible = false;848 //check if this is an alert page849 if (typeof (bd_nd_issues_count) != "undefined") {850 isAlertPage = bd_nd_issues_count > 0 ? true : false;851 }852 isProductOn = (1 == bd_nd_E893A5F3FE87409FB167F51A030D021C_settings.getFeature(0).status ? true : false);853 if (typeof (bd_nd_untrusted) != "undefined" && bd_nd_untrusted) {854 isUntrustedSite = true;855 }856 if (isAlertPage || isUntrustedSite || bd_nd_whitelist) {857 hui_container.style.top = '0px';858 hui_visible = true;859 }860 document.body.appendChild(hui_container);861 if (isProductOn) {862 that.CreateStatus(isAlertPage ? STATUS_NOK : (isUntrustedSite ? STATUS_UNTRUSTED : (bd_nd_whitelist ? STATUS_NOK : STATUS_OK)));863 } else {864 that.CreateStatus(STATUS_DISABLED);865 }866 that.CreateTitle();867 that.CreateSeparator();868 var sandbox_available = that.IsSandBoxAvailable();869 var sandbox_tooltip = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.tool_3_tooltip_xp;870 if (sandbox_available) {871 sandbox_tooltip = bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.tool_3_tooltip;872 }873 that.CreateTool("tooltip_sandbox", "<div id='nd_e506252a6b7649eb9640b54befbe7519_tooltip_sandbox_img'/>", sandbox_tooltip, that.OnTool3Click, sandbox_available);874 that.CreateSeparator();875 that.CreateTool("tooltip_settings", "<div id='nd_e506252a6b7649eb9640b54befbe7519_tooltip_settings_img'/>", bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.tool_settings_tooltip, that.OnTool4Click, true);876 that.CreateSeparator();877 that.CreateOnOff(isProductOn, "ON/OFF");878 that.CreateDragger(bd_nd_E893A5F3FE87409FB167F51A030D021C_strings.tool_dragger);879 that.CreateSettingsPage();880 //add click event for document to close hui on outside click881 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onclick", bd_nd_E893A5F3FE87409FB167F51A030D021C_click_outside, document);882 } //end init883}884function bd_nd_E893A5F3FE87409FB167F51A030D021C_onOffChanged(index, status)885{886 var currentFeature = document.getElementById(bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('onoff'));887 if (null != currentFeature)888 {889 //update sender according to the new status890 if (1 == status)891 {892 currentFeature.className = bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('onoff') + " " + bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('onoff_on') + (bd_nd_supervisor ? "" : "_unavailable") + "_hover";893 bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.updateStatuses(status);894 }895 else896 if (0 == status)897 {898 currentFeature.className = bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('onoff') + " " + bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('onoff_off') + (bd_nd_supervisor ? "" : "_unavailable") + "_hover";899 bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.updateStatuses(status);900 }901 }902}903function bd_nd_E893A5F3FE87409FB167F51A030D021C_statusChanged(index, status)904{905 currentFeature = document.getElementById(bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID(index));906 if (null != currentFeature) {907 //update sender according to the new status908 if (1 == status)909 {910 currentFeature.className = bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('settings_btn_status') + " " + bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('settings_btn_status_on_hover');911 }else912 if (0 == status)913 {914 currentFeature.className = bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('settings_btn_status') + " " + bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.GetID('settings_btn_status_off_hover');915 }else916 {917 //error shit happend918 }919 }920}921function bd_nd_E893A5F3FE87409FB167F51A030D021C_click_outside(e)922{923 if (false == bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.IsHuiVisible())924 {925 //hui is not visible926 return;927 }928 var bd_nd_E893A5F3FE87409FB167F51A030D021C_target = bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.getEventTarget(e); 929 var bd_nd_E893A5F3FE87409FB167F51A030D021C_id = bd_nd_E893A5F3FE87409FB167F51A030D021C_target.id; 930 931 if(bd_nd_E893A5F3FE87409FB167F51A030D021C_id.indexOf('tf_hui_container') != -1)932 {933 //the user clicked on HUI934 return;935 }936 while(typeof(bd_nd_E893A5F3FE87409FB167F51A030D021C_target.parentNode) != 'undefined' && bd_nd_E893A5F3FE87409FB167F51A030D021C_target.parentNode != null)937 {938 bd_nd_E893A5F3FE87409FB167F51A030D021C_target = bd_nd_E893A5F3FE87409FB167F51A030D021C_target.parentNode;939 bd_nd_E893A5F3FE87409FB167F51A030D021C_id = bd_nd_E893A5F3FE87409FB167F51A030D021C_target.id;940 941 if (bd_nd_E893A5F3FE87409FB167F51A030D021C_id != 'undefined' && bd_nd_E893A5F3FE87409FB167F51A030D021C_id != null)942 { 943 if(typeof(bd_nd_E893A5F3FE87409FB167F51A030D021C_id) == 'string' && bd_nd_E893A5F3FE87409FB167F51A030D021C_id.indexOf('tf_hui_container') != -1)944 {945 //the user clicked on a HUI child946 return;947 } 948 }949 }//end while950 //call on dragger click to close hui951 bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.OnDraggerClick(e);952}953if (!window.rwctrd)954{955 /*if (bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.getIEVersion() == -1)956 {957 bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.Init();958 }959 else960 {961 window.attachEvent("onload", bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.Init);962 }*/963 if (typeof(bd_nd_issues_count) != "undefined")964 {965 if (bd_nd_issues_count)966 {967 //this is an alert page968 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onload", bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.Init, window);969 }else970 {971 if (bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.canEmbed())//do not try to show hui in IE7972 {973 bd_nd_E893A5F3FE87409FB167F51A030D021C_evt.add("onload", bd_nd_E893A5F3FE87409FB167F51A030D021C_tfHUI.Init, window);974 }975 } 976 }...
constants.js
Source:constants.js
1export const importantNotes = [2 {3 header: "REINCARCERATION",4 body: `For the purposes of this dashboard, reincarceration is the incarceration of someone in5 a North Dakota DOCR facility who has previously been incarcerated in a North Dakota DOCR6 facility no matter how much time has passed. A revocation is also a reincarceration for a7 formerly incarcerated individual, but not for an individual whose supervision revocation8 results in transfer from probation to a DOCR facility. An individual can also be9 reincarcerated following successful supervision termination, which would count towards10 reincarceration metrics but not revocation metrics. For example, if someone is incarcerated,11 released on parole, completes parole, and then a year later is incarcerated for a new crime,12 that incarceration is a reincarceration but not a revocation.13 We do not have data on incarceration in county jails or in other states. As a result, our14 reincarceration calculations consider only incarceration in North Dakota DOCR facilities.`,15 },16 {17 header: "LOCATION FILTER",18 body: `Selecting a location filters charts to only show data from individuals living in that19 county or set of counties currently or prior to incarceration. Specifically, the county of20 residence is determined by an individual's most recent home address. If the most recent21 address is that of a ND DOCR facility or parole and probation office, the last known22 non-incarcerated address is used. Of note: just over 40% of people are missing location data.23 For approximately 28% of people, this is because there is no known non-incarcerated address.24 For approximately 13% of people, this is because the last known non-incarcerated address is25 outside of North Dakota.`,26 },27 {28 header: "DATA PULLED FROM ELITE & DOCSTARS",29 body: `Data in the dashboard is updated nightly using information pulled from Elite and Docstars.`,30 },31 {32 header: "LEARN MORE",33 body: `Click on "Methodology" for more information on the calculations behind that chart.`,34 },35];36export const availableDistricts = [37 "US_ND_ADAMS",38 "US_ND_BARNES",39 "US_ND_BENSON",40 "US_ND_BILLSON",41 "US_ND_BOTTINEAU",42 "US_ND_BOWMAN",43 "US_ND_BURKE",44 "US_ND_BURLEIGH",45 "US_ND_CASS",46 "US_ND_CAVALIER",47 "US_ND_DICKEY",48 "US_ND_DIVIDE",49 "US_ND_DUNN",50 "US_ND_EDDY",51 "US_ND_EMMONS",52 "US_ND_FOSTER",53 "US_ND_GOLDEN VALLEY",54 "US_ND_GRAND FORKS",55 "US_ND_GRANT",56 "US_ND_GRIGGS",57 "US_ND_HETTINGER",58 "US_ND_KIDDER",59 "US_ND_LAMOURE",60 "US_ND_LOGAN",61 "US_ND_MCHENRY",62 "US_ND_MCINTOSH",63 "US_ND_MCKENZIE",64 "US_ND_MCLEAN",65 "US_ND_MERCER",66 "US_ND_MORTON",67 "US_ND_MOUNTRAIL",68 "US_ND_NELSON",69 "US_ND_OLIVER",70 "US_ND_PEMBINA",71 "US_ND_PIERCE",72 "US_ND_RAMSEY",73 "US_ND_RANSOM",74 "US_ND_RENVILLE",75 "US_ND_RICHLAND",76 "US_ND_ROLETTE",77 "US_ND_SARGENT",78 "US_ND_SHERIDAN",79 "US_ND_SIOUX",80 "US_ND_SLOPE",81 "US_ND_STARK",82 "US_ND_STEELE",83 "US_ND_STUTSMAN",84 "US_ND_TOWNER",85 "US_ND_TRAILL",86 "US_ND_WALSH",87 "US_ND_WARD",88 "US_ND_WELLS",89 "US_ND_WILLIAMS",90];91export const metrics = {92 district: ["all"],93 metricPeriodMonths: "36",94 supervisionType: "all",...
nd_learning_add_to_compare.js
Source:nd_learning_add_to_compare.js
1//START function2function nd_learning_add_to_compare(course_id,user_id,action_type,text,link,img_none,img_full){3 //variables4 var nd_learning_course_id = course_id;5 var nd_learning_user_id = user_id;6 var nd_learning_action_type = action_type;7 var nd_learning_text_to_return = text;8 var nd_learning_link_to_return = link;9 var nd_learning_img_to_return_none = img_none;10 var nd_learning_img_to_return_full = img_full;11 jQuery( '.nd_learning_add_to_compare_btn_'+nd_learning_course_id ).prepend('<div class="nd_learning_add_to_compare_ajax_loader_'+nd_learning_course_id+' nd_learning_bg_white_alpha nd_learning_position_absolute nd_learning_width_100_percentage nd_learning_height_100_percentage nd_learning_cursor_progress"></div>');12 //START post method13 jQuery.get(14 15 16 //ajax17 nd_learning_my_vars_add_to_compare.nd_learning_ajaxurl_add_to_compare,18 {19 action : 'nd_learning_compare_php_function', 20 nd_learning_course_id: nd_learning_course_id,21 nd_learning_user_id: nd_learning_user_id,22 nd_learning_action_type: nd_learning_action_type,23 nd_learning_text_to_return: nd_learning_text_to_return,24 nd_learning_link_to_return: nd_learning_link_to_return,25 nd_learning_img_to_return_none: nd_learning_img_to_return_none,26 nd_learning_img_to_return_full: nd_learning_img_to_return_full27 },28 //end ajax29 //START success30 function( nd_learning_compare_result ) {31 32 var nd_learning_array_result = nd_learning_compare_result.split(",");33 jQuery( ".nd_learning_add_to_compare_link_"+nd_learning_array_result[0] ).remove();34 if( typeof nd_learning_array_result[1] != 'undefined' ){35 jQuery( ".nd_learning_add_to_compare_btn_"+nd_learning_array_result[0] ).append( jQuery( "<div class='nd_learning_display_inline_block'><a title='"+nd_learning_array_result[1]+"' href="+nd_learning_link_to_return+" class='nd_learning_cursor_pointer nd_learning_display_inline_block nd_learning_text_decoration_none'><img width='20' height='20' src='"+nd_learning_img_to_return_none+"'></a></div>" ) ); 36 }else{37 jQuery( ".nd_learning_add_to_compare_btn_"+nd_learning_array_result[0] ).append( jQuery( "<div class='nd_learning_display_inline_block'><a title='"+nd_learning_text_to_return+"' href="+nd_learning_link_to_return+" class='nd_learning_cursor_pointer nd_learning_display_inline_block nd_learning_text_decoration_none'><img width='20' height='20' src='"+nd_learning_img_to_return_full+"'></a></div>" ) ); 38 }39 40 jQuery( '.nd_learning_add_to_compare_ajax_loader_'+nd_learning_course_id ).remove(); //remove the loader41 }42 //END43 44 );45 //END46 47}...
Using AI Code Generation
1var backstop = require('backstopjs');2var config = require('./backstop.json');3backstop('reference', {config: config})4 .then(function () {5 return backstop('test', {config: config});6 })7 .then(function () {8 console.log('backstopjs is done');9 })10 .catch(function (err) {11 console.log(err);12 });13{14 {15 },16 {17 },18 {19 }20 {21 }22 "paths": {
Using AI Code Generation
1var backstop = require('backstopjs');2var fs = require('fs');3var config = JSON.parse(fs.readFileSync('./backstop.json'));4config.paths.bitmaps_reference = './bitmaps_reference';5config.paths.bitmaps_test = './bitmaps_test';6config.paths.html_report = './html_report';7config.paths.ci_report = './ci_report';8backstop('test', {config: config});9{10 {11 },12 {13 },14 {15 }16 {17 }18 "paths": {19 },20 "engineOptions": {21 },22}23module.exports = function (chromy, scenario) {24 console.log('onBefore.js');
Using AI Code Generation
1var backstop = require('backstopjs');2var backstopConfig = require('./config.js');3backstop('test', {config: backstopConfig});4module.exports = {5 {6 },7 {8 },9 {10 },11 {12 }13 {14 }15 "paths": {16 },17 "engineOptions": {18 },19};
Using AI Code Generation
1module.exports = function (casper, scenario, vp) {2 const backstop = require('backstopjs');3 casper.then(function () {4 backstop('test', {5 paths: {6 },7 });8 });9};10{11 {12 },13 {14 },15 {16 }17 {18 }19 "paths": {
Using AI Code Generation
1module.exports = function (casper, scenario, vp) {2casper.then(function () {3 this.evaluate(function () {4 document.querySelector('#username').value = 'admin';5 document.querySelector('#password').value = 'admin';6 document.querySelector('#login').click();7 });8});9};10 {11 }12"paths": {13},14"engineOptions": {15},16}
Using AI Code Generation
1var backstop = require('backstopjs');2var fs = require('fs');3var path = require('path');4var os = require('os');5var crypto = require('crypto');6var rimraf = require('rimraf');7var mkdirp = require('mkdirp');8var Promise = require('bluebird');9var compareImages = require('resemblejs/compareImages');10var fs = require('fs');11var path = require('path');12var os = require('os');13var crypto = require('crypto');14var rimraf = require('rimraf');15var mkdirp = require('mkdirp');16var Promise = require('bluebird');17var compareImages = require('resemblejs/compareImages');18var fs = require('fs');19var path = require('path');20var os = require('os');21var crypto = require('crypto');22var rimraf = require('rimraf');23var mkdirp = require('mkdirp');24var Promise = require('bluebird');25var compareImages = require('resemblejs/compareImages');26var fs = require('fs');27var path = require('path');28var os = require('os');29var crypto = require('crypto');30var rimraf = require('rimraf');31var mkdirp = require('mkdirp');32var Promise = require('bluebird');33var compareImages = require('resemblejs/compareImages');34var fs = require('fs');35var path = require('path');36var os = require('os');37var crypto = require('crypto');38var rimraf = require('rimraf');39var mkdirp = require('mkdirp');40var Promise = require('bluebird');41var compareImages = require('resemblejs/compareImages');42var fs = require('fs');43var path = require('path');44var os = require('os');45var crypto = require('crypto');46var rimraf = require('rimraf');47var mkdirp = require('mkdirp');48var Promise = require('bluebird');49var compareImages = require('resemblejs/compareImages');50var fs = require('fs');51var path = require('path');52var os = require('os');53var crypto = require('crypto');54var rimraf = require('rimraf');55var mkdirp = require('mkdirp');56var Promise = require('bluebird');57var compareImages = require('resemblejs/compareImages');58var fs = require('fs');
Using AI Code Generation
1var backstop = require('backstopjs');2var fs = require('fs');3var path = require('path');4var exec = require('child_process').exec;5var config = {6 {7 },8 {9 },10 {11 }12 {13 }14 "paths": {15 },16 "engineOptions": {17 },18};19var scenarios = config.scenarios;20var viewports = config.viewports;21var referenceUrl = config.scenarios[0].referenceUrl;22var url = config.scenarios[0].url;23var label = config.scenarios[0].label;24var misMatchThreshold = config.scenarios[0].misMatchThreshold;25for (var i =
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!