Skip to content

Commit 948bac5

Browse files
committed
Add all remaining comments
1 parent f2c3424 commit 948bac5

File tree

1 file changed

+88
-11
lines changed

1 file changed

+88
-11
lines changed

index.d.ts

Lines changed: 88 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -320,67 +320,131 @@ declare global {
320320
}
321321

322322
interface RealtimeInfo {
323+
/** Whether to listen to active questions via the websocket */
323324
active: boolean;
325+
/** Whether to listen to new questions via the websocket */
324326
newest: boolean;
327+
/** Whether to listen to tag-related websocket events */
325328
tagged: boolean;
329+
/** Number of hours to disconnect websocket connection if it is stale */
326330
staleDisconnectIntervalInHours: number;
327331
}
328332

329333
interface SiteInfo {
330-
childUrl: string;
334+
/** The meta site that corresponds to the current main one (doesn't exist if the current site is a meta site) */
335+
childUrl?: string;
336+
/** The domain of the cookies SE uses */
331337
cookieDomain: string;
338+
/** A short description of the site */
332339
description: string;
340+
/** Whether to show a warning if a new tag is about to be created */
333341
enableNewTagCreationWarning: boolean;
342+
/** Whether to enable social media sharing in the "Share" popup */
334343
enableSocialMediaInSharePopup: boolean;
344+
/** The current site's id */
335345
id: number;
346+
/** Whether to insert a space after the auto-completed name of a user in the comment box */
336347
insertSpaceAfterNameTabCompletion: boolean;
337-
isNoticesTabEnabled: boolean;
348+
/** Whether the current site is the meta site of a main one */
349+
isChildMeta?: boolean;
350+
/** Whether the current site is a meta site */
351+
isMetaSite?: boolean;
352+
isNoticesTabEnabled: boolean; // unused?
353+
/** The current site's name */
338354
name: string;
339-
negativeVoteScoreFloor: null;
355+
/** Used to normalise a post's score. */
356+
negativeVoteScoreFloor: number | null;
357+
/** The main's site URL, only exists if isChildMeta is true */
358+
parentUrl?: string;
359+
/** The current site's protocol */
340360
protocol: "http" | "https";
361+
/** Whether to highlight the code using highlight.js in the current site */
341362
styleCodeWithHighlightjs: boolean;
342363
}
343364

344365
interface JobPreferences {
366+
/** Maximum number of developer roles */
345367
maxNumDeveloperRoles: number;
368+
/** Maximum number of industries */
346369
maxNumIndustries: number;
347370
}
348371

349372
interface Story {
373+
/** Max length of disliked technologies */
350374
dislikedTagsMaxLength: number;
375+
/** Max length of disliked technologies */
351376
likedTagsMaxLength: number;
377+
/** The minimum body length of various description textareas */
352378
minCompleteBodyLength: number;
353379
}
354380

355381
interface Events {
356-
postEditionSection: { title: 1; body: 2; tags: 3 };
357-
postType: { question: 1 };
382+
postEditionSection: {
383+
title: 1;
384+
body: 2;
385+
tags: 3
386+
};
387+
postType: {
388+
question: 1
389+
};
358390
}
359391

360392
const options: {
393+
/** Information about the current user */
361394
user: UserInfo;
395+
/** Current user's job preferences */
362396
jobPreferences: JobPreferences;
397+
/** The language code of the locale */
363398
locale: string;
399+
/** The hostname of Meta StackExchange */
364400
networkMetaHostname: string;
401+
/** Websocket-related constants */
365402
realtime: RealtimeInfo;
403+
/** The route name of the current page (e.g. Home/Index) */
366404
routeName: string;
405+
/** The Unix epoch time in seconds */
367406
serverTime: number;
407+
/** Server's time offset in seconds */
368408
serverTimeOffsetSec: number;
409+
/** Event-related constants */
369410
events: Events;
411+
/** Information about the current site */
370412
site: SiteInfo;
413+
/** Constants regarding the user's bio */
371414
story: Story;
415+
/** StackExchange's SVGs hash */
372416
svgIconHash: string;
417+
/** The remote URL StackExchange fetches the SVGs from */
373418
svgIconPath: string;
374419
};
375420

376421
const comments: {
377-
uiForPost(comments: JQuery): {
378-
addShow(value1: boolean, value2: boolean): void;
422+
/**
423+
* Useful helpers related to a post's comments
424+
* @param elOrJQueryOrSelector The comments container HTML element, selector or jQuery object
425+
*/
426+
uiForPost(elOrJQueryOrSelector: string | JQuery | HTMLDivElement): {
427+
/**
428+
* Show all hidden comments (if any)
429+
* @param noFocus If true, the input won't be focused
430+
* @param shouldRenderAddForm Whether to show the "Add a comment" textarea
431+
*/
432+
addShow(
433+
noFocus: boolean,
434+
shouldRenderAddForm: boolean
435+
): void;
436+
/**
437+
*
438+
* @param htmlOrJQuery The new comments as an HTML string or a jQuery object
439+
* @param submittedEditCommentId The submitted comment id (if one has been posted)
440+
* @param noHighlighting If true, the unhidden comments won't be highlighted
441+
* @param noScrolling Whether to scroll to the comments container
442+
*/
379443
showComments(
380-
value1: string,
381-
value2: string | null,
382-
value3: boolean,
383-
value4: boolean
444+
htmlOrJQuery: string | JQuery,
445+
submittedEditCommentId: string | null,
446+
noHighlighting: boolean,
447+
noScrolling: boolean
384448
): void;
385449
};
386450
};
@@ -398,31 +462,44 @@ declare global {
398462
};
399463

400464
interface AccountSettings {
465+
/** Whether the current account's password is required for changing Stack id password */
401466
currentPasswordRequiredForChangingStackIdPassword: boolean;
402467
}
403468

404469
interface FlagSettings {
470+
/** Whether retracting comment flags is allowed */
405471
allowRetractingCommentFlags: boolean;
472+
/** Whether retracting post flags is allowed */
406473
allowRetractingFlags: boolean;
407474
}
408475

409476
interface MarkdownSettings {
477+
/** Whether table formatting is allowed */
410478
enableTables: boolean;
411479
}
412480

413481
interface SiteSettings {
482+
/** Whether image uploads are allowed */
414483
allowImageUploads: boolean;
484+
/** Whether imgur HTTPS is enabled */
415485
enableImgurHttps: boolean;
486+
/** Whether expanded user cards are enabled */
416487
enableUserHovercards: boolean;
488+
/** Whether to force HTTPS on images */
417489
forceHttpsImages: boolean;
490+
/** Whether to highlight the code */
418491
styleCode: boolean;
419492
}
420493

421494
/** Site settings */
422495
const settings: {
496+
/** Constants related to the current StackExchange account */
423497
accounts: AccountSettings;
498+
/** Constants related to flags */
424499
flags: FlagSettings;
500+
/** Constants related to the markdown parser */
425501
markdown: MarkdownSettings;
502+
/** Constants related to the current site */
426503
site: SiteSettings;
427504
};
428505
}

0 commit comments

Comments
 (0)