Skip to content

Instantly share code, notes, and snippets.

@itsazzad
Last active March 31, 2024 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsazzad/e77b21358ec606144a745491e33ee3db to your computer and use it in GitHub Desktop.
Save itsazzad/e77b21358ec606144a745491e33ee3db to your computer and use it in GitHub Desktop.
freelancer.com
const MAX = 352;
document.querySelectorAll("fl-list-item").forEach(item=>{
const bidsEntryData = item.querySelector(".BidEntryData");
if(bidsEntryData){
const bids=bidsEntryData.textContent.match(/\d+/)[0];
if(+bids<MAX/100||+bids>MAX/10){
item.querySelectorAll(".BitsListItemHeader.HasHoverState").forEach(bitsItem=>{bitsItem.style.backgroundColor = "blue";});
}
}
});
class RegExp1 extends RegExp {
[Symbol.split](str, limit) {
const result = RegExp.prototype[Symbol.split].call(this, str, limit);
return result.map(x => x.trim());
}
}
const skillsByName = {};
const skillsByCount = {};
const sections = document.querySelectorAll("#browseCategories > div > section")
for (let section of sections) {
const lis = section.querySelectorAll("ul > li");
for (let li of lis) {
const as = li.querySelectorAll("a");
let skillName = "";
let jobCount = 0;
for (let a of as) {
const splitted = a.textContent.split(new RegExp1(/\(|\)/))
if(splitted[0]){
skillName = splitted[0];
}
jobCount+=parseInt(splitted[splitted.length - 2]);
}
skillsByName[skillName] = jobCount;
if(!skillsByCount[jobCount]){
skillsByCount[jobCount] = [];
}
skillsByCount[jobCount].push(skillName);
}
}
console.log(skillsByCount)
console.log(skillsByName)
const skills = <GET_FROM_CATEGORIES>;
const list = document.querySelectorAll("fl-stat-type-list > div > ul li");
list.forEach(item => {
const span = item.querySelector("span");
const skill = span.textContent.trim();
const newtext = document.createTextNode(skills[skill] + ":\t");
span.prepend(newtext)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment