How to use progress method in stryker-parent

Best JavaScript code snippet using stryker-parent

ui.js

Source:ui.js Github

copy

Full Screen

1/*global plupload */2/*global qiniu */3function FileProgress(file, targetID) {4 this.fileProgressID = file.id;5 this.file = file;6 this.opacity = 100;7 this.height = 0;8 this.fileProgressWrapper = $('#' + this.fileProgressID);9 if (!this.fileProgressWrapper.length) {10 // <div class="progress">11 // <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">12 // <span class="sr-only">20% Complete</span>13 // </div>14 // </div>15 this.fileProgressWrapper = $('<tr></tr>');16 var Wrappeer = this.fileProgressWrapper;17 Wrappeer.attr('id', this.fileProgressID).addClass('progressContainer');18 var progressText = $("<td/>");19 progressText.addClass('progressName').text(file.name);20 var fileSize = plupload.formatSize(file.size).toUpperCase();21 var progressSize = $("<td/>");22 progressSize.addClass("progressFileSize").text(fileSize);23 var progressBarTd = $("<td/>");24 var progressBarBox = $("<div/>");25 progressBarBox.addClass('info');26 var progressBarWrapper = $("<div/>");27 progressBarWrapper.addClass("progress progress-striped");28 var progressBar = $("<div/>");29 progressBar.addClass("progress-bar progress-bar-info")30 .attr('role', 'progressbar')31 .attr('aria-valuemax', 100)32 .attr('aria-valuenow', 0)33 .attr('aria-valuein', 0)34 .width('0%');35 var progressBarPercent = $('<span class=sr-only />');36 progressBarPercent.text(fileSize);37 var progressCancel = $('<a href=javascript:; />');38 progressCancel.show().addClass('progressCancel').text('×');39 progressBar.append(progressBarPercent);40 progressBarWrapper.append(progressBar);41 progressBarBox.append(progressBarWrapper);42 progressText.append(progressCancel);43 var progressBarStatus = $('<div class="status text-center"/>');44 progressBarBox.append(progressBarStatus);45 progressBarTd.append(progressBarBox);46 Wrappeer.append(progressText);47 Wrappeer.append(progressSize);48 Wrappeer.append(progressBarTd);49 $('#' + targetID).append(Wrappeer);50 } else {51 this.reset();52 }53 this.height = this.fileProgressWrapper.offset().top;54 this.setTimer(null);55}56FileProgress.prototype.setTimer = function(timer) {57 this.fileProgressWrapper.FP_TIMER = timer;58};59FileProgress.prototype.getTimer = function(timer) {60 return this.fileProgressWrapper.FP_TIMER || null;61};62FileProgress.prototype.reset = function() {63 this.fileProgressWrapper.attr('class', "progressContainer");64 this.fileProgressWrapper.find('td .progress .progress-bar-info').attr('aria-valuenow', 0).width('0%').find('span').text('');65 this.appear();66};67FileProgress.prototype.setChunkProgess = function(chunk_size) {68 var chunk_amount = Math.ceil(this.file.size / chunk_size);69 if (chunk_amount === 1) {70 return false;71 }72 var viewProgess = $('<button class="btn btn-default">查看分块上传进度</button>');73 var progressBarChunkTr = $('<tr class="chunk-status-tr"><td colspan=3></td></tr>');74 var progressBarChunk = $('<div/>');75 for (var i = 1; i <= chunk_amount; i++) {76 var col = $('<div class="col-md-2"/>');77 var progressBarWrapper = $('<div class="progress progress-striped"></div');78 var progressBar = $("<div/>");79 progressBar.addClass("progress-bar progress-bar-info text-left")80 .attr('role', 'progressbar')81 .attr('aria-valuemax', 100)82 .attr('aria-valuenow', 0)83 .attr('aria-valuein', 0)84 .width('0%')85 .attr('id', this.file.id + '_' + i)86 .text('');87 var progressBarStatus = $('<span/>');88 progressBarStatus.addClass('chunk-status').text();89 progressBarWrapper.append(progressBar);90 progressBarWrapper.append(progressBarStatus);91 col.append(progressBarWrapper);92 progressBarChunk.append(col);93 }94 if(!this.fileProgressWrapper.find('td:eq(2) .btn-default').length){95 this.fileProgressWrapper.find('td>div').append(viewProgess);96 }97 progressBarChunkTr.hide().find('td').append(progressBarChunk);98 progressBarChunkTr.insertAfter(this.fileProgressWrapper);99};100FileProgress.prototype.setProgress = function(percentage, speed, chunk_size) {101 this.fileProgressWrapper.attr('class', "progressContainer green");102 var file = this.file;103 var uploaded = file.loaded;104 var size = plupload.formatSize(uploaded).toUpperCase();105 var formatSpeed = plupload.formatSize(speed).toUpperCase();106 var progressbar = this.fileProgressWrapper.find('td .progress').find('.progress-bar-info');107 if (this.fileProgressWrapper.find('.status').text() === '取消上传'){108 return;109 }110 this.fileProgressWrapper.find('.status').text("已上传: " + size + " 上传速度: " + formatSpeed + "/s");111 percentage = parseInt(percentage, 10);112 if (file.status !== plupload.DONE && percentage === 100) {113 percentage = 99;114 }115 progressbar.attr('aria-valuenow', percentage).css('width', percentage + '%');116 if (chunk_size) {117 var chunk_amount = Math.ceil(file.size / chunk_size);118 if (chunk_amount === 1) {119 return false;120 }121 var current_uploading_chunk = Math.ceil(uploaded / chunk_size);122 var pre_chunk, text;123 for (var index = 0; index < current_uploading_chunk; index++) {124 pre_chunk = $('#' + file.id + "_" + index);125 pre_chunk.width('100%').removeClass().addClass('alert alert-success').attr('aria-valuenow', 100);126 text = "块" + index + "上传进度100%";127 pre_chunk.next().html(text);128 }129 var currentProgessBar = $('#' + file.id + "_" + current_uploading_chunk);130 var current_chunk_percent;131 if (current_uploading_chunk < chunk_amount) {132 if (uploaded % chunk_size) {133 current_chunk_percent = ((uploaded % chunk_size) / chunk_size * 100).toFixed(2);134 } else {135 current_chunk_percent = 100;136 currentProgessBar.removeClass().addClass('alert alert-success');137 }138 } else {139 var last_chunk_size = file.size - chunk_size * (chunk_amount - 1);140 var left_file_size = file.size - uploaded;141 if (left_file_size % last_chunk_size) {142 current_chunk_percent = ((uploaded % chunk_size) / last_chunk_size * 100).toFixed(2);143 } else {144 current_chunk_percent = 100;145 currentProgessBar.removeClass().addClass('alert alert-success');146 }147 }148 currentProgessBar.width(current_chunk_percent + '%');149 currentProgessBar.attr('aria-valuenow', current_chunk_percent);150 text = "块" + current_uploading_chunk + "上传进度" + current_chunk_percent + '%';151 currentProgessBar.next().html(text);152 }153 this.appear();154};155FileProgress.prototype.setComplete = function(up, info) {156 var td = this.fileProgressWrapper.find('td:eq(2)'),157 tdProgress = td.find('.progress');158 var res;159 var url;160 if(uploadConfig.saveType == "oss"){161 url = "oss";162 str = "<div class='success_text'>上传成功</div>";163 }else{164 res = $.parseJSON(info);165 if (res.url) {166 url = res.url;167 str = "<div class='success_text'>上传成功</div>";168 } else {169 var domain = up.getOption('domain');170 url = domain + encodeURI(res.key);171 var link = domain + res.key;172 str = "<div class='success_text'>上传成功</div>";173 }174 }175 tdProgress.html(str).removeClass().next().next('.status').hide();176 this.fileProgressWrapper.find('td:eq(0) .progressCancel').hide();177 td.find('.status').hide();178 angular.element(document.querySelector('angular-filemanager > div')).scope().fileNavigator.refresh();179};180FileProgress.prototype.setError = function() {181 this.fileProgressWrapper.find('td:eq(2)').attr('class', 'text-warning');182 this.fileProgressWrapper.find('td:eq(2) .progress').css('width', 0).hide();183 this.fileProgressWrapper.find('button').hide();184 this.fileProgressWrapper.next('.chunk-status-tr').hide();185};186FileProgress.prototype.setCancelled = function(manual) {187 var progressContainer = 'progressContainer';188 if (!manual) {189 progressContainer += ' red';190 }191 this.fileProgressWrapper.attr('class', progressContainer);192 this.fileProgressWrapper.find('td .progress').remove();193 this.fileProgressWrapper.find('td:eq(2) .btn-default').hide();194 this.fileProgressWrapper.find('td:eq(0) .progressCancel').hide();195};196FileProgress.prototype.setStatus = function(status, isUploading) {197 if (!isUploading) {198 this.fileProgressWrapper.find('.status').text(status).attr('class', 'status text-left');199 }200};201// 绑定取消上传事件202FileProgress.prototype.bindUploadCancel = function(up) {203 var self = this;204 if (up) {205 self.fileProgressWrapper.find('td:eq(0) .progressCancel').on('click', function(){206 self.setCancelled(false);207 self.setStatus("取消上传");208 self.fileProgressWrapper.find('.status').css('left', '0');209 up.removeFile(self.file);210 });211 }212};213FileProgress.prototype.appear = function() {214 if (this.getTimer() !== null) {215 clearTimeout(this.getTimer());216 this.setTimer(null);217 }218 if (this.fileProgressWrapper[0].filters) {219 try {220 this.fileProgressWrapper[0].filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100;221 } catch (e) {222 // If it is not set initially, the browser will throw an error. This will set it if it is not set yet.223 this.fileProgressWrapper.css('filter', "progid:DXImageTransform.Microsoft.Alpha(opacity=100)");224 }225 } else {226 this.fileProgressWrapper.css('opacity', 1);227 }228 this.fileProgressWrapper.css('height', '');229 this.height = this.fileProgressWrapper.offset().top;230 this.opacity = 100;231 this.fileProgressWrapper.show();...

Full Screen

Full Screen

handlers.js

Source:handlers.js Github

copy

Full Screen

1/**2 * 3 * @version $Id: handlers.js 1 22:28 2010年7月20日Z tianya $4 * @package DedeCMS.Administrator5 * @copyright Copyright (c) 2007 - 2010, DesDev, Inc.6 * @license http://help.dedecms.com/usersguide/license.html7 * @link http://www.dedecms.com8 */9//---事件句并------------------------------10function fileQueueError(file, errorCode, message){11 try {12 var imageName = "error.gif";13 var errorName = "";14 if (errorCode === SWFUpload.errorCode_QUEUE_LIMIT_EXCEEDED) {15 errorName = "你添加的文件超过了限制!";16 }17 if (errorName !== "") {18 alert(errorName);19 return;20 }21 switch (errorCode) {22 case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:23 imageName = "zerobyte.gif";24 break;25 case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:26 imageName = "toobig.gif";27 break;28 case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:29 case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:30 default:31 alert(message);32 break;33 }34 addImage("images/" + imageName, 0);35 } catch (ex) {36 this.debug(ex);37 }38}39function fileDialogComplete(numFilesSelected, numFilesQueued) {40 try {41 if (numFilesQueued > 0) {42 this.startUpload();43 }44 } catch (ex) {45 this.debug(ex);46 }47}48function uploadProgress(file, bytesLoaded) {49 try {50 var percent = Math.ceil((bytesLoaded / file.size) * 100);51 var progress = new FileProgress(file, this.customSettings.upload_target);52 progress.setProgress(percent);53 if (percent === 100) {54 progress.setStatus("创建缩略图...");55 progress.toggleCancel(false, this);56 } else {57 progress.setStatus("上传中...");58 progress.toggleCancel(true, this);59 }60 } catch (ex) {61 this.debug(ex);62 }63}64function uploadSuccess(file, serverData) {65 try {66 var progress = new FileProgress(file, this.customSettings.upload_target);67 if (serverData.substring(0, 7) === "FILEID:") {68 addImage("swfupload.php?dopost=thumbnail&id=" + serverData.substring(7), serverData.substring(7));69 progress.setStatus("获取缩略图...");70 progress.toggleCancel(false);71 } else {72 addImage("images/error.gif", 0);73 progress.setStatus("有错误!");74 progress.toggleCancel(false);75 alert(serverData);76 }77 } catch (ex) {78 this.debug(ex);79 }80}81function uploadComplete(file) {82 try {83 /* I want the next upload to continue automatically so I'll call startUpload here */84 if (this.getStats().files_queued > 0) {85 this.startUpload();86 } else {87 var progress = new FileProgress(file, this.customSettings.upload_target);88 progress.setComplete();89 progress.setStatus("所有图片上传完成...");90 progress.toggleCancel(false);91 }92 } catch (ex) {93 this.debug(ex);94 }95}96function uploadError(file, errorCode, message) {97 var imageName = "error.gif";98 var progress;99 try {100 switch (errorCode) {101 case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:102 try {103 progress = new FileProgress(file, this.customSettings.upload_target);104 progress.setCancelled();105 progress.setStatus("Cancelled");106 progress.toggleCancel(false);107 }108 catch (ex1) {109 this.debug(ex1);110 }111 break;112 case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:113 try {114 progress = new FileProgress(file, this.customSettings.upload_target);115 progress.setCancelled();116 progress.setStatus("Stopped");117 progress.toggleCancel(true);118 }119 catch (ex2) {120 this.debug(ex2);121 }122 case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:123 imageName = "uploadlimit.gif";124 break;125 default:126 alert(message);127 break;128 }129 addImage("images/" + imageName, 0);130 } catch (ex3) {131 this.debug(ex3);132 }133}134var albImg = 0;135function addImage(src, pid){136 var newImgDiv = document.createElement("div");137 var delstr = '';138 var iptwidth = 190;139 albImg++;140 if(pid != 0) {141 albImg = 'ok' + pid;142 delstr = '<a href="javascript:delAlbPic('+pid+')">[删除]</a>';143 } else {144 albImg = 'err' + albImg;145 }146 newImgDiv.className = 'albCt';147 newImgDiv.id = 'albCt'+albImg;148 document.getElementById("thumbnails").appendChild(newImgDiv);149 newImgDiv.innerHTML = '<img src="'+src+'" width="120" />'+delstr;150 if(typeof arctype != 'undefined' && arctype == 'article' )151 { 152 iptwidth = 100;153 if(pid != 0) {154 newImgDiv.innerHTML = '<img src="'+src+'" width="120" onClick="addtoEdit('+pid+')"/>'+delstr;155 }156 }157 newImgDiv.innerHTML += '<div style="margin-top:10px">注释:<input type="text" name="picinfo'+albImg+'" value="" style="width:'+iptwidth+'px;" /></div>';158}159/* ******************************************160 * FileProgress Object161 * Control object for displaying file info162 * ****************************************** */163function FileProgress(file, targetID) {164 this.fileProgressID = "divFileProgress";165 this.fileProgressWrapper = document.getElementById(this.fileProgressID);166 if (!this.fileProgressWrapper) {167 this.fileProgressWrapper = document.createElement("div");168 this.fileProgressWrapper.className = "progressWrapper";169 this.fileProgressWrapper.id = this.fileProgressID;170 this.fileProgressElement = document.createElement("div");171 this.fileProgressElement.className = "progressContainer";172 var progressCancel = document.createElement("a");173 progressCancel.className = "progressCancel";174 progressCancel.href = "#";175 progressCancel.style.visibility = "hidden";176 progressCancel.appendChild(document.createTextNode(" "));177 var progressText = document.createElement("div");178 progressText.className = "progressName";179 progressText.appendChild(document.createTextNode(file.name));180 var progressBar = document.createElement("div");181 progressBar.className = "progressBarInProgress";182 var progressStatus = document.createElement("div");183 progressStatus.className = "progressBarStatus";184 progressStatus.innerHTML = "&nbsp;";185 this.fileProgressElement.appendChild(progressCancel);186 this.fileProgressElement.appendChild(progressText);187 this.fileProgressElement.appendChild(progressStatus);188 this.fileProgressElement.appendChild(progressBar);189 this.fileProgressWrapper.appendChild(this.fileProgressElement);190 document.getElementById(targetID).appendChild(this.fileProgressWrapper);191 } else {192 this.fileProgressElement = this.fileProgressWrapper.firstChild;193 this.fileProgressElement.childNodes[1].firstChild.nodeValue = file.name;194 }195 this.height = this.fileProgressWrapper.offsetHeight;196}197FileProgress.prototype.setProgress = function (percentage) {198 this.fileProgressElement.className = "progressContainer blue";199 this.fileProgressElement.childNodes[3].className = "progressBarInProgress";200 this.fileProgressElement.childNodes[3].style.width = percentage + "%";201};202FileProgress.prototype.setComplete = function () {203 this.fileProgressElement.className = "progressContainer green";204 this.fileProgressElement.childNodes[3].className = "progressBarComplete";205 this.fileProgressElement.childNodes[3].style.width = "";206};207FileProgress.prototype.setError = function () {208 this.fileProgressElement.className = "progressContainer red";209 this.fileProgressElement.childNodes[3].className = "progressBarError";210 this.fileProgressElement.childNodes[3].style.width = "";211};212FileProgress.prototype.setCancelled = function () {213 this.fileProgressElement.className = "progressContainer";214 this.fileProgressElement.childNodes[3].className = "progressBarError";215 this.fileProgressElement.childNodes[3].style.width = "";216};217FileProgress.prototype.setStatus = function (status) {218 this.fileProgressElement.childNodes[2].innerHTML = status;219};220FileProgress.prototype.toggleCancel = function (show, swfuploadInstance) {221 this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";222 if (swfuploadInstance) {223 var fileID = this.fileProgressID;224 this.fileProgressElement.childNodes[0].onclick = function () {225 swfuploadInstance.cancelUpload(fileID);226 return false;227 };228 }...

Full Screen

Full Screen

ProgressBar.js

Source:ProgressBar.js Github

copy

Full Screen

1import React, { Component } from 'react';2import { Card, CardBody, CardHeader, Progress } from 'reactstrap';3class ProgressBar extends Component {4 render() {5 return (6 <div className="animated fadeIn">7 <Card>8 <CardHeader>9 <i className="fa fa-align-justify"></i><strong>Progress</strong>10 <div className="card-header-actions">11 <a href="https://reactstrap.github.io/components/progress/" rel="noreferrer noopener" target="_blank" className="card-header-action">12 <small className="text-muted">docs</small>13 </a>14 </div>15 </CardHeader>16 <CardBody>17 <div className="text-center">0%</div>18 <Progress />19 <div className="text-center">25%</div>20 <Progress value="25" />21 <div className="text-center">50%</div>22 <Progress value={50} />23 <div className="text-center">75%</div>24 <Progress value={75} />25 <div className="text-center">100%</div>26 <Progress value="100" />27 <div className="text-center">Multiple bars</div>28 <Progress multi>29 <Progress bar value="15" />30 <Progress bar color="success" value="30" />31 <Progress bar color="info" value="25" />32 <Progress bar color="warning" value="20" />33 <Progress bar color="danger" value="5" />34 </Progress>35 </CardBody>36 </Card>37 <Card>38 <CardHeader>39 <i className="fa fa-align-justify"></i><strong>Progress</strong>40 <small> color variants</small>41 </CardHeader>42 <CardBody>43 <Progress value={2 * 5} className="mb-3" />44 <Progress color="success" value="25" className="mb-3" />45 <Progress color="info" value={50} className="mb-3" />46 <Progress color="warning" value={75} className="mb-3" />47 <Progress color="danger" value="100" className="mb-3" />48 </CardBody>49 </Card>50 <Card>51 <CardHeader>52 <i className="fa fa-align-justify"></i><strong>Progress</strong>53 <small> labels</small>54 </CardHeader>55 <CardBody>56 <Progress value="25" className="mb-3">25%</Progress>57 <Progress value={50} className="mb-3">1/2</Progress>58 <Progress value={75} className="mb-3">You're almost there!</Progress>59 <Progress color="success" value="100" className="mb-3">You did it!</Progress>60 <Progress multi className="mb-3">61 <Progress bar value="15">Meh</Progress>62 <Progress bar color="success" value="30">Wow!</Progress>63 <Progress bar color="info" value="25">Cool</Progress>64 <Progress bar color="warning" value="20">20%</Progress>65 <Progress bar color="danger" value="5">!!</Progress>66 </Progress>67 </CardBody>68 </Card>69 <Card>70 <CardHeader>71 <i className="fa fa-align-justify"></i><strong>Progress</strong>72 <small> striped</small>73 </CardHeader>74 <CardBody>75 <Progress striped value={2 * 5} className="mb-3" />76 <Progress striped color="success" value="25" className="mb-3" />77 <Progress striped color="info" value={50} className="mb-3" />78 <Progress striped color="warning" value={75} className="mb-3" />79 <Progress striped color="danger" value="100" className="mb-3" />80 <Progress multi className="mb-3">81 <Progress striped bar value="10" />82 <Progress striped bar color="success" value="30" />83 <Progress striped bar color="warning" value="20" />84 <Progress striped bar color="danger" value="20" />85 </Progress>86 </CardBody>87 </Card>88 <Card>89 <CardHeader>90 <i className="fa fa-align-justify"></i><strong>Progress</strong>91 <small> animated</small>92 </CardHeader>93 <CardBody>94 <Progress animated value={2 * 5} className="mb-3" />95 <Progress animated color="success" value="25" className="mb-3" />96 <Progress animated color="info" value={50} className="mb-3" />97 <Progress animated color="warning" value={75} className="mb-3" />98 <Progress animated color="danger" value="100" className="mb-3" />99 <Progress multi>100 <Progress animated bar value="10" />101 <Progress animated bar color="success" value="30" />102 <Progress animated bar color="warning" value="20" />103 <Progress animated bar color="danger" value="20" />104 </Progress>105 </CardBody>106 </Card>107 <Card>108 <CardHeader>109 <i className="fa fa-align-justify"></i><strong>Progress</strong>110 <small> multiple bars / stacked</small>111 </CardHeader>112 <CardBody>113 <div className="text-center">Plain</div>114 <Progress multi>115 <Progress bar value="15" />116 <Progress bar color="success" value="20" />117 <Progress bar color="info" value="25" />118 <Progress bar color="warning" value="20" />119 <Progress bar color="danger" value="15" />120 </Progress>121 <div className="text-center">With Labels</div>122 <Progress multi>123 <Progress bar value="15">Meh</Progress>124 <Progress bar color="success" value="35">Wow!</Progress>125 <Progress bar color="warning" value="25">25%</Progress>126 <Progress bar color="danger" value="25">LOOK OUT!!</Progress>127 </Progress>128 <div className="text-center">Stripes and Animations</div>129 <Progress multi>130 <Progress bar striped value="15">Stripes</Progress>131 <Progress bar animated color="success" value="30">Animated Stripes</Progress>132 <Progress bar color="info" value="25">Plain</Progress>133 </Progress>134 </CardBody>135 </Card>136 <Card>137 <CardHeader>138 <i className="fa fa-align-justify"></i><strong>Progress</strong>139 <small> max value</small>140 </CardHeader>141 <CardBody>142 <div className="text-center">1 of 5</div>143 <Progress value="1" max="5" />144 <div className="text-center">50 of 135</div>145 <Progress value={50} max="135" />146 <div className="text-center">75 of 111</div>147 <Progress value={75} max={111} />148 <div className="text-center">463 of 500</div>149 <Progress value="463" max={500} />150 <div className="text-center">Various (40) of 55</div>151 <Progress multi>152 <Progress bar value="5" max={55}>5</Progress>153 <Progress bar color="success" value="15" max={55}>15</Progress>154 <Progress bar color="warning" value="10" max={55}>10</Progress>155 <Progress bar color="danger" value="10" max={55}>10</Progress>156 </Progress>157 </CardBody>158 </Card>159 </div>160 );161 }162}...

Full Screen

Full Screen

fileprogress.js

Source:fileprogress.js Github

copy

Full Screen

1/*2 A simple class for displaying file information and progress3 Note: This is a demonstration only and not part of SWFUpload.4 Note: Some have had problems adapting this class in IE7. It may not be suitable for your application.5*/6function FileProgress(file, targetID) {7 this.fileProgressID = file.id;8 this.opacity = 100;9 this.height = 0;10 this.fileProgressWrapper = document.getElementById(this.fileProgressID);11 if (!this.fileProgressWrapper) {12 this.fileProgressWrapper = document.createElement("div");13 this.fileProgressWrapper.className = "progressWrapper";14 this.fileProgressWrapper.id = this.fileProgressID;15 this.fileProgressElement = document.createElement("div");16 this.fileProgressElement.className = "progressContainer";17 var progressCancel = document.createElement("a");18 progressCancel.className = "progressCancel";19 progressCancel.href = "#";20 progressCancel.style.visibility = "hidden";21 progressCancel.appendChild(document.createTextNode(" "));22 var progressText = document.createElement("div");23 progressText.className = "progressName";24 progressText.appendChild(document.createTextNode(file.name));25 var progressBar = document.createElement("div");26 progressBar.className = "progressBarInProgress";27 var progressStatus = document.createElement("div");28 progressStatus.className = "progressBarStatus";29 progressStatus.innerHTML = "&nbsp;";30 this.fileProgressElement.appendChild(progressCancel);31 this.fileProgressElement.appendChild(progressText);32 this.fileProgressElement.appendChild(progressStatus);33 this.fileProgressElement.appendChild(progressBar);34 this.fileProgressWrapper.appendChild(this.fileProgressElement);35 document.getElementById(targetID).appendChild(this.fileProgressWrapper);36 } else {37 this.fileProgressElement = this.fileProgressWrapper.firstChild;38 this.reset();39 }40 this.height = this.fileProgressWrapper.offsetHeight;41 this.setTimer(null);42}43FileProgress.prototype.setTimer = function (timer) {44 this.fileProgressElement["FP_TIMER"] = timer;45};46FileProgress.prototype.getTimer = function (timer) {47 return this.fileProgressElement["FP_TIMER"] || null;48};49FileProgress.prototype.reset = function () {50 this.fileProgressElement.className = "progressContainer";51 this.fileProgressElement.childNodes[2].innerHTML = "&nbsp;";52 this.fileProgressElement.childNodes[2].className = "progressBarStatus";53 this.fileProgressElement.childNodes[3].className = "progressBarInProgress";54 this.fileProgressElement.childNodes[3].style.width = "0%";55 this.appear();56};57FileProgress.prototype.setProgress = function (percentage) {58 this.fileProgressElement.className = "progressContainer green";59 this.fileProgressElement.childNodes[3].className = "progressBarInProgress";60 this.fileProgressElement.childNodes[3].style.width = percentage + "%";61 this.appear();62};63FileProgress.prototype.setComplete = function () {64 this.fileProgressElement.className = "progressContainer blue";65 this.fileProgressElement.childNodes[3].className = "progressBarComplete";66 this.fileProgressElement.childNodes[3].style.width = "";67};68FileProgress.prototype.setError = function () {69 this.fileProgressElement.className = "progressContainer red";70 this.fileProgressElement.childNodes[3].className = "progressBarError";71 this.fileProgressElement.childNodes[3].style.width = "";72 var oSelf = this;73 this.setTimer(setTimeout(function () {74 oSelf.disappear();75 }, 5000));76};77FileProgress.prototype.setCancelled = function () {78 this.fileProgressElement.className = "progressContainer";79 this.fileProgressElement.childNodes[3].className = "progressBarError";80 this.fileProgressElement.childNodes[3].style.width = "";81 var oSelf = this;82 this.setTimer(setTimeout(function () {83 oSelf.disappear();84 }, 2000));85};86FileProgress.prototype.setStatus = function (status) {87 this.fileProgressElement.childNodes[2].innerHTML = status;88};89FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {90 this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";91 if (swfUploadInstance) {92 var fileID = this.fileProgressID;93 this.fileProgressElement.childNodes[0].onclick = function () {94 swfUploadInstance.cancelUpload(fileID);95 return false;96 };97 }98};99FileProgress.prototype.appear = function () {100 if (this.getTimer() !== null) {101 clearTimeout(this.getTimer());102 this.setTimer(null);103 }104 if (this.fileProgressWrapper.filters) {105 try {106 this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = 100;107 } catch (e) {108 this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=100)";109 }110 } else {111 this.fileProgressWrapper.style.opacity = 1;112 }113 this.fileProgressWrapper.style.height = "";114 this.height = this.fileProgressWrapper.offsetHeight;115 this.opacity = 100;116 this.fileProgressWrapper.style.display = "";117};118FileProgress.prototype.disappear = function () {119 var reduceOpacityBy = 15;120 var reduceHeightBy = 4;121 var rate = 30; // 15 fps122 if (this.opacity > 0) {123 this.opacity -= reduceOpacityBy;124 if (this.opacity < 0) {125 this.opacity = 0;126 }127 if (this.fileProgressWrapper.filters) {128 try {129 this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;130 } catch (e) {131 this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";132 }133 } else {134 this.fileProgressWrapper.style.opacity = this.opacity / 100;135 }136 }137 if (this.height > 0) {138 this.height -= reduceHeightBy;139 if (this.height < 0) {140 this.height = 0;141 }142 this.fileProgressWrapper.style.height = this.height + "px";143 }144 if (this.height > 0 || this.opacity > 0) {145 var oSelf = this;146 this.setTimer(setTimeout(function () {147 oSelf.disappear();148 }, rate));149 } else {150 this.fileProgressWrapper.style.display = "none";151 this.setTimer(null);152 }...

Full Screen

Full Screen

progress.spec.js

Source:progress.spec.js Github

copy

Full Screen

1describe('progress events', function () {2 beforeEach(function () {3 jasmine.Ajax.install();4 });5 afterEach(function () {6 jasmine.Ajax.uninstall();7 });8 it('should add a download progress handler', function (done) {9 var progressSpy = jasmine.createSpy('progress');10 axios('/foo', { onDownloadProgress: progressSpy } );11 getAjaxRequest().then(function (request) {12 request.respondWith({13 status: 200,14 responseText: '{"foo": "bar"}'15 });16 expect(progressSpy).toHaveBeenCalled();17 done();18 });19 });20 it('should add a upload progress handler', function (done) {21 var progressSpy = jasmine.createSpy('progress');22 axios('/foo', { onUploadProgress: progressSpy } );23 getAjaxRequest().then(function (request) {24 // Jasmine AJAX doesn't trigger upload events. Waiting for upstream fix25 // expect(progressSpy).toHaveBeenCalled();26 done();27 });28 });29 it('should add both upload and download progress handlers', function (done) {30 var downloadProgressSpy = jasmine.createSpy('downloadProgress');31 var uploadProgressSpy = jasmine.createSpy('uploadProgress');32 axios('/foo', { onDownloadProgress: downloadProgressSpy, onUploadProgress: uploadProgressSpy });33 getAjaxRequest().then(function (request) {34 // expect(uploadProgressSpy).toHaveBeenCalled();35 expect(downloadProgressSpy).not.toHaveBeenCalled();36 request.respondWith({37 status: 200,38 responseText: '{"foo": "bar"}'39 });40 expect(downloadProgressSpy).toHaveBeenCalled();41 done();42 });43 });44 it('should add a download progress handler from instance config', function (done) {45 var progressSpy = jasmine.createSpy('progress');46 var instance = axios.create({47 onDownloadProgress: progressSpy,48 });49 instance.get('/foo');50 getAjaxRequest().then(function (request) {51 request.respondWith({52 status: 200,53 responseText: '{"foo": "bar"}'54 });55 expect(progressSpy).toHaveBeenCalled();56 done();57 });58 });59 it('should add a upload progress handler from instance config', function (done) {60 var progressSpy = jasmine.createSpy('progress');61 var instance = axios.create({62 onUploadProgress: progressSpy,63 });64 instance.get('/foo');65 getAjaxRequest().then(function (request) {66 // expect(progressSpy).toHaveBeenCalled();67 done();68 });69 });70 it('should add upload and download progress handlers from instance config', function (done) {71 var downloadProgressSpy = jasmine.createSpy('downloadProgress');72 var uploadProgressSpy = jasmine.createSpy('uploadProgress');73 var instance = axios.create({74 onDownloadProgress: downloadProgressSpy,75 onUploadProgress: uploadProgressSpy,76 });77 instance.get('/foo');78 getAjaxRequest().then(function (request) {79 // expect(uploadProgressSpy).toHaveBeenCalled();80 expect(downloadProgressSpy).not.toHaveBeenCalled();81 request.respondWith({82 status: 200,83 responseText: '{"foo": "bar"}'84 });85 expect(downloadProgressSpy).toHaveBeenCalled();86 done();87 });88 });...

Full Screen

Full Screen

Progressable.js

Source:Progressable.js Github

copy

Full Screen

1/**2 * A Traversable mixin.3 * @private4 */5Ext.define('Ext.mixin.Progressable', {6 extend: 'Ext.mixin.Mixin',7 isProgressable: true,8 mixinConfig: {9 id: 'progressable'10 },11 config: {12 /**13 * @cfg {Number} minProgressInput14 * Minimum input value for this indicator15 */16 minProgressInput: 0,17 /**18 * @cfg {Number} maxProgressInput19 * Maximum input value for this indicator20 */21 maxProgressInput: 1,22 /**23 * @cfg {Number} minProgressOutput24 * Minimum output value for this indicator25 */26 minProgressOutput: 0,27 /**28 * @cfg {Number} maxProgressOutput29 * Maximum output value for this indicator30 */31 maxProgressOutput: 100,32 /**33 * @cfg {Boolean} dynamic34 *35 * When false this indicator will only receive progressStart and progressEnd commands, no progressUpdate commands will be sent.36 *37 */38 dynamic: true,39 /**40 * @cfg {String} state41 *42 * Current state of the progressIndicator. Should be used for switching progress states like download to upload.43 */44 state: null45 },46 // @private47 _progressActive: false,48 _progress: 0,49 _rawProgress: 0,50 onStartProgress: Ext.emptyFn,51 onUpdateProgress: Ext.emptyFn,52 onEndProgress: Ext.emptyFn,53 startProgress: function() {54 if (!this._progressActive) {55 this._progressActive = true;56 this.onStartProgress();57 this.updateProgress(this.getMinProgressInput());58 }59 },60 updateProgress: function(value, state) {61 if(state && state != this.getState()) this.setState(state);62 if(value > this.getMaxProgressInput()) value = this.getMaxProgressInput();63 if(value < this.getMinProgressInput()) value = this.getMinProgressInput();64 var mappedValue = this.mapValues(value, this.getMinProgressInput(), this.getMaxProgressInput(), this.getMinProgressOutput(), this.getMaxProgressOutput());65 this._progress = mappedValue;66 this._rawProgress = value;67 if(this.getDynamic()) {68 this.onUpdateProgress(mappedValue);69 }70 },71 endProgress: function() {72 if (this._progressActive) {73 this._progressActive = false;74 this.updateProgress(this.getMaxProgressInput());75 this.onEndProgress()76 }77 },78 mapValues: function(value, inputMin, inputMax, outputMin, outputMax) {79 return (value - inputMin) / (inputMax - inputMin) * (outputMax - outputMin) + outputMin;80 },81 setProgress: function(value) {82 this.updateProgress(value);83 },84 getProgress: function() {85 return this._progress86 },87 getRawProgress: function() {88 return this._rawProgress;89 }...

Full Screen

Full Screen

u-easings.js

Source:u-easings.js Github

copy

Full Screen

1u.easings = new function() {2 this["ease-in"] = function(progress) {3 return Math.pow((progress), 3);4 }5 this["linear"] = function(progress) {6 return progress;7 }8 this["ease-out"] = function(progress) {9 return 1 - Math.pow(1 - ((progress)), 3);10 }11 this["linear"] = function(progress) {12 return (progress);13 }14 this["ease-in-out-veryslow"] = function(progress) {15 if(progress > 0.5) {16 return 4*Math.pow((progress-1),3)+1;17 }18 return 4*Math.pow(progress,3); 19 }20 this["ease-in-out"] = function(progress) {21 if(progress > 0.5) {22 return 1 - Math.pow(1 - ((progress)), 2);23 }24 return Math.pow((progress), 2);25 }26 this["ease-out-slow"] = function(progress) {27 return 1 - Math.pow(1 - ((progress)), 2);28 }29 30 this["ease-in-slow"] = function(progress) {31 return Math.pow((progress), 2);32 }33 this["ease-in-veryslow"] = function(progress) {34 return Math.pow((progress), 1.5);35 }36 this["ease-in-fast"] = function(progress) {37 return Math.pow((progress), 4);38 }39 40 41 this["easeOutQuad"] = function (progress) {42 d = 1;43 b = 0;44 c = progress;45 t = progress;46 t /= d;47 return -c * t*(t-2) + b;48 };49 this["easeOutCubic"] = function (progress) {50 d = 1;51 b = 0;52 c = progress;53 t = progress;54 t /= d;55 t--;56 return c*(t*t*t + 1) + b;57 };58 this["easeOutQuint"] = function (progress) {59 d = 1;60 b = 0;61 c = progress;62 t = progress;63 t /= d;64 t--;65 return c*(t*t*t*t*t + 1) + b;66 };67 68 this["easeInOutSine"] = function (progress) {69 d = 1;70 b = 0;71 c = progress;72 t = progress;73 return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;74 };75 76 this["easeInOutElastic"] = function (progress) {77 d = 1;78 b = 0;79 c = progress;80 t = progress;81 var s=1.70158;var p=0;var a=c;82 if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);83 if (a < Math.abs(c)) { a=c; var s=p/4; }84 else var s = p/(2*Math.PI) * Math.asin (c/a);85 if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;86 return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;87 }88 89 this["easeOutBounce"] = function (progress) {90 d = 1;91 b = 0;92 c = progress;93 t = progress;94 if ((t/=d) < (1/2.75)) {95 return c*(7.5625*t*t) + b;96 } else if (t < (2/2.75)) {97 return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;98 } else if (t < (2.5/2.75)) {99 return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;100 } else {101 return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;102 }103 }104 this["easeInBack"] = function (progress) {105 var s = 1.70158;106 d = 1;107 b = 0;108 c = progress;109 t = progress;110 111 // if (s == undefined) s = 1.70158;112 return c*(t/=d)*t*((s+1)*t - s) + b;113 }...

Full Screen

Full Screen

Progress.stories.js

Source:Progress.stories.js Github

copy

Full Screen

1import React from 'react'2import {storiesOf} from '@storybook/react'3import {Progress} from './'4storiesOf('Progress/', module).add('Progress empty', () => (5 <Progress width={'600px'} FOOBAR></Progress>6))7storiesOf('Progress/', module).add('Progress 0', () => (8 <Progress width={'600px'} FOOBAR>9 <Progress.Bar value={0} max={10} />10 </Progress>11))12storiesOf('Progress/', module).add('Progress full', () => (13 <Progress width={'600px'} FOOBAR>14 <Progress.Bar value={10} max={10} />15 </Progress>16))17storiesOf('Progress/', module).add('Progress Full success', () => (18 <Progress width={'600px'} FOOBAR>19 <Progress.Bar success value={10} max={10} />20 </Progress>21))22storiesOf('Progress/', module).add('Progress Full danger', () => (23 <Progress width={'600px'} FOOBAR>24 <Progress.Bar danger value={10} max={10} />25 </Progress>26))27storiesOf('Progress/', module).add('Progress mixed', () => (28 <Progress width={'600px'} FOOBAR>29 <Progress.Bar danger value={2.5} max={10} />30 <Progress.Bar success value={2.5} max={10} />31 <Progress.Bar value={2.5} max={10} />32 </Progress>...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2var stryker = require('stryker-parent');3var stryker = require('stryker-parent');4var stryker = require('stryker-parent');5var stryker = require('stryker-parent');6var stryker = require('stryker-parent');7var stryker = require('stryker-parent');8var stryker = require('stryker-parent');9var stryker = require('stryker-parent');10var stryker = require('stryker-parent');11var stryker = require('stryker-parent');12var stryker = require('stryker-parent');

Full Screen

Using AI Code Generation

copy

Full Screen

1var strykerParent = require('stryker-parent');2var progress = strykerParent.progress;3progress.report({current: 1, total: 3});4progress.report({current: 2, total: 3});5progress.report({current: 3, total: 3});6module.exports = function (config) {7 config.set({8 mochaOptions: {9 }10 });11}12var strykerParent = require('stryker-parent');13var log = strykerParent.log;14log('Hello world!');15var strykerParent = require('stryker-parent');16var debug = strykerParent.debug;17debug('Hello world!');18var strykerParent = require('stryker-parent');19var warn = strykerParent.warn;20warn('Hello world!');21var strykerParent = require('stryker-parent');22var error = strykerParent.error;23error('Hello world!');24var strykerParent = require('stryker-parent');25var fatal = strykerParent.fatal;26fatal('Hello world!');

Full Screen

Using AI Code Generation

copy

Full Screen

1var progress = require('stryker').progress;2progress(0.1);3progress(0.2);4progress(0.3);5progress(0.4);6progress(0.5);7progress(1);

Full Screen

Using AI Code Generation

copy

Full Screen

1var parent = require('stryker-parent');2parent.progress('test.js', 1, 100);3var parent = require('stryker-parent');4parent.log('test.js', 'This is a test message');5var parent = require('stryker-parent');6parent.error('test.js', 'This is a test error message');7var parent = require('stryker-parent');8parent.done('test.js');9var parent = require('stryker-parent');10parent.done('test.js', 1, 100);11var parent = require('stryker-parent');12parent.done('test.js', 1, 100, 'This is a test message');13var parent = require('stryker-parent');14parent.done('test.js', 1, 100, 'This is a test message', 'This is a test error message');15var parent = require('stryker-parent');16parent.done('test.js', 1, 100, 'This is a test message', 'This is a test error message', 'This is a test error stack');17var parent = require('stryker-parent');18parent.done('test.js', 1, 100, 'This is a test message', 'This is a test error message', 'This is a test error stack', 1, 100);19var parent = require('stryker-parent');20parent.done('test.js', 1, 100, 'This is a test message', 'This is a test error message', 'This is a test error stack', 1, 100, 'This is a test error stack');

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2stryker.progress('test');3var stryker = require('stryker-child');4module.exports = {5 progress: function (message) {6 stryker.progress(message);7 }8}9var stryker = require('stryker-child');10module.exports = {11 progress: function (message) {12 console.log(message);13 }14}15var stryker = require('stryker-child');16module.exports = {17 progress: function (message) {18 stryker.progress(message);19 }20}21var stryker = require('stryker-child');22module.exports = {23 progress: function (message) {24 console.log(message);25 }26}

Full Screen

Using AI Code Generation

copy

Full Screen

1var stryker = require('stryker-parent');2stryker.progress(10);3module.exports = {4 progress: function (progress) {5 console.log(progress);6 }7};8{9}10var stryker = require('stryker-parent');11stryker.progress(10);12module.exports = {13 progress: function (progress) {14 console.log(progress);15 }16};17{18}19{20 "dependencies": {21 }22}23var stryker = require('stryker-parent');24var path = require('path');25var strykerPath = path.dirname(require.resolve('stryker-parent'));

Full Screen

Using AI Code Generation

copy

Full Screen

1progress: function (progress) {2 process.send({3 });4},5process.on('message', function (msg) {6 if (msg.event === 'progress') {7 }8});9function updateProgress(progress) {10 process.send({11 });12}13process.on('message', function (msg) {14 if (msg.event === 'progress') {15 }16});

Full Screen

Using AI Code Generation

copy

Full Screen

1var parent = require('stryker-parent');2parent.progress(1, 2, 3, 4, 5);3module.exports = function(config) {4 config.set({5 });6};

Full Screen

Using AI Code Generation

copy

Full Screen

1const child = require('child_process');2const path = require('path');3const parent = require('stryker-parent');4const childPath = path.resolve(__dirname, './stryker-child.js');5const childProcess = child.fork(childPath, { stdio: 'inherit' });6const progress = parent.progress(childProcess);7progress.on('progress', (progress) => {8 console.log(progress);9});10progress.on('complete', (result) => {11 console.log(result);12});13const child = require('stryker-child');14child.runMutationTest().then((result) => {15 console.log(result);16});17const child = require('child_process');18const path = require('path');19const parent = require('stryker-parent');20const childPath = path.resolve(__dirname, './stryker-child.js');21const childProcess = child.fork(childPath, { stdio: 'inherit' });22const progress = parent.progress(childProcess);

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