kalpdev.1 / ICE-Pop

// ==UserScript==
// @name     ICE-Pop
// @author   support-@shjaisw 
// @match    https://argus.aka.amazon.com/*
// @include  https://argus.aka.amazon.com/*
// @require     https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js
// @require     https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js
// @updateURL https://openuserjs.org/meta/kalpdev.1/ICE-Pop.meta.js
// @downloadURL https://openuserjs.org/install/kalpdev.1/ICE-Pop.user.js
// @require     https://gist.github.com/raw/2625891/waitForKeyElements.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
// @resource    githubButtonIconSet https://raw.githubusercontent.com/necolas/css3-github-buttons/master/gh-icons.png
// @grant       GM_xmlhttpRequest
// @grant       GM_addStyle
// @license MIT
// @version    0.1
// @grant       GM_getResourceText
// @grant       GM_getResourceURL
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
    introduced in GM 1.0.   It restores the sandbox.
*/
console.log("Start");

document.head.appendChild(cssElement(GM_getResourceURL ("githubButtonIconSet")));
document.head.appendChild(cssElement(GM_getResourceURL ("buttonCSS")));
document.head.appendChild(cssElement(GM_getResourceURL ("bootstrapCSS")));

function cssElement(url) {
  $("#category").removeClass("hidden");
  var link = document.createElement("link");
  link.href = url;
  link.rel="stylesheet";
  link.type="text/css";
  return link;
}

function addCustomSearchResult (jNode) {
$("#finishProductButton").hide ();

//    jNode.append (
//        '<button class="select-card clp-accent-card answer-select md-button md-clp-theme md-whiteframe-1dp" type="button" id="click_me" class="click_me" >Finish Product</button>'
//   );
//
//    jNode.append (
//        '<div class="button-group"><a type="button" class="btn btn-primary btn-sm" data-toggle="modal" id="click_me" data-target="#myModal">Finish Product</a></div>'
//    );

    //$("#tabstrip").before(deleteButtonHtml);

    $('#click_me').click(function(){


    var modalHtml = `
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Project Pawn - Alert Message</h4>
      </div>
      <div class="modal-body">

        <center><span id="alert_msg_section2" style="font-size: 18px;font-weight: bold;"></span></center><br><br>
        <center><span id="oalert_msg_section1" style="font-size: 18px;font-weight: bold;"></span></center><br>
        <center><span id="oalert_msg_section2" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section3" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section4" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section5" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section6" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section7" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section8" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section9" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section10" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section11" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section12" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section13" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section14" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section15" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section16" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section17" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section18" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section19" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section20" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section21" style="font-size: 18px;font-weight: bold;"></span></center><br>
<center><span id="oalert_msg_section22" style="font-size: 18px;font-weight: bold;"></span></center><br>


      </div>
      <div class="modal-footer">
        <a type="button" class="btn btn-default closeButton" data-dismiss="modal">Close</a>
      </div>
    </div>
  </div>
</div>
`;

$("body").prepend(modalHtml);

        var product_title = $("#dtTools").text();
        product_title = product_title.trim();      // Title

        var product_asin = $("#workItemContainer").text();
        product_asin = product_asin.trim();      // Title
        //alert(product_asin);

        //var v = document.getElementsByClassName(".spoof-user-badge-pic").alt;
        var username = jQuery(".spoof-user-badge-pic").attr('alt');
        //alert("Username is : " + v);


        //alert(product_title);

        var batt = $('md-radio-button[aria-checked="true"]').text();
        var batt1 = $('md-radio-button[aria-checked="false"]').text();
        var mapObj = {
            None:"",
            LEHS3:"",
            LEHS6:"",
            1:"",
            2:"",
            3:"",
            4:"",
            5:"",
            6:"",
            7:"",
            8:"",
            9:"",
            10:"",
            11:"",
            12:"",
            13:"",
            14:"",
            15:"",
            16:"",
            17:"",
            18:"",
            19:"",
            20:"",
        };

        batt1 = batt1.replace(/None|LEHS3|LEHS6|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20/gi, function(matched){
            return mapObj[matched];
        });

        batt = batt.replace(/None|LEHS3|LEHS6|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20/gi, function(matched){
            return mapObj[matched];
        });

        //batt1=batt1.replace("LEHS6", "");
        //var batt = $(".detail-wrapper").text();
        batt = batt.trim();      // Batt
        batt1 = batt1.trim();      // Batt
        batt1 = batt1.replace(/(\r\n|\n|\r|)/gm, "");
        batt1 = batt1.replace(/ /g,'-');
        batt1 = batt1.replace("--------------------",'-');
        batt1 = batt1.split("-");
        //batt1 = batt1.split(" ");

        batt = batt.replace(/(\r\n|\n|\r|)/gm, "");
        batt = batt.replace(/ /g,'-');
        batt = batt.replace("0----------------------------------------------------------------------------",'');
        batt1.push(batt);
        batt1 = batt1.filter(item => item);

        var i;
        var j;
        var k;
        var sstr = "";
        var final_string = "";
        var cmbnd_string = "";
        var cmbnd_string1 = "";
        var final_string1 = "";
        //var product_title = "";
        var product_title_string = "";

        var active_fs = [];

        for (j = 0; j <= batt1.length-1; j++) {
            $('md-radio-button[aria-label="' + batt1[j] + '"]').trigger('click');
        var active_data = $('.ng-isolate-scope').text();
        active_data = active_data.trim();
        active_data = active_data.split("ArgusDG  Dashboard Feedback Loop Dashboard History Get WorkRW  Assistant Smart Sample Similar ASINs Model Authoring WorkflowTime Tracker  Track User Preferences DownloadPublic  Sampling CalculatorDG Dashboard Feedback Loop Dashboard History Get WorkRW Assistant Smart Sample Similar ASINs Model Authoring WorkflowTime Tracker Track User Preferences DownloadPublic Sampling CalculatorHow are we doing?CloseTell us how you're feelingDelightedSatisfiedDisappointedThank You! We appreciate your feedback.Delight error!There was a problem providing feedback.  Either this site has not been configured properly, or there is a problem with the feedback system.  Please contact the delight.amazon.com maintainers here").join(" ");
        active_data = active_data.split("\t").join(" ");
        active_data = active_data.split("    ").join(" ");
        active_data = active_data.split("\n\n").join(" ");
        active_data = active_data.split("  ").join(" ");
        console.log("-------------");
            cmbnd_string = cmbnd_string + "\n\n" + active_data + "\n";

        }

        final_string = cmbnd_string.replace(/(UPC|UNID|truePSN|Trouble Ticketing|Wercsmart|MSDS Online|Google|Yahoo|Bing|State|Search|REVIEWED|Review Summary|nh|Product Type Guide|PCA|Packing Group|No resources|No competitors|Mark all as Read Wikipage Open a SIM|HTRC|Hazmat Exceptions|Group GL|gl_beauty|GHS Statements|GHS Classification Class (Supplier Input)|EU 2008 Labeling Risks|EU 2008 Labeling Hazard|EAN|CSI Data ViewerAlaska|CATALOG REVIEWSDSDESCRIPTION|CATALOG REVIEWSDS|Amazon Tools|UNID|Open All Unread)/gm, "");

var selected_classification = $("#dtProductFinal .easy-code-statement").text();
selected_classification = selected_classification.trim();
var active_data7 = "";
         var keyword_list1 = "";
	 var keyword_list2 = "";
	 var keyword_list3 = "";
	 var keyword_list4 = "";
	 var keyword_list5 = "";
	 var keyword_list6 = "";
	 var keyword_list7 = "";
	 var keyword_list8 = "";
	 var keyword_list9 = "";
	 var keyword_list10 = "";
	 var keyword_list11 = "";
	 var keyword_list12 = "";
	 var keyword_list13 = "";
     var keyword_list14 = "";
var arr2 = { "lithium_ion" : "nh", "lithium_ion" : "9mi,9mw,9ms,ub,u3a,u3b,u", "lithium_metal" : "nh,9ii,9iw,9is,ub,u3a,u3b,u", "batteries_contained_in_equipment" : "nh,9ms,9is,ub,u3a,u3b,u,9iw,9mw", "batteries_packed_with_equipment" : "nh,9ms,9is,ub,u3a,u3b,u,9ii,9mi", "batteries_only" : "9ii,9mi", "alkaline" : "ub,u3a,u3b,u,9mw,9mi,9ms,9ii,9iw,9is", "lithium_polymer" : "nh,9mw,9mi,9ms,ub,u3a,u3b,u", "lithium_manganese_dioxide" : "nh,ub,u3a,u3b,u", "lithium_manganese_oxide" : "nh,ub,u3a,u3b,u", "lithium" : "nh,9mw,9mi,9ms,ub,u3a,u3b,u", "cr2" : "nh,9iw,9ii,9is,ub,u3a,u3b,u", "cr123a" : "nh,ub,u3a,u3b,u", "cr123" : "nh,ub,u3a,u3b,u", "LiMnO2" : "nh,ub,u3a,u3b,u", "cr2032":"nh,9ii,9iw,9is,ub,u3a,u3b,u", "Li-Ion" : "nh,9mw,9mi,9ms,ub,u3a,u3b,u", "NiMh" : "ub,u3a,u3b,u", "NiCd" : "ub,u3a,u3b,u"};
var flag7 = 0;
var alert_msg7 = "";
var alert_msg1 = "";
var alert_msg2 = "";
var alert_msg5 = "";
var oalert_msg1 = "";
var oalert_msg2 = "";
var oalert_msg3 = "";
var oalert_msg4 = "";
var oalert_msg5 = "";
var oalert_msg6 = "";
var oalert_msg7 = "";
var oalert_msg8 = "";
var oalert_msg9 = "";
var oalert_msg10 = "";
var oalert_msg11 = "";
var oalert_msg12 = "";
var oalert_msg13 = "";
var oalert_msg14 = "";

        var oflag1 = 0;
        var oflag2 = 0;
        var oflag3 = 0;
        var oflag4 = 0;
        var oflag5 = 0;
        var oflag6 = 0;
        var oflag7 = 0;
        var oflag8 = 0;
        var oflag9 = 0;
        var oflag10 = 0;
        var oflag11 = 0;
        var oflag12 = 0;
        var oflag13 = 0;
        var oflag14 = 0;

final_string = final_string.toLowerCase();

var msge1 = {
"headphone" : "ub, u3a, u3b", "earphone" : "ub, u3a, u3b", "ear-phone" : "ub, u3a, u3b", "desktop": "9ii, ub, 9mi, 9mw", "pc" : "9ii, ub, 9mi, 9mw", "motherboard" : "9ii, 9iw, ub, 9mi, 9mw", "toothbrush" : "ub, u3a, u3b", "ups" : "8nsb, 9ii, 9iw, ub, u, 9mi, 9mw",  "uninterrupted" : "8nsb, 9ii, 9iw, ub, u, 9mi, 9mw", "keyboard" : "ub, u3a, u3b", "keyboard for tablet" : "ub u3a, u3b", "key fob" : "nh, ub, 9mw, 9iw", "keyless remote control" : "nh, ub", "mobile phone" : "nh, ub", "smartphone" : "nh, ub", "clip on tuner" : "nh, ub", "clip-on tuner" : "nh, ub, u3a, u3b", "tuner" : "nh, ub, u3a, u3b", "ride on" : "9ii, 9iw, 9mbe, 9fr", "ride-on" : "9ii, 9iw, 9mbe, 9fr", "Scooter" : "9ii, 9iw, 9mbe, 9fr", "apple" : "9iw", "ipod"  : "9iw", "laptop" : "ub, u3a, u3b", "macbook" : "9iw", "electronic lighter" : "u, ub, u3a,u3b, 9iw, 9mi, 9mw", "rechargeable lighter" : "u, ub, u3a,u3b, 9iw, 9mi, 9mw", " bluetooth speaker" : "ub,u3a, u3b, 9iw, 9mw", "laptop"  : "nh, u3a, u3b, ub", "notebook" : "nh, ub", "card style" : "nh, 9iw, 9mw, ub", "24 key remote control" : "nh, 9iw, 9mw, ub", "power bank" : "ub, u3a, u3b, 9iw, 9ii", "smartwatch" : "ub, u3a, u3b", "smart watch" : "ub, u3a, u3b", "fitness tracker" : "ub, u3a, u3b", "spy watch" : "ub, u3a, u3b", "gps watch" : "ub, u3a, u3b", "fit band" : "ub, u3a, u3b", "hybrid watch" : "ub, u3a, u3b", "tablet" : "ub, u3a, u3b", "vibrator" : "ub, u3a, u3b", "magic wand" : "ub, u3a, u3b", "massager" : "ub, u3a, u3b", "earbud" : "9ii, ub, u3a, u3b",  "charging case" : "9ii, 9mi, 9mw, ub, u3a, u3b", "battery box" : "9ii, ub", "controller box" : "9ii, ub", "quartz" : "ub, u3a, u3b, 9ii, 9iw", "digital" : "ub, u3a, u3b, 9ii, 9iw", "solar" : "ub, 9ii, 9iw", "eco drive" : "ub, 9ii, 9iw", "eco tech time watches" : "ub, 9ii, 9iw", "non-rechargeable hybrid watch" : "ub, 9ii, 9iw", "drone" : "ub, u3a, u3b", "drones" : "ub, u3a, u3b", "tire pressure monitoring sensor" : "9ii, 9mi, 9mw, ub, u3a, u3b", "TPMS" : "9ii, 9mi, 9mw, ub, u3a, u3b", "tire pressure monitoring system" : "9ii, 9mi, 9mw, ub, u3a, u3b", "tire pressure monitor system" :  "9ii, 9mi, 9mw, ub, u3a, u3b", "hoverboard" : "9ii, 9mi, 9mw, ub, u3a, u3b", "hover-board" : "9ii, ub, u3a, u3b, 9mi, 9mw", "light up shoes" : "ub, u3a, u3b", "led shoe" : "ub, u3a, u3b", "light-up shoes" : "ub", "illuminated shoes" : "ub, u3a, u3b", "vape pens" : "9ii, ub, u3a, u3b", "vape pod" : "9ii, ub, u3a, u3b", "e-cigarette" : "9ii, ub, u3a, u3b"
};

for(var OJT1 in msge1)
{
    var value = msge1[OJT1];
  var search_ojt1 = final_string.search(OJT1);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt1>0)
        {
            var ores1 = value.split(",");
            ores1.forEach(function(oentry1)
                      {
			oentry1 = oentry1.trim();
                if(selected_classification==oentry1)
                {
                   oflag1 = 1;
                    //alert("Check");
                   keyword_list1 = keyword_list1 + "," + OJT1;
                }
            });

        }
}

var msge2 = {
    "hand warmer"  : "9ii, 9iw, ub, u3a,u3b", "handwarmer" : "9ii, 9iw, ub, u3a,u3b", "heated jacket" : "9ii, 9iw, 9mi, 9mw, ub, u3a,u3b", "heated gloves" : "9ii, 9iw, 9mi, 9mw, ub, u3a,u3b", "heated appeareal" : "9ii, 9iw, 9mi, 9mw, ub, u3a,u3b", "heated" : "9ii, 9iw, 9mi, 9mw, ub, u3a,u3b"
};

        for(var OJT2 in msge2)
{
     value = msge2[OJT2];
  var search_ojt2 = final_string.search(OJT2);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt2>0)
        {
            var ores2 = value.split(",");
            ores2.forEach(function(oentry2)
                      {
				oentry2 = oentry2.trim();
                if(selected_classification==oentry2)
                {
                   oflag2 = 1;
                    //alert("Check");
                    keyword_list2 = keyword_list2 + "," + OJT2;
                }
            });

        }
}

var msge3 = {
    "nail powder" : "u, u3a, u3b", "acrylic powder" : "u, 3a, u3b", "nail polish" : "u, u3a,u3b", "gel polish" : "u, u3a, u3b", "base coat" : "nh, u, u3a, u3b", "top coat" : "nh, u, u3a, u3b", "hair color" : "u, u3a, u3b", "hand sanitizer" : "nh, u, u3a, u3b", "wet wipe" : "u, u3a,u3b",
"deodorant stick" : "2.1, u, u3a, u3b", "bleaching powder" : "nh", "perfume" : "nh, u, u3a, u3b", "shampoo" : "u, u3a, u3b", "conditioner" : "u, u3a, u3b", "eye care" : "u, u3a,u3b",  "soap" : "u, u3a,u3b", "shower gel" : "u, u3a, u3b", "Hair mask" : "u, u3a, u3b", "Nail polish remover" : "nh, u, u3a, u3b", "tattoo ink" : "u, u3a, u3b", "sunscreen" : "nh", "serum" : "u,u3a, u3b", "makeup remover" : "nh", "make-up remover" : "nh", "whitening" : "nh"
};

for(var OJT3 in msge3)
{
     value = msge3[OJT3];
  var search_ojt3 = final_string.search(OJT3);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt3>0)
        {
            var ores3 = value.split(",");
            ores3.forEach(function(oentry3)
                      {
				oentry3 = oentry3.trim();
                if(selected_classification==oentry3)
                {
                   oflag3 = 1;
                    //alert("Check");
                   keyword_list3 = keyword_list3 + "," + OJT3;
                }
            });

        }
}

var msge4 = {
    "essential oil" : "u, u3a, u3b"
};

        for(var OJT4 in msge4)
{
     value = msge4[OJT4];
  var search_ojt4 = final_string.search(OJT4);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt4>0)
        {
            var ores4 = value.split(",");
            ores4.forEach(function(oentry4)
                      {
				oentry4 = oentry4.trim();
                if(selected_classification==oentry4)
                {
                   oflag4 = 1;
                    //alert("Check");
                   keyword_list4 = keyword_list4 + "," + OJT4;
                }
            });

        }
}


var msge5 = {
    "lighter" : "nh, u, u3a, u3b", "flint" : "nh", "ferrocerium" : "nh, u, u3a, u3b", "ferro" : "nh, u, u3a, u3b", "piezo" : "4.1l"
};

for(var OJT5 in msge5)
{
     value = msge5[OJT5];
  var search_ojt5 = final_string.search(OJT5);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt5>0)
        {
            var ores5 = value.split(",");
            ores5.forEach(function(oentry5)
                      {
				oentry5 = oentry5.trim();
                if(selected_classification==oentry5)
                {
                   oflag5 = 1;
                    //alert("Check");
                   keyword_list5 = keyword_list5 + "," + OJT5;
                }
            });

        }
}

var msge6 = {
    "speakers" : "nh", "woofers" : "nh", "neodymium magnet" : "nh"
};

for(var OJT6 in msge6)
{
     value = msge6[OJT6];
  var search_ojt6 = final_string.search(OJT6);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt6>0)
        {
            var ores6 = value.split(",");
            ores6.forEach(function(oentry6)
                      {
				oentry6 = oentry6.trim();
                if(selected_classification==oentry6)
                {
                   oflag6 = 1;
                    //alert("Check");
                   keyword_list6 = keyword_list6 + "," + OJT6;
                }
            });

        }
}

var msge7 = {
    "marker" : "nh, u, u3a, u3b", "sharpie" : "u, u3a, u3b, nh", "fabric marker" : "4.1mk, custom, u, u3a, u3b",
};

for(var OJT7 in msge7)
{
     value = msge7[OJT7];
  var search_ojt7 = final_string.search(OJT7);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt7>0)
        {
            var ores7 = value.split(",");
            ores7.forEach(function(oentry7)
                      {
				oentry7 = oentry7.trim();
                if(selected_classification==oentry7)
                {
                   oflag7 = 1;
                    //alert("Check");
                   keyword_list7 = keyword_list7 + "," + OJT7;
                }
            });

        }
}

var msge8 = {
    "liquid extracts" : "u, u3a, u3b", "liquid supplements" : "u, u3a, u3b", "Dietery supplement" : "u, u3a, u3b", "supplement" : "u, u3a, u3b", "life saving appliances" : "u, u3a, u3b", "meals" : "u, u3a, u3b", "ready-to-eat" : "u, u3a, u3b", "ready to eat" : "u, u3a, u3b", "mre" : "u, u3a, u3b",
"shock absorbers" : "u, u3a, u3b", "gas springs" : "u, u3a, u3b", "strut" : "u, u3a, u3b", "lift chair" : "u, u3a, u3b", "props" : "u, u3a, u3b", "repair kit" : "u, u3a, u3b"
};

for(var OJT8 in msge8)
{
     value = msge8[OJT8];
  var search_ojt8 = final_string.search(OJT8);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt8>0)
        {
            var ores8 = value.split(",");
            ores8.forEach(function(oentry8)
                      {
				oentry8 = oentry8.trim();
                if(selected_classification==oentry8)
                {
                   oflag8 = 1;
                    //alert("Check");
                   keyword_list8 = keyword_list8 + "," + OJT8;
                }
            });

        }
}

var msge9 = {
    "camphor" : "u, u3a, u3b, nh", "naphthalene" : "u, u3a, u3b, nh"
};

for(var OJT9 in msge9)
{
     value = msge9[OJT9];
  var search_ojt9 = final_string.search(OJT9);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt9>0)
        {
            var ores9 = value.split(",");
            ores9.forEach(function(oentry9)
                      {
				oentry9 = oentry9.trim();
                if(selected_classification==oentry9)
                {
                   oflag9 = 1;
                    //alert("Check");
                    keyword_list9 = keyword_list9 + "," + OJT9;
                }
            });

        }
}

var msge10 = {
    "refrigerator" : "u, u3a, u3b, nh", "fridge" : "u, u3a, u3b, nh", "freezer" : "u, u3a, u3b, nh", "wine cooler" : "u, u3a, u3b, nh", "water cooler" : "u, u3a, u3b, nh", "dehumidifier" : "u, u3a, u3b, nh",
"compressor" : "u, u3a, u3b, nh", "air conditioner" : "u, u3a, u3b, nh", "air-conditioner" : "u, u3a, u3b, nh", "condenser" : "Custom, u, u3a, u3b"
};

for(var OJT10 in msge10)
{
     value = msge10[OJT10];
  var search_ojt10 = final_string.search(OJT10);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt10>0)
        {
            var ores10 = value.split(",");
            ores10.forEach(function(oentry10)
                      {
				oentry10 = oentry10.trim();
                if(selected_classification==oentry10)
                {
                   oflag10 = 1;
                    //alert("Check");
                   keyword_list10 = keyword_list10 + "," + OJT10;
                }
            });

        }
}

var msge11 = {
    "aerosol" : "nh, u, u3a, u3b", "flammable aerosol" : "nh, 2.2"
};

for(var OJT11 in msge11)
{
     value = msge11[OJT11];
  var search_ojt11 = final_string.search(OJT11);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt11>0)
        {
            var ores11 = value.split(",");
            ores11.forEach(function(oentry11)
                      {
				oentry11 = oentry11.trim();
                if(selected_classification==oentry11)
                {
                   oflag11 = 1;
                    //alert("Check");
                   keyword_list11 = keyword_list11 + "," + OJT11;
                }
            });

        }
}

var msge12 = {
    "diamond painting kit" : "u, u3a, u3b", "mosquito repellent " : "u, u3a, u3b", "henna" : "u, u3a, u3b", "talcum" : "u, u3a, u3b", "air freshener" : "u, u3a, u3b",
"glue stick" : "u, u3a, u3b", "glue gun stick" : "u, u3a, u3b", "stickers" : "u, u3a, u3b", "block notes" : "u, u3a, u3b", "spirit bubble level" : "u, u3a, u3b", "surface leveler" : "u, u3a, u3b",
"grease" : "u, u3a, u3b", "glue type" : "u, u3a, u3b", "supplement" : "u, u3a, u3b", "shampoo" : "u, u3a, u3b", "conditioner" : "u, u3a, u3b", "dummy battery" : "ub, u, u3a, u3b", "lightup wheel" : "ub, u, u3a, u3b", "light-up wheel" : "ub, u, u3a, u3b", "light up wheel" : "ub, u, u3a, u3b",
"incense" : "u, u3a, u3b", "clay" : "u, u3a, u3b", "wax " : "u, u3a, u3b", "candle" : "u, u3a, u3b", "ultrasound gel" : "u, u3a, u3b",
"gel pad" : "u, u3a, u3b", "pain relief " : "u, u3a, u3b", "slime" : "u, u3a, u3b", "bubble" : "u, u3a, u3b", "dietary supplement" : "u, u3a, u3b", "pain relief cream" : "u, u3a, u3b",
"granules" : "u, u3a, u3b", "food supplement " : "u, u3a, u3b", "glow in dark" : "u, u3a, u3b", "chemical glow stick" : "u, u3a, u3b", "holy water" : "u, u3a, u3b",
"spring water" : "u, u3a, u3b", "sparkling water" : "u, u3a, u3b", "rose water" : "u, u3a, u3b", "personal lubricant" : "u, u3a, u3b", "incense stick" : "u, u3a, u3b",
"cone stick" : "u, u3a, u3b", "ceramic fire coal" : "u, u3a, u3b", "holi color" : "u, u3a, u3b", "kumkum" : "u, u3a, u3b", "sindoor " : "u, u3a, u3b", "roli" : "u, u3a, u3b",
"kesar tilak" : "u, u3a, u3b", "modelling clay" : "u, u3a, u3b", "beeswax beads " : "u, u3a, u3b", "wax bead" : "u, u3a, u3b", "scented candle" : "u, u3a, u3b", "wick for candle" : "u, u3a, u3b",
"wax roll-on" : "u, u3a, u3b", "fabric softener" : "u, u3a, u3b", "eye pad patch" : "u, u3a, u3b", "foot pad" : "u, u3a, u3b", "herpes patch" : "u, u3a, u3b",
"pet" : "u, u3a, u3b", "water based liquid color " : "u, u3a, u3b", "crayons" : "u, u3a, u3b", "acrylic ink " : "u, u3a, u3b", "bath bombs" : "u, u3a, u3b",
"nicotine gum" : "u, u3a, u3b", "bingo dauber" : "u, u3a, u3b", "repair patche" : "u, u3a, u3b", "plant seed" : "u, u3a, u3b", "mouse correction tape" : "u, u3a, u3b",
"clipper oil " : "u, u3a, u3b", "hot and cold eye mask" : "u, u3a, u3b", "instant pack" : "u, u3a, u3b", "urea based cold pack" : "u, u3a, u3b", "instant cold pack" : "u, u3a, u3b", "silica gel bead" : "u, u3a, u3b", "anointing oil" : "u, u3a, u3b", "anti-cellulite" : "u, u3a, u3b", "anti cellulite" : "u, u3a,u3b", "wall clock" : "ub, u3a, u3b", "wall-clock" : "ub, u3a, u3b", "paint by number" : "u, u3a, u3b", "vermicomposting" : "u,u3a,u3b", "Coco peat" : "u, u3a, u3b", "neem cake" : "u, u3a, u3b", "Cow dung" : "u, u3a, u3b", "charcoal filters" : "u, u3a, u3b", "air purifier bag" : "u, u3a, u3b"
};

for(var OJT12 in msge12)
{
     value = msge12[OJT12];
  var search_ojt12 = final_string.search(OJT12);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt12>0)
        {
            var ores12 = value.split(",");
            ores12.forEach(function(oentry12)
                      {
				oentry12 = oentry12.trim();
                if(selected_classification==oentry12)
                {
                   oflag12 = 1;
                    //alert("Check");
                   keyword_list12 = keyword_list12 + "," + OJT12;
                }
            });

        }
}

var msge13 = {
    "delay spray" : "nh", "pepper spray" : "nh", "dried coconut" : "nh", "coconut" : "nh", "dry coconut" : "nh", "copra" : "nh", "sanitizer" : "nh", "Bitter" : "u, u3a, u3b", "monomer" : "nh, 9el, 9es, 3cl"
};

for(var OJT13 in msge13)
{
     value = msge13[OJT13];
  var search_ojt13 = final_string.search(OJT13);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt13>0)
        {
            var ores13 = value.split(",");
            ores13.forEach(function(oentry13)
                      {
				oentry13 = oentry13.trim();
                if(selected_classification==oentry13)
                {
                   oflag13 = 1;
                    //alert("Check");
                   keyword_list13 = keyword_list13 + "," + OJT13;
                }
            });

        }
}

var msge14 = {
    "fairy lights" : "nh", "string light" : "nh", "light strip" : "nh", "strip light" : "nh", "rgb light" : "nh", "led strip" : "nh", "rgb remote" : "nh",
};

for(var OJT14 in msge14)
{
     value = msge14[OJT14];
  var search_ojt14 = final_string.search(OJT14);
  //var search_check1 = active_data.search(key);
    //console.log("Searching in title");
    if(search_ojt14>0)
        {
            var ores14 = value.split(",");
            ores14.forEach(function(oentry14)
                      {
				oentry14 = oentry14.trim();
                if(selected_classification==oentry14)
                {
                   oflag14 = 1;
                    //alert("Check");
                   keyword_list14 = keyword_list14 + "," + OJT14;
                }
            });

        }
}
        // selected classification
//alert(selected_classification);

        var flag = 0;
        var flag5 = 0;
        var flag6 = 0;



                             //var sds_tab = $("sds-resource-item").text();
        var sds_tab = $(".sds-resource-item").text();
                             sds_tab = sds_tab.trim();      // attachments Tab
                             var flag_2 = 0;
                             var flag_3 = 0;
                             var error_msg_2 = "";

        //alert(sds_tab);

                             //var search_check = sds_tab.search(key);
                             if(sds_tab.search("seller_central")>0 || sds_tab.search("PanDash")>0 || sds_tab.search("vendor_central")>0 || sds_tab.search("AshaVC")>0)
                             {
            //alert("Seller Central");
                                           if(selected_classification=="u" || selected_classification=="ub")
                                           {
                                                          flag_2 = 1;
                                           }
                             }
                             else if(sds_tab.search("Argus")>0 || sds_tab.search("SCOT")>0)
                             {
                                           if(selected_classification=="u3a" || selected_classification=="u3b")
                                           {
                                                          flag_3 = 1;
                                           }
                             }



if(flag_2=="1" || flag_3=="1")
{
    //alert_msg = alert_msg + "Please recheck your classification with Document source.";
    alert_msg2 = "Please recheck your classification basis Document source)";
              //alert("SDS tab problem");
}


if(oflag1=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg1 = "Please check BPB :- " + keyword_list1 + "\n";
}

if(oflag2=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg2 = "Please check Training Doc in PB :- " + keyword_list2 + "\n";
}

if(oflag3=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg3 = "Check cosmetic SOP :- " + keyword_list3 + "\n";
}

if(oflag4=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg4 = "Check Essential oil guide :- " + keyword_list4 + "\n";
}

if(oflag5=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg5 = "Check lighter Guide :- " + keyword_list5 + "\n";
}

if(oflag6=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg6 = "Check Magnetized material Guidelines :- " + keyword_list6 + "\n";
}

if(oflag7=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg7 = "Check Markers guide :- " + keyword_list7 + "\n";
}

if(oflag8=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg8 = "Check Product Bank in policy :- " + keyword_list8 + "\n";
}

if(oflag9=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg9 = "Check Pure substance in IBC :- " + keyword_list9 + "\n";
}

if(oflag10=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg10 = "Check Refrigerator fridge guide :- " + keyword_list10 + "\n";
}

if(oflag11=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg11 = "Compressed gases Classification guideline :- " + keyword_list11 + "\n";
}

if(oflag12=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg12 = "Please Check Non-DG PPT :- " + keyword_list12 + "\n";
}

if(oflag13=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg13 = "Please ask SME :- " + keyword_list13 + "\n";
}
        if(oflag14=="1")
{
              //alert("Please recheck the classification1. The ASIN contains the following keywords :- " + keyword_list);
    oalert_msg14 = "Please Check If Light Includes Card Style Remote :- " + keyword_list14 + "\n";
}

        setTimeout(function(){ attribute1();},100);

        function attribute1() {
                if(alert_msg2!="" || oalert_msg1!="" || oalert_msg2!="" || oalert_msg3!="" || oalert_msg4!="" || oalert_msg5!="" || oalert_msg6!="" || oalert_msg7!="" || oalert_msg8!="" || oalert_msg9!="" || oalert_msg10!="" || oalert_msg11!="" || oalert_msg12!="" || oalert_msg13!="" || oalert_msg14!="")
        {
       //  alert("Alert message is : " + alert_msg5);
           var alert_msg = alert_msg2 + " ------ " + oalert_msg1 + " ------ " + oalert_msg2 + " ------ " + oalert_msg3 + " ------ " + oalert_msg4 + " ------ " + oalert_msg5 + " ------ " + oalert_msg6 + " ------ " + oalert_msg7 + " ------ " + oalert_msg8 + " ------ " + oalert_msg9 + " ------ " + oalert_msg10 + " ------ " + oalert_msg11 + " ------ " + oalert_msg12 + " ------ " + oalert_msg13 + " ------ " + oalert_msg14;
//alert("Alert message is : " + alert_msg5);
        GM_xmlhttpRequest({
            method: "POST",
            url: "http://pnq-412gv7q.ant.amazon.com:8087/project_pawn/save_entry",
                                                data: "username="+username+"&asin="+product_asin+"&selected_classification="+selected_classification+"&alert_msg="+alert_msg,
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            onload: function(response) {
                //alert(response);
                //console.log(response);

                console.log(response.responseText);
                //alert(response.responseText);
//                console.log(array);
//                alert(array);

                //var xx = JSON.stringify(response, null, 2);
                //console.log(xx);
                //alert(xx);

                //var json = $.parseJSON(response);
            }
        });


                //alert(alert_msg);
            $('#myModal').modal('show');
            $('#alert_msg_section5').text(alert_msg5);
            $('#oalert_msg_section1').text(oalert_msg1);
            $('#oalert_msg_section2').text(oalert_msg2);
	    $('#alert_msg_section2').text(alert_msg2);
$('#oalert_msg_section3').text(oalert_msg3);
$('#oalert_msg_section4').text(oalert_msg4);
$('#oalert_msg_section5').text(oalert_msg5);
$('#oalert_msg_section6').text(oalert_msg6);
$('#oalert_msg_section7').text(oalert_msg7);
$('#oalert_msg_section8').text(oalert_msg8);
$('#oalert_msg_section9').text(oalert_msg9);
$('#oalert_msg_section10').text(oalert_msg10);
$('#oalert_msg_section11').text(oalert_msg11);
$('#oalert_msg_section12').text(oalert_msg12);
$('#oalert_msg_section13').text(oalert_msg13);
$('#oalert_msg_section14').text(oalert_msg14);


                $("#click_me").hide();
                $("#finishProductButton").show();
            console.log(final_string);
        }
        else
        {
            $("#click_me").hide ();
            $("#finishProductButton").show();
          //  $("#finishProductButton").trigger('click');
        }

        }

    });


}







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 ("#dtProductFinal > div.w-75.layout-align-center-center.layout-column", addCustomSearchResult);
}else{
    console.log("This is not an Argus DG Page!");
}