// ==UserScript==
// @name FrontierVille and TreasureIsle Wall Manager
// @description Manages FrontierVille and TreasureIsle wall posts
// @include http*://*.facebook.com/*?sk=fl_*
// @include http*://*.facebook.com/*?ref=home
// @include http*://*.facebook.com/*?filter=*
// @include http*://*.facebook.com/*games*ap=1
// @include http*://*.facebook.com/
// @include http*://*.facebook.com/*?*sk=lf*
// @include http*://*.facebook.com/*?*sk=nf*
// @include http*://*.facebook.com/*?*sk=cg*
// @exclude http*://*.facebook.com/*?sk=messages*
// @exclude http*://*.facebook.com/*?sk=events*
// @exclude http*://*.facebook.com/*?sk=media*
// @exclude http*://*.facebook.com/*?sk=ru*
// @exclude http*://*.facebook.com/reqs.php*
// @license http://creativecommons.org/licenses/by-nc-nd/3.0/us/
// @version 1.3.109
// @copyright Joe Simmons and Charlie Ewing
// @require http://userscripts.org/scripts/source/29910.user.js
// @require http://sizzlemctwizzle.com/updater.php?id=86674&days=1
// ==/UserScript==
// Based on script built by Joe Simmons in Farmville Wall Manager
// New TI and FrV related script by Charlie Ewing
// Having problems with script leaving tabs or windows open after its done?
// 1. Go to address bar and type about:config
// 2. Go to parameter dom.allow_scripts_to_close_windows
// 3. Set its value as true
// @include http://fb-0.cityville.zynga.com/Reward.php?*
(function() {
var version = "1.3.109";
Array.prototype.inArray = function(value) {
for(var i=this.length-1; i>=0; i--) {
if(this[i]==value) return true;
}
return false;
};
Array.prototype.inArrayWhere = function(value) {
for(var i=0,l=this.length; i<l; i++) {
if(this[i]==value) return i;
}
return false;
};
String.prototype.find = function(s) {
return (this.indexOf(s) != -1);
};
String.prototype.startsWith = function(s) {
return (this.substring(0, s.length) == s);
};
// special circumstance checking for later versions
//var exceptionCV = "http://fb-0.cityville.zynga.com/Reward.php?";
// dont run in frames, prevents detection and misuse of unsafewindow
try {
var unsafeWindow = unsafeWindow || window.wrappedJSObject || window;
if(unsafeWindow.frameElement != null) return;
} catch(e) {}
var imgs = {
bgold : "http://i45.tinypic.com/raq4x3.png",
bg : "http://oi40.tinypic.com/34s0aba.jpg",
logo : "http://i54.tinypic.com/3130mmg.png",
icon : "http://i56.tinypic.com/s46edh.jpg"
};
// Get is Greasemonkey running
var isGM = (typeof GM_getValue != 'undefined' && typeof GM_getValue('a', 'b') != 'undefined');
// Get ID
function $(ID,root) {return (root||document).getElementById(ID);}
// Add GM_addStyle if we're not in FireFox
var GM_addStyle = function(css) {
var head = document.getElementsByTagName('head')[0], style = document.createElement('style');
if(head) {
style.type = 'text/css';
try {style.innerHTML = css} catch(x) {style.innerText = css}
head.appendChild(style);
}
};
// alignCenter by JoeSimmons
// Instructions: Supply an id string or node element as a first argument
function alignCenter(e) {
var node = (typeof e=='string') ? document.getElementById(e) : ((typeof e=='object') ? e : false);
if(!window || !node || !node.style) {return;}
var style = node.style, beforeDisplay = style.display, beforeOpacity = style.opacity;
if(style.display=='none') style.opacity='0';
if(style.display!='') style.display = '';
style.top = Math.floor((window.innerHeight/2)-(node.offsetHeight/2)) + 'px';
style.left = Math.floor((window.innerWidth/2)-(node.offsetWidth/2)) + 'px';
style.display = beforeDisplay;
style.opacity = beforeOpacity;
}
// Fade by JoeSimmons. Fade in/out by id and choose speed: slow, medium, or fast
// Syntax: fade('idhere', 'out', 'medium');
function fade(e, dir, s) {
if(!e || !dir || typeof dir!='string' || (dir!='out'&&dir!='in')) {return;} // Quit if node/direction is omitted, direction isn't in/out, or if direction isn't a string
dir=dir.toLowerCase(); s=s.toLowerCase(); // Fix case sensitive bug
var node = (typeof e=='string') ? $(e) : e, speed = {slow : 400, medium : 200, fast : 50};
if(!s) var s='medium'; // Make speed medium if not specified
if(s!='slow' && s!='medium' && s!='fast') s='medium'; // Set speed to medium if specified speed not supported
if(dir=='in') node.style.opacity = '0';
else if(dir=='out') node.style.opacity = '1';
node.style.display='';
var intv = setInterval(function(){
if(dir=='out') {
if(parseFloat(node.style.opacity)>0) node.style.opacity = (parseFloat(node.style.opacity)-.1).toString();
else {
clearInterval(intv);
node.style.display='none';
}
}
else if(dir=='in') {
if(parseFloat(node.style.opacity)<1) node.style.opacity = (parseFloat(node.style.opacity)+.1).toString();
else {
clearInterval(intv);
}
}
}, speed[s]);
}
// $g by JoeSimmons. Supports ID, Class, and XPath (full with types) in one query
// Supports multiple id/class grabs in one query (split by spaces), and the ability to remove all nodes regardless of type
// See script page for syntax examples: http://userscripts.org/scripts/show/51532
function $g(que, O) {
if(!que||typeof(que)!='string'||que==''||!(que=que.replace(/^\s+/,''))) return false;
var obj=O||({del:false,type:6,node:document}), r, t,
idclass_re=/^[#\.](?!\/)[^\/]/, xp_re=/^\.?(\/{1,2}|count|id)/;
if(idclass_re.test(que)) {
var s=que.split(' '), r=new Array(), c;
for(var n=0; n<s.length; n++) {
switch(s[n].substring(0,1)) {
case '#': r.push(document.getElementById(s[n].substring(1))); break;
case '.': c=document.getElementsByClassName(s[n].substring(1));
if(c.length>0) for(var i=0; i<c.length; i++) r.push(c[i]); break;
}
}
if(r.length==1) r=r[0];
} else if(xp_re.test(que)) {
r = (obj['doc']||document).evaluate(que,(obj['node']||document),null,((t=obj['type'])||6),null);
if(typeof t=="number" && /[12389]/.test(t)) r=r[(t==1?"number":(t==2?"string":(t==3?"boolean":"singleNode")))+"Value"];
}
if(r && obj['del']===true) {
if(r.nodeType==1) r.parentNode.removeChild(r);
else if(r.snapshotItem) for(var i=r.snapshotLength-1; (item=r.snapshotItem(i)); i--) item.parentNode.removeChild(item);
else if(!r.snapshotItem) for(var i=r.length-1; i>=0; i--) if(r[i]) r[i].parentNode.removeChild(r[i]);
} return r;
}
//Returns the value of property p from element e
//e must be an element object
function getPropertyFromElement(e, p) {
if(e==null) return "error: element is null";
//main.debug(e.innerHTML + ", " + p);
return e.innerHTML.split(p+"=\"")[1].split("\"")[0];
}
// GM_config by JoeSimmons/sizzlemctwizzle/izzysoft
var GM_config = {
storage: 'GM_config', // This needs to be changed to something unique for localStorage
init: function() {
// loop through GM_config.init() arguements
for(var i=0,l=arguments.length,arg; i<l; ++i) {
arg=arguments[i];
switch(typeof arg) {
case 'object': for(var j in arg) { // could be a callback functions or settings object
switch(j) {
case "open": GM_config.onOpen=arg[j]; delete arg[j]; break; // called when frame is gone
case "close": GM_config.onClose=arg[j]; delete arg[j]; break; // called when settings have been saved
case "save": GM_config.onSave=arg[j]; delete arg[j]; break; // store the settings objects
default: var settings = arg;
}
} break;
case 'function': GM_config.onOpen = arg; break; // passing a bare function is set to open
// could be custom CSS or the title string
case 'string': if(arg.indexOf('{')!=-1&&arg.indexOf('}')!=-1) var css = arg;
else GM_config.title = arg;
break;
}
}
if(!GM_config.title) GM_config.title = 'Settings - Anonymous Script'; // if title wasn't passed through init()
var stored = GM_config.read(); // read the stored settings
GM_config.passed_values = {};
for (var i in settings) {
GM_config.doSettingValue(settings, stored, i, null, false);
if(settings[i].kids) for(var kid in settings[i].kids) GM_config.doSettingValue(settings, stored, kid, i, true);
}
GM_config.values = GM_config.passed_values;
GM_config.settings = settings;
if (css) GM_config.css.stylish = css;
},
open: function() {
if(document.evaluate("//iframe[@id='GM_config']",document,null,9,null).singleNodeValue) return;
// Create frame
document.body.appendChild((GM_config.frame=GM_config.create('iframe',{id:'GM_config', style:'position:fixed; top:0; left:0; opacity:0; display:none; z-index:999; width:75%; height:75%; max-height:95%; max-width:95%; border:1px solid #000000; overflow:auto;'})));
GM_config.frame.src = 'about:blank'; // In WebKit src cant be set until it is added to the page
GM_config.frame.addEventListener('load', function(){
var obj = GM_config, frameBody = this.contentDocument.getElementsByTagName('body')[0], create=obj.create, settings=obj.settings;
obj.frame.contentDocument.getElementsByTagName('head')[0].appendChild(create('style',{type:'text/css',textContent:obj.css.basic+obj.css.stylish}));
// Add header and title
frameBody.appendChild(create('div', {id:'header',className:'config_header block center', innerHTML:obj.title}));
// Append elements
var anch = frameBody, secNo = 0; // anchor to append elements
for (var i in settings) {
var type, field = settings[i], value = obj.values[i];
if (field.section) {
anch = frameBody.appendChild(create('div', {className:'section_header_holder', id:'section_'+secNo, kids:new Array(
create('a', {className:'section_header center', href:"javascript:void(0);", id:'c_section_kids_'+secNo, textContent:field.section[0], onclick:function(){GM_config.toggle(this.id.substring(2));}}),
create('div', {id:'section_kids_'+secNo, className:'section_kids', style:obj.getValue('section_kids_'+secNo, "none")=="none"?"display: none;":""})
)}));
if(field.section[1]) anch.appendChild(create('p', {className:'section_desc center',innerHTML:field.section[1]}));
secNo++;
}
anch.childNodes[1].appendChild(GM_config.addToFrame(field, i, false));
}
// Add save and close buttons
frameBody.appendChild(obj.create('div', {id:'buttons_holder', kids:new Array(
obj.create('button',{id:'saveBtn',textContent:'Save',title:'Save options and close window',className:'saveclose_buttons',onclick:function(){GM_config.close(true)}}),
obj.create('button',{id:'cancelBtn', textContent:'Cancel',title:'Close window',className:'saveclose_buttons',onclick:function(){GM_config.close(false)}}),
obj.create('div', {className:'reset_holder block', kids:new Array(
obj.create('a',{id:'resetLink',textContent:'Restore to default',href:'#',title:'Restore settings to default configuration',className:'reset',onclick:obj.reset})
)}))}));
obj.center(); // Show and center it
window.addEventListener('resize', obj.center, false); // Center it on resize
if (obj.onOpen) obj.onOpen(); // Call the open() callback function
// Close frame on window close
window.addEventListener('beforeunload', function(){GM_config.remove(this);}, false);
}, false);
},
close: function(save) {
if(save) {
var type, fields = GM_config.settings, typewhite=/radio|text|hidden|checkbox/;
for(f in fields) {
var field = GM_config.frame.contentDocument.getElementById('field_'+f), kids=fields[f].kids;
if(!field.className.find("separator")) {
if(typewhite.test(field.type)) type=field.type;
else type=field.tagName.toLowerCase();
GM_config.doSave(f, field, type);
if(kids) for(var kid in kids) {
var field = GM_config.frame.contentDocument.getElementById('field_'+kid);
if(typewhite.test(field.type)) type=field.type;
else type=field.tagName.toLowerCase();
GM_config.doSave(kid, field, type, f);
}
}
}
if(GM_config.onSave) GM_config.onSave(); // Call the save() callback function
GM_config.save();
}
if(GM_config.frame) GM_config.remove(GM_config.frame);
delete GM_config.frame;
if(GM_config.onClose) GM_config.onClose(); // Call the close() callback function
},
set: function(name,val) {GM_config.values[name] = val;},
get: function(name) {return GM_config.values[name];},
isGM: typeof GM_getValue != 'undefined' && typeof GM_getValue('a', 'b') != 'undefined',
log: (this.isGM) ? GM_log : ((window.opera) ? opera.postError : console.log),
getValue : function(name, def) { return (this.isGM?GM_getValue:(function(name,def){return localStorage.getItem(name)||def}))(name, def||""); },
setValue : function(name, value) { return (this.isGM?GM_setValue:(function(name,value){return localStorage.setItem(name,value)}))(name, value||""); },
save: function(store, obj) {
try {
var val = JSON.stringify(obj||GM_config.values);
GM_config.setValue((store||GM_config.storage),val);
} catch(e) {
GM_config.log("GM_config failed to save settings!");
}
},
read: function(store) {
try {
var val = GM_config.getValue((store||GM_config.storage), '{}'), rval = JSON.parse(val);
} catch(e) {
GM_config.log("GM_config failed to read saved settings!");
rval = {};
}
return rval;
},
reset: function(e) {
e.preventDefault();
var type, obj = GM_config, fields = obj.settings;
for(f in fields) {
var field = obj.frame.contentDocument.getElementById('field_'+f), kids=fields[f].kids;
if(field.type=='radio'||field.type=='text'||field.type=='checkbox') type=field.type;
else type=field.tagName.toLowerCase();
GM_config.doReset(field, type, null, f, null, false);
if(kids) for(var kid in kids) {
var field = GM_config.frame.contentDocument.getElementById('field_'+kid);
if(field.type=='radio'||field.type=='text'||field.type=='checkbox') type=field.type;
else type=field.tagName.toLowerCase();
GM_config.doReset(field, type, f, kid, true);
}
}
},
addToFrame : function(field, i, k) {
var elem, obj = GM_config, anch = GM_config.frame, value = obj.values[i], Options = field.options, label = field.label, create=GM_config.create, isKid = k!=null && k===true;
switch(field.type) {
case 'separator': elem = create("span", {textContent:label, id:'field_'+i, className:'field_label separator'});
break;
case 'textarea':
elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
create('span', {textContent:label, className:'field_label'}),
create('textarea', {id:'field_'+i,innerHTML:value, cols:(field.cols?field.cols:20), rows:(field.rows?field.rows:2)})
), className: 'config_var'});
break;
case 'radio':
var boxes = new Array();
for (var j = 0,len = Options.length; j<len; j++) {
boxes.push(create('span', {textContent:Options[j]}));
boxes.push(create('input', {value:Options[j], type:'radio', name:i, checked:Options[j]==value?true:false}));
}
elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
create('span', {textContent:label, className:'field_label'}),
create('span', {id:'field_'+i, kids:boxes})
), className: 'config_var'});
break;
case 'select':
var options = new Array();
if(!Options.inArray) for(var j in Options) options.push(create('option',{textContent:Options[j],value:j,selected:(j==value)}));
else options.push(create("option", {textContent:"Error - options needs to be an object type, not an array.",value:"error",selected:"selected"}));
elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
create('span', {textContent:label, className:'field_label'}),
create('select',{id:'field_'+i, kids:options})
), className: 'config_var'});
break;
case 'checkbox':
elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
create('label', {textContent:label, className:'field_label', "for":'field_'+i}),
create('input', {id:'field_'+i, type:'checkbox', value:value, checked:value})
), className: 'config_var'});
break;
case 'button':
var tmp;
elem = create(isKid ? "span" : "div", {kids:new Array(
(tmp=create('input', {id:'field_'+i, type:'button', value:label, size:(field.size?field.size:25), title:field.title||''}))
), className: 'config_var'});
if(field.script) obj.addEvent(tmp, 'click', field.script);
break;
case 'hidden':
elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
create('input', {id:'field_'+i, type:'hidden', value:value})
), className: 'config_var'});
break;
default:
elem = create(isKid ? "span" : "div", {title:field.title||'', kids:new Array(
create('span', {textContent:label, className:'field_label'}),
create('input', {id:'field_'+i, type:'text', value:value, size:(field.size?field.size:25)})
), className: 'config_var'});
}
if(field.kids) {
var kids=field.kids;
for(var kid in kids) elem.appendChild(GM_config.addToFrame(kids[kid], kid, true));
}
return elem;
},
doSave : function(f, field, type, oldf) {
var isNum=/^[\d\.]+$/, set = oldf ? GM_config.settings[oldf]["kids"] : GM_config.settings;
switch(type) {
case 'text':
GM_config.values[f] = ((set[f].type=='text') ? field.value : ((isNum.test(field.value) && ",int,float".indexOf(","+set[f].type)!=-1) ? parseFloat(field.value) : false));
if(set[f]===false) {
alert('Invalid type for field: '+f+'\nPlease use type: '+set[f].type);
return;
}
break;
case 'hidden':
GM_config.values[f] = field.value.toString();
break;
case 'textarea':
GM_config.values[f] = field.value;
break;
case 'checkbox':
GM_config.values[f] = field.checked;
break;
case 'select':
GM_config.values[f] = field[field.selectedIndex].value;
break;
case 'span':
var radios = field.getElementsByTagName('input');
if(radios.length>0) for(var i=radios.length-1; i>=0; i--) {
if(radios[i].checked) GM_config.values[f] = radios[i].value;
}
break;
}
},
doSettingValue : function(settings, stored, i, oldi, k) {
var set = k!=null && k==true && oldi!=null ? settings[oldi]["kids"][i] : settings[i];
if(",save,open,close".indexOf(","+i) == -1) {
// The code below translates to:
// if a setting was passed to init but wasn't stored then
// if a default value wasn't passed through init() then use null
// else use the default value passed through init()
// else use the stored value
try {
var value = (stored[i]==null || typeof stored[i]=="undefined") ? ((set["default"]==null || typeof set["default"]=="undefined") ? null : (set["default"])) : stored[i];
} catch(e) {
var value = stored[i]=="undefined" ? (set["default"]=="undefined" ? null : set["default"]) : stored[i];
}
// If the value isn't stored and no default was passed through init()
// try to predict a default value based on the type
if (value === null) {
switch(set["type"]) {
case 'radio': case 'select':
value = set.options[0]; break;
case 'checkbox':
value = false; break;
case 'int': case 'float':
value = 0; break;
default:
value = (typeof stored[i]=="function") ? stored[i] : "";
}
}
}
GM_config.passed_values[i] = value;
},
doReset : function(field, type, oldf, f, k) {
var isKid = k!=null && k==true, obj=GM_config,
set = isKid ? obj.settings[oldf]["kids"][f] : obj.settings[f];
switch(type) {
case 'text':
field.value = set['default'] || '';
break;
case 'hidden':
field.value = set['default'] || '';
break;
case 'textarea':
field.value = set['default'] || '';
break;
case 'checkbox':
field.checked = set['default'] || false;
break;
case 'select':
if(set['default']) {
for(var i=field.options.length-1; i>=0; i--)
if(field.options[i].value==set['default']) field.selectedIndex=i;
}
else field.selectedIndex=0;
break;
case 'span':
var radios = field.getElementsByTagName('input');
if(radios.length>0) for(var i=radios.length-1; i>=0; i--) {
if(radios[i].value==set['default']) radios[i].checked=true;
}
break;
}
},
values: {},
settings: {},
css: {
basic: 'body {background:#FFFFFF;}\n' +
'.indent40 {margin-left:40%;}\n' +
'* {font-family: arial, tahoma, sans-serif, myriad pro;}\n' +
'.field_label {font-weight:bold; font-size:12px; margin-right:6px;}\n' +
'.block {display:block;}\n' +
'.saveclose_buttons {\n' +
'margin:16px 10px 10px 10px;\n' +
'padding:2px 12px 2px 12px;\n' +
'}\n' +
'.reset, #buttons_holder, .reset a {text-align:right; color:#000000;}\n' +
'.config_header {font-size:20pt; margin:0;}\n' +
'.config_desc, .section_desc, .reset {font-size:9pt;}\n' +
'.center {text-align:center;}\n' +
'.section_header_holder {margin-top:8px;}\n' +
'.config_var {margin:0 0 4px 0; display:block;}\n' +
'.section_header {font-size:13pt; background:#414141; color:#FFFFFF; border:1px solid #000000; margin:0;}\n' +
'.section_desc {font-size:9pt; background:#EFEFEF; color:#575757; border:1px solid #CCCCCC; margin:0 0 6px 0;}\n' +
'input[type="radio"] {margin-right:8px;}',
stylish: ''
},
create: function(a,b) {
var ret=window.document.createElement(a);
if(b) for(var prop in b) {
if(prop.indexOf('on')==0) ret.addEventListener(prop.substring(2),b[prop],false);
else if(prop=="kids" && (prop=b[prop])) for(var i=0; i<prop.length; i++) ret.appendChild(prop[i]);
else if(",style,accesskey,id,name,src,href,for".indexOf(","+prop.toLowerCase())!=-1) ret.setAttribute(prop, b[prop]);
else ret[prop]=b[prop];
}
return ret;
},
center: function() {
var node = GM_config.frame, style = node.style, beforeOpacity = style.opacity;
if(style.display=='none') style.opacity='0';
style.display = '';
style.top = Math.floor((window.innerHeight/2)-(node.offsetHeight/2)) + 'px';
style.left = Math.floor((window.innerWidth/2)-(node.offsetWidth/2)) + 'px';
style.opacity = '1';
},
run: function() {
var script=GM_config.getAttribute('script');
if(script && typeof script=='string' && script!='') {
func = new Function(script);
window.setTimeout(func, 0);
}
},
addEvent: function(el,ev,scr) { el.addEventListener(ev, function() { typeof scr == 'function' ? window.setTimeout(scr, 0) : eval(scr) }, false); },
remove: function(el) { if(el && el.parentNode) el.parentNode.removeChild(el); },
toggle : function(e) {
var node=GM_config.frame.contentDocument.getElementById(e);
node.style.display=(node.style.display!='none')?'none':'';
GM_config.setValue(e, node.style.display);
}
};
var main = {
paused : false,
pauseClick : false,
boxFull : false,
pauseCount : 0,
openCount : 0,
requestsOpen : 0,
reqTO : 30000,
profile : "",
acceptStage : 1,
// Changeable vars for adaptation to other games (ease of use)
streamID : "contentArea",
stream : ($("home_stream") || $("pagelet_intentional_stream") || $("contentArea") || $("pagelet_tab_content") || $("profile_minifeed")),
navID : "navItem",
navIDnf : "navItem_nf",
gameIDFrV : "201278444497", // frontierville
gameIDTI: "234860566661", // treasureisle
gameIDWS: "29507308663", // warstorm
gameIDRwF: "120563477996213", //ravenwood fair
gameIDCV : "291549705119", // cityville
gameIDFV : "102452128776", // farmville
gameURLpartFrV : "/frontierville",
gameURLpartTI: "/treasureisle",
gameURLpartFV: "/onthefarm",
gameURLpartWS: "/warstorm",
gameURLpartRwF: "/ravenwoodfair",
gameURLpartCV: "/cityville",
whitelistWhenPaused : ",null", // categories separated by commas to be accepted even if gift box is full
gameNameFrV : "FrontierVille",
gameNameTI : "TreasureIsle",
gameNameRwF : "RavenwoodFair",
gameNameCV : "CityVille",
gameNameWS : "WarStorm",
gameNameFV : "FarmVille",
gameAcronym : "WallManager",
scriptHomeURL : "http://userscripts.org/scripts/show/86674",
gameKeyUrlKeywordFrV : "sendkey=", // used in the regex and xpath to look for "key=" or "sk=" or whatever it may be
gameKeyUrlKeywordTI : "key=",
gameKeyUrlKeywordRwF : "tv2=",
gameKeyUrlKeywordCV : "sendkey=",
gameKeyUrlKeywordWS : "sendkey=",
gameKeyUrlKeywordFV : "key=",
oTab : null, //this is where the window handle for the work window goes
oTabID : "", //this is the unique key found in the last tab so we know its not loading the same page still
oTabLifeSpan : 0,
specialAlternator : 0,
special24HourBit : 0,
FrVfriendListHolder : null,
TIfriendListHolder : null,
RwFfriendListHolder : null,
CVfriendListHolder : null,
WSfriendListHolder : null,
// empty options object for later modification
opts : {},
ampRegex : /&/g,
spaceRegex : /\s+/g,
keyRegexFrV : null, // will be changed after main is defined - bug
keyRegexTI : null,
nRegex : /\n+/g,
phpRegex : /#\/.*\.php/,
numberRegex : /\d+/,
profileRegex : /facebook\.com\/([^?]+)/i,
postStatusRegex : / (itemdone|itemneutral|itemprocessing|itemfailed|itemoverlimit)/,
accTextRegex : /(here's a reward|here is a reward|you've received a gift|would you like to accept|your friend needs help|thanks for coming to ravenwood fair|you just sent|you just got|reward limit for|present sent to)/,
failTextRegex : /(oh no|sorry pardner|only your friends can send you|no longer working|you've already claimed|can't claim your own)/,
boxFullRegex : /(you have exceeded your limit|gift box is full|exceeded)/,
emptyRegex : /\s*/g,
gameUrlPHPPage : /index\.php/,
accDefaultText : "Got this!",
failText : "Oh no! Sorry pardner!",
overLimitText : "Limit reached!",
accText : {
FrVxp : "Unknown XP", FrVxp15 : "15 XP", FrVxp20 : "20 XP", FrVxp25 : "25 XP", FrVxp40 : "40 XP", FrVxp50 : "50 XP",
FrVxp60 : "60 XP", FrVxp75 : "75 XP", FrVxp100 : "100 XP", FrVxp120 : "120 XP", FrVxp150 : "150 XP", FrVxp200 : "200 XP",
FrVcoin100 : "100 Coin", FrVcoin200 : "200 Coin", FrVcoin250 : "250 Coin", FrVcoin500 : "500 Coin", FrVcoin1000 : "1000 Coin",
FrVcoin: "Unknown Coin", FrVcoin300 : "300 Coin",
FrVnone : "Unrecognized", FrVwishlist : "Wish List", FrVenergy : "Energy",
FrVrep : "Reputation", FrVfood : "Food", FrVwood : "Wood", FrVtool : "Tool",
FrVmystery : "Mystery Gift", FrVcarepkg : "Care Package",
FrVsnack : "Light Snack (3)", FrVpicnicbasket : "Picknic Basket (3)", FrVhotdog : "Hotdog (5)",
FrVbreakfast : "Breakfast (7)", FrVsteakdinner : "Steak Dinner (10)", FrVlunch : "Lunch (15)",
FrVfries : "Fries (20)", FrVhamburger : "Hamburger (28)", FrVdinner : "Dinner (30)",
FrVicecreamsandwich : "Icecream Sandwich (35)", FrVfeast : "Feast (62)",
FrVboostcherry : "Cherry Ready Boost", FrVboostrand : "Unknown Boost",
FrVsendenergy : "Light Snack",
FrVsendbrick : "Brick", FrVsendnail : "Nail", FrVsendhammer : "Hammer", FrVsendpaint : "Paint", FrVsenddrill : "Drill",
FrVsendcement : "Cement", FrVsendmallet : "Mallet", FrVsendpeg : "Peg", FrVsendwindow : "Window", FrVsendgrease : "Elbow Grease",
FrVsendtape : "Measuring Tape", FrVsendshingle : "Shingle", FrVsendlevel : "Level", FrVsendscrap : "Scrap Metal",
FrVsendsurvey : "Land Survey", FrVsendwaiver : "Waiver", FrVsendrsvp : "Jackalope RSVP", FrVsendcharter : "Charter",
FrVsendspitball : "Spitball", FrVsendchalk : "Chalk", FrVsendslate : "Slate", FrVsendinkpen : "Pen", FrVsendinkwell : "Ink",
FrVsendmeasurement : "Measurement", FrVsendpattern : "Pattern", FrVsendhanger : "Hanger",
FrVsendcanningjar : "Canning Jar", FrVsendboots : "Hip Boots", FrVsendshippinglabel : "Shipping Label", FrVsendmetalbar : "Metal Bar",
FrVsendseedscabbage : "Cabbage Seeds", FrVsendbins : "Bins", FrVsendplans : "Plans", FrVsendshelves : "Shelves",
FrVsendbabynames : "Baby Names", FrVsendbabyclothes : "Baby Clothes",
FrVsendchaps : "Rodeo Chaps!", FrVsendrodeohat : "Rodeo Hat", FrVsendscrewdriver : "Screwdriver",
FrVsend : "Unknown",
FrVchick : "Chicken", FrVgoose : "Goose", FrVpig : "Pig", FrVcow : "Cow", FrVox : "Ox", FrVsheep : "Sheep", FrVgoat : "Goat", FrVmule : "Mule", FrVhorse : "Horse",
FrVgroundhog : "Collectible (groundhog)", FrVpoop : "Collectible (manure)", FrVgoatmilk : "Collectible (goat milk)",
FrVoxencol : "Collectible (oxen)", FrVribeye : "Collectible (ribeye)", FrVapplepie : "Collectible (apple pie)",
FrVdiary : "Collectible (diary)", FrVcandy : "Collectible (candy)", FrVfoxcol : "Collectible (fox)",
FrVtollcol : "Collectible (toll booth)", FrVtailorcol : "Collectible (tailor)", FrVbabycol : "Collectible (family)",
FrVrandomcol : "Collectible (unknown)",
FrVribbon : "Ribbon", FrVfeather : "Downy Feathers", FrVbatter : "Batter", FrVpeter : "Salt Peter",
FrVpresent : "Present", FrVcloth : "Unknown Cloth", FrVclothes : "Clothes", FrVclothfancy : "Fancy Clothes",
FrVbrick : "Brick", FrVnail : "Nail", FrVhammer : "Hammer", FrVpaint : "Paint", FrVdrill : "Drill",
FrVcement : "Cement", FrVmallet : "Mallet", FrVpeg : "Peg", FrVwindow : "Window", FrVshingle : "Shingle",
FrVtape : "Measuring Tape", FrVlevel : "Level", FrVmetalbar : "Metal Bar",
FrVchalk : "Chalk", FrVspitball : "Spitball", FrVslate : "Slate", FrVinkpen : "Pen", FrVinkwell : "Ink",
FrVcharter : "Charter",
FrVoaktree : "Oak Tree", FrVpinetree : "Pine Tree", FrVappletree : "Apple Tree", FrVcherrytree : "Cherry Tree",
FrVloom : "Loom", FrVbarbwire : "Barbed Fence", FrVtrough : "Feed Trough", FrVshovel : "Shovel", FrVsledge : "Sledge Hammer",
FrVpath : "Path Segment", FrVbucket : "Bucket",
FrVsendcarvingknife : "Carving Knife", FrVbutter : "Butter!", FrVsendloggingpermit : "Logging Permit", FrVsendtinder : "Tinder",
FrVfireworks : "Fireworks",
FrVsendholly : "Wreath", FrVsendjug : "Jug", FrVsendstrawbale : "Straw Bale", FrVsendseasoning : "Seasonings",
FrVsendcarrot : "Carrot", FrVsendcoal : "Coal", FrVstraw : "Straw Bale", FrVsendrodeovest : "Rodeo Vest",
FrVsendsnowhat : "Top Hat", FrVsendcardboardbox : "Cardboard Box", FrVsendsewingneedle : "Sewing Needle",
FrVsendcrowbar : "Crowbar", FrVstuffedgroundhog : "Stuffed Groundhog", FrVsendtile : "Tile", FrVsendbeam : "Beam", FrVsendawl : "Awl",
FrVsendchocolatebar : "Chocolate Bar", FrVsendfeedbag : "Feed Bag", FrVsendsouprecipe : "Soup Recipe",
FrVsendhardwood : "Hardwood", FrVsendwelcomebasket : "Welcome Basket", FrVsendfirstrsvp : "Party RSVP",
FrVsendgame : "Game", FrVflaxoil : "Collectible (flax oil)", FrVprairiepile : "Collectible (prairie pile)",
FrVpitchfork : "Pitchfork", FrVfire : "Fire", FrVsendhelp : "Babysitter", FrVsendmilkingstool : "Milking Stool",
FrVsendcoffin : "Coffin", FrVsendcandycane : "Candycane", FrVsendgumdrops : "Gum Drops", FrVcowmilk : "Collectible (cow milk)",
FrVsendtradepermit : "Trade Permit", FrVbeaverpelt : "Beaver Pelt",
FrVfirstrsvp : "Party RSVP", FrVexplosives : "Explosives", FrVsendtoys : "Toy",
FrVtoy : "Toy", FrVtoy2 : "2 Toys", FrVtoy5 : "5 Toys", FrVtoy10 : "10 Toys",
FrVfruitcake : "Fruitcake (15)", FrVsendxmascard : "Christmas Card", FrVsendgingerslab : "Gingerbread Slab",
FrVsendtubefrosting : "Frosting", FrVsenddriedfruit : "Dried Fruit", FrVgingerhut : "Gingerbread Hut",
FrVsendsink : "Sink", FrVsendplaster : "Plaster", FrVsendspackle : "Spackle", FrVoldbook : "Collectible (old book)",
FrVsendbook : "Book", FrVgrainsack : "Collectible (grain sack)", FrVsendshavinglather : "Shaving Lather",
FrVcloth1 : "1 Cloth", FrVcloth2 : "2 Cloth", FrVcloth25 : "25 Cloth", FrVcloth5 : "5 Cloth",
FrVsendbirchbark : "Birch Bark", FrVsendjigmusic : "Jig Music",
TIxp : "XP", TIsave : "Unknown Animal", TIcoin : "Coins", TIbonus : "Bonus",
TIsend : "This", TIwishlist : "Wish List", TInone : "Unrecognized",
TIenergycapsule : "Energy Capsule", TIfiredig : "Fire Dig",
TIfruitkiwi : "Kiwi", TIfruitbanana : "Banana", TIfruitmango : "Mango", TIfruitcoconut : "Coconut", TIfruitpineapple : "Pineapple",
TIfruitdragonfruit : "Dragonfruit", TIfruitsushi : "Sushi", TIfruitmonsterkebab : "Monster Kebab", TIfruithappycake : "Happy Cake",
TIfruit : "Unknown Fruit",
TIbasicbait : "Basic Bait", TIgoodbait : "Good Bait", TIspecialbait : "Special Bait", TImagicbait : "Magic Bait",
TIphoenixfeather : "Phoenix Feather", TImapfragment : "Map Fragment", TIgoldenticket : "Golden Ticket", TImonkeywrench : "Monkey Wrench",
TIgemred : "Red Gem", TIgemblue : "Blue Gem", TIgemorange : "Orange Gem", TIgempurple : "Purple Gem", TIgemgreen : "Green Gem",
TIgembag : "Bag of Gems", TIgem : "Unknown Gem", TIgemyours : "Gem from your own tree",
TIpeacock : "Peacock", TItarantula : "Tarantula", TIpanda : "Panda", TIsloth : "Sloth", TIiguana : "Iguana",
TImonkey : "Monkey", TItoucan : "Toucan", TIparrot : "Parrot", TIcockatoo : "Cockatoo", TIdolphin : "Dolphin",
TIseal : "Seal", TIredpanda : "Red Panda", TImargay : "Margay", TIpanther : "Panther", TIporcupine : "Porcupine",
TIgirraffe : "Girraffe", TIdeer : "Deer", TIunicorn : "Unicorn", TIelephant : "Elephant", TIchinchilla : "Chinchilla",
TIoctopus : "Octopus", TIblackcat : "Black Cat", TIturtle : "Turtle", TIpetturkey : "Turkey",
TIrsvp : "RSVP!", TIfruittaffy : "Taffy", TIoxygen : "Oxygen Bottle",
TIflamingo : "Flamingo", TIlemur : "Lemur", TIjellyfish : "Jellyfish", TIgull : "Gull", TIdusky : "Dusky Dolphin",
TIfruithors : "Finger Food", TIbubbly : "Bubbly", TIpresent : "Present",
TIjdturkey : "JD Turkleton", TIpetmclovin : "McLovin'", TIstreetlamp : "Street Lamp", TIfruitfruitcake : "Fruitcake",
TIbuildingmaterials : "Building Material Kit", TIfruitcandycane : "Candy Cane",
TIsendscarf : "Scarf", TIsendslush : "Slush", TIsendpaint : "Paint", TIsendresin : "Resin", TIsendplanks : "Planks",
TIsendpillar : "Pillar", TIsendshells : "Shells", TIsenddye : "Dye", TIsendmarble : "Marble", TIsendaquavitae : "Aqua Vitae",
TIsendnails : "Nails", TIsendfrosting : "Frosting", TIsendrock : "Rock", TIsendectoplasm : "Ectoplasm",
TInewyearsboat : "New Year's Boat", TIfireworks : "Fireworks", TIpartytable : "Party Table",
TIsendrope : "Rope", TIsendfire : "Fire", TIsendgold : "Gold", TIsendseeds : "Seeds", TIsendcloth : "Cloth", TIsendoil : "Oil",
TIsendice : "Ice", TIsendgumdrops : "Gum Drops", TIsendglue : "Glue", TIsendpackedsnow : "Packed Snow",
TIsendglass : "Glass", TIsendgears : "Gears", TIsendgingerbread : "Gingerbread", TIsendmetal : "Metal", TIsendbolts : "Bolts",
TIsendenergypack : "Energy Pack", TIsendbubbly : "Bubbly", TIsendpartyfavor : "Party Favor",
TIsnowflake : "Snowflake", TIsendmagictophat : "Magic Top Hat", TIfruitcarrot : "Carrot", TIsnowdog : "Snow Dog", TIsnowwoman : "Snow Woman",
TIsnowcloud : "Snow Cloud", TIredkey : "Red Chest Key", TIbluekey : "Blue Chest Key", TIsendmapfrag : "Map Fragment",
RwFwood : "Wood", RwFenergy : "Energy", RwFcoin : "Coins", RwFfood : "Food",
RwFsend : "Opened in a new window", RwFnone : "Unrecognized",
CVsend : "Unknown Item", CVxp : "XP", CVcoin : "Coins", CVgoods : "Goods", CVnone : "Unrecognized",
CVwishlist : "Wish List", CVplay : "Play CityVille",
CVsendpermit : "Permit", CVsendendorsement : "Endorsement", CVsendenergy : "Energy",
CVsendchocolate : "Chocolate",
CVsendpresent : "Present", CVsendpinecone : "Pinecone", CVsendholidaylights : "Holiday Lights",
CVsendiceskates : "Ice Skates", CVsendwinterjacket : "Winter Jacket", CVsendwintermittens : "winter Mittens",
CVsendwinterhat : "winter Hat",
CVsendsnowflake : "Snowflake", CVsendsnowball : "Snowball",
},
// Created by avg, modified by JoeSimmons. shortcut to create an element
create : function(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".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;
},
// cross-browser log function
log: ((isGM) ? GM_log : ((window.opera) ? opera.postError : console.log)),
// click something
click : function(e, type) {
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);
},
// remove something from the page
remove : function(e) {
var node = (typeof e=='string') ? $(e) : e;
if(node) node.parentNode.removeChild(node);
},
keyDownFunc : function(e) {
if(",9,18,33,34,35,36,37,38,39,40,116".find(","+e.keyCode) || (main.paused && main.pauseClick)) return;
main.paused=true;
main.pauseClick=false;
main.pauseCount = main.opts["inputtimeout"] || 15;
main.status();
},
getBodyTextFromLink : function(item) {
if(item==null)return;
var text;
try {
if (main.realURL.find("games")) return item.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[1].textContent.replace(main.nRegex,"");
else return item.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[2].textContent.replace(main.nRegex,"");
} catch (e){
return "";//main.debug("no reference to body from link: "+item);
}
},
getAppIdFromLink : function(item){
d=item.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("data-ft");
d=d.split("app_id\":")[1].split(",")[0];
return d;
},
getActorIdFromLink : function(item){
d=item.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("data-ft");
d=d.split("actrs\":\"")[1].split("\"")[0];
return d;
},
getStoryIdFromLink : function(item){
d=item.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("data-ft");
d=d.split("fbid\":\"")[1].split("\"")[0];
return d;
//f={"src":10,"sty":237,"actrs":"1585105758","targets":"1585105758","pub_time":1293201740,"fbid":"138275076229649","s_obj":9,"s_edge":1,"s_prnt":9,"app_id":201278444497,"pos":14,"filter":"fl_103014009750339"}
},
addOneClickRemoveButtonToPost : function(item) {
appid = main.getAppIdFromLink(item);
actorid = main.getActorIdFromLink(item);
storyid = main.getStoryIdFromLink(item);
l = "/ajax/feed/filter_action.php?action=uninteresting&object_ids%5B0%5D="+actorid+"&object_ids%5B1%5D="+appid+"&story_fbids%5B0%5D="+storyid+"&source=home";
l="<a data-ft=\"{\"type\":\"hide\"}\" href=\""+l+"\" rel=\"async-post\" tabindex=\"0\" role=\"menuitem\" class=\"itemAnchor\">Hide this post</a>"
//add the button to the post
},
getLinkTextFromLink: function(item) {return (item.textContent);},
matchLinkText : function(item, text) {return (main.getLinkTextFromLink(item).toLowerCase().find(text.toLowerCase()));},
matchBodyText : function(item, text) {return (main.getBodyTextFromLink(item).toLowerCase().find(text.toLowerCase()));},
matchLinkHref : function(item, text) {return (item.href.toLowerCase().find(text.toLowerCase()));},
getGameModeFromActionLink : function(item){
if(item.href.find("/frontierville/")) return "FrV";
else if(item.href.find("/treasureisle/")) return "TI";
else if(item.href.find("/ravenwoodfair/")) return "RwF";
else if(item.href.find("/cityville/")) return "CV";
else if(item.href.find("/onthefarm/")) return "FV";
else if(item.href.find("/warstorm/")) return "WS";
else return "";
},
// all regexps are stored here
excludesRegex : /(claim land title|tame the flames|go to frontierVille|dispatch the pelican|collect the monkeys|lace up the cleats|wield the sword|clean it up|play treasure|go see my gift|go play|send thank you gift|play ravenwood fair|visit cityville|visita cityville|start your business|démarre ton activité|play warstorm)/,
whichRegexFrV : /(help|send items|send|expansion|explosives|toy|fries|straw|candy|breakfast|sledge|prairie pile|downy feathers|pine sapling|coin|apple tree|money|wood|food|brick|chick|goose|peter|lunch|loom|ribeye|experience|xp|energy|hammer|poop|rsvp|shingle|waiver|grease|mallet|slate|window|cement|screwdriver|peg|tool|energy|batter|ribbon|cloth|roadkill|diary|slate|ink well|ink pen|spitball|nail|chalk|trough|paint|drill|present|horse|mule|cow|calf|cattle|sheep|goat milk|goat|pig|path|level|tape|scrap|survey|turkey|crow|measurement|pattern|hanger|oxen|metal bar)/,
whichRegexTI : /(help|send|fruit cake|candy cane|rsvp|snowflake|snow flake|carrot|bubbly|present|fire dig|golden ticket|phoenix feather|energy capsule|oxygen|basic bait|special bait|good bait|magic bait|fruit|gem|coin|xp|coconut|banana|sushi|pineapple|watermellon|happy cake|monster kebab|dragonfruit|dragon fruit|mango|kiwi|taffy|map fragment|bonus|monkey wrench|dusky|peacock|margay|flamingo|lemur|jellyfish|gull|red panda|panda|black cat|panther|toucan|sloth|tarantula|seal|dolphin|elephant|unicorn|deer|chinchilla|porcupine|octopus|sea turtle|turtle|cockatoo|parrot|girraffe|save)/,
whichRegexRwF : /(coin|food|energy|wood)/,
whichRegexCV : /(send|contre pièces|invia|envoie|envoyer|envÃa|xp|coin|pièces|goods|bonus|marchandises|productos)/,
whichRegexWS : /(open|silver|rare|watch|play|earn|enter)/,
// get what type of item it is
which : function(item) {
var w, linkText=item.textContent.toLowerCase();
//shorten the function texts
function bText(t){if(t!=null) return main.matchBodyText(item,t); else return false;}
function lText(t){if(t!=null) return main.matchLinkText(item,t); else return false;}
function lHref(t){if(t!=null) return main.matchLinkHref(item,t); else return false;}
//check for excluded link text
if (linkText.match(main.excludesRegex)){return "exclude";}
//determine game and most likely WHICH
var gameModeNow=main.getGameModeFromActionLink(item);
switch(gameModeNow){
case "TI": w=(w==null)?linkText.match(main.whichRegexTI):w; break;
case "FrV": w=(w==null)?linkText.match(main.whichRegexFrV):w; break;
case "RwF": w=(w==null)?linkText.match(main.whichRegexRwF):w; break;
case "CV": w=(w==null)?linkText.match(main.whichRegexCV):w; break;
case "WS": w=(w==null)?linkText.match(main.whichRegexWS):w; break;
}
//if no WHICH returned, mark as NONE, otherwise remove space in matched text
w=(w!=null)?w[1].replace(main.spaceRegex,""):"none";
//search game specific link and body text for WHICH
switch(gameModeNow){
case "FrV":
//switch common text found to common WHICH type
w=(w==="experience")?"xp":(w==="money")?"coin":(w==="cattle")?"cow":
(w==="calf")?"cow":(w==="expansion")?"send":(w==="lamb")?"sheep":
(w==="downyfeathers")?"feather":(w==="pinesapling")?"pinetree":
(w==="senditems")?"wishlist":
w;
//search for common link text not listed above
w=(w==="send")?w:lText("free decoration")?"bucket":
lText("that love")?"rep":
lText("claim feast")?"food":
lText("some grub")?"food":
lText("a fruit tree")?"cherrytree":
lText("i'd like some pie")?"applepie":
lText("barbed wire")?"barbwire":
lText("groundhog bits")?"groundhog":
lText("collectibles")?"groundhog":
lText("collectible")?"randomcol":
lText("random item")?"randomcol":
lText("get ink")?"inkwell":
lText("get pen")?"inkpen":
lText("oxen collectible")?"oxencol":
lText("charter agreement")?"charter":
lText("mystery gift")?"mystery":
lText("grab a box")?"mystery":
lText("i want a boost")?"boostrand":
lText("fancy clothes")?"clothfancy":
lText("clothes")?"clothes":
lText("care package")?"carepkg":
bText("collecting chicken soup recipes")?"sendsouprecipe":
lText("fireworks")?"fireworks":
lText("receive gift")?"present":
lText("i want in")?"xp100":
bText("fruitcake")?"fruitcake":
bText("stuffed groundhog")?"stuffedgroundhog":
lText("gingerbread hut")?"gingerhut":
lText("rsvp for the party")?"firstrsvp":
lText("gimme some cow")?"cow":
lText("gimme some")?"fruitcake":
lText("i'll do it")?"sendhelp":
bText("flaxseed oil aplenty")?"flaxoil":
bText("extra cows for the taking")?"cow":
bText("floats like a butterfly and stings like a bee")?"xp50":
bText("a vacation veteran")?"ribbon":
bText("quicker picker upper")?"pitchfork":
bText("burn it down and start over")?"fire":
bText("new hobbies to enjoy")?"coin300":
bText("enjoy some free cloth")?"cloth":
bText("the animals just plain love her")?"cowmilk":
lText("gimme grub")?"food":
lText("beaver pelt")?"beaverpelt":
lText("gimme a book")?"oldbook":
lText("gimme a sack")?"grainsack":
lText("fire good")?"fire":
lText("yes, please")?"food":
w;
//determine reward for specific badges
if (bText("badge")){
w=bText("casual clicker")?"xp50":
bText("capricious clicker")?"xp100":
bText("crazy clicker")?"xp150":
bText("courageous clicker")?"xp200":
bText("sufficient spender")?"xp50":
bText("super spender")?"xp100":
bText("sophisticated spender")?"xp150":
bText("stunning spender")?"xp200":
bText("varmint vandal")?"xp50":
bText("varmint vaporizer")?"xp150":
bText("varmint vanquisher")?"xp100":
bText("talented teamwork")?"xp50":
bText("thoughtful teamwork")?"xp100":
bText("thankful teamwork")?"xp150":
bText("terrific teamwork")?"xp200":
bText("rowdy rancher")?"xp50":
bText("responsible rancher")?"xp100":
bText("respectable rancher")?"xp150":
bText("radical rancher")?"xp200":
bText("easy energy")?"xp50":
bText("edible energy")?"xp100":
bText("enormous energy")?"xp150":
bText("expensive energy")?"xp200":
bText("controlled consumption")?"xp50":
bText("crazy consumption")?"xp100":
bText("costly consumption")?"xp150":
bText("concentrated consumption")?"xp200":
bText("dandy decorator")?"xp50":
bText("delightful decorator")?"xp100":
bText("detailed decorator")?"xp150":
bText("devoted decorator")?"xp200":
bText("cool cultivator")?"xp50":
bText("competent cultivator")?"xp100":
bText("clever cultivator")?"xp150":
bText("coordinated cultivator")?"xp200":
bText("excellent employer")?"xp50":
bText("engaging employer")?"xp100":
bText("exceptional employer")?"xp150":
bText("experienced employer")?"xp200":
bText("horseshoe handler")?"xp50":
bText("horseshoe honcho")?"xp100":
bText("horseshoe hustler")?"xp150":
bText("horseshoe hero")?"xp200":
bText("accute accumulation")?"coin150":
bText("adequate accumulation")?"coin250":
bText("ample accumulation")?"coin500":
bText("advanced accumulation")?"coin1000":
bText("naive neighbor")?"xp50":
bText("noble neighbor")?"xp100":
bText("needy neighbor")?"xp150":
bText("noteworthy neighbor")?"xp200":
bText("able repeater")?"xp50":
bText("stubborn repeater")?"xp100":
bText("amazing repeater")?"xp150":
bText("illustrious repeater")?"xp200":
bText("resolute pioneer")?"xp200":
bText("patient player")?"xp50":
bText("proud player")?"xp100":
bText("passionate player")?"xp150":
bText("perfect player")?"xp200":
bText("clever trader")?"xp50":
bText("cunning trader")?"xp100":
bText("wily trader")?"xp150":
bText("?? trader")?"xp200":
w; //unknown badge xp
}
// determine quantity of cloth from reward
else if (w==="cloth"){
w=bText("key to prosperity")?"cloth2":
bText("readying some fancy duds")?"cloth2":
bText("ready fer the quiltin' bee")?"cloth1":
bText("becomin' a world-class trader")?"cloth1":
bText("making presents for a relative's wedding")?"cloth1":
bText("likes big suds and cannot lie")?"cloth25":
bText("has brought a barber to the")?"cloth25":
bText("has properly furnished the Barber Shop")?"cloth25":
bText("new baby has arrived")?"cloth2": //for both child 2 and 3
bText("has properly finished the Barber Shop")?"cloth25":
bText("is playing more frontierville in the new year")?"cloth5":
w; //unknown cloth count
}
// determine specific xp value from reward
else if (w==="xp"){
w=bText("new general store manager")?"xp100":
bText("bear")?"xp50":
bText("primed")?"xp150":
bText("snake")?"xp50":
bText("niblets")?"xp150":
bText("fowl watch")?"xp15":
bText("pumpkin")?"xp100":
bText("flax")?"xp200":
bText("cakes")?"xp100":
bText("decorating")?"xp50":
bText("oxen")?"xp50":
bText("schooled")?"xp25":
bText("spud stud")?"xp40":
bText("cousin")?"xp50":
bText("thorny")?"xp75":
bText("groundhog")?"xp100":
bText("birthday")?"xp75":
bText("is now level")?"xp15":
bText("whole new crop: cabbages")?"xp50":
bText("where babies come from")?"xp100":
bText("looking to have a second child")?"xp40":
bText("looking to have a third child")?"xp40":
bText("looking to have a fourth child")?"xp40":
bText("looking to have a fifth child")?"xp60":
bText("looking to have a sixth child")?"xp100":
bText("babies is tiring work")?"xp120":
bText("took care of some neighbor crops")?"xp25":
bText("completed the first")?"xp15":
bText("sheep will be safe now")?"xp20":
bText("new water tower")?"xp100":
bText("easy to notice on the frontier")?"xp25":
bText("homemade medicine")?"xp25":
bText("everything about sunflowers")?"xp25":
bText("made things nice and hot")?"xp50":
bText("wood for generations")?"xp25":
bText("icing")?"xp100":
bText("wants to be a jackalope")?"xp50":
bText("beared it all")?"xp50":
bText("little fellas fed")?"xp50":
bText("big animals satisfied")?"xp50":
bText("getting bigger")?"xp100":
bText("made a big table")?"xp100":
bText("storage shed! listen")?"xp100":
bText("storage shed! learn")?"xp150":
bText("built him a gingerbread")?"xp100":
w;
}
// determine specific value of coin reward
else if (w==="coin"){
w=bText("sheep had wandered off")?"coin100":
bText("everyday cabin")?"coin100":
bText("time to think about a spouse")?"coin100":
bText("honeymoon is over")?"coin100":
bText("whole family of teeny avatars")?"coin100":
bText("spelling bee")?"coin200":
bText("tough an' they're fast")?"coin200":
bText("know 'bout chickens")?"coin500":
bText("master farmer")?"coin500":
bText("mighty famous")?"coin500":
bText("most famous people")?"coin1000":
bText("sent off a gift bed")?"coin100":
bText("keeping the wilderness at bay")?"coin100":
bText("whole passel of emergency")?"coin100":
bText("bigger is better")?"coin250":
bText("wants an extension")?"coin100":
bText("extended the family homestead")?"coin200":
bText("traded in the")?"coin100":
w;
}
//determine specific collectible given
else if (w==="randomcol"){
w=bText("spying")?"foxcol":
bText("groundhog")?"groundhog":
bText("troll")?"tollcol":
bText("bustle")?"tailorcol":
bText("four members")?"babycol":
w;
}
//determine how many toys offered
else if (w==="toy"){
w=lText("two toys")?"toy2":
lText("five toys")?"toy5":
lText("ten toys")?"toy10":
w;
}
//check for baby clothes
else if (w==="clothes"){
w=bText("baby clothes")?"babyclothes":w;
}
//determine specific boost given
else if (w==="boostrand"){
w=bText("cherries")?"boostcherry":w;
}
//determine specific item being sent as gift
else if (w==="send" || w==="help"){
w=bText("hammer")?"sendhammer":
bText("kick the party up")?"sendfirstrsvp":
bText("food to prepare for the feast")?"sendturkeyrsvp":
bText("nail")?"sendnail":
bText("paint")?"sendpaint":
bText("peg")?"sendpeg":
bText("cement")?"sendcement":
bText("shingle")?"sendshingle":
bText("window")?"sendwindow":
bText("mallet")?"sendmallet":
bText("screwdriver")?"sendscrewdriver":
bText("survey")?"sendsurvey":
bText("waiver")?"sendwaiver":
bText("pattern")?"sendpattern":
bText("elbow")?"sendgrease":
bText("brick")?"sendbrick":
bText("drill")?"senddrill":
bText("tape")?"sendtape":
bText("level")?"sendlevel":
bText("rsvp")?"sendrsvp":
bText("scrap")?"sendscrap":
bText("handshake")?"sendhandshake":
bText("charter")?"sendcharter":
bText("pen")?"sendinkpen":
bText("wells")?"sendinkwell":
bText("chalk")?"sendchalk":
bText("spitball")?"sendspitball":
bText("slate")?"sendslate":
bText("baby clothes")?"sendbabyclothes":
bText("hanger")?"sendhanger":
bText("inseam")?"sendmeasurement":
bText("pattern")?"sendpattern":
bText("snack")?"sendenergy":
bText("bins")?"sendbins":
bText("plans")?"sendplans":
bText("shelves")?"sendshelves":
bText("cabbage seeds")?"sendseedscabbage":
bText("baby names")?"sendbabynames":
bText("logging permit")?"sendloggingpermit":
bText("shipping label")?"sendshippinglabel":
bText("sewing needle")?"sendsewingneedle":
lText("tile")?"sendtile":
lText("awl")?"sendawl":
lText("beam")?"sendbeam":
lText("trade permit")?"sendtradepermit":
lText("coffin")?"sendcoffin":
lText("milking stool")?"sendmilkingstool":
lText("plaster")?"sendplaster":
lText("spackle")?"sendspackle":
lText("sink")?"sendsink":
lText("book")?"sendbook":
lText("shaving lather")?"sendshavinglather":
lText("birch bark")?"sendbirchbark":
lText("jigs")?"sendjigmusic":
bText("canning jar")?"sendcanningjar":
bText("boots")?"sendboots":
bText("free bars")?"sendmetalbar":
bText("metal bar")?"sendmetalbar":
bText("rodeo hat")?"sendrodeohat":
bText("chaps")?"sendchaps":
bText("rodeo vest")?"sendrodeovest":
bText("special seasoning")?"sendseasoning":
bText("cardboard box")?"sendcardboardbox":
bText("jug")?"sendjug":
bText("crowbar")?"sendcrowbar":
lText("feed bag")?"sendfeedbag":
lText("candy cane")?"sendcandycane":
lText("gum drops")?"sendgumdrops":
bText("tinder")?"sendtinder":
bText("holly wreath")?"sendholly":
bText("bale of straw")?"sendstrawbale":
bText("carrot")?"sendcarrot":
bText("coal")?"sendcoal":
bText("hat")?"sendsnowhat":
bText("spoon")?"sendservingspoon":
bText("toys")?"sendtoys":
bText("christmas card")?"sendxmascard":
bText("gingerbread slab")?"sendgingerslab":
bText("frosting tube")?"sendtubefrosting":
bText("dried fruit")?"senddriedfruit":
lText("chocolate bar")?"sendchocolatebar":
lText("hardwood")?"sendhardwood":
lText("welcome basket")?"sendwelcomebasket":
lText("game")?"sendgame":
w;
}
//switch to undefined collection if enabled
w=(w==="none" && main.opts["FrVdoUnknown"])?"doUnknown":w;
break;
case "TI":
//switch common words found to common WHICH type
w=(w==="carrot"||w==="taffy"||w==="candycane"||w==="mango"||w==="banana"||w==="coconut"||w==="sushi"||w==="pineapple"||w==="kiwi"||w==="watermellon"||w==="happycake"||w==="monsterkebab"||w==="dragonfruit"||w==="fruitcake")?"fruit"+w:w;
//search for common link text not listed above
w=lText("gimme, gimme more")?"xp":
lText("grab some of that power")?"xp":
lText("help out")?"send":
lText("some love")?"xp":
lText("your gems")?"gemyours":
lText("claim reward")?"bonus":
lText("claim your treasure")?"bonus":
lText("send gift")?"wishlist":
lText("save the turkey")?"petturkey":
lText("take the treasure")?"wishgift":
lText("get some hors")?"fruithors":
lText("cheese platter")?"fruitcheeseplatter":
lText("turkey feast")?"fruitturkeyfeast":
lText("black balloons")?"blackballoons":
lText("black coffee")?"fruitblackcoffee":
lText("coffee tray")?"fruitblackcoffee":
lText("mclovin")?"petmclovin":
lText("jd turkleton")?"jdturkey":
lText("building materials")?"buildingmaterials":
lText("street lamp")?"streetlamp":
lText("christmas boat")?"christmasboat":
lText("snow dog")?"snowdog":
lText("snow woman")?"snowwoman":
lText("snow cloud")?"snowcloud":
lText("red chest key")?"redkey":
lText("blue chest key")?"bluekey":
w;
//deterine color or type of gem rewarded
if (w==="gem"){
w=bText("red")?"gemred":
bText("blue")?"gemblue":
bText("purple")?"gempurple":
bText("orange")?"gemorange":
bText("green")?"gemgreen":
bText("of each")?"gembag":
w;
}
//determine specific items given by reward or bonus text links
else if (w==="bonus"){
w=bText("bag of pineapples")?"fruitpineapple":
bText("of each gem")?"gembag":
bText("turkey feast")?"fruitturkeyfeast":
bText("racoontable")?"racoontable":
bText("sunflowers")?"sunflowers":
bText("fail whale")?"failwhale":
bText("swan boat")?"swanboat":
bText("big barn")?"bigbarn":
bText("garden plot")?"gardenplot":
bText("pig float")?"pigfloat":
bText("pumpkin pie")?"fruitpumpkinpie":
bText("cheese platter")?"fruitcheeseplatter":
bText("black coffee")?"fruitblackcoffee":
bText("fruit cake")?"fruitfruitcake":
bText("building material")?"buildingmaterials":
bText("jd turkelton")?"jdturkey":
bText("christmas boat")?"christmasboat":
bText("mclovin")?"petmclovin":
bText("street lamp")?"streetlamp":
bText("hors d'oeuvre")?"fruithors":
bText("snow dog")?"snowdog":
bText("snow woman")?"snowwoman":
bText("snow cloud")?"snowcloud":
bText("red chest key")?"redkey":
bText("blue chest key")?"bluekey":
bText("fruit")?"fruit":
w;
}
else if (w==="send"){
w=bText("scarf")?"sendscarf":
bText("slush")?"sendslush":
bText("resin")?"sendresin":
bText("dye")?"senddye":
bText("marble")?"sendmarble":
bText("pillar")?"sendpillar":
bText("paint")?"sendpaint":
bText("shells")?"sendshells":
bText("planks")?"sendplanks":
bText("aqua vitae")?"sendaquavitae":
bText("nails")?"sendnails":
bText("rock")?"sendrock":
bText("ectoplasm")?"sendectoplasm":
bText("frosting")?"sendfrosting":
bText("cloth")?"sendcloth":
bText("gold")?"sendgold":
bText("seeds")?"sendseeds":
bText("fire")?"sendfire":
bText("rope")?"sendrope":
bText("oil")?"sendoil":
bText("ice")?"sendice":
bText("gum drops")?"sendgumdrops":
bText("glue")?"sendglue":
bText("packed snow")?"sendpackedsnow":
bText("glass")?"sendglass":
bText("metal")?"sendmetal":
bText("gears")?"sendgears":
bText("bolts")?"sendbolts":
bText("gingerbread")?"sendgingerbread":
lText("energy pack")?"sendenergypack":
lText("bubbly")?"sendbubbly":
lText("party favor")?"sendpartyfavor":
lText("map frag")?"sendmapfrag":
lText("magic top hat")?"sendmagictophat":
w;
}
//switch to undefined collection if enabled
w=(w==="none" && main.opts["TIdoUnknown"])?"doUnknown":w;
break;
case "RwF":
w=lText("help me")?"send":w;
break;
case "CV":
w=lHref("holiday2010_tree_gift_request")?"sendpresent":
lHref("permits_request")?"sendpermit":
lHref("mayor_endorsement")?"sendendorsement":
lHref("holiday_snow_pinecone")?"sendpinecone":
lHref("holiday_snow_skate")?"sendiceskates":
lHref("holiday_mittens")?"sendwintermitten":
lHref("holiday_puffy_jacket")?"sendwinterjacket":
lHref("holiday_winter_hat")?"sendwinterhat":
lHref("holiday_snow_snowball")?"sendsnowball":
lHref("holiday_snow_snowflake")?"sendsnowflake":
lHref("holiday_snow_lights")?"sendholidaylights":
lHref("place_statue")?"xp":
lHref("daily_bonus")?"coin":
lHref("neighbor_visit_crops")?"goods":
lHref("neighbor_visit_default")?"coin":
lHref("reputation_level_up")?"goods":
lHref("visit_neighbor")?"xp":
lHref("energy_feed")?"sendenergy":
lHref("star_rating_increased")?"coin":
lHref("news_viral")?"coin":
lHref("state_fair4")?"coin":
lHref("state_fair3")?"xp":
lHref("state_fair2")?"goods":
lHref("state_fair1")?"coin":
lHref("collection_trade_in")?"coin":
lHref("neighbors.php")?"wishlist":
lHref("level_up_")?"xp":
lHref("neighbor_visit_bus")?"coin":
lHref("little_italy1")?"goods":
lHref("little_italy2")?"coin":
lHref("earn_star")?"coin":
lHref("ugc_viral")?"coin":
lHref("bonus_remind_accept")?"coin":
lHref("startuptype=emptylot")?"play":
lHref("world_tour3")?"goods":
lHref("world_tour1")?"goods":
lHref("prepare_shipping2")?"xp":
lHref("time_capsule2")?"xp":
lHref("grow_hq")?"goods":
lHref("place_hq")?"xp":
lHref("train1")?"goods":
lHref("train4")?"goods":
lHref("train3")?"goods":
lHref("rita_garden")?"goods":
lHref("rita_cont2")?"coin":
lHref("edgar_burger")?"coin":
lHref("elected_mayor")?"coin":
lHref("mayor_prep")?"coin":
lHref("central_park3")?"xp":
lHref("central_park1")?"xp":
lHref("safety_first")?"goods":
lHref("place_to_play")?"xp":
lHref("capitol_sports2")?"xp":
lHref("capitol_sports1")?"goods":
lHref("pigeon3")?"goods":
lHref("pigeon4")?"coin":
lHref("more_andre2")?"goods":
lHref("more_andre3")?"xp":
lHref("build_school")?"xp":
lHref("holiday_winterclothes")?"coin":
lHref("more_billy1")?"coin":
lHref("more_billy2")?"coin":
lHref("more_billy3")?"xp":
lHref("more_billy4")?"goods":
lHref("increase_pop")?"xp":
lHref("prepare_capital_city")?"xp":
lHref("plant_and_harvest")?"xp":
lHref("build_neighborhood")?"coin":
lHref("pretty_up_bakery")?"sendchocolate":
lHref("grow_pop")?"xp":
//fallbacks
lText("send")?"send":
lText("coins")?"coin":
lText("goods")?"goods":
lText("xp")?"xp":
w;
break;
case "WS":
break;
} //end gamemode switch
return gameModeNow + w;
},
failedItem : function(d, t) {
return main.failTextRegex.test(t.toLowerCase());
},
gotItem : function(d, t) {
return main.accTextRegex.test(t.toLowerCase());
},
// function to debug stuff. displays in a big white textarea box
debug : function(s) {
var d=$("debugT");
if(!d) document.body.insertBefore(d=main.create("textarea", {id:"debugT",style:"position:fixed; top:20px; left:20px; width:95%; height:90%; color:#000000; background:#ffffff; border:3px ridge #000000; z-index:99999;",ondblclick:function(e){e.target.style.display="none";}}, new Array(main.create("text",s))), document.body.firstChild);
else d.innerHTML+="\n\n\n\n"+s;
if(d.style.display=="none") d.style.display="";
},
// get the key for the url
getKey : function(href) {
if(href.find("/frontierville/")){
return href.match(main.keyRegexFrV)[1];
}
else if(href.find("/treasureisle/")){
return href.match(main.keyRegexTI)[1];
}
else if(href.find("/ravenwoodfair/")){
return href.match(main.keyRegexRwF)[1];
}
else if(href.find("/cityville/")){
return href.match(main.keyRegexCV)[1];
}
else if(href.find("/warstorm/")){
return href.match(main.keyRegexWS)[1];
}
return "nokey";
},
storeTypes : /^(true|false|\d+)$/,
getValue : (isGM ? GM_getValue : (function(name, def) {
var s=localStorage.getItem(name), val = ((s=="undefined" || s=="null") ? def : s);
if(typeof val == "string" && main.storeTypes.test(val)) val = ((new Function("return "+val+";"))());
return val;
})),
setValue : (isGM ? GM_setValue : (function(name, value) {return localStorage.setItem(name, value)})),
deleteValue : (isGM ? GM_deleteValue : (function(name, def) {return localStorage.setItem(name, def)})),
// get the accepted items' times they were accepted
getAcceptedTime : function() {
return (new Function("return "+(main.getValue(main.gameAcronym.toLowerCase()+"_accepted_time_"+main.profile, "({})"))+";"))();
},
// save the accepted items' times they were accepted
setAcceptedTime : function(e) {
var val = JSON.stringify(e), store=main.gameAcronym.toLowerCase()+"_accepted_time_"+main.profile;
main.setValue(store, val);
},
// get the accepted items' times they were accepted
getFailedTime : function() {
return (new Function("return "+(main.getValue(main.gameAcronym.toLowerCase()+"_failed_time_"+main.profile, "({})"))+";"))();
},
// save the accepted items' times they were accepted
setFailedTime : function(e) {
var val = JSON.stringify(e), store=main.gameAcronym.toLowerCase()+"_failed_time_"+main.profile;
main.setValue(store,val);
},
// reset the accepted items
resetAccepted : function() {
if(confirm("Really reset accepted items?")) window.setTimeout(function(){
var reset=main.deleteValue;
reset(main.gameAcronym.toLowerCase()+"_accepted_"+main.profile, "({})");
reset(main.gameAcronym.toLowerCase()+"_accepted_time_"+main.profile, "({})");
reset(main.gameAcronym.toLowerCase()+"_failed_"+main.profile, "({})");
reset(main.gameAcronym.toLowerCase()+"_failed_time_"+main.profile, "({})");
reset(main.gameAcronym.toLowerCase()+"_DetlColl_"+main.profile, "({})");
}, 0);
},
// get the accepted items
getAccepted : function() {
return (new Function("return "+(main.getValue(main.gameAcronym.toLowerCase()+"_accepted_"+main.profile, "({})"))+";"))();
},
// save the accepted items
setAccepted : function(e) {
var val = JSON.stringify(e), store=main.gameAcronym.toLowerCase()+"_accepted_"+main.profile;
main.setValue(store,val);
},
// get the accepted items
getFailed : function() {
return (new Function("return "+main.getValue(main.gameAcronym.toLowerCase()+"_failed_"+main.profile, "({})")+";"))();
},
// save the accepted items
setFailed : function(e) {
var val = JSON.stringify(e), store=main.gameAcronym.toLowerCase()+"_failed_"+main.profile;
main.setValue(store,val);
},
// get number of current requests
get currReqs() {
//return $g("count(.//iframe)",{node:$("silent_req_holder"),type:1});
return main.requestsOpen;
},
toHomepage : function() {
window.location.replace(main.realURL);
},
toFilterpage : function(appID) {
window.location.replace("http://www.facebook.com/home.php?filter=app_"+appID+"&show_hidden=true&ignore_self=true&sk=lf");
},
colorCode : function(item, type) {
try {
switch(main.opts["colorcode"]) {
case true:
var div = $g(".//ancestor::*[starts-with(@id,'stream_story_') and not(contains(@id,'_collapsed'))]", {type:9, node:item});
if(div) div.className = div.getAttribute("class").replace(main.postStatusRegex, "") + " item"+(type || "neutral");
break;
}
} catch(e) {alert(e);}
},
// generate a refresh time
get refTime() {
var t=2;
switch(GM_config.get("arinterval")) {
case "sixth": t = 0.1666667; break; // 10 seconds
case "third": t = 0.3333333; break; // 20 seconds
case "half": t = 0.5; break; // 30 seconds
case "one": t = 1; break; // 1 minute
case "two": t = 2; break; // 2 minutes
case "three": t = 3; break; // 3 minutes
case "four": t = 4; break; // 4 minutes
case "five": t = 5; break; // 5 minutes
case "ten": t = 10; break; // 10 minutes
case "30s2m": t = (Math.random() * 1.5) + 0.5; break; // random between 30s and 2m
case "2m5m": t = (Math.random() * 3) + 2; break; // random between 2m and 5m
case "5m10m": t = (Math.random() * 5) + 5; break; // random between 5m and 10m
}
return Math.round((t*60000)+(Math.random()*(t*250)));
},
// get the real url of the page
get realURL() {
//joe's hash checker
var u=window.location.href, host=window.location.host, protocol=window.location.protocol+"//", hash=window.location.hash;
if(hash!="" && main.phpRegex.test(hash)) u=protocol+host+hash.split("#")[1];
else if(hash!="" && hash.find("#")) u=u.split("#")[0];
//prevent unnamed hash at the end when we click older posts at the same time page refreshes
if (u.substr(-1) === "#") u=u.split("#")[0];
return u;
},
getOlderPostsButton : function(){
var more=$g("//a[(contains(.,'Older Posts') or contains(.,'Show Older')) and contains(@class,'uiMorePagerPrimary')]", {type:9});
return more;
},
// show config screen
config : function() {
if(main.currReqs == 0) { // if the # of requests are at 0
GM_config.open(); // open the options menu
try{ $(main.gameAcronym.toLowerCase()+"_msgbox").style.display = "none"; }catch(e){} // hide msg box
}
else {
window.setTimeout(main.config, 1000); // check in 1 second
main.message("Please wait... finishing requests..."); // show pls wait msg
}
},
removeSkipped : function(){
var done = $g(".//a[starts-with(@id,'item_skip_') or contains(.,'Play Ravenwood Fair') or contains(.,'Play CityVille') or contains(.,'Play FrontierVille') or contains(.,'Play Treasure Isle') or contains(.,'Play Treasure Isle')]/ancestor::*[starts-with(@id,'stream_story_') and not(contains(@id, '_collapsed'))]", {node:main.stream});
for(var i=0,len=done.snapshotLength; i<len; i++) if(!$g(".//span[starts-with(@class,'UIActionLinks')]//a[starts-with(@id,'item_processing_')] | .//*[starts-with(@id,'stream_story_') and contains(@id,'_collapsed')]", {type:9, node:done.snapshotItem(i)})) main.remove(done.snapshotItem(i).id);
if (main.opts["filterWishlists"]===false){
var wishlist = $g(".//a[starts-with(@id,'item_wishlist_')]/ancestor::*[starts-with(@id,'stream_story_') and not(contains(@id, '_collapsed'))]", {node:main.stream});
for(var i=0,len=wishlist.snapshotLength; i<len; i++) main.remove(wishlist.snapshotItem(i).id);
wishlist=null;
}
done=null;
return;
},
getIsStale : function(tStamp) {
//returns true if date in tStamp differs from NOW by 24 hours or more
var d=new Date(tStamp),d2=new Date();
return (d2.valueOf() - d.valueOf()) > 86400000;
},
removeDone : function() {
//get finished posts and delete nodes
var done = $g(".//a[starts-with(@id,'item_done_') or starts-with(@id,'item_overlimit_') or starts-with(@id,'item_failed_') or starts-with(@id,'item_skip_')]/ancestor::*[starts-with(@id,'stream_story_') and not(contains(@id, '_collapsed'))]", {node:main.stream});
for(var i=0,len=done.snapshotLength; i<len; i++) if(!$g(".//span[starts-with(@class,'UIActionLinks')]//a[starts-with(@id,'item_processing_')] | .//*[starts-with(@id,'stream_story_') and contains(@id,'_collapsed')]", {type:9, node:done.snapshotItem(i)})) main.remove(done.snapshotItem(i).id);
//also delete protected wishlist items if option is not checked
if (main.opts["filterWishlists"]===false){
var wishlist = $g(".//a[starts-with(@id,'item_wishlist_')]/ancestor::*[starts-with(@id,'stream_story_') and not(contains(@id, '_collapsed'))]", {node:main.stream});
for(var i=0,len=wishlist.snapshotLength; i<len; i++) main.remove(wishlist.snapshotItem(i).id);
wishlist=null;
}
done=null;
return;
},
removeFiltered : function() {
var done = $g(".//a[not(starts-with(@id,'item_'))]/ancestor::*[starts-with(@id,'stream_story_') and not(contains(@id, '_collapsed'))]", {node:main.stream});
for(var i=0,len=done.snapshotLength; i<len; i++) {
var del = true, ssi =done.snapshotItem(i).innerHTML;
if(ssi.find(main.gameURLpartFrV) && main.opts["filterHideFrV"]===false) del=false;
if(ssi.find(main.gameURLpartTI) && main.opts["filterHideTI"]===false) del=false;
if(ssi.find(main.gameURLpartFV) && main.opts["filterDontHideFV"]===true) del=false;
if(ssi.find(main.gameURLpartWS) && main.opts["filterDontHideWS"]===true) del=false;
if(ssi.find(main.gameURLpartRwF) && main.opts["filterHideRwF"]===false) del=false;
if(ssi.find(main.gameURLpartCV) && main.opts["filterHideCV"]===false) del=false;
if (del===true) main.remove(done.snapshotItem(i).id);
}
done=null;
return;
},
// auto click "like" buttons if enabled
like : function(id) {
var like=$g("//a[contains(@id,'_"+id+"')]/ancestor::span/button[@name='like' and @type='submit']", {type:9});
if(like) like.click();
},
expand : function() {
var posts=$g("count(.//*[starts-with(@id,'stream_story_') and contains(@class,'"+main.gameID+"')])", {node:main.stream, type:1}),
more=main.getOlderPostsButton();
min = main.opts["minposts"];
switch(min != "off" && more != null) {
case true: if(posts < parseInt(min)) main.click(more);
else main.opts["minposts"] = "off"; break;
}
},
similarPosts : function() {
// Auto click "show x similar posts" links
var sp = $g(".//a[@rel='async' and contains(@ajaxify,'oldest=') and contains(@ajaxify,'newest=') and not(starts-with(@id, 'similar_post_'))] | .//a[@rel='async' and contains(.,'SHOW') and contains(.,'SIMILAR POSTS') and not(starts-with(@id, 'similar_post_'))]", {node:main.stream, type:9}),
posts = $g("count(.//*[starts-with(@id,'stream_story_') and contains(@class,'"+main.gameID+"') and not(contains(@id,'_collapsed'))])", {node:main.stream, type:1}),
max = main.opts["maxposts"], maxC = parseInt(max) || 9999;
if(sp && (max == "off" || (max != "off" && posts < maxC))) {
if(max=="off" || ((parseInt(sp.textContent.match(main.numberRegex)[0]) + posts) < maxC)) {
sp.setAttribute("id", "similar_post_"+sp.getAttribute("ajaxify").split("stream_story_")[1].split("&")[0]);
main.click(sp);
return;
} else return;
}
},
olderPosts : function() {
// Auto click "older posts" or "show older"
var posts=$g("count(.//*[starts-with(@id,'stream_story_') and (contains(@id,'item_') or contains(@class,'"+main.gameIDFrV+"') or contains(@class,'"+main.gameIDRwF+"') )])", {node:main.stream, type:1}),
more=main.getOlderPostsButton();
max = main.opts["olderlimit"];
if ((max=="off" || (posts < parseInt(max))) && more!=null) main.click(more);
return;
},
printShareableFriendList : function(){
var c, l,p = "http://www.facebook.com/profile.php?id=", chop= main.opts["chopprinting"];
if(main.opts["FrVfriendlist"]){
main.debug("Frontierville Friends Who Played Recently")
l="";
for (c=0,len=main.FrVfriendListHolder.length; c<len; c++){
l = l + p + main.FrVfriendListHolder[c] + "\r";
if(l.length > 900 && chop) {main.debug(l); l="";}
}
main.debug(l);
}
if(main.opts["TIfriendlist"]){
main.debug("Treasureisle Friends Who Played Recently")
l="";
for (c=0,len=main.TIfriendListHolder.length; c<len; c++){
l = l + p + main.TIfriendListHolder[c] + "\r";
if(l.length > 900 && chop) {main.debug(l); l="";}
}
main.debug(l);
}
if(main.opts["RwFfriendlist"]){
main.debug("Ravenwood Friends Who Played Recently")
l="";
for (c=0,len=main.RwFfriendListHolder.length; c<len; c++){
l = l + p + main.RwFfriendListHolder[c] + "\r";
if(l.length > 900 && chop) {main.debug(l); l="";}
}
main.debug(l);
}
if(main.opts["CVfriendlist"]){
main.debug("CityVille Friends Who Played Recently")
l="";
for (c=0,len=main.CVfriendListHolder.length; c<len; c++){
l = l + p + main.CVfriendListHolder[c] + "\r";
if(l.length > 900 && chop) {main.debug(l); l="";}
}
main.debug(l);
}
if(main.opts["WSfriendlist"]){
main.debug("WarStorm Friends Who Played Recently")
l="";
for (c=0,len=main.WSfriendListHolder.length; c<len; c++){
l = l + p + main.WSfriendListHolder[c] + "\r";
if(l.length > 900 && chop) {main.debug(l); l="";}
}
main.debug(l);
}
main.debug("Hit refresh on your browser to continue");
},
// refresh function. be sure to only do it if the config isn't up, it isn't paused, and requests are finished
// also prevent refresh if window open
refresh : function() {
if(main.currReqs==0 && !$("GM_config") && !main.paused && !main.openPopup && main.opts["olderdepth"]===false) {
//check if need to print a friends list for sharing
if (main.special24HourBit==1) {
if (main.opts["FrVfriendlist"] || main.opts["TIfriendlist"] || main.opts["RwFfriendlist"] || main.opts["CVfriendlist"] || main.opts["WSfriendlist"]){
//pause and print the lists
main.paused = true;
main.printShareableFriendList();
return; //prevents refresh timer from starting up again
}
}
//do refresh
var i=0, refint=window.setInterval(function() {
if(i >= 12 && main.currReqs==0) {
window.clearInterval(runint);
window.clearInterval(refint);
if (main.oTab) main.oTab.close();
if (main.opts["filteronly"]==1) main.toFilterpage(main.gameIDFrV); // if filter only option is enabled
else if (main.opts["filteronly"]==2) main.toFilterpage(main.gameIDTI); // if filter only option is enabled
else main.toHomepage(); // if filter only option is disabled or un-defined
}
else if(i < 12 && main.currReqs==0) i++;
else i=0;
}, 250);
} else window.setTimeout(main.refresh, (main.currReqs == 0 ? 1 : main.currReqs)*1000);
},
dropItem : function(key, w, intv) {
// otherwise, clean it up and forget it
var item = $g(".//a[contains(@id,'"+key+"')]", {type:9, node:main.stream});
if(item) {
//if the item was in the processing state, remove that state and color
if (item.getAttribute("id").find("item_proc")) {
item.setAttribute("id", "item_skip_"+key);
main.colorCode(item, "neutral");
if (main.requestsOpen>0) main.requestsOpen--;
}
main.remove(key);
}
if (intv) window.clearInterval(intv);
},
// update debug status box
status : function() {
switch(main.pauseCount) {case 0: if(!main.pauseClick) main.paused=false; break;}
var statusText = !main.boxFull ? (!main.paused?"["+main.gameAcronym+"] "+main.currReqs+" requests currently ("+main.openCount+" done)":(!main.pauseClick?("["+main.pauseCount+"] "):"")+"[PAUSED] Click this box to unpause") : "[STOPPED] Gift box is full - Refresh to restart";
switch(document.title != statusText) {case true: document.title=statusText; break;}
switch($("status_WM").textContent != statusText) {case true: $("status_WM").textContent = statusText; break;}
if(!main.pauseClick && main.paused && main.pauseCount>0) main.pauseCount--;
},
// display a message in the middle of the screen
message : function(t) {
if(GM_config.get("newuserhints") === false) return;
var box = $(main.gameAcronym.toLowerCase()+"_msgbox");
if(box=="null" || box==null || box.nodeType !== 1) $("contentArea").insertBefore(box=main.create("div", {id:main.gameAcronym.toLowerCase()+"_msgbox",style:"background:#CAEEFF; border:2px solid #4AC5FF; z-index:998; padding:20px; -moz-border-radius:6px; -moz-appearance:none; display:none;"}, new Array(
main.create("div", {style:"width:100%; text-align:right;"}, new Array(
main.create("a", {textContent:"Close", style:"font-size:9pt; font-family:myriad pro,tahoma,arial,verdana; color:#000000;", href:"javascript:void(0);", onclick:function(e){ e.target.parentNode.parentNode.style.display = "none"; }})
)),
main.create("br"),
main.create("span", {innerHTML:t, style:"color:#002537; font-size:16pt; font-family:myriad pro,tahoma,arial,verdana;"})
)), $("contentArea").firstChild);
else box.getElementsByTagName("span")[0].innerHTML = t;
if(box.style.display=="none") fade(box.id, "in", "fast");
},
setAsAccepted : function(key, w) {
//autolike if turned on
if(main.opts["autolike"]===true) main.like(key);
var accTime=main.getAcceptedTime(), acc=main.getAccepted(),item=$g("//a[contains(@id,'"+key+"')]", {type:9});
item.setAttribute("id", "item_done_"+key);
item.textContent=
w.startsWith("CV")?"Tried": (((w.find("send")?"Sent ":w.find("wishlist")?"":"Got ") + main.accText[w]) || main.accDefaultText);
main.colorCode(item, w.startsWith("CV")?"city":"done");
main.openCount++;
accTime[w][key] = new Date().getTime();
main.setAcceptedTime(accTime);
acc[w].push(key);
main.setAccepted(acc);
main.remove(key);
},
setAsFailed : function(key, w, comment){
var item=$g("//a[contains(@id,'"+key+"')]", {type:9}), failed=main.getFailed(), failedTime=main.getFailedTime();
item.setAttribute("id", "item_failed_"+key);
item.textContent = comment;
main.colorCode(item, "failed");
if (main.opts["countfailed"]) main.openCount++;
failedTime[w][key] = new Date().getTime();
main.setFailedTime(failedTime);
failed[w].push(key);
main.setFailed(failed);
main.remove(key);
},
onFrameLoad_RwF : function(key, w){
//main.debug("frameload_rwf");
//RavenWood Fair has a different kind of popup window and we need to find the send button
tabStream=main.oTab.document;
Mozilla add on,User script,Grease Monkey Script, greasemonkey userscripts, updater userscripts mafia wars userscripts mafia wars autoplayer userscripts mafia wars wall userscripts scripts userscripts travian greasemonkey greasemonkey download greasemonkey facebook greasemonkey tutorial greasemonkey youtube greasemonkey travian greasemonkey chrome greasemonkey mafia wars greasemonkey mafia wars autoplayer
Saturday, January 22, 2011
Frontier Ville and Treasure Island Wall Manager
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment