FIRE's global object.
- fire
.metaData
.api
.clickHandlers
℗.requestStackExchangeToken()
℗.checkHashForWriteToken()
℗.checkWriteTokenSuccess()
℗.getDataForUrl(reportedUrl, callback)
℗.listHasCurrentUser(flags)
⇒boolean
℗.loadDataForReport(openAfterLoad)
℗.updateReportCache()
℗.parseDataForReport(data, openAfterLoad, $this, skipLoadPost)
℗.parseSiteUrl(url)
⇒string
℗.loadStackExchangeSites()
℗.loadPost(report)
℗.loadPostRevisions(report)
℗.showEditedIcon()
℗.showReputation(reputation)
℗.loadPostFlagStatus(report)
℗.loadCurrentSEUser([page])
℗.parseUserResponse(response, page)
℗.getSE(method, parameters, success, error, always)
℗.stackExchangeAjaxCall(method, parameters, config)
⇒jqXHR
℗.getWriteToken([callback])
℗.chatListener(message)
℗.decorateMessage(message)
.filterOnContents($object, text)
⇒object
℗.toastrPositionChangeHandler()
℗.toastrDurationHandler()
℗.blurOptionClickHandler()
℗.flagOptionClickHandler()
℗.debugOptionClickHandler()
℗.imageOptionClickHandler()
℗.boolOptionClickHandler(element, message, key, [callback])
℗.keyboardShortcuts(e)
℗.openReportPopupForMessage(message)
.writeTokenPopup(callback)
℗.openReportPopup()
℗.openSettingsPopup()
℗.closePopup()
⇒object
℗.getPopupLeft()
⇒number
℗.postMetaSmokeFeedback(data, verdict, button)
℗.postMetaSmokeSpamFlag(data, api, token, feedbackSuccess)
⇒undefined
℗.keyCodesToArray(keyCodes)
⇒array.number
℗.createFeedbackButton(data, keyCodes, text, verdict, tooltip)
⇒object
℗.createCloseButton(clickHandler)
⇒object
℗.createSettingsCheckBox(id, value, handler, labelText, headerText)
⇒object
℗._(tagName, [cssClass], [options])
⇒object
℗.br()
⇒object
℗.span(contents)
⇒object
℗.button(text, clickHandler)
⇒object
℗.hasEmojiSupport()
℗.emojiOrImage(emoji, [large])
⇒object
℗.injectExternalScripts()
℗.injectCSS(path)
℗.injectScript(name, path, [callback], [always])
℗.loadToastrCss()
℗.initializeToastr()
℗.registerOpenLastReportKey()
℗.registerAnchorHover()
℗.registerWebSocket()
℗.registerForLocalStorage(object, key, localStorageKey)
℗.registerLoggingFunctions()
℗.showFireOnExistingMessages()
℗.decorateExistingMessages(timeout)
℗.getLogger(fn)
⇒function
℗.socketOnMessage(message)
℗.expandLinksOnHover()
℗.initLocalStorage(hOP, defaultStorage)
℗.setValue(key, value)
℗.clearValue(key)
℗.getCurrentChatUser()
℗.getFireConstants()
⇒object
℗~singleReportCallback
:function
The userscript's metadata
Kind: static property of fire
Access: public
The userscript's api urls and keys
Kind: static property of fire
Access: public
Click handlers for the settings window.
Kind: static constant of fire
Access: private
Open the "Request authorization" MetaSmoke page.
Kind: static method of clickHandlers
Access: private
Request a token from the MetaSmoke code.
Kind: static method of clickHandlers
Access: private
Param | Type | Description |
---|---|---|
input | object |
The input DOM node that contains the code. |
callback | function |
The callback that receives the MetaSmoke code. |
Close all popup windows and open the "Request write token" popup.
Kind: static method of clickHandlers
Access: private
requestStackExchangeToken - Request a Stack Exchange Write token for this app.
Kind: static method of fire
Access: private
checkHashForWriteToken - Check the url hash to see if a write token has been obtained. If so, parse it.
Kind: static method of fire
Access: private
checkWriteTokenSuccess - Check if the write token was successfully obtained.
Kind: static method of fire
Access: private
getDataForUrl - Loads MetaSmoke data for a specified post url.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
reportedUrl | string |
The url that's been reported. |
callback | singleReportCallback |
An action to perform after the report is loaded. |
listHasCurrentUser - Checks if the list of users on this flag report contains the current user.
Kind: static method of fire
Returns: boolean
- true
if the current user is found in the flag list.
Access: private
Param | Type | Description |
---|---|---|
flags | object |
A report's (auto-)flags, where it's users array has to be checked. |
loadDataForReport - Loads a report's data when you hover over the FIRE button.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
openAfterLoad | boolean |
Open the report popup after load? |
updateReportCache - Loads all MS data on the page.
Kind: static method of fire
Access: private
parseDataForReport - Parse a report's loaded data.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
data | object |
A MetaSmoke report |
openAfterLoad | boolean |
Open the report popup after load? |
$this | object |
The clicked FIRE report button |
skipLoadPost | boolean |
skip loading additional data fot the post? |
parseSiteUrl - Parse a site url into a api parameter.
Kind: static method of fire
Returns: string
- The Stack Exchange API name for the report's site.
Access: private
Param | Type | Description |
---|---|---|
url | string |
A report's Stack Exchange link |
loadStackExchangeSites - Loads a list of all Stack Exchange Sites.
Kind: static method of fire
Access: private
loadPost - Loads additional information for a post, from the Stack exchange API.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
report | object |
The MetaSmoke report. |
loadPostRevisions - Loads a post's revision history from the Stack Exchange API.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
report | object |
The MetaSmoke report. |
showEditedIcon - Render a "Edited" icon on a opened report popup.
Kind: static method of fire
Access: private
showReputation - Shows a user's reputation in the report.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
reputation | number |
The user's reputation. |
loadPostFlagStatus - Loads a post's flagging status from the Stack Exchange API.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
report | object |
The MetaSmoke report. |
loadPostFlagStatus - Loads the current Stack Exchange user and what sites they're registered at from the Stack Exchange API.
Kind: static method of fire
Access: private
Param | Type | Default | Description |
---|---|---|---|
[page] | number |
1 |
the page to load. |
parseUserResponse - Parse the user response.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
response | object |
the Stack Exchange user response. |
page | number |
The page that's been loaed. |
getSE - GET
call on the Stack Exchange API.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
method | string |
The Stack Exchange api method. |
parameters | object |
The parameters to be passed to the Stack Exchange api. |
success | function |
The success callback. |
error | function |
The error callback. |
always | function |
The always callback. |
stackExchangeAjaxCall - Perform an AJAX call on the Stack Exchange API.
Kind: static method of fire
Returns: jqXHR
- The jqXHR Promise.
Access: private
Param | Type | Description |
---|---|---|
method | string |
The Stack Exchange api method. |
parameters | object |
The parameters to be passed to the Stack Exchange api. |
config | object |
The AJAX call configuration object, containing: |
config.call | function |
The jquery AJAX call to use. |
config.success | function |
The success callback. |
config.error | function |
The error callback. |
config.always | function |
The always callback. |
getWriteToken - Gets a MetaSmoke write token.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
[callback] | function |
A optional function to run after the write token was obtained. |
chatListener - Chat message event listener. If SmokeDetector reports another post, decorate the message.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
message | object |
The received message, containing: |
message.event_type | number |
The message type |
message.user_id | number |
The message's userID |
message.message_id | number |
The message ID |
decorateMessage - Adds the "FIRE" button to the passed message.
Kind: static method of fire
Access: public
Param | Type | Description |
---|---|---|
message | object |
The message DOM node the button should be added to. |
filterOnContents - Filter a jQuery list on the element text.
Kind: static method of fire
Returns: object
- The filtered list
Access: private
Param | Type | Description |
---|---|---|
$object | object |
A jQuery list of DOM elements |
text | string |
The text the element should contain. |
toastrPositionChangeHandler - Set the toastr position class.
Kind: static method of fire
Access: private
toastrDurationHandler - Update the toastr popup duration.
Kind: static method of fire
Access: private
blurOptionClickHandler - Set the "Blur" option for the popup modal.
Kind: static method of fire
Access: private
flagOptionClickHandler - Set the "Flag" option for "tpu-" feedback.
Kind: static method of fire
Access: private
debugOptionClickHandler - Set the "Debug" option to show logs in the dev console.
Kind: static method of fire
Access: private
imageOptionClickHandler - Set the "HideImages" option to hide or show images in reports.
Kind: static method of fire
Access: private
boolOptionClickHandler - Set a boolean option after a setting checkbox was clicked.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
element | object |
The `input[type=checkbox]`` DOM node that was clicked. |
message | string |
The message to show. |
key | string |
The setting key to save. |
[callback] | function |
A optional callback. |
keyboardShortcuts - Handle keypress events for the popup.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
e | object |
the jQuery keyboard event |
openReportPopupForMessage - Opens a report popup for a specific message.
Kind: static method of fire
Access: public
Param | Type | Description |
---|---|---|
message | object |
The message DOM node the report should be opened for. |
writeTokenPopup - Open a popup to enter the write token.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
callback | function |
The action to perform after getting a write token / chosing read-only mode. |
openReportPopup - Build a report popup and show it.
Kind: static method of fire
Access: private
openSettingsPopup - Opens a popup to change fire's settings.
Kind: static method of fire
Access: private
closePopup - Close the popup.
Kind: static method of fire
Returns: object
- The previously closed popup's button (if any) so it can be re-opened.
Access: private
getPopupLeft - Gets the left
position for the popup.
Kind: static method of fire
Returns: number
- The left
position for the popup.
Access: private
postMetaSmokeFeedback - Submit MetaSmoke feedback.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
data | object |
The report data. |
verdict | string |
The chosen verdict. |
button | object |
The clicked button. |
postMetaSmokeSpamFlag - Flag the post as spam.
Kind: static method of fire
Returns: undefined
- returns undefined to break out of the function.
Access: private
Param | Type | Description |
---|---|---|
data | object |
The report data. |
api | object |
API configuration object, containing: |
api.url | string |
The API url. |
api.key | string |
The API key. |
token | string |
The MetaSmoke write token. |
feedbackSuccess | object |
A jQuery DOM node containing the feedback success message. |
keyCodesToArray - Structure the keyCodes Array.
Kind: static method of fire
Returns: array.number
- An array of keyCodes mapped from the input chars / keyCodes.
Access: private
Param | Type | Description |
---|---|---|
keyCodes | number | string | array |
An number, string, or array of numbers or strings containing keys or keycodes. |
createFeedbackButton - Create a feedback button for the top of the popup.
Kind: static method of fire
Returns: object
- The constructed feedback button.
Access: private
Param | Type | Description |
---|---|---|
data | object |
the report data. |
keyCodes | number | string | array |
The keyCodes to use for this button. |
text | string |
The text to display for this button. |
verdict | string |
This button's MetaSmoke verdict |
tooltip | string |
The tooltip to display for this button. |
createCloseButton - Create a button to close a popup.
Kind: static method of fire
Returns: object
- The constructed "close" button.
Access: private
Param | Type | Description |
---|---|---|
clickHandler | function |
The button's click handler. |
createSettingsCheckBox - Creates a input[type=checkbox] for the settings.
Kind: static method of fire
Returns: object
- The constructed settings checkbox.
Access: private
Param | Type | Description |
---|---|---|
id | string |
The option's name. |
value | boolean |
The option's current value. |
handler | function |
The option's click handler. |
labelText | string |
The text to show next to the checkbox. |
headerText | string |
The header to show above the checkbox. |
_ - Wrapper to create a new element with a specified class.
Kind: static method of fire
Returns: object
- A jQuery DOM node.
Access: private
Param | Type | Description |
---|---|---|
tagName | string |
The tag to create. |
[cssClass] | string |
The tag's css class. Optional. If this is an object, this is assumed to be options . |
[options] | object |
The options to use for the created element. |
br - Create a linebreak.
Kind: static method of fire
Returns: object
- A jQuery <br />
DOM node.
Access: private
span - Create a <span>
with the specified contents.
Kind: static method of fire
Returns: object
- A jQuery <span>
DOM node with the specified contents.
Access: private
Param | Type | Description |
---|---|---|
contents | object |
A jQuery DOM node to use insert into the span. |
button - Create a button.
Kind: static method of fire
Returns: object
- A jQuery <button>
DOM node.
Access: private
Param | Type | Description |
---|---|---|
text | string |
The button's text |
clickHandler | function |
The button's click handler. |
hasEmojiSupport - Detect Emoji support in this browser.
Kind: static method of fire
Access: private
emojiOrImage - Returns the emoji if it's supported. Otherwise, return a fallback image.
Kind: static method of fire
Returns: object
- A jQuery <span>
DOM node with the specified emoji as string or image.
Access: private
Param | Type | Default | Description |
---|---|---|---|
emoji | string |
The emoji to render | |
[large] | boolean |
false |
Make it large? |
injectExternalScripts - Inject FIRE stylesheet and Toastr library.
Kind: static method of fire
Access: private
injectCSS - Inject the specified stylesheet.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
path | string |
The path to the CSS file. |
injectScript - Inject the specified script.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
name | string |
The global name to check against before injecting the script. Exapme: (typeof myInjectedGlobal ) |
path | string |
The script's path. |
[callback] | function |
An optional "success" callback. |
[always] | function |
An optional "always" callback. |
loadToastrCss - Load toastr css.
Kind: static method of fire
Access: private
initializeToastr - Set toastr options.
Kind: static method of fire
Access: private
registerOpenLastReportKey - Open the last report on [Ctrl]+[Space].
Kind: static method of fire
Access: private
registerAnchorHover - Register the "tooltip" hover for anchor elements.
Kind: static method of fire
Access: private
registerWebSocket - Register a websocket listener.
Kind: static method of fire
Access: private
registerForLocalStorage - Adds a property on fire
that's stored in localStorage
.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
object | object |
The object to register the property on. |
key | string |
The key to use on the object. |
localStorageKey | string |
The key to use in localStorage . |
registerLoggingFunctions - Registers logging functions on fire
.
Kind: static method of fire
Access: private
showFireOnExistingMessages - Adds the "FIRE" button to all existing messages and registers an event listener to do so after "load older messages" is clicked.
Kind: static method of fire
Access: private
decorateExistingMessages - Decorate messages that exist on page load.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
timeout | number |
The time to wait before trying to decorate the messages. |
getLogger - Gets a log wrapper for the specified console function.
Kind: static method of fire
Returns: function
- A fire-wrapped console function.
Access: private
Param | Type | Description |
---|---|---|
fn | function |
the console function to wrap in a debug condition. |
socketOnMessage - Handle socket messages.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
message | object |
The socket message. |
expandLinksOnHover - Expands anchor elements in the report's body on hover, to show the href.
Kind: static method of fire
Access: private
initLocalStorage - Initializes localStorage
.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
hOP | function |
Object.hasOwnProperty bound securely. |
defaultStorage | objects |
localStorage's default settings. |
setValue - Sets a value on fire.userData
, stored in localStorage
.
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
key | string |
the localStorage key. |
value | object |
the value to set. |
clearValue - Removes a value from fire.userData
, stored in localStorage
Kind: static method of fire
Access: private
Param | Type | Description |
---|---|---|
key | string |
the localStorage key. |
getCurrentChatUser - Gets the currently logged-in user.
Kind: static method of fire
Access: private
getFireConstants - Gets constants to be used in fire
.
Kind: static method of fire
Returns: object
- FIRE's constants
Access: private
This is a callback that is passed a single report's data.
Kind: inner typedef of fire
Param | Type | Description |
---|---|---|
reportData | object |
The data for the loaded report. |