How to use findFile method in Karma

Best JavaScript code snippet using karma

jsCommonFunction.js

Source:jsCommonFunction.js Github

copy

Full Screen

12function setCatIdfromDrowdown(setto, val)3{4 var objHdnCatCityId=document.getElementById(setto);5 //alert("Coming value : " + val + " Hidden obj: " + objHdnCatCityId);6 if(objHdnCatCityId!=null)7 {8 objHdnCatCityId.value="";9 objHdnCatCityId.value=val;10 //alert(objHdnCatCityId.value);11 }12 else13 {14 alert("Hidden field not found!");15 }16}17function setValToObj(setto, val)18{19 var objSetTo=document.getElementById(setto);20 //alert("Coming value : " + val + " obj: " + objSetTo);21 if(objSetTo!=null)22 {23 objSetTo.value="";24 objSetTo.value=val;25 // val.selectedIndex.options[val.selectedIndex].text;26 }27 else28 {29 alert("Hidden field not found!");30 }31}32function uncheckRadio(rad1, rad2)33{34 var radText=document.getElementById(rad1);35 var radHtml=document.getElementById(rad2);36 //alert("Existing " +radExisting + " New " + radNew );37 if(radText !=null)38 {39 radText.checked=false;40 }41 if(radHtml !=null)42 {43 radHtml.checked=false;44 }45 46}47function divVisibleInvisible(div1, div2, val)48{49 //alert(div1 + "," + div1 + "," + val);50 //If the value comes 1 : div2 to show div1 to hide51 //If the value comes 2 : div1 to show div2 to hide52 var dvObj1=document.getElementById(div1);53 var dvObj2=document.getElementById(div2);54 if(dvObj1!=null && dvObj2!=null)55 {56 if(val==1)57 {58 dvObj1.style.display="none";59 dvObj2.style.display="block";60 }61 else if(val==2)62 {63 dvObj1.style.display="block";64 dvObj2.style.display="none";65 }66 else67 {68 dvObj1.style.display="none";69 dvObj2.style.display="none"; 70 } 71 }72 else73 {74 alert("Object not found.");75 }76 77}78function clearAllRadio(formName)79{80 var theForm=document.getElementById(formName);81 var z = 0; 82 if(theForm!=null)83 {84 for(z=0; z<theForm.length;z++)85 { 86 if(theForm[z].type == 'radio')87 {88 theForm[z].checked = false;89 }90 }91 }92 else93 {94 alert("Object not found.");95 }96 97}98function setTodayDate(objName)99{100 var objCal=document.getElementById(objName); 101 var today=new Date(); 102 if(objCal!=null)103 { 104 //objCal.value=today.getMonth()+1+"/"+today.getDate()+"/"+(today.getFullYear()); 105 if(today.getMonth()<9)106 {107 108 if(today.getDate()<9)109 {110 objCal.value="0" + (today.getMonth()+1)+"/"+ "0" + (today.getDate())+"/"+(today.getFullYear()); 111 }112 else113 {114 objCal.value="0" + (today.getMonth()+1)+"/"+today.getDate()+"/"+(today.getFullYear()); 115 }116 }117 else118 {119 if(today.getDate()<9)120 {121 objCal.value=today.getMonth()+1+"/"+ "0" + (today.getDate())+"/"+(today.getFullYear());122 }123 else124 {125 objCal.value=today.getMonth()+1+"/"+today.getDate()+"/"+(today.getFullYear()); 126 }127 }128 }129}130function setDDtextToObj(setto, objDropDown)131{132 var objSetTo=document.getElementById(setto);133 //alert("set to : " + objSetTo + " obj: " + objDropDown);134 if(objSetTo!=null)135 {136 var varSelIndex=objDropDown.selectedIndex;137// objSetTo.value=objDropDown.options[varSelIndex].text;138 objSetTo.value=varSelIndex;139 alert(objSetTo.value);140 }141 else142 {143 alert("Hidden field not found!");144 }145}146function fnCartAdd(Mode,item_id)147{148if(Mode!="")149 { 150// alert("mode:"+Mode+"item_id:"+item_id);151 //alert("proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&Counter="+intcounter); 152 var spnbuy=document.getElementById("spnBuyBtn_"+item_id);153 var spnload=document.getElementById("spnload_"+item_id);154 // alert("btn: " + spnbuy + " ajax img: " + spnload);155 var xmlHttpReq_findfile = false;156 var self_findfile = this;157 if (window.XMLHttpRequest) 158 {159 self_findfile.xmlHttpReq_findfile = new XMLHttpRequest();160 }161 else if (window.ActiveXObject) 162 {163 self_findfile.xmlHttpReq_findfile = new ActiveXObject("Microsoft.XMLHTTP");164 }165// self_findfile.xmlHttpReq_findfile.open("POST", "frmAjaxCart.aspx", true);166 self_findfile.xmlHttpReq_findfile.open("POST", "ajaxupdate.aspx", true);167 168 self_findfile.xmlHttpReq_findfile.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");169// alert(self_findfile.xmlHttpReq_findfile.responseText);170 self_findfile.xmlHttpReq_findfile.onreadystatechange = function() 171 {172 if (self_findfile.xmlHttpReq_findfile.readyState == 4) 173 { 174 var ret= self_findfile.xmlHttpReq_findfile.responseText;175 if(ret.indexOf('~' != -1))176 {177 GetValue=ret.split("~");178 }179 // alert(GetValue[0].toString());180 181 if(GetValue[0].toString()!="")182 {183 if(GetValue[0].toString()=="1")184 {185 window.location="cart.aspx";186 }187 }188 189// alert(ret);190// if(ret=="t")191// {192//// spnbuy.style.display="block";193//// spnload.style.display="none";194// window.location="cart.aspx";195// }196 else197 {198 alert("Some problem in adding cart!!plz try again.....");199 }200 }201 if (self_findfile.xmlHttpReq_findfile.readyState < 4) 202 { 203 spnbuy.style.display="none";204 spnload.style.display="block";205 }206 }207 208// self_findfile.xmlHttpReq_findfile.send("proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random()); 209//self_findfile.xmlHttpReq_findfile.send("proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random()); 210 self_findfile.xmlHttpReq_findfile.send("item_id="+ item_id +"&mode="+Mode+"&randN="+Math.random()); 211 flag=true;212 }213}214function loaddetail()215 {216 var xmlHttpobj=ajaxFunction();217// alert(xmlHttpobj);218 if(xmlHttpobj != null)219 {220// alert(xmlHttpobj);221//document.getElemntById("reg").style.visibility = "hidden";222document.getElementById("reg").style.display="none";223// xmlHttpobj.open("POST","edit_reg.aspx",true);224 xmlHttpobj.open("GET","edit_reg.aspx",true);225 xmlHttpobj.send(null);226 }227 }228//function for add to cart from item page by subhro229function fnCartAddFrmItem(Mode,proID,catId)230{231if(Mode!="")232 { 233 234 //alert("proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random()); 235 236// var spnbuy=document.getElementById("spnBuyBtn_"+intcounter);237 var spnbuy=document.getElementById("spnBuyBtn");238 var qty=document.getElementById("hdnQty").value;239 240 var spnload=document.getElementById("spnload");241 var xmlHttpReq_findfile = false;242 var self_findfile = this;243 if (window.XMLHttpRequest) 244 {245 self_findfile.xmlHttpReq_findfile = new XMLHttpRequest();246 }247 else if (window.ActiveXObject) 248 {249 self_findfile.xmlHttpReq_findfile = new ActiveXObject("Microsoft.XMLHTTP");250 }251 self_findfile.xmlHttpReq_findfile.open("POST", "frmAjaxCart.aspx", true);252 self_findfile.xmlHttpReq_findfile.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");253 self_findfile.xmlHttpReq_findfile.onreadystatechange = function() 254 {255 if (self_findfile.xmlHttpReq_findfile.readyState == 4) 256 { 257 var ret= self_findfile.xmlHttpReq_findfile.responseText;258 if(ret=="t")259 {260 window.location="cart.aspx";261 }262 else263 {264 alert("Some problem in adding cart!!plz try again.....");265 }266 }267 if (self_findfile.xmlHttpReq_findfile.readyState < 4) 268 { 269 spnbuy.style.display="none";270 spnload.style.display="block";271 }272 }273 274 self_findfile.xmlHttpReq_findfile.send("qty="+ qty +"&proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random()); 275 flag=true;276 }277}...

Full Screen

Full Screen

ajax_ins_del.js

Source:ajax_ins_del.js Github

copy

Full Screen

1// JScript File2 function ins()3 {4 var name=document.getElementById("txtname").value;5 var address=document.getElementById("txtaddress").value;6 var spnbuy=document.getElementById("spnBuyBtn");7 var spnload=document.getElementById("spnload");8 //alert("btn: " + spnbuy + " ajax img: " + spnload);9 var xmlHttpReq_findfile = false;10 var self_findfile = this;11 if (window.XMLHttpRequest) 12 {13 self_findfile.xmlHttpReq_findfile = new XMLHttpRequest();14 }15 else if (window.ActiveXObject) 16 {17 self_findfile.xmlHttpReq_findfile = new ActiveXObject("Microsoft.XMLHTTP");18 }19 self_findfile.xmlHttpReq_findfile.open("POST", "frmAjaxCart.aspx", true);20 // self_findfile.xmlHttpReq_findfile.open("POST", "edit_reg.aspx", true);21 22 self_findfile.xmlHttpReq_findfile.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");23 self_findfile.xmlHttpReq_findfile.onreadystatechange = function() 24 {25 if (self_findfile.xmlHttpReq_findfile.readyState == 4) 26 { 27 var ret= self_findfile.xmlHttpReq_findfile.responseText;28// var t=ret.substring(0,ret.indexOf(" ");29 30 var GetValue=new Array();31 GetValue=ret.split('');32// alert(GetValue[0]);33 34 if(GetValue[0]=="t")35 {36 spnbuy.style.display="block";37 spnload.style.display="none";38// alert('data inserted successfully');39// LoadResponse(ret,"MainPlaceHolder");40}41 else42 {43 alert("Some problem in adding cart!!plz try again.....");44 }45 }46 if (self_findfile.xmlHttpReq_findfile.readyState < 4) 47 { 48 spnbuy.style.display="none";49 spnload.style.display="block";50 }51 }52 53 self_findfile.xmlHttpReq_findfile.send("name="+ name +"&address="+ address); 54//self_findfile.xmlHttpReq_findfile.send("proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random()); 55 flag=true;56 57 58 }59 60 function LoadResponse(response,control)61 {62 var container=document.getElementById(control);63 try64 {65 while(container.firstChild)66 container.removeChild(container.firstChild);67 var t=document.createElement('div');68 t.innerHTML=response;69 container.appendChild(t);70// document.getElementById("dvloadGV").style.display="none";71 }72 catch(ex)73 {74 container.innerHTML=response;75 }76 } 77 78 79 80 function deleteFromCart(recId, prodId)81{ 82 var objErrLabel=document.getElementById("lblError");83 var objMainDiv=document.getElementById("dvCart");84// alert(objErrLabel + " : " + objMainDiv);85 86 if(objErrLabel!=null && objMainDiv!=null)87 { 88 if(recId!=null && prodId!=null)89 {90 //alert(recId + " : " + prodId);91 var xmlHttpReq = false;92 var self = this;93 if (window.XMLHttpRequest) 94 {95 self.xmlHttpReq = new XMLHttpRequest(); 96 }97 else if (window.ActiveXObject) 98 {99 self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); 100 }101 self.xmlHttpReq.open('POST', "ajaxCartFunction.aspx", true); 102 self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');103 self.xmlHttpReq.onreadystatechange = function() 104 {105 if (self.xmlHttpReq.readyState == 4) 106 { 107 document.getElementById("dvAjaxPic").style.display="none";108 objMainDiv.style.display="block";109 var GetValue=new Array();110 if(self.xmlHttpReq.responseText.indexOf('~' != -1))111 {112 GetValue=self.xmlHttpReq.responseText.split("~");113 }114 if(GetValue[0].toString()!="")115 {116 if(GetValue[0].toString()=="0")117 {118 objErrLabel.innerHTML=GetValue[1].toString(); 119 objMainDiv.innerHTML="<ul><li><a href=\"index.aspx\"><img class=\"shoppingBtn\" src=\"images/continue_shopping_btn.gif\" /></a></li></ul>"; 120 }121 else122 {123 objMainDiv.innerHTML=GetValue[1].toString();;124 objErrLabel.innerHTML=""; 125 }126 }127 else128 {129 alert("Ajax return not found...");130 }131 }132 else133 {134 document.getElementById("dvAjaxPic").style.display="block";135 objMainDiv.style.display="none";136 }137 } 138 self.xmlHttpReq.send("mode=2&recId="+recId + "&prodId="+prodId); 139 }140 else141 {142 alert("Invalid parameter. Try again.");143 }144 }145 else146 {147 alert("Objects not found. Try again.");148 }149}150// JScript File151function del(id)152 {153// var objErrLabel=document.getElementById("lblError");154 var objMainDiv=document.getElementById("objMainDiv");155 //alert(objErrLabel + " : " + objMainDiv);156// alert(id);157 158 if(id!=null)159 {160 //alert(recId + " : " + prodId);161 var xmlHttpReq = false;162 var self = this;163 if (window.XMLHttpRequest) 164 {165 self.xmlHttpReq = new XMLHttpRequest(); 166 }167 else if (window.ActiveXObject) 168 {169 self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); 170 }171 self.xmlHttpReq.open('POST', "from_ajax_delete.aspx", true); 172 self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');173 self.xmlHttpReq.onreadystatechange = function() 174 {175 if (self.xmlHttpReq.readyState == 4) 176 { 177 document.getElementById("dvAjaxPic").style.display="none";178 objMainDiv.style.display="block";179 var GetValue=new Array();180 if(self.xmlHttpReq.responseText.indexOf('~' != -1))181 {182 GetValue=self.xmlHttpReq.responseText.split("~");183 }184 185 if(GetValue[0].toString()!="")186 {187 if(GetValue[0].toString()=="0")188 {189// objErrLabel.innerHTML=GetValue[1].toString(); 190 objMainDiv.innerHTML="<ul><li><a href=\"index.aspx\"><img class=\"shoppingBtn\" src=\"images/continue_shopping_btn.gif\" /></a></li></ul>"; 191 }192 else193 {194// alert(GetValue[1]);195// alert(GetValue[0]);196 document.getElementById("objMainDiv").style.display="block";197 objMainDiv.innerHTML=GetValue[1].toString();198// objErrLabel.innerHTML=""; 199 }200 }201 else202 {203 alert("Ajax return not found...");204 }205 }206 else207 {208 document.getElementById("dvAjaxPic").style.display="block";209 objMainDiv.style.display="none";210 }211 } 212// self.xmlHttpReq.send("mode=2&recId="+recId + "&prodId="+prodId); 213// alert(id);214 self.xmlHttpReq.send("mode=2&id="+id); 215// self.xmlHttpReq.send("id="+id); 216 }217 else218 {219 alert("Invalid parameter. Try again.");220 }221 222 223 224 ...

Full Screen

Full Screen

AJAXScript.js

Source:AJAXScript.js Github

copy

Full Screen

1// JScript File2var xmlHttp;3function ajaxFunction()4{5 //var xmlHttp;6 try7 {8 xmlHttp=new XMLHttpRequest();9 }10 catch(e)11 {12 //IE13 try14 {15 xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");16 }17 catch(e)18 {19 try20 {21 xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");22 }23 catch(e)24 {25 alert("Your browser doesnt support AJAX");26 return null;27 }28 }29 }30 xmlHttp.onreadystatechange=statechange;31 return xmlHttp;32}33function loadAll()34{35 var xmlHttpobj=ajaxFunction();36 if(xmlHttpobj != null)37 {38 xmlHttpobj.open("GET","NewPage.aspx?name=",true);39 xmlHttpobj.send(null);40 }41}42function getLoading()43{44 return "<div style='width:100%;height:300px;padding-top:150px'><center><img src='images/pleasewait.gif'/><br><font color='red'><b>Loading....</b></font></center></div>";45}46function statechange()47{48 if(xmlHttp.readyState==2)49 {50 51 document.getElementById("MainPlaceHolder").innerHTML="Loading...........";52// LoadResponse(getLoading(),"MainPlaceHolder");53 }54 else if(xmlHttp.readyState==4)55 {56 //alert(xmlHttp.responseXML);57// if(xmlHttp.status==200)58 LoadResponse(xmlHttp.responseText,"MainPlaceHolder");59// else60// alert("Error Occurred while Fetching Last Request. ErrorCode:" + xmlHttp.status);61 //document.getElementById("MainPlaceHolder").innerHTML=xmlHttp.responseText;62 }63 64}65function loadData()66{67 var xmlHttpobj=ajaxFunction();68 69 if(xmlHttpobj != null)70 {71 try{72 var params = "name=" + document.getElementById("ddllist").value;73 74// xmlHttpobj.setRequestHeader("Content-type","application/x-www-form-urlencoded");75// alert("1");76// xmlHttpobj.setRequestHeader("Content-length",params.length);77// alert("2");78// xmlHttpobj.setRequestHeader("Connection","close");79 80 //xmlHttpobj.open("POST","NewPage.aspx",true);81 xmlHttpobj.open("GET","NewPage.aspx?name=" + document.getElementById("ddllist").value,true);82 xmlHttpobj.send(null);83 }84 catch(e)85 {86 alert(e.toString());87 }88 }89 }90 91 function loaddetail()92 {93 var xmlHttpReq_findfile = false;94 var self_findfile = this;95 if (window.XMLHttpRequest) 96 {97 self_findfile.xmlHttpReq_findfile = new XMLHttpRequest();98 }99 else if (window.ActiveXObject) 100 {101 self_findfile.xmlHttpReq_findfile = new ActiveXObject("Microsoft.XMLHTTP");102 }103// self_findfile.xmlHttpReq_findfile.open("POST", "frmAjaxCart.aspx", true);104 self_findfile.xmlHttpReq_findfile.open("POST", "edit_reg.aspx", true);105 106 self_findfile.xmlHttpReq_findfile.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");107 self_findfile.xmlHttpReq_findfile.onreadystatechange = function() 108 {109 if (self_findfile.xmlHttpReq_findfile.readyState == 4) 110 { 111 112 LoadResponse(self_findfile.xmlHttpReq_findfile.responseText,"MainPlaceHolder");113 114// else115// {116// alert("Some problem in adding cart!!plz try again.....");117// }118 }119 if (self_findfile.xmlHttpReq_findfile.readyState < 4) 120 { 121// spnbuy.style.display="none";122// spnload.style.display="block";123document.getElementById("reg").style.display="none";124document.getElementById("MainPlaceHolder").innerHTML="Loading...........";125 }126 }127 128 129 130 131// self_findfile.send(null);132// alert(xmlHttpobj);133 134 135 136 137 138 var xmlHttpobj=ajaxFunction();139 if(xmlHttpobj != null)140 {141// alert(xmlHttpobj);142//document.getElemntById("reg").style.visibility = "hidden";143document.getElementById("reg").style.display="none";144 xmlHttpobj.open("POST","edit_reg.aspx",true);145 xmlHttpobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");146// xmlHttpobj.open("GET","edit_reg.aspx",true);147 xmlHttpobj.send(null);148 }149 }150 151 152 function ins()153 {154 var name=document.getElementById("txtname").value;155 var address=document.getElementById("txtaddress").value;156 var spnbuy=document.getElementById("spnBuyBtn");157 var spnload=document.getElementById("spnload");158 //alert("btn: " + spnbuy + " ajax img: " + spnload);159 var xmlHttpReq_findfile = false;160 var self_findfile = this;161 if (window.XMLHttpRequest) 162 {163 self_findfile.xmlHttpReq_findfile = new XMLHttpRequest();164 }165 else if (window.ActiveXObject) 166 {167 self_findfile.xmlHttpReq_findfile = new ActiveXObject("Microsoft.XMLHTTP");168 }169 self_findfile.xmlHttpReq_findfile.open("POST", "frmAjaxCart.aspx", true);170 // self_findfile.xmlHttpReq_findfile.open("POST", "edit_reg.aspx", true);171 172 self_findfile.xmlHttpReq_findfile.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");173 self_findfile.xmlHttpReq_findfile.onreadystatechange = function() 174 {175 if (self_findfile.xmlHttpReq_findfile.readyState == 4) 176 { 177 var ret= self_findfile.xmlHttpReq_findfile.responseText;178// var t=ret.substring(0,ret.indexOf(" ");179 180 var GetValue=new Array();181 GetValue=ret.split('');182 alert(GetValue[0]);183// if(self.xmlHttpReq.responseText.indexOf(' ' != -1))184// {185// GetValue=self.xmlHttpReq.responseText.split("");186// } 187// if(GetValue[0].toString()!="")188// {189// if(GetValue[0].toString()=="t")190// {191 192 193 194 if(GetValue[0]=="t")195 {196 spnbuy.style.display="block";197 spnload.style.display="none";198 alert('data inserted successfully');199 LoadResponse(ret,"MainPlaceHolder");200// window.location="reg.aspx";201 }202 203// if(ret==="t")204// {205//// alert(ret);206// spnbuy.style.display="block";207// spnload.style.display="none"; 208//// window.location="reg.aspx";209// }210 else211 {212 alert("Some problem in adding cart!!plz try again.....");213 }214 }215 if (self_findfile.xmlHttpReq_findfile.readyState < 4) 216 { 217 spnbuy.style.display="none";218 spnload.style.display="block";219 }220 }221 222 self_findfile.xmlHttpReq_findfile.send("name="+ name +"&address="+ address); 223//self_findfile.xmlHttpReq_findfile.send("proId="+ proID +"&catId="+ catId +"&mode="+Mode+"&randN="+Math.random()); 224 flag=true;225 226 227 }228 229 function LoadResponse(response,control)230 {231 var container=document.getElementById(control);232 try233 {234 while(container.firstChild)235 container.removeChild(container.firstChild);236 var t=document.createElement('div');237 t.innerHTML=response;238 container.appendChild(t);239 }240 catch(ex)241 {242 container.innerHTML=response;243 }244 } 245 ...

Full Screen

Full Screen

files.js

Source:files.js Github

copy

Full Screen

2module.exports = (state, { load = null, type }) => {3 let file4 switch (type) {5 case events.CHANGE_BROADCASTING_STATE:6 file = findFile(load.did, state.published.concat(state.purchased))7 if (file == null) { break }8 file.shouldBroadcast = load.shouldBroadcast9 file.status = file.status === events.CONNECTING ? events.AWAITING_DOWNLOAD : file.status10 break11 case events.CLOSE_AFS_EXPLORER:12 file = findFile(load.did, state.published.concat(state.purchased))13 if (file == null) { break }14 file.packageOpened = false15 break16 case events.DOWNLOADING:17 file = findFile(load.did, state.purchased)18 if (file == null) { break }19 file.downloadPercent = load.downloadPercent || 020 file.status = events.DOWNLOADING21 file.size = load.size || file.size22 break23 case events.DOWNLOADED:24 file = findFile(load.did, state.purchased)25 if (file == null) { break }26 file.name = load.name27 file.downloadPercent = 128 file.status = events.DOWNLOADED_PUBLISHED29 file.shouldBroadcast = true30 file.size = load.size || file.size31 break32 case events.DOWNLOAD_FAILED:33 file = findFile(load.did, state.purchased)34 if (file == null) { break }35 file.downloadPercent = 036 file.status = events.DOWNLOAD_FAILED37 break38 case events.ERROR_PUBLISHING:39 file = state.published[state.published.length - 1]40 file.status = load.oldStatus41 file.size = 042 break43 case events.ERROR_PURCHASING:44 state.purchased = state.purchased.slice(0, state.purchased.length - 1)45 break46 case events.FEED_CONTENT_VIEWER:47 file = findFile(load.did, state.published.concat(state.purchased))48 file.packageOpened = true49 break50 case events.LOADED_BACKGROUND_AFS_DATA:51 state.published = load.published52 state.purchased = load.purchased53 break54 case events.GOT_DL_PERC_AND_STATUS:55 file = findFile(load.did, state.published.concat(state.purchased))56 file.status = load.status57 file.downloadPercent = load.downloadPercent58 break59 case events.GOT_LIBRARY:60 state.loadingLibrary = false61 state.published = load.published62 state.purchased = load.purchased63 break64 case events.GOT_EARNING:65 file = findFile(load.did, state.published.concat(state.purchased))66 file.earnings += Number(load.earnings)67 break68 case events.GOT_META:69 file = findFile(load.did, state.published.concat(state.purchased))70 file.name = load.meta.title || null71 file.size = load.meta.size || 072 file.datePublished = load.meta.timestamp || null73 break74 case events.GOT_PRICE:75 file = findFile(load.did, state.published.concat(state.purchased))76 file.price = load.price77 break78 case events.GOT_REWARDS:79 file = findFile(load.did, state.published.concat(state.purchased))80 file.allocatedRewards = load.allocatedRewards81 break82 case events.GETTING_USER_DATA:83 state.loadingLibrary = true84 break85 case events.LOGOUT:86 case events.CLEAN_UI:87 state.published = []88 state.purchased = []89 state.loadingLibrary = false90 break91 case events.PAUSED:92 file = findFile(load.did, state.published.concat(state.purchased))93 file.status = events.PAUSED94 break95 case events.PUBLISHING:96 file = findFile(load.did, state.published)97 if (!file) state.published.push(load)98 break99 case events.PUBLISHED:100 file = findFile(load.did, state.published)101 if (file == null) { break }102 file.status = events.DOWNLOADED_PUBLISHED,103 file.datePublished = new Date104 file.shouldBroadcast = true105 file.owner = true106 break107 case events.PURCHASING:108 file = findFile(load.did, state.purchased)109 if (!file) state.purchased.push(load)110 break111 case events.PURCHASED:112 file = findFile(load.did, state.purchased)113 file.jobId = load.jobId114 file.status = events.AWAITING_DOWNLOAD115 break116 case events.PROXY_DEPLOYED:117 state.published.push(load.descriptor)118 break119 case events.UPDATE_AVAILABLE:120 file = findFile(load.did, state.purchased)121 if (file == null) { break }122 file.status = events.UPDATE_AVAILABLE123 break124 case events.UPDATING_FILE:125 file = findFile(load.did, state.published)126 if (file == null) { break }127 file.name = load.name128 file.price = load.price == null ? file.price : load.price129 file.size = load.size == 0 ? file.size : load.size130 file.status = events.UPDATING_FILE131 break132 case events.UPDATED_FILE:133 file = findFile(load.did, state.published)134 if (file == null) { break }135 file.status = events.DOWNLOADED_PUBLISHED136 break137 case events.UPDATE_EARNING:138 file = findFile(load.did, state.published)139 file.earnings += Number(load.earning)140 break141 case events.UPDATE_META:142 file = findFile(load.did, state.published)143 Object.assign(file, load)144 break145 case events.UPDATE_PEER_COUNT:146 file = findFile(load.did, state.published.concat(state.purchased))147 if (file == null) { break }148 file.peers = load.peers149 break150 case events.REDEEMING_REWARDS:151 file = findFile(load.did, state.published.concat(state.purchased))152 if (file == null) { break }153 file.redeeming = true154 break155 case events.REWARDS_ALLOCATED:156 file = findFile(load.did, state.published.concat(state.purchased))157 if (file == null) { break }158 file.allocatedRewards = load.rewardsBalance159 break160 case events.REWARDS_REDEEMED:161 file = findFile(load.did, state.published.concat(state.purchased))162 if (file == null) { break }163 file.allocatedRewards = 0164 file.earnings += Number(load.value)165 file.redeeming = false166 break167 case events.CONNECTING:168 file = findFile(load.did, state.purchased)169 if (file == null) { break }170 file.downloadPercent = 0171 file.status = events.CONNECTING172 break173 default:174 return state175 }176 return state177}178function findFile(did, files) {179 return files.find(file => file.did === did)...

Full Screen

Full Screen

ajax_script.js

Source:ajax_script.js Github

copy

Full Screen

1// JScript File2function del(id) 3{4var objMainDiv=document.getElementById("MainPlaceHolder");if(objMainDiv!=null) 5{ 6if(id!=null) 7{8var xmlHttpReq_Del = false;9var self = this;if (window.XMLHttpRequest) 10{11self.xmlHttpReq_Del = new XMLHttpRequest(); 12}13else if (window.ActiveXObject) 14{15self.xmlHttpReq_Del = new ActiveXObject("Microsoft.XMLHTTP"); 16}17self.xmlHttpReq_Del.open('POST', "from_ajax_delete.aspx", true); 18self.xmlHttpReq_Del.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 19 20self.xmlHttpReq_Del.onreadystatechange = function() 21{22if (self.xmlHttpReq_Del.readyState == 4) 23{ 24//alert(self.xmlHttpReq.responseText);25document.getElementById("dvAjaxPic").style.display="none";objMainDiv.style.display="block"; 26 27var GetValue=new Array();28if(self.xmlHttpReq_Del.responseText.indexOf('~' != -1)) 29{30GetValue=self.xmlHttpReq_Del.responseText.split("~"); 31} 32if(GetValue[0].toString()!="") 33{34if(GetValue[0].toString()=="0") 35{36 37}38else39{40objMainDiv.innerHTML=GetValue[2].toString();41}42}43else44{45alert("Ajax return not found..."); 46}47}48else49{50document.getElementById("dvAjaxPic").style.display="block";objMainDiv.style.display="none"; 51}52} 53self.xmlHttpReq_Del.send("mode=3&id="+id); 54}55else56{57alert("Invalid parameter. Try again."); 58}59}60else61{62alert("Objects not found. Try again."); 63}64}65 66function LoadResponse(response,control) 67{68var container=document.getElementById("dvTest"); 69try70{71while(container.firstChild) 72container.removeChild(container.firstChild);73var t=document.createElement('div'); 74t.innerHTML=response;75container.appendChild(t);76}77catch(ex) 78{79container.innerHTML=response;80}81} 82 83 84 85function loadGV() 86{87 88var xmlHttpReq = false; 89var self = this;90if (window.XMLHttpRequest) 91{92self.xmlHttpReq = new XMLHttpRequest(); 93}94else if (window.ActiveXObject) 95{96self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); 97}98self.xmlHttpReq.open('POST', "from_ajax_delete.aspx", true); 99self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');100self.xmlHttpReq.onreadystatechange = function() 101{102if (self.xmlHttpReq.readyState == 4) 103{104var GetValue=new Array(); if(self.xmlHttpReq.responseText.indexOf('~' != -1)) 105{106GetValue=self.xmlHttpReq.responseText.split("~"); 107}108if(GetValue[0].toString()!="") 109{110if(GetValue[0].toString()=="0") 111{112LoadResponse(GetValue[2],"MainPlaceHolder"); 113}114else115{116 117}118}119else120{121alert("Ajax return not found..."); 122}123}124else125{126}127} 128 129self.xmlHttpReq.send("m=2"); 130} 131 132function ins() 133{134var name=document.getElementById("txtname").value; 135var address=document.getElementById("txtaddress").value;136var spnbuy=document.getElementById("spnBuyBtn"); 137var spnload=document.getElementById("spnload");138//alert("btn: " + spnbuy + " ajax img: " + spnload);139var xmlHttpReq_findfile = false; 140var self_findfile = this;141if (window.XMLHttpRequest) 142{143self_findfile.xmlHttpReq_findfile = new XMLHttpRequest(); 144}145else if (window.ActiveXObject) 146{147self_findfile.xmlHttpReq_findfile = new ActiveXObject("Microsoft.XMLHTTP"); 148}149self_findfile.xmlHttpReq_findfile.open("POST", "frmAjaxCart.aspx", true); 150 151self_findfile.xmlHttpReq_findfile.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");self_findfile.xmlHttpReq_findfile.onreadystatechange = function() 152{153if (self_findfile.xmlHttpReq_findfile.readyState == 4) 154{ 155var ret= self_findfile.xmlHttpReq_findfile.responseText; 156 157var GetValue=new Array();158GetValue=ret.split('');159// alert(GetValue[0]);160// alert(GetValue[1]);161if(GetValue[0]=="t") 162{163spnbuy.style.display="block";spnload.style.display="none"; 164}165else166{167alert("Some problem in inserting!!plz try again....."); 168}169}170if (self_findfile.xmlHttpReq_findfile.readyState < 4) 171{ 172spnbuy.style.display="none";spnload.style.display="block"; 173}174}175 176self_findfile.xmlHttpReq_findfile.send("name="+ name +"&address="+ address); flag=true; 177 178 ...

Full Screen

Full Screen

findfile.test.js

Source:findfile.test.js Github

copy

Full Screen

1/*2 * findresult_test.js3 *4 * Some tests of findresult.js5 */6const {FileType} = require('../src/filetype');7const FindFile = require('../src/findfile').FindFile;8describe('testing findfile', () => {9 it('testFindFileAbsPath', () => {10 const pathname = `${process.env.HOME}/src/xfind/javascript/jsfind/src`;11 const filename = 'findfile.js';12 const findfile = new FindFile(pathname, filename, FileType.CODE);13 const expected = `${process.env.HOME}/src/xfind/javascript/jsfind/src/findfile.js`;14 expect(findfile.relativePath()).toEqual(expected);15 });16 it('testFindFileRelPath1', () => {17 const pathname = '.';18 const filename = 'findfile.js';19 const findfile = new FindFile(pathname, filename, FileType.CODE);20 const expected = './findfile.js';21 expect(findfile.relativePath()).toEqual(expected);22 });23 it('testFindFileRelPath2', () => {24 const pathname = './';25 const filename = 'findfile.js';26 const findfile = new FindFile(pathname, filename, FileType.CODE);27 const expected = './findfile.js';28 expect(findfile.relativePath()).toEqual(expected);29 });30 it('testFindFileRelPath3', () => {31 const pathname = '..';32 const filename = 'findfile.js';33 const findfile = new FindFile(pathname, filename, FileType.CODE);34 const expected = '../findfile.js';35 expect(findfile.relativePath()).toEqual(expected);36 });...

Full Screen

Full Screen

mergeDelFile.js

Source:mergeDelFile.js Github

copy

Full Screen

...12/*删除多余的文件*/13function delFile(outPath,configJson){1415 //获取原有的文件信息16 delSignFile(wake.findFile(outPath,true),configJson);17 // delSignFile(wake.findFile(outPath,"html",true),configJson);18 // delSignFile(wake.findFile(outPath,"js",true),configJson);19 // delSignFile(wake.findFile(outPath,"png",true),configJson);20 // delSignFile(wake.findFile(outPath,"jpg",true),configJson);21 // delSignFile(wake.findFile(outPath,"css",true),configJson);22 // delSignFile(wake.findFile(outPath,"gif",true),configJson);23 //24 // delSignFile(wake.findFile(outPath,"as",true),configJson);25 // delSignFile(wake.findFile(outPath,"fla",true),configJson);26 // delSignFile(wake.findFile(outPath,"swf",true),configJson);27 // delSignFile(wake.findFile(outPath,"msi",true),configJson);2829}3031exports = module.exports = function () {32 return this;33};3435/*解析文件中的代码*/ ...

Full Screen

Full Screen

rap.clear.file.js

Source:rap.clear.file.js Github

copy

Full Screen

...9}10/*删除多余的文件*/11function delFile(outPath,configJson){12 //获取原有的文件信息13 delSignFile(wake.findFile(outPath,true),configJson);14 // delSignFile(wake.findFile(outPath,"html",true),configJson);15 // delSignFile(wake.findFile(outPath,"js",true),configJson);16 // delSignFile(wake.findFile(outPath,"png",true),configJson);17 // delSignFile(wake.findFile(outPath,"jpg",true),configJson);18 // delSignFile(wake.findFile(outPath,"css",true),configJson);19 // delSignFile(wake.findFile(outPath,"gif",true),configJson);20 //21 // delSignFile(wake.findFile(outPath,"as",true),configJson);22 // delSignFile(wake.findFile(outPath,"fla",true),configJson);23 // delSignFile(wake.findFile(outPath,"swf",true),configJson);24 // delSignFile(wake.findFile(outPath,"msi",true),configJson);25}26exports = module.exports = function () {27 return this;28};29/*解析文件中的代码*/...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var file = window.__karma__.findFile('test.js');2var file = window.__karma__.findFile('/base/test.js');3var file = window.__karma__.findFile('/base/src/test.js');4var file = window.__karma__.findFile('src/test.js');5var file = window.__karma__.findFile('/src/test.js');6var file = window.__karma__.findFile('src/test.js');7var file = window.__karma__.findFile('src/test.js');8var file = window.__karma__.findFile('/src/test.js');9var file = window.__karma__.findFile('src/test.js');10var file = window.__karma__.findFile('/src/test.js');11var file = window.__karma__.findFile('src/test.js');12var file = window.__karma__.findFile('/src/test.js');

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('MyService', function() {2 var myService;3 beforeEach(function() {4 myService = new MyService();5 });6 it('should be able to read a file', function() {7 var file = myService.findFile('test.js');8 expect(file).not.toBeNull();9 });10});11function MyService() {12 this.findFile = function(fileName) {13 var filePath = Object.keys(__karma__.files).filter(function(file) {14 return file.indexOf(fileName) !== -1;15 })[0];16 return __karma__.files[filePath];17 };18}

Full Screen

Using AI Code Generation

copy

Full Screen

1var file = window.__karma__.findFile('path/to/file.js');2var file = window.__karma__.findFile(/\/path\/to\/file\.js$/);3var file = window.__karma__.findFile('test.js');4var file = window.__karma__.findFile(/\/test\.js$/);5var file = window.__karma__.findFile('path/to/file.js');6var file = window.__karma__.findFile(/\/path\/to\/file\.js$/);7var file = window.__karma__.findFile('path/to/file.js');8var file = window.__karma__.findFile(/\/path\/to\/file\.js$/);9var file = window.__karma__.findFile('path/to/file.js');10var file = window.__karma__.findFile(/\/path\/to\/file\.js$/);11var file = window.__karma__.findFile('path/to/file.js');12var file = window.__karma__.findFile(/\/path\/to\/file\.js$/);13var file = window.__karma__.findFile('path/to/file.js');14var file = window.__karma__.findFile(/\/path\/to\/file\.js$/);15var file = window.__karma__.findFile('path/to/file.js');16var file = window.__karma__.findFile(/\/path\/to\/file\.js$/);17var file = window.__karma__.findFile('path/to/file.js');18var file = window.__karma__.findFile(/\/path\/to\/file\.js$/);

Full Screen

Using AI Code Generation

copy

Full Screen

1var server = window.__karma__.server;2server.findFile('/base/path/to/file', function (file) {3});4var server = window.__karma__.server;5server.findFile(/\/base\/path\/to\/.*\.js$/, function (files) {6});

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