Created
          December 31, 2019 18:11 
        
      - 
      
 - 
        
Save SmugZombie/e5b6e8e4112564066c5534b94aa1fdac to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // ==UserScript== | |
| // @name Porkbun PriceScanner | |
| // @namespace Github.com/Smugzombie | |
| // @version 0.1 | |
| // @description Scans Porkbun's Domain Page for Best Priced Domains | |
| // @author SmugZombie | |
| // @match https://porkbun.com/checkout/search?q=*&all=1 | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| window.myPrice = 10.00 // The highest I want to pay Right now for domains | |
| $( "body" ).append( "<div style='position: absolute; top: 70px; left: 10px; width: 150px; height: 75px; background-color: red; z-index: 1000; padding: 10px;'><button id='PriceScanner'>ScanPrices</button></div>" ); | |
| function scanPrices(){ | |
| $.each( $(".childContent"), function( key, value ) { | |
| //console.log($(".childContent")[key].innerText.match(/\$\S+/g)) | |
| var parent_node = $(".childContent")[key].parentNode.parentNode; | |
| var domain = $(".childContent")[key].parentNode.parentNode.children[0].innerText | |
| var prices = $(".childContent")[key].innerText.match(/\$\S+/g) | |
| if(prices){ | |
| console.log(prices) | |
| $.each( prices, function( key2, value2 ) { | |
| var number = Number(value2.replace(/[^0-9.-]+/g,"")); | |
| if(number <= window.myPrice){ | |
| console.log("Found a cheap one! ["+domain+"]"); | |
| $(".childContent")[key].parentNode.parentNode.classList.add("cheap"); | |
| $(".childContent")[key].parentNode.parentNode.style.backgroundColor = "green"; | |
| $(".childContent")[key].parentNode.parentNode.style.color = "white"; | |
| }else{ | |
| if(!$(".childContent")[key].parentNode.parentNode.classList.contains( "cheap" )){ | |
| $(".childContent")[key].parentNode.parentNode.style.backgroundColor = "yellow"; | |
| $(".childContent")[key].parentNode.parentNode.style.color = "black"; | |
| } | |
| } | |
| }); | |
| } | |
| }); | |
| } | |
| $("#PriceScanner").click (scanPrices); | |
| })(); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment