How to use parseIntValue method in Puppeteer

Best JavaScript code snippet using puppeteer

GwxPhotoCutter_1126_d.js

Source:GwxPhotoCutter_1126_d.js Github

copy

Full Screen

...77 //getComputedStyle("元素", "伪类"或null);78 //获取当前元素所有最终使用的CSS属性值。返回的是一个CSS样式声明对象(),只读。79 width = window.getComputedStyle(obj, null)[[type]];80 }81 width = self.parseIntValue(width);//数值化82 return width;83 };84 //创建最外层div85 self.createOuter = function () {86 //创建一个“DIV”对象87 var outer = self.outer = document.createElement("div");88 //这个“DIV”的 类名:89 outer.className = "gwx_photo_cutter_outer";90 outer.style.width = self.maxWidth + "px";91 outer.style.height = self.maxHeight + "px";92 //在self.render末尾添加这个“DIV”对象93 self.render.appendChild(outer); 94 };95 //创建“图片预览”96 self.createPreviews = function () {97 //将config["previews"] 赋值给panels98 var panels = config["previews"];99 for (var i = 0, len = panels.length; i < len; i++) {100 //将config["previews"]中的previews遍历给 preview101 var preview = panels[i];102 //通过id依次获得 preview103 preview = document.getElementById(preview);104 //设置 预览区的 尺寸:(可见区域的宽度)或(100)105 preview.viewSize = preview.clientWidth || 100;106 self.previews[i] = preview;107 }108 };109 //创建一个 遮罩层(Mask)110 self.createMask = function () {111 //初始化mask(内容区域)为一个 新建的“DIV”112 var mask = self.mask = document.createElement("div");113 //分别创建mask(内容区域)的上、下、左、右的四个黑色遮罩“DIV”114 var mask_north = mask.mask_north = document.createElement("div");115 var mask_south = mask.mask_south = document.createElement("div");116 var mask_west = mask.mask_west = document.createElement("div");117 var mask_east = mask.mask_east = document.createElement("div");118 self.outer.insertBefore(mask, self.outer.firstChild);//放到photo前面119 //mask(内容区域)的上、下、左、右分别添加以上四个黑色遮罩“DIV”120 mask.appendChild(mask_north);121 mask.appendChild(mask_west);122 mask.appendChild(mask_east);123 mask.appendChild(mask_south);124 //上、下、左、右分别为以上四个黑色遮罩“DIV”添加类名125 mask.className = "gwx_photo_cutter_mask";126 mask_north.className = "gwx_photo_cutter_mask_sub gwx_photo_cutter_mask_north";127 mask_south.className = "gwx_photo_cutter_mask_sub gwx_photo_cutter_mask_south";128 mask_west.className = "gwx_photo_cutter_mask_sub";129 mask_east.className = "gwx_photo_cutter_mask_sub gwx_photo_cutter_mask_east";130 //onselectstart(选中动作刚开始,尚未实质性被选中)131 mask.onselectstart = function () {//禁止点击选中132 return false;133 };134 };135 //创建中心的“DIV”136 self.createCenter = function () {137 //初始化center为一个新建的“DIV”138 var center = self.center = document.createElement("div");139 //初始化fake为一个新建的“DIV”140 var fake = self.fake = document.createElement("div");141 fake.className = "gwx_photo_cutter_fake";142 //在mask的末尾节点,添加center这个DIV143 self.mask.appendChild(center);144 //在center的末尾节点,添加fake这个DIV145 center.appendChild(fake);146 for (var i = 0; i < 8; i++) {147 //依次创建8 个block(div)148 var block = self["block_" + i] = document.createElement("div");149 block.className = "gwx_photo_cutter_block gwx_photo_cutter_block_" + i;150 //在center子节点末尾依次添加这8个block(div)151 center.appendChild(block);152 //mode153 block.mode = i;154 }155 //分别设置center、block的css属性156 center.className = "gwx_photo_cutter_center";157 self.centerOffset = self.getStyleValue(center, "borderLeftWidth") * 2;//两个中心边框158 self.blockOffset = self["block_1"].offsetWidth;//一个block的宽度159 /* var l =0;160 var t=0;*/161 //例子:162 // <input type= "text" id="t1" onclick="aaa(event)">163 164 // function aaa(e){165 // e = e || window.event;166 // var tar = e.target || e.srcElement;167 // alert(tar.id);//触发onclick事件的元素 即这个text框 的id168 // }169 center.onmousedown = function (e) {//z注册事件170 //初始化e171 e = e || window.event;172 //e.target(FF)和e.srcElement(IE)是触发event事件的元素对象173 var el = e.target || e.srcElement;174 //pageX指鼠标在页面上的位置,以页面左侧为参考点175 //clientX指可视区域内离左侧的距离,以滚动条滚动到的位置为参考点。176 var x = e.pageX || (e.clientX + self.docOffsetX);177 var y = e.pageY || (e.clientY + self.docOffsetY);178 //179 center.tag = true;180 //181 center.ox = x;182 center.oy = y;183 /*l =self.outer.offsetLeft+self.render.offsetLeft;184 t =self.outer.offsetTop+self.render.offsetTop;*/185 186 //el.className 为对象添加类名187 //el.className.indexOf("block"):兼容ie通过类名查找的问题188 if (el.className.indexOf("block") > -1) {189 center.mode = el.mode;190 self.fake.style.cursor = self.cursorMap[center.mode];//暂时修改center上面的鼠标效果191 } else {192 center.mode = "m";193 }194 document.body.style.cursor = self.cursorMap[center.mode];//暂时修改document上面的鼠标效果195 document.onselectstart = function () {196 return false;197 };198 document.onmouseup = function () {199 center.tag = false;200 self.fake.style.cursor = self.cursorMap["m"];//还原修改document上面的鼠标效果201 document.body.style.cursor = "";//self.docCursor;//还原center上面的鼠标效果202 document.onselectstart = self.docMosSel;203 document.onmousemove = self.docMosMove;204 document.onmouseup = self.docMosUp;205 };206 document.onmousemove = function (e) {207 if (center.tag) {208 e = e || window.event;209 var x = e.pageX || (e.clientX + self.docOffsetX);210 var y = e.pageY || (e.clientY + self.docOffsetY);211 /*x=x<l?(l):x;212 y=y<t?(t):y;*/213 // self.pos=x+" "+y+" "+l+" "+t;214 var dx = x - center.ox;215 var dy = y - center.oy;216 center.ox = x;217 center.oy = y;218 self.resizeHandler(center.mode, dx, dy);219 }220 };221 };222 };223 //224 self.resizeHandler = function (mode, dx, dy) {225 //226 var mw = self.photoWidth;227 var mh = self.photoHeight;228 //style.left:左边距。是读写的,offsetLeft是只读的229 var ol = self.parseIntValue(self.center.style.left);230 var ot = self.parseIntValue(self.center.style.top);231 var newX = ol;232 var newY = ot;233 var isIn = true;234 var handlers = {235 mode_m: function () {//移动236 newX = ol + dx;237 newY = ot + dy;238 dx = dy = 0;239 if (newX < 0 || newX > (mw - self.centerWidth)) {240 newX = (newX < 0) ? 0 : (mw - self.centerWidth);241 }242 if (newY < 0 || newY > (mh - self.centerHeight)) {243 newY = (newY < 0) ? 0 : (mh - self.centerHeight);244 }245 },246 mode_0: function () {//西北方向移动247 //dx = dy = self.parseIntValue((dy + dx) /2);248 dy = dx;249 newX = ol + dx;250 newY = ot + dy;251 },252 mode_1: function () {//北部移动253 dx = dy = self.parseIntValue(dy / 2) * 2;254 newX = ol + dx / 2;255 newY = ot + dy;256 },257 mode_2: function () {//东北移动258 dx = dy = -dx;// -self.parseIntValue((dx - dy) / 2);259 newY = ot + dy;260 },261 mode_3: function () {//西部移动262 dx = dy = (self.parseIntValue(dx / 2) * 2);263 newX = ol + dx;264 newY = ot + dx / 2;265 },266 mode_4: function () {//东部移动267 dx = dy = -self.parseIntValue(dx / 2) * 2;268 newY = ot + dy / 2;269 },270 mode_5: function () {//西南移动271 dy = dx;//= self.parseIntValue(dx);272 newX = ol + dx;273 },274 mode_6: function () {//南部移动275 dx = dy = -self.parseIntValue(dy / 2) * 2;276 newX = ol + dx / 2;277 },278 mode_7: function () {//东南移动279 dx = dy = -dx;//-self.parseIntValue((dx + dy) / 2);280 }281 };282 handlers["mode_" + mode]();//根据mode调用相应事件283 if (mode != "m") {284 isIn = !(newX < 0 || newY < 0);//判断左上角越界285 isIn = !isIn ? isIn : newX < (mw - self.centerWidth + dx + 1);//判断右部越界286 isIn = !isIn ? isIn : newY < (mh - self.centerHeight + dy + 1);//判断底部越界287 isIn = !isIn ? isIn : (!((self.centerWidth - dx) < self.minCenterSize && dx > 0));//判断center最小极限288 }289 if (isIn) {//如果已经越界,停止移动,move除外290 self.centerWidth -= dx;291 self.centerHeight -= dy;292 self.freshMask(newX, newY);293 }294 };295 //显示照片296 self.show = function () {297 var photo = self.photo = document.createElement("img");298 photo.className = "gwx_photo_cutter_photo";299 photo.onload = self.loadPhotoSuccessed;300 photo.onerror = self.loadPhotoFailed;301 setTimeout(function () {302 photo.src = config["photo"];303 }, 200);304 self.outer.appendChild(photo);305 };306 //预览区 的显示307 self.showPreview = function () {308 for (var i = 0, len = self.previews.length; i < len; i++) {309 var previewPanel = self.previews[i];310 var previewPhoto = document.createElement("img");311 previewPanel.style.overflow = "hidden";//隐藏预览区div的滚动条312 previewPhoto.src = config["photo"];313 previewPanel.innerHTML = "";314 previewPanel.appendChild(previewPhoto);315 }316 };317 //提示语“loading...”318 self.showTip = function (content) {319 if (!self.tipMain) {320 var tipMain = self.tipMain = document.createElement("div");321 var createTip4Preview = function () {322 var tipPreview = document.createElement("div");323 tipPreview.className = "gwx_photo_cutter_tip";324 tipPreview.innerHTML = "loading...";325 return tipPreview;326 };327 tipMain.className = "gwx_photo_cutter_tip";328 tipMain.style.lineHeight = self.maxHeight * 4 / 5 + "px";329 self.outer.appendChild(tipMain);330 }331 self.tipMain.innerHTML = content || "loading...";332 /* for (var i = 0, len = self.previews.length; i < len; i++) {333 var previewPanel = self.previews[i];334 var tip = createTip4Preview();335 tip.style.lineHeight = previewPanel.viewSize * 4 / 5 + "px";336 previewPanel.appendChild(tip);337 }*/338 };339 //新图片的位置布局340 self.freshMask = function (newX, newY) {341 var mask = self.mask;342 mask.mask_north.style.height = mask.mask_west.style.top = mask.mask_east.style.top = newY + "px";343 mask.mask_west.style.width = newX + "px";344 mask.mask_east.style.width = (self.photoWidth - self.centerWidth - newX) + "px";345 mask.mask_south.style.height = (self.photoHeight - self.centerHeight - newY) + "px";346 mask.mask_west.style.height = mask.mask_east.style.height = self.centerHeight + "px";347 self.freshCenter(newX, newY);348 if (self["showStatus"]) {//刷新状态信息349 self["showStatus"](self.getStatus());350 }351 self.freshPreview();352 };353 //新图片的中心位置354 self.freshCenter = function (newX, newY) {355 var center = self.center;356 var centerSize = self.centerHeight - self.centerOffset;357 var blockPos = (centerSize - self.blockOffset) / 2;358 center.style.left = newX + "px";359 center.style.top = newY + "px";360 center.style.width = (self.centerWidth - self.centerOffset) + "px";361 center.style.height = (self.centerHeight - self.centerOffset) + "px";362 self["block_1"].style.left = self["block_4"].style.top = self["block_6"].style.left = self["block_3"].style.top = blockPos + "px";363 };364 //新图片 的预览365 self.freshPreview = function () {366 var cLeft = self.parseIntValue(self.center.style.left);367 var cTop = self.parseIntValue(self.center.style.top);368 for (var i = 0, len = self.previews.length; i < len; i++) {369 var previewPanel = self.previews[i];370 var previewPhoto = previewPanel.getElementsByTagName("img")[0];371 var scale = (previewPanel.viewSize / self.centerWidth);372 var npw = scale * self.photoWidth;373 var nph = scale * self.photoHeight;374 previewPhoto.width = npw;375 previewPhoto.height = nph;376 previewPhoto.style.marginLeft = -(cLeft * scale) + "px";377 previewPhoto.style.marginTop = -(cTop * scale) + "px";378 }379 };380 //加载失败381 self.loadPhotoFailed = function () {382 self.tipMain.innerHTML = "Load failed!";383 /*for (var i = 0, len = self.previews.length; i < len; i++) {384 self.previews[i].firstChild.innerHTML = "Load failed!";385 }*/386 this["onerror"] = null;387 };388 //加载成功389 self.loadPhotoSuccessed = function () {390 var photo = this;391 var width = self.realPhotoWidth = photo.width;392 var height = self.realPhotoHeight = photo.height;393 //如果图片显加载出来了394 if (self.outer) {395 //self.outer.removeChild(self.tipMain);396 self.tipMain.style.display = "none";397 }398 //创建边框区、中心图片区、图片预览399 self.createMask();400 self.createCenter();401 self.showPreview();402 //获取图片合适的宽高403 if (width > height) {404 photo.width = self.maxWidth;405 } else {406 photo.height = self.maxHeight;407 }408 //设置相关的宽高409 self.photoWidth = photo.width;410 self.photoHeight = photo.height;411 self.outer.style.width = self.photoWidth + "px";412 self.centerWidth = self.centerHeight = self.parseIntValue(0.8 * Math.min(photo.width, photo.height));413 self.centerX = self.parseIntValue((self.photoWidth - self.centerWidth) / 2);414 self.centerY = self.parseIntValue((self.photoHeight - self.centerWidth) / 2);415 self.mask.style.width = self.photoWidth + "px";416 self.mask.style.height = self.photoHeight + "px";417 //418 photo.className = photo.className.replace(/\s*gwx_photo_cutter_photo/g, "");419 //420 self.freshMask(self.centerX, self.centerY);421 //422 //offsetX:IE特有,鼠标相比较于触发事件的元素的位置423 //scrollTop代表页面利用滚动条滚动到下方时,隐藏在滚动条上方的页面的高度;424 //scrollLeft代表页面利用滚动条滚动到右侧时,隐藏在滚动条左侧的页面的宽度 425 //scrollLeft() 方法返回或设置匹配元素的滚动条的水平位置。426 self.docOffsetX = document.body.scrollLeft - document.body.clientLeft;427 self.docOffsetY = document.body.scrollTop - document.body.clientTop;428 photo["onload"] = null;429 };430 //设置图片的路径431 self.setPhoto = function (src) {432 config["photo"] = src;433 };434 //获取当前状态下的宽高、边距435 self.getStatus = function () {436 var scale = self.realPhotoWidth / self.photoWidth;437 var fw = self.centerWidth;438 var fh = self.centerHeight;439 var fx = self.parseIntValue(self.center.style.left);440 var fy = self.parseIntValue(self.center.style.top);441 var w = self.parseIntValue(fw * scale);442 var h = self.parseIntValue(fh * scale);443 var x = self.parseIntValue(fx * scale);444 var y = self.parseIntValue(fy * scale);445 return {446 w: w,447 h: h,448 x: x,449 y: y,450 fw: fw,451 fh: fh,452 fx: fx,453 fy: fy,454 rw: self.realPhotoWidth,455 rh: self.realPhotoHeight456 };457 };458 //...

Full Screen

Full Screen

EmulatedDevices.js

Source:EmulatedDevices.js Github

copy

Full Screen

...71 * @param {*} object72 * @param {string} key73 * @return {number}74 */75 function parseIntValue(object, key) {76 const value = /** @type {number} */ (parseValue(object, key, 'number'));77 if (value !== Math.abs(value)) {78 throw new Error('Emulated device value \'' + key + '\' must be integer');79 }80 return value;81 }82 /**83 * @param {*} json84 * @return {!UI.Geometry.Insets}85 */86 function parseInsets(json) {87 return new UI.Geometry.Insets(88 parseIntValue(json, 'left'), parseIntValue(json, 'top'), parseIntValue(json, 'right'),89 parseIntValue(json, 'bottom'));90 }91 /**92 * @param {*} json93 * @return {!SDK.OverlayModel.HighlightColor}94 */95 function parseRGBA(json) {96 const result = {};97 result.r = parseIntValue(json, 'r');98 if (result.r < 0 || result.r > 255) {99 throw new Error('color has wrong r value: ' + result.r);100 }101 result.g = parseIntValue(json, 'g');102 if (result.g < 0 || result.g > 255) {103 throw new Error('color has wrong g value: ' + result.g);104 }105 result.b = parseIntValue(json, 'b');106 if (result.b < 0 || result.b > 255) {107 throw new Error('color has wrong b value: ' + result.b);108 }109 result.a = /** @type {number} */ (parseValue(json, 'a', 'number'));110 if (result.a < 0 || result.a > 1) {111 throw new Error('color has wrong a value: ' + result.a);112 }113 return /** @type {!SDK.OverlayModel.HighlightColor} */ (result);114 }115 /**116 * @param {*} json117 * @return {!SDK.OverlayModel.Hinge}118 */119 function parseHinge(json) {120 const result = {};121 result.width = parseIntValue(json, 'width');122 if (result.width < 0 || result.width > MaxDeviceSize) {123 throw new Error('Emulated device has wrong hinge width: ' + result.width);124 }125 result.height = parseIntValue(json, 'height');126 if (result.height < 0 || result.height > MaxDeviceSize) {127 throw new Error('Emulated device has wrong hinge height: ' + result.height);128 }129 result.x = parseIntValue(json, 'x');130 if (result.x < 0 || result.x > MaxDeviceSize) {131 throw new Error('Emulated device has wrong x offset: ' + result.height);132 }133 result.y = parseIntValue(json, 'y');134 if (result.x < 0 || result.x > MaxDeviceSize) {135 throw new Error('Emulated device has wrong y offset: ' + result.height);136 }137 if (json['contentColor']) {138 result.contentColor = parseRGBA(json['contentColor']);139 }140 if (json['outlineColor']) {141 result.outlineColor = parseRGBA(json['outlineColor']);142 }143 return /** @type {!SDK.OverlayModel.Hinge} */ (result);144 }145 /**146 * @param {*} json147 * @return {!Orientation}148 */149 function parseOrientation(json) {150 const result = {};151 result.width = parseIntValue(json, 'width');152 if (result.width < 0 || result.width > MaxDeviceSize || result.width < MinDeviceSize) {153 throw new Error('Emulated device has wrong width: ' + result.width);154 }155 result.height = parseIntValue(json, 'height');156 if (result.height < 0 || result.height > MaxDeviceSize || result.height < MinDeviceSize) {157 throw new Error('Emulated device has wrong height: ' + result.height);158 }159 const outlineInsets = parseValue(json['outline'], 'insets', 'object', null);160 if (outlineInsets) {161 result.outlineInsets = parseInsets(outlineInsets);162 if (result.outlineInsets.left < 0 || result.outlineInsets.top < 0) {163 throw new Error('Emulated device has wrong outline insets');164 }165 result.outlineImage = /** @type {string} */ (parseValue(json['outline'], 'image', 'string'));166 }167 if (json['hinge']) {168 result.hinge = parseHinge(parseValue(json, 'hinge', 'object', undefined));169 }...

Full Screen

Full Screen

SummaryItem.js

Source:SummaryItem.js Github

copy

Full Screen

...14 this.DepositGap = this.getIntValue(msmeData[19]);15 this.CreditGap = this.getIntValue(msmeData[20]);16 this.A2F = this.parseFloatValue(msmeData[10]);17 this.A2F += (this.A2F != "" ? '%' : '');18 this.Checking = this.parseIntValue(msmeData[6]);19 this.Overdratf = this.parseIntValue(msmeData[7]);20 this.Loan = this.parseIntValue(msmeData[8]);21 this.Credit = this.parseIntValue(msmeData[9]);22 this.DoesNotNeedCredit = this.parseIntValue(msmeData[11]);23 this.Unserved = this.parseIntValue(msmeData[12]);24 this.Underserved = this.parseIntValue(msmeData[13]);25 this.Wellserved = this.parseIntValue(msmeData[14]);26 this.SourcePrivate = this.parseIntValue(msmeData[15]);27 this.SourceGov = this.parseIntValue(msmeData[16]);28 this.SourceNonBank = this.parseIntValue(msmeData[17]);29 this.SourceOther = this.parseIntValue(msmeData[18]);30 this.Gdp2005 = this.getIntValue(this.indData[3]);31 this.GdpCurrent = this.getIntValue(this.indData[4]);32 this.Atms = this.parseFloatValue(this.indData[5]);33 this.BankBranches = this.parseFloatValue(this.indData[6]);34 this.PosTerminals = this.parseFloatValue(this.indData[7]);35 this.DomesticCredit = this.parseFloatValue(this.indData[8]);36 this.LendingIr = this.parseFloatValue(this.indData[9]);37 this.Population = this.getIntValue(this.indData[10]);38 this.PopulationAges = this.parseFloatValue(this.indData[29]);39 this.MobileSubscriptions = this.parseFloatValue(this.indData[12]);40 this.LaborForce = this.getIntValue(this.indData[13]);41 this.EmploymentRatio = this.parseFloatValue(this.indData[14]);42 this.PovertyRatio = this.parseFloatValue(this.indData[15]);43 this.LegalRightsStrength = this.parseFloatValue(this.indData[16]);44 this.CreditDepth = this.parseFloatValue(this.indData[17]);45 this.EaseOfBusiness = this.parseFloatValue(this.indData[18]);46 this.LiteracyRate = this.parseFloatValue(this.indData[19]);47 this.DepositIr = this.parseFloatValue(this.indData[20]);48 this.Unemployment = this.parseFloatValue(this.indData[21]);49 this.IrSpread = this.parseFloatValue(this.indData[22]);50 this.PrivateCreditCoverage = this.parseFloatValue(this.indData[23]);51 this.PublicCreditCoverage = this.parseFloatValue(this.indData[24]);52 this.LaborMale = this.parseFloatValue(this.indData[25]);53 this.LaborFemale = this.parseFloatValue(this.indData[26]);54 this.UrbanPopulation = this.parseFloatValue(this.indData[27]);55 break;56 case 'region':57 this.Name = msmeData[0];58 this.EnterprisesCount = this.getIntValue(msmeData[5]);59 this.DepositGap = this.getIntValue(msmeData[25]);60 this.CreditGap = this.getIntValue(msmeData[23]);61 this.A2F = this.parseFloatValue(msmeData[10]);62 this.A2F += (this.A2F != "" ? '%' : '');63 this.Checking = this.parseIntValue(msmeData[6]);64 this.Overdratf = this.parseIntValue(msmeData[7]);65 this.Loan = this.parseIntValue(msmeData[8]);66 this.Credit = this.parseIntValue(msmeData[9]);67 this.DoesNotNeedCredit = this.parseIntValue(msmeData[11]);68 this.Unserved = this.parseIntValue(msmeData[12]);69 this.Underserved = this.parseIntValue(msmeData[13]);70 this.Wellserved = this.parseIntValue(msmeData[14]);71 this.SourcePrivate = this.parseIntValue(msmeData[18]);72 this.SourceGov = this.parseIntValue(msmeData[19]);73 this.SourceNonBank = this.parseIntValue(msmeData[20]);74 this.SourceOther = this.parseIntValue(msmeData[21]);75 this.Gdp2005 = this.getIntValue(this.indData[0]);76 this.GdpCurrent = this.getIntValue(this.indData[1]);77 this.Atms = this.parseFloatValue(this.indData[2]);78 this.BankBranches = this.parseFloatValue(this.indData[3]);79 this.PosTerminals = this.parseFloatValue(this.indData[4]);80 this.DomesticCredit = this.parseFloatValue(this.indData[5]);81 this.LendingIr = this.parseFloatValue(this.indData[6]);82 this.Population = this.getIntValue(this.indData[7]);83 this.PopulationAges = this.parseFloatValue(this.indData[25]);84 this.MobileSubscriptions = this.parseFloatValue(this.indData[9]);85 this.LaborForce = this.getIntValue(this.indData[10]);86 this.EmploymentRatio = this.parseFloatValue(this.indData[11]);87 this.PovertyRatio = this.parseFloatValue(this.indData[12]);88 this.LegalRightsStrength = this.parseFloatValue(this.indData[13]);89 this.CreditDepth = this.parseFloatValue(this.indData[14]);90 this.EaseOfBusiness = this.parseFloatValue(this.indData[15]);91 this.LiteracyRate = this.parseFloatValue(this.indData[16]);92 this.DepositIr = this.parseFloatValue(this.indData[17]);93 this.Unemployment = this.parseFloatValue(this.indData[18]);94 this.IrSpread = this.parseFloatValue(this.indData[19]);95 this.PrivateCreditCoverage = this.parseFloatValue(this.indData[20]);96 this.PublicCreditCoverage = this.parseFloatValue(this.indData[21]);97 this.LaborMale = this.parseFloatValue(this.indData[22]);98 this.LaborFemale = this.parseFloatValue(this.indData[23]);99 this.UrbanPopulation = this.parseFloatValue(this.indData[24]);100 break;101 case 'development':102 this.Name = msmeData[0];103 this.EnterprisesCount = this.getIntValue(msmeData[1]);104 this.DepositGap = this.getIntValue(msmeData[16]);105 this.CreditGap = this.getIntValue(msmeData[15]);106 this.A2F = this.parseFloatValue(msmeData[2]);107 this.A2F += (this.A2F != "" ? '%' : '');108 this.Checking = this.parseIntValue(msmeData[3]);109 this.Overdratf = this.parseIntValue(msmeData[4]);110 this.Loan = this.parseIntValue(msmeData[5]);111 this.Credit = this.parseIntValue(msmeData[6]);112 this.DoesNotNeedCredit = this.parseIntValue(msmeData[7]);113 this.Unserved = this.parseIntValue(msmeData[8]);114 this.Underserved = this.parseIntValue(msmeData[9]);115 this.Wellserved = this.parseIntValue(msmeData[10]);116 this.SourcePrivate = this.parseIntValue(msmeData[11]);117 this.SourceGov = this.parseIntValue(msmeData[12]);118 this.SourceNonBank = this.parseIntValue(msmeData[13]);119 this.SourceOther = this.parseIntValue(msmeData[14]);120 this.Gdp2005 = this.getIntValue(this.indData[3]);121 this.GdpCurrent = this.getIntValue(this.indData[4]);122 this.Atms = this.parseFloatValue(this.indData[5]);123 this.BankBranches = this.parseFloatValue(this.indData[6]);124 this.PosTerminals = this.parseFloatValue(this.indData[7]);125 this.DomesticCredit = this.parseFloatValue(this.indData[8]);126 this.LendingIr = this.parseFloatValue(this.indData[9]);127 this.Population = this.getIntValue(this.indData[10]);128 this.PopulationAges = this.parseFloatValue(this.indData[11]);129 this.MobileSubscriptions = this.parseFloatValue(this.indData[12]);130 this.LaborForce = this.getIntValue(this.indData[13]);131 this.EmploymentRatio = this.parseFloatValue(this.indData[14]);132 this.PovertyRatio = this.parseFloatValue(this.indData[15]);133 this.LegalRightsStrength = this.parseFloatValue(this.indData[16]);...

Full Screen

Full Screen

gprs.js

Source:gprs.js Github

copy

Full Screen

...40 for (i = 0; i < months.length; i++) {41 if (~s.indexOf(months[i])) {42 console.log('Found: ' + months[i]);43 a = s.split(months[i]);44 day = parseIntValue(a[0]);45 year = parseIntValue(a[1]);46 month = i > 9 ? i : ('0' + i);47 day = day > 9 ? day : ('0' + day);48 var res = parseInt(year) + '-' + month + '-' + parseInt(day);49 console.log(res);50 return res;51 }52 }53 return '';54}55/**56 * @param {String} s строка цены, на момент написания −3 691,19 ₽57*/58window.parsePriceValue = function(s)59 {60 var allow = '0123456789-,.−', i, r = '', ch, 61 isPointAlready = 0,62 isMinusAlready = 0;63 s = String(s).trim();64 for (i = 0; i < s.length; i++) {65 ch = s.charAt(i);66 //console.log(ch);67 if (~allow.indexOf(ch)) {68 if (ch == ',') {69 ch = '.';70 }71 if (ch == '.') {72 if (!isPointAlready) {73 isPointAlready = 1;74 } else {75 continue;76 }77 }78 if (ch == '−') {79 ch = '-';80 }81 if (ch == '-') {82 if (!isMinusAlready) {83 isMinusAlready = 1;84 } else {85 continue;86 }87 }88 r += ch;89 }90 }91 //console.log(r);92 return parseFloat(r);93 }94/**95 * @param {String} s строка даты, на момент написания пример 21 нояб. 2018 г.96*/97window.parseDateValue = function(s) {98 console.log('parseDateValue GOT ' + s);99 if (String(s).indexOf('–') != -1) {100 return '';101 }102 var months = ['nicapius', 'янв.', 'февр.', 'мар.', 'апр.', 'мая', 'июн.', 'июл.', 'авг.', 'сент.', 'окт.', 'нояб.', ''], 103 i, j, a, day, month, year;104 for (i = 0; i < months.length; i++) {105 if (~s.indexOf(months[i])) {106 console.log('Found: ' + months[i]);107 a = s.split(months[i]);108 day = parseIntValue(a[0]);109 if (String(day).length > 2) {110 return '';111 }112 year = parseIntValue(a[1]);113 month = i > 9 ? i : ('0' + i);114 day = day > 9 ? day : ('0' + day);115 var res = parseInt(year) + '-' + month + '-' + parseInt(day);116 console.log(res);117 return res;118 }119 }120 return '';121}122/**123 * @param {String} выбирает только целые числа из строки124*/125window.parseIntValue = function(s)126 {...

Full Screen

Full Screen

options.js

Source:options.js Github

copy

Full Screen

...30 options = program31 .description('Download map tile images from OSM tile server')32 .version(pkgInfo.version)33 // Required options34 .option('-s, --start-zoom-level <n>', 'Zoom level start', parseIntValue('-s, --start-zoom-level <n>'))35 .option('-e, --end-zoom-level <n>', 'Zoom level end', parseIntValue('-e, --end-zoom-level <n>'))36 .option('-u, --url <url>', 'Tile server url')37 .option('-o, --output-dir <dir>', 'Output directory')38 // Optional options39 .option('-v, --verbose', 'Verbose mode, default is off')40 .option('-c, --check-tiles', 'Check if the expected tiles exist in output directory instead of downloading them')41 .option('-d, --delay <ms>', 'Delay in ms between downloads, default is 0', parseIntValue('-d, --delay <ms>'))42 .option('-m, --max-retries <num>', 'Maximum number of retries for download, default is 3', parseIntValue('-m, --max-retries <num>'))43 .option('-r, --retry-delay <ms>', 'Delay in ms between download retries, default is 2500', parseIntValue('-r, --retry-delay <ms>'))44 .option('-f, --force-overwrite', 'Force overwriting existing tiles (re-downloads all tiles), default is off')45 .option('-y, --yes', 'Answer yes to prompt confirming downloading of tiles, default is off')46 .parse(process.argv);47 // Set default options unless they were set48 program.verbose = program.verbose === true;49 program.checkTiles = program.checkTiles === true;50 program.forceOverwrite = program.forceOverwrite === true;51 program.yes = program.yes === true;52 program.delay = (_.isFinite(program.delay) && program.delay >= 0) ? program.delay : 0;53 program.maxRetries = (_.isFinite(program.maxRetries) && program.maxRetries >= 0) ? program.maxRetries : 3;54 program.retryDelay = (_.isFinite(program.retryDelay) && program.retryDelay >= 0) ? program.retryDelay : 2500;55 if (program.forceOverwrite && program.checkTiles) {56 showErrorMessageAndExit("Can't use both -f (--force-overwrite) & -c (--check-tiles) options");57 }...

Full Screen

Full Screen

Engine.android.js

Source:Engine.android.js Github

copy

Full Screen

...44 ponder: parts[3],45 }46 };47 } else if (response.startsWith('info')) {48 const cpScore = parseIntValue(response, 'score cp');49 const mateScore = parseIntValue(response, 'score mate');50 return {51 type: 'info',52 data: {53 multipv: parseIntValue(response, 'multipv'),54 depth: parseIntValue(response, 'depth'),55 seldepth: parseIntValue(response, 'seldepth'),56 nodes: parseIntValue(response, 'nodes'),57 time: parseIntValue(response, 'time'),58 score: cpScore ? ['cp', cpScore] : ['mate', mateScore],59 pv: parsePv(response),60 },61 };62 } else {63 return {64 type: 'unknown',65 data: response,66 };67 }...

Full Screen

Full Screen

apiPaginate.js

Source:apiPaginate.js Github

copy

Full Screen

...13 return v <= maxLimit ? v : maxLimit;14};15function ApiPaginate() {}16ApiPaginate.parseOptionsForElasticSearch = function(params) {17 const limit = parseIntValue(params.limit, LIMIT_DEFAULT, LIMIT_MAX);18 const offset = parseIntValue(params.offset, OFFSET_DEFAULT);19 // See https://github.com/crowi/crowi/pull/29320 if (limit + offset > DEFAULT_MAX_RESULT_WINDOW) {21 throw new Error(`(limit + offset) must be less than or equal to ${DEFAULT_MAX_RESULT_WINDOW}`);22 }23 return { limit, offset };24};25ApiPaginate.parseOptions = function(params) {26 const limit = parseIntValue(params.limit, LIMIT_DEFAULT, LIMIT_MAX);27 const offset = parseIntValue(params.offset, OFFSET_DEFAULT);28 return { limit, offset };29};...

Full Screen

Full Screen

parseIntValue.js

Source:parseIntValue.js Github

copy

Full Screen

1import parseIntValue from '../../parseIntValue';2it('parseIntValue', () => {3 expect(parseIntValue(' cp 10', 'cp')).toBe(10);4 expect(parseIntValue(' cp -10', 'cp')).toBe(-10);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteer = require('puppeteer');2const { parseIntValue } = require('puppeteer-utils');3(async () => {4 const browser = await puppeteer.launch({ headless: false });5 const page = await browser.newPage();6 const searchInput = await page.$('input[name="q"]');7 await searchInput.type('puppeteer');8 const searchButton = await page.$('input[name="btnK"]');9 await searchButton.click();10 await page.waitForNavigation();11 const searchResults = await page.$$('div.g');12 for (const searchResult of searchResults) {13 const searchResultText = await searchResult.$eval('div.rc', el => el.innerText);14 console.log(searchResultText);15 }16 const searchResultsCount = await page.$eval('#result-stats', el => el.innerText);17 const searchResultsCountValue = parseIntValue(searchResultsCount);18 console.log(searchResultsCountValue);19 await browser.close();20})();21MIT © [Sudhanshu Yadav](

Full Screen

Using AI Code Generation

copy

Full Screen

1const puppeteerUtils = require('../puppeteerUtils');2(async () => {3 const browser = await puppeteer.launch();4 const page = await browser.newPage();5 await puppeteerUtils.parseIntValue(page, 'input[name="q"]', 'test');6 await browser.close();7})();8MIT © [Hammad Khan](

Full Screen

Using AI Code Generation

copy

Full Screen

1const Puppeteer = require('./puppeteer');2(async () => {3 const puppeteer = new Puppeteer();4 await puppeteer.init();5 console.log(value);6 await puppeteer.close();7})();8[MIT](

Full Screen

Using AI Code Generation

copy

Full Screen

1const { parseIntValue } = require('puppeteer-utils');2const puppeteer = require('puppeteer');3(async () => {4 const browser = await puppeteer.launch();5 const page = await browser.newPage();6 const value = await parseIntValue(page, '#myId');7 console.log(value);8 await browser.close();9})();10const { parseFloatValue } = require('puppeteer-utils');11const puppeteer = require('puppeteer');12(async () => {13 const browser = await puppeteer.launch();14 const page = await browser.newPage();15 const value = await parseFloatValue(page, '#myId');16 console.log(value);17 await browser.close();18})();19const { parseDateValue } = require('puppeteer-utils');20const puppeteer = require('puppeteer');21(async () => {22 const browser = await puppeteer.launch();23 const page = await browser.newPage();24 const value = await parseDateValue(page, '#myId');25 console.log(value);26 await browser.close();27})();28const { parseBoolValue } = require('puppeteer-utils');29const puppeteer = require('puppeteer');30(async () => {31 const browser = await puppeteer.launch();32 const page = await browser.newPage();33 const value = await parseBoolValue(page, '#myId');34 console.log(value);35 await browser.close();36})();37const { parseArrayValue } = require('puppeteer-utils');38const puppeteer = require('puppeteer');39(async () => {40 const browser = await puppeteer.launch();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Puppeteer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful