Wednesday, December 7, 2011

Wall Manager Sidekick (Pot Farm) Beta


// ==UserScript==
// @name           Wall Manager Sidekick (Pot Farm) Beta
// @description    Assists Wall Manager with Pot Farm posts
// @include        http://thepotfarmgame.com/*
// @include        http://www.thepotfarmgame.com/*
// @include        http://www.facebook.com/*
// @exclude        http://www.facebook.com/groups/*
// @exclude        http://www.facebook.com/editaccount*
// @exclude        http://www.facebook.com/friends/*
// @exclude        http://www.facebook.com/settings*
// @exclude        http://www.facebook.com/help/*
// @exclude        http://www.facebook.com/logout*
// @exclude        http://www.facebook.com/login*
// @exclude        http://www.facebook.com/ajax/*
// @exclude        http://www.facebook.com/reqs*
// @exclude        http://www.facebook.com/campaign/*
// @exclude        http://www.facebook.com/notifications*
// @exclude        http://www.facebook.com/editprofile*
// @exclude        http://www.facebook.com/posted*
// @exclude        http://www.facebook.com/plugins*
// @exclude        http://www.facebook.com/home.php?sk=group_*
// @exclude        http://www.facebook.com/*/posts/*
// @license        http://creativecommons.org/licenses/by-nc-nd/3.0/us/
// @version        1.8.1b
// @require        http://sizzlemctwizzle.com/updater.php?id=119887&days=1
// @copyright      MonkeyNround
// ==/UserScript== 
(function() { 

 var version = "1.8.1b";
 var thisAppID = "272810543124";
 var defaultTO=null;

 function $(ID,root) {return (root||document).getElementById(ID);}

 String.prototype.startsWith = function(s) {return (this.match("^"+s)==s)};

 String.prototype.endsWith = function(s) {return (this.match(s+"$")==s)};

 String.prototype.find = function(s) {return (this.indexOf(s) != -1);};

 String.prototype.contains = function(s) {return (this.indexOf(s) != -1);};

 String.prototype.noSpaces = function(s) {return (this.replace(/\s+/g,''));};

 String.prototype.upperWords = function(s) {return (this+'').replace(/^(.)|\s(.)/g, function($1){return $1.toUpperCase();});};

 Array.prototype.swap = function (x,y) {var b = this[x];this[x] = this[y];this[y] = b;return this;};

 Array.prototype.inArray = function(value) {for(var i=this.length-1; i>=0; i--) {if(this[i]==value) return true;} return false;};

 //sorts an array in such a way as to prevent
 //finding pea before peanut, or pea before english pea, and then effectively swapping their order
 //now also finds ash in cashew and places ash after cashew
 Array.prototype.fixOrder = function(){
  if (this.length>1) for (var i=this.length-1;i>0;i--) {
   for (var i2=i-1;i2>0;i2--){
    if (this[i].toLowerCase().contains(this[i2].toLowerCase())){
     var b=this[i];
     this[i]=this[i2];
     this[i2]=b;
     b=null;
    }
   }
  }
  return this;
 };

 //reconstruct an array, turning it into definitions using a prefix
 Array.prototype.toDefinitions = function(prefix){
  if (this) for (var i=0;(this[i]);i++) this[i]=prefix+this[i].noSpaces().toLowerCase();
  return this;
 };


 //returns the merge of any number of JSON objects
 //pass JSON objects as comma separated parameters
 //var newJSON = mergeJSON(a,b,c...n)
 //note: overwrites preexisting entries from earlier passed objects
 function mergeJSON () {
  var ret = {};
  for (var a=0,len=arguments.length;a<len;a++) for (var v in arguments[a]) ret[v] = arguments[a][v];
        return ret;
 };

 //short form for evaluate
 //returns a snapshot object
 function selectNodes(xPath,params){
  params=(params||{});
  return (params['doc']||document).evaluate(xPath,(params['node']||document),null,(params['type']||6),null);
 };

 //short form for evaluate with single node return
 //returns the actual node, not the snapshot
 function selectSingleNode(xPath,params){
  params=params||{}; params['type']=9;
  return selectNodes(xPath,params).singleNodeValue;
 };

 //clicks an object using the mouse
 //does not run default actions like opening links
 function click(e) {
  if(!e && typeof e=='string') e=document.getElementById(e);
  if(!e) return;
  var evObj = e.ownerDocument.createEvent('MouseEvents');
  evObj.initMouseEvent("click",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);
  e.dispatchEvent(evObj);
 };

 // Created by avg, modified by JoeSimmons. shortcut to create an element
 function createElement(a,b,c) {
  if(a=="text") {return document.createTextNode(b);}
  var ret=document.createElement(a.toLowerCase());
  if(b) for(var prop in b) if(prop.indexOf("on")==0) ret.addEventListener(prop.substring(2),b[prop],false);
  else if(",style,accesskey,id,name,src,href,which,rel,action,method,value,data-ft".indexOf(","+prop.toLowerCase())!=-1) ret.setAttribute(prop.toLowerCase(), b[prop]);
  else ret[prop]=b[prop];
  if(c) c.forEach(function(e) { ret.appendChild(e); });
  return ret;
 };

 //sidekick ability to pass information via hash parameter
 function setHashParam(p,v){
  var h = unsafeWindow.top.location.hash;
  var params = h.split('&');
  var found=false;
  if (params.length) for (var x=0;x<params.length && !found;x++){
   var p1 = params[x].split('=')[0];
   var v1 = params[x].split('=')[1];
   if (p1 == p) {
    params[x]=p+'='+v;
    found=true;
   }
  }
  if (!found) params[params.length]=p+'='+v;
  h=params.join('&');
  unsafeWindow.top.location.hash = h;
 };

 function sendMessage(s){
  top.location.href = 'http://www.facebook.com/ThereIsNoWayThisExists/#status=' + s;
  return;
  try {
   setHashParam('status',s);
  } catch(e) {
   try{
    top.location.hash += "&status="+s;
   } catch(e){       
    if (window != top) top.location.href = "http://apps.facebook.com/?#status="+s;   
   }
  }
 };

 function dock(){
  //check that dock exists
  var door=$('wmDock');
  if (!door) {
   //cannot find dock
   window.setTimeout(dock, 1000);
   return;
  } 

  //check that the dock does not not already have us listed

  var doorMark=$('wmDoor_app'+thisAppID);
  if (doorMark) return; //already posted to door

  var attachment={
   appID:'272810543124',
   alias:'PF',
   hrefKey:'ktf', //such as sendkey
   name:'Pot Farm', //how you want it to display
   thumbsSource:'www.thepotfarmgame.com',
   flags:{httpsTrouble:true,requiresTwo:false,skipResponse:false,alterLink:true},
   icon:"http://external.ak.fbcdn.net/safe_image.php?d=AQAWRdi35LD2GK5A&w=90&h=90&url=http%3A%2F%2Fa1.twimg.com%2Fprofile_images%2F1449405777%2Fpf45_bigger.jpg",
   desc:"Pot Farm Sidekick ("+version+")",

   alterLink: {
    find: "apps.facebook.com/mypotfarm",
    replace: "thepotfarmgame.com/potfarm", //"apps.facebook.com/mypotfarm",
    },
   
   accText: {
    Bonus  : 'Bonus',
    Protection : 'Protection',
    Decoration : 'Decoration',
    Plant  : 'Plant',
    FeedReward : 'FeedReward',
    Contraption : 'Contraption',
    Repeater : 'Repeater',
    Special  : 'Special',
    Tending  : 'Tending',
    Product  : 'Product',
    Puzzle  : 'Puzzle',
    Pplant  : 'Pplant',

   },
   tests: [
    {url:"feedCoins=",ret:"Bonus"},// Generic Achievement Bonus
    {url:"feedXP=",ret:"Bonus"}, // Generic Achievement Bonus

    {url:"fst=ParaBear",ret:"Protection"},
    {url:"fst=DozyBunny",ret:"Decoration"},
    {url:"fst=Driftwood",ret:"Decoration"},
    {url:"fst=OldHippie",ret:"Plant"},
    {url:"fst=Acapulco_Gold",ret:"Plant"},
    {url:"fst=Pizza_Flower",ret:"Plant"},
    {url:"fst=Bacon_Tree",ret:"Plant"},
    {url:"fst=Ripple_Chip_Plant",ret:"Plant"},
    {url:"fst=Buzzed+Beaver",ret:"Decoration"},
    {url:"fst=White+Rabbit",ret:"Decoration"},
    {url:"fst=Black+Rabbit",ret:"Decoration"},
    {url:"fst=Dark+Chocobunny",ret:"Decoration"},
    {url:"fst=Milk+Chocobunny",ret:"Decoration"},
    {url:"fst=Oogy+Bunny",ret:"Decoration"},
    {url:"fst=Pink+Bunny",ret:"Decoration"},
    {url:"fst=Sad+Bunny",ret:"Decoration"},
    {url:"fst=Dozy+Zombie",ret:"Decoration"},
    {url:"fst=Dozy+Death",ret:"Decoration"},
    {url:"fst=Dozy+Ghost",ret:"Decoration"},
    {url:"fst=Dozy+Pumpkin",ret:"Decoration"},
    {url:"fst=Dozy+Devil",ret:"Decoration"},
    {url:"fst=Jelly_Bean_Tree",ret:"Plant"},
    {url:"fst=Cookie_Bush",ret:"Plant"},
    {url:"fst=Baked_Turkey",ret:"Protection"},
    {url:"fst=Floyd_Freak",ret:"FeedReward"},
    {url:"fst=Paranoid_Girl_Bear",ret:"Protection"},
    {url:"fst=Dozy_Pilgrim",ret:"Decoration"},
    {url:"fst=Buzzed_Pilgrim",ret:"Decoration"},
    {url:"fst=Paranoid_Pilgrim",ret:"Protection"},
    {url:"fst=Baked_Reindeer",ret:"Protection"},
    {url:"fst=Dozy_Reindeer",ret:"Decoration"},
    {url:"fst=Paranoid_Reindeer",ret:"Protection"},
    {url:"fst=Buzzed_Reindeer",ret:"Decoration"},
    {url:"fst=3x_Christmas_Kush",ret:"Plant"},
    {url:"fst=Old_Hippy_Gold",ret:"Plant"},
    {url:"fst=Invite_Friend",ret:"FeedReward"},
    {url:"fst=Panama_Red",ret:"Plant"},
    {url:"fst=Big+Phrog",ret:"Protection"},
    {url:"fst=4x_Pineapple_Punch",ret:"Plant"},
    {url:"fst=9x_Pineapple_Punch",ret:"Plant"},
    {url:"fst=Oil_Press",ret:"Contraption"},
    {url:"fst=4x_Love_Potion",ret:"Plant"},
    {url:"fst=Candy_Heart_Bush",ret:"Plant"},
    {url:"fst=9x_Love_Potion",ret:"Plant"},
    {url:"fst=Whiskey_Still",ret:"Contraption"},
    {url:"fst=Brewery",ret:"Contraption"},
    {url:"fst=Popcorn_Maker",ret:"Contraption"},
    {url:"fst=Nacho_Machine",ret:"Contraption"},
    {url:"fst=Caramel+Corn+Maker",ret:"Contraption"},
    {url:"fst=Caramel+Corn+Maker+Christmas",ret:"Contraption"},
    {url:"fst=Wine+Maker",ret:"Contraption"},
    {url:"fst=Love+Machine",ret:"Contraption"},
    {url:"fst=Love+In",ret:"Contraption"},
    {url:"fst=ChoreValentine",ret:"Plant"},
    {url:"fst=Inflatable+Sheep",ret:"Protection"},
    {url:"fst=Blow+Up+Sheep",ret:"Protection"},
    {url:"fst=Bubbly_Love_Pig",ret:"Protection"},
    {url:"fst=Choco_Love_Pig",ret:"Protection"},
    {url:"fst=Love_Pig",ret:"Protection"},
    {url:"fst=Rosy_Love_Pig",ret:"Protection"},
    {url:"fst=4x_Danny_Boy",ret:"Plant"},
    {url:"fst=9x_Danny_Boy",ret:"Plant"},
    {url:"fst=Cheezo_Bush",ret:"Plant"},
    {url:"fst=Donut_Tree",ret:"Plant"},
    {url:"fst=Pie_Cabbage",ret:"Plant"},
    {url:"fst=Green+Beer+Brewery",ret:"Contraption"},
    {url:"fst=10x_Christmas_Kush",ret:"Plant"},
    {url:"fst=Ale_Prechaun",ret:"Repeater"},
    {url:"fst=ArchivedFriend",ret:"Special"},
    {url:"fst=Jitters",ret:"Tending"},
    {url:"fst=Leprechaun+Ale",ret:"Contraption"},
    {url:"fst=Leprechaun+Pipe",ret:"Contraption"},
    {url:"fst=Lost_Leprechaun",ret:"Protection"},
    {url:"fst=Puffy_Leprechaun",ret:"Repeater"},
    {url:"fst=Bubbly+Love+Pig",ret:"Contraption"},
    {url:"fst=Choco+Love+Pig",ret:"Contraption"},
    {url:"fst=Love+Pig",ret:"Contraption"},
    {url:"fst=Rosy+Love+Pig",ret:"Contraption"},
    {url:"fst=4x_Four_Twenty_Blues",ret:"Plant"},
    {url:"fst=9x_Four_Twenty_Blues",ret:"Plant"},
    {url:"fst=Rally+Girl",ret:"Product"},
    {url:"fst=Shrooms+Blue",ret:"Plant"},
    {url:"fst=ShroomsBluesLost",ret:"Repeater"},
    {url:"fst=Cocoa_Tree",ret:"Repeater"},
    {url:"fst=Cocoa_Tree_Lrg",ret:"Repeater"},
    {url:"fst=Cocoa_Tree_Sml",ret:"Repeater"},
    {url:"fst=Frog_Blue",ret:"Protection"},
    {url:"fst=Frog_Red",ret:"Protection"},
    {url:"fst=Dopey_Duck",ret:"Protection"},
    {url:"fst=Dopey_Duck_Grey",ret:"Protection"},
    {url:"fst=Dopey_Four_Twenty_Duck",ret:"Protection"},
    {url:"fst=Pot_Heads_Lrg",ret:"Product"},
    {url:"fst=Pot_Heads_Med",ret:"Product"},
    {url:"fst=Pot_Heads_Sml",ret:"Special"},
    {url:"fst=4x_Chocolate_Chunk",ret:"Plant"},
    {url:"fst=9x_Chocolate_Chunk",ret:"Plant"},
    {url:"fst=Easter_Island_Bunny",ret:"Repeater"},
    {url:"fst=Dopey_Rasta_Duck",ret:"Protection"},
    {url:"fst=Paranoid_Rasta_Bear",ret:"Protection"},
    {url:"fst=Brownie_Machine",ret:"Contraption"},
    {url:"fst=Brownie_Machine_Premium",ret:"Contraption"},
    {url:"fst=pot_heads_island",ret:"Product"},
    {url:"fst=Brownie_Machine_Premium_2",ret:"Contraption"},
    {url:"fst=pot_heads_island_lrg",ret:"Product"},
    {url:"fst=pot_heads_island_sml",ret:"Product"},
    {url:"fst=FourTwentyNews",ret:"Plant"},
    {url:"fst=4x_Ditch_Weed",ret:"Plant"},
    {url:"fst=9x_Ditch_Weed",ret:"Plant"},
    {url:"fst=Trailer_Dryer",ret:"Plant"},
    {url:"fst=Dopey_Trailer_Duck",ret:"Protection"},
    {url:"fst=Paranoid_Girl_Trailer_Bear",ret:"Protection"},
    {url:"fst=Paranoid_Trailer_Bear",ret:"Protection"},
    {url:"fst=4x_Alien_Kush",ret:"Plant"},
    {url:"fst=Puzzle1",ret:"Puzzle"},
    {url:"fst=pot_heads_trailer_sml",ret:"Special"},
    {url:"fst=pot_heads_trailer",ret:"Special"},
    {url:"fst=pot_heads_trailer_lrg",ret:"Special"},
    {url:"fst=Trailer_Washer",ret:"Plant"},
    {url:"fst=9x_Alien_Kush",ret:"Plant"},
    {url:"fst=Buzzed_Conspiracy_Beaver",ret:"Decoration"},
    {url:"fst=Dopey_Conspiracy_Duck",ret:"Protection"},
    {url:"fst=Dozy_Conspiracy_Bunny",ret:"Decoration"},
    {url:"fst=Paranoid_Conspiracy_Bear",ret:"Protection"},
    {url:"fst=4x_OG_Kush",ret:"Plant"},
    {url:"fst=crop_circle_bunny",ret:"Plant"},
    {url:"fst=crop_circle_pot_leaf",ret:"Plant"},
    {url:"fst=Pot_Heads_Conspiracy",ret:"Special"},
    {url:"fst=Pot_Heads_Conspiracy_Lrg",ret:"Special"},
    {url:"fst=Pot_Heads_Conspiracy_Sml",ret:"Special"},
    {url:"fst=Alien_Grey_Kush",ret:"Plant"},
    {url:"fst=9x_OG_Kush",ret:"Plant"},
    {url:"fst=Buzzed_Party_Beaver",ret:"Decoration"},
    {url:"fst=Buzzed_Rasta_Beaver",ret:"Decoration"},
    {url:"fst=Dopey_Party_Duck",ret:"Protection"},
    {url:"fst=Dozy_Party_Bunny",ret:"Protection"},
    {url:"fst=OG_Kush_Hollywood",ret:"Plant"},
    {url:"fst=Paranoid_Party_Bear",ret:"Protection"},
    {url:"fst=pot_heads_rock_star",ret:"Product"},
    {url:"fst=pot_heads_rock_star_lrg",ret:"Special"},
    {url:"fst=pot_heads_rock_star_sml",ret:"Special"},
    {url:"fst=Guitar",ret:"Plant"},
    {url:"fst=Keyboard",ret:"Plant"},
    {url:"fst=Drums",ret:"Plant"},
    {url:"fst=Band_Set",ret:"Plant"},
    {url:"fst=Hash_Press_Blonde",ret:"Product"},
    {url:"fst=4x_Grim_Reefer",ret:"Plant"},
    {url:"fst=9x_Grim_Reefer",ret:"Plant"},
    {url:"fst=Apotcalypse",ret:"Plant"},
    {url:"fst=Cauldron_Bubbling",ret:"Plant"},
    {url:"fst=Cauldron_Witches",ret:"Plant"},
    {url:"fst=Pot_Heads_Halloween",ret:"Special"},
    {url:"fst=Pot_Heads_Halloween_Lrg",ret:"Special"},
    {url:"fst=Pot_Heads_Halloween_Sml",ret:"Special"},
    {url:"fst=10x_Halloween",ret:"Plant"},
    {url:"fst=Buzzed_Death_Beaver",ret:"Decoration"},
    {url:"fst=Dopey_Death_Duck",ret:"Protection"},
    {url:"fst=Paranoid_Death_Bear",ret:"Protection"},
    {url:"fst=Paranoid_Devil_Bear",ret:"Protection"},
    {url:"fst=Paranoid_Pumpkin_Bear",ret:"Protection"},
    {url:"fst=4x_Halloween",ret:"Plant"},
    {url:"fst=20x_Peoples_Pot",ret:"Plant"},
    {url:"fst=3x_Bankers_Bud",ret:"Plant"},
    {url:"fst=4x_Peoples_Pot",ret:"Plant"},
    {url:"fst=9x_Peoples_Pot",ret:"Plant"},
    {url:"fst=Bankers_Bud",ret:"Plant"},
    {url:"fst=Peoples_Pot",ret:"Plant"},
    {url:"fst=Pot_Heads_Occupy",ret:"Special"},
    {url:"fst=Pot_Heads_Occupy_Lrg",ret:"Special"},
    {url:"fst=Pot_Heads_Occupy_Sml",ret:"Special"},
    {url:"fst=4x_Wizards_Weed",ret:"Plant"},
    {url:"fst=9x_Wizards_Weed",ret:"Plant"},
    {url:"fst=Buzzed_Wizard_Beaver",ret:"Protection"},
    {url:"fst=Dopey_Wizard_Duck",ret:"Protection"},
    {url:"fst=Dozy_Wizard_Bunny",ret:"Protection"},
    {url:"fst=Excalibur",ret:"Plant"},
    {url:"fst=Paranoid_Wizard_Bear",ret:"Protection"},
    {url:"fst=Pot_Heads_Fantasy",ret:"Special"},
    {url:"fst=Pot_Heads_Fantasy_Lrg",ret:"Special"},
    {url:"fst=Pot_Heads_Fantasy_Sml",ret:"Special"},
    {url:"fst=Wishing_Well",ret:"Plant"},
    {url:"fst=Wizards_Weed_White",ret:"Pplant"},
    {url:"fst=Frog_Prince",ret:"Protection"},
    {url:"fst=Blaze+Runner",ret:"Plant"},
    {url:"fst=baby_dragon_red",ret:"Plant"},
    {url:"fst=4x_Harvest_Moon",ret:"Plant"},
    {url:"fst=9x_Harvest_Moon",ret:"Plant"},
    {url:"fst=Cornucopia",ret:"Special"},
    {url:"fst=20x_Ice_Weed",ret:"Plant"},
    {url:"fst=4x_Ice_Weed",ret:"Plant"},
    {url:"fst=9x_Ice_Weed",ret:"Plant"},
    {url:"fst=Pot_Heads_Xmas",ret:"Special"},
    {url:"fst=Pot_Heads_Xmas_Lrg",ret:"Special"},
    {url:"fst=Pot_Heads_Xmas_Sml",ret:"Special"},
    {url:"fst=Lostsheep_Cat",ret:"Decoration"},
    {url:"fst=Lostsheep_Cat_Santa",ret:"Decoration"},
    {url:"fst=Paranoid+Santa+Bear",ret:"Protection"},
   ],

   menu: {
    SSsection_main:{type:"section",label:"Pot Farm Manager Options ("+version+")",kids:{
     SSupdateSidekick:{type:"link",label:"Update Sidekick",href:"http://userscripts.org/scripts/source/119887.user.js"},
     SSsep:{type:"separator",label:"Basics",kids:{
      Bonus  :{type:"checkbox",label:"Get Bonus Xp/Coins"},
      Protection :{type:"checkbox",label:"Get Protection"},
      Decoration :{type:"checkbox",label:"Get Decoration"},
      Plant  :{type:"checkbox",label:"Get Plant"},
      FeedReward :{type:"checkbox",label:"Get FeedReward"},
      Contraption :{type:"checkbox",label:"Get Contraption"},
      Repeater :{type:"checkbox",label:"Get Repeater"},
      Special  :{type:"checkbox",label:"Get Special"},
      Tending  :{type:"checkbox",label:"Get Tending"},
      Product  :{type:"checkbox",label:"Get Product"},
      Puzzle  :{type:"checkbox",label:"Get Puzzle"},
      Pplant  :{type:"checkbox",label:"Get Pplant"},
     }},
     
    }},
   }
  };

  attString=JSON.stringify(attachment);
  door.appendChild(createElement('div',{id:'wmDoor_app'+thisAppID,'data-ft':attString}));
  window.setTimeout(function(){click(door);},1000);
 };
 

 //main script function
 function run(){
  var href = window.location.href;
  var text = document.documentElement.textContent;
  var thisLoc; (thisLoc=(location.protocol+"//"+location.host+location.pathname).split("/")).pop(); thisLoc=thisLoc.join("/");

  //*************************************************************************************
  //***** this section must be tailored to fit your specific needs                  *****
  //***** below is a list of searches for text pertaining to various messages       *****
  //***** the list below is not generic and targets Empires and Allies specifically *****
  //***** you will need to find the specific texts for the game you selected        *****
  //*************************************************************************************
  //***** The WM script can recieve and act on the following statusCode values:     *****
  /*
     1: Acceptance, no stipulations
     0: Unknown return, use this only if your script encounters unplanned results and can still communicate a result
    -1: Failure, generic
    -2: Failure, none left
    -3: Over Gift Limit failure
    -4: Over Gift Limit, still allows sending gift, marked as accepted
    -5: Identified server error
    -6: Already got, failure marked as accepted
    -7: Identified server down for repairs
    -8: Problem finding a required action link
    -9: reserved for WM functions
   -10: reserved for WM functions
   -11: Identified as expired
   -12: Post source is not a neighbor and neighbor status is required. Future WM version will auto-add neighbor if possible.

   //additional codes may now exist, please check the wiki support site for information
  */
  //*************************************************************************************

  if (href.startsWith('http://www.facebook.com/')) {
   dock();
   return;
  }

  else if (href.startsWith(thisLoc+'/play.php')) {
   if (text.match(/"errorCode":101/gi)) {
    window.location.reload();
   }
   else if (text.find('Sorry! This page cannot be found') || (text == '')) {
    sendMessage('-5');
    return;
   }
   else if (text.find('Someone else got here first')) {
    sendMessage('-2');
    return;
   }
   else if (text.match(/(You've reached the 24 hour claim limit.)/gi)) {
    sendMessage('-3');
    return;
   }
   else if (text.find('you already got this')) {
    sendMessage('-6');
    return;
   }
   else if (text.find('You have already claimed this reward')) {
    sendMessage('-6');
    return;
   }
   else if (text.find('You can claim up to')) {
    sendMessage('1');
    return;
   }
   else if (text.find('You got a')) {
    sendMessage('1');
    return;
   }
   else if (text.find('You got an')) {
    sendMessage('1');
    return;
   }
   else if (text.find('You got the')) {
    sendMessage('1');
    return;
   }
   else if (text.find('in your gift box')) {
    sendMessage('1');
    return;
   }
   else if (text.find('Thanks for adopting')) {
    sendMessage('1');
    return;
   }
   else if (text.find('You received')) {
    sendMessage('1');
    return;
   }
   else if (text.find('Right on man')) {
    sendMessage('1');
    return;
   }
  }
  else if (href.startsWith(thisLoc+'/claimFeedRewards.php')) {
   if (text.find('You have received the following rewards in your gift box')) {
    sendMessage('1');
    return;
   }
   else if (text.find('You have already claimed this reward')) {
    sendMessage('-6');
    return;
   }
  }
 }
 //start the script
 window.setTimeout(run,500);

})(); // anonymous function wrapper end

0 comments:

Post a Comment