Stefan Breunig 360f6f8336 rework chat handling completely
The old system was getting too complicated to add new features to.
The new one should be easier to understand and will be explained
below. This patch should fix #140 and fix #16.

There are several places where new data requests may come from:
- chat.needMoreMessages checks if we are scrolled too far up or
  there is no scrollbar. It then requests new messages.
- scrolling up
- switching the chat tab via chat.chooser
- auto refresh
- once on boot
The latter two always request both types of chat.

Faction and public are handled the same way. Public is later split
into categories. I will explain the faction chat here because it’s
easier.

It starts in chat.requestFaction. This will initialize the query to
the server for data. The exact query is determined by chat.
genPostData. There can only be one faction chat request at a time.
Clearing on map move is handled automatically in code/requests.js.

Let’s assume the data query is successful. It is now passed to
chat.handleFaction which runs some basic checks before the data is
processed and stored in chat._factionData. This is done by chat.
writeDataToHash. The hash keys are the message GUIDs to avoid
duplicates. The hash values are an array of timestamp, processed
message and other meta data.

There is only one way to render faction chat, so data is directly
handed to chat.renderFaction which immediately hands it to chat
.renderData. renderData discards the GUIDs and sorts the values
by their timestamp. It then iterates over the data to insert
date break lines and finally renders the data in the DOM. It also
does some magic to keep the correct scrolling position.

Chat data will be cleared on map move or zoom. However, the
display is not refreshed, so the old, invalid chat data is still
displayed. Only once the data query is finished the data is
rendered. The upside is that small map operations within your
local area appear to never lose their chat data. Downside is that
there’s invalid chat for some time when changing cities.
2013-02-13 02:52:27 +01:00
2013-02-13 02:52:27 +01:00
2013-02-11 19:10:15 +01:00
2013-02-11 19:27:16 +01:00
2013-02-11 19:10:15 +01:00
2013-02-01 13:11:14 +01:00
2013-02-01 13:11:14 +01:00
2013-02-13 02:52:27 +01:00
2013-02-07 14:27:24 +01:00
2013-02-11 19:34:35 +01:00
2013-02-04 10:49:11 +01:00
2013-02-04 10:49:11 +01:00
2013-02-13 02:52:27 +01:00

WEBSITE LOOKS BROKEN? Update the script. On the upside you may scroll the portal details if theres not enough screen space.

ingress.com/intel total conversion

Its annoying to extend the intel page with new features because the minified code makes it hard to grasp whats going on. Also, one has to play catch up each time Niantic put up a new version because all the variables might get new names.

So instead, heres a userscript that starts from scratch:

Screenshot of the total conversion in Johannesburg

(click to zoom)

Features

  • feels faster. (Likely because leaflet is faster, although there are some other tricks.)
  • full view of portal images
  • better chat
    • separated automated/public/faction
    • only showing the last automated message for each user. Makes a great “where are they now” guide.
    • nick tab completion
    • clickable links
  • automatic idle resume
  • portal details get updated while portal is visible on map
  • links to portals made easy (partly works with the vanilla map, too)
  • info porn. Everything with the help cursor has more info hidden in a tooltip.
  • may toggle portals/links/fields
  • hack range (yellow circle) and link range (large red circle) for portals. Click on the range link in the sidebar to zoom to link range.
  • double clicking a portal zooms in and focuses it
  • display of XM and AP rewards for redeemed passcodes

Install

Current version is 0.51. See NEWS.md for details.

INSTALL

Firefox: Install Greasemonkey or Scriptish. Click install link. Install. Reload page.

Chrome: The user script works in vanilla Chrome.

  1. Click install link and ignore the warning.
  2. The file should be downloaded and appear in your download bar.
  3. Goto Menu ButtonToolsExtensions.
  4. Drag and drop the download over the window and Chrome will offer you to install the script.
  5. Reload page.

Note: if Chrome only shows you the text, but does not offer an install dialog, make sure the file ends in .user.js. If its something like .user(2).js it wont work.

Opera: Download the script and put it into your user_js folder (thats ~/.opera/user_js on Unix). If you cant find it see Operas docs. After placing it there, reload the page.

NoScript: It doesnt work with NoScript, unless you uncheck NoScriptEmbeddingsBlock every object coming from a site makred as untrusted. This is required, even if NoScript is set to allow scripts globally. No embedded objects are being loaded. I tried reporting the bug, but only a forum that wouldnt let me register was available. Theres a stripped down example in noscript-sucks.html. If you can manage to report the bug, be my guest.

INSTALL

Contributing

Please do!

(Obviously, Resistance folks must send in complete patches while Enlightenment gals and guys may just open feature request ☺)

Contributors

Bananeweizen, cmrn, epf, integ3r, JasonMillward, mledoze, OshiHidra, phoenixsong6, Pirozek, Scrool, sorgo, Xelio, ZauberNerd

Hacking

Execute ./build.py to effectively concatenate main.js with all the files in code/. It generates the user script which may be installed into your browser. Do not modify ttic-debug.user.js manually, because it is automatically generated. Instead, modify the files in code/ and have that file built for you. The files in dist/ are for release only and should not be touched by you.

style.css contains most styles required for the user-script. The extra ones can be found in code/boot.js#window.setupStyles. Only CSS rules that depend on config variables should be defined there.

external/leaflet_google.js contains some code to display Google Maps imagery with Leaflet, which is a slightly modified version of this gist. The code likely was originally written by Pavel Shramov.

external/autolink.js is the same file as distributed by Bryan Woods.

My dev setup is like this:

  • checked out git repository
  • symlinked the user script to the version in the repo. It should work like this:
    • cd ~/.mozilla/firefox/<YOUR FF PROFILE>/scriptish_scripts/ingress-intel-total-conversion@breunigs
    • ln -s ~/<PATH TO REPO>/total-conversion-build.user.js ingress-intel-total-conversion@breunigs.user.js
  • if you are working on styles or scripts that are normally served via HTTP, you can setup an HTTP server for the current directory at http://0.0.0.0:8000 using python -m SimpleHTTPServer.
  • run ./autobuild.sh to re-build the user script whenever you make changes
  • Focus the location bar and hit enter instead of reloading. This way your browser doesnt look for new versions of cached files.

Attribution & License

This project is licensed under the permissive ISC license. Parts imported from other projects remain under their respective licenses:

Description
No description provided
Readme 15 MiB
Languages
JavaScript 69.3%
Java 15%
PHP 7.4%
CSS 3.8%
Hack 2.6%
Other 1.9%