264
265
266
267
268
269
270
271
272
273
274
275
276
277
|
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
|
+
|
Returns F.toast.
*/
const toastImpl = function f(cssClass, durationMult, argsObject){
if(!f.toaster){
f.toaster = new F.PopupWidget({
cssClass: 'fossil-toast-message'
});
D.attr(f.toaster.e, 'role', 'alert');
}
const T = f.toaster;
if(f._timer) clearTimeout(f._timer);
D.clearElement(T.e);
if(f._prevCssClass) T.e.classList.remove(f._prevCssClass);
if(cssClass) T.e.classList.add(cssClass);
f._prevCssClass = cssClass;
|
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
|
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
|
F.toast = {
config: {
position: { x: 5, y: 5 /*viewport-relative, pixels*/ },
displayTimeMs: 3000
},
/**
Convenience wrapper around a PopupWidget which pops up a shared
PopupWidget instance to show toast-style messages (commonly seen
on Android). Its arguments may be anything suitable for passing
to fossil.dom.append(), and each argument is first append()ed to
the toast widget, then the widget is shown for
F.toast.config.displayTimeMs milliseconds. This is called while
a toast is currently being displayed, the first will be overwritten
and the time until the message is hidden will be reset.
PopupWidget instance to show toast-style messages (commonly
seen on Android). Its arguments may be anything suitable for
passing to fossil.dom.append(), and each argument is first
append()ed to the toast widget, then the widget is shown for
F.toast.config.displayTimeMs milliseconds. If this is called
while a toast is currently being displayed, the first will be
overwritten and the time until the message is hidden will be
reset.
The toast is always shown at the viewport-relative coordinates
defined by the F.toast.config.position.
The toaster's DOM element has the CSS classes fossil-tooltip
and fossil-toast, so can be style via those.
The toaster's DOM element has the CSS class fossil-tooltip
and fossil-toast-message, so can be style via those.
The 3 main message types (message, warning, error) each get a
CSS class with that same name added to them. Thus CSS can
select on .fossil-toast-message.error to style error toasts.
*/
message: function(/*...*/){
return toastImpl(false,1, arguments);
},
/**
Displays a toast with the 'warning' CSS class assigned to it. It
displays for 1.5 times as long as a normal toast.
|