| ︙ | | | ︙ | |
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
hashtag:{
activeTag: undefined,
match: function(tag){
return !this.activeTag || tag===this.activeTag;
},
matchElem: function(e){
return !this.activeTag
|| !!e.querySelector('[data-hashtag='+this.activeTag+']');
}
},
current: undefined/*gets set to current active filter*/
},
/** Gets (no args) or sets (1 arg) the current input text field value,
taking into account single- vs multi-line input. The getter returns
a string and the setter returns this object. */
|
|
|
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
hashtag:{
activeTag: undefined,
match: function(tag){
return !this.activeTag || tag===this.activeTag;
},
matchElem: function(e){
return !this.activeTag
|| !!e.querySelector('[data-hashtag="'+this.activeTag+'"]');
}
},
current: undefined/*gets set to current active filter*/
},
/** Gets (no args) or sets (1 arg) the current input text field value,
taking into account single- vs multi-line input. The getter returns
a string and the setter returns this object. */
|
| ︙ | | | ︙ | |
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
|
/** To be passed each MessageWidget's top-level DOM element
after initial processing of the message, to set up
hashtag references. */
const setupHashtags = function f(elem){
if(!f.$click){
f.$click = function(ev){
const tag = ev.target.dataset.hashtag;
if(tag){
Chat.setHashtagFilter(
tag===Chat.filter.hashtag.activeTag
? false : tag
);
}
};
}
elem.querySelectorAll('[data-hashtag]').forEach(function(e){
e.dataset.hashtag = e.dataset.hashtag.toLowerCase();
e.addEventListener('click', f.$click, false);
})
};
/**
Custom widget type for rendering messages (one message per
instance). These are modelled after FIELDSET elements but we
don't use FIELDSET because of cross-browser inconsistencies in
features of the FIELDSET/LEGEND combination, e.g. inability to
align legends via CSS in Firefox and clicking-related
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
<
>
>
>
>
|
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
|
/** To be passed each MessageWidget's top-level DOM element
after initial processing of the message, to set up
hashtag references. */
const setupHashtags = function f(elem){
if(!f.$click){
f.$click = function(ev){
/* Click handler for hashtags */
const tag = ev.target.dataset.hashtag;
if(tag){
Chat.setHashtagFilter(
tag===Chat.filter.hashtag.activeTag
? false : tag
);
}
};
f.$clickNum = function(ev){
/* Click handler for #NNN references */
const tag = ev.target.dataset.numtag;
if(tag){
const e = Chat.e.viewMessages.querySelector(
'.message-widget[data-msgid="'+tag+'"]'
);
if(e){
Chat.MessageWidget.scrollToMessageElem(e);
}else{
F.toast.warning("Message #"+tag+" not found in loaded messages.");
}
}
};
}
elem.querySelectorAll('[data-hashtag]').forEach(function(e){
e.dataset.hashtag = e.dataset.hashtag.toLowerCase();
e.addEventListener('click', f.$click, false);
})
elem.querySelectorAll('[data-numtag]').forEach(
(e)=>e.addEventListener('click', f.$clickNum, false)
)
}/*setupHashtags()*/;
/**
Custom widget type for rendering messages (one message per
instance). These are modelled after FIELDSET elements but we
don't use FIELDSET because of cross-browser inconsistencies in
features of the FIELDSET/LEGEND combination, e.g. inability to
align legends via CSS in Firefox and clicking-related
|
| ︙ | | | ︙ | |
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
|
D.append(
D.addClass(D.div(), 'toolbar'),
D.button(
"Message in context",
function(){
self.hide();
Chat.clearFilters();
eMsg.scrollIntoView(false);
Chat.animate(eMsg.firstElementChild, 'anim-flip-h');
})
)
);
}/*jump-to button*/
}
const tab = eMsg.querySelector('.message-widget-tab');
D.append(tab, this.e);
|
|
<
|
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
|
D.append(
D.addClass(D.div(), 'toolbar'),
D.button(
"Message in context",
function(){
self.hide();
Chat.clearFilters();
Chat.MessageWidget.scrollToMessageElem(eMsg);
})
)
);
}/*jump-to button*/
}
const tab = eMsg.querySelector('.message-widget-tab');
D.append(tab, this.e);
|
| ︙ | | | ︙ | |
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
|
}/*end static init*/
let theMsg = ev.target;
while( theMsg && !theMsg.classList.contains('message-widget')){
theMsg = theMsg.parentNode;
}
if(theMsg) f.popup.show(theMsg);
}/*_handleLegendClicked()*/
};
return cf;
})()/*MessageWidget*/;
const BlobXferState = (function(){/*drag/drop bits...*/
/* State for paste and drag/drop */
const bxs = {
|
>
>
>
>
>
>
>
>
>
>
|
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
|
}/*end static init*/
let theMsg = ev.target;
while( theMsg && !theMsg.classList.contains('message-widget')){
theMsg = theMsg.parentNode;
}
if(theMsg) f.popup.show(theMsg);
}/*_handleLegendClicked()*/
}/*MessageWidget.prototype*/;
/** Assumes that e is a MessageWidget element, ensures that
Chat.e.viewMessages is visible, scrolls the message,
and animates it a bit to make it more visible. */
cf.scrollToMessageElem = function(e){
if(e.firstElementChild){
Chat.setCurrentView(Chat.e.viewMessages);
e.scrollIntoView(false);
Chat.animate(e.firstElementChild, 'anim-flip-h');
}
};
return cf;
})()/*MessageWidget*/;
const BlobXferState = (function(){/*drag/drop bits...*/
/* State for paste and drag/drop */
const bxs = {
|
| ︙ | | | ︙ | |