Advertisement
Guest User

Logserv gm Script - Ogame *monkey

a guest
Jul 23rd, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.31 KB | None | 0 0
  1. // ==UserScript==
  2. // @name LogServer.net GM script
  3. // @namespace localhost
  4. // @description LogServer.net Greasemonkey script for quick uploading combat reports in OGame v5.x ("redesign")
  5. // @include http://*.ogame.*/game/index.php?*page=*
  6. // @include http://*-*.ogame.gameforge.com/game/index.php?page=*
  7. // @exclude http://board.*.ogame.gameforge.com
  8. // @copyright 2010, Nate River
  9. // @license GNU
  10. // @version 3.1
  11. // @author Nate River (Skyline Designs)
  12. // @updateURL http://userscripts.org/scripts/source/69560.user.js
  13. // @installURL http://userscripts.org/scripts/source/69560.user.js
  14. // @downloadURL http://userscripts.org/scripts/source/69560.user.js
  15. // @grant none
  16. // @homepage http://logserver.net
  17. // ==/UserScript==
  18.  
  19. (function ()
  20. {
  21. objScript = document.createElement("script");
  22. objScript.src = "http://logserver.net/plugin/logserver_gms_combatreport.js";
  23. document.body.appendChild(objScript);
  24.  
  25. objScript = document.createElement("script");
  26. objScript.src = "http://logserver.net/plugin/logserver_gms_menubutton.js";
  27. document.body.appendChild(objScript);
  28.  
  29. var $ = unsafeWindow.$;
  30. $.getScript( '/cdn/js/greasemonkey/version-check.js', function() {
  31. (unsafeWindow || window).oGameVersionCheck('LogServer.net GM script', '5.4.3', 'http://userscripts.org/scripts/show/69560');
  32. });
  33.  
  34. if (document.location.href.indexOf ("/game/index.php?page=messages") < 0) return;
  35. var myFunc = (function ()
  36. {
  37. var url = location.hostname.search('ru');
  38.  
  39. if (url == '-1')
  40. {
  41. var LogServer_plugin = 'LogServer plugin';
  42. var upload_form = 'upload form';
  43. var Recycler_report = 'Recycler report:';
  44. var Comment = 'Comment:';
  45. var Planet_clean_up = 'Planet clean-up:';
  46. var Public_log = 'Public log';
  47. var Hide_coordinates = 'Hide coordinates';
  48. var Hide_technologies = 'Hide technologies';
  49. var Hide_technologies = 'Hide technologies';
  50. var Hide_time = 'Hide Time';
  51. var Hide_comments = 'Ban comments';
  52. var Calculate_IPMs = 'Calculate IPMs:';
  53. var Calc_deuterium = 'Calc. deuterium consumption (100%)';
  54. var Universe = 'Universe';
  55. var Upload = 'Upload';
  56. } else {
  57. var LogServer_plugin = 'LogServer плагин';
  58. var upload_form = 'форма загрузки';
  59. var Recycler_report = 'Доклад переработчиков:';
  60. var Comment = 'Комментарий:';
  61. var Planet_clean_up = 'Зачистка планеты:';
  62. var Public_log = 'Публичный лог';
  63. var Hide_coordinates = 'Скрыть координаты';
  64. var Hide_technologies = 'Скрыть технологии';
  65. var Hide_time = 'Скрыть время';
  66. var Hide_comments = 'Запрет комментариев';
  67. var Calculate_IPMs = 'Учесть МПР:';
  68. var Calc_deuterium = 'Рассчитать потр. дейтерия (100%)';
  69. var Universe = 'Вселенная';
  70. var Upload = 'Загрузить';
  71. }
  72.  
  73. if (document.location.href.indexOf("page=messages") < 0) return;
  74. $(document).ajaxSuccess (function(e, xhr, ajaxOptions)
  75. {
  76. if (ajaxOptions.url.indexOf ("page=combatreport") >= 0)
  77. {
  78. $ (".overlayDiv > .combatreport").each (function ()
  79. {
  80. var strLogServerURL = "http://logserver.net/index.php";
  81.  
  82. var strHTML = document.getElementsByClassName("combatreport")[0].innerHTML;
  83.  
  84. strPattern = "<style.+?</style>";
  85. while (strHTML.search(new RegExp(strPattern)) != -1)
  86. strHTML = strHTML.replace(new RegExp(strPattern), "");
  87.  
  88. strPattern = "<script.+?</script>";
  89. while (strHTML.search(new RegExp(strPattern)) != -1)
  90. strHTML = strHTML.replace(new RegExp(strPattern), "");
  91.  
  92. strPattern = "<lcs.+?dataexchangeelement>";
  93. while (strHTML.search(new RegExp(strPattern)) != -1)
  94. strHTML = strHTML.replace(new RegExp(strPattern), "");
  95.  
  96. strHTML = strHTML.replace(new RegExp("<input.+?Shahterov.+?>"), "");
  97.  
  98. var strUploadDiv = "";
  99. strUploadDiv += "<form action='" + strLogServerURL + "' method='post' target='_blank'>";
  100. strUploadDiv += "<center>";
  101. strUploadDiv += " <table>";
  102. strUploadDiv += " <tr>";
  103. strUploadDiv += " <center><font color='#00DD00'><b>LogServer.net " + upload_form + "</b></font></center>";
  104. strUploadDiv += " </tr>";
  105. strUploadDiv += " <tr>";
  106. strUploadDiv += " <td align='center'>";
  107. strUploadDiv += " <textarea rows='8' name='log_textarea' cols='156' style='display: none; font-size: 10px; font-family: Arial; color:#888888; background-color:#000000; border-style:solid; border: 1px solid #888888;'>" + strHTML +"</textarea>";
  108. strUploadDiv += " <font face='Arial' color='#888888' size='2'>" + Recycler_report + "</font><br>";
  109. strUploadDiv += " <textarea rows='2' name='recycler_textarea' cols='160' style='width: 700px; min-height: 20px; font-size: 10px; font-family: Arial; color:#888888; background-color:#000000; border-style:solid; border: 1px solid #888888;' onclick='this.setAttribute(\"rows\", 4); if (this.innerHTML==\"*\") this.innerHTML=\"\"'>*</textarea>";
  110. strUploadDiv += " <br><font face='Arial' color='#888888' size='2'>" + Comment + "</font><br>";
  111. strUploadDiv += " <textarea rows='2' name='comment_textarea' cols='160' style='width: 700px; min-height: 20px; font-size: 10px; font-family: Arial; color:#888888; background-color:#000000; border-style:solid; border: 1px solid #888888;' onclick='this.setAttribute(\"rows\", 4);'></textarea>";
  112. strUploadDiv += " <br><font face='Arial' color='#888888' size='2'>" + Planet_clean_up + "</font><br>";
  113. strUploadDiv += " <textarea rows='2' name='clean_up_textarea' cols='160' style='width: 700px; min-height: 20px; font-size: 10px; font-family: Arial; color:#888888; background-color:#000000; border-style:solid; border: 1px solid #888888;' onclick='this.setAttribute(\"rows\", 4);'></textarea>";
  114. strUploadDiv += " </td>";
  115. strUploadDiv += " </tr>";
  116.  
  117. strChecked = getCookie("index_cbx_public");
  118. if (strChecked == "false") strChecked = ""
  119. else strChecked = "checked";
  120. strCheckBoxes = " <input type='checkbox' name='cbx_public' value='ON' " + strChecked + " onchange='document.cookie=\"index_cbx_public=\"+this.checked+\"; expires=Monday, 01-Sep-2020 10:0:0 GMT\"'><font color='#888888' face='Arial' size='2'>" + Public_log + "</font><br>";
  121. strChecked = getCookie("index_cbx_hide_coord");
  122. if (strChecked == "false") strChecked = ""
  123. else strChecked = "checked";
  124. strCheckBoxes += " <input type='checkbox' name='cbx_hide_coord' value='ON' " + strChecked + " onchange='document.cookie=\"index_cbx_hide_coord=\"+this.checked+\"; expires=Monday, 01-Sep-2020 10:0:0 GMT\"'><font color='#888888' face='Arial' size='2'>" + Hide_coordinates + "</font><br>";
  125. strChecked = getCookie("index_hide_tech");
  126. if (strChecked == "false") strChecked = ""
  127. else strChecked = "checked";
  128. strCheckBoxes += " <input type='checkbox' name='cbx_hide_tech' value='ON' " + strChecked + " onchange='document.cookie=\"index_hide_tech=\"+this.checked+\"; expires=Monday, 01-Sep-2020 10:0:0 GMT\"'><font color='#888888' face='Arial' size='2'>" + Hide_technologies + "</font><input type=hidden name='submited' value='1'>";
  129.  
  130. strListBoxes = " <table border='0' style='border-collapse: collapse' cellpadding='2'><tr><td>";
  131. strListBoxes += " <select size='1' name='select_uni' style='font-size: 10px; width: 120px;'>";
  132. strListBoxes += " <option value='0' selected>Universe: auto</option>";
  133. strListBoxes += " <option value='101'>Andromeda</option>";
  134. strListBoxes += " <option value='102'>Barym</option>";
  135. strListBoxes += " <option value='103'>Capella</option>";
  136. strListBoxes += " <option value='104'>Draco</option>";
  137. strListBoxes += " <option value='105'>Electra</option>";
  138. strListBoxes += " <option value='106'>Fornax</option>";
  139. strListBoxes += " <option value='107'>Gemini</option>";
  140. strListBoxes += " <option value='108'>Hydra</option>";
  141. strListBoxes += " <option value='109'>Io</option>";
  142. strListBoxes += " <option value='110'>Jupiter</option>";
  143. strListBoxes += " <option value='111'>Kassiopeia</option>";
  144. strListBoxes += " <option value='112'>Leo</option>";
  145. strListBoxes += " <option value='113'>Mizar</option>";
  146. strListBoxes += " <option value='114'>Nekkar</option>";
  147. strListBoxes += " <option value='115'>Orion</option>";
  148. strListBoxes += " <option value='116'>Pegasus</option>";
  149. strListBoxes += " <option value='117'>Quantum</option>";
  150. strListBoxes += " <option value='118'>Rigel</option>";
  151. strListBoxes += " <option value='119'>Sirius</option>";
  152. strListBoxes += " <option value='120'>Taurus</option>";
  153. strListBoxes += " <option value='121'>Ursa</option>";
  154. strListBoxes += " <option value='122'>Vega</option>";
  155. strListBoxes += " <option value='123'>Wasat</option>";
  156. strListBoxes += " <option value='124'>Xalynth</option>";
  157. strListBoxes += " <option value='125'>Yakini</option>";
  158. strListBoxes += " <option value='126'>Zagadra</option>";
  159. for (var i = 1; i < 101; i++)
  160. strListBoxes += "<option value='" + i + "'>" + i + ". Universe</option>";
  161. strListBoxes += " </select>";
  162. strListBoxes += " <td></td></td><td>";
  163. strListBoxes += " <select size='1' name='select_domain' style='font-size: 10px; width: 120px;'>";
  164. strListBoxes += " <option value='0' selected>Domain: auto</option>";
  165. strListBoxes += " <option value='AR'>AR</option>";
  166. strListBoxes += " <option value='BG'>BG</option>";
  167. strListBoxes += " <option value='BR'>BR</option>";
  168. strListBoxes += " <option value='HU'>HU</option>";
  169. strListBoxes += " <option value='DE'>DE</option>";
  170. strListBoxes += " <option value='GR'>GR</option>";
  171. strListBoxes += " <option value='DK'>DK</option>";
  172. strListBoxes += " <option value='ES'>ES</option>";
  173. strListBoxes += " <option value='IT'>IT</option>";
  174. strListBoxes += " <option value='LV'>LV</option>";
  175. strListBoxes += " <option value='LT'>LT</option>";
  176. strListBoxes += " <option value='MX'>MX</option>";
  177. strListBoxes += " <option value='NL'>NL</option>";
  178. strListBoxes += " <option value='NO'>NO</option>";
  179. strListBoxes += " <option value='ORG'>ORG</option>";
  180. strListBoxes += " <option value='PL'>PL</option>";
  181. strListBoxes += " <option value='PT'>PT</option>";
  182. strListBoxes += " <option value='RU'>RU</option>";
  183. strListBoxes += " <option value='RO'>RO</option>";
  184. strListBoxes += " <option value='US'>US</option>";
  185. strListBoxes += " <option value='SK'>SK</option>";
  186. strListBoxes += " <option value='SI'>SI</option>";
  187. strListBoxes += " <option value='TW'>TW</option>";
  188. strListBoxes += " <option value='TR'>TR</option>";
  189. strListBoxes += " <option value='FI'>FI</option>";
  190. strListBoxes += " <option value='FR'>FR</option>";
  191. strListBoxes += " <option value='CZ'>CZ</option>";
  192. strListBoxes += " <option value='SE'>SE</option>";
  193. strListBoxes += " <option value='JP'>JP</option>";
  194. strListBoxes += " </select>";
  195. strListBoxes += " </td></tr><tr height='4'><td></td><td width='4'></td><td></td></tr><tr><td>";
  196. strListBoxes += " <select size='1' name='select_skin' style='font-size: 10px; width: 120px;'>";
  197. strListBoxes += " <option value='logserver_v20' selected>Skin: LogServer v2</option>";
  198. strListBoxes += " <option value='0'>Default</option>";
  199. strListBoxes += " <option value='original'>Original</option>";
  200. strListBoxes += " <option value='abstract'>Abstract</option>";
  201. strListBoxes += " <option value='animex'>AnimeX</option>";
  202. strListBoxes += " <option value='animex_2'>AnimeX 2</option>";
  203. strListBoxes += " <option value='chaos'>Chaos</option>";
  204. strListBoxes += " <option value='destroyer'>Destroyer</option>";
  205. strListBoxes += " <option value='fallout'>Fallout</option>";
  206. strListBoxes += " <option value='dead_space'>Dead Space</option>";
  207. strListBoxes += " <option value='ntrvr'>¿ntrvr[!]</option>";
  208. strListBoxes += " <option value='disturbed'>Disturbed</option>";
  209. strListBoxes += " <option value='staticx'>Static-X</option>";
  210. strListBoxes += " <option value='system_shock'>System shock</option>";
  211. strListBoxes += " <option value='bender'>Bender</option>";
  212. strListBoxes += " </select>";
  213. strListBoxes += " <td></td></td><td>";
  214. strListBoxes += " <select style='display: none' size='1' name='lang' style='font-size: 10px; width: 120px;'>";
  215. strListBoxes += " <option value='0' selected>Language: auto</option>";
  216. strListBoxes += " <option value='bg'>Bulgarian</option>";
  217. strListBoxes += " <option value='de'>German</option>";
  218. strListBoxes += " <option value='en'>English</option>";
  219. strListBoxes += " <option value='ru'>Russian</option>";
  220. strListBoxes += " <option value='ua'>Ukrainian</option>";
  221. strListBoxes += " </select>";
  222. strListBoxes += " </td></tr></table>";
  223.  
  224. strUploadDiv += " <tr>";
  225. strUploadDiv += " <td align='left'>";
  226. strUploadDiv += " <table border='0' style='border-collapse: collapse' width='754'>";
  227. strUploadDiv += " <tr>";
  228. strUploadDiv += " <td align='left' valign='top'>";
  229. strUploadDiv += strCheckBoxes;
  230. strUploadDiv += " </td>";
  231. strUploadDiv += " <td width='10'></td>";
  232. strUploadDiv += " <td align='right' valign='top'>";
  233. strUploadDiv += " <div id='exsettings' style='display: block;'>";
  234. strUploadDiv += " <table border='0' style='border-collapse: collapse'>";
  235. strUploadDiv += " <tr>";
  236. strUploadDiv += " <td>";
  237. strUploadDiv += " <input type='checkbox' name='cbx_ipm' value='ON' onchange='(this.checked) ? (document.getElementById(\"text_ipm\").disabled = false) : (document.getElementById(\"text_ipm\").disabled = true)'><font color='#888888' face='Arial' size='2'>" + Calculate_IPMs + " </font>";
  238. strUploadDiv += " <input disabled type='text' id='text_ipm' name='text_ipm' size='5' value='' style='width: 20; font-size: 12px; font-family: Arial; color: #000000; background-color: #ffffff; border: 1px solid #888888;'>";
  239. strUploadDiv += " <br>";
  240. strUploadDiv += " <input type='checkbox' name='cbx_fuel' value='ON'><font color='#888888' face='Arial' size='2'>" + Calc_deuterium + "</font>";
  241. strUploadDiv += " </td>";
  242. strUploadDiv += " <td width='10'></td>";
  243. strUploadDiv += " <td>";
  244. strUploadDiv += strListBoxes;
  245. strUploadDiv += " </td>";
  246. strUploadDiv += " </tr>";
  247. strUploadDiv += " </table>";
  248. strUploadDiv += " </div>";
  249. strUploadDiv += " </td>";
  250. strUploadDiv += " </tr>";
  251. strUploadDiv += " </table>";
  252. strUploadDiv += " </td>";
  253. strUploadDiv += " </tr>";
  254.  
  255. strUploadDiv += " <tr>";
  256. strUploadDiv += " <td>";
  257. strUploadDiv += " <center>";
  258. strUploadDiv += " <input class='btn_blue' type='submit' value='" + Upload + "' name='submit'>";
  259. strUploadDiv += " </center>";
  260. strUploadDiv += " </td>";
  261. strUploadDiv += " </tr>";
  262. strUploadDiv += " </table>";
  263. strUploadDiv += "</center>";
  264. strUploadDiv += "</form>";
  265.  
  266. var objDiv = document.createElement("div");
  267. objDiv.id = 'logserver_combat_result';
  268. objDiv.style.display = 'none';
  269. objDiv.className = 'upload_div';
  270. objDiv.innerHTML = strUploadDiv;
  271.  
  272. var objButton = document.createElement("input");
  273. objButton.id = "logserver_plugin_button";
  274. objButton.className = "btn_blue";
  275. objButton.type = "button";
  276. objButton.value = LogServer_plugin + " ▼";
  277. objButton.addEventListener("click", ShowHideUploadDiv, false);
  278.  
  279. var objCenter = document.createElement("center");
  280.  
  281. var combat_result = document.getElementById('combat_result');
  282. objCenter.appendChild(objButton);
  283. combat_result.appendChild(objCenter);
  284. combat_result.appendChild(objDiv);
  285. });
  286. }
  287. else if (ajaxOptions.url.indexOf ("page=showmessage") >= 0)
  288. {
  289. $ (".overlayDiv > .showmessage .note").each (function ()
  290. {
  291. var attack = document.getElementsByClassName('attack')[0];
  292.  
  293. if (attack) {
  294. var strMsgLogServerURL = "http://msg.logserver.net/index.php";
  295. var theHref = document.location.href;
  296. var strHTML = document.getElementsByClassName("showmessage")[0].innerHTML;
  297.  
  298. strPattern = "<.+?>";
  299. while (strHTML.search(new RegExp(strPattern)) != -1)
  300. strHTML = strHTML.replace(new RegExp(strPattern), "");
  301.  
  302. strPattern = "<script.+?</script>";
  303. while (strHTML.search(new RegExp(strPattern)) != -1)
  304. strHTML = strHTML.replace(new RegExp(strPattern), "");
  305.  
  306. var strUploadDiv = "";
  307. strUploadDiv += "<form name='upload_form' id='upload_form' target='_blank' enctype='multipart/form-data' action='" + strMsgLogServerURL + "' method='post'>";
  308. strUploadDiv += "<textarea rows='1' name='theHref' cols='160' style='display: none;'>" + theHref + "</textarea>";
  309. strUploadDiv += "<textarea rows='1' name='report' cols='160' style='display: none;'>" + strHTML + "</textarea>";
  310. strUploadDiv += "<center>";
  311. strUploadDiv += " <table border='1'>";
  312. strUploadDiv += " <tr>";
  313. strUploadDiv += " <center><font color='#00DD00'><b>LogServer.net " + upload_form + "</b></font></center>";
  314. strUploadDiv += " </tr>";
  315. strUploadDiv += " <tr>";
  316. strUploadDiv += " <td align='center'>";
  317. strUploadDiv += Comment + "<br />";
  318. strUploadDiv += " <textarea rows='2' name='comment' cols='132' style='font-size: 10px; font-family: Arial; color:#888888; background-color:#000000; border-style:solid; border: 1px solid #888888;' onclick='this.setAttribute(\"rows\", 4); if (this.innerHTML==\"*\") this.innerHTML=\"\"'></textarea>";
  319. strUploadDiv += " </td>";
  320. strUploadDiv += " </tr>";
  321. strUploadDiv += " <tr align='center'>";
  322. strUploadDiv += " <td>";
  323. strUploadDiv += " <input class='btn_blue' type='submit' value='" + Upload + "' name='submit'>";
  324. strUploadDiv += " </td>";
  325. strUploadDiv += " </tr>";
  326. strUploadDiv += " </table>";
  327. strUploadDiv += "</center>";
  328. strUploadDiv += "</form>";
  329.  
  330. var objDiv = document.createElement("div");
  331. objDiv.id = 'logserver_combat_result';
  332. objDiv.style.display = 'none';
  333. objDiv.className = 'upload_div';
  334. objDiv.innerHTML = strUploadDiv;
  335.  
  336. var objButton = document.createElement("input");
  337. objButton.id = "logserver_plugin_button";
  338. objButton.className = "btn_blue";
  339. objButton.type = "button";
  340. objButton.value = LogServer_plugin + " ▼";
  341. objButton.addEventListener("click", ShowHideUploadDiv, false);
  342.  
  343. var objCenter = document.createElement("center");
  344.  
  345. var message = document.getElementsByClassName('showmessage')[0];
  346. if (message)
  347. {
  348. objCenter.appendChild(objButton);
  349. message.appendChild(objCenter);
  350. message.appendChild(objDiv);
  351. }
  352. }
  353. });
  354. }
  355. });
  356.  
  357. function ShowHideUploadDiv() {
  358. var objDiv = document.getElementById("logserver_combat_result");
  359. var objButton = document.getElementById("logserver_plugin_button");
  360.  
  361. if (objDiv.style.display == "none") {
  362. objDiv.style.display = "";
  363. objButton.value = objButton.value.replace("▼", "▲");
  364. window.moveTo(0, 0);
  365. window.resizeTo(screen.availWidth, screen.availHeight);
  366. }
  367. else {
  368. objDiv.style.display = "none";
  369. objButton.value = objButton.value.replace("▲", "▼");
  370. }
  371. }
  372.  
  373. function getCookie(name) {
  374. var cookie = " " + document.cookie;
  375. var search = " " + name + "=";
  376. var setStr = null;
  377. var offset = 0;
  378. var end = 0;
  379. if (cookie.length > 0) {
  380. offset = cookie.indexOf(search);
  381. if (offset != -1) {
  382. offset += search.length;
  383. end = cookie.indexOf(";", offset)
  384. if (end == -1) {
  385. end = cookie.length;
  386. }
  387. setStr = unescape(cookie.substring(offset, end));
  388. }
  389. }
  390. return(setStr);
  391. }
  392. }).toString ();
  393. var script = document.createElement ("script");
  394. script.setAttribute ("type", "application/javascript");
  395. script.textContent = "(" + myFunc + ") ();";
  396. document.body.appendChild (script);
  397. }) ();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement