Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name freelancer.com country filter
- // @namespace https://drawcode.eu/
- // @include https://www.freelancer.com/projects/*
- // @version 1
- // @grant none
- // ==/UserScript==
- /*
- // script to run in web console (e.g. in a separate Firefox profile to avoid new tab focus and tabs overflow)
- var links = document.getElementsByClassName("JobSearchCard-primary-heading");
- var length = links.length;
- var i = -1;
- (function searchJobs() {
- ++i;
- if (i < length) {
- if (links[i].children.length > 2) { // "links[i].children.length > 2" can decrease spam by only opening job offers with verified payment method (remove the if condition and else block if you want to see these jobs)
- window.open(links[i].firstElementChild.href);
- setTimeout(function(){searchJobs();}, 5000); // open new URL every 5 seconds (could be changed without breaking the script)
- }
- else {
- searchJobs();
- }
- }
- })();
- */
- var found = false;
- var targetNode = document.getElementsByTagName("app-root")[0];
- var config = {childList: true, subtree: true};
- var callback = function(mutationsList, observer) {
- for (var i = 0; found != true; ++i) {
- if (mutationsList[i].addedNodes[0].nodeName == "FL-CARD") {
- // only search country flag if we got a correct node name
- var flag = document.getElementsByClassName("FlagImage")[0];
- if (flag) {
- found = true;
- observer.disconnect();
- var country = flag.title;
- // add or remove country codes as needed
- if (country != "gb" && // GB is used instead of UK
- country != "ie" &&
- country != "fr" &&
- country != "de" &&
- country != "ch" &&
- country != "es" &&
- country != "pt" &&
- country != "it" &&
- country != "be" &&
- country != "lu" &&
- country != "nl" &&
- country != "dk" &&
- country != "at" &&
- country != "se" &&
- country != "fi" &&
- country != "no" &&
- country != "is") {
- window.close();
- }
- }
- }
- }
- };
- var observer = new MutationObserver(callback);
- observer.observe(targetNode, config);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement