Telethon/js/search.js

245 lines
177 KiB
JavaScript
Raw Normal View History

2016-08-26 13:58:53 +03:00
root = document.getElementById("main_div");
root.innerHTML = `
<!-- You can append '?q=query' to the URL to default to a search -->
<input id="searchBox" type="text" onkeyup="updateSearch(event)"
placeholder="Search for requests and types…" />
<div id="searchDiv">
<div id="exactMatch" style="display:none;">
<b>Exact match:</b>
<ul id="exactList" class="together">
</ul>
</div>
<details id="methods" open><summary class="title">Methods (<span id="methodsCount">0</span>)</summary>
<ul id="methodsList" class="together">
</ul>
</details>
<details id="types" open><summary class="title">Types (<span id="typesCount">0</span>)</summary>
<ul id="typesList" class="together">
</ul>
</details>
<details id="constructors"><summary class="title">Constructors (<span id="constructorsCount">0</span>)</summary>
<ul id="constructorsList" class="together">
</ul>
</details>
</div>
<div id="contentDiv">
` + root.innerHTML + "</div>";
// HTML modified, now load documents
contentDiv = document.getElementById("contentDiv");
searchDiv = document.getElementById("searchDiv");
searchBox = document.getElementById("searchBox");
// Search lists
methodsDetails = document.getElementById("methods");
methodsList = document.getElementById("methodsList");
methodsCount = document.getElementById("methodsCount");
typesDetails = document.getElementById("types");
typesList = document.getElementById("typesList");
typesCount = document.getElementById("typesCount");
constructorsDetails = document.getElementById("constructors");
constructorsList = document.getElementById("constructorsList");
constructorsCount = document.getElementById("constructorsCount");
// Exact match
exactMatch = document.getElementById("exactMatch");
exactList = document.getElementById("exactList");
try {
requests = ["AcceptAuthorizationRequest", "AcceptCallRequest", "AcceptContactRequest", "AcceptEncryptionRequest", "AcceptLoginTokenRequest", "AcceptTermsOfServiceRequest", "AcceptUrlAuthRequest", "ActivateStealthModeRequest", "AddChatUserRequest", "AddContactRequest", "AddPreviewMediaRequest", "AddStickerToSetRequest", "AllowSendMessageRequest", "AnswerWebhookJSONQueryRequest", "ApplyBoostRequest", "ApplyGiftCodeRequest", "AssignAppStoreTransactionRequest", "AssignPlayMarketTransactionRequest", "BindTempAuthKeyRequest", "BlockRequest", "BlockFromRepliesRequest", "CanPurchasePremiumRequest", "CanSendMessageRequest", "CanSendStoryRequest", "CancelCodeRequest", "CancelPasswordEmailRequest", "ChangeAuthorizationSettingsRequest", "ChangePhoneRequest", "ChangeStarsSubscriptionRequest", "ChangeStickerRequest", "ChangeStickerPositionRequest", "CheckChatInviteRequest", "CheckChatlistInviteRequest", "CheckGiftCodeRequest", "CheckGroupCallRequest", "CheckHistoryImportRequest", "CheckHistoryImportPeerRequest", "CheckPasswordRequest", "CheckQuickReplyShortcutRequest", "CheckRecoveryPasswordRequest", "CheckShortNameRequest", "account.CheckUsernameRequest", "channels.CheckUsernameRequest", "ClearAllDraftsRequest", "ClearRecentEmojiStatusesRequest", "ClearRecentReactionsRequest", "ClearRecentStickersRequest", "ClearSavedInfoRequest", "ClickSponsoredMessageRequest", "ConfirmCallRequest", "ConfirmPasswordEmailRequest", "ConfirmPhoneRequest", "ConvertToGigagroupRequest", "CreateBusinessChatLinkRequest", "CreateChannelRequest", "CreateChatRequest", "CreateForumTopicRequest", "CreateGroupCallRequest", "CreateStickerSetRequest", "CreateThemeRequest", "DeactivateAllUsernamesRequest", "DeclinePasswordResetRequest", "DeleteAccountRequest", "DeleteAutoSaveExceptionsRequest", "DeleteBusinessChatLinkRequest", "DeleteByPhonesRequest", "DeleteChannelRequest", "DeleteChatRequest", "DeleteChatUserRequest", "DeleteContactsRequest", "DeleteExportedChatInviteRequest", "DeleteExportedInviteRequest", "DeleteFactCheckRequest", "messages.DeleteHistoryRequest", "channels.DeleteHistoryRequest", "messages.DeleteMessagesRequest", "channels.DeleteMessagesRequest", "DeleteParticipantHistoryRequest", "DeletePhoneCallHistoryRequest", "DeletePhotosRequest", "DeletePreviewMediaRequest", "DeleteQuickReplyMessagesRequest", "DeleteQuickReplyShortcutRequest", "DeleteRevokedExportedChatInvitesRequest", "DeleteSavedHistoryRequest", "DeleteScheduledMessagesRequest", "DeleteSecureValueRequest", "DeleteStickerSetRequest", "DeleteStoriesRequest", "DeleteTopicHistoryRequest", "DestroyAuthKeyRequest", "DestroySessionRequest", "DisablePeerConnectedBotRequest", "DiscardCallRequest", "DiscardEncryptionRequest", "DiscardGroupCallRequest", "DismissSuggestionRequest", "DropTempAuthKeysRequest", "EditAdminRequest", "EditBannedRequest", "EditBusinessChatLinkRequest", "EditChatAboutRequest", "EditChatAdminRequest", "EditChatDefaultBannedRightsRequest", "EditChatPhotoRequest", "EditChatTitleRequest", "EditCloseFriendsRequest", "EditCreatorRequest", "EditExportedChatInviteRequest", "EditExportedInviteRequest", "EditFactCheckRequest", "EditForumTopicRequest", "EditGroupCallParticipantRequest", "EditGroupCallTitleRequest", "EditInlineBotMessageRequest", "EditLocationRequest", "EditMessageRequest", "EditPeerFoldersRequest", "EditPhotoRequest", "EditPreviewMediaRequest", "EditQuickReplyShortcutRequest", "EditStoryRequest", "EditTitleRequest", "EditUserInfoRequest", "ExportAuthorizationRequest", "ExportChatInviteRequest", "ExportChatlistInviteRequest", "ExportContactTokenRequest", "ExportGroupCallInviteRequest", "ExportInvoiceRequest", "ExportLoginTokenRequest", "ExportMessageLinkRequest", "ExportStoryLinkRequest", "FaveStickerRequest", "FinishJobRequest", "FinishTakeoutSessionRequest", "ForwardMessagesRequest", "FulfillStarsSubscriptionRequest", "GetAccountTTLRequest", "GetAdminLogRequest", "GetAdminedPublicChannelsRequest", "GetAdminsWithInvitesRequest", "GetAllDraftsRequest", "GetAllReadPeerStoriesRequest", "GetAllSecureValuesRequest", "GetAllStickersRequest", "GetAllStoriesRequest", "Get
types = ["AccessPointRule", "AccountDaysTTL", "AttachMenuBot", "AttachMenuBotIcon", "AttachMenuBotIconColor", "AttachMenuBots", "AttachMenuBotsBot", "AttachMenuPeerType", "Authorization", "AutoDownloadSettings", "AutoSaveException", "AutoSaveSettings", "AvailableEffect", "AvailableReaction", "BadMsgNotification", "BankCardOpenUrl", "BaseTheme", "BindAuthKeyInner", "Birthday", "Bool", "Boost", "BotApp", "BotBusinessConnection", "BotCommand", "BotCommandScope", "BotInfo", "BotInlineMessage", "BotInlineResult", "BotMenuButton", "BotPreviewMedia", "BroadcastRevenueBalances", "BroadcastRevenueTransaction", "BusinessAwayMessage", "BusinessAwayMessageSchedule", "BusinessBotRecipients", "BusinessChatLink", "BusinessGreetingMessage", "BusinessIntro", "BusinessLocation", "BusinessRecipients", "BusinessWeeklyOpen", "BusinessWorkHours", "CdnConfig", "CdnPublicKey", "ChannelAdminLogEvent", "ChannelAdminLogEventAction", "ChannelAdminLogEventsFilter", "ChannelLocation", "ChannelMessagesFilter", "ChannelParticipant", "ChannelParticipantsFilter", "Chat", "ChatAdminRights", "ChatAdminWithInvites", "ChatBannedRights", "ChatFull", "ChatInvite", "ChatInviteImporter", "ChatOnlines", "ChatParticipant", "ChatParticipants", "ChatPhoto", "ChatReactions", "Client_DH_Inner_Data", "CodeSettings", "Config", "ConnectedBot", "Contact", "ContactBirthday", "ContactStatus", "DataJSON", "DcOption", "DefaultHistoryTTL", "DestroyAuthKeyRes", "DestroySessionRes", "Dialog", "DialogFilter", "DialogFilterSuggested", "DialogPeer", "Document", "DocumentAttribute", "DraftMessage", "EmailVerification", "EmailVerifyPurpose", "EmojiGroup", "EmojiKeyword", "EmojiKeywordsDifference", "EmojiLanguage", "EmojiList", "EmojiStatus", "EmojiURL", "EncryptedChat", "EncryptedFile", "EncryptedMessage", "ExportedChatInvite", "ExportedChatlistInvite", "ExportedContactToken", "ExportedMessageLink", "ExportedStoryLink", "FactCheck", "FileHash", "Folder", "FolderPeer", "ForumTopic", "FoundStory", "FutureSalt", "FutureSalts", "Game", "GeoPoint", "GeoPointAddress", "GlobalPrivacySettings", "GroupCall", "GroupCallParticipant", "GroupCallParticipantVideo", "GroupCallParticipantVideoSourceGroup", "GroupCallStreamChannel", "HighScore", "HttpWait", "ImportedContact", "InlineBotSwitchPM", "InlineBotWebView", "InlineQueryPeerType", "InputAppEvent", "InputBotApp", "InputBotInlineMessage", "InputBotInlineMessageID", "InputBotInlineResult", "InputBusinessAwayMessage", "InputBusinessBotRecipients", "InputBusinessChatLink", "InputBusinessGreetingMessage", "InputBusinessIntro", "InputBusinessRecipients", "InputChannel", "InputChatPhoto", "InputChatlist", "InputCheckPasswordSRP", "InputClientProxy", "InputCollectible", "InputContact", "InputDialogPeer", "InputDocument", "InputEncryptedChat", "InputEncryptedFile", "InputFile", "InputFileLocation", "InputFolderPeer", "InputGame", "InputGeoPoint", "InputGroupCall", "InputInvoice", "InputMedia", "InputMessage", "InputNotifyPeer", "InputPaymentCredentials", "InputPeer", "InputPeerNotifySettings", "InputPhoneCall", "InputPhoto", "InputPrivacyKey", "InputPrivacyRule", "InputQuickReplyShortcut", "InputReplyTo", "InputSecureFile", "InputSecureValue", "InputSingleMedia", "InputStarsTransaction", "InputStickerSet", "InputStickerSetItem", "InputStickeredMedia", "InputStorePaymentPurpose", "InputTheme", "InputThemeSettings", "InputUser", "InputWallPaper", "InputWebDocument", "InputWebFileLocation", "Invoice", "IpPort", "JSONObjectValue", "JSONValue", "KeyboardButton", "KeyboardButtonRow", "LabeledPrice", "LangPackDifference", "LangPackLanguage", "LangPackString", "MaskCoords", "MediaArea", "MediaAreaCoordinates", "Message", "MessageAction", "MessageEntity", "MessageExtendedMedia", "MessageFwdHeader", "MessageMedia", "MessagePeerReaction", "MessagePeerVote", "MessageRange", "MessageReactions", "MessageReactor", "MessageReplies", "MessageReplyHeader", "MessageViews", "MessagesFilter", "MissingInvitee", "MsgDetailedInfo", "MsgResendReq", "MsgsAck", "MsgsAllInfo", "MsgsStateInfo", "MsgsStateReq", "MyBoost", "NearestDc", "NewSession", "NotificationSound", "Notify
constructors = ["AccessPointRule", "AccountDaysTTL", "AdminLogResults", "AffectedFoundMessages", "AffectedHistory", "AffectedMessages", "AllStickers", "AllStickersNotModified", "AllStories", "AllStoriesNotModified", "AppConfig", "AppConfigNotModified", "AppUpdate", "ArchivedStickers", "AttachMenuBot", "AttachMenuBotIcon", "AttachMenuBotIconColor", "AttachMenuBots", "AttachMenuBotsBot", "AttachMenuBotsNotModified", "AttachMenuPeerTypeBotPM", "AttachMenuPeerTypeBroadcast", "AttachMenuPeerTypeChat", "AttachMenuPeerTypePM", "AttachMenuPeerTypeSameBotPM", "auth.Authorization", "Authorization", "AuthorizationForm", "AuthorizationSignUpRequired", "Authorizations", "AutoDownloadSettings", "account.AutoDownloadSettings", "AutoSaveException", "AutoSaveSettings", "account.AutoSaveSettings", "AvailableEffect", "AvailableEffects", "AvailableEffectsNotModified", "AvailableReaction", "AvailableReactions", "AvailableReactionsNotModified", "BadMsgNotification", "BadServerSalt", "BankCardData", "BankCardOpenUrl", "BaseThemeArctic", "BaseThemeClassic", "BaseThemeDay", "BaseThemeNight", "BaseThemeTinted", "BindAuthKeyInner", "Birthday", "Blocked", "BlockedSlice", "Boost", "BoostsList", "BoostsStatus", "BotApp", "messages.BotApp", "BotAppNotModified", "BotBusinessConnection", "BotCallbackAnswer", "BotCommand", "BotCommandScopeChatAdmins", "BotCommandScopeChats", "BotCommandScopeDefault", "BotCommandScopePeer", "BotCommandScopePeerAdmins", "BotCommandScopePeerUser", "BotCommandScopeUsers", "BotInfo", "bots.BotInfo", "BotInlineMediaResult", "BotInlineMessageMediaAuto", "BotInlineMessageMediaContact", "BotInlineMessageMediaGeo", "BotInlineMessageMediaInvoice", "BotInlineMessageMediaVenue", "BotInlineMessageMediaWebPage", "BotInlineMessageText", "BotInlineResult", "BotMenuButton", "BotMenuButtonCommands", "BotMenuButtonDefault", "BotPreviewMedia", "BotResults", "BroadcastRevenueBalances", "BroadcastRevenueStats", "BroadcastRevenueTransactionProceeds", "BroadcastRevenueTransactionRefund", "BroadcastRevenueTransactionWithdrawal", "BroadcastRevenueTransactions", "BroadcastRevenueWithdrawalUrl", "BroadcastStats", "BusinessAwayMessage", "BusinessAwayMessageScheduleAlways", "BusinessAwayMessageScheduleCustom", "BusinessAwayMessageScheduleOutsideWorkHours", "BusinessBotRecipients", "BusinessChatLink", "BusinessChatLinks", "BusinessGreetingMessage", "BusinessIntro", "BusinessLocation", "BusinessRecipients", "BusinessWeeklyOpen", "BusinessWorkHours", "CdnConfig", "CdnFile", "CdnFileReuploadNeeded", "CdnPublicKey", "Channel", "ChannelAdminLogEvent", "ChannelAdminLogEventActionChangeAbout", "ChannelAdminLogEventActionChangeAvailableReactions", "ChannelAdminLogEventActionChangeEmojiStatus", "ChannelAdminLogEventActionChangeEmojiStickerSet", "ChannelAdminLogEventActionChangeHistoryTTL", "ChannelAdminLogEventActionChangeLinkedChat", "ChannelAdminLogEventActionChangeLocation", "ChannelAdminLogEventActionChangePeerColor", "ChannelAdminLogEventActionChangePhoto", "ChannelAdminLogEventActionChangeProfilePeerColor", "ChannelAdminLogEventActionChangeStickerSet", "ChannelAdminLogEventActionChangeTitle", "ChannelAdminLogEventActionChangeUsername", "ChannelAdminLogEventActionChangeUsernames", "ChannelAdminLogEventActionChangeWallpaper", "ChannelAdminLogEventActionCreateTopic", "ChannelAdminLogEventActionDefaultBannedRights", "ChannelAdminLogEventActionDeleteMessage", "ChannelAdminLogEventActionDeleteTopic", "ChannelAdminLogEventActionDiscardGroupCall", "ChannelAdminLogEventActionEditMessage", "ChannelAdminLogEventActionEditTopic", "ChannelAdminLogEventActionExportedInviteDelete", "ChannelAdminLogEventActionExportedInviteEdit", "ChannelAdminLogEventActionExportedInviteRevoke", "ChannelAdminLogEventActionParticipantInvite", "ChannelAdminLogEventActionParticipantJoin", "ChannelAdminLogEventActionParticipantJoinByInvite", "ChannelAdminLogEventActionParticipantJoinByRequest", "ChannelAdminLogEventActionParticipantLeave", "ChannelAdminLogEventActionParticipantMute", "ChannelAdminLogEventActionParticipantSubExtend", "ChannelAdminLogEventActionParticipantToggleAdmin", "C
requestsu = ["methods/account/accept_authorization.html", "methods/phone/accept_call.html", "methods/contacts/accept_contact.html", "methods/messages/accept_encryption.html", "methods/auth/accept_login_token.html", "methods/help/accept_terms_of_service.html", "methods/messages/accept_url_auth.html", "methods/stories/activate_stealth_mode.html", "methods/messages/add_chat_user.html", "methods/contacts/add_contact.html", "methods/bots/add_preview_media.html", "methods/stickers/add_sticker_to_set.html", "methods/bots/allow_send_message.html", "methods/bots/answer_webhook_json_query.html", "methods/premium/apply_boost.html", "methods/payments/apply_gift_code.html", "methods/payments/assign_app_store_transaction.html", "methods/payments/assign_play_market_transaction.html", "methods/auth/bind_temp_auth_key.html", "methods/contacts/block.html", "methods/contacts/block_from_replies.html", "methods/payments/can_purchase_premium.html", "methods/bots/can_send_message.html", "methods/stories/can_send_story.html", "methods/auth/cancel_code.html", "methods/account/cancel_password_email.html", "methods/account/change_authorization_settings.html", "methods/account/change_phone.html", "methods/payments/change_stars_subscription.html", "methods/stickers/change_sticker.html", "methods/stickers/change_sticker_position.html", "methods/messages/check_chat_invite.html", "methods/chatlists/check_chatlist_invite.html", "methods/payments/check_gift_code.html", "methods/phone/check_group_call.html", "methods/messages/check_history_import.html", "methods/messages/check_history_import_peer.html", "methods/auth/check_password.html", "methods/messages/check_quick_reply_shortcut.html", "methods/auth/check_recovery_password.html", "methods/stickers/check_short_name.html", "methods/account/check_username.html", "methods/channels/check_username.html", "methods/messages/clear_all_drafts.html", "methods/account/clear_recent_emoji_statuses.html", "methods/messages/clear_recent_reactions.html", "methods/messages/clear_recent_stickers.html", "methods/payments/clear_saved_info.html", "methods/channels/click_sponsored_message.html", "methods/phone/confirm_call.html", "methods/account/confirm_password_email.html", "methods/account/confirm_phone.html", "methods/channels/convert_to_gigagroup.html", "methods/account/create_business_chat_link.html", "methods/channels/create_channel.html", "methods/messages/create_chat.html", "methods/channels/create_forum_topic.html", "methods/phone/create_group_call.html", "methods/stickers/create_sticker_set.html", "methods/account/create_theme.html", "methods/channels/deactivate_all_usernames.html", "methods/account/decline_password_reset.html", "methods/account/delete_account.html", "methods/account/delete_auto_save_exceptions.html", "methods/account/delete_business_chat_link.html", "methods/contacts/delete_by_phones.html", "methods/channels/delete_channel.html", "methods/messages/delete_chat.html", "methods/messages/delete_chat_user.html", "methods/contacts/delete_contacts.html", "methods/messages/delete_exported_chat_invite.html", "methods/chatlists/delete_exported_invite.html", "methods/messages/delete_fact_check.html", "methods/messages/delete_history.html", "methods/channels/delete_history.html", "methods/messages/delete_messages.html", "methods/channels/delete_messages.html", "methods/channels/delete_participant_history.html", "methods/messages/delete_phone_call_history.html", "methods/photos/delete_photos.html", "methods/bots/delete_preview_media.html", "methods/messages/delete_quick_reply_messages.html", "methods/messages/delete_quick_reply_shortcut.html", "methods/messages/delete_revoked_exported_chat_invites.html", "methods/messages/delete_saved_history.html", "methods/messages/delete_scheduled_messages.html", "methods/account/delete_secure_value.html", "methods/stickers/delete_sticker_set.html", "methods/stories/delete_stories.html", "methods/channels/delete_topic_history.html", "methods/destroy_auth_key.html", "methods/destroy_session.html", "methods/account/disable_peer_connected_bot.html", "methods/phone/disca
typesu = ["types/access_point_rule.html", "types/account_days_ttl.html", "types/attach_menu_bot.html", "types/attach_menu_bot_icon.html", "types/attach_menu_bot_icon_color.html", "types/attach_menu_bots.html", "types/attach_menu_bots_bot.html", "types/attach_menu_peer_type.html", "types/authorization.html", "types/auto_download_settings.html", "types/auto_save_exception.html", "types/auto_save_settings.html", "types/available_effect.html", "types/available_reaction.html", "types/bad_msg_notification.html", "types/bank_card_open_url.html", "types/base_theme.html", "types/bind_auth_key_inner.html", "types/birthday.html", "index.html#bool", "types/boost.html", "types/bot_app.html", "types/bot_business_connection.html", "types/bot_command.html", "types/bot_command_scope.html", "types/bot_info.html", "types/bot_inline_message.html", "types/bot_inline_result.html", "types/bot_menu_button.html", "types/bot_preview_media.html", "types/broadcast_revenue_balances.html", "types/broadcast_revenue_transaction.html", "types/business_away_message.html", "types/business_away_message_schedule.html", "types/business_bot_recipients.html", "types/business_chat_link.html", "types/business_greeting_message.html", "types/business_intro.html", "types/business_location.html", "types/business_recipients.html", "types/business_weekly_open.html", "types/business_work_hours.html", "types/cdn_config.html", "types/cdn_public_key.html", "types/channel_admin_log_event.html", "types/channel_admin_log_event_action.html", "types/channel_admin_log_events_filter.html", "types/channel_location.html", "types/channel_messages_filter.html", "types/channel_participant.html", "types/channel_participants_filter.html", "types/chat.html", "types/chat_admin_rights.html", "types/chat_admin_with_invites.html", "types/chat_banned_rights.html", "types/chat_full.html", "types/chat_invite.html", "types/chat_invite_importer.html", "types/chat_onlines.html", "types/chat_participant.html", "types/chat_participants.html", "types/chat_photo.html", "types/chat_reactions.html", "types/client_dh__inner__data.html", "types/code_settings.html", "types/config.html", "types/connected_bot.html", "types/contact.html", "types/contact_birthday.html", "types/contact_status.html", "types/data_json.html", "types/dc_option.html", "types/default_history_ttl.html", "types/destroy_auth_key_res.html", "types/destroy_session_res.html", "types/dialog.html", "types/dialog_filter.html", "types/dialog_filter_suggested.html", "types/dialog_peer.html", "types/document.html", "types/document_attribute.html", "types/draft_message.html", "types/email_verification.html", "types/email_verify_purpose.html", "types/emoji_group.html", "types/emoji_keyword.html", "types/emoji_keywords_difference.html", "types/emoji_language.html", "types/emoji_list.html", "types/emoji_status.html", "types/emoji_url.html", "types/encrypted_chat.html", "types/encrypted_file.html", "types/encrypted_message.html", "types/exported_chat_invite.html", "types/exported_chatlist_invite.html", "types/exported_contact_token.html", "types/exported_message_link.html", "types/exported_story_link.html", "types/fact_check.html", "types/file_hash.html", "types/folder.html", "types/folder_peer.html", "types/forum_topic.html", "types/found_story.html", "types/future_salt.html", "types/future_salts.html", "types/game.html", "types/geo_point.html", "types/geo_point_address.html", "types/global_privacy_settings.html", "types/group_call.html", "types/group_call_participant.html", "types/group_call_participant_video.html", "types/group_call_participant_video_source_group.html", "types/group_call_stream_channel.html", "types/high_score.html", "types/http_wait.html", "types/imported_contact.html", "types/inline_bot_switch_pm.html", "types/inline_bot_web_view.html", "types/inline_query_peer_type.html", "types/input_app_event.html", "types/input_bot_app.html", "types/input_bot_inline_message.html", "types/input_bot_inline_message_id.html", "types/input_bot_inline_result.html", "types/input_business_away_message.html", "types/input_business_bot_recipient
constructorsu = ["constructors/access_point_rule.html", "constructors/account_days_ttl.html", "constructors/channels/admin_log_results.html", "constructors/messages/affected_found_messages.html", "constructors/messages/affected_history.html", "constructors/messages/affected_messages.html", "constructors/messages/all_stickers.html", "constructors/messages/all_stickers_not_modified.html", "constructors/stories/all_stories.html", "constructors/stories/all_stories_not_modified.html", "constructors/help/app_config.html", "constructors/help/app_config_not_modified.html", "constructors/help/app_update.html", "constructors/messages/archived_stickers.html", "constructors/attach_menu_bot.html", "constructors/attach_menu_bot_icon.html", "constructors/attach_menu_bot_icon_color.html", "constructors/attach_menu_bots.html", "constructors/attach_menu_bots_bot.html", "constructors/attach_menu_bots_not_modified.html", "constructors/attach_menu_peer_type_bot_pm.html", "constructors/attach_menu_peer_type_broadcast.html", "constructors/attach_menu_peer_type_chat.html", "constructors/attach_menu_peer_type_pm.html", "constructors/attach_menu_peer_type_same_bot_pm.html", "constructors/auth/authorization.html", "constructors/authorization.html", "constructors/account/authorization_form.html", "constructors/auth/authorization_sign_up_required.html", "constructors/account/authorizations.html", "constructors/auto_download_settings.html", "constructors/account/auto_download_settings.html", "constructors/auto_save_exception.html", "constructors/auto_save_settings.html", "constructors/account/auto_save_settings.html", "constructors/available_effect.html", "constructors/messages/available_effects.html", "constructors/messages/available_effects_not_modified.html", "constructors/available_reaction.html", "constructors/messages/available_reactions.html", "constructors/messages/available_reactions_not_modified.html", "constructors/bad_msg_notification.html", "constructors/bad_server_salt.html", "constructors/payments/bank_card_data.html", "constructors/bank_card_open_url.html", "constructors/base_theme_arctic.html", "constructors/base_theme_classic.html", "constructors/base_theme_day.html", "constructors/base_theme_night.html", "constructors/base_theme_tinted.html", "constructors/bind_auth_key_inner.html", "constructors/birthday.html", "constructors/contacts/blocked.html", "constructors/contacts/blocked_slice.html", "constructors/boost.html", "constructors/premium/boosts_list.html", "constructors/premium/boosts_status.html", "constructors/bot_app.html", "constructors/messages/bot_app.html", "constructors/bot_app_not_modified.html", "constructors/bot_business_connection.html", "constructors/messages/bot_callback_answer.html", "constructors/bot_command.html", "constructors/bot_command_scope_chat_admins.html", "constructors/bot_command_scope_chats.html", "constructors/bot_command_scope_default.html", "constructors/bot_command_scope_peer.html", "constructors/bot_command_scope_peer_admins.html", "constructors/bot_command_scope_peer_user.html", "constructors/bot_command_scope_users.html", "constructors/bot_info.html", "constructors/bots/bot_info.html", "constructors/bot_inline_media_result.html", "constructors/bot_inline_message_media_auto.html", "constructors/bot_inline_message_media_contact.html", "constructors/bot_inline_message_media_geo.html", "constructors/bot_inline_message_media_invoice.html", "constructors/bot_inline_message_media_venue.html", "constructors/bot_inline_message_media_web_page.html", "constructors/bot_inline_message_text.html", "constructors/bot_inline_result.html", "constructors/bot_menu_button.html", "constructors/bot_menu_button_commands.html", "constructors/bot_menu_button_default.html", "constructors/bot_preview_media.html", "constructors/messages/bot_results.html", "constructors/broadcast_revenue_balances.html", "constructors/stats/broadcast_revenue_stats.html", "constructors/broadcast_revenue_transaction_proceeds.html", "constructors/broadcast_revenue_transaction_refund.html", "constructors/broadcast_revenue_transaction_withdr
} catch (e) {
requests = [];
types = [];
constructors = [];
requestsu = [];
typesu = [];
constructorsu = [];
}
if (typeof prependPath !== 'undefined') {
for (var i = 0; i != requestsu.length; ++i) {
requestsu[i] = prependPath + requestsu[i];
}
for (var i = 0; i != typesu.length; ++i) {
typesu[i] = prependPath + typesu[i];
}
for (var i = 0; i != constructorsu.length; ++i) {
constructorsu[i] = prependPath + constructorsu[i];
}
}
// Assumes haystack has no whitespace and both are lowercase.
//
// Returns the penalty for finding the needle in the haystack
// or -1 if the needle wasn't found at all.
function find(haystack, needle) {
if (haystack.indexOf(needle) != -1) {
return 0;
}
var hi = 0;
var ni = 0;
var penalty = 0;
var started = false;
while (true) {
while (needle[ni] < 'a' || needle[ni] > 'z') {
++ni;
if (ni == needle.length) {
return penalty;
}
}
while (haystack[hi] != needle[ni]) {
++hi;
if (started) {
++penalty;
}
if (hi == haystack.length) {
return -1;
}
}
++hi;
++ni;
started = true;
if (ni == needle.length) {
return penalty;
}
if (hi == haystack.length) {
return -1;
}
}
}
// Given two input arrays "original" and "original urls" and a query,
// return a pair of arrays with matching "query" elements from "original".
//
// TODO Perhaps return an array of pairs instead a pair of arrays (for cache).
function getSearchArray(original, originalu, query) {
var destination = [];
var destinationu = [];
for (var i = 0; i < original.length; ++i) {
var penalty = find(original[i].toLowerCase(), query);
if (penalty > -1 && penalty < original[i].length / 3) {
destination.push(original[i]);
destinationu.push(originalu[i]);
}
}
return [destination, destinationu];
}
// Modify "countSpan" and "resultList" accordingly based on the elements
// given as [[elements], [element urls]] (both with the same length)
function buildList(countSpan, resultList, foundElements) {
var result = "";
for (var i = 0; i < foundElements[0].length; ++i) {
result += '<li>';
result += '<a href="' + foundElements[1][i] + '">';
result += foundElements[0][i];
result += '</a></li>';
}
if (countSpan) {
countSpan.innerHTML = "" + foundElements[0].length;
}
resultList.innerHTML = result;
}
function updateSearch(event) {
var query = searchBox.value.toLowerCase();
if (!query) {
contentDiv.style.display = "";
searchDiv.style.display = "none";
return;
}
contentDiv.style.display = "none";
searchDiv.style.display = "";
var foundRequests = getSearchArray(requests, requestsu, query);
var foundTypes = getSearchArray(types, typesu, query);
var foundConstructors = getSearchArray(constructors, constructorsu, query);
var original = requests.concat(constructors);
var originalu = requestsu.concat(constructorsu);
var destination = [];
var destinationu = [];
for (var i = 0; i < original.length; ++i) {
if (original[i].toLowerCase().replace("request", "") == query) {
destination.push(original[i]);
destinationu.push(originalu[i]);
}
}
if (event && event.keyCode == 13) {
if (destination.length != 0) {
window.location = destinationu[0];
} else if (methodsDetails.open && foundRequests[1].length) {
window.location = foundRequests[1][0];
} else if (typesDetails.open && foundTypes[1].length) {
window.location = foundTypes[1][0];
} else if (constructorsDetails.open && foundConstructors[1].length) {
window.location = foundConstructors[1][0];
}
return;
}
buildList(methodsCount, methodsList, foundRequests);
buildList(typesCount, typesList, foundTypes);
buildList(constructorsCount, constructorsList, foundConstructors);
// Now look for exact matches
if (destination.length == 0) {
exactMatch.style.display = "none";
} else {
exactMatch.style.display = "";
buildList(null, exactList, [destination, destinationu]);
return destinationu[0];
}
}
function getQuery(name) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i != vars.length; ++i) {
var pair = vars[i].split("=");
if (pair[0] == name)
return decodeURI(pair[1]);
}
}
document.onkeydown = function (e) {
if (e.key == '/' || e.key == 's' || e.key == 'S') {
if (document.activeElement != searchBox) {
searchBox.focus();
return false;
}
} else if (e.key == '?') {
alert('Pressing any of: /sS\nWill focus the search bar\n\n' +
'Pressing: enter\nWill navigate to the first match')
}
}
var query = getQuery('q');
if (query) {
searchBox.value = query;
}
var exactUrl = updateSearch();
var redirect = getQuery('redirect');
if (exactUrl && redirect != 'no') {
window.location = exactUrl;
}