-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some chat refactoring #412
Conversation
7d4754d
to
68f25d3
Compare
Please explain this. |
those points slightly change the API while other points are intern mechanism I should say: "changes that may break some plugins" |
Please add more cases where you are not sure about compatibility
We should avoid such changes in public api. |
0d066f0
to
3e979c3
Compare
6768e2d
to
c013ebf
Compare
So is it possible to completely avoid breaking anything? |
c013ebf
to
13864c7
Compare
About the remaining point: Other plugins that apply a style sheet on IITC migh also assume the html structure but the current changes make things easier to customize the chat (removing inline style + |
Before: <div id="chat">
<div id="chatall">
<table>
<!-- Public chat -->
<tr>
<td><time title="2020-12-24 12:08:45<small class="milliseconds">.871</small>" data-timestamp="1608808125871">12:08</time></td>
<td>
<span class="invisep"><</span>
<mark class="nickname" style="cursor:pointer; color:#0088FF">aplayer</mark>
<span class="invisep">></span>
</td>
<td>
<!-- prefix -->
<span style="color: #ff6; background-color: #550">[public]</span>
hi <span class="ENLIGHTENED pl_nudge_player" onclick="window.chat.nicknameClicked(event, 'anotherplayer')">@anotherplayer</span>!
</td>
</tr>
<!-- Public chat with highlight-->
<tr>
<td>
<div class="pl_nudge_date"> <!-- additional div -->
<time title="2020-12-16 17:54:37<small class="milliseconds">.447</small>" data-timestamp="1608137677447">17:54</time>
</div>
<!-- div for decoration -->
<div class="pl_nudge_pointy_spacer"></div>
</td>
<td>
<span class="invisep"><</span>
<mark class="nickname" style="cursor:pointer; color:#0088FF">aplayer</mark>
<span class="invisep">></span>
</td>
<td>
<span style="color: #ff6; background-color: #550">[public]</span>
<span class="pl_nudge_me" onclick="window.chat.nicknameClicked(event, 'LeJeu')">@LeJeu</span>
</td>
</tr>
<!-- Faction chat with highlight-->
<tr>
<td>
<!-- divs for highlight -->
<div class="pl_nudge_date">
<time title="2020-12-24 17:26:08<small class="milliseconds">.502</small>" data-timestamp="1608827168502">17:26</time>
</div>
<div class="pl_nudge_pointy_spacer"></div>
</td>
<td>
<span class="invisep"><</span>
<mark class="nickname" style="cursor:pointer; color:#fd6">LeJeu</mark>
<span class="invisep">></span>
</td>
<td>
<!-- span for chat type prefix -->
<span style="color: #f88; background-color: #500;">[faction]</span>
a <span class="pl_nudge_me" onclick="window.chat.nicknameClicked(event, 'LeJeu')">@LeJeu</span> z
</td>
</tr>
<!-- Narrowcast -->
<tr>
<td>
<time title="2020-12-15 17:46:05<small class="milliseconds">.609</small>" data-timestamp="1608050765609">17:46</time>
</td>
<td>
<span class="invisep"><</span>
<mark class="nickname" style="cursor:pointer; color:#0088FF">GrfnRgx</mark><span class="invisep">></span>
</td>
<td>
<!-- Additional div -->
<div class="system_narrowcast">
Your Portal <a onclick="window.selectPortalByLatLng(49.013188, 1.372882);return false" title="19 Rue Dupont de l'Eure, 27120 Pacy-sur-Eure, France" href="/?pll=49.013188,1.372882" class="help">Pacy - Jeux de l'étang Taron</a> neutralized by GrfnRgx
</div>
</td>
</tr>
</table>
</div>
<div id="chatfaction">
<table>
<!-- faction chat with highlight -->
<tr>
<td>
<div class="pl_nudge_date">
<time title="2020-12-24 17:26:08<small class="milliseconds">.502</small>" data-timestamp="1608827168502">17:26</time>
</div>
<div class="pl_nudge_pointy_spacer"></div>
</td>
<td>
<span class="invisep"><</span>
<mark class="nickname" style="cursor:pointer; color:#fd6">LeJeu</mark>
<span class="invisep">></span>
</td>
<td>
<!-- no prefix -->
a <span class="pl_nudge_me" onclick="window.chat.nicknameClicked(event, 'LeJeu')">@LeJeu</span> z</td>
</tr>
</table>
</div>
<div id="chatalerts">
<table>
<!-- Public chat with highlight-->
<!-- faction chat with highlight -->
<!-- Narrowcast -->
<!-- same as chatall -->
</table>
</div>
</div> After <!-- tr.class is `public`/`faction` for chat, undef for agent actions and private messages (narrowcast) whatever the tab -->
<tr data-guid="cc0a4d0ce5ea4087a2edd007e9700a64.d" class="">
<!-- time.class is `pl_nudge_date` in case of chat highlight -->
<td><time class="" title="2020-12-22 11:22:22<small class="milliseconds">.675</small>" data-timestamp="1608632542675">11:22</time></td>
<td>
<span class="invisep"><</span>
<mark class="nickname enl">APlayer</mark>
<span class="invisep">></span>
</td>
<!-- msg content (td).class is `system_narrowcast` for private messages (alert/kinectic capsule/scoot/etc) -->
<td class=""> deployed a Resonator on <a onclick="window.selectPortalByLatLng(40.123456, 1.789012);return false" title="26 Avenue de la Liberté, 01234 Free, France" href="/?pll=40.123456,1.789012" class="help">a portal</a></td>
</tr> That is: [public]/[faction] are CSS controlled instead of added to the html, and message decoration is handled thanks to CSS classes on TR/TD instead of wrapping |
66caaa5
to
ff22075
Compare
What is benefit? |
stability, this is how stock intel works, and is consistent with last seen guid (oldest/newest) |
plextType === PLAYER_GENERATED
Is this PR ready?
Are you going to complete ideas list? |
This branch is on top of #409 PR
The aim is to rewrite part of
chat.js
for better code quality and easier customization (plugins/style)Atm:
plext.categories
to determine if the message is public/secure and is an alertwriteDataToHash
torenderMsg
style.css
:before
and:after
for[public]/[secure]
decoration and agent messages alertChanges that may break some plugins/style:
chat.renderMsg
first parameter is not the formatted message but the markup from raw data<div>
to apply specific rules)chat.renderData(...)
takes astorageHash
as first parameter (instead ofstorageHash.data
)Global changes:
!important
from some css rules (.enl
.res
.nickname
)Idea: