NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Sideline Tool- Qops // @run-at document-end // @version 1.7 // @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 // @grant GM_addStyle // @namespace kalpsdj // @author Shjaisw // @updateURL https://openuserjs.org/meta/kalpdev.1/Sideline_Tool-_Qops.meta.js // @downloadURL https://openuserjs.org/install/kalpdev.1/Sideline_Tool-_Qops.user.js // @resource buttonCSS https://raw.githubusercontent.com/necolas/css3-github-buttons/master/gh-buttons.css // @resource bootstrapCSS https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css // @updateURL https://openuserjs.org/meta/kalpdev.1/Battery_Word_Counter.meta.js // @require https://code.jquery.com/jquery-3.3.1.min.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 // @require https://code.jquery.com/jquery-3.3.1.min.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 // @require https://gist.github.com/raw/2625891/waitForKeyElements.js //@require https://cdn.jsdelivr.net/npm/sweetalert2@10 // @grant GM_xmlhttpRequest // @grant GM_registerMenuCommand // @grant GM_setValue // @grant GM_getValue // @grant GM_addStyle // @grant GM_addStyle // @grant GM_xmlhttpRequest // @grant GM_getResourceText // @grant GM_getResourceURL // @license MIT // ==/UserScript== /*- The @grant directive is needed to work around a design change introduced in GM 1.0. It restores the sandbox. */ GM_addStyle(` .lookup-custom-height { z-index:10000000; } `); function addCustomSearchResult (jNode) { 'use strict'; 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() : ''; const sidelineButton = document.querySelector('#dtSearch > div.sideline-asin-container > sideline-work-item > button') $('.sideline-asin-container').click(function(){ setTimeout(function(){ add_description(); }, 100); function add_description(){ var toastMixin = Swal.mixin({ toast: true, icon: 'success', title: 'General Title', animation: false, position: 'top-left', showConfirmButton: false, customClass: 'lookup-custom-height', timer: 4000, timerProgressBar: true, didOpen: (toast) => { toast.addEventListener('mouseenter', Swal.stopTimer) toast.addEventListener('mouseleave', Swal.resumeTimer) } }); Swal.fire({ icon: 'question', title: 'Select the Valid reason of this Sideline ', backdrop: ` rgba(5,59,37,0.19) left top no-repeat `, showCancelButton: true, focusConfirm: false, allowOutsideClick: false, allowEscapeKey: false, html: `<select name="Reason" id="reason" style="font-size:large;" > placeholder="Reason" <option value="Multiple Document">Multiple Document</option> <option value="Qbuzz">Qbuzz</option><option value="Already Qbuzz">Already Qbuzz</option> <option value="StockRoom">StockRoom</option> <option value="DeepSea">DeepSea</option> <option value="Tool Issue">Tool Issue</option> </select> <p type="password" id="password" display="none" placeholder="asinnumber"> <p type="reason" id="reason" display="none" placeholder="Reason">`, confirmButtonText: 'Submit Reason <i class="fa fa-arrow-right"></i>', showCancelButton: false, focusConfirm: false, footer: `<a type="button" target="_blank" rel="noopener noreferrer" href="http://pnq-412gv7q.ant.amazon.com:8087/Stockroom/index"><i class="fa fa-arrow-right"></i> StockRoom <i class="fa fa-arrow-left"></i></a> `, preConfirm: () => { const reason = Swal.getPopup().querySelector('#reason').value; GM_xmlhttpRequest({ method: "POST", url: "http://pnq-412gv7q.ant.amazon.com:8087/sideline_tool/save_entry", data: "username="+username+"&asin="+asin+"&reason="+reason, headers: { "Content-Type": "application/x-www-form-urlencoded" }, onload: function(response) { //alert(response.responseText); } }); return { login: username, password: asin , reason: reason} } }).then((result) => { toastMixin.fire(` *Reason Submited* User-Id: ${result.value.login} Reason: ${result.value.reason} ${result.value.password} `.trim()) }) } }); } 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!"); } // GM_xmlhttpRequest({ // method: "POST", // url: "http://pnq-412gv7q.ant.amazon.com:8083/sideline/", // data: "username="+username+"&asin="+product_asin+"&alert_msg="+alert_msg, // headers: { // "Content-Type": "application/x-www-form-urlencoded" // },