NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Sideline auto internal2 // @run-at document-body // @match https://argus.aka.amazon.com/* // @include https://argus.aka.amazon.com/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @require https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/jquery.mark.es6.min.js // @require https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js // @license MIT //@require https://cdn.jsdelivr.net/npm/sweetalert2@10 // @grant GM_addStyle // @match http://pnq-412gv7q.ant.amazon.com:8087/* // @grant GM_xmlhttpRequest // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ function addCustomSearchResult (jNode) { //$(".submit-product-card-classification").hide (); $('.submit-product-card-classification').click(function(){ setTimeout(function(){ add_description(); }, 100); function add_description(){ var usernameElement = document.querySelector('.spoof-user-badge-pic'); var username = usernameElement ? usernameElement.alt : null; var asinElement = document.querySelector('span.ng-binding'); var asin = asinElement ? asinElement.innerText.trim() : ''; GM_xmlhttpRequest({ method: "POST", url: "http://pnq-412gv7q.ant.amazon.com:8087/sdj/save_entry", data: "username="+username+"&asin="+asin, headers: { "Content-Type": "application/x-www-form-urlencoded" }, onload: function(response) { const sidelineButton = document.querySelector('#dtSearch > div.sideline-asin-container > sideline-work-item > button') // get the sideline button alert(response.responseText); if (response.responseText === "qbuzz") { // Perform actions for Condition 1 sidelineButton.click(); const finalconfirm = setInterval(function () { const slButton = document.querySelector("body > div.sweet-alert.showSweetAlert.visible > div.sa-button-container > div > button") if (slButton) { slButton.click(); clearInterval(finalconfirm); // document.location.reload(true); } }, 200); // Add your desired commands here } else if (response.responseText === "Condition 2") { // Perform actions for Condition 2 console.log("Condition 2 is met."); // Add your desired commands here } else { // Perform actions for other conditions console.log("fresh asin"); // fresh asin } // console.log(response.responseText); // alert(response.responseText); } }); // $('md-tab-item[aria-label="Extended battery attributes from the catalog"]').trigger('click'); //alert("Hey"); //console.log("Heyyyyyyy"); // $('md-tab-item[aria-label="Extended battery attributes from the catalog"]').trigger('click'); // setTimeout(function(){ var n = attribute(); console.log("Str is : " + n); var keyword = "American"; if(n.includes("lithium_polymer")==true || n.includes("lithium_ion") || n.includes("lithium_metal")==true || n.includes("lithium_manganese_dioxide") || n.includes("lithium")==true || n.includes("cr2") || n.includes("cr123a")==true || n.includes("cr123") || n.includes("LiMnO2")==true || n.includes("batteries_packed_with_equipment") || n.includes("batteries_contained_in_equipment")==true || n.includes("batteries_only")) { alert('Please Check Battery Attributes'); } }, 1000); // function attribute(){ // var active_data7= $('.ng-scope').text(); //console.log("Battery string is : " + active_data7); // return (active_data7); // } ////var active_data = $('.ng-isolate-scope').text(); //console.log("Active string is : " + active_data); var batt = $('.md-dg-theme').text(); document.querySelector('#dt-list-select-400-ni-mh').style.display = 'none'; ////console.log("Bat Attri is : " + batt); } //alert("Hey"); //console.log("Heyyyyyyy"); }); } var url= window.location.href; var isArgusDG = /^https:\/\/argus.aka.amazon.com\/#!\/dg(.*)/i.test(url); if (isArgusDG){ console.log("This is an Argus DG Page!"); waitForKeyElements (".submit-product-card-classification", addCustomSearchResult); }else{ console.log("This is not an Argus DG Page!"); }