Cantr Enhanced

Some useful enhancements: events grouping and coloring names, objects grouping, clean objects list, buildings&vehicles highlighting

  1. // ==UserScript==
  2. // @name Cantr Enhanced
  3. // @namespace http://www.cantr-mmorpg.pl/scripts
  4. // @description Some useful enhancements: events grouping and coloring names, objects grouping, clean objects list, buildings&vehicles highlighting
  5. // @include http://www.cantr.net/*
  6. // @include http://cantr.net/*
  7. // @include https://cantr.net/*
  8. // @include https://www.cantr.net/*
  9. // @include cantr.net/*
  10. // @include http://test.cantr.net/*
  11. // @grant none
  12. // @exclude http://cantr.net/*?page=login*
  13. // @include www.cantr.net/*
  14. // @version 2.5.0
  15. // ==/UserScript==
  16.  
  17. var VER = '2.5.0';
  18.  
  19. /*
  20.  
  21. version 2.5.0
  22. - make CE work after the major layout changes
  23.  
  24. version 2.4.0b
  25. - nothing changes, it's just made available on greasefork instead of dead userscripts
  26.  
  27. version 2.4.0
  28. - CE options available again on player page
  29.  
  30. version 2.3.0
  31. - compatibility with new events page changes
  32.  
  33. version 2.2.0
  34. - removed [all] button for objects&inventory pages
  35.  
  36. version 2.1.0
  37. - support for Finnish characters
  38. - buildings&vehicles bookmarks works again
  39. - removed grouping of vehicles by type (it's already done by the game)
  40.  
  41. version 2.0.0
  42. - ajax based object taking/dropping
  43. - fixed operations on many notes for taking notes from envelope
  44.  
  45. version 1.8.5
  46. - most of modules now work for Spanish and German characters, but interface is not translated
  47.  
  48. version 1.8.3
  49. - whisper receivers list is remembered between page loads
  50. - name on receivers list is updated when changing character name using ajax char renaming
  51.  
  52. version 1.8.2
  53. - fixed bug with renaming chars on events page
  54.  
  55. version 1.8.1
  56. - fixed bugs from 1.8.0
  57. - it's possible to submit text on events page using [ENTER]
  58. - on chrome works significantly faster
  59. - removing character from whisper list no longer causes issues
  60.  
  61. version 1.8.0 UNSTABLE
  62. - events page performance fix
  63. - added ajax whisper on events page
  64. - added rename character on events page
  65. - added line which shows unread events (when browser was not focused)
  66. - it's easier to select English language in CE options
  67. - removed summer time, because server will always use UTC
  68. - removed unused features (note preview, repair time autofill, object labels)
  69.  
  70. version 1.5.1
  71. - added https support
  72.  
  73. version 1.5.0
  74. - added import/export of private settings to text in CE options
  75.  
  76. version 1.4.1
  77. - events grouping a bit faster
  78. - change in Portuguese translation
  79.  
  80. version 1.4.0
  81. - fixed "select language" box on the player page
  82.  
  83. version 1.3.01
  84. - fix for turn time left
  85.  
  86. version 1.3.0
  87. - works with new cantr appearance
  88. - "talk to" popup works again
  89.  
  90. version 1.05.0
  91. - fixed notes checker, because I need it
  92.  
  93. version 1.00.5
  94. - fixed buildings and vehicles bookmarks
  95.  
  96. version 1.00.0
  97. - object and inventory pages things adjusted to new inventory and objects page
  98.  
  99. version 0.99.7
  100. - fixed "last 4 digits of char id" function, now character related data is saved properly
  101.  
  102. version 0.99.5
  103. - repair time autofill revived
  104.  
  105. version 0.99.0
  106. - script is revived
  107.  
  108. version 0.98.0
  109. - script is dead, managed to revive events page options
  110.  
  111. version 0.97.0
  112. - some events-related things works, events filtering will be provided by the game. Autorefreshed events are not coloured etc.
  113.  
  114.  
  115. version 0.92.0
  116. - notes checker bugfix
  117.  
  118. version 0.90.0
  119. - options are on the main page, not in shop (which will be deleted soon)
  120.  
  121. version 0.79.0+1
  122. - take and drop all ultimate (+0.0.1 max amount to take bugfix)
  123.  
  124. version 0.76.0
  125. - names colors (+0.01 bugfix) (+0.02 names shortening + lesser opacity of names)
  126.  
  127. version 0.75.0
  128. - popup talk button on the events page (language independent)
  129. - new (autorefreshed) events are filtered by the script
  130.  
  131. version 0.70.32
  132. - roll die PL and tiny bugfix (destructive objects pulling)
  133. - bum bum, calculator bugfix (after some changes suggested by ProgD)
  134. - moar pretty [max] buttons when taking/giving resources
  135.  
  136. version 0.70.1
  137. - grouping events misc bugfix
  138.  
  139. version 0.70.0
  140. - grouping events SHOULD work for English (but I can't guarantee that)
  141. - summer time option in the Shop (disable it to have proper ticks information if something's wrong)
  142.  
  143. version 0.69.1
  144. - grouping events bugfix
  145.  
  146. version 0.69.0
  147. - grouping events (works only for PL for now, very professional translation needed) i.e. (x drops y.", "x drops z." => "x drops y, z."
  148.  
  149. version 0.66.1
  150. - more quotations for Events Filter in English
  151.  
  152. version 0.66.0
  153. - language selection when you use that script first time
  154. - improved RegExp (most of them should work also on Opera)
  155.  
  156. version 0.60.0
  157. - objects list on the OBJECTS page
  158. - grouping objects (machines) on the OBJECTS page
  159.  
  160. version 0.59.0
  161. - (almost) works for German version
  162. - English version should work fine (except of events filter)
  163.  
  164. version 0.55.0
  165. - nothing (I just need better version number)
  166.  
  167. version 0.52.3
  168. - dynamic calculator is more dynamic now
  169.  
  170. version 0.52.1
  171. - display bugfix (description in options panel)
  172.  
  173. version 0.52.0
  174. - labels are now only for containers
  175.  
  176. version 0.51.4
  177. - some bugfixes
  178. - characters count when editing notes (unfortunately doesn't count regional characters as 2)
  179.  
  180. version 0.51.3
  181. - more minor bugfixes
  182.  
  183. version 0.51.2
  184. - some minor bugfixes
  185.  
  186. version 0.51.1
  187. - notes autochecking (all, none, duplicates, opposite)
  188. - name highlight in event filter bugfix (now script is searching for only first word of name)
  189.  
  190. version 0.50.1
  191. - clock bugfix (visible on every page)
  192.  
  193. version 0.50.0
  194. - clock improvement (instead of "remains 108:8 ..." there is "remains 1:48:08...")
  195. - replacement of "exits" panel on the "location" page
  196. - English translation (but not everything works fine - I don't have any English character to check some quotations)
  197. version 0.49.0
  198. - dynamic clock with turn alert (but needs extra connection with Cantr Server, so it is visible that you are using it) - needs improve
  199. - bookmark favourites buildings and vehicles
  200.  
  201. version 0.48.1
  202. - critical bugfix - syntax error
  203.  
  204. version 0.48.0
  205. - dynamic clock (turn alert will be added soon)
  206. - some improvements
  207. - nice "enhanced" title next to "Cantr II" on the top
  208.  
  209. version 0.46.0
  210. - language selection in option "shop" page (but still works only pl - en needs translation)
  211.  
  212. version 0.45.0
  213. - possibility of adding new languages (though currently there is no option of changing language)
  214.  
  215. version 0.42.0
  216. - max button on "give resources" page
  217.  
  218. version 0.41.0 and 0.41.1 and 0.41.2
  219. - events filtering enhancement (more and more)
  220.  
  221. version 0.40.0
  222. - events filtering (wow!) (only PL, need fixes)
  223. - grouping bugfix (now titleBars are being shown only when there is at least 1 vehicle or ship)
  224.  
  225. version 0.36.1
  226. - when you set empty ("") string as a label of an object, the label is entirely removed
  227.  
  228. version 0.36.0
  229. - land vehicles and ships grouping on "Buildings and Vehicles" page (oonly PL)
  230.  
  231. version 0.35.0
  232. - dynamic amount of resources for projects needed (only PL)
  233.  
  234. version 0.3
  235. - options on "shop" page - you can enable or disable some functions (only PL)
  236. - labels on "put into container" page (only PL)
  237.  
  238. version 0.29
  239. - note preview on "edit note" page (only PL)
  240.  
  241. version 0.20 and older
  242. - labels for objects (PL and EN)
  243. - 'taking as much as you can' button om "pick up resources" page (only PL)
  244.  
  245. */
  246.  
  247. // stałe
  248. var MAXCAP = 15000; // udźwig maksymalny w gramach
  249. var NOTE_MAXLENGTH = 65535;
  250. var GROUPEVENTS_MAX_MIN_DIFF = 2; // amount of minutes between first and last grouped event possible
  251.  
  252. var ln = getLanguage(); // language - will be en as default but not yet
  253. var lang = [];
  254. /*#############################
  255. LANGUAGES
  256. #############################*/
  257.  
  258. var activeText = [];
  259. var pageObjects = [];
  260. var pageInventory = [];
  261. var pageBuildingsAndVehicles = [];
  262. var pageBuildingsAndVehiclesInside = [];
  263. var pageEvents = [];
  264. var pageTakingInfo = [];
  265. var pageWriteNote = [];
  266. var pageShop = [];
  267. var pageStorageResources = [];
  268. var pageSelAmountToProject = [];
  269. var pageGiveResources = [];
  270. var pageRepair = [];
  271. var pageLocation = [];
  272. var pageEmptyEnvelope = [];
  273. var pageMainPage = [];
  274. var pageRetrieveFromContainer = [];
  275. /*
  276. POLISH
  277. */
  278. lang['pl'] = [];
  279. // labels
  280. lang['pl']['setLabel'] = "[set]";
  281. lang['pl']['setPromptInfo'] = 'Podaj identyfikator dla tego obiektu';
  282. // max button - pick up resources
  283. lang['pl']['maxButton'] = 'max';
  284. // note preview
  285. lang['pl']['previewButton'] = '<b>[podgląd]</b>';
  286. lang['pl']['previewCharLeft'] = 'Pozostało znaków:';
  287. lang['pl']['previewExceedsLimit'] = 'UWAGA! LICZBA ZNAKÓW W NOTATCE PRZEKROCZONA!!!';
  288. // project size
  289. lang['pl']['timeInDays'] = 'Dokładny czas w dniach (w nawiasie realny): ';
  290. // ships and land vehicles grouping
  291. lang['pl']['groupingCheckBoxDesc'] = ' grupowanie pojazdów lądowych i morskich';
  292. lang['pl']['landVehicles'] = 'Pojazdy lądowe:';
  293. lang['pl']['ships'] = 'Statki:';
  294. // events filter
  295. lang['pl']['filters'] = '<b>Filtry:</b>';
  296. lang['pl']['sayFilter'] = 'rozmowy';
  297. lang['pl']['wichtigFilter'] = 'ważne';
  298. lang['pl']['whisperFilter'] = 'antyVlo'; // enabling and disabling whispers
  299. lang['pl']['radioFilter'] = 'radio';
  300. lang['pl']['travelFilter'] = 'podróż';
  301. lang['pl']['resourcesFilter'] = 'surowce';
  302. lang['pl']['tap_danceFilter'] = 'tuptanie'; // moving inside buildings, vehicles etc.
  303. lang['pl']['miscFilter'] = 'inne'; // everything else: hunting, eating...
  304. // ajax whisper
  305. lang['pl']['ajaxEventsToEveryone'] = 'Do wszystkich';
  306. lang['pl']['ajaxEventsWhisperButton'] = 'Szepcz';
  307. lang['pl']['ajaxEventsYouTalkingTo'] = 'Wybierz do kogo mówić:';
  308. // rename character on events page
  309. lang['pl']['eventsRenameChar'] = 'Podaj nowe imię dla postaci';
  310. // clock
  311. lang['pl']['clockTimeLeft'] = 'pozostało';
  312. lang['pl']['clockUntil'] = 'do';
  313. lang['pl']['clockTicksailing'] = 'przeliczenia podróży morskich';
  314. lang['pl']['clockTicktravel'] = 'przeliczenia podróży lądowych';
  315. lang['pl']['clockTickproject'] = 'przeliczenia projektów';
  316. // bookmark
  317. lang['pl']['bmVehTitle'] = 'WYRÓŻNIONE POJAZDY';
  318. lang['pl']['bmBuildTitle'] = 'WYRÓŻNIONE BUDYNKI';
  319. lang['pl']['bottomPanelCharacterMenu'] = 'MENU POSTACI';
  320. // "location" page's panels replacement
  321. lang['pl']['replaceLocationExits'] = 'WYJŚCIA';
  322. lang['pl']['replaceCheckBoxDesc'] = 'zamiana paneli';
  323. // notes checker
  324. lang['pl']['notesChbTitle'] = 'Autozaznaczanie notatek';
  325. lang['pl']['notesChbAll'] = 'wszystkie';
  326. lang['pl']['notesChbNo'] = 'żadne';
  327. lang['pl']['notesChbDupl'] = 'duplikaty';
  328. lang['pl']['notesChbOpp'] = 'odwrotność';
  329. // list objects
  330. lang['pl']['listObjectsTitle'] = 'LISTA';
  331. lang['pl']['listObjectsNotesCB'] = 'notatki';
  332. lang['pl']['listObjectsResourcesCB'] = 'surowce';
  333. lang['pl']['listObjectsOthersCB'] = 'inne';
  334. // group objects
  335. lang['pl']['groupObjectsUsedFirst'] = '<i>(używane ';
  336. lang['pl']['groupObjectsUsedOf'] = ' z ';
  337. lang['pl']['groupObjectsUsedEnd'] = ')</i>';
  338. // language selection
  339. lang['pl']['langSelectionTextBefore'] = 'Wybierz język. Wystarczy wybrać go z listy i odświeżyć stronę, a zostanie on zapisany na stałe.';
  340. lang['pl']['langSelectionTextAfter'] = 'Jeśli zechcesz zmienić później język skryptu lub wyłączyć niektóre moduły skryptu to znajdziesz tę możliwość na stronie "SKLEP"';
  341. // other
  342. lang['pl']['shipNames'] = ['łódka', 'darter', 'dłubanka', 'prom', 'trzcinowa łódź', 'łódź wiosłowa', 'galeon', 'szabrownik', 'slup', 'tratwa', 'długa łódź', 'szkuner', 'kajak', 'soarer']; // MUST BE LOWERCASE
  343. lang['pl']['itemNote'] = 'notatka';
  344. lang['pl']['itemEnvelope'] = 'Koperta';
  345. lang['pl']['grams'] = 'gram';
  346. lang['pl']['pieces'] = ' sztuk ';
  347. lang['pl']['optionsButton'] = 'opcje Cantr Enhanced';
  348. lang['pl']['groupObjectsInUse'] = ' <i>(w użyciu)</i>';
  349.  
  350. // since 2.1
  351. lang['pl']['vehCategoryLandVehicles'] = 'POJAZDY LĄDOWE';
  352. lang['pl']['vehCategoryShips'] = 'STATKI';
  353. lang['pl']['vehCategoryConstructions'] = 'KONSTRUKCJE';
  354. lang['pl']['categoryBuildingsOutside'] = 'BUDYNKI';
  355. lang['pl']['categoryBuildingsInside'] = 'POMIESZCZENIA';
  356. // events grouping - be careful, it's quite hard to translate
  357. lang['pl']['groupEventsSbUse'] = />(?:.*)>(.*) używa(?: trochę)* (.*)( na )(.*)/;
  358. lang['pl']['groupEventsSbHunt'] = />(?:.*)>(.*) zwierzę znane jako (.*)(, używając )(.*)/;
  359. lang['pl']['groupEventsSbPoke'] = />(?:.*)>(.*) szturcha (.*)\./;
  360. lang['pl']['groupEventsSbTake'] = />(?:.*)>(.*) bierze (?:trochę )*(.*)\./;
  361. lang['pl']['groupEventsSbDrop'] = />(?:.*)>(.*)(?: upuszcza | odkłada )(?:trochę )*(.*)\./;
  362. lang['pl']['groupEventsSbGive'] = />(?:.*)>(.* podaje do .*)> (?:trochę |coś wyglądającego jak )*(.*)\./;
  363. lang['pl']['groupEventsSbDragRes'] = /(Widzisz,* że ktoś przeciągnął )(?:trochę )*(.*)()( z centralnego obszaru .* do .*| z <.* do .*| do .* z .*)/;
  364. lang['pl']['groupEventsSbThrowDie'] = /(Widzisz, że .* rzuca czymś wyglądającym jak .*\.)( Wypada )(.*)\./;
  365. lang['pl']['groupPreEventsYouSay'] = 'Mówisz';
  366. lang['pl']['groupPreEventsSbSay'] = ' mówi:';
  367. lang['pl']['groupPreEventsSbWhisper'] = ' mówi do ';
  368. lang['pl']['groupPreEventsSbUse'] = ' używa ';
  369. lang['pl']['groupPreEventsSbHunt'] = 'zwierzę znane jako';
  370. lang['pl']['groupPreEventsSbPoke'] = ' szturcha ';
  371. lang['pl']['groupPreEventsSbTake'] = ' bierze ';
  372. lang['pl']['groupPreEventsSbDrop'] = '';
  373. lang['pl']['groupPreEventsSbGive'] = ' podaje do ';
  374. lang['pl']['groupPreEventsSbDragRes'] = ' że ktoś przeciągnął ';
  375. lang['pl']['groupPreEventsSbThrowDie'] = ' rzuca czymś wyglądającym jak ';
  376. // options on "shop" page (enabling and disabling options, language change etc.)
  377. lang['pl']['optionsTitle'] = "<i>Cantr Enhanced v. " + VER + " - PANEL KONFIGURACYJNY </i> <br><br>";
  378. lang['pl']['optionsLabel'] = "etykiety dla obiektów w zakładkach OBIEKTY oraz INWENTARZ";
  379. lang['pl']['optionsNotePre'] = "podgląd edytowanej notatki";
  380. lang['pl']['optionsAllButt'] = "przycisk podnoszenia i podawania\"ile się da\"";
  381. lang['pl']['optionsIntoContainer'] = "etykiety dla pojemników na stronie WŁÓŻ SUROWIEC DO POJEMNIKA";
  382. lang['pl']['optionsProjectSize'] = "dane co do ilości potrzebnych surowców generowane (mądre słowo) w czasie rzeczywistym (jeszcze mądrzejsze)";
  383. lang['pl']['optionsGroupBuildingVehicles'] = "grupowanie pojazdów lądowych i morskich na stronie BUDYNKI I POJAZDY";
  384. lang['pl']['optionsEventsFilter'] = "filtrowanie zdarzeń";
  385. lang['pl']['optionsGroupEvents'] = "grupowanie zdarzeń (wymaga włączonego filtrowania)";
  386. lang['pl']['optionsColorNames'] = "kolorowanie imion (wymaga włączonego wyskakującego okienka rozmawiaj (tm))";
  387. lang['pl']['optionsShortNames'] = "skracanie nieznanych imion (np. dwudziestoletni mężczyzna -> dwudziestolatek)";
  388. lang['pl']['optionsClock'] = 'ruchomy zegarek i powiadamianie o turach';
  389. lang['pl']['optionsSummerTime'] = 'czas letni (dostosuj do cantryjskiej rzeczywistości)';
  390. lang['pl']['optionsPopupButtons'] = 'Wyskakujące okienko rozmawiaj<s>/przeciągaj/atakuj</s> na stronie zdarzeń (wymaga włączonego filtrowania)';
  391. lang['pl']['optionsClickInsteadOfHover'] = 'Klikanie na imię postaci zamiast najechania na nie (uniemożliwia korzystanie z linka w imieniu)';
  392. lang['pl']['optionsAjaxWhisper'] = 'Szeptanie na stronie zdarzeń jak "Mów do wszystkich" (AJAX). Wyskakujące okienko "Rozmawiaj" musi być włączone';
  393. lang['pl']['optionsBookmarkBuildingsVehicles'] = 'wyróżnione budynki i pojazdy';
  394. lang['pl']['optionsLocationPanelsReplacement'] = 'zamiana kolejności paneli w stronie Miejsce';
  395. lang['pl']['optionsNotesCheckBox'] = 'autozaznaczanie notatek na stronach OPERACJE NA WIELU NOTATKACH i OPRÓŻNIJ KOPERTĘ';
  396. lang['pl']['optionsListObjects'] = 'wysuwalne menu na dole strony OBIEKTY, wyświetlające listę obiektów do skopiowania';
  397. lang['pl']['optionsGroupObjects'] = 'grupowanie maszyn tego samego typu w zakładce OBIEKTY';
  398. lang['pl']['optionsTakeAllUltimate'] = 'przycisk podnoszenia wszystkiego na stronie obiektów';
  399. lang['pl']['optionsLineEventsNotFocused'] = 'linia pokazująca zdarzenia wyświetlone gdy przeglądarka była nieaktywna';
  400. lang['pl']['optionsCharMenuToolbar'] = 'Przyciski menu postaci (buduj itp) po prawej stronie głównych okien';
  401. // QUOTATIONS
  402. /*
  403. !!!CAUTION!!! Remember that you shouldn't translate this text, but check how it is named in your language - no mistakes allowed or script will not load
  404. */
  405. // most important quotation
  406. activeText['pl'] = 'graczy było aktywnych w ciągu ostatnich 15 minut.';
  407. pageObjects.push('OBIEKTY'); // opened objects panel titlebar
  408. pageInventory.push('INWENTARZ'); // opened inventory panel titlebar
  409. pageBuildingsAndVehicles.push(lang['pl']['vehCategoryLandVehicles']);// opened vehicles panel titlebar
  410. pageBuildingsAndVehicles.push(lang['pl']['vehCategoryShips']);
  411. pageBuildingsAndVehicles.push(lang['pl']['vehCategoryConstructions']);
  412. pageBuildingsAndVehicles.push(lang['pl']['categoryBuildingsOutside']);
  413. pageBuildingsAndVehiclesInside.push(lang['pl']['categoryBuildingsInside']);
  414. pageEvents.push('ZDARZENIA'); // opened events panel titlebar
  415. pageTakingInfo.push('INFORMACJA O ZABIERANIU'); // page where you type how much resources do you want to pick up
  416. pageWriteNote.push('NAPISZ NOTATKĘ'); // write note page
  417. pageShop.push('EKSTRA CZAS ZA KREDYTKI'); // shop page (credits etc)
  418. pageStorageResources.push('PRZECHOWYWANIE SUROWCÓW'); // how much resources do you want to put into container
  419. pageSelAmountToProject.push('WYBIERZ ILOŚĆ DO TEGO PROJEKTU'); // when you create project and you type how much do you want to get (in projects like refining iron ore)
  420. pageGiveResources.push('INFORMACJA O DAWANIU'); // how much resources do you want to give to sb
  421. pageRepair.push('Naprawa - '); /* de on pageGiveResources - because there are two pages with similar name */
  422. pageLocation.push(': OPIS'); // how to recognise LOCATION page? :D
  423. pageEmptyEnvelope.push('OPRÓŻNIANIE KOPERTY');
  424. pageMainPage.push('PROFIL GRACZA');
  425. pageRetrieveFromContainer.push('POZYSKAJ ZE SKŁADU');
  426. /*
  427. ENGLISH
  428. */
  429. lang['en'] = [];
  430. // labels
  431. lang['en']['setLabel'] = "[set]";
  432. lang['en']['setPromptInfo'] = 'Insert identifier of this object';
  433. // max button - pick up resources
  434. lang['en']['maxButton'] = 'max';
  435. // note preview
  436. lang['en']['previewButton'] = '<b>[preview]</b>';
  437. lang['en']['previewCharLeft'] = 'Characters left:';
  438. lang['en']['previewExceedsLimit'] = 'WARNING! NOTE CAPACITY REACHED!!!';
  439. // project size
  440. lang['en']['timeInDays'] = 'Strict time in days (real in brackets): ';
  441. // ships and land vehicles grouping
  442. lang['en']['groupingCheckBoxDesc'] = ' grouping of land vehicles and ships';
  443. lang['en']['landVehicles'] = 'Land vehicles:';
  444. lang['en']['ships'] = 'Ships:';
  445. // events filter
  446. lang['en']['filters'] = '<b>Filters:</b>';
  447. lang['en']['sayFilter'] = 'talking';
  448. lang['en']['wichtigFilter'] = 'important';
  449. lang['en']['whisperFilter'] = 'whispers'; // enabling and disabling whispers
  450. lang['en']['radioFilter'] = 'radio';
  451. lang['en']['travelFilter'] = 'movement';
  452. lang['en']['resourcesFilter'] = 'resources';
  453. lang['en']['tap_danceFilter'] = 'in/out'; // moving inside buildings, vehicles etc.
  454. lang['en']['miscFilter'] = 'misc'; // everything else: hunting, eating...
  455. // ajax whisper
  456. lang['en']['ajaxEventsToEveryone'] = 'To everyone';
  457. lang['en']['ajaxEventsWhisperButton'] = 'Whisper';
  458. lang['en']['ajaxEventsYouTalkingTo'] = 'Who are you talking to:';
  459. // rename character on events page
  460. lang['en']['eventsRenameChar'] = 'Enter new name for a character';
  461. // clock
  462. lang['en']['clockTimeLeft'] = '';
  463. lang['en']['clockUntil'] = 'until';
  464. lang['en']['clockTicksailing'] = 'sailing tick';
  465. lang['en']['clockTicktravel'] = 'travelling tick';
  466. lang['en']['clockTickproject'] = 'projects tick';
  467. // bookmark
  468. lang['en']['bmVehTitle'] = 'BOOKMARKED VEHICLES';
  469. lang['en']['bmBuildTitle'] = 'BOOKMARKED BUILDINGS';
  470. lang['en']['bottomPanelCharacterMenu'] = 'CHARACTER MENU'; // bottom menu with buttons like create note, manufacture etc - must be exactly like panel in the game
  471. // "location" page's panels replacement
  472. lang['en']['replaceLocationExits'] = 'EXITS';
  473. lang['en']['replaceCheckBoxDesc'] = 'panels replacement';
  474. // notes checker
  475. lang['en']['notesChbTitle'] = 'Autochecker:';
  476. lang['en']['notesChbAll'] = 'all';
  477. lang['en']['notesChbNo'] = 'no';
  478. lang['en']['notesChbDupl'] = 'duplicates';
  479. lang['en']['notesChbOpp'] = 'opposite';
  480. // list objects
  481. lang['en']['listObjectsTitle'] = 'LIST';
  482. lang['en']['listObjectsNotesCB'] = 'notes';
  483. lang['en']['listObjectsResourcesCB'] = 'resources';
  484. lang['en']['listObjectsOthersCB'] = 'others';
  485. // group objects
  486. lang['en']['groupObjectsUsedFirst'] = '<i>(';
  487. lang['en']['groupObjectsUsedOf'] = ' out of ';
  488. lang['en']['groupObjectsUsedEnd'] = ' in use)</i>';
  489. // language selection
  490. lang['en']['langSelectionTextBefore'] = 'Select language. It is enough to select it from the list, refresh page and it will be saved.';
  491. lang['en']['langSelectionTextAfter'] = 'If you would like to change language in the future or disable some modules you can click on the text [Cantr Enhanced options] below.';
  492. // other
  493. lang['en']['itemNote'] = 'Note';
  494. lang['en']['itemEnvelope'] = 'Envelope';
  495. lang['en']['grams'] = 'grams';
  496. lang['en']['pieces'] = ' pieces of ';
  497. lang['en']['optionsButton'] = 'Cantr Enhanced options';
  498. lang['en']['groupObjectsInUse'] = ' <i>(in use)</i>';
  499.  
  500. // since 2.1
  501. lang['en']['vehCategoryLandVehicles'] = 'LAND VEHICLES';
  502. lang['en']['vehCategoryShips'] = 'SHIPS';
  503. lang['en']['vehCategoryConstructions'] = 'CONSTRUCTIONS';
  504. lang['en']['categoryBuildingsOutside'] = 'BUILDINGS';
  505. lang['en']['categoryBuildingsInside'] = 'OTHER ROOMS';
  506. lang['en']['shipNames'] = ['raft', 'kayak', 'dugout canoe', 'reed boat', 'dinghy', 'rowing boat', 'sloop', 'darter', 'longboat', 'soarer', 'ferry', 'raker', 'skimmer', 'galleon']; // MUST BE LOWERCASE
  507.  
  508. // events grouping - be careful, it's quite hard to translate
  509. lang['en']['groupEventsSbUse'] = />(?:.*)>(.*) use(?: some)* (.*)( on )(.*)/;
  510. lang['en']['groupEventsSbHunt'] = />(?:.*)>(.*) hurt (.*)( using )(.*)/;
  511. lang['en']['groupEventsSbPoke'] = />(?:.*)>(.*) poke (.*)\./;
  512. lang['en']['groupEventsSbTake'] = />(?:.*)>(.*) take (?:some )*(.*)\./;
  513. lang['en']['groupEventsSbDrop'] = />(?:.*)>(.*) drop (?:some )*(.*)\./;
  514. lang['en']['groupEventsSbGive'] = />(?:.*)>(.*) give (?:some )*(.*)( to )(.*)\./;
  515. lang['en']['groupEventsSbDragRes'] = /(You see )(?:some )*(.*)()( being pulled from .* to .*| being pulled to .*, coming from .*)/;
  516. lang['en']['groupEventsSbThrowDie'] = /doesn work/;
  517. lang['en']['groupPreEventsYouSay'] = 'You say';
  518. lang['en']['groupPreEventsSbSay'] = ' says:';
  519. lang['en']['groupPreEventsSbWhisper'] = ' talking to ';
  520. lang['en']['groupPreEventsSbUse'] = ' use ';
  521. lang['en']['groupPreEventsSbHunt'] = ' hurt ';
  522. lang['en']['groupPreEventsSbPoke'] = ' poke ';
  523. lang['en']['groupPreEventsSbTake'] = ' take ';
  524. lang['en']['groupPreEventsSbDrop'] = ' drop ';
  525. lang['en']['groupPreEventsSbGive'] = ' give ';
  526. lang['en']['groupPreEventsSbDragRes'] = ' being pulled from ';
  527. lang['en']['groupPreEventsSbThrowDie'] = ' roll a ';
  528.  
  529. // options on "shop" page (enabling and disabling options, language change etc.)
  530. lang['en']['optionsTitle'] = "<i>Cantr Enhanced v. " + VER + " - Config panel </i> <br><br>";
  531. lang['en']['optionsLabel'] = "labels for objects on OBJECTS, INVENTORY pages";
  532. lang['en']['optionsNotePre'] = "preview of edited note";
  533. lang['en']['optionsAllButt'] = "\'take as much as you can\' button when picking up and giving resources";
  534. lang['en']['optionsIntoContainer'] = "labels on \'put resource into\' page";
  535. lang['en']['optionsProjectSize'] = "resources needed for a project calculator";
  536. lang['en']['optionsGroupBuildingVehicles'] = "grouping of land vehicles and ships on OBJECTS AND VEHICLES page";
  537. lang['en']['optionsEventsFilter'] = "events filtering (not 100% working)";
  538. lang['en']['optionsGroupEvents'] = "grouping events (events filtering must be enabled)";
  539. lang['en']['optionsColorNames'] = "name colors (popup talk window must be enabled)";
  540. lang['en']['optionsShortNames'] = "shortening names (i.e. a man in his twenties -> 20 year-old-man)";
  541. lang['en']['optionsClock'] = 'dynamic clock and turns notifier';
  542. lang['en']['optionsSummerTime'] = 'summer time';
  543. lang['en']['optionsPopupButtons'] = 'Popup talk window on the events page (events filtering must be enabled)';
  544. lang['en']['optionsClickInsteadOfHover'] = 'Click on character name instead of hovering (makes entering name link impossible)';
  545. lang['en']['optionsAjaxWhisper'] = 'Whisper form on events page like "talk to all" (AJAX). popup buttons must be enabled';
  546. lang['en']['optionsBookmarkBuildingsVehicles'] = 'bookmark buildings and vehicles';
  547. lang['en']['optionsLocationPanelsReplacement'] = 'replacement of panels on LOCATION page';
  548. lang['en']['optionsNotesCheckBox'] = 'autochecking notes on the "empty envelope" and "many notes operations"';
  549. lang['en']['optionsListObjects'] = 'menu on OBJECTS page which shows list of objects easy to copy/paste';
  550. lang['en']['optionsGroupObjects'] = 'grouping of machines of the same type on OBJECTS page';
  551. lang['en']['optionsTakeAllUltimate'] = 'take all button on the OBJECTS page';
  552. lang['en']['optionsLineEventsNotFocused'] = 'Line which shows events which took place when browser was not focued';
  553. lang['en']['optionsCharMenuToolbar'] = 'Charmenu buttons on right side of the screen on main game pages';
  554. // QUOTATIONS
  555. /*
  556. !!!CAUTION!!! Remember that you shouldn't write translated text, but check how it is named in your language - no mistakes allowed or script will not load
  557. */
  558.  
  559. // most important quotation
  560. activeText['en'] = ' users were active in the last 15 minutes.';
  561. pageObjects.push('OBJECTS'); // opened objects panel titlebar
  562. pageInventory.push('INVENTORY'); // opened inventory panel titlebar
  563. pageBuildingsAndVehicles.push(lang['en']['vehCategoryLandVehicles']);// opened vehicles panel titlebar
  564. pageBuildingsAndVehicles.push(lang['en']['vehCategoryShips']);
  565. pageBuildingsAndVehicles.push(lang['en']['vehCategoryConstructions']);
  566. pageBuildingsAndVehicles.push(lang['en']['categoryBuildingsOutside']);
  567. pageBuildingsAndVehiclesInside.push(lang['en']['categoryBuildingsInside']);
  568. pageEvents.push('EVENTS'); // opened events panel titlebar
  569. pageTakingInfo.push('TAKE INFO'); // page where you type how much resources do you want to pick up
  570. pageWriteNote.push('WRITE A NOTE'); // write note page
  571. pageShop.push('SHOPPING WITH CREDITS'); // shop page (credits etc)
  572. pageStorageResources.push('STORE RAW MATERIAL'); // how much resources do you want to put into container
  573. pageSelAmountToProject.push('SELECT AMOUNT FOR THIS PROJECT'); // when you create project and you type how much do you want to get (in projects like refining iron ore)
  574. pageGiveResources.push('<B>GIVE INFO</B>'); // how much resources do you want to give to sb
  575. pageRepair.push('Repairing'); /* de on pageGiveResources - because there are two pages with similar name */
  576. pageLocation.push(': DESCRIPTION'); // how to recognise LOCATION page? :D
  577. pageEmptyEnvelope.push('EMPTY ENVELOPE'); // when taking notes out of envelope - titlebar
  578. pageMainPage.push('PLAYER INFO');
  579. /*
  580. DEUTSCH
  581. */
  582.  
  583. // QUOTATIONS
  584. /*
  585. !!!CAUTION!!! Remember that you shouldn't write translated text, but check how it is named in your language - no mistakes allowed or script will not load
  586. */
  587. lang['de'] = [];
  588. // other
  589. lang['de']['itemNote'] = 'Zettel';
  590. lang['de']['itemEnvelope'] = 'Briefumschlag';
  591. lang['de']['grams'] = 'Gramm';
  592. lang['de']['pieces'] = 'Stück';
  593. lang['de']['shipNames'] = ['floß', 'fellboot', 'einbaumkanu', 'schilfboot', 'jolle', 'ruderboot', 'slup', 'darter', 'langboot', 'soarer', 'fähre', 'raker', 'skimmer', 'galleone']; // MUST BE LOWERCASE
  594. lang['de']['groupObjectsInUse'] = ' <i>(wird benutzt)</i>';
  595.  
  596. // since 2.1
  597. lang['de']['vehCategoryLandVehicles'] = 'LAND VEHICLES';
  598. lang['de']['vehCategoryShips'] = 'SHIPS';
  599. lang['de']['vehCategoryConstructions'] = 'CONSTRUCTIONS';
  600. lang['de']['categoryBuildingsOutside'] = 'BUILDINGS';
  601. lang['de']['categoryBuildingsInside'] = 'ANDERE RÄUME';
  602. // events grouping - be careful, it's quite hard to translate
  603. lang['de']['groupEventsSbUse'] = />(?:.*)>(.*) (?:ein\/einen|etwas) (.*)( für )(?:das Projekt )*(.*) (?:benutzen|verwenden)\./;
  604. lang['de']['groupEventsSbHunt'] = />(?:.*)>(.*) (?:ein|eine|einen) (.*)( mit )(.*) verwunden\./;
  605. lang['de']['groupEventsSbPoke'] = />(?:.*)>(.*) ein\/einen (.*) stoßen\./;
  606. lang['de']['groupEventsSbTake'] = />(?:.*)>(.*) (?:etwas )?(.*) nehmen\./;
  607. lang['de']['groupEventsSbDrop'] = />(?:.*)>(.*) etwas (.*) fallen lässt\./;
  608. lang['de']['groupEventsSbGive'] = />doesnt workI@UDAWSd/;
  609. lang['de']['groupEventsSbDragRes'] = /(Du siehst wie )(?:etwas )*(.*)()( aus .* ins .* geschleppt wird\.)/;
  610. lang['de']['groupEventsSbThrowDie'] = /doesnt!#@$ work/;
  611. lang['de']['groupPreEventsYouSay'] = 'Du sagst:';
  612. lang['de']['groupPreEventsSbSay'] = ' sagt:';
  613. lang['de']['groupPreEventsSbWhisper'] = ' reden.';
  614. lang['de']['groupPreEventsSbUse'] = ' ';
  615. lang['de']['groupPreEventsSbHunt'] = ' verwunden.';
  616. lang['de']['groupPreEventsSbPoke'] = ' stoßen.';
  617. lang['de']['groupPreEventsSbTake'] = ' nehmen.';
  618. lang['de']['groupPreEventsSbDrop'] = ' fallen l';
  619. lang['de']['groupPreEventsSbGive'] = ' doesnt work1234';
  620. lang['de']['groupPreEventsSbDragRes'] = ' geschleppt wird.';
  621. lang['de']['groupPreEventsSbThrowDie'] = ' doesnt work1234s';
  622. // most important quotation
  623. activeText['de'] = 'Spieler waren in den letzten 15 Minuten aktiv.';
  624. pageObjects.push('OBJEKTE'); // opened objects panel titlebar
  625. pageInventory.push('INVENTAR'); // opened inventory panel titlebar
  626. pageBuildingsAndVehicles.push(lang['de']['vehCategoryLandVehicles']);// opened vehicles panel titlebar
  627. pageBuildingsAndVehicles.push(lang['de']['vehCategoryShips']);
  628. pageBuildingsAndVehicles.push(lang['de']['vehCategoryConstructions']);
  629. pageBuildingsAndVehicles.push(lang['de']['categoryBuildingsOutside']);
  630. pageBuildingsAndVehiclesInside.push(lang['de']['categoryBuildingsInside']);
  631. pageEvents.push('EREIGNISSE'); // opened events panel titlebar
  632. pageTakingInfo.push('INFO NEHMEN'); // page where you type how much resources do you want to pick up
  633. pageWriteNote.push('EINE NOTIZ SCHREIBEN'); // write note page
  634. pageShop.push('EINKAUFEN MIT CREDITS'); // shop page (credits etc)
  635. pageStorageResources.push('ROHMATERIAL LAGERN'); // how much resources do you want to put into container
  636. pageSelAmountToProject.push('WÄHLE MENGE FÜR DIESES PROJEKT'); // when you create project and you type how much do you want to get (in projects like refining iron ore)
  637. pageGiveResources.push('INFO GEBEN</B>'); // how much resources do you want to give to sb
  638. pageRepair.push('repariert '); /* de on pageGiveResources - because there are two pages with similar name */
  639. pageLocation.push(': BESCHREIBUNG'); // how to recognise LOCATION page? :D
  640. pageEmptyEnvelope.push('LEERER BRIEFUMSCHLAG');
  641. /*
  642. Português
  643. */
  644. lang['pt'] = [];
  645. // other
  646. lang['pt']['itemNote'] = 'nota';
  647. lang['pt']['itemEnvelope'] = 'envelope';
  648. lang['pt']['grams'] = 'gramas';
  649. lang['pt']['pieces'] = 'doesnt exist leixi9I(@!UI(JF';
  650. lang['pt']['shipNames'] = ['jangada', 'caiaque', 'canoa de tora', 'barco de junco', 'bote', 'barco a remos', 'eslópe', 'patacho', 'bote longo', 'catamarão', 'balsa', 'brigue', 'escuna', 'galeão']; // MUST BE LOWERCASE
  651. lang['pt']['groupObjectsInUse'] = ' <i>(em uso)</i>';
  652. // since 2.1
  653. lang['pt']['vehCategoryLandVehicles'] = 'LAND VEHICLES';
  654. lang['pt']['vehCategoryShips'] = 'SHIPS';
  655. lang['pt']['vehCategoryConstructions'] = 'CONSTRUCTIONS';
  656. lang['pt']['categoryBuildingsOutside'] = 'CONSTRUÇÕES';
  657. lang['pt']['categoryBuildingsInside'] = 'OTHER ROOMS';
  658. // QUOTATIONS
  659. /*
  660. !!!CAUTION!!! Remember that you shouldn't write translated text, but check how it is named in your language - no mistakes allowed or script will not load
  661. */
  662. activeText['pt'] = 'usuários estiveram ativos durante os últimos 15 minutos.';
  663. pageObjects.push('OBJETOS'); // opened objects panel titlebar
  664. pageInventory.push('INVENTÁRIO'); // opened inventory panel titlebar
  665. pageBuildingsAndVehicles.push(lang['pt']['vehCategoryLandVehicles']);// opened vehicles panel titlebar
  666. pageBuildingsAndVehicles.push(lang['pt']['vehCategoryShips']);
  667. pageBuildingsAndVehicles.push(lang['pt']['vehCategoryConstructions']);
  668. pageBuildingsAndVehicles.push(lang['pt']['categoryBuildingsOutside']);
  669. pageBuildingsAndVehiclesInside.push(lang['pt']['categoryBuildingsInside']);
  670. pageEvents.push('ACONTECIMENTOS'); // opened events panel titlebar
  671. pageTakingInfo.push('PEGUE INFORMAÇÃO'); // page where you type how much resources do you want to pick up
  672. pageWriteNote.push('ESCREVER UMA NOTA'); // write note page
  673. pageShop.push('COMPRAS COM OS CRÉDITOS'); // shop page (credits etc)
  674. pageStorageResources.push('ARMAZENAR MATERIAL EM ESTADO BRUTO'); // how much resources do you want to put into container
  675. pageSelAmountToProject.push('SELECIONA A QUANTIDADE PARA ESTE PROJETO'); // when you create project and you type how much do you want to get (in projects like refining iron ore)
  676. pageGiveResources.push('<B>DAR INFORMAÇÃO</B>'); // how much resources do you want to give to sb
  677. pageRepair.push('Reparando'); /* de on pageGiveResources - because there are two pages with similar name */
  678. pageLocation.push(': DESCRIÇÃO'); // how to recognise LOCATION page? :D
  679. pageEmptyEnvelope.push('ESVAZIAR ENVELOPE'); // when taking notes out of envelope - titlebar
  680. /*
  681. SPANISH
  682. */
  683.  
  684. // QUOTATIONS
  685. /*
  686. !!!CAUTION!!! Remember that you shouldn't write translated text, but check how it is named in your language - no mistakes allowed or script will not load
  687. */
  688. lang['es'] = [];
  689. // other
  690. lang['es']['itemNote'] = 'nota';
  691. lang['es']['itemEnvelope'] = 'Sobre';
  692. lang['es']['grams'] = 'gramos de';
  693. lang['es']['pieces'] = 'peça(s) de';
  694. lang['es']['shipNames'] = ['balsa', 'kayak', 'canoa', 'bote de cañas', 'esquife', 'bote de remos', 'balandra', 'patache', 'chalupa', 'catamarán', 'transbordador', 'bergantín', 'nao', 'galeón']; // MUST BE LOWERCASE
  695. lang['es']['groupObjectsInUse'] = ' <i>(en uso)</i>';
  696.  
  697. // since 2.1
  698. lang['es']['vehCategoryLandVehicles'] = 'LAND VEHICLES';
  699. lang['es']['vehCategoryShips'] = 'SHIPS';
  700. lang['es']['vehCategoryConstructions'] = 'CONSTRUCTIONS';
  701. lang['es']['categoryBuildingsOutside'] = 'BUILDINGS';
  702. lang['es']['categoryBuildingsInside'] = 'OTRAS HABITACIONES';
  703.  
  704. // most important quotation
  705. activeText['es'] = 'usuarios activos en los últimos 15 minutos.';
  706. pageObjects.push('OBJETOS'); // opened objects panel titlebar
  707. pageInventory.push('INVENTARIO'); // opened inventory panel titlebar
  708. pageBuildingsAndVehicles.push(lang['es']['vehCategoryLandVehicles']);// opened vehicles panel titlebar
  709. pageBuildingsAndVehicles.push(lang['es']['vehCategoryShips']);
  710. pageBuildingsAndVehicles.push(lang['es']['vehCategoryConstructions']);
  711. pageBuildingsAndVehicles.push(lang['es']['categoryBuildingsOutside']);
  712. pageBuildingsAndVehiclesInside.push(lang['es']['categoryBuildingsInside']);
  713. pageEvents.push('ACONTECIMIENTOS'); // opened events panel titlebar
  714. pageTakingInfo.push('INFORMACIÓN SOBRE LO QUE COJE'); // page where you type how much resources do you want to pick up
  715. pageWriteNote.push('ESCRIBE UNA NOTA'); // write note page
  716. pageShop.push('NO LONGER EXIST dkoawjid'); // shop page (credits etc)
  717. pageStorageResources.push('ALMACENAR MATERIAS PRIMAS '); // how much resources do you want to put into container
  718. pageSelAmountToProject.push('SELECCIONAR CANTIDAD PARA ESTE PROYECTO'); // when you create project and you type how much do you want to get (in projects like refining iron ore)
  719. pageGiveResources.push('INFORMACIÓN SOBRE LO QUE VA A ENTREGAR'); // how much resources do you want to give to sb
  720. pageRepair.push('reparando '); /* de on pageGiveResources - because there are two pages with similar name */
  721. pageLocation.push(': DESCRIPCIÓN'); // how to recognise LOCATION page? :D
  722. pageEmptyEnvelope.push('SOBRE1234 DOESNT WORK');
  723.  
  724.  
  725. /*
  726. * FINNISH
  727. */
  728.  
  729. lang['fi'] = [];
  730.  
  731. // since 2.1
  732. lang['fi']['vehCategoryLandVehicles'] = 'LAND VEHICLES';
  733. lang['fi']['vehCategoryShips'] = 'SHIPS';
  734. lang['fi']['vehCategoryConstructions'] = 'CONSTRUCTIONS';
  735. lang['fi']['categoryBuildingsOutside'] = 'RAKENNUKSET';
  736. lang['fi']['categoryBuildingsInside'] = 'MUUT HUONEET';
  737.  
  738. // other
  739. lang['fi']['itemNote'] = 'Viestilappu';
  740. lang['fi']['itemEnvelope'] = 'Kirjekuori';
  741. lang['fi']['grams'] = 'grammaa';
  742. lang['fi']['pieces'] = ' kappaletta ';
  743. lang['fi']['optionsButton'] = 'Cantr Enhanced vaihtoehdot';
  744. lang['fi']['groupObjectsInUse'] = ' <i>(käytössä)</i>';
  745.  
  746. // most important quotation
  747. activeText['fi'] = 'käyttäjää on ollut aktivisena viimeisen 15 minuutin sisään.';
  748. pageObjects.push('ESINEET'); // opened objects panel titlebar
  749. pageInventory.push('OMAT TAVARAT'); // opened inventory panel titlebar
  750. pageBuildingsAndVehicles.push(lang['fi']['vehCategoryLandVehicles']);// opened vehicles panel titlebar
  751. pageBuildingsAndVehicles.push(lang['fi']['vehCategoryShips']);
  752. pageBuildingsAndVehicles.push(lang['fi']['vehCategoryConstructions']);
  753. pageBuildingsAndVehicles.push(lang['fi']['categoryBuildingsOutside']);
  754. pageBuildingsAndVehiclesInside.push(lang['fi']['categoryBuildingsInside']);
  755. pageEvents.push('TAPAHTUMAT'); // opened events panel titlebar
  756. pageTakingInfo.push('OTTO - TIEDOT'); // page where you type how much resources do you want to pick up
  757. pageWriteNote.push('KIRJOITA VIESTI'); // write note page
  758. pageShop.push('OSTOKSET KREDIITEILLÄ'); // shop page (credits etc)
  759. pageStorageResources.push('LAITA VARASTOON'); // how much resources do you want to put into container
  760. pageSelAmountToProject.push('VALITSE MÄÄRÄ PROJEKTILLE'); // when you create project and you type how much do you want to get (in projects like refining iron ore)
  761. pageGiveResources.push('<B>ANNA</B>'); // how much resources do you want to give to sb
  762. pageRepair.push('Korjataan'); /* de on pageGiveResources - because there are two pages with similar name */
  763. pageLocation.push(': KUVAUS'); // how to recognise LOCATION page? :D
  764. pageEmptyEnvelope.push('TYHJENNÄ KIRJEKUORI'); // when taking notes out of envelope - titlebar
  765. pageMainPage.push('PELAAJAINFO');
  766. // ustawianie języka postaci
  767. var chLn = getCharacterLanguage();
  768. /*#############################
  769. LANGUAGES END
  770. #############################*/
  771. //////
  772. ////// POCZĄTEK LISTA OBIEKTÓW
  773. //////
  774. function listObjects(){
  775. var node = document.body;
  776. var mainNode = node.getElementsByClassName('page')[1];
  777. var TRs = mainNode.getElementsByTagName('tr');
  778. var list = [];
  779. var dummySpan = document.createElement('span');
  780. for (var ind=0;ind<TRs.length;ind++){
  781. if(TRs[ind].getElementsByTagName('table').length > 0){ // because there is outer TR and inner TR (in table), we want only outer TRs
  782. var tabNode = TRs[ind].getElementsByTagName('table')[0];
  783. var TDs = tabNode.getElementsByTagName('td');
  784. var lastTD = TDs[TDs.length-1];
  785. dummySpan.innerHTML = lastTD.innerHTML.replace(">", "> ");
  786. list.push(trim(dummySpan.textContent));
  787. }
  788. }
  789. var listOuterDiv = document.createElement('div');
  790. mainNode.appendChild(listOuterDiv);
  791. var headerDiv = createHeaderTitle(lang[ln]['listObjectsTitle'], 12);
  792. headerDiv.style.marginBottom = '10px';
  793. var listDiv = document.createElement('div');
  794. // na początku lista jest ukryta
  795. var listVisible = false;
  796. listDiv.style.display = 'none';
  797. // ukrywanie i odkrywanie listy po wciśnięciu nagłówka
  798. headerDiv.addEventListener('click', function(){
  799. listVisible = !listVisible;
  800. if (listVisible)
  801. listDiv.style.display = 'block';
  802. else
  803. listDiv.style.display = 'none';
  804. }, true);
  805.  
  806. var chBoxes = document.createElement('div');
  807. var chNotes = addListCheckBox(lang[ln]['listObjectsNotesCB']);
  808. var chRes = addListCheckBox(lang[ln]['listObjectsResourcesCB']);
  809. var chOther = addListCheckBox(lang[ln]['listObjectsOthersCB']);
  810. listDiv.appendChild(chBoxes);
  811. var listTArea = document.createElement('textarea');
  812. listTArea.cols = 83;
  813. listTArea.rows = 5;
  814. listDiv.appendChild(listTArea);
  815. rebuildList();
  816. var noteCB = document.createElement('input');
  817. listOuterDiv.appendChild(headerDiv);
  818. listOuterDiv.appendChild(listDiv);
  819. function rebuildList(){
  820. console.log('rebuilding');
  821. listTArea.innerHTML = '';
  822. for (var index=0;index<list.length;index++){
  823. if (list[index].indexOf(lang[chLn]['itemNote']) >= 0 || list[index].indexOf(lang[chLn]['itemEnvelope']) >= 0){
  824. if (chNotes.checked)
  825. listTArea.innerHTML += list[index] + '\n';
  826. }
  827. else if (list[index].indexOf(lang[chLn]['grams']) >= 0 ){
  828. if (chRes.checked)
  829. listTArea.innerHTML += list[index] + '\n';
  830. }
  831. else if (chOther.checked){
  832. listTArea.innerHTML += list[index] + '\n';
  833. }
  834. }
  835. }
  836. function addListCheckBox(spanName){
  837. var chBox = document.createElement('input');
  838. chBox.type = 'checkbox';
  839. chBox.checked = true;
  840. chBoxes.appendChild(chBox);
  841. var capSpan = document.createElement('span');
  842. capSpan.innerHTML = spanName;
  843. chBox.addEventListener('click', function(){ rebuildList();}, true);
  844. chBoxes.appendChild(capSpan);
  845. return chBox;
  846. }
  847. function trim (str){
  848. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  849. }
  850. }
  851. //////
  852. ////// KONIEC LISTA OBIEKTÓW
  853. ////// POCZĄTEK GRUPOWANIE OBIEKTÓW
  854. //////
  855. function groupObjects(){
  856. var node = document.body;
  857. var centerNode = node.getElementsByClassName('page')[1];
  858. var TRs = centerNode.getElementsByTagName('tr');
  859. var list = [];
  860. for (var ind=0;ind<TRs.length;ind++){
  861. if(TRs[ind].getElementsByTagName('table').length > 0){ // because there is outer TR and inner TR (in table), we want only outer TRs
  862. var tabNode = TRs[ind].getElementsByTagName('table')[0];
  863. var TDs = tabNode.getElementsByTagName('td');
  864. for (var tdind=0;tdind<TDs.length;tdind++){
  865. if (TDs[tdind].innerHTML.indexOf('button_small_use.gif') >= 0){ // sprawdza czy jest to maszyna
  866. var nameTD = TDs[TDs.length-1];
  867. var projectTD = TDs[tdind];
  868. var allTR = TRs[ind];
  869. var infoSpan = document.createElement('span');
  870. var used = false;
  871. if (nameTD.innerHTML.indexOf(lang[chLn]['groupObjectsInUse']) >= 0){
  872. used = true;
  873. }
  874. nameTD.innerHTML = nameTD.innerHTML.replace(lang[chLn]['groupObjectsInUse'], '');
  875. var hash = nameTD.innerHTML.hashCode();
  876. if (list[hash] == null || list[hash] == undefined){ // gdy znalazło po raz pierwszy
  877. list[hash] = [];
  878. nameTD.appendChild(infoSpan);
  879. list[hash]['name'] = nameTD;
  880. list[hash]['project'] = projectTD;
  881. list[hash]['info'] = infoSpan;
  882. list[hash]['num'] = 1;
  883. list[hash]['used'] = 0;
  884. if (used){
  885. list[hash]['used'] = 1;
  886. list[hash]['info'].innerHTML = lang[chLn]['groupObjectsInUse'];
  887. }
  888. }
  889. else { // po raz kolejny wystąpiło
  890. list[hash]['num']++;
  891. if (used){
  892. list[hash]['used']++;
  893. }
  894. else {
  895. list[hash]['project'].innerHTML = projectTD.innerHTML;
  896. }
  897. list[hash]['info'].innerHTML = ' ' + lang[ln]['groupObjectsUsedFirst'] + list[hash]['used'] + lang[ln]['groupObjectsUsedOf'] + list[hash]['num'] + lang[ln]['groupObjectsUsedEnd'];
  898. TRs[ind].innerHTML = '';
  899. // TRs[ind].parentNode.removeChild(TRs[ind]);
  900. }
  901. }
  902. }
  903. }
  904. }
  905. }
  906. //////
  907. ////// KONIEC GRUPOWANIE OBIEKTÓW
  908. ////// POCZĄTEK AUTOZAZNACZANIE NOTATEK
  909. //////
  910. function notesCheckBoxInventory(){
  911. var node = document.body;
  912. var inputs = node.getElementsByTagName('input');
  913. // storage of informations about TR checkbox and TR in which is located
  914. var noteName = [];
  915. var noteCB = [];
  916. for (var i=0;i<inputs.length;i++){
  917. var currInput = inputs[i];
  918. if (currInput.type == 'checkbox' && currInput.name == 'notes[]'){
  919. var label = currInput.parentNode;
  920. var rx1 = new RegExp('('+lang[chLn]['itemNote']+')(.*)', "m");
  921.  
  922. var parts = rx1.exec(label.innerHTML);
  923. var text = "";
  924. if (parts){
  925. text = parts[0];
  926. }
  927. if (text.indexOf(lang[chLn]['itemNote']) >= 0){
  928. noteName.push(text);
  929. noteCB.push(currInput);
  930. }
  931. }
  932. }
  933. if (noteCB.length > 0){
  934. console.log('number of notes: ' + noteCB.length);
  935. var optionsCenter = node.getElementsByTagName('center')[2];
  936. var forPanel = document.createElement('div');
  937. optionsCenter.insertBefore(forPanel, optionsCenter.firstChild);
  938. notesCheckBoxIn(noteCB, noteName, forPanel);
  939. }
  940. }
  941. function notesCheckBoxEnvelopes() {
  942. var node = document.body.getElementsByTagName('center')[0];
  943. var inputs = node.getElementsByTagName('input');
  944. var noteName = [];
  945. var noteCB = [];
  946. for (var i=0;i<inputs.length;i++) {
  947. var currInput = inputs[i];
  948. if (currInput.type == 'checkbox' && currInput.name.indexOf('note') == 0){
  949. noteCB.push(currInput);
  950. // i tu się zaczyna głupia sprawa z nazwą, bo jej potrzebuję
  951. var noteNameNode = currInput.parentNode.nextSibling.nextSibling;
  952. var currCode = noteNameNode.innerHTML;
  953. var currName = currCode.split('<br>', 1)[0];
  954. noteName.push(currName);
  955. }
  956. }
  957. if (noteCB.length > 0){
  958. console.log('number of notes: ' + noteCB.length);
  959. var optionsCenter = document.body.getElementsByTagName('center')[0];
  960. var forDiv = document.createElement('div');
  961. optionsCenter.insertBefore(forDiv, optionsCenter.firstChild);
  962. notesCheckBoxIn(noteCB, noteName, forDiv);
  963. }
  964. }
  965. function notesCheckBoxIn(notesArr, nameArr, options){
  966. var infoSpan = document.createElement('span');
  967. infoSpan.innerHTML = lang[ln]['notesChbTitle'] + ': ';
  968. var allNotes = document.createElement('span');
  969. allNotes.innerHTML = ' [' + lang[ln]['notesChbAll'] + '] ';
  970. allNotes.addEventListener('click', function(){
  971. for (var i=0;i<notesArr.length;i++)
  972. notesArr[i].checked = true;
  973. }, true);
  974. var noNotes = document.createElement('span');
  975. noNotes.innerHTML = ' [' + lang[ln]['notesChbNo'] + '] ';
  976. noNotes.addEventListener('click', function(){
  977. for (var i=0;i<notesArr.length;i++)
  978. notesArr[i].checked = false;
  979. }, true);
  980. var duplNotes = document.createElement('span');
  981. duplNotes.innerHTML = ' [' + lang[ln]['notesChbDupl'] + '] ';
  982. duplNotes.addEventListener('click', function(){
  983. var hashTab = [];
  984. for (var i=0;i<notesArr.length;i++){
  985. var currHash = nameArr[i].hashCode();
  986. if (hashTab[currHash] != 1){ // jeśli nie istnieje taki element
  987. hashTab[currHash] = 1;
  988. notesArr[i].checked = false;
  989. }
  990. else { // jeśli już wcześniej taki znaleziono
  991. notesArr[i].checked = true;
  992. }
  993. }
  994. }, true);
  995. var oppositeNotes = document.createElement('span');
  996. oppositeNotes.innerHTML = ' [' + lang[ln]['notesChbOpp'] + '] ';
  997. oppositeNotes.addEventListener('click', function(){
  998. for (var i=0;i<notesArr.length;i++)
  999. notesArr[i].checked = !notesArr[i].checked;
  1000. }, true);
  1001. options.appendChild(infoSpan);
  1002. options.appendChild(allNotes);
  1003. options.appendChild(noNotes);
  1004. options.appendChild(duplNotes);
  1005. options.appendChild(oppositeNotes);
  1006. }
  1007. //////
  1008. ////// KONIEC AUTOZAZNACZANIE NOTATEK
  1009. ////// POCZĄTEK WYRÓŻNIONE BUDYNKI/POJAZDY
  1010. //////
  1011. function bookmarkBuildingsVehicles(){
  1012. var char4digits = get4digits();
  1013. var hlDiv = document.createElement('div');
  1014. hlDiv.style.width = '700px';
  1015. hlDiv.style.margin = 'auto';
  1016. hlDiv.style.marginTop = "10px";
  1017. hlDiv.style.background = 'rgba(0, 58, 0, 0.86)';
  1018. hlDiv.style.boxShadow = '3px 3px 10px #004000, -3px -3px 10px #003A00, 3px -3px 10px #003000';
  1019.  
  1020. var titleBars = document.getElementsByClassName('titlebar txt-title');
  1021. var isVehBar = false;
  1022. var isBuildBar = false;
  1023. var sumVeh = 0; // sum of bookmarked vehicles
  1024. var sumBuild = 0; // sum of bookmarked buildings
  1025. for (var i=0; i < titleBars.length; i++) {
  1026. var currBar = titleBars[i];
  1027. if (
  1028. (currBar.textContent.indexOf(lang[chLn]['vehCategoryLandVehicles']) >= 0) ||
  1029. (currBar.textContent.indexOf(lang[chLn]['vehCategoryShips']) >= 0) ||
  1030. (currBar.textContent.indexOf(lang[chLn]['vehCategoryConstructions']) >= 0)
  1031. ) { // add to veh
  1032. if (!isVehBar) {
  1033. isVehBar = true;
  1034. var vehTitle = createHeaderTitle(lang[ln]['bmVehTitle'], 8);
  1035. hlDiv.appendChild(vehTitle);
  1036. }
  1037. var ourCenter = skipIfNotCenter(currBar.nextSibling);
  1038. sumVeh += addToHighlightList(ourCenter);
  1039. } else if (
  1040. (currBar.textContent.indexOf(lang[chLn]['categoryBuildingsOutside']) >= 0) ||
  1041. (currBar.textContent.indexOf(lang[chLn]['categoryBuildingsInside']) >= 0)
  1042. ) { // add to buildings
  1043. if (!isBuildBar) {
  1044. isBuildBar = true;
  1045. var buildTitle = createHeaderTitle(lang[ln]['bmBuildTitle'], 8);
  1046. hlDiv.appendChild(buildTitle);
  1047. }
  1048. var ourCenter = skipIfNotCenter(currBar.nextSibling);
  1049. sumBuild += addToHighlightList(ourCenter);
  1050. }
  1051. }
  1052.  
  1053. if (isVehBar || isBuildBar) {
  1054. if ((sumVeh == 0) && (vehTitle != null)) {
  1055. vehTitle.parentNode.removeChild(vehTitle);
  1056. }
  1057. if ((sumBuild == 0) && (buildTitle != null)) {
  1058. buildTitle.parentNode.removeChild(buildTitle);
  1059. }
  1060. titleBars[1].parentNode.insertBefore(hlDiv, titleBars[1]);
  1061. }
  1062.  
  1063. function skipIfNotCenter(node) {
  1064. if (node.tagName != "CENTER") {
  1065. return node.nextSibling;
  1066. }
  1067. return node;
  1068. }
  1069. function addToHighlightList(selObjects){
  1070. var count = 0;
  1071. var objList = selObjects.getElementsByTagName('tr');
  1072. for (var obID=0;obID<objList.length;obID++){
  1073. var objID = '';
  1074. var currObj = objList[obID];
  1075. var currObjTDs = currObj.getElementsByTagName('td'); // TR zawierający informacje o pojeździe. Należy uważać, żeby nic nie popsuć
  1076. var lineDiv = document.createElement('div');
  1077. var lastElement;
  1078. for (var tdi = 0; tdi<currObjTDs.length; tdi++){
  1079. var currTD = currObjTDs[tdi];
  1080. var inputNode = currTD.getElementsByTagName('input')[0];
  1081. if (inputNode != null && objID == '')
  1082. objID = inputNode.value;
  1083. var currDiv = document.createElement('div');
  1084. currDiv.innerHTML = currObjTDs[tdi].innerHTML;
  1085. currDiv.style.display = 'inline';
  1086. currDiv.style.verticalAlign = 'top';
  1087. // usuwanie stylu dla dodatkowych znaków
  1088. var pe = currDiv.getElementsByTagName('p');
  1089. for (var idx = 0;idx<pe.length;idx++)
  1090. pe[idx].style.display = 'none';
  1091. lineDiv.appendChild(currDiv);
  1092. lastElement = currDiv;
  1093. }
  1094. if (itemExists(char4digits, objID)){ // todo
  1095. count++;
  1096.  
  1097. hlDiv.appendChild(lineDiv);
  1098. }
  1099. var selectionTD = document.createElement('td');
  1100. if (!itemExists(char4digits, objID))
  1101. setEnable(selectionTD);
  1102. else setDisable(selectionTD);
  1103. setChangeListener(selectionTD, char4digits, objID);
  1104. currObj.insertBefore(selectionTD, currObjTDs[currObjTDs.length-1]); // dodajemy gwiazdkę tuż przed ostatnim elementem - tekstem
  1105. }
  1106. return count;
  1107. }
  1108. }
  1109.  
  1110. function setChangeListener(master, digits, idek){
  1111. master.addEventListener('click', function(){
  1112. if (!itemExists(digits, idek)){ // gdy taki wpis nie istniał
  1113. itemSet(digits, idek);
  1114. // todo set localStorage że to ma być wyróżnione
  1115. setDisable(master);
  1116. }
  1117. else {
  1118. itemRemove(digits, idek);
  1119. setEnable(master);
  1120. }
  1121. }, true);
  1122. }
  1123. function itemExists(dgt, obi){
  1124. return localStorage.getItem('CE_hl_' + dgt + '_' + obi);
  1125. }
  1126. function itemSet(dgt, obi){
  1127. localStorage.setItem('CE_hl_' + dgt + '_' + obi, 'yes');
  1128. }
  1129. function itemRemove(dgt, obi){
  1130. localStorage.removeItem('CE_hl_' + dgt + '_' + obi);
  1131. }
  1132. function setEnable(tnode){
  1133. tnode.innerHTML = '(+)';
  1134. }
  1135. function setDisable(tnode){
  1136. tnode.innerHTML = '[-]';
  1137. }
  1138. //////
  1139. ////// KONIEC WYRÓŻNIONE BUDYNKI/POJAZDY
  1140. ////// POCZĄTEK OPERACJE NA STRONIE ZDARZEŃ
  1141. //////
  1142. function eventsFilter(){
  1143. var ID4digits = get4digits();
  1144. // łączenie komunikatów tego samego typu - pod warunkiem zaznaczenia pewnej opcji w wiadomo czym
  1145. if (enabledInStorage('GroupEvents') && lang[chLn]){
  1146.  
  1147. var types = [
  1148. {
  1149. 'id': 1,
  1150. 'pretext': lang[chLn]['groupPreEventsSbUse'],
  1151. 'regexp': lang[chLn]['groupEventsSbUse'],
  1152. 'f1':function(fst,snd, p, arg0, perf){
  1153. if (p[1] == perf && p[4] == arg0){
  1154. fst.innerHTML = fst.innerHTML.substr(0, fst.innerHTML.indexOf(p[3])) + ', ' + p[2] + fst.innerHTML.substr(fst.innerHTML.indexOf(p[3]));
  1155. snd.innerHTML = '';
  1156. return true;
  1157. }
  1158. return false;
  1159. }
  1160. },
  1161. {
  1162. 'id': 2,
  1163. 'pretext': lang[chLn]['groupPreEventsSbHunt'],
  1164. 'regexp': lang[chLn]['groupEventsSbHunt'],
  1165. 'f1':function(fst,snd, p, arg0, perf){
  1166. if (p[1] == perf && p[4] == arg0){
  1167. fst.innerHTML = fst.innerHTML.substr(0, fst.innerHTML.indexOf(p[3])) + ', ' + p[2] + fst.innerHTML.substr(fst.innerHTML.indexOf(p[3]));
  1168. snd.innerHTML = '';
  1169. return true;
  1170. }
  1171. return false;
  1172. }
  1173. },
  1174. {
  1175. 'id': 3,
  1176. 'pretext': lang[chLn]['groupPreEventsSbPoke'],
  1177. 'regexp': lang[chLn]['groupEventsSbPoke'],
  1178. 'f1':function(fst,snd, p, arg0, perf){
  1179. if (p[1] == perf){
  1180. fst.innerHTML = fst.innerHTML.substr(0, fst.innerHTML.lastIndexOf('.')) + ', ' + p[2] + fst.innerHTML.substr(fst.innerHTML.lastIndexOf('.'));
  1181. snd.innerHTML = '';
  1182. return true;
  1183. }
  1184. return false;
  1185. }
  1186. },
  1187. {
  1188. 'id': 4,
  1189. 'pretext': lang[chLn]['groupPreEventsSbTake'],
  1190. 'regexp': lang[chLn]['groupEventsSbTake'],
  1191. 'f1':function(fst,snd, p, arg0, perf){
  1192. if (p[1] == perf){
  1193. fst.innerHTML = fst.innerHTML.substr(0, fst.innerHTML.lastIndexOf('.')) + ', ' + p[2] + fst.innerHTML.substr(fst.innerHTML.lastIndexOf('.'));
  1194. snd.innerHTML = '';
  1195. return true;
  1196. }
  1197. return false;
  1198. }
  1199. },
  1200. {
  1201. 'id': 5,
  1202. 'pretext': lang[chLn]['groupPreEventsSbDrop'],
  1203. 'regexp': lang[chLn]['groupEventsSbDrop'],
  1204. 'f1':function(fst,snd, p, arg0, perf){
  1205. if (p[1] == perf){
  1206. fst.innerHTML = fst.innerHTML.substr(0, fst.innerHTML.lastIndexOf('.')) + ', ' + p[2] + fst.innerHTML.substr(fst.innerHTML.lastIndexOf('.'));
  1207. snd.innerHTML = '';
  1208. return true;
  1209. }
  1210. return false;
  1211. }
  1212. },
  1213. {
  1214. 'id': 6,
  1215. 'pretext': lang[chLn]['groupPreEventsSbGive'],
  1216. 'regexp': lang[chLn]['groupEventsSbGive'],
  1217. 'f1':function(fst,snd, p, arg0, perf){
  1218. if (p[1] == perf){
  1219. fst.innerHTML = fst.innerHTML.substr(0, fst.innerHTML.lastIndexOf('.')) + ', ' + p[2] + fst.innerHTML.substr(fst.innerHTML.lastIndexOf('.'));
  1220. snd.innerHTML = '';
  1221. return true;
  1222. }
  1223. return false;
  1224. }
  1225. },
  1226. {
  1227. 'id': 7,
  1228. 'pretext': lang[chLn]['groupPreEventsSbDragRes'],
  1229. 'regexp': lang[chLn]['groupEventsSbDragRes'],
  1230. 'f1':function(fst,snd, p, arg0, perf){
  1231. if (arg0 == p[4]){
  1232. var firstP = fst.innerHTML.substr(0, fst.innerHTML.indexOf(p[4]));
  1233. var secP = fst.innerHTML.substr(fst.innerHTML.indexOf(p[4]));
  1234. fst.innerHTML = firstP + ', ' + p[2] + secP;
  1235. snd.innerHTML = '';
  1236. return true;
  1237. }
  1238. return false;
  1239. }
  1240. },
  1241. {
  1242. 'id': 8,
  1243. 'pretext': lang[chLn]['groupPreEventsSbThrowDie'],
  1244. 'regexp': lang[chLn]['groupEventsSbThrowDie'],
  1245. 'f1':function(fst,snd, p, arg0, perf){
  1246. if (arg0 == p[1]) {
  1247. var firstP = fst.innerHTML.substr(0, fst.innerHTML.lastIndexOf('.'));
  1248. var secP = fst.innerHTML.substr(fst.innerHTML.lastIndexOf('.'));
  1249. fst.innerHTML = firstP + ', ' + p[3] + secP;
  1250. snd.innerHTML = '';
  1251. return true;
  1252. }
  1253. return false;
  1254. }
  1255. }
  1256. ];
  1257. var eventNode = document.getElementById("eventsList");
  1258. var divs = eventNode.getElementsByTagName('div');
  1259. var timexp = /(\d+)-(\d+)\.<small>(\d+)<\/small>/; // time regexp
  1260. var startTime = new Date().getTime();
  1261.  
  1262. var arrtime = [];
  1263. var lastType = 0;
  1264. var first = 0;
  1265. var sub = '';
  1266. var perf = '';
  1267. for (var i=0;i<divs.length;i++) {
  1268. var tdiv = divs[i];
  1269. if ((tdiv.innerHTML.indexOf(lang[chLn]['groupPreEventsYouSay']) == -1) &&
  1270. (tdiv.innerHTML.indexOf(lang[chLn]['groupPreEventsSbSay']) == -1) &&
  1271. (tdiv.innerHTML.indexOf(lang[chLn]['groupPreEventsSbWhisper']) == -1)
  1272. ) {
  1273. var ctime = timexp.exec(tdiv.innerHTML); // zakładam, że zawsze będzie pasować
  1274. var matched = false;
  1275. for (var u=0;u<types.length && !matched;u++) {
  1276. var type = types[u];
  1277. if (tdiv.innerHTML.indexOf(type.pretext) == -1) {
  1278. continue;
  1279. }
  1280. var rexp = type.regexp;
  1281. var parts = rexp.exec(tdiv.innerHTML);
  1282. if (parts) {
  1283. matched = true;
  1284. if ((lastType != type.id) || !isnear(ctime, arrtime) ||
  1285. !type.f1(first, tdiv, parts, sub, perf)
  1286. ) { // mimo tego samego typu nie udalo sie skleic, bo roznia sie szczegoly; zaczynamy od poczatku
  1287. first = tdiv;
  1288. lastType = type.id;
  1289. sub = parts[4];
  1290. perf = parts[1];
  1291. arrtime = ctime;
  1292. }
  1293. }
  1294. }
  1295. if (!matched) {
  1296. lastType = 0;
  1297. }
  1298. } else {
  1299. lastType = 0;
  1300. }
  1301. }
  1302. }
  1303. console.log("Event grouping time: " + (new Date().getTime() - startTime));
  1304. // funkcja sprawdzająca odległość czasową
  1305. function isnear(tab1, tab2){ // sprawdza czy pierwsza komórka jest taka sama a druga +- 1 min taka sama
  1306. var t1 = tab1[1]*8*36+tab1[2]*36+tab1[3];
  1307. var t2 = tab2[1]*8*36+tab2[2]*36+tab2[3];
  1308. return Math.abs(t2-t1) <= GROUPEVENTS_MAX_MIN_DIFF;
  1309. }
  1310. var divp = document.createElement('div');
  1311. /*
  1312. pobieranie numeru postaci
  1313. */
  1314. var charID = getCharId();
  1315. /*
  1316. Popup do szeptów
  1317. */
  1318.  
  1319. function popupstart(nnd) {
  1320. if (enabledInStorage('ShortNames') && chLn == 'pl') {
  1321. switch (nnd.innerHTML){
  1322. case 'dwudziestoletni mężczyzna': nnd.innerHTML = 'dwudziestolatek'; break;
  1323. case 'trzydziestoletni mężczyzna': nnd.innerHTML = 'trzydziestolatek'; break;
  1324. case 'czterdziestoletni mężczyzna': nnd.innerHTML = 'czterdziestolatek'; break;
  1325. case 'pięćdziesięcioletni mężczyzna': nnd.innerHTML = 'pięćdziesięciolatek'; break;
  1326. case 'sześćdziesięcioletni mężczyzna': nnd.innerHTML = 'sześćdziesięciolatek'; break;
  1327. case 'siedemdziesięcioletni mężczyzna': nnd.innerHTML = 'siedemdziesięciolatek'; break;
  1328. case 'osiemdziesięcioletni mężczyzna': nnd.innerHTML = 'osiemdziesięciolatek'; break;
  1329. case 'dwudziestoletnia kobieta': nnd.innerHTML = 'dwudziestolatka'; break;
  1330. case 'trzydziestoletnia kobieta': nnd.innerHTML = 'trzydziestolatka'; break;
  1331. case 'czterdziestoletnia kobieta': nnd.innerHTML = 'czterdziestolatka'; break;
  1332. case 'pięćdziesięcioletnia kobieta': nnd.innerHTML = 'pięćdziesięciolatka'; break;
  1333. case 'sześćdziesięcioletnia kobieta': nnd.innerHTML = 'sześćdziesięciolatka'; break;
  1334. case 'siedemdziesięcioletnia kobieta': nnd.innerHTML = 'siedemdziesięciolatka'; break;
  1335. case 'osiemdziesięcioletnia kobieta': nnd.innerHTML = 'osiemdziesięciolatka'; break;
  1336. }
  1337. }
  1338. if (enabledInStorage('ColorNames')){
  1339. var colors = ['#eeeeee', '#3dc5cc', '#fefefe', '#ffec77', '#e8ff8b', '#000080', '#333333', '#330033', '#4b2500', '#004000'];
  1340. var name = nnd.innerHTML;
  1341. var k = Math.abs(name.hashCode());
  1342. var e = k%5;
  1343. k = Math.floor(k/10);
  1344. var o = k%5;
  1345. if (e < 5)
  1346. o = o+5;
  1347.  
  1348. var spanNode = document.createElement('span');
  1349. spanNode.style.backgroundColor = colors[o];
  1350. spanNode.style.color = colors[e];
  1351. spanNode.style.opacity = "0.6";
  1352. spanNode.innerHTML = name;
  1353. nnd.innerHTML = "";
  1354. nnd.appendChild(spanNode);
  1355. }
  1356. }
  1357. var startTime = new Date().getTime();
  1358. var divs = eventNode.children;
  1359. for (var i=0;i<divs.length;i++){
  1360. var aNodes = divs[i].getElementsByClassName('character');
  1361. for (var k=0;k<aNodes.length;k++){
  1362. popupstart(aNodes[k]);
  1363. }
  1364. }
  1365. console.log("Character name matching time: " + (new Date().getTime() - startTime));
  1366. /*
  1367. NEW EVENTS
  1368. */
  1369.  
  1370. var eventsNumber = divs.length;
  1371. function refreshEvents() {
  1372. return function() {
  1373. var newEvents = divs.length - eventsNumber;
  1374. for (var i = 0; i < newEvents; i++) {
  1375. var aNodes = divs[i].getElementsByClassName('character');
  1376. for (var k=0;k<aNodes.length;k++) {
  1377. var nnode = aNodes[k];
  1378. popupstart(nnode);
  1379. }
  1380. }
  1381. eventsNumber = divs.length;
  1382. };
  1383. }
  1384.  
  1385. setInterval(refreshEvents(), 1000);
  1386.  
  1387. /*
  1388. * KRESKA POKAZUJACA DOKAD SIE DOCZYTALO ZDARZENIA
  1389. */
  1390.  
  1391. if (enabledInStorage('LineEventsNotFocused')) {
  1392. var eventsFocus = divs.length;
  1393. var lastUnderlinedNode = null;
  1394. function onFocus() {
  1395. var diff = divs.length - eventsFocus;
  1396. if (diff > 0) {
  1397. if (lastUnderlinedNode != null) {
  1398. lastUnderlinedNode.style.borderBottom = "none";
  1399. }
  1400. lastUnderlinedNode = divs[diff-1];
  1401. lastUnderlinedNode.style.borderBottom = "1px dashed #820";
  1402. }
  1403. }
  1404.  
  1405. function onBlur() {
  1406. eventsFocus = divs.length;
  1407. }
  1408. window.onfocus = onFocus;
  1409. window.onblur = onBlur;
  1410. }
  1411. }
  1412. //////
  1413. ////// KONIEC OPERACJE NA STRONIE ZDARZEŃ
  1414. ////// POCZĄTEK ZEGAREK
  1415. //////
  1416. function cantrClock(){
  1417. var client = new XMLHttpRequest();
  1418. var result = 0;
  1419. client.open("OPTIONS", "*", true);
  1420. client.send();
  1421. client.onreadystatechange = function() {
  1422. if(this.readyState == 2) {
  1423. var regEx = new RegExp(/^(.*?), (\d+) (.*?) (\d+) (\d+:\d+:\d+)(.*?)$/); // RegExp gets hour min and sec section from string like: "Thu, 11 Aug 2011 23:53:13 GMT"
  1424. var dateParts = regEx.exec(client.getResponseHeader("Date"));
  1425. //console.log('time: ' + dateParts[0]);
  1426. var dens = dateParts[5].split(':');
  1427. result = dens[0]*3600;
  1428. result += dens[1]*60;
  1429. result += +dens[2]*1;
  1430. cantrClockWithTime(result);
  1431. }
  1432. }
  1433. }
  1434. function cantrClockWithTime(serverTime){
  1435. var node = document.body;
  1436. var datespan = node.getElementsByClassName('tiny-top')[0];
  1437.  
  1438. console.log('serverTime = ' + serverTime);
  1439. var startDate = document.getElementById('datetime').innerHTML;
  1440. // wyłuszczanie dnia i godziny z tego tekstu
  1441. var rx1 = /^(.*)(\d+)(.*?)(\d+:\d+:\d+)(.*)$/; // regexp który wycina z treści w stylu "Day 3338 Time: 0:35:27"
  1442. var parts = rx1.exec(startDate);
  1443. // [1] "day:", [2] dayCount (i.e. '3333'), [3] "time", [4] timeCount(i.e. '3:06:05')
  1444. var day = parts[2];
  1445. var time = parts[4];
  1446. var timeSplit = time.split(':');
  1447. var hour = timeSplit[0];
  1448. var min = timeSplit[1];
  1449. var sec = timeSplit[2];
  1450. var ticks = [];
  1451.  
  1452. ticks[0] = addTick('sailing', 0, 44, 0);
  1453. ticks[1] = addTick('travel', 1, 10, 0);
  1454. ticks[2] = addTick('project', 1, 40, 0);
  1455. var x = 0;
  1456. var systemTime = Math.floor(new Date().getTime()/1000);
  1457. setInterval(function (){clockTick();}, 500);
  1458. function clockTick() {
  1459. var newTime = Math.floor(new Date().getTime()/1000);
  1460. if (newTime == systemTime) {
  1461. return;
  1462. }
  1463. systemTime = newTime;
  1464. var to0 = (((ticks[0]['min']*1+36)-min)*60+ticks[0]['sec']*1-sec)%(36*60); // 10:20 -> 14:00
  1465. var to1 = (((ticks[1]['min']*1+36)-min)*60+ticks[1]['sec']*1-sec)%(36*60);
  1466. var to2 = (((ticks[2]['min']*1+36)-min)*60+ticks[2]['sec']*1-sec)%(36*60);
  1467. var used = 0;
  1468. if (to0 < to1){
  1469. if(to2 < to0)
  1470. used = 2;
  1471. }
  1472. else {
  1473. if (to1 < to2)
  1474. used = 1;
  1475. else used = 2;
  1476. }
  1477. toTick = ((ticks[used]['min']*60+ticks[used]['sec']+36*60-min*60-sec)*5-x)%(3600*3);
  1478. // migający alarm gdy tura się zbliża
  1479. if (toTick*1 < 10*60){
  1480. datespan.style.background = '#' + (Math.round(toTick)%2 ? 'AA':'FF') + '0000'; // miganie komunikatu
  1481. } else {
  1482. datespan.style.background = 'none';
  1483. }
  1484. var hoursLeft = '';
  1485. var minsLeft = Math.floor(toTick/60);
  1486. var secsLeft = Math.round(toTick%60);
  1487. if (minsLeft >=60){
  1488. hoursLeft = Math.floor((minsLeft/60)) + ':';
  1489. minsLeft %= 60;
  1490. }
  1491. if (minsLeft < 10 && hoursLeft != '')
  1492. minsLeft = '0' + minsLeft;
  1493. if (secsLeft < 10)
  1494. secsLeft = '0' + secsLeft;
  1495. var timeLeft = hoursLeft + minsLeft + ':' + secsLeft;
  1496. datespan.innerHTML = lang[ln]['clockTimeLeft']+ ' <b>' + timeLeft + '</b> ' + lang[ln]['clockUntil'] + ' ' + lang[ln]['clockTick' + ticks[used]['name']];
  1497. // refresh every second, but second in cantr is 5 times longer
  1498. x++;
  1499. if (x < 5)
  1500. return;
  1501. x = 0;
  1502. sec++;
  1503. if (sec >= 60){
  1504. sec = 0;
  1505. min++;
  1506. if (min >= 36){
  1507. min = 0;
  1508. hour++;
  1509. if (hour >= 8){
  1510. day++;
  1511. }
  1512. }
  1513. }
  1514. // setTime();
  1515. }
  1516.  
  1517. function addTick(tickName, tickHour, tickMin, tickSec){
  1518. //console.log(tickHour + ' ' + tickMin + ' ' + tickSec);
  1519. var s_tickTime = tickHour*3600;
  1520. s_tickTime += tickMin*60;
  1521. s_tickTime = s_tickTime + tickSec*1;
  1522. // tymczasowo
  1523. //console.log('tickName: ' + tickName);
  1524. //console.log('serverTime: ' + serverTime + ' s_tickTime: ' + s_tickTime);
  1525. var rlSecondsToNextTick = ((s_tickTime+24*60*60 - serverTime)%(3600*3)); // czas do najbliższego ticku w sekundach
  1526. var cantrSecsToNextTick = rlSecondsToNextTick/5;
  1527. //console.log('cantrSecsToNextTick ' + cantrSecsToNextTick);
  1528. var cantrMinsToNextTick = Math.floor(cantrSecsToNextTick/60);
  1529. cMin = (min*1+cantrMinsToNextTick*1)%36;
  1530. cSec = Math.round(sec*1+cantrSecsToNextTick*1%60);
  1531. if (cSec >= 60){ // if na wypadek gdyby sec+reszta z dzielenia SecsToNextTick dawała razem pełną minutę
  1532. cSec -= 60;
  1533. cMin++;
  1534. }
  1535. var resArr = [];
  1536. //console.log('cantrTime ' + cMin + ' ' + cSec);
  1537. resArr['min'] = cMin;
  1538. resArr['sec'] = cSec;
  1539. resArr['name'] = tickName;
  1540. return resArr;
  1541. }
  1542. }
  1543. //////
  1544. ////// KONIEC ZEGAREK
  1545. ////// POCZĄTEK PASEK NARZĘDZI POSTACI
  1546. //////
  1547.  
  1548. function charMenuToolbar() {
  1549. var toolbar = document.createElement('div');
  1550. toolbar.style.display = "block";
  1551. toolbar.style.width = "60px";
  1552. toolbar.style.backgroundColor = "#040";
  1553. toolbar.style.padding = "3px";
  1554. toolbar.style.position = "fixed";
  1555. var width = window.innerWidth || d.documentElement.clientWidth || d.body.clientWidth;
  1556. var pos = width/2 + 350 + 60;
  1557. toolbar.style.top = "20px";
  1558. toolbar.style.left = pos + "px";
  1559.  
  1560. var oldCharMenu = document.getElementById('character_menu');
  1561. var els = oldCharMenu.getElementsByTagName('a');
  1562. for (var i=0; i < els.length; i++) {
  1563. var newEl = els[i].cloneNode(true);
  1564. toolbar.appendChild(newEl);
  1565. }
  1566. var backToPlayer = document.getElementById('player_menu').getElementsByTagName('a')[0];
  1567. toolbar.appendChild(backToPlayer.cloneNode(true));
  1568. document.body.appendChild(toolbar);
  1569. }
  1570.  
  1571. //////
  1572. ////// KONIEC PASEK NARZĘDZI POSTACI
  1573. ////// POCZĄTEK WYBORU JĘZYKA ZA PIERWSZYM RAZEM
  1574. //////
  1575. function langSelection() {
  1576. var cent = document.body.getElementsByClassName('playerTopBar')[0];
  1577.  
  1578. var trForBox = document.createElement('div');
  1579. var langSpanBefore = document.createElement('p');
  1580. var langSpanAfter = document.createElement('p');
  1581. langSpanBefore.style.margin = '3px';
  1582. langSpanAfter.style.margin = '3px';
  1583. var langDiv = document.createElement('div');
  1584. langDiv.colSpan = 2;
  1585. langDiv.style.backgroundColor = '#008800';
  1586. langDiv.style.padding = '2px';
  1587. langSpanBefore.innerHTML = lang[ln]['langSelectionTextBefore'];
  1588. langSpanAfter.innerHTML = lang[ln]['langSelectionTextAfter'];
  1589. trForBox.appendChild(langDiv);
  1590. cent.appendChild(trForBox);
  1591. langDiv.appendChild(langSpanBefore);
  1592. langDiv.appendChild(languageNode());
  1593. langDiv.appendChild(langSpanAfter);
  1594. }
  1595. //////
  1596. ////// KONIEC WYBORU JĘZYKA ZA PIERWSZYM RAZEM
  1597. ////// POCZĄTEK OPCJE
  1598. //////
  1599. function optionPanel(){
  1600. var node = document.body;
  1601. node = node.getElementsByClassName('playerTopBar')[0]; // node - wszystkie elementy z <center>
  1602. optionsDiv = document.createElement('div');
  1603. var optionTD = document.createElement('div');
  1604. var showOptions = document.createElement('p');
  1605. showOptions.innerHTML = '[' + lang[ln]['optionsButton'] + ']';
  1606. optionsDiv.appendChild(showOptions);
  1607. optionsDiv.appendChild(optionTD);
  1608. node.appendChild(optionsDiv);
  1609. showOptions.style.textAlign = 'right';
  1610. showOptions.addEventListener("click", function() {
  1611. if (optionTD.style.display == 'none')
  1612. optionTD.style.display = 'block';
  1613. else optionTD.style.display = 'none';
  1614. }, true);
  1615. var CE_Desc = document.createElement('span');
  1616. CE_Desc.style.fontSize = "21px";
  1617. CE_Desc.innerHTML = lang[ln]['optionsTitle'];
  1618. optionTD.appendChild(CE_Desc);
  1619. var oForm = document.createElement('form');
  1620. optionTD.appendChild(oForm);
  1621. optionTD.style.display = 'none';
  1622. optionTD.style.textAlign = 'left';
  1623. optionTD.style.background = "#006600";
  1624. addCheckbox(oForm, "EventsFilter", lang[ln]['optionsEventsFilter']);
  1625. addCheckbox(oForm, "GroupEvents", lang[ln]['optionsGroupEvents']);
  1626. addCheckbox(oForm, "ColorNames", lang[ln]['optionsColorNames']);
  1627. addCheckbox(oForm, "ShortNames", lang[ln]['optionsShortNames']);
  1628. addCheckbox(oForm, "Clock", lang[ln]['optionsClock']);
  1629. addCheckbox(oForm, "HighlightedBuildingsVehicles", lang[ln]['optionsBookmarkBuildingsVehicles']);
  1630. addCheckbox(oForm, "NotesCheckBox", lang[ln]['optionsNotesCheckBox']);
  1631. addCheckbox(oForm, "List", lang[ln]['optionsListObjects']);
  1632. addCheckbox(oForm, "GroupObjects", lang[ln]['optionsGroupObjects']);
  1633. addCheckbox(oForm, "LineEventsNotFocused", lang[ln]['optionsLineEventsNotFocused']);
  1634. addCheckbox(oForm, "CharMenuToolbar", lang[ln]['optionsCharMenuToolbar']);
  1635. optionTD.appendChild(languageNode());
  1636. optionTD.appendChild(createImportExportArea());
  1637. function addCheckbox(upForm, optionName, descText){
  1638. var enableOption = document.createElement('input');
  1639. enableOption.type = 'checkbox';
  1640. enableOption.name = "CE_enable" + optionName;
  1641. var optionDesc = document.createElement('span');
  1642. optionDesc.innerHTML = descText + "<br>";
  1643. enableOption.checked = true;
  1644. if (localStorage.getItem('CE_enable' + optionName) != null && localStorage.getItem('CE_enable' + optionName) == 'false')
  1645. enableOption.checked = false;
  1646. enableOption.addEventListener("click", function(){
  1647. localStorage.setItem('CE_enable' + optionName, enableOption.checked);
  1648. }, true);
  1649. upForm.appendChild(enableOption);
  1650. upForm.appendChild(optionDesc);
  1651. }
  1652. function createImportExportArea() {
  1653. var importExportDiv = document.createElement('div');
  1654. var ietextArea = document.createElement('textarea');
  1655. ietextArea.cols = 83;
  1656. ietextArea.rows = 5;
  1657. var importButt = document.createElement('input');
  1658. importButt.type = 'button';
  1659. importButt.value = "import";
  1660. var exportButt = document.createElement('input');
  1661. exportButt.type = 'button';
  1662. exportButt.value = "export";
  1663. exportButt.addEventListener("click", function() {
  1664. var values = {};
  1665. for (var i=0;i<localStorage.length;i++) {
  1666. var valueName = localStorage.key(i);
  1667. values[valueName] = localStorage.getItem(valueName);
  1668. }
  1669. ietextArea.value = JSON.stringify(values);
  1670. }, true);
  1671. importButt.addEventListener("click", function() {
  1672. try {
  1673. var values = JSON.parse(ietextArea.value);
  1674. } catch (e) { // input is invalid
  1675. return;
  1676. }
  1677. for (idx in values) {
  1678. if (localStorage.getItem(idx) === null) { // item doesn't exist so import
  1679. localStorage.setItem(idx, values[idx]);
  1680. }
  1681. }
  1682. }, true);
  1683. importExportDiv.appendChild(ietextArea);
  1684. importExportDiv.appendChild(importButt);
  1685. importExportDiv.appendChild(exportButt);
  1686. return importExportDiv;
  1687. }
  1688. }
  1689. function languageNode(){
  1690. var selectNode = document.createElement('select');
  1691. var noOp = addLangOption("--");
  1692. var enOp = addLangOption('en');
  1693. var plOp = addLangOption('pl');
  1694. // var deOp = addOption('de');
  1695. selectNode.addEventListener("change", function(){
  1696. ln = selectNode.options[selectNode.selectedIndex].value;
  1697. setLanguage(ln);
  1698. }, true);
  1699. function addLangOption(language){
  1700. var optionNode = document.createElement('option');
  1701. optionNode.name = language;
  1702. optionNode.innerHTML = language;
  1703. optionNode.value = language;
  1704. if (language == getLanguage())
  1705. optionNode.selected = true;
  1706. selectNode.appendChild(optionNode);
  1707. return optionNode;
  1708. }
  1709. return selectNode;
  1710. }
  1711. //////
  1712. ////// KONIEC OPCJE
  1713. //////
  1714. /*
  1715. posX posY functions - to get global absolute position of the tag
  1716. */
  1717. function posX(obj){
  1718. var curleft = 0;
  1719. if(obj.offsetParent)
  1720. while(1){
  1721. curleft += obj.offsetLeft;
  1722. if(!obj.offsetParent)
  1723. break;
  1724. obj = obj.offsetParent;
  1725. }
  1726. else if(obj.x)
  1727. curleft += obj.x;
  1728. return curleft;
  1729. }
  1730.  
  1731. function posY(obj){
  1732. var curtop = 0;
  1733. if(obj.offsetParent)
  1734. while(1){
  1735. curtop += obj.offsetTop;
  1736. if(!obj.offsetParent)
  1737. break;
  1738. obj = obj.offsetParent;
  1739. }
  1740. else if(obj.y)
  1741. curtop += obj.y;
  1742. return curtop;
  1743. }
  1744.  
  1745. function get4digits(){
  1746. var ownCharIdNode = document.getElementById('ownCharId'); // center nr 1 - tu jest belka postaci
  1747. return (ownCharIdNode.value)%10000; // only last 4 digits for safety reasons, ya know
  1748. }
  1749. function createHeaderTitle(title, pts){
  1750. var titleDiv = document.createElement('div');
  1751. titleDiv.innerHTML = '<b>' + title + '</b>';
  1752. titleDiv.style.background = '#008800';
  1753. titleDiv.style.fontSize = pts + 'pt';
  1754. titleDiv.style.textAlign = 'center';
  1755. return titleDiv;
  1756. }
  1757. String.prototype.hashCode = function(){
  1758. var hash = 0;
  1759. if (this.length == 0) return hash;
  1760. for (i = 0; i < this.length; i++) {
  1761. char = this.charCodeAt(i);
  1762. hash = ((hash<<5)-hash)+char;
  1763. hash = hash & hash; // Convert to 32bit integer
  1764. }
  1765. return hash;
  1766. }
  1767. /*
  1768. * SPRAWDZANIE NA KTÓREJ STRONIE SIĘ ZNAJDUJESZ
  1769. */
  1770. function isWrit(tresc, arr){
  1771. var isW = false;
  1772. for (idx=0; idx < arr.length;idx++){
  1773. if (tresc.indexOf(arr[idx]) >= 0)
  1774. isW = true;
  1775. }
  1776. return isW;
  1777. }
  1778. function cInput(itype, iname, ivalue){
  1779. var ci = document.createElement('input');
  1780. ci.type = itype;
  1781. ci.name = iname;
  1782. ci.value = ivalue;
  1783. return ci;
  1784. }
  1785.  
  1786. function checkStrona(){
  1787. var node = document.body;
  1788. node = node.getElementsByClassName("titlebar"); // node - wszystkie elementy z <div>
  1789. if (node.length > 0){ // czy istnieje pierwszy div
  1790. for (var i = 0; i < node.length; i++) {
  1791. if (isWrit(node[i].innerHTML, pageMainPage)) {
  1792. return ('main_page');
  1793. }
  1794. }
  1795. }
  1796. if(node.length > 1){ // czy w ogóle istnieje czwart center
  1797. var code = node[1].innerHTML; // kod <center> nr 4 czyli tego z belką w której jest nazwana podstrona
  1798. if(isWrit(code, pageObjects))
  1799. return ('objects');
  1800. if(isWrit(code, pageLocation))
  1801. return ('location');
  1802. if(isWrit(code, pageInventory))
  1803. return ('inventory');
  1804. if(isWrit(code, pageBuildingsAndVehicles))
  1805. return ('building_vehicles');
  1806. if(isWrit(code, pageBuildingsAndVehiclesInside))
  1807. return ('inside_building');
  1808. if(isWrit(code, pageEvents))
  1809. return ('events_page');
  1810. }
  1811. var header = node[0];
  1812. if (header != null){
  1813. var code = header.innerHTML;
  1814. // gdy coś podnosisz
  1815. if (isWrit(code, pageTakingInfo)){
  1816. return ('take_resources');
  1817. }
  1818. if (isWrit(code, pageEmptyEnvelope)){
  1819. return ('empty_envelope');
  1820. }
  1821. if (isWrit(code, pageWriteNote)){
  1822. return ('write_note');
  1823. }
  1824. if (isWrit(code, pageRetrieveFromContainer)){
  1825. return ('retrieve_from_container');
  1826. }
  1827. if (isWrit(code, pageShop)){
  1828. return ('shop');
  1829. }
  1830. if (isWrit(code, pageStorageResources)){
  1831. return ('into_container');
  1832. }
  1833. if (isWrit(code, pageSelAmountToProject)){
  1834. return ('project_size');
  1835. }
  1836. if (isWrit(code, pageGiveResources)){
  1837. return ('give_resources');
  1838. }
  1839. if (isWrit(code, pageRepair)){
  1840. return ('repair');
  1841. }
  1842. // jeśli żadnej nas interesującej nie znajdzie
  1843. }
  1844. return ('no');
  1845. }
  1846.  
  1847. function changeName(){
  1848. var cantrTitle = document.body.getElementsByTagName('p')[0];
  1849. cantrTitle.innerHTML = 'Cantr II<span style="font-size:10px;text-shadow: -1px 0 #444444, 0 1px #444444, 1px 0 #444444, 0 -1px #444444;"> enhanced</span>';
  1850. }
  1851.  
  1852. function getCap(){
  1853. var cnode = document.body.getElementsByTagName('center')[0];
  1854. var capTD = cnode.getElementsByTagName('tr')[4].getElementsByTagName('td')[1];
  1855. var capRexp = /\d+/;
  1856. var capText = capRexp.exec(capTD.innerHTML);
  1857. if (capText)
  1858. return capText[0];
  1859. else return 0;
  1860. }
  1861.  
  1862. function enabledInStorage(itemName) {
  1863. if (enabledInStorage.items === undefined) {
  1864. enabledInStorage.items = [];
  1865. }
  1866. if (enabledInStorage.items[itemName] !== undefined) {
  1867. return enabledInStorage.items[itemName];
  1868. } else {
  1869. var value = localStorage.getItem('CE_enable' + itemName);
  1870. var result = (value == null || value == 'true');
  1871. enabledInStorage.items[itemName] = result;
  1872. return result;
  1873. }
  1874. }
  1875.  
  1876. function getLanguage(){
  1877. var langResult = localStorage.getItem('CE_language');
  1878. if (langResult != null)
  1879. return langResult;
  1880. return 'en';
  1881. }
  1882.  
  1883. function setLanguage(setLan) {
  1884. if (lang[setLan] === undefined) {
  1885. setLan = "en";
  1886. }
  1887. localStorage.setItem('CE_language', setLan);
  1888. }
  1889.  
  1890.  
  1891. // pobieranie języka POSTACI
  1892.  
  1893. function getCharacterLanguage(){
  1894. var tab = document.body.getElementsByTagName('table')[0];
  1895. var activeReceivedText = tab.getElementsByTagName('td')[1].getElementsByTagName('span')[0]
  1896. // tekst ile osób było aktywnych w ciągu ostatnich x minut
  1897. for (var index in activeText){
  1898. if (activeReceivedText.innerHTML.indexOf(activeText[index]) >= 0){
  1899. return index;
  1900. }
  1901. }
  1902. return 'en'; // default
  1903. }
  1904.  
  1905. function getCharId() {
  1906. return document.getElementById('ownCharId').value;
  1907. }
  1908.  
  1909.  
  1910. // tu zaczyna działać tak naprawdę po raz pierwszy
  1911.  
  1912. var scriptStartTime = new Date().getTime();
  1913.  
  1914. var strona = checkStrona(); // sprawdzamy czy znajdujemy się na której ze stron "znaczących" - takich na których skrypt ma coś robić
  1915.  
  1916. changeName();
  1917.  
  1918.  
  1919. if (strona == 'objects' && enabledInStorage('ListObjects')){
  1920. listObjects();
  1921. }
  1922.  
  1923. if (strona == 'objects' && enabledInStorage('GroupObjects')){
  1924. groupObjects();
  1925. }
  1926.  
  1927. if (strona == 'inventory' && enabledInStorage('NotesCheckBox')){
  1928. notesCheckBoxInventory();
  1929. }
  1930.  
  1931. if (strona == 'empty_envelope' && enabledInStorage('NotesCheckBox')){
  1932. notesCheckBoxEnvelopes();
  1933. }
  1934.  
  1935. if (strona == 'write_note' && enabledInStorage('NotePre')){
  1936. notePreview();
  1937. }
  1938.  
  1939. if (strona == 'main_page' && localStorage.getItem('CE_language') == null)
  1940. langSelection();
  1941.  
  1942. if (strona == 'main_page'){
  1943. optionPanel();
  1944. }
  1945.  
  1946. if ((strona == 'building_vehicles' || strona == 'inside_building') && enabledInStorage('BookmarkBuildingsVehicles')){
  1947. bookmarkBuildingsVehicles();
  1948. }
  1949.  
  1950. if (strona == 'events_page' && enabledInStorage('EventsFilter')){
  1951. eventsFilter();
  1952. }
  1953.  
  1954. if (enabledInStorage('Clock')){
  1955. cantrClock();
  1956. }
  1957.  
  1958. if (['objects', 'location', 'inventory', 'building_vehicles', 'inside_building',
  1959. 'events_page'].indexOf(strona) != -1 && enabledInStorage('CharMenuToolbar')) {
  1960. charMenuToolbar();
  1961. }
  1962.  
  1963. console.log("Cantr Enhanced execution time: " + (new Date().getTime() - scriptStartTime));