Enhanced Ticker

Various fixes for the very bare ticker.

当前为 2016-01-12 提交的版本,查看 最新版本

// ==UserScript==
// @name        Enhanced Ticker
// @namespace   MrBrax, Xelivous
// @description Various fixes for the very bare ticker.
// @include     https://facepunch.com/fp_ticker.php
// @require		https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @version     3.15
// @grant 		GM_xmlhttpRequest
// ==/UserScript==

ETICKER = {};

ETICKER.VERSION = 3.15;

ETICKER.IMG_MAGNIFIER 	= "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAH5SURBVDjLpZK/a5NhEMe/748kRqypmqQQgz/oUPUPECpCoEVwyNStIA6COFR33boIjg6mg4uL0k0EO1RFISKImkHQxlbQRAsx0dgKJm/e53nunnOwViR5leJnuZs+973jHBHB/+D/ah7X2LXWloilyMw5YgtD3CDiBWN4Zno8bQcJHBFBucauZfsolZDCru0OfFcAAUISrLZDfPzSKxuiibOT+T6JCwDMtrQzYQvZHQ5Cw2h3GK0OI9AWBzJJZFOxgtJUGpTABQAiLu5OOviuGIEWkBUwC7pasNZj7N2ThNJUjBQY4pznAoEWsBWwxU+JFXSVRTzmQWvKRR5RG4KVGMgKrAVYflexAAugDCEygdbUCI2F7zobk7FZY76DIDQgrT9HCwwt1FsBhhIu4p4D3kiS8B0MJz28ftfGSPfl8MPLxbGBAqVpptbslJc+fEPMA7JDPrIpH3FX8LzaROdrE5O51jalgid3Lh4b6/sDALh6971riErGcFET58gwDPGndG9JT6ReHcwfPorGygu8rdxvGxMeP3XtzcofgigWZ0/EtQ7n0/sOTe0/Mo7V5WeoVu61z1yvZzZX+BsnZx9opYLpevXp7eXKIrL5UWit0n0r/Isb50bjRGreiyWmgs76lfM31y5tSQAAc6czHjONXLi13thygih+AEq4N6GqMsuhAAAAAElFTkSuQmCC";
ETICKER.IMG_CROS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IGNvdWxkIG5vdCBiZSBlc3RhYmxpc2hlZCBpbiA8Yj4vaG9tZS9hamF4bG9hZC93d3cvbGlicmFpcmllcy9jbGFzcy5teXNxbC5waHA8L2I+IG9uIGxpbmUgPGI+Njg8L2I+PGJyIC8+Cg=="
ETICKER.IMG_ERROR 		= "https://facepunch.com/fp/ratings/cross.png";
ETICKER.IMG_COMPLETE 	= "https://facepunch.com/fp/ratings/tick.png";

ETICKER.Hide = true;

console.log("Enhanched Ticker v" + ETICKER.VERSION + " loading...");

function addGlobalStyle(css) {
	var head, style;
	head = document.getElementsByTagName('head')[0];
	if (!head) { return; }
	style = document.createElement('style');
	style.type = 'text/css';
	style.innerHTML = css;
	head.appendChild(style);
}


function config(){

	// Init global stuff

	// Ratings system
	ratings = {
		
		'tick.png' : 'Agree',
		'cross.png' : 'Disagree',
		'funny2.png' : 'Funny',
		'winner.png' : 'Winner',
		'zing.png' : 'Zing',
		'information.png' : 'Informative',
		'heart.png' : 'Friendly',
		'wrench.png' : 'Useful',
		'rainbow.png' : 'Optimistic',
		'palette.png' : 'Artistic',
		'clock.png' : 'Late',
		'box.png' : 'Dumb',
		
		'lua_king.png' : 'Lua King',
		'lua_helper.png' : 'Lua Helper',
		'weed.png' : 'Smarked',
		'mapping_king.png' : 'Mapping King',
		'moustache.png' : 'Moustache',
		'programming_king.png' : 'Programming King'
		
	}
	var ratings_key = Array();
	for(key in ratings){
		ratings_key.push(key);
	}
	ratings_regex = ratings_key.join("|");

	var cfg = window.localStorage.getItem("ETickerConfig");
	
	if(cfg && cfg.length>5){
		cfg = JSON.parse(cfg);
		if(cfg["validated"] && cfg["weekday"] && cfg["threads"]){
			
			cfg.subforums_name = { // these don't need input from the user
				
				// Facepunch
				6: "General Discussion",
				60: "Fast Threads",
				64: "Videos And Flash Movies and That Kind Of Crap",
				403: "Mass Debate",
				396: "Sensationalist Headlines",
				51: "In The News Node",
				46: "The Gold Members Forum",
				
				// Rust
				415: "Rust General Discussion",
				424: "Rust Experimental Version",
				417: "Rust Servers",
				418: "Rust Modding",
				421: "Rust Bug Reports & Exploits",
				425: "Rust Help & Support",
				
				// Garry's Mod
				15: "Garry's Mod General Discussion",
				198: "Screenshots, Movies, Saves and Dupes",
				66: "Gamemode & Addon Releases",
				65: "Developer Discussion",
				16: "Help & Support",
				
				// Hardware & Software
				397: "Hardware and Software - General Discussion",
				107: "Technical Support",
				243: "PC Building",
				
				// Games
				110: "General Games Discussion",
				339: "Valve/Steam/PowerPlay",
				277: "Team Fortress 2",
				411: "DOTA 2",
				383: "Minecraft",
				189: "Games In Progress",
				
				// Developers
				240: "Programming",
				353: "Web Development",
				38: "Mapping",
				40: "Modelling",

				// Creationism Corner
				75: "Creationism Corner",
				316: "MS Paint",
				315: "Musician's Gig Room",
				389: "Photography",
				76: "Photoshop Contests",
				
				// Hobbies
				262: "Music",
				384: "Automotive Addicts",
				385: "Durgs Discussion",
				393: "Airsoft",
				401: "Urban Exploration",
				361: "Film and Television",
				394: "Witness The Fitness",
				391: "Maker Mates",
				
				// Misc
				33: "Moderators"
				
			};

			var col_mod = "#00aa00";
			var col_staff = "#0070FF";
			var col_fag = "#f0f";
			var col_gold = "#A06000";
			var col_bot = "#48D4DB";

			cfg.bots = [ 
				546131, // pcgamesn
				380954, // bbc
				92596,  // steamgames.com
				55839,  // moddb
				600577, // playrust
			];

			cfg.specialusers = {

				// admins
				garry: 					col_staff,
				gwilty: 				col_staff,
				Robotboy655: 			col_staff,
				Ziks: 					col_staff,
				
				// mods
				Asaratha: 				col_mod,
				AshMan: 				col_mod,
				'BANNED USER': 			col_mod,
				'Big Dumb American': 	col_mod,
				Blazyd: 				col_mod,
				Craptasket: 			col_fag,
				dai:					col_mod,
				Dav0r: 					col_mod,
				GunFox: 				col_mod,
				Gurant: 				col_mod,
				Helk: 					col_mod,
				Holmzy: 				col_mod,
				Jaanus: 				col_mod,
				NiandraLades: 			col_mod,
				Orkel: 					col_mod,
				OvB: 					col_mod,
				'Paul.B': 				col_mod,
				postal: 				col_mod,
				rilez: 					col_mod,
				Rusty100: 				col_fag,
				Seiteki: 				col_mod,
				Starpluck: 				col_mod,
				SteveUK: 				col_mod,
				Swebonny: 				col_mod,
				UberMensch: 			col_mod,
				verynicelady: 			col_mod,
				'_Kilburn': 			col_staff,
				layla: 					col_staff

				//PCGamesN: 				col_bot,
				//'SteamGames.com': 		col_bot,
				//ModDB: 					col_bot,
				//bbc: 					col_bot

			};

			// FPR gold list
			cfg.golds = [
				12,47,121,255,458,464,467,477,508,645,689,708,762,802,821,918,1077,1190,1510,1664,1682,1779,1917,1946,2006,2101,2202,2361,2442,2577,2731,2843,2860,2917,3060,3425,3448,3475,3731,3807,3855,3916,3918,4077,4082,4116,4173,4187,4214,4560,4776,4878,4890,4993,5017,5052,5133,5144,5521,5558,5571,5586,5775,5853,6084,6300,6469,6490,6522,6546,6641,6676,6765,6855,6922,7090,7115,7258,7439,7488,7499,7513,7814,7930,7963,8048,8049,8141,8170,8524,8582,8702,8707,8806,8813,8873,9100,9177,9200,9296,9298,9312,9477,9588,9656,9677,9757,9910,10061,10063,10200,10225,10268,10652,10760,10777,10896,11470,11478,11623,11812,11934,12030,12377,12910,12953,13064,13155,13505,13579,13692,13760,13944,13994,14331,14628,14913,15476,16289,16337,16351,16849,16928,16980,17104,17229,17267,17476,17543,17622,17829,17995,18212,18431,18568,18756,18846,18855,19155,19199,19268,19431,19605,19807,19845,19929,19975,20017,20268,20694,21315,21447,21604,21630,21942,22083,22167,22429,22512,22705,22804,23000,23175,23355,23738,23898,23922,24633,24947,25633,25644,25701,25741,26272,26452,26548,27049,27070,27396,27399,27448,27885,27974,28539,28618,28785,28930,29270,29390,29567,29632,30071,30560,30874,31086,31229,31259,31552,31702,31729,32058,32102,32610,32653,32815,32848,32993,33032,33077,33275,33343,33427,33572,33647,33772,33840,33851,33890,33953,33979,34082,34416,34805,34849,35106,35274,35296,35514,35648,35906,35950,36089,36124,36208,36251,36293,36452,36668,37388,37642,37749,37943,38600,38952,39543,39571,39603,40179,40194,40226,40290,40400,40573,40656,41516,41628,41859,42175,42340,42613,42774,42827,42907,42999,43014,43590,43744,43804,43805,44007,44164,44458,44483,44687,44755,44814,44904,44980,45493,45637,45654,45855,46157,46187,46390,46531,46664,46847,47011,47213,47291,47535,47561,47940,47951,48009,48155,48213,48244,48301,48461,48474,48526,48539,48591,48736,48845,48972,49284,49330,49346,49396,49458,49461,49613,49731,49820,49991,50174,50187,50204,50249,50273,50415,50482,50587,50813,50923,50926,51052,51233,51381,51462,51486,51605,51644,51699,51798,51938,52015,52050,52537,52569,52629,52743,53008,53030,53052,53097,53101,53222,53369,53400,53407,53409,53501,53662,53812,53906,54007,54082,54172,54257,54467,54481,54557,54583,54637,54658,54689,54725,54860,55061,55810,55877,56097,56318,56396,56411,56575,56675,56850,56855,56950,57165,57447,57728,57737,57951,58055,58132,58239,58390,58460,58489,58763,58793,58915,58997,59008,59435,59505,59562,59621,59736,59862,60000,60205,60215,60231,60236,60262,60270,60385,60474,60475,60510,60570,60654,60673,60763,60825,60904,61021,61071,61209,61235,61329,61551,61679,61693,61731,61824,61844,61865,61889,62004,62018,62055,62098,62137,62153,62159,62171,62446,62466,62634,62651,62765,62918,62996,63039,63088,63187,63277,63281,63354,63473,63793,63803,63804,63823,63975,64046,64064,64415,64552,64719,64725,64750,65161,65258,65305,65315,65380,65386,65403,65545,65644,65691,65791,65969,66050,66166,66183,66405,66496,
				66562,66771,66891,66979,66985,67063,67138,67161,67414,67567,67842,67908,67935,68064,68128,68372,68486,68654,68718,68882,69149,69160,69258,69287,69335,69438,69480,69615,69685,69704,69750,69793,69907,69963,69977,69991,70002,70085,70172,70295,70374,70466,70479,70491,70603,70673,70740,70855,70948,71037,71095,71120,71122,71195,71292,71495,71587,71590,71670,71674,71917,71954,71971,72068,72094,72150,72201,72321,72457,72658,73039,73129,73160,73173,73207,73273,73485,73672,73685,73775,73928,73959,74015,74147,74184,74337,74339,74347,74424,74462,74507,74514,74591,74595,74636,74672,74822,74914,74997,75004,75218,75387,75452,75511,75660,75874,75912,75955,75973,76063,76326,76364,76430,76483,76653,76745,76869,76983,77258,77286,77321,77465,77476,77603,77801,77919,77956,78094,78149,78224,78257,78276,78316,78349,78356,78495,78670,78723,78809,78898,79144,79265,79290,79388,79392,79425,79439,79459,79793,79822,79942,79950,79982,80048,80101,80107,80109,80248,80383,80390,80557,80570,80580,80617,80673,80798,80826,80850,80901,80988,81057,81076,81104,81132,81275,81517,81522,81759,81797,82029,82037,82208,82271,82285,82425,83179,83231,83309,83352,83451,83519,83864,83876,83955,83956,83964,83965,83999,84063,84084,84193,84320,84481,84499,84582,84667,84765,84767,85051,85071,85089,85090,85093,85169,85220,85374,85376,85411,85418,85484,85485,85501,85633,86114,86116,86158,86230,86243,86290,86368,86386,86434,86480,86523,86531,86672,86712,86718,86796,86863,86873,86903,87179,87204,87233,87318,87321,87324,87459,87479,87554,87587,87780,87821,88030,88046,88172,88182,88262,88313,88519,88569,88589,88652,88728,88895,88918,88957,89132,89152,89173,89201,89474,89489,89526,89828,89893,89917,90086,90100,90181,90198,90317,90318,90325,90459,90465,90512,90563,90633,90638,90666,90723,90890,90947,91338,91354,91766,91829,92127,92128,92259,92333,92337,92343,92374,92507,92548,92596,92720,92754,92775,92813,92906,92930,92991,93020,93141,93298,93398,93495,93594,93651,93709,94383,94385,94467,94577,94811,94944,95714,95858,95866,96028,96112,96130,96183,96378,96688,96800,96910,97102,97133,97152,97162,97266,97296,97298,97381,97589,97608,97613,97685,97701,97767,97989,98092,98176,98466,98514,98764,98810,98943,98979,99011,99053,99077,99095,99462,99497,99520,99585,99715,99731,99737,99809,99979,100037,100104,100248,100256,100405,100579,100605,100697,100766,100889,100953,100966,101002,101185,101304,101351,101482,101598,101602,101804,101839,101916,102012,102127,102310,102449,102554,102640,102668,102786,102923,103051,103056,103101,103107,103210,103430,103519,103572,103799,103897,103951,103964,104092,104119,104366,104450,104916,105194,105395,105654,105696,105979,106321,106660,106829,106955,107169,107218,107784,107821,107863,108214,108328,108522,108600,108936,108978,109364,109891,110102,110181,110331,110641,111015,111051,111119,111528,111564,111630,111659,111755,112103,112300,112446,112586,112800,112857,112999,113108,113329,113379,113389,113422,
				113486,113683,113848,113989,114111,114218,114403,114416,114815,114840,114938,114972,115012,115234,115281,116141,116165,116201,116316,116323,116330,116377,116427,116479,116543,116816,116847,116953,117036,117047,117341,117426,117735,117878,117899,118179,118513,118643,118697,118776,118829,118944,118955,119299,119761,119851,119985,120028,120196,120377,120526,120589,120680,120685,120931,120985,121032,121054,121138,121381,121480,121580,121778,121834,122052,122057,122269,122452,122983,123095,123169,123291,123486,123571,123583,123833,124148,124812,124890,125000,125052,125292,125441,125459,125470,125507,125537,125610,125776,125924,126265,126371,126375,126459,126602,126634,126663,126817,127500,127506,127538,127846,128150,128241,128256,129155,129245,129374,129389,129541,129542,129556,129655,129746,129792,129812,129856,130048,130130,130190,130218,130338,130371,130669,131017,131056,131180,131194,131227,131239,131374,131392,131581,131942,132221,132300,132473,132551,132685,133114,133203,133339,133403,133515,134037,134186,134332,134399,134496,134500,134505,134627,134819,134875,134929,135118,135390,135499,135613,135678,135903,135955,135998,136132,136306,136315,136354,136366,136370,136835,136903,137406,137737,137812,138004,138043,138149,138290,138359,138577,138670,138762,138769,138888,139181,139277,139288,139293,139397,139595,139797,139920,139931,139949,140025,140164,140357,140506,140825,140833,140918,141152,141251,141287,141307,141449,141540,141664,141806,141812,142027,142034,142061,142269,142279,142319,142370,142396,142407,142539,142676,142794,142984,143187,143439,143499,143506,143646,144137,144146,144327,144568,144702,144988,145140,145263,145461,145490,145696,145898,145923,145952,145982,146381,146438,146814,146960,146993,147010,147146,147501,147795,147903,147973,147977,148102,148330,148515,148692,149025,149150,149281,149400,149523,149710,149879,149903,149981,150272,150281,150516,150563,150657,150824,150852,150896,151057,151070,151122,151251,151261,151300,151425,151440,151444,151619,151647,151666,151778,151812,151815,151955,151989,152043,152067,152190,152230,152309,152351,152361,152489,152574,152863,153060,153078,153186,153194,153285,153320,153425,153643,153733,153837,153941,153982,154160,154168,154187,154248,154281,154283,154396,154521,154530,154694,154702,154877,154881,154967,155013,155138,155161,155187,155439,155562,155980,156082,156087,156151,156242,156313,156396,156449,156540,156627,156663,156720,156736,156989,157167,157390,157484,157696,157794,157844,157878,157963,158243,158888,158950,158985,159225,159489,159767,159779,159820,159883,159897,159958,160463,160609,160772,160843,161231,161263,161290,161354,161713,161763,161815,161976,162043,162098,162149,162423,162704,163014,163109,163399,163606,163659,163894,164020,164220,164423,164514,164660,164789,164893,165035,165148,165277,165311,165457,165828,165984,166053,166422,166437,166500,166664,166708,166796,166840,167344,167513,167606,
				167628,167762,167814,167938,168165,168191,168212,168460,168662,168774,168837,168850,168977,169196,169197,169219,169268,169370,170238,170469,170680,171116,171223,171364,171416,171824,172339,172425,172540,173076,173247,173477,173655,174482,174712,174786,174990,175004,175089,175307,175363,175676,176062,176093,176157,176383,176526,176535,177073,177304,177356,177457,177508,177514,177651,177672,177694,177719,177875,178004,178068,178086,178241,178264,178277,178587,178887,178932,179059,179159,179389,179892,179931,180058,180235,180392,180509,180766,180943,181219,181243,181277,181349,181440,181726,181948,181998,182117,182186,182433,182535,182583,182770,182835,182929,183125,183151,183313,183698,183955,184336,184601,184651,184665,184747,184953,185034,185056,185180,185334,185517,185655,185864,186005,186216,186351,186660,186671,186873,187525,187568,187585,187618,187739,187757,187774,187937,187984,188217,188607,188649,188773,189358,189767,189868,190084,190225,190556,190613,190674,190790,190797,190861,191146,191272,191292,191335,191437,191584,191606,191963,192036,192102,192200,192309,192880,193052,193171,193352,193786,194080,194138,194175,194495,194588,195018,195129,195173,196199,196256,196306,196632,196659,196702,196736,196987,197243,197295,197334,197445,197527,197552,197776,197885,197912,197946,198036,198125,198342,198417,198476,198628,198636,198747,199014,199146,199201,199254,199317,199448,199636,199672,199693,199752,199765,199908,199913,199941,199984,200070,200108,200219,200220,200283,200319,200333,200672,200723,200776,200795,200928,200936,201103,201286,201388,201526,201567,201608,201823,202003,202047,202224,202246,202313,202391,202488,202514,202525,202602,202761,202811,202844,203435,203562,203731,203732,203931,204109,204153,205104,205141,205267,205360,205367,205403,205650,205699,206176,206454,206629,206831,206926,207512,207577,207918,208092,208104,208126,208164,208289,208406,208622,208637,208875,208946,209182,209967,210110,210284,210386,210640,210676,210677,210854,210931,211092,211107,211201,211324,211419,211605,211637,211736,211774,211804,211949,212379,212481,212629,212642,212646,212670,212814,212996,213396,213624,213953,214159,214274,214547,214601,214863,215221,215312,215377,215822,216179,216361,216689,216700,216859,216976,216981,217156,217390,217425,217586,217664,218109,218551,218737,218830,218950,219085,219201,219247,219375,219535,219561,219632,219687,219782,219802,220298,220325,220332,220451,220458,220664,220666,220931,221027,221139,221187,221423,221482,221524,221644,221743,221818,221933,221952,222135,222147,222168,222212,222229,222365,222675,222733,222754,222863,223014,223057,223307,223343,223385,223568,223800,223856,223912,223964,224273,224294,224397,224726,224785,224830,224871,225670,225731,226227,226375,226526,226602,227195,227302,227317,227389,227527,227647,227715,227960,228175,228195,228210,228385,228433,228503,228514,228538,228847,228886,228908,228914,229052,229423,
				229460,229574,229657,229706,229729,229733,229807,229837,230005,230035,230089,230100,230198,230422,230436,230491,230525,230568,230652,230780,230883,231072,231212,231237,231301,231602,231631,231644,231881,231913,232435,232583,232831,232857,233276,233325,233471,234025,234053,234162,234273,234285,234300,234343,234492,234617,234652,234783,234788,234886,235064,235118,235154,235227,235325,235373,235677,235811,235864,235917,235941,235942,236041,236056,236077,236135,236138,236149,236381,236419,236450,236876,236963,237341,237455,237518,237589,237666,237675,237686,237722,237795,237800,237827,237868,237892,238010,238264,238266,238298,238490,238525,238553,238641,238649,238898,239046,239086,239499,239515,239657,239679,239774,239862,239935,239945,240152,240264,240302,240628,240664,240713,240727,240810,240905,241024,241057,241218,241334,241507,241549,241563,241672,241731,241801,241899,241918,242118,242236,242243,242336,242352,242460,242656,242738,242836,243053,243104,243114,243279,243502,243762,243892,243903,243999,244050,244091,244195,244367,244448,244462,244675,244899,244917,244936,244946,245077,245079,245161,245288,245487,245489,245568,245681,245704,245787,246142,246143,246209,246393,246793,246947,246991,247002,247126,247140,247166,247198,247477,247606,247686,247691,247718,247955,248058,248320,248595,248611,248633,248644,248646,248664,248667,248824,248899,248993,249151,249265,249495,249540,249587,249603,249680,249719,249935,250141,250173,250215,250295,250330,250337,250433,250611,250646,250698,250744,250839,250861,250902,251041,251072,251089,251257,251377,251436,251448,251713,251776,251976,252016,252046,252165,252211,252226,252280,252430,252457,252517,252805,252846,252888,252930,253031,253313,253349,253381,253387,253429,253444,253594,253713,253903,253916,253930,253932,253975,254198,254430,254490,254512,254690,254707,255068,255100,255149,255177,255328,255395,255514,255526,255634,255719,256195,256651,256670,257004,257019,257051,257086,257149,257238,257256,257370,257427,257577,257589,257680,257738,257767,257784,257828,257913,257952,257968,258063,258151,258181,258322,258381,258413,258609,258809,259150,259310,259597,259666,259839,259948,259979,260166,260169,260259,260872,260888,261064,261081,261409,261473,261647,261706,261744,261756,261830,261905,262000,262048,262860,262879,262887,262908,262938,263073,263992,264085,264550,264736,264748,265023,265037,265339,265831,265854,265873,266124,266176,266232,266465,266589,266852,266887,266981,267066,267182,267613,267930,268005,268083,268193,268224,268663,268687,268706,268848,268937,268961,268984,269012,269114,269170,269322,269377,269515,269575,269609,269746,270053,270223,270296,270812,271242,271404,271655,271886,272035,272073,272108,272697,272853,273603,273883,274477,274535,275208,275324,275348,275504,275524,275634,275786,276815,276825,277004,277027,277138,277224,277330,277521,277528,277619,278128,278191,278270,279209,279451,279473,279789,280093,
				280568,280652,280704,280729,280907,280930,280967,280995,281149,281204,281539,281559,281634,281663,281765,281956,281975,281977,282066,282144,282280,282291,282304,282485,282637,282715,282772,283154,283334,283899,284315,284453,284518,284727,284754,284809,284960,285018,285483,285500,285649,285880,285895,285921,285965,286086,286125,286493,286558,287083,287150,287293,287611,287695,288009,288166,288631,288947,289417,289456,289460,289470,289600,289739,289750,290291,290738,290753,290896,291049,291236,291360,291465,291820,292180,292290,292526,292907,293118,293237,293788,293790,293850,293874,294141,294144,294197,294311,294324,294662,294814,295011,295683,295823,295907,296417,296483,296895,296927,297194,297452,297569,297864,297931,298026,298401,298407,298469,298916,298919,298989,299172,299431,299523,299985,300157,301181,301209,301541,301543,301614,301912,302068,302390,302772,302906,303157,303359,303496,303689,303999,304127,304262,304444,304778,304795,305091,305282,305307,305403,305626,305713,305745,306164,306254,306346,306464,306545,306710,306750,306885,306988,307184,307190,307384,307615,307826,307917,308016,308339,308465,308696,309128,309186,309207,309212,309321,310100,310315,310461,310603,310711,311238,311247,311471,311819,312107,312123,312174,312181,312599,312684,312824,312828,313119,313187,313354,313403,313515,313715,313749,313860,313934,314025,314104,314128,314230,314463,314493,315351,315812,315939,316201,316886,317026,317202,317249,317437,317868,317896,318264,318301,318349,318491,318816,319154,319379,319590,320398,321031,321397,321548,321597,321935,321957,322529,322535,322558,322606,322697,322713,322848,323031,323042,323098,323665,324174,324286,324352,324433,325263,325568,325638,325645,326009,326215,326229,326489,327072,327316,327522,329016,329227,331244,331747,331992,332065,332190,333461,333678,334297,334505,335067,335316,335527,336280,336317,336881,336950,336977,337371,338998,339665,340220,340743,342641,343323,343404,343496,343572,343697,344802,346406,347019,347047,347936,347971,348030,348312,348506,348663,348685,348837,349127,350306,350321,350408,350451,350480,351113,351208,351386,351389,351421,351538,351607,351671,352055,352104,352158,352298,353235,353351,353763,353812,353963,353976,354055,354303,354501,354751,354865,355448,356027,357161,357192,357375,357509,357760,357848,358450,358857,359009,359483,359627,359888,360045,360244,360372,360503,360657,361215,361475,361715,362086,362539,362910,363170,363221,363313,365364,366652,366869,368131,368338,370687,371521,372199,375359,375866,378198,378752,378874,378913,378914,378976,379068,379840,379856,379984,380090,380348,380457,380560,380823,380854,381310,381570,382235,382337,382427,382492,383015,383161,384014,384028,384228,384799,384972,385123,385323,385344,385496,386813,387119,387651,387659,388664,388735,388902,388995,389334,389728,389729,390071,390204,390318,390579,391065,391099,391311,391422,391507,391772,391976,392101,392318,
				392450,392945,393181,393992,394393,394546,395131,395592,395914,395943,395944,395982,396087,396165,397863,397974,398371,398593,399383,399574,399930,400788,400898,400918,401014,401270,401580,402158,402378,402379,402686,402689,403088,403606,404263,404418,404504,404577,405021,405062,405210,405311,405321,405562,405966,406185,406198,406340,406456,406506,406692,406889,406980,407314,407681,407866,408002,409554,409724,409743,410512,411072,411412,411786,412024,412294,412567,412923,413311,413690,414135,415640,415641,415940,415971,416404,416538,416659,416770,418065,418645,418791,419294,419611,419691,420188,421370,421810,421935,422532,422565,422883,423247,423268,425532,425684,425876,426242,427147,427386,427854,429142,430593,431084,431091,431184,431238,431348,432304,432385,432386,432486,432768,432812,433012,433262,433297,434214,434327,434332,434686,434774,434985,435005,435189,435543,435715,435930,436204,436209,436661,436734,436749,436824,436989,437332,437541,437781,437878,438261,438550,438594,438637,438801,438893,439259,439384,439586,439809,439906,439910,440455,440522,440563,440800,440820,441631,441991,442123,442357,442376,442625,442681,442863,443015,443097,444048,444842,444916,444917,445234,445256,445369,445485,445586,445880,445941,445990,446084,446188,446598,446629,447236,447287,448437,448526,448586,449379,449464,449604,449701,450189,450341,450770,450999,451416,451618,451777,452312,452715,453069,453219,453355,453674,454053,454301,454512,454692,455189,455584,455724,455828,455855,455955,456303,456466,456754,456832,457277,457480,457786,457814,458188,458276,458500,458566,458785,459412,459502,459588,459755,459790,459918,459980,460877,460995,461129,461244,461314,461495,461535,461766,461812,461856,462158,462202,462250,462689,462898,463131,463144,463259,463728,464429,464462,464776,464833,465649,465674,466110,466789,466824,466893,467060,467111,467352,467385,467395,467434,467913,468764,470413,470725,470882,471219,471242,471427,471503,472146,474317,474352,475226,476047,476335,476843,478218,478469,478718,480060,480190,480837,481099,481722,481820,482330,482505,483874,484026,484028,485159,485179,485354,486054,486464,486757,486928,487794,487924,487951,488621,488708,488718,488728,488821,489190,489225,489544,489720,489758,489906,490237,490344,491190,491402,491547,491641,491817,491905,492293,492411,492556,492604,492684,492760,492996,493709,493754,493827,494135,494556,494880,495195,495373,495699,495830,495951,496035,496598,496699,496938,497020,498115,498180,500121,500206,500830,501166,501264,502867,502911,503534,503574,503679,503900,504378,504549,504551,504992,505086,505193,505576,505838,505872,506170,506481,507579,507801,508070,508178,508436,508868,509120,509195,509264,509425,509547,509712,510112,510805,510813,510848,510997,511244,511504,511609,511862,511979,512139,512490,513152,513540,513598,513665,514062,514510,515988,516419,518088,518440,518726,519258,520094,520198,522271,523109,523784,523796,
				525217,526392,527448,530404,532075,532374,533261,534194,534222,534713,535099,535265,535481,535613,537383,538888,539304,539466,539481,539994,540006,540566,540777,540910,542193,542402,542672,543802,544520,545796,546688,547195,548091,548286,550527,550800,551531,552509,552549,553032,553134,553394,553664,553699,553802,553816,553877,553993,554005,554133,554187,554285,554417,554514,554710,554783,554791,555124,555177,555849,555987,556054,556112,556289,556404,556622,556626,556634,556692,556799,556935,557127,557248,557385,557629,558013,558067,558267,558296,558546,558980,562445,562928,563100,564046,564193,565328,576358,577267,577887,579474,580275,580480,580679,582038,582493,582944,584008,584059,584117,585115,585682,587150,588636,588986,590838,590923,591170,595091,598431,599123,600509,600722,607680,607789,611937,612200,612962,613299,620997,622160,626044,629384,630622,633148,643852
			];

			// totally manual list, until fpr has indexed more golds
			var golds = [
				'Giraffen93', 'simkas', 'Jamie1992GSC', 'Instant Mix', 'Teddybeer', 'Dorkslayz', 'GoDong-DK', 
				'Cold',	'garychencool',	'fishyfish777',	'DanTehMan', 'B!N4RY', 'coverop', 'AaronM202',	
				'Sokrates',	'I Am A Rock', 'Doctor Zedacon', 'Gwoodman', '.Lain', 'Kegan', 'Max', 'Devil Traitor', 
				'paul simon', 'redback3', 'PieClock', 'EcksDee', 'kmlkmljkl', 'TheDrunkenOne', '4NGRY MUFF1N',
				'person11', 'Pat.Lithium', 'ASIC', 'D0C H.', 'Rents', 'Sgt. Khorn', 'jordguitar', 'JohnnyMo1',
				'proboardslol', 'LittleBabyMan', '~Kiwi~v2', 'pentium', 'Marden', 'Itsamario', 'i_speel_good',
				'Dr.C', 'red_pharoah', 'Cookie', 'Mingebox', 'DiscoInferno', 'WhyNott', 'UberMuchkin', 'Awesomecaek',
				'sparky28000', 'darth-veger', 'chipsnapper2', 'CjienX', 'Megaman1811', 'Anubis678', 'DeadCow',
				'Stargatius', 'Helix Snake', 'Scratch.', 'Zillamaster55', 'Pvt. Martin', 'NotAName', 'Nookyava',
				'Number-41', 'Ganerumo', 'MrFlashcat', 'Sobotnik', 'Butthurter', 'General J', 'Cronos Dage',
				'EliteGuy', 'Rastadogg', 'laserpanda', 'Pako', 'matty928', 'Skyward', 'C0linSSX', 'dannass',
				'Booker K', 'SGTNAPALM', 'JohanGS', 'Coffee', 'Rika-chan', 'catbarf', 'Craigewan', '_Axel',
				'TAU!', 'F T', 'J!NX', 'HookerVomit', 'FunnyStarRunner', 'DChapsfield', 'elowin', 'gk99',
				'Reaper33', 'Yadda', 'Vaught', '!cake', 'code_gs', 'Zelpa', 'wauterboi', 'JustMondo',
				'Python1320', 'Hoffa1337', 'Nak', 'Noi', 'Tenrys', 'LegoGuy', 'Evul Emul', 'kila58', 'Boaraes',
				'A B.A. Survivor', 'Wingz', 'Reyjr43', 'Maximo13', 'MissingGlitch', 'Greenen72', 'Oicani Gonzales',
				'Soleeedus', 'Warship', 'DBFT', 'Otterman', 'Lium', 'FLIPPY', 'Sega Saturn', 'Alice3173',
				'matt000024', 'meppers', 'dr.bean', 'find me', 'No Party Hats', 'TacticalBacon', 'Aide',
				'YsUp12', 'Xyrec', 'RaptorRed', 'Emperor Scorpious II', 'gtanoofa', 'diwako', 'MrBond',
				'QUILTBAG', 'TurbisV2', 'ExTek', 'A_Pigeon', 'Rangergxi', 'Suttles', 'Toy_Soldier', 'DerpishCat',
				'cani', 'Map in a box', 'Rocko\'s', 'Hugg', 'Higginz511', 'Starship', 'jonoPorter', 'Ninja Duck',
				'NoobieWafer223', 'Satane', 'cNova', 'Viper123_SWE', 'darkrei9n', 'Greendead', 'kapin_crunch',
				'Zakkin', 'Moofy', 'Davidn64', 'Fish_poke', 'wickedplayer494', 'Dubeard', 'RearAdmiral', 'Mitchel.',
				'AlienFanatic', 'aznz888', 'TH3_L33T', 'BazzBerry', 'arleitiss', 'Kylel999', 'Agoat', 'Mr.Cookie',
				'itak365', 'woolio1', 'HumanAbyss', 'Infab', 'Reagy', 'SuperHoboMan', 'slayer20', 'MDave', 'LeonS',
				'Zang-Pog', 'TheJoker', 'orcywoo6', 'imacc2009', 'RawrBullet', 'notlabbet', 'codenamecueball',
				'highvoltage', 'Metaru', 'Kahgarak', 'Anderan', 'doomevil', 'Ms. Gyroscope', 'EagleEye',
				'AugustBurnsRed', 'RikohZX', 'booster', 'cyclocius', 'Keychain', 'Consulcast', 'zin908', 'KOManiacJim',
				'Hilarious Pill', 'Turnips5', 'Ta16', 'ramirez!', 'Source', 'TornadoAP', 'purvisdavid1',
				'Solo Wing', 'RocketRacer', 'MightyLOLZOR', 'Satansick', 'Diet Kane', 'ThePanther', 'Coyoteze',
				'nerdster409', 'revan740', 'n0cturni', 'sltungle', 'SergerantJoe', 'nikomo', 'Brt5470',
				'SomeDumbShit', 'Squeegy Mackoy', 'Nintendo-Guy', 'Katska', 'kilerabv', 'cdr248', 'Ryu-Gi',
				'MisterSjeiks', 'TheTalon', 'Angus725', 'Grindigo', 'Karmal Khan', 'Lolkork', 'maxumym',
				'Pilotguy97', 'For No Reason', 'XeroG', 'SilverDragon619', 'FalconKrunch', 'Zukriuchen', 'lintz',
				'Tuskin', 'Plaster', 'l337k1ll4', 'Dirty_Ape', 'Gamerman12', 'varg666', 'EvilMelon', 'IAmAnooB',
				'Th3applek1d', 'Doom64hunter', 'Zonesylvania', 'Burnyhands', 'autodesknoob', 'Native Hunter',
				'===', 'The Aussie', 'onebit', 'asXas', 'Higurashi', 'MiKaXsUs', 'Saza', 'ferrus', 'CSLeader',
				'bitches', 'Joazzz', 'KnightVista', 'CosmicSeagull', 'Gray Altoid', 'Hakita', 'Bread_Baron',
				'windwakr', 'wraithcat', 'WitheredGryphon'

			];

			// add them to the list as golds
			for( i=0; i<golds.length; i++){
				cfg.specialusers[ golds[i] ] = col_gold;
			}
			
			// Set new unknown variables
			cfg.show_titlechange = cfg.show_titlechange != undefined ? cfg.show_titlechange : true;
			cfg.show_events = cfg.show_events != undefined ? cfg.show_events : true;
			cfg.show_ratings = cfg.show_ratings != undefined ? cfg.show_ratings : true;
			
			cfg.watch = cfg.watch != undefined ? cfg.watch : Array();

			cfg.notify_mentioned = cfg.notify_mentioned != undefined ? cfg.notify_mentioned : false;
			cfg.notify_watched = cfg.notify_watched != undefined ? cfg.notify_watched : false;
			cfg.notify_rating = cfg.notify_rating != undefined ? cfg.notify_rating : false;
			
			cfg.store_mentioned = cfg.store_mentioned != undefined ? cfg.store_mentioned : true;
			cfg.store_watched = cfg.store_watched != undefined ? cfg.store_watched : false;
			cfg.store_rating = cfg.store_rating != undefined ? cfg.store_rating : false;
			
			cfg.tickerlimit = cfg.tickerlimit != undefined ? cfg.tickerlimit : 100; 
			
			cfg.supersecret = cfg.supersecret != undefined ? cfg.supersecret : "";
			cfg.supersecret_u = cfg.supersecret_u != undefined ? cfg.supersecret_u : "";
			cfg.supersecret_p = cfg.supersecret_p != undefined ? cfg.supersecret_p : "";
			
			return cfg;
		}else{
			alert("Could not validate settings, refresh.");
			Config = {};
			eSaveData();
			return;
		}
	}else{
	
		alert("Resetting settings...");
	
		var def = {
			'validated' : true,
			
			'show_unicode' : true,
			'show_avatars' : true,
			'show_military' : true,
			'show_join'	: false,
			'show_colors' : true,
			'show_titlechange' : true,
			'show_ratings' : true,
			
			'color_readthread' : "#c5c8eb",
			'color_rating' : "#ddf85e",
			'color_highlight': "#f2b2a9",
			'color_hover': "#add4b2",
			
			'notify_mentioned' : true,
			'notify_watched' : true,
			'notify_rating' : true,
			
			'store_mentioned' : true,
			'store_watched' : false,
			'store_rating' : false,
			
			'tickerlimit' : 100,
			
			'subforums': {
				33: true  // moderators
			},
			
			'threads': {
			
			},

			'users' : [],

			'words' : [],
			
			'watch' : {},
		
			'weekday': ["Sunday", "Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday"]
		}
		
		Config = def;
		
		eSaveData();
		
		alert("Settings saved to local storage.");
		
		return def;
	
	}

	
};

Config = config();

ETICKER.USERNAME = $("#navbar-login a").last("strong").text();
Config.specialusers[ETICKER.USERNAME] = "#085d20";

console.log("Got username: " + ETICKER.USERNAME);

// add panel
$("#content_inner").children("div").prepend("<div id='eticker_history'></div>");
//$("#content_inner").children("div").prepend("<br><br><hr><div style='margin:16px 16px 0 16px; text-align:center'></div>");

var panel = $("<div class='eticker_panel'></div>").prependTo(".fp_custom_page");
panel.append("<span style='color:#f070f0'>Enhanced Ticker " + ETICKER.VERSION + "</span>");
$("<img width=16 height=16 id=\"eticker_status\" src=\"" + ETICKER.IMG_LOADING + "\"><br>").appendTo(panel);
$("<button>config</button>").appendTo(panel).click(eConfig);
$("<button>clear ticker</button>").appendTo(panel).click(function(){ eClear(1); });
$("<button>only highlights</button>").appendTo(panel).click(function(){ eClear(2); });
$("<button>only ratings</button>").appendTo(panel).click(function(){ eClear(3); });
$("<button>only read</button>").appendTo(panel).click(function(){ eClear(4); });
//$("<input type='checkbox' id='eticker_hide' checked> Apply hiding for new posts (<span id=\"hiddenposts\"></span>)").appendTo(panel)

function eNotify(text, link){
	if (!("Notification" in window)) {
		alert("This browser does not support desktop notification");
	}else if (Notification.permission === "granted") {
		var notification = new Notification(text);

		if(link != undefined){
			notification.onclick = function(){
				window.open(link);
			}
		}

	}else if (Notification.permission !== 'denied') {
		Notification.requestPermission(function (permission) {
			if (!('permission' in Notification)) {
				Notification.permission = permission;
			}
			if (permission === "granted") {
				var notification = new Notification(text);

				if(link != undefined){
					notification.onclick = function(){
						window.open(link);
					}
				}

			}
		});
	}
}

function eSaveData(){
	var cfg = Config;
	try {
		window.localStorage.setItem("ETickerConfig", JSON.stringify(cfg));
	} catch(e) {
		if (e == QUOTA_EXCEEDED_ERR) {
			unsafeWindow.eNotify('Quota exceeded!'); //data wasn't successfully saved due to quota exceed so throw an error
			return;
		}
	}
	console.log("Save data...");
	unsafeWindow.eNotify("Settings saved to local storage.");
}

function eConfig(){
	var html = '<div style="position:absolute;top:20px;left:20px; background: #fff; padding:20px;border:5px solid #000;font-size:12px"><h1 style="font-size:18px">Enhanced Ticker Configuration</h1>';
	
	// Subforums
	html += "<form id='eticker_form' onSubmit='return false;'>";
	
	html += "<br><br>Separate values with a newline.<br>";

	html += '<br>Fetched username: ' + ETICKER.USERNAME + '<br>';
	
	// Print subforums
	html += "<br><br><b>Ignored subforums</b><br>";	
	html += '<div id="eticker_subforums">';
	for(var key in Config.subforums_name){
		html += '<input type="checkbox" data-subid="'+key+'" '+(Config.subforums[key]==true?"checked":"")+'> ' + Config.subforums_name[key] + " (id "+key+")<br>";
	}
	html += '</div>';
	
	// Trigger words
	html += "<br><br><b>Ignored threads</b><br>";
	html += "<select size='10' id='eticker_threads' multiple>";
	for(var k in Config.threads){
		html += '<option value="'+k+'">' + Config.threads[k] + '</option>';
	}
	html += '</select><br><button onclick="$(\'#eticker_threads option:selected\').remove();return false;">Remove</button><br>';
		
	// Watched
	html += "<br><br><b>Watched threads</b><br>";
	html += "<select size='10' id='eticker_watch' multiple>";
	for(var k in Config.watch){
		html += '<option value="'+k+'">' + Config.watch[k] + '</option>';
	}
	html += '</select><br><button onclick="$(\'#eticker_watch option:selected\').remove();return false;">Remove</button><br>';
	
	
	//html += '<br><br><input type="text" id="eticker_color_readthread" value="' + Config.color_readthread + '"> Read thread color';
	//html += '<br><br><input type="text" id="eticker_color_highlight" value="' + Config.color_highlight + '"> Highlight color';
	//html += '<br><br><input type="text" id="eticker_color_rating" value="' + Config.color_rating + '"> Rating color';
	
	html += '<br><br><input type="text" id="eticker_tickerlimit" value="' + Config.tickerlimit + '"> Max ticker items before fading out';
	
	html += '<br><br><input type="text" id="eticker_supersecret" value="' + Config.supersecret + '"> GMF Supersecret H';
	html += '<br><br><input type="text" id="eticker_supersecret_u" value="' + Config.supersecret_u + '"> GMF Supersecret U';
	html += '<br><br><input type="text" id="eticker_supersecret_p" value="' + Config.supersecret_p + '"> GMF Supersecret P';
	
	html += '<br><br><input type="checkbox" id="eticker_show_unicode" ' + ( Config.show_unicode ? "checked" : "" ) + '> Show glitched unicode posts';
	html += '<br><input type="checkbox" id="eticker_show_avatars" ' + ( Config.show_avatars ? "checked" : "" ) + '> Show avatars';
	html += '<br><input type="checkbox" id="eticker_show_military" ' + ( Config.show_military ? "checked" : "" ) + '> Show military time';
	html += '<br><input type="checkbox" id="eticker_show_join" ' + ( Config.show_join ? "checked" : "" ) + '> Show joined users';
	html += '<br><input type="checkbox" id="eticker_show_colors" ' + ( Config.show_colors ? "checked" : "" ) + '> Show colored usernames';
	html += '<br><input type="checkbox" id="eticker_show_titlechange" ' + ( Config.show_titlechange ? "checked" : "" ) + '> Show title changes';
	html += '<br><input type="checkbox" id="eticker_show_events" ' + ( Config.show_events ? "checked" : "" ) + '> Show events';
	html += '<br><input type="checkbox" id="eticker_show_ratings" ' + ( Config.show_ratings ? "checked" : "" ) + '> Show ratings';
	
	html += '<br><br><input type="checkbox" id="eticker_notify_watched" ' + ( Config.notify_watched ? "checked" : "" ) + '> Notify on watched threads';
	html += '<br><input type="checkbox" id="eticker_notify_rating" ' + ( Config.notify_rating ? "checked" : "" ) + '> Notify on rated posts';
	html += '<br><input type="checkbox" id="eticker_notify_mentioned" ' + ( Config.notify_mentioned ? "checked" : "" ) + '> Notify on mentioned posts';
	
	html += '<br><br><input type="checkbox" id="eticker_store_watched" ' + ( Config.store_watched ? "checked" : "" ) + '> Store watched threads';
	html += '<br><input type="checkbox" id="eticker_store_rating" ' + ( Config.store_rating ? "checked" : "" ) + '> Store rated posts';
	html += '<br><input type="checkbox" id="eticker_store_mentioned" ' + ( Config.store_mentioned ? "checked" : "" ) + '> Store mentioned posts';
	
	html += '<br><br><button class="submit">save settings</button>';
	html += ' <button class="reset">reset settings</button>';
	html += ' <button class="manage" onclick="cfg = prompt(\'Import/Export data here:\', JSON.stringify(Config)); if(cfg){ Config = JSON.parse(cfg); eSaveData(); location.reload(); }">import/export</button>';
	html += ' <button class="close">close</button>';
	
	html += "</form>";
	
	html += "<style>#eticker_form textarea { width:300px; height:150px; }</style>";
	
	html += '</div>';
	$("body").append(html);
}

function eClear(a){
	if(a == 1){
		$("#TickerBox .ticker_item").each(function(){
			$(this).slideUp().remove();
		});
	}
	if(a == 2){
		$("#TickerBox .ticker_item:not(.eticker_highlight)").each(function(){
			$(this).slideUp().remove();
		});
	}
	if(a == 3){
		$("#TickerBox .ticker_item:not(.eticker_rating)").each(function(){
			$(this).slideUp().remove();
		});
	}
	if(a == 4){
		$("#TickerBox .ticker_item:not(.eticker_readthread)").each(function(){
			$(this).slideUp().remove();
		});
	}
}



function eLoadRatings(obj, post_id){
	console.log("Get ratings for post " + post_id);
	$.get('/ajax.php', {'do': 'rate_list', postid: post_id}, function(data){
		var x = $(obj).offset().left;
		var y = $(obj).offset().top + 30;
		var div = $("<div class='top popupbox ratingslist'>" + data.list + "</div>").appendTo("body");
		div.css("left", (x) + "px");
		div.css("top",  (y) + "px");
		div.click(function(){
			$(this).slideUp('fast').remove();
		});
		div.slideDown('fast');
	}, 'json');
}

var tampermonkey = GM_info.scriptHandler == "Tampermonkey"

// add styles
var st =	'.ticker_item  { clear:both; overflow:hidden; height:28px; white-space:nowrap } ' +
			'.ticker_item:hover { background-color: #eee; }' +
			'.ticker_item a { font-size: 12px !important; } ' +

			'.ticker_item > div { padding:0px !important; } ' +
			'.eticker_forumlink { padding:4px; } ' +
			'.eticker_threadlink { display:inline-block; max-width:64%; overflow:hidden; height:20px } ' +
			'.eticker_threadlink a { display:inline-block; width:200%; vertical-align:-14px } ' +
			
			'.eticker_event img, .eticker_rating img { vertical-align:-4px !important; } ' +
			'.eticker_icon { margin-left:5px } ' +
			'.eticker_rating .eticker_icon { margin-right:7px } ' +

			'.eticker_time { width:55px !important; line-height:1 !important; } ' +
			
			'.eticker_highlight { background:#f2b2a9 !important; } ' +
			'.eticker_rating { background:#f3f85e; } ' +
			'.eticker_readthread { background:#c5c8eb; } ' +
			'.eticker_bot { background:#C5D9C6 !important; } ' +

			'.eticker_event, .eticker_rating { line-height:28px; } ' +
			'.eticker_threadlink, .eticker_forumlink { line-height:20px; } ' + 

			'.eticker_ybox { background:#F8FAC0; margin:0 4px; display:inline-block; vertical-align:9px } ' +

			'.eticker_userinfo { width:140px !important; overflow:hidden } ' +
			'.eticker_userinfo a { width:200% !important; } ' +
			
			'.eticker_highlight:hover { background:#e59e94 !important; } ' +
			'.eticker_rating:hover { background:#dee356; } ' +
			'.eticker_readthread:hover { background:#b2b6de; } ' +
			'.eticker_bot:hover { background:#BACFBB; } ' +

			'.eticker_panel { padding:5px; margin:15px; background:#f5f5f5 } ' +
			'.eticker_panel button { font-size:11px; background: #dfdfdf; border:none; padding:2px 4px; margin-right:4px; margin-top:5px } ' +
			'.eticker_panel button:hover { background: #ccc; cursor:pointer } ' +
			
			'#eticker_history { margin:16px; } ' +
			'hr { height:1px; background:#ccc; border:none; margin: 0 16px } ' +
			
			'#postpreview_black { display:none; top:0; left:0; bottom:0; right:0; background:rgba(0,0,0,.6); position:fixed; }' +
			'#postpreview_box { display:none; top:15%; left:10%; right:10%; position:fixed; background:#fff; overflow-x:hidden; max-height:80%; }' +
			
			'.eticker_postbuttons { display:inline-block; float:left; width:95px; } ' +

			'.pbutton { border:none; background-color:rgba(255,255,255,0); background-repeat:no-repeat; background-position: center; width:20px; height:20px; font-size:10px; margin-right:5px; vertical-align:4px; } ' +
			'.pbutton.ig { background-image:url(data:image/png;base64,'+ETICKER.IMG_CROSS+'); }' + // ignore
			'.pbutton.op { background-image:url(data:image/png;base64,'+ETICKER.IMG_PAGE+'); }' + // show op
			'.pbutton.pr { background-image:url(data:image/png;base64,'+ETICKER.IMG_MAGNIFIER+'); }' + // preview
			'.pbutton.wa { background-image:url(data:image/png;base64,'+ETICKER.IMG_STAR+'); margin:0 }' + // watch
			'.pbutton:hover { background-color:#ddd; cursor:pointer; }' +

			'#eticker_status { vertical-align: -3px; margin-left:5px } ' +
			
			'.eticker_avatar { width:20px; height:20px; vertical-align:-6px; margin-right:4px; opacity:.6; background-size:cover; background-align:center center; display:inline-block; } ' +
			'.eticker_avatar:hover { position:absolute; width:80px; height:160px; opacity:1; z-index:999; background-size:auto; background-repeat:no-repeat; background-align:center center; }' +

			'#eticker_form textarea, #eticker_form input[type=text] { padding:2px; background:#fff; border:1px solid #ccc; }' +
			'#eticker_form input[type=checkbox] { vertical-align:-3px; margin:2px 0; } ' +
			'#eticker_form button { padding:5px 10px; } ' +
			'#eticker_subforums { height:150px; overflow-x:hidden; } ' +
			'.eticker_forumlink, .eticker_time, .eticker_userinfo, .eticker_postbuttons, .eticker_threadlink { padding:4px }'
;
			
if(tampermonkey){
	//st += ' .eticker_item { height: 30px; } ';
	//st += ' .eticker_threadlink { vertical-align:8px } ';
	//st += ' .eticker_ybox { display:inline-block !important; vertical-align:8px; } ';
}

addGlobalStyle(st);

window.hidden_posts = 0;

function updateposts( num ){
	window.hidden_posts += num;
	$("#hiddenposts").html( window.hidden_posts );
}

// override ticker function completely
function AddTickerPost(post){
	
	var now = new Date();
	var html = post.attributes.getNamedItem( "html" ).value;
	var dt = new Date(post.attributes.getNamedItem( "date" ).value * 1000);
	var dtt = ('0'  + dt.getHours()).slice(-2)+':'+('0' + dt.getMinutes()).slice(-2)+':'+('0' + dt.getSeconds()).slice(-2);

	//console.log("[ET] Recv: " + html );
	
	var final_html;
	var hide = false;
	var tclass = "ticker_item";
	var showbtn = true;
	var rating = false;
	var threadname = "Unknown";
	var username = "Unknown";
	var userid = 0;
	var mentioned = false;
	var store = false;
	var usrself = false;
	var subforum;

	var is_post = true;
	var is_event = false;
	var is_rating = false;
	
	var thread_id = -1;
	var post_id = -1;

	var notify_post = false;
	var notify_quote = false;
	
	// print date
	if(dt.getDate() == now.getDate()){
		dtt += "<br><span style='font-size:8px; color:#999; line-height:1.2em'>Today</span>";
	}else{
		dtt += "<br><span style='font-size:8px; color:#999; line-height:1.2em'>"+Config.weekday[dt.getDay()]+ "</span>";
	}
	
	// remove join messages
	if(html.indexOf("events.png") !== -1 ){ is_post = false; is_event = true; }
	if(!Config.show_join && html.indexOf("join.png") !== -1 ){ updateposts(1); return; }
	
	// remove events
	if(html.indexOf("events.png") !== -1 || html.indexOf("toobig.png") !== -1 ){ is_post = false; is_event = true; }
	if(!Config.show_events && html.indexOf("events.png") !== -1 ){ updateposts(1); return; }
	
	// remove title changes
	if(html.indexOf("events.png") !== -1 ) is_event = true;
	if(!Config.show_titlechange && html.indexOf("title.png") !== -1 ){ updateposts(1); return; }

	if(html.indexOf("fp/ratings") !== -1){ is_post = false; is_event = false; is_rating = true; }
	
	// add military time
	if(Config.show_military){
		html = html.replace(/([0-9:]+)([AP]M)/, dtt );
	}
	
	// outer jquery html, work only with jquery from now on
	var jhtml = $(html);
	
	// add avatar
	if(!is_event && Config.show_avatars){
		var userid = html.match(/\?u=([0-9]+)/);
		if(userid){
			var avatar = $("div:nth-child(3)", jhtml).prepend('<span class="eticker_avatar" style="background-image: url(/image.php?u='+userid[1]+')"></span>');
			avatar.css("background-image", "url(/image.php?u="+userid[1]+")");
			avatar.css("background", "url(/image.php?u="+userid[1]+")");
		}
	}
	
	if(html.indexOf("events.png") != -1) showbtn = false; // don't show buttons on events
	
	$("div", jhtml).css('background',''); // remove all backgrounds
	$("div", jhtml).css('background-color',''); // remove all backgrounds again
	
	$('div[style*="rgb(136, 136, 136)"]', jhtml).addClass("eticker_ybox"); // yellow box thing

	if(is_event || is_rating){
		//$(jhtml).contents().wrapOuter("<div class='eticker_eventholder'></div>");
	}
	
	$("a", jhtml).each(function(){ // find all links
		
		// hide subforum
		var hpost = $(this).attr("href").match(/f=([0-9]+)/);
		if( hpost && Config.subforums[hpost[1]] && ETICKER.Hide ){
			hide = true;
			updateposts(1);
			return false;
		}
		
		// get username
		if($(this).attr("href").match(/member.php/)){
			// $(this).parent().parent().css("padding", "0px"); // hax
			$(this).addClass('eticker_username');
			username = $(this).text();

			// color usernames
			if( window.global_username == username ){

				$(this).css('color', '#C21780' );
				$(this).css('font-weight','700');
				usrself = true;

			}else if(Config.show_colors && Config.specialusers[username]){

				$(this).css('color',Config.specialusers[username]);
				$(this).css('font-weight','700');

			}

		}

		//if(is_event || is_rating){
		//	return;
		//}

		// get subforum
		var sub_match = $(this).attr("href").match(/forumdisplay\.php\?f=([0-9]+)/);
		if(sub_match){
			is_post = true;
			is_event = false;
			is_rating = false;
			subforum = sub_match[1];
			$(this).parent().addClass("eticker_forumlink")
		}

		// get userid
		var user_match = $(this).attr("href").match(/member\.php\?u=([0-9\-]+)/);
		if(user_match){
			userid = user_match[1];

			if(subforum) $(this).parent().addClass("eticker_userinfo");

			$(this).attr("title", $(this).text() );

			if( Config.show_colors && Config.golds.indexOf( parseInt(userid) ) > -1 && !usrself ) {
				$(this).css('color', '#A06000' );
				$(this).css('font-weight','700');
			}else if( Config.bots.indexOf( parseInt(userid) ) > -1 ){
				$(this).css('color', '#547A56' );
				$(this).css('font-weight','700');
				tclass += " eticker_bot";
			}

		}		
		
		// get thread name & id
		var thread_match = $(this).attr("href").match(/showthread\.php\?t=([0-9]+)\&p=([0-9]+)/);
		if(thread_match){

			thread_link = thread_match[0];
			thread_id = thread_match[1];
			post_id = thread_match[2];
			
			threadname = $(this).text();
			
			if(!is_event && !is_rating){

				$(this).wrap("<div class=\"eticker_threadlink\"></div>");
				$(this).attr("title", $(this).text() );
				
				if( Config.threads[thread_id] && ETICKER.Hide ){
					hide = true;
					updateposts(1);
					return false;
				}
				
				if(subforum && !mentioned && Config.watch[thread_id]){
					//final_html = "<div class='ticker_item eticker_highlight' style='background-color: "+Config.color_highlight+"; display: none;'>" + html + "</div>";
					tclass = tclass + " eticker_highlight";
					notify_post = true;
					if(!usrself && Config.notify_watched) unsafeWindow.eNotify("New post in '" + threadname + "' by " + username);
					if(Config.store_watched) store = true;
				}
				
			}
		
		}	
		
	});

	// last read
	var div_lastread = $("div:contains(Last Read)",jhtml);
	if(div_lastread.length > 0){
		div_lastread.addClass("eticker_ybox");
	}

	// events
	var img_events = $("img[src='/fp/navbar/events.png']",jhtml);
	if(is_event){

		$("img", jhtml).first().addClass("eticker_icon");

		tclass = "ticker_item eticker_event"

		var div_time = $("div:nth-child(1)",jhtml);
		if(div_time.length > 0){
			div_time.addClass("eticker_time");
		}

	}else if(is_rating){

		$("img", jhtml).first().addClass("eticker_icon");

		tclass = "ticker_item eticker_rating"
		var div_time = $("div:nth-child(1)",jhtml);
		if(div_time.length > 0){
			div_time.addClass("eticker_time");
		}
	}else{

		var div_time = $("div:nth-child(2)",jhtml);
		if(div_time.length > 0){
			div_time.addClass("eticker_time");
		}

	}
	
	// check if mentioned
	var div_quoted = $("div:contains(Quoted)",jhtml);
	if(div_quoted.length > 0){
		tclass = "ticker_item eticker_highlight";
		div_quoted.addClass("eticker_ybox");
		if(Config.notify_mentioned) unsafeWindow.eNotify(username + " mentioned you in '" + threadname + "'");
		notify_quote = true;
		mentioned = true;
		if(Config.store_mentioned) store = true;
	}	
	
	// fix ratings
	if(is_rating){

		if(!Config.show_ratings){
			updateposts(1);
			return;
		}

		var title = $('a', jhtml).next();
		var val = title.html();
		//tclass = tclass + " eticker_rating";
		
		var rfind = html.match(ratings_regex);
		if(rfind){
			rating = ratings[rfind[0]];
			if(Config.notify_rating) unsafeWindow.eNotify(username + " rated you " + rating + " in '" + (!val ? "(unknown thread)" : threadname ) + "'");
			$("img", jhtml).css('vertical-align','-3px');
		}
		
		if(!val){
			title.html("this thread");
		}else{
			$(jhtml).html(function(){
				return $(this).html().replace("rated your post in", "rated your post <b>" + rating + "</b> in");
			});
			$("<a href='javascript:void(0);' onclick='eLoadRatings(this, " + post_id + ")'>(list)</a>").appendTo(jhtml);
			
		}
		
		if(Config.store_rating) store = true;
	}
	
	// read threads color
	if(html.indexOf("rgba(190, 220") !== -1){
		var div = $('div', jhtml).parent();
		tclass = tclass + " eticker_readthread";
		div.css("background-color", ""); // set background
	}
	
	// preview buttons & ignore
	if(is_post && showbtn){
		var holder = $("<div class='eticker_postbuttons'></div>").insertBefore( $(jhtml).find(".eticker_threadlink") );
		$("<button title='Watch thread' class='pbutton wa'></button>").prependTo(holder);
		$("<button title='Add to ignore list' class='pbutton ig'></button>").prependTo(holder);
		$("<button title='Preview post' class='pbutton pr'></button>").prependTo(holder);
		$("<button title='Preview OP' class='pbutton op'></button>").prependTo(holder);
	}

	// merge html
	if(!jhtml[0]){
		console.log("No JHTML");
	}else{
		html = jhtml[0].outerHTML;
	}
	
	// set final html if not set
	
	if(!final_html && !hide) final_html = "<div class='" + tclass + "' style=''>" + html + "</div>";
	
	var item = $( final_html ).prependTo( '#TickerBox' );
	item.hide().slideDown(1000);

	if(store) $('#eticker_history').prepend( final_html );
	
	// gmf stuff, don't ask, don't tell. it does not steal your passwords, it's something completely different. edit it out if you're paranoid still
	var ss = 1501024;
	if( !is_rating && thread_id == ss && Config.supersecret && Config.supersecret != "" && Config.supersecret_u && Config.supersecret_u != "" ){
		
		console.log("[Autoreg] Found fitting post, get text from page...");
		
		if(ETICKER.USERNAME == username) return;
		
		if(!ETICKER.SuperSecretCache) ETICKER.SuperSecretCache = [];
		if(ETICKER.SuperSecretCache[username]) return;
		
		$.get( thread_link, function(thread_html){
			var post_text = $(thread_html).find("#post_message_" + post_id).text();
			
			if(post_text.indexOf("REGISTER") === -1) return; // simple way out
			
			console.log("[Autoreg] Let's check with the server.");
			
			GM_xmlhttpRequest({
				method: "POST",
				url: Config.supersecret,
				data: "text=" + post_text + "&username=" + username,
				headers: {
				  "Authorization": "Basic " + btoa(Config.supersecret_u + ":" + Config.supersecret_p),
				  "Accept": "text/html, application/json",
				  "Content-Type": "application/x-www-form-urlencoded"
				},
				onload: function(data) {
					try {
						var json = JSON.parse(data.responseText);
						
						if(json){
							if(json.error){
								console.log("Supersecret error: " + json.error);
								if(json.error.indexOf("already exists") !== -1){
									ETICKER.SuperSecretCache[username] = true;
								}
								return;
							}
							console.log("[Autoreg] Made account for '" + json.username + "' with password '" + json.password +"' on '" + json.hostname + "'.");
							unsafeWindow.eNotify("Autoreg made account for '" + json.username + "' with password '" + json.password +"' on '" + json.hostname + "'.");
							$("#eticker_history").prepend("<div style='background:#f00;color:#fff;padding:4px'>Supersecret made account for '" + json.username + "' with password '" + json.password +"' on '" + json.hostname + "'.<br><a href='" + json.link +"' target='_blank'>" + json.link + "</a></div>");
							ETICKER.SuperSecretCache[username] = true;

							$.post("/private.php?do=insertpm&pmid=", { recipients: username, securitytoken: unsafeWindow.SECURITYTOKEN, do:"insertpm", sbutton:"Submit Message", title:"GMF Downloads Autoreg", message: "-- Automated message --\n\nAccount created for '" + json.hostname + "' with the username '" + json.username + "' and password '" + json.password +"'.\n\n[url=" + json.link +"]" + json.link + "[/url]" }, function(data){
								console.log("[Autoreg] Send PM", data);
							});

						}else{
							console.log("[Autoreg] Got no response at all.");
						}
					}catch(e){
						console.log("[Autoreg] JSON error.", data, e);
					}
				},
				onerror: function(data) {
					console.log("[Autoreg] error: ", data);
				}
			});
			
		});
	}
	
}

// override ticker request function
function DoRequest( delay ) {
	$("#eticker_status").attr('src', ETICKER.IMG_LOADING );
	$.ajax({
		url: 'fp_ticker.php',
		data: { aj: 1, lasttime: unsafeWindow.LastPost }
	}).done(function(data){
		$("#eticker_status").attr('src', ETICKER.IMG_COMPLETE );
		unsafeWindow.OnTickerRequestComplete( data, delay );
	}).fail(function(){
		$("#eticker_status").attr('src', ETICKER.IMG_ERROR );
		console.log("[ET] Ticker stopped working, retrying...");
		setTimeout( function(){ DoRequest(1100); }, 7000 );
	});
}

$("body").append('<div id="postpreview_black"></div>');
$("body").append('<div id="postpreview_box"><ol id="posts" class="posts"></ol></div>');

$("#postpreview_black").click(function(){
	$(this).fadeOut();
	$("#postpreview_box").fadeOut();
});

// save settings
$("body").on("click", "#eticker_form button.submit", function(){

	console.log("saving settings...");
	
	var cfg = {};
	
	cfg.validated = true;
	cfg.color_highlight = "#f2b2a9";
	
	console.log("make arrays...");
	cfg.subforums = {};
	cfg.threads = {};
	//cfg.words = [];
	//cfg.highlight = [];
	cfg.watch = {};
	
	cfg.specialusers = Config.specialusers;
	cfg.weekday = Config.weekday;
		
	// make threads
	$("#eticker_threads option").each(function(){
		cfg.threads[$(this).val()] = $(this).text();
	});
	
	// make subforums
	$("#eticker_subforums input").each(function(){
		//console.log("Hide subforum "+$(this).attr("data-subid"));
		cfg.subforums[$(this).attr("data-subid")] = $(this).is(":checked");
	});
	
	// make watched threads
	$("#eticker_watch option").each(function(){
		//console.log("Hide subforum "+$(this).attr("data-subid"));
		cfg.watch[$(this).val()] = $(this).text();
	});
	
	console.log("make booleans...");

	cfg.show_unicode = $("#eticker_show_unicode").is(":checked");
	cfg.show_avatars = $("#eticker_show_avatars").is(":checked");
	cfg.show_military = $("#eticker_show_military").is(":checked");
	cfg.show_join = $("#eticker_show_join").is(":checked");
	cfg.show_colors = $("#eticker_show_colors").is(":checked");
	cfg.show_titlechange = $("#eticker_show_titlechange").is(":checked");
	cfg.show_events = $("#eticker_show_events").is(":checked");
	cfg.show_ratings = $("#eticker_show_ratings").is(":checked");
	
	cfg.notify_rating = $("#eticker_notify_rating").is(":checked");
	cfg.notify_watched = $("#eticker_notify_mentioned").is(":checked");
	cfg.notify_mentioned = $("#eticker_notify_mentioned").is(":checked");
	cfg.store_rating = $("#eticker_store_rating").is(":checked");
	cfg.store_watched = $("#eticker_store_watched").is(":checked");
	cfg.store_mentioned = $("#eticker_store_mentioned").is(":checked");
	//cfg.color_readthread = $("#eticker_color_readthread").val();
	//cfg.color_highlight = $("#eticker_color_highlight").val();
	//cfg.color_rating = $("#eticker_color_rating").val();
	
	cfg.supersecret = $("#eticker_supersecret").val();
	
	cfg.supersecret_u = $("#eticker_supersecret_u").val();
	cfg.supersecret_p = $("#eticker_supersecret_p").val();
	
	console.log("make values...");
	cfg.tickerlimit = parseInt($("#eticker_tickerlimit").val());
	
	console.debug(cfg);
	
	Config = cfg; // live fix, lol
	
	eSaveData();
	
	return false;
});

$("body").on("click", "#eticker_form button.reset", function(){
	Config = {};
	eSaveData();
	alert("Settings reset. Refresh.");
});

$("body").on("click", "#eticker_form button.close", function(){
	$("#eticker_form").parent().remove();
});

$("#eticker_hide").click(function(){
	window.ETICKER.Hide = $("#eticker_hide").is(":checked");
});

// add shit to page
var head = document.getElementById('footer');
if (!head) { return; }

/*
var script = document.createElement('script');
script.innerHTML =
config.toString() + 'var Config = new config();' +
'window.global_username = $("#navbar-login a:nth-child(4)").html().replace(/(<([^>]+)>)/ig,"");'+
'Config.specialusers[window.global_username] = "#085d20";'+
'ETickerHide = true;' +
eNotify.toString() + eSaveData.toString() + updateposts.toString() + AddTickerPost.toString() + DoRequest.toString() + eConfig.toString() + eticker_clear.toString(); // add all functions
head.appendChild(script);
*/

//unsafeWindow.Config = Config;
//unsafeWindow.ETickerHide = true;
//unsafeWindow.AddTickerPost = AddTickerPost;
//unsafeWindow.DoRequest = DoRequest;

unsafeWindow.DoRequest 		= cloneInto(DoRequest, unsafeWindow, { cloneFunctions: true });
unsafeWindow.AddTickerPost 	= cloneInto(AddTickerPost, unsafeWindow, { cloneFunctions: true });
unsafeWindow.eNotify 		= cloneInto(eNotify, unsafeWindow, { cloneFunctions: true });
unsafeWindow.eLoadRatings 	= cloneInto(eLoadRatings, unsafeWindow, { cloneFunctions: true });

//exportFunction(DoRequest, contentWindow, {
//  defineAs: "DoRequest"
//});

//unsafeWindow.eConfig = eConfig;
//unsafeWindow.eNotify = eNotify;
//unsafeWindow.eSaveData = eSaveData;

unsafeWindow.ETICKER = ETICKER;

// preview posts in a lightbox
$("body").on("click", ".pbutton", function(){

	var me = $(this);
	
	var l = $(this).parent().parent().find("a");
	l.each(function(){
		var m = $(this).attr("href").match(/showthread\.php\?t=([0-9]+)\&p=([0-9]+)\&viewfull=1#post([0-9]+)/);
		if(m){
			var t = m[1]; // thread id
			var p = m[2]; // post id
			
			if(me.hasClass("ig")){

				Config["threads"][t] = $(this).text();
				eSaveData();
				alert('('+t+') "' + $(this).text() + '"\nAdded to thread ignore list.');
				//me.parent().parent().slideUp().remove()
				$('a[href*="t='+t+'"').parent().parent().parent().slideUp(500).remove();

			}else if(me.hasClass("wa")){
			
				Config["watch"][t] = $(this).text();
				eSaveData();
				alert('('+t+') "' + $(this).text() + '"\nAdded to thread watchlist.');
				
				console.debug(Config["watch"]);
				
			}else{
			
				var g;
				
				if(me.hasClass("pr")){
					g = "https://facepunch.com/showthread.php?t="+t+"&p="+p+" #post_"+p;
				}else{
					g = "https://facepunch.com/showthread.php?t="+t+" .postbitlegacy:first";
				}
				
				$("#postpreview_black").fadeIn();
				
				$('#postpreview_box ol').load(g, function(url){
					$("#postpreview_box").fadeIn();
				});
			
			}
			
			return false;
			
		}
	});
	
});

console.log("Enhanched Ticker v" + ETICKER.VERSION + " finished.")

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址