How to use getFiles method in Cypress

Best JavaScript code snippet using cypress

148919.user.js

Source:148919.user.js Github

copy

Full Screen

1// ==UserScript==2// @name           Zevera Auto Linker3// @namespace      Changes all Links to "Zevera Links". 4// @description    Changes all Links to "Zevera Links". 5// @include        *6// @exclude        http://google.com/*7// @exclude        http://rapidshare.com/*8// @exclude        http://zevera.com/*9// @exclude        http://*.zevera.com/*10// @By Havard, Updated by Harp V.13.011// ==/UserScript==1213//MODIFIED FOR ZEVERA1415/* Do not modify this unless you know what you're doing */16var lnk=document.evaluate("//a[@href]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);17var btn=document.evaluate("//input[@value]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 18var img=document.evaluate("//img", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);19var toReplace = /(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\^|\$)/g;20var modifyLink = new Links(); 21var modifyButton = new Buttons();22var modifyImage = new Images();2324modifyLink.byTarget ("2shared.com*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);25modifyLink.byTarget ("4shared.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);26modifyLink.byTarget ("asfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);27modifyLink.byTarget ("bayfiles.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);28modifyLink.byTarget ("bitshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);29modifyLink.byTarget ("cloudnator.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);30modifyLink.byTarget ("Cramit.in/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);31modifyLink.byTarget ("crocko.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);32modifyLink.byTarget ("easybytez.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);33modifyLink.byTarget ("extabit.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);34modifyLink.byTarget ("fiberupload.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);35modifyLink.byTarget ("fileape.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);36modifyLink.byTarget ("filebox.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);37modifyLink.byTarget ("filedino.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);38modifyLink.byTarget ("filedino.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);39modifyLink.byTarget ("fileduct.com*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);40modifyLink.byTarget ("filefactory.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);41modifyLink.byTarget ("filemates.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);42modifyLink.byTarget ("filemonster.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);43modifyLink.byTarget ("filepost.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);44modifyLink.byTarget ("filepost.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);45modifyLink.byTarget ("filereactor.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);46modifyLink.byTarget ("filerio.in/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);47modifyLink.byTarget ("fileserving.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);48modifyLink.byTarget ("filevelocity.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);49modifyLink.byTarget ("freakshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);50modifyLink.byTarget ("furk.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);51modifyLink.byTarget ("hotfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);52modifyLink.byTarget ("ifile.it/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);53modifyLink.byTarget ("jumbofiles.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);54modifyLink.byTarget ("letitbit.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);55modifyLink.byTarget ("lumfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);56modifyLink.byTarget ("mediafire.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);57modifyLink.byTarget ("megashare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);58modifyLink.byTarget ("megashares.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);59modifyLink.byTarget ("netload.in/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);60modifyLink.byTarget ("novafile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);61modifyLink.byTarget ("rapidgator.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);62//modifyLink.byTarget ("rapidshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);63modifyLink.byTarget ("rarefile.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);64modifyLink.byTarget ("ryushare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);65modifyLink.byTarget ("scribd.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);66modifyLink.byTarget ("sendspace.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);67modifyLink.byTarget ("share-online.biz*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);68modifyLink.byTarget ("sharpfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);69modifyLink.byTarget ("Shragle.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);70modifyLink.byTarget ("slingfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);71modifyLink.byTarget ("turbobit.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);72modifyLink.byTarget ("unibytes.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);73modifyLink.byTarget ("uploadjet.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);74modifyLink.byTarget ("uptobox.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);75modifyLink.byTarget ("videobam.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);76modifyLink.byTarget ("yousendit.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);77modifyLink.byTarget ("zippyshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);787980modifyLink.byTarget ("ul.to/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);81modifyLink.byTarget ("uploaded.to/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);82modifyLink.byTarget ("uploaded.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);83modifyLink.byTarget ("uploading.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);84modifyLink.byTarget ("uploading.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);8586878889/* Links */90function Links (){91	addMethod(this, "byText", function(ExpectedName, DesiredName){92		ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";93		re = new RegExp(ExpectedName)94		for(i = 0; i < lnk.snapshotLength; i++) {95			tmp = lnk.snapshotItem(i);96			if(re.test(tmp.innerHTML)){97				if (DesiredName != ""){98					tmp.innerHTML = DesiredName;99				}100			}101		}				102	});103	104	addMethod(this, "byText", function(ExpectedName, DesiredName, RegexEnabled){105		if (RegexEnabled != 1){106			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";107		}108		re = new RegExp(ExpectedName)109		for(i = 0; i < lnk.snapshotLength; i++) {110			tmp = lnk.snapshotItem(i);111			if(re.test(tmp.innerHTML)){112				if (DesiredName != ""){113					tmp.innerHTML = DesiredName;114				}115			}116		}				117	});118	119	addMethod(this, "byText", function(ExpectedName, DesiredName, DesiredTarget, RegexEnabled){120		if (RegexEnabled != 1){121			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";122		}123		re = new RegExp(ExpectedName)124		for(i = 0; i < lnk.snapshotLength; i++) {125			tmp = lnk.snapshotItem(i);126			if(re.test(tmp.innerHTML)){127				if (DesiredName != ""){128					tmp.innerHTML = DesiredName;129				}130				if (DesiredTarget != ""){131					tmp.href = DesiredTarget;132				}133			}134					else if(re.test(tmp.href)){135				if (DesiredName != ""){136					tmp.innerHTML = DesiredName;137				}138				if (DesiredTarget != ""){139					tmp.href = DesiredTarget;140				}141			}142		}				143	});144	145	addMethod(this, "byTarget", function (ExpectedTarget, DesiredTarget){146		ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";147		re = new RegExp(ExpectedTarget);148		for(i = 0; i < lnk.snapshotLength; i++) {149			tmp = lnk.snapshotItem(i);150			if(re.test(tmp.href)){151				if (DesiredTarget != ""){152					tmp.href = DesiredTarget;153				}154			}155		}				156	});157	158	addMethod(this, "byTarget", function (ExpectedTarget, DesiredTarget, RegexEnabled){159		if (RegexEnabled != 1){160			ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";161		}162		re = new RegExp(ExpectedTarget);163		for(i = 0; i < lnk.snapshotLength; i++) {164			tmp = lnk.snapshotItem(i);165			if(re.test(tmp.href)){166				if (DesiredTarget != ""){167					tmp.href = DesiredTarget + lnk.snapshotItem(i);168				}169			}170		}				171	});172	173	addMethod(this, "byTarget", function (ExpectedTarget, DesiredName, DesiredTarget, RegexEnabled){174		if (RegexEnabled != 1){175			ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";176		}177		re = new RegExp(ExpectedTarget);178		for(i = 0; i < lnk.snapshotLength; i++) {179			tmp = lnk.snapshotItem(i);180			if(re.test(tmp.href)){181				if (DesiredName != ""){182					tmp.innerHTML = DesiredName;183				}184				if (DesiredTarget != ""){185					tmp.href = DesiredTarget;186				}187			}188		}				189	});190}191192193/* Buttons */194function Buttons (){195196addMethod (this, "byText", function(ExpectedName, DesiredName){197		ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";198		re = new RegExp(ExpectedName)199		for(i = 0; i < btn.snapshotLength; i++) {200			tmp = btn.snapshotItem(i)201			if(re.test(tmp.value)){202				if (DesiredName != ""){203					tmp.value = DesiredName;204				}205			}206		}				207	});208209addMethod (this, "byText", function(ExpectedName, DesiredName, RegexEnabled){210		if (RegexEnabled != 1){211			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";212		}213		re = new RegExp(ExpectedName)214		for(i = 0; i < btn.snapshotLength; i++) {215			tmp = btn.snapshotItem(i)216			if(re.test(tmp.value)){217				if (DesiredName != ""){218					tmp.value = DesiredName;219				}220			}221		}				222	});223}	224225/* Images */226function Images (){227228addMethod (this, "byText", function(ExpectedText, DesiredSource){229		ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";230		re = new RegExp(ExpectedText)231		for(i = 0; i < img.snapshotLength; i++) {232			tmp = img.snapshotItem(i)233			if(re.test(tmp.alt)){234				if (DesiredSource != ""){235					tmp.src = DesiredSource;236				}237			}238		}				239	});240	241addMethod (this, "byText", function(ExpectedText, DesiredSource, RegexEnabled){242		if (RegexEnabled != 1){243			ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";244		}245		re = new RegExp(ExpectedText)246		for(i = 0; i < img.snapshotLength; i++) {247			tmp = img.snapshotItem(i)248			if(re.test(tmp.alt)){249				if (DesiredSource != ""){250					tmp.src = DesiredSource;251				}252			}253		}				254	});255addMethod (this, "byText", function(ExpectedText, DesiredSource, DesiredHeight, DesiredWidth){256		ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";257		re = new RegExp(ExpectedText)258		for(i = 0; i < img.snapshotLength; i++) {259			tmp = img.snapshotItem(i)260			if(re.test(tmp.alt)){261				if (DesiredSource != ""){262					tmp.src = DesiredSource;263				}264				if (DesiredHeight != ""){265					tmp.height = DesiredHeight;266				}267				if (DesiredWidth != ""){268					tmp.width = DesiredWidth;269				}270			}271		}				272	});273addMethod (this, "byText", function(ExpectedText, DesiredSource, DesiredHeight, DesiredWidth, RegexEnabled){274		if (RegexEnabled != 1){275			ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";276		}277		re = new RegExp(ExpectedText)278		for(i = 0; i < img.snapshotLength; i++) {279			tmp = img.snapshotItem(i)280			if(re.test(tmp.alt)){281				if (DesiredSource != ""){282					tmp.src = DesiredSource;283				}284				if (DesiredHeight != ""){285					tmp.height = DesiredHeight;286				}287				if (DesiredWidth != ""){288					tmp.width = DesiredWidth;289				}290			}291		}				292	});293addMethod (this, "bySource", function(ExpectedSource, DesiredSource){294		ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";295		re = new RegExp(ExpectedSource)296		for(i = 0; i < img.snapshotLength; i++) {297			tmp = img.snapshotItem(i)298			if(re.test(tmp.src)){299				if (DesiredSource != ""){300					tmp.src = DesiredSource;301				}302			}303		}				304	});305addMethod (this, "bySource", function(ExpectedSource, DesiredSource, RegexEnabled){306		if (RegexEnabled != 1){307			ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";308		}309		re = new RegExp(ExpectedSource)310		for(i = 0; i < img.snapshotLength; i++) {311			tmp = img.snapshotItem(i)312			if(re.test(tmp.src)){313				if (DesiredSource != ""){314					tmp.src = DesiredSource;315				}316			}317		}				318	});319	320addMethod (this, "bySource", function(ExpectedSource, DesiredSource, DesiredHeight, DesiredWidth){321		ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";322		re = new RegExp(ExpectedSource)323		for(i = 0; i < img.snapshotLength; i++) {324			tmp = img.snapshotItem(i)325			if(re.test(tmp.src)){326				if (DesiredSource != ""){327					tmp.src = DesiredSource;328				}329				if (DesiredHeight != ""){330					tmp.height = DesiredHeight;331				}332				if (DesiredWidth != ""){333					tmp.width = DesiredWidth;334				}335			}336		}				337	});338	339addMethod (this, "bySource", function(ExpectedSource, DesiredSource, DesiredHeight, DesiredWidth, RegexEnabled){340		if (RegexEnabled != 1){341			ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";342		}343		re = new RegExp(ExpectedSource)344		for(i = 0; i < img.snapshotLength; i++) {345			tmp = img.snapshotItem(i)346			if(re.test(tmp.src)){347				if (DesiredSource != ""){348					tmp.src = DesiredSource;349				}350				if (DesiredHeight != ""){351					tmp.height = DesiredHeight;352				}353				if (DesiredWidth != ""){354					tmp.width = DesiredWidth;355				}356			}357		}				358	});359360}	361362//Used for overloading methods, by John Resig363function addMethod(object, name, fn){364    var old = object[ name ];365    object[ name ] = function(){366        if ( fn.length == arguments.length )367            return fn.apply( this, arguments );368        else if ( typeof old == 'function' )369            return old.apply( this, arguments );370    };371}372
...

Full Screen

Full Screen

124851.user.js

Source:124851.user.js Github

copy

Full Screen

1// ==UserScript==2// @name           Zevera Auto Linker3// @namespace      Changes all Links to "Zevera Links". 4// @description    Changes all Links to "Zevera Links". 5// @include        *6// @exclude        http://google.com/*7// @By Havard V.12.38// ==/UserScript==910//MODIFIED FOR ZEVERA1112/* Do not modify this unless you know what you're doing */13var lnk=document.evaluate("//a[@href]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);14var btn=document.evaluate("//input[@value]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 15var img=document.evaluate("//img", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);16var toReplace = /(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\^|\$)/g;17var modifyLink = new Links(); 18var modifyButton = new Buttons();19var modifyImage = new Images();2021modifyLink.byTarget ("2shared.com*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);22modifyLink.byTarget ("4shared.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);23modifyLink.byTarget ("asfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);24modifyLink.byTarget ("bayfiles.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);25modifyLink.byTarget ("bitshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);26modifyLink.byTarget ("crocko.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);27modifyLink.byTarget ("easybytez.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);28modifyLink.byTarget ("extabit.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);29modifyLink.byTarget ("fiberupload.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);30modifyLink.byTarget ("filebox.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);31modifyLink.byTarget ("filedino.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);32modifyLink.byTarget ("fileduct.com*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);33modifyLink.byTarget ("filefactory.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);34modifyLink.byTarget ("filemonster.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);35modifyLink.byTarget ("filepost.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);36modifyLink.byTarget ("uploaded.to/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);37modifyLink.byTarget ("filepost.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);38modifyLink.byTarget ("filereactor.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);39modifyLink.byTarget ("fileserving.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);40modifyLink.byTarget ("filedino.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);41modifyLink.byTarget ("filevelocity.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);42modifyLink.byTarget ("freakshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);43modifyLink.byTarget ("furk.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);44modifyLink.byTarget ("hotfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);45modifyLink.byTarget ("ifile.it/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);46modifyLink.byTarget ("fileape.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);47modifyLink.byTarget ("jumbofiles.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);48modifyLink.byTarget ("letitbit.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);49modifyLink.byTarget ("mediafire.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);50modifyLink.byTarget ("megashare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);51modifyLink.byTarget ("megashares.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);52modifyLink.byTarget ("rapidgator.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);53modifyLink.byTarget ("rarefile.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);54modifyLink.byTarget ("rapidshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);55modifyLink.byTarget ("sendspace.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);56modifyLink.byTarget ("share-online.biz*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);57modifyLink.byTarget ("turbobit.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);58modifyLink.byTarget ("unibytes.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);59modifyLink.byTarget ("uploaded.to/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);60modifyLink.byTarget ("uploading.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);61modifyLink.byTarget ("ryushare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);62modifyLink.byTarget ("Shragle.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);63modifyLink.byTarget ("cloudnator.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);64modifyLink.byTarget ("netload.in/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);65modifyLink.byTarget ("novafile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);66modifyLink.byTarget ("videobam.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);67modifyLink.byTarget ("Cramit.in/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);68modifyLink.byTarget ("filerio.in/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);69modifyLink.byTarget ("slingfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);70modifyLink.byTarget ("filemates.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);71modifyLink.byTarget ("scribd.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);72modifyLink.byTarget ("zippyshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);73modifyLink.byTarget ("yousendit.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);74modifyLink.byTarget ("uptobox.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);75modifyLink.byTarget ("uploadjet.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);76modifyLink.byTarget ("lumfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);7778798081/* Links */82function Links (){83	addMethod(this, "byText", function(ExpectedName, DesiredName){84		ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";85		re = new RegExp(ExpectedName)86		for(i = 0; i < lnk.snapshotLength; i++) {87			tmp = lnk.snapshotItem(i);88			if(re.test(tmp.innerHTML)){89				if (DesiredName != ""){90					tmp.innerHTML = DesiredName;91				}92			}93		}				94	});95	96	addMethod(this, "byText", function(ExpectedName, DesiredName, RegexEnabled){97		if (RegexEnabled != 1){98			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";99		}100		re = new RegExp(ExpectedName)101		for(i = 0; i < lnk.snapshotLength; i++) {102			tmp = lnk.snapshotItem(i);103			if(re.test(tmp.innerHTML)){104				if (DesiredName != ""){105					tmp.innerHTML = DesiredName;106				}107			}108		}				109	});110	111	addMethod(this, "byText", function(ExpectedName, DesiredName, DesiredTarget, RegexEnabled){112		if (RegexEnabled != 1){113			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";114		}115		re = new RegExp(ExpectedName)116		for(i = 0; i < lnk.snapshotLength; i++) {117			tmp = lnk.snapshotItem(i);118			if(re.test(tmp.innerHTML)){119				if (DesiredName != ""){120					tmp.innerHTML = DesiredName;121				}122				if (DesiredTarget != ""){123					tmp.href = DesiredTarget;124				}125			}126					else if(re.test(tmp.href)){127				if (DesiredName != ""){128					tmp.innerHTML = DesiredName;129				}130				if (DesiredTarget != ""){131					tmp.href = DesiredTarget;132				}133			}134		}				135	});136	137	addMethod(this, "byTarget", function (ExpectedTarget, DesiredTarget){138		ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";139		re = new RegExp(ExpectedTarget);140		for(i = 0; i < lnk.snapshotLength; i++) {141			tmp = lnk.snapshotItem(i);142			if(re.test(tmp.href)){143				if (DesiredTarget != ""){144					tmp.href = DesiredTarget;145				}146			}147		}				148	});149	150	addMethod(this, "byTarget", function (ExpectedTarget, DesiredTarget, RegexEnabled){151		if (RegexEnabled != 1){152			ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";153		}154		re = new RegExp(ExpectedTarget);155		for(i = 0; i < lnk.snapshotLength; i++) {156			tmp = lnk.snapshotItem(i);157			if(re.test(tmp.href)){158				if (DesiredTarget != ""){159					tmp.href = DesiredTarget + lnk.snapshotItem(i);160				}161			}162		}				163	});164	165	addMethod(this, "byTarget", function (ExpectedTarget, DesiredName, DesiredTarget, RegexEnabled){166		if (RegexEnabled != 1){167			ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";168		}169		re = new RegExp(ExpectedTarget);170		for(i = 0; i < lnk.snapshotLength; i++) {171			tmp = lnk.snapshotItem(i);172			if(re.test(tmp.href)){173				if (DesiredName != ""){174					tmp.innerHTML = DesiredName;175				}176				if (DesiredTarget != ""){177					tmp.href = DesiredTarget;178				}179			}180		}				181	});182}183184185/* Buttons */186function Buttons (){187188addMethod (this, "byText", function(ExpectedName, DesiredName){189		ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";190		re = new RegExp(ExpectedName)191		for(i = 0; i < btn.snapshotLength; i++) {192			tmp = btn.snapshotItem(i)193			if(re.test(tmp.value)){194				if (DesiredName != ""){195					tmp.value = DesiredName;196				}197			}198		}				199	});200201addMethod (this, "byText", function(ExpectedName, DesiredName, RegexEnabled){202		if (RegexEnabled != 1){203			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";204		}205		re = new RegExp(ExpectedName)206		for(i = 0; i < btn.snapshotLength; i++) {207			tmp = btn.snapshotItem(i)208			if(re.test(tmp.value)){209				if (DesiredName != ""){210					tmp.value = DesiredName;211				}212			}213		}				214	});215}	216217/* Images */218function Images (){219220addMethod (this, "byText", function(ExpectedText, DesiredSource){221		ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";222		re = new RegExp(ExpectedText)223		for(i = 0; i < img.snapshotLength; i++) {224			tmp = img.snapshotItem(i)225			if(re.test(tmp.alt)){226				if (DesiredSource != ""){227					tmp.src = DesiredSource;228				}229			}230		}				231	});232	233addMethod (this, "byText", function(ExpectedText, DesiredSource, RegexEnabled){234		if (RegexEnabled != 1){235			ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";236		}237		re = new RegExp(ExpectedText)238		for(i = 0; i < img.snapshotLength; i++) {239			tmp = img.snapshotItem(i)240			if(re.test(tmp.alt)){241				if (DesiredSource != ""){242					tmp.src = DesiredSource;243				}244			}245		}				246	});247addMethod (this, "byText", function(ExpectedText, DesiredSource, DesiredHeight, DesiredWidth){248		ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";249		re = new RegExp(ExpectedText)250		for(i = 0; i < img.snapshotLength; i++) {251			tmp = img.snapshotItem(i)252			if(re.test(tmp.alt)){253				if (DesiredSource != ""){254					tmp.src = DesiredSource;255				}256				if (DesiredHeight != ""){257					tmp.height = DesiredHeight;258				}259				if (DesiredWidth != ""){260					tmp.width = DesiredWidth;261				}262			}263		}				264	});265addMethod (this, "byText", function(ExpectedText, DesiredSource, DesiredHeight, DesiredWidth, RegexEnabled){266		if (RegexEnabled != 1){267			ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";268		}269		re = new RegExp(ExpectedText)270		for(i = 0; i < img.snapshotLength; i++) {271			tmp = img.snapshotItem(i)272			if(re.test(tmp.alt)){273				if (DesiredSource != ""){274					tmp.src = DesiredSource;275				}276				if (DesiredHeight != ""){277					tmp.height = DesiredHeight;278				}279				if (DesiredWidth != ""){280					tmp.width = DesiredWidth;281				}282			}283		}				284	});285addMethod (this, "bySource", function(ExpectedSource, DesiredSource){286		ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";287		re = new RegExp(ExpectedSource)288		for(i = 0; i < img.snapshotLength; i++) {289			tmp = img.snapshotItem(i)290			if(re.test(tmp.src)){291				if (DesiredSource != ""){292					tmp.src = DesiredSource;293				}294			}295		}				296	});297addMethod (this, "bySource", function(ExpectedSource, DesiredSource, RegexEnabled){298		if (RegexEnabled != 1){299			ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";300		}301		re = new RegExp(ExpectedSource)302		for(i = 0; i < img.snapshotLength; i++) {303			tmp = img.snapshotItem(i)304			if(re.test(tmp.src)){305				if (DesiredSource != ""){306					tmp.src = DesiredSource;307				}308			}309		}				310	});311	312addMethod (this, "bySource", function(ExpectedSource, DesiredSource, DesiredHeight, DesiredWidth){313		ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";314		re = new RegExp(ExpectedSource)315		for(i = 0; i < img.snapshotLength; i++) {316			tmp = img.snapshotItem(i)317			if(re.test(tmp.src)){318				if (DesiredSource != ""){319					tmp.src = DesiredSource;320				}321				if (DesiredHeight != ""){322					tmp.height = DesiredHeight;323				}324				if (DesiredWidth != ""){325					tmp.width = DesiredWidth;326				}327			}328		}				329	});330	331addMethod (this, "bySource", function(ExpectedSource, DesiredSource, DesiredHeight, DesiredWidth, RegexEnabled){332		if (RegexEnabled != 1){333			ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";334		}335		re = new RegExp(ExpectedSource)336		for(i = 0; i < img.snapshotLength; i++) {337			tmp = img.snapshotItem(i)338			if(re.test(tmp.src)){339				if (DesiredSource != ""){340					tmp.src = DesiredSource;341				}342				if (DesiredHeight != ""){343					tmp.height = DesiredHeight;344				}345				if (DesiredWidth != ""){346					tmp.width = DesiredWidth;347				}348			}349		}				350	});351352}	353354//Used for overloading methods, by John Resig355function addMethod(object, name, fn){356    var old = object[ name ];357    object[ name ] = function(){358        if ( fn.length == arguments.length )359            return fn.apply( this, arguments );360        else if ( typeof old == 'function' )361            return old.apply( this, arguments );362    };363}364
...

Full Screen

Full Screen

131269.user.js

Source:131269.user.js Github

copy

Full Screen

1// ==UserScript==2// @name           Zevera Auto Linker V103// @namespace      Changes all Links to "Zevera Links". 4// @description    Changes all Links to "Zevera Links". 5// @include        *6// @exclude        http://google.com/*7// @By Antonio Monteiro8// ==/UserScript==910//MODIFIED FOR ZEVERA1112/* Do not modify this unless you know what you're doing */13var lnk=document.evaluate("//a[@href]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);14var btn=document.evaluate("//input[@value]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); 15var img=document.evaluate("//img", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);16var toReplace = /(\/|\.|\*|\+|\?|\||\(|\)|\[|\]|\{|\}|\\|\^|\$)/g;17var modifyLink = new Links(); 18var modifyButton = new Buttons();19var modifyImage = new Images();2021modifyLink.byTarget ("2shared.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);22modifyLink.byTarget ("4shared.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);23modifyLink.byTarget ("asfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);24modifyLink.byTarget ("bayfiles.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);25modifyLink.byTarget ("bitshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);26modifyLink.byTarget ("bulletupload.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);27modifyLink.byTarget ("crocko.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);28modifyLink.byTarget ("easybytez.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);29modifyLink.byTarget ("extabit.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);30modifyLink.byTarget ("fiberupload.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);31modifyLink.byTarget ("fileape.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);32modifyLink.byTarget ("filebox.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);33modifyLink.byTarget ("filedino.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);34modifyLink.byTarget ("fileduct.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);35modifyLink.byTarget ("filefactory.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);36modifyLink.byTarget ("filemonster.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);37modifyLink.byTarget ("filepost.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);38modifyLink.byTarget ("filereactor.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);39modifyLink.byTarget ("fileserving.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);40modifyLink.byTarget ("filesmonster.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);41modifyLink.byTarget ("filevelocity.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);42modifyLink.byTarget ("freakshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);43modifyLink.byTarget ("furk.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);44modifyLink.byTarget ("hotfile.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);45modifyLink.byTarget ("ifile.it/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);46modifyLink.byTarget ("jumbofiles.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);47modifyLink.byTarget ("kickload.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);48modifyLink.byTarget ("letitbit.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);49modifyLink.byTarget ("mediafire.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);50modifyLink.byTarget ("megashare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);51modifyLink.byTarget ("megashares.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);52modifyLink.byTarget ("netload.in/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);53modifyLink.byTarget ("rapidgator.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);54modifyLink.byTarget ("rarefile.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);55modifyLink.byTarget ("rapidshare.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);56modifyLink.byTarget ("sendspace.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);57modifyLink.byTarget ("shareflare.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);58modifyLink.byTarget ("share-online.biz/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);59modifyLink.byTarget ("shragle.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);60modifyLink.byTarget ("turbobit.net/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);61modifyLink.byTarget ("unibytes.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);62modifyLink.byTarget ("ul.to/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);63modifyLink.byTarget ("uploaded.to/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);64modifyLink.byTarget ("uploading.com/*", "http://www.zevera.com/getFiles.aspx?ourl=", 1);6566/* Links */67function Links (){68	addMethod(this, "byText", function(ExpectedName, DesiredName){69		ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";70		re = new RegExp(ExpectedName)71		for(i = 0; i < lnk.snapshotLength; i++) {72			tmp = lnk.snapshotItem(i);73			if(re.test(tmp.innerHTML)){74				if (DesiredName != ""){75					tmp.innerHTML = DesiredName;76				}77			}78		}				79	});80	81	addMethod(this, "byText", function(ExpectedName, DesiredName, RegexEnabled){82		if (RegexEnabled != 1){83			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";84		}85		re = new RegExp(ExpectedName)86		for(i = 0; i < lnk.snapshotLength; i++) {87			tmp = lnk.snapshotItem(i);88			if(re.test(tmp.innerHTML)){89				if (DesiredName != ""){90					tmp.innerHTML = DesiredName;91				}92			}93		}				94	});95	96	addMethod(this, "byText", function(ExpectedName, DesiredName, DesiredTarget, RegexEnabled){97		if (RegexEnabled != 1){98			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";99		}100		re = new RegExp(ExpectedName)101		for(i = 0; i < lnk.snapshotLength; i++) {102			tmp = lnk.snapshotItem(i);103			if(re.test(tmp.innerHTML)){104				if (DesiredName != ""){105					tmp.innerHTML = DesiredName;106				}107				if (DesiredTarget != ""){108					tmp.href = DesiredTarget;109				}110			}111					else if(re.test(tmp.href)){112				if (DesiredName != ""){113					tmp.innerHTML = DesiredName;114				}115				if (DesiredTarget != ""){116					tmp.href = DesiredTarget;117				}118			}119		}				120	});121	122	addMethod(this, "byTarget", function (ExpectedTarget, DesiredTarget){123		ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";124		re = new RegExp(ExpectedTarget);125		for(i = 0; i < lnk.snapshotLength; i++) {126			tmp = lnk.snapshotItem(i);127			if(re.test(tmp.href)){128				if (DesiredTarget != ""){129					tmp.href = DesiredTarget;130				}131			}132		}				133	});134	135	addMethod(this, "byTarget", function (ExpectedTarget, DesiredTarget, RegexEnabled){136		if (RegexEnabled != 1){137			ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";138		}139		re = new RegExp(ExpectedTarget);140		for(i = 0; i < lnk.snapshotLength; i++) {141			tmp = lnk.snapshotItem(i);142			if(re.test(tmp.href)){143				if (DesiredTarget != ""){144					tmp.href = DesiredTarget + lnk.snapshotItem(i);145				}146			}147		}				148	});149	150	addMethod(this, "byTarget", function (ExpectedTarget, DesiredName, DesiredTarget, RegexEnabled){151		if (RegexEnabled != 1){152			ExpectedTarget = "^" + ExpectedTarget.replace(toReplace, "\\$1") + "$";153		}154		re = new RegExp(ExpectedTarget);155		for(i = 0; i < lnk.snapshotLength; i++) {156			tmp = lnk.snapshotItem(i);157			if(re.test(tmp.href)){158				if (DesiredName != ""){159					tmp.innerHTML = DesiredName;160				}161				if (DesiredTarget != ""){162					tmp.href = DesiredTarget;163				}164			}165		}				166	});167}168169170/* Buttons */171function Buttons (){172173addMethod (this, "byText", function(ExpectedName, DesiredName){174		ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";175		re = new RegExp(ExpectedName)176		for(i = 0; i < btn.snapshotLength; i++) {177			tmp = btn.snapshotItem(i)178			if(re.test(tmp.value)){179				if (DesiredName != ""){180					tmp.value = DesiredName;181				}182			}183		}				184	});185186addMethod (this, "byText", function(ExpectedName, DesiredName, RegexEnabled){187		if (RegexEnabled != 1){188			ExpectedName = "^" + ExpectedName.replace(toReplace, "\\$1") + "$";189		}190		re = new RegExp(ExpectedName)191		for(i = 0; i < btn.snapshotLength; i++) {192			tmp = btn.snapshotItem(i)193			if(re.test(tmp.value)){194				if (DesiredName != ""){195					tmp.value = DesiredName;196				}197			}198		}				199	});200}	201202/* Images */203function Images (){204205addMethod (this, "byText", function(ExpectedText, DesiredSource){206		ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";207		re = new RegExp(ExpectedText)208		for(i = 0; i < img.snapshotLength; i++) {209			tmp = img.snapshotItem(i)210			if(re.test(tmp.alt)){211				if (DesiredSource != ""){212					tmp.src = DesiredSource;213				}214			}215		}				216	});217	218addMethod (this, "byText", function(ExpectedText, DesiredSource, RegexEnabled){219		if (RegexEnabled != 1){220			ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";221		}222		re = new RegExp(ExpectedText)223		for(i = 0; i < img.snapshotLength; i++) {224			tmp = img.snapshotItem(i)225			if(re.test(tmp.alt)){226				if (DesiredSource != ""){227					tmp.src = DesiredSource;228				}229			}230		}				231	});232addMethod (this, "byText", function(ExpectedText, DesiredSource, DesiredHeight, DesiredWidth){233		ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";234		re = new RegExp(ExpectedText)235		for(i = 0; i < img.snapshotLength; i++) {236			tmp = img.snapshotItem(i)237			if(re.test(tmp.alt)){238				if (DesiredSource != ""){239					tmp.src = DesiredSource;240				}241				if (DesiredHeight != ""){242					tmp.height = DesiredHeight;243				}244				if (DesiredWidth != ""){245					tmp.width = DesiredWidth;246				}247			}248		}				249	});250addMethod (this, "byText", function(ExpectedText, DesiredSource, DesiredHeight, DesiredWidth, RegexEnabled){251		if (RegexEnabled != 1){252			ExpectedText = "^" + ExpectedText.replace(toReplace, "\\$1") + "$";253		}254		re = new RegExp(ExpectedText)255		for(i = 0; i < img.snapshotLength; i++) {256			tmp = img.snapshotItem(i)257			if(re.test(tmp.alt)){258				if (DesiredSource != ""){259					tmp.src = DesiredSource;260				}261				if (DesiredHeight != ""){262					tmp.height = DesiredHeight;263				}264				if (DesiredWidth != ""){265					tmp.width = DesiredWidth;266				}267			}268		}				269	});270addMethod (this, "bySource", function(ExpectedSource, DesiredSource){271		ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";272		re = new RegExp(ExpectedSource)273		for(i = 0; i < img.snapshotLength; i++) {274			tmp = img.snapshotItem(i)275			if(re.test(tmp.src)){276				if (DesiredSource != ""){277					tmp.src = DesiredSource;278				}279			}280		}				281	});282addMethod (this, "bySource", function(ExpectedSource, DesiredSource, RegexEnabled){283		if (RegexEnabled != 1){284			ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";285		}286		re = new RegExp(ExpectedSource)287		for(i = 0; i < img.snapshotLength; i++) {288			tmp = img.snapshotItem(i)289			if(re.test(tmp.src)){290				if (DesiredSource != ""){291					tmp.src = DesiredSource;292				}293			}294		}				295	});296	297addMethod (this, "bySource", function(ExpectedSource, DesiredSource, DesiredHeight, DesiredWidth){298		ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";299		re = new RegExp(ExpectedSource)300		for(i = 0; i < img.snapshotLength; i++) {301			tmp = img.snapshotItem(i)302			if(re.test(tmp.src)){303				if (DesiredSource != ""){304					tmp.src = DesiredSource;305				}306				if (DesiredHeight != ""){307					tmp.height = DesiredHeight;308				}309				if (DesiredWidth != ""){310					tmp.width = DesiredWidth;311				}312			}313		}				314	});315	316addMethod (this, "bySource", function(ExpectedSource, DesiredSource, DesiredHeight, DesiredWidth, RegexEnabled){317		if (RegexEnabled != 1){318			ExpectedSource = "^" + ExpectedSource.replace(toReplace, "\\$1") + "$";319		}320		re = new RegExp(ExpectedSource)321		for(i = 0; i < img.snapshotLength; i++) {322			tmp = img.snapshotItem(i)323			if(re.test(tmp.src)){324				if (DesiredSource != ""){325					tmp.src = DesiredSource;326				}327				if (DesiredHeight != ""){328					tmp.height = DesiredHeight;329				}330				if (DesiredWidth != ""){331					tmp.width = DesiredWidth;332				}333			}334		}				335	});336337}	338339//Used for overloading methods, by John Resig340function addMethod(object, name, fn){341    var old = object[ name ];342    object[ name ] = function(){343        if ( fn.length == arguments.length )344            return fn.apply( this, arguments );345        else if ( typeof old == 'function' )346            return old.apply( this, arguments );347    };348}349
...

Full Screen

Full Screen

jsonSamplesAndTestFiles.js

Source:jsonSamplesAndTestFiles.js Github

copy

Full Screen

2var chai = require('chai'); chai.Should();3chai.use(require('../dist/').chaiModule);4describe('Samples', function() {5  describe('full', function() {6    getFiles('./samples/full').forEach(function(file) {7      it(file, function() {8        assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");9        require('../samples/full/' + file).should.be.validSignalK;10      });11    })12  });13  14  describe('hello', function() {15    getFiles('./samples/hello').forEach(function(file) {16      it(file, function() {17        assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");18        require('../samples/hello/' + file).should.be.validSignalKHello;19      });20    })21  });22  23  describe('delta', function() {24    getFiles('./samples/delta').forEach(function(file) {25      it(file, function() {26        assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");27        require('../samples/delta/' + file).should.be.validSignalKDelta;28      });29    })30  });31  32  describe('subscribe', function() {33    getFiles('./samples/subscribe').forEach(function(file) {34      it(file, function() {35        assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");36        require('../samples/subscribe/' + file).should.be.validSubscribeMessage;37      });38    })39  });40  41  describe('unsubscribe', function() {42    getFiles('./samples/unsubscribe').forEach(function(file) {43      it(file, function() {44        assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");45        require('../samples/unsubscribe/' + file).should.be.validUnsubscribeMessage;46      });47    })48  });49  50  describe('discovery', function() {51    getFiles('./samples/discovery').forEach(function(file) {52      it(file, function() {53        assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");54        require('../samples/discovery/' + file).should.be.validDiscovery;55      });56    })57  });58  59});60describe('Unit tests', function() {61  describe('full', function () {62    describe('valid', function () {63      getFiles('./test/data/full-valid').forEach(function (file) {64        it(file, function () {65          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");66          require('../test/data/full-valid/' + file).should.be.validSignalK;67        });68      })69    });70    describe('invalid', function () {71      getFiles('./test/data/full-invalid').forEach(function (file) {72        it(file, function () {73          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");74          require('../test/data/full-invalid/' + file).should.not.be.validSignalK;75        });76      })77    });78  });79  describe('discovery', function () {80    describe('valid', function () {81      getFiles('./test/data/discovery-valid').forEach(function (file) {82        it(file, function () {83          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");84          require('../test/data/discovery-valid/' + file).should.be.validDiscovery;85        });86      })87    });88    describe('invalid', function () {89      getFiles('./test/data/discovery-invalid').forEach(function (file) {90        it(file, function () {91          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");92          require('../test/data/discovery-invalid/' + file).should.not.be.validDiscovery;93        });94      })95    });96  });97  describe('hello', function () {98    describe('valid', function () {99      getFiles('./test/data/hello-valid').forEach(function (file) {100        it(file, function () {101          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");102          require('../test/data/hello-valid/' + file).should.be.validSignalKHello;103        });104      })105    });106    describe('invalid', function () {107      getFiles('./test/data/hello-invalid').forEach(function (file) {108        it(file, function () {109          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");110          require('../test/data/hello-invalid/' + file).should.not.be.validSignalKHello;111        });112      })113    });114  });115  describe('delta', function () {116    describe('valid', function () {117      getFiles('./test/data/delta-valid').forEach(function (file) {118        it(file, function () {119          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");120          require('../test/data/delta-valid/' + file).should.be.validSignalKDelta;121        });122      })123    });124    describe('invalid', function () {125      getFiles('./test/data/delta-invalid').forEach(function (file) {126        it(file, function () {127          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");128          require('../test/data/delta-invalid/' + file).should.not.be.validSignalKDelta;129        });130      })131    });132  });133  describe('put', function () {134    describe('valid', function () {135      getFiles('./test/data/put-valid').forEach(function (file) {136        it(file, function () {137          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");138          require('../test/data/put-valid/' + file).should.be.validSignalKPut;139        });140      })141    });142    describe('invalid', function () {143        getFiles('./test/data/put-invalid').forEach(function (file) {144          it(file, function () {145            assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");146            require('../test/data/put-invalid/' + file).should.not.be.validSignalKPut;147          });148        })149      });150  });151  152  describe('get', function () {153	    describe('valid', function () {154	      getFiles('./test/data/get-valid').forEach(function (file) {155	        it(file, function () {156	          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");157	          require('../test/data/get-valid/' + file).should.be.validSignalKGet;158	        });159	      })160	    });161	    describe('invalid', function () {162	        getFiles('./test/data/get-invalid').forEach(function (file) {163	          it(file, function () {164	            assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");165	            require('../test/data/get-invalid/' + file).should.not.be.validSignalKGet;166	          });167	        })168	      });169	  });170  describe('subscribe', function () {171    describe('valid', function () {172      getFiles('./test/data/subscribe-valid').forEach(function (file) {173        it(file, function () {174          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");175          require('../test/data/subscribe-valid/' + file).should.be.validSubscribeMessage;176        });177      })178    });179    describe('invalid', function () {180      getFiles('./test/data/subscribe-invalid').forEach(function (file) {181        it(file, function () {182          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");183          require('../test/data/subscribe-invalid/' + file).should.not.be.validSubscribeMessage;184        });185      })186    });187  });188  describe('unsubscribe', function () {189    describe('valid', function () {190      getFiles('./test/data/unsubscribe-valid').forEach(function (file) {191        it(file, function () {192          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");193          require('../test/data/unsubscribe-valid/' + file).should.be.validUnsubscribeMessage;194        });195      })196    });197    describe('invalid', function () {198      getFiles('./test/data/unsubscribe-invalid').forEach(function (file) {199        it(file, function () {200          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");201          require('../test/data/unsubscribe-invalid/' + file).should.not.be.validUnsubscribeMessage;202        });203      })204    });205  });206  207  describe('auth', function () {208    describe('valid', function () {209      getFiles('./test/data/auth-valid').forEach(function (file) {210        it(file, function () {211          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");212          require('../test/data/auth-valid/' + file).should.be.validAuthMessage;213        });214      })215    });216    describe('invalid', function () {217      getFiles('./test/data/auth-invalid').forEach(function (file) {218        it(file, function () {219          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");220          require('../test/data/auth-invalid/' + file).should.not.be.validAuthMessage;221        });222      })223    });224  });225  describe('vessel', function () {226    describe('valid', function () {227      getFiles('./test/data/vessel-valid').forEach(function (file) {228        it(file, function () {229          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");230          require('../test/data/vessel-valid/' + file).should.be.validSignalKVessel;231        });232      })233    });234    describe('invalid', function () {235      getFiles('./test/data/vessel-invalid').forEach(function (file) {236        it(file, function () {237          assert.equal(file.indexOf(' '), -1, "spaces are not permitted in file names");238          require('../test/data/vessel-invalid/' + file).should.not.be.validSignalKVessel;239        });240      })241    });242  });243});244function getFiles(dir, fileList){245  var fs = require('fs');246  fileList = fileList || [];247  var files = fs.readdirSync(dir);248  for(var i in files){249    if (!files.hasOwnProperty(i)) continue;250    var name = dir+'/'+files[i];251    if (!fs.statSync(name).isDirectory()){252      fileList.push(files[i]);253    }254  }255  return fileList;...

Full Screen

Full Screen

config.js

Source:config.js Github

copy

Full Screen

...45            '/languages/laravel/': [46                {47                    isGroup: true,48                    text: 'Laravel',49                    children: getFiles('languages/laravel'),50                },51                {52                    isGroup: true,53                    text: 'Api',54                    children: getFiles('languages/laravel/api'),55                },56                {57                    isGroup: true,58                    text: 'Packages',59                    children: getFiles('languages/laravel/packages'),60                },61                {62                    isGroup: true,63                    text: 'Testing',64                    children: getFiles('languages/laravel/testing'),65                },66                {67                    isGroup: true,68                    text: 'Nova',69                    children: getFiles('languages/laravel/nova'),70                },71                {72                    isGroup: true,73                    text: 'Livewire',74                    children: getFiles('languages/laravel/livewire'),75                },76            ],77            '/languages/wordpress/': [78                {79                    isGroup: true,80                    text: 'WordPress',81                    children: getFiles('languages/wordpress'),82                },83            ],84            '/languages/go/': [85                {86                    isGroup: true,87                    text: 'Go',88                    children: getFiles('languages/go'),89                },90            ],91            '/languages/javascript/': [92                {93                    isGroup: true,94                    text: 'Javascript',95                    children: getFiles('languages/javascript'),96                },97                {98                    isGroup: true,99                    text: 'Webpack2',100                    children: getFiles('languages/javascript/webpack2'),101                },102            ],103            '/languages/vue/': [104                {105                    isGroup: true,106                    text: 'Vue',107                    children: getFiles('languages/vue'),108                },109                {110                    isGroup: true,111                    text: 'Vee Validate',112                    children: getFiles('languages/vue/vee-validate'),113                },114            ],115            '/languages/symfony-components/': [116                {117                    isGroup: true,118                    text: 'Symfony 组件',119                    children: getFiles('languages/symfony-components'),120                },121            ],122            '/os/centos': [123                {124                    isGroup: true,125                    text: 'CentOS',126                    children: getFiles('os/centos'),127                },128                {129                    isGroup: true,130                    text: 'CentOS7',131                    children: getFiles('os/centos/centos7'),132                },133            ],134            '/os/ubuntu': [135                {136                    isGroup: true,137                    text: 'Ubuntu',138                    children: getFiles('os/ubuntu'),139                },140            ],141            '/os/mac-os': [142                {143                    isGroup: true,144                    text: 'Mac OS',145                    children: getFiles('os/mac-os'),146                },147            ],148            '/tools/': [149                {150                    isGroup: true,151                    text: 'Tools',152                    children: getFiles('tools'),153                },154                {155                    isGroup: true,156                    text: 'Sublime Text',157                    children: getFiles('tools/sublime')158                },159                {160                    isGroup: true,161                    text: 'PHPStorm',162                    children: getFiles('tools/phpstorm')163                },164                {165                    isGroup: true,166                    text: 'Git',167                    children: getFiles('tools/git')168                },169                {170                    isGroup: true,171                    text: 'Atom',172                    children: getFiles('tools/atom')173                },174                {175                    isGroup: true,176                    text: 'Google Developer Tools',177                    children: getFiles('tools/google-developer-tools'),178                },179                {180                    isGroup: true,181                    text: 'Vagrant',182                    children: getFiles('tools/vagrant'),183                },184                {185                    isGroup: true,186                    text: 'Valet',187                    children: getFiles('tools/valet')188                },189                {190                    isGroup: true,191                    text: 'Homestead',192                    children: getFiles('tools/homestead')193                },194                {195                    isGroup: true,196                    text: 'Docker',197                    children: getFiles('tools/docker')198                },199            ],200            '/others': [201                {202                    isGroup: true,203                    text: 'Others',204                    children: getFiles('others'),205                },206            ],207        },208    }...

Full Screen

Full Screen

component.test.js

Source:component.test.js Github

copy

Full Screen

...8    list.forEach((item) => {9      const { name } = item;10      const childPath = path.resolve(folderPath, name);11      if (item.isDirectory()) {12        const childFiles = getFiles(childPath);13        res = [...res, ...childFiles];14      } else {15        const curr = {16          filePath: path.resolve(folderPath, name),17          content: fs.readFileSync(childPath, 'utf8'),18        };19        res = res.concat(curr);20      }21    });22    return res;23  } catch (e) {24    console.error(e);25    return [];26  }27};28const FILES_PATH = path.resolve(__dirname, './files');29const RUNTIME_PATH = path.resolve(__dirname, './runtime');30const INDEX_PATH = path.resolve(__dirname, '../index.js');31const files = getFiles(FILES_PATH);32const icludes = (list = []) => {33  list = getFiles(RUNTIME_PATH).map((item = {}) => {34    const { filePath: itemFilePath = '', ...others } = item;35    const filePath = itemFilePath.replace(RUNTIME_PATH, FILES_PATH);36    return { filePath, ...others };37  });38  return list.every((item = {}) => {39    const keys = Object.keys(item) || [];40    return files.some((file = {}) => keys.every(41      (key) => item[key] === file[key],42    ));43  });44};45beforeEach(() => {46  if (fs.existsSync(RUNTIME_PATH)) {47    child_process.execSync(`rm -rf ${RUNTIME_PATH}`);48  }49  fs.mkdirSync(RUNTIME_PATH);50});51afterEach(() => {52  if (fs.existsSync(RUNTIME_PATH)) {53    child_process.execSync(`rm -rf ${RUNTIME_PATH}`);54  }55});56test('create component class', () => {57  child_process.execSync(`node ${INDEX_PATH} ComponentClass`,{ cwd: RUNTIME_PATH });58  const list = getFiles(RUNTIME_PATH);59  const included = icludes(list);60  expect(included).toBe(true);61});62test('create component function', () => {63  child_process.execSync(`node ${INDEX_PATH} ComponentFunction -f`,{ cwd: RUNTIME_PATH });64  const list = getFiles(RUNTIME_PATH);65  const included = icludes(list);66  expect(included).toBe(true);67});68test('create component function with hooks', () => {69  child_process.execSync(`node ${INDEX_PATH} ComponentFunctionHooks -f -h`,{ cwd: RUNTIME_PATH });70  const list = getFiles(RUNTIME_PATH);71  const included = icludes(list);72  expect(included).toBe(true);73});74test('create single component class', () => {75  child_process.execSync(`node ${INDEX_PATH} ComponentClassSingle -s`,{ cwd: RUNTIME_PATH });76  const list = getFiles(RUNTIME_PATH);77  const included = icludes(list);78  expect(included).toBe(true);79});80test('create single component function', () => {81  child_process.execSync(`node ${INDEX_PATH} ComponentFunctionSingle -f -s`,{ cwd: RUNTIME_PATH });82  const list = getFiles(RUNTIME_PATH);83  const included = icludes(list);84  expect(included).toBe(true);85});86test('create page class', () => {87  child_process.execSync(`node ${INDEX_PATH} PageClass -p`,{ cwd: RUNTIME_PATH });88  const list = getFiles(RUNTIME_PATH);89  const included = icludes(list);90  expect(included).toBe(true);91});92test('create page function', () => {93  child_process.execSync(`node ${INDEX_PATH} PageFunction -p -f`,{ cwd: RUNTIME_PATH });94  const list = getFiles(RUNTIME_PATH);95  const included = icludes(list);96  expect(included).toBe(true);97});98test('create page function with hooks', () => {99  child_process.execSync(`node ${INDEX_PATH} PageFunctionHooks -p -f -h`,{ cwd: RUNTIME_PATH });100  const list = getFiles(RUNTIME_PATH);101  const included = icludes(list);102  expect(included).toBe(true);103});104test('create single page class', () => {105  child_process.execSync(`node ${INDEX_PATH} PageClassSingle -p -s`,{ cwd: RUNTIME_PATH });106  const list = getFiles(RUNTIME_PATH);107  const included = icludes(list);108  expect(included).toBe(true);109});110test('create single page function', () => {111  child_process.execSync(`node ${INDEX_PATH} PageFunctionSingle -p -f -s`,{ cwd: RUNTIME_PATH });112  const list = getFiles(RUNTIME_PATH);113  const included = icludes(list);114  expect(included).toBe(true);...

Full Screen

Full Screen

115173.user.js

Source:115173.user.js Github

copy

Full Screen

1// ==UserScript==2// @name           Zevera Auto Text3// @namespace      Changes all text to "Zevera text".4// @description    Changes all text to "Zevera text".5// @include        *    6// ==/UserScript==78//MODIFIED FOR ZEVERA910var words = {11///////////////////////////////////////////////////////12// Syntax: 'Search word' : 'Replace word',1314///////////////////////////////////////////////////////15"megaupload.com":"zevera.com/getFiles.aspx?ourl=megaupload.com",16"rapidshare.com":"zevera.com/getFiles.aspx?ourl=rapidshare.com",17"badongo.com":"zevera.com/getFiles.aspx?ourl=badongo.com",18"depositfiles.com":"zevera.com/getFiles.aspx?ourl=depositfiles.com",19"bitshare.com":"zevera.com/getFiles.aspx?ourl=bitshare.com",20"fileserve.com":"zevera.com/getFiles.aspx?ourl=fileserve.com",21"mediafire.com":"zevera.com/getFiles.aspx?ourl=mediafire.com",22"oron.com":"zevera.com/getFiles.aspx?ourl=oron.com",23"easy-share.com":"zevera.com/getFiles.aspx?ourl=easy-share.com",24"filefactory.com":"zevera.com/getFiles.aspx?ourl=filefactory.com",25"freakshare.com":"zevera.com/getFiles.aspx?ourl=freakshare.com",26"hotfile.com":"zevera.com/getFiles.aspx?ourl=hotfile.com",27"netload.in":"zevera.com/getFiles.aspx?ourl=netload.in",28"2shared.com":"zevera.com/getFiles.aspx?ourl=2shared.com",29"4shared.com":"zevera.com/getFiles.aspx?ourl=4shared.com",30"uploading.com":"zevera.com/getFiles.aspx?ourl=uploading.com",31"megaporn.com":"zevera.com/getFiles.aspx?ourl=megaporn.com",32"wupload.com":"zevera.com/getFiles.aspx?ourl=wupload.com",33"uploadstation.com":"zevera.com/getFiles.aspx?ourl=uploadstation.com",34"megashare.com":"zevera.com/getFiles.aspx?ourl=megashare.com",35"megashares.com":"zevera.com/getFiles.aspx?ourl=megashares.com",36"kickload.com":"zevera.com/getFiles.aspx?ourl=kickload.com",37"filesonic.com":"zevera.com/getFiles.aspx?ourl=filesonic.com"};3839404142//////////////////////////////////////////////////////////////////////////////43// This is where the real code is44// Don't edit below this45//////////////////////////////////////////////////////////////////////////////4647// prepareRegex by JoeSimmons48// Used to take a string and ready it for use in new RegExp()49String.prototype.prepareRegex = function() {50return this.replace(/([\[\]\^\&\$\.\(\)\?\/\\\+\{\}\|])/g, "\\$1");51};5253function isOkTag(tag) {54return (",pre,blockquote,code,input,button,textarea".indexOf(","+tag) == -1);55}5657var regexs=new Array(),58	replacements=new Array();59for(var word in words) {60if(word != "") {61regexs.push(new RegExp("\\b"+word.prepareRegex().replace(/\*/g,'[^ ]*')+"\\b", 'gi'));62replacements.push(words[word]);63}64}6566var texts = document.evaluate(".//text()[normalize-space(.)!='']",document.body,null,6,null), text="";67for(var i=0,l=texts.snapshotLength; (this_text=texts.snapshotItem(i)); i++) {68	if(isOkTag(this_text.parentNode.tagName.toLowerCase()) && (text=this_text.textContent)) {69	for(var x=0,l=regexs.length; x<l; x++) {70	text = text.replace(regexs[x], replacements[x]);71	this_text.textContent = text;72	}73	}
...

Full Screen

Full Screen

getFiles.test.js

Source:getFiles.test.js Github

copy

Full Screen

...18      ].sort();19    }20  });21  test('Get all files in entered filetypes', () => {22    const result = getFiles('./testData/getFiles/', [23      '.js',24      '.ts',25      '.haml',26      '.html'27    ]);28    expect(result.sort()).toEqual(mustBe);29  });30  test('Get all js files', () => {31    const result = getFiles('./testData/getFiles/', ['.js']);32    const jsFiles = [mustBe[0], mustBe[3]];33    expect(result.sort()).toEqual(jsFiles);34  });35  test('Function return empty array, if target node_modules', () => {36    const result = getFiles('./node_modules/', [37      '.js',38      '.ts',39      '.haml',40      '.html'41    ]);42    expect(result.sort()).toEqual([]);43  });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('My First Test', () => {2  it('Gets, types and asserts', () => {3    cy.contains('type').click()4    cy.url().should('include', '/commands/actions')5    cy.get('.action-email')6      .type('

Full Screen

Using AI Code Generation

copy

Full Screen

1Cypress.Commands.add('getFiles', { prevSubject: 'element' }, (subject, selector) => {2    cy.wrap(subject).find(selector).then($el => {3        return new Promise(resolve => {4            $el.on('change', e => {5                resolve(e.target.files)6            })7        })8    })9})10Cypress.Commands.add('getFiles', { prevSubject: 'element' }, (subject, selector) => {11    cy.wrap(subject).find(selector).then($el => {12        return new Promise(resolve => {13            $el.on('change', e => {14                resolve(e.target.files)15            })16        })17    })18})19Cypress.Commands.add('getFiles', { prevSubject: 'element' }, (subject, selector) => {20    cy.wrap(subject).find(selector).then($el => {21        return new Promise(resolve => {22            $el.on('change', e => {23                resolve(e.target.files)24            })25        })26    })27})28Cypress.Commands.add('getFiles', { prevSubject: 'element' }, (subject, selector) => {29    cy.wrap(subject).find(selector).then($el => {30        return new Promise(resolve => {31            $el.on('change', e => {32                resolve(e.target.files)33            })34        })35    })36})37Cypress.Commands.add('getFiles', { prevSubject: 'element' }, (subject, selector) => {38    cy.wrap(subject).find(selector).then($el => {39        return new Promise(resolve => {40            $el.on('change', e => {41                resolve(e.target.files)42            })43        })44    })45})46Cypress.Commands.add('getFiles', { prevSubject: 'element' }, (subject, selector) => {47    cy.wrap(subject).find(selector).then($el => {48        return new Promise(resolve => {49            $el.on('change', e => {50                resolve(e.target.files)51            })52        })53    })54})55Cypress.Commands.add('getFiles', { prevSubject: 'element' }, (subject, selector) => {56    cy.wrap(subject).find(selector).then($el => {57        return new Promise(resolve => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const cypress = require('cypress')2cypress.run({3}).then((results) => {4  console.log(results)5})6{7}8const cypress = require('cypress')9cypress.run({10}).then((results) => {11  console.log(results)12})13{14}15const cypress = require('cypress')16cypress.run({17}).then((results) => {18  console.log(results)19})20{21}22const cypress = require('cypress')23cypress.run({24}).then((results) => {25  console.log(results)26})27{28}29const cypress = require('cypress')30cypress.run({31}).then((results) => {32  console.log(results)33})34{35}36const cypress = require('cypress')37cypress.run({38}).then((results) => {39  console.log(results)40})41{42}43const cypress = require('cypress')44cypress.run({45}).then((results) => {46  console.log(results)47})48{49}50const cypress = require('cypress')51cypress.run({52}).then

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test', () => {2  it('test', () => {3    cy.getFiles('test.txt')4  })5})6Cypress.Commands.add('getFiles', (fileName) => {7  cy.readFile('test.txt').then((fileContent) => {8    cy.log(fileContent)9  })10})

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('test', () => {2  it('test', () => {3    cy.getFiles('test', { timeout: 15000 }).then((files) => {4      expect(files.length).to.be.greaterThan(0);5    });6  });7});8Cypress.Commands.add('getFiles', (folderPath, options = {}) => {9  const { timeout = 5000 } = options;10    .task('getFiles', folderPath, { timeout })11    .then((files) => files.map((file) => file.replace(/\\/g, '/')));12});13const fs = require('fs');14const path = require('path');15module.exports = (on, config) => {16  on('task', {17    getFiles(folderPath) {18      return getFiles(folderPath);19    },20  });21};22function getFiles(folderPath) {23  return new Promise((resolve, reject) => {24    fs.readdir(folderPath, (err, files) => {25      if (err) {26        reject(err);27      } else {28        const filePaths = files.map((file) => path.join(folderPath, file));29        resolve(filePaths);30      }31    });32  });33}34{35  "testFiles": "**/*.{feature,features}",36  "env": {37  },38  "testFiles": "**/*.{js,jsx,ts,tsx,feature,features}"39}

Full Screen

Using AI Code Generation

copy

Full Screen

1describe('Test for the file upload', () => {2  it('Upload a file', () => {3    cy.get('#file-upload').attachFile('sample.txt')4  })5})6describe('Test for the file upload', () => {7  it('Upload a file', () => {8    cy.get('#file-upload').attachFile('sample.txt', { subjectType: 'drag-n-drop' })9  })10})11describe('Test for the file upload', () => {12  it('Upload a file', () => {13    cy.get('#file-upload').attachFile(['sample.txt', 'sample2.txt'])14  })15})16describe('Test for the file upload', () => {17  it('Upload a file', () => {18    cy.get('#file-upload').attachFile(['sample.txt', 'sample2.txt'], { subjectType: 'drag-n-drop' })19  })20})21describe('Test for the file upload', () => {22  it('Upload a file', () => {23    cy.get('#file-upload').attachFile('sample.txt', { subjectType: 'drag-n-drop

Full Screen

Cypress Tutorial

Cypress is a renowned Javascript-based open-source, easy-to-use end-to-end testing framework primarily used for testing web applications. Cypress is a relatively new player in the automation testing space and has been gaining much traction lately, as evidenced by the number of Forks (2.7K) and Stars (42.1K) for the project. LambdaTest’s Cypress Tutorial covers step-by-step guides that will help you learn from the basics till you run automation tests on LambdaTest.

Chapters:

  1. What is Cypress? -
  2. Why Cypress? - Learn why Cypress might be a good choice for testing your web applications.
  3. Features of Cypress Testing - Learn about features that make Cypress a powerful and flexible tool for testing web applications.
  4. Cypress Drawbacks - Although Cypress has many strengths, it has a few limitations that you should be aware of.
  5. Cypress Architecture - Learn more about Cypress architecture and how it is designed to be run directly in the browser, i.e., it does not have any additional servers.
  6. Browsers Supported by Cypress - Cypress is built on top of the Electron browser, supporting all modern web browsers. Learn browsers that support Cypress.
  7. Selenium vs Cypress: A Detailed Comparison - Compare and explore some key differences in terms of their design and features.
  8. Cypress Learning: Best Practices - Take a deep dive into some of the best practices you should use to avoid anti-patterns in your automation tests.
  9. How To Run Cypress Tests on LambdaTest? - Set up a LambdaTest account, and now you are all set to learn how to run Cypress tests.

Certification

You can elevate your expertise with end-to-end testing using the Cypress automation framework and stay one step ahead in your career by earning a Cypress certification. Check out our Cypress 101 Certification.

YouTube

Watch this 3 hours of complete tutorial to learn the basics of Cypress and various Cypress commands with the Cypress testing at LambdaTest.

Run Cypress 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