-
Notifications
You must be signed in to change notification settings - Fork 14
Contributing
shu8 edited this page Feb 11, 2016
·
13 revisions
###Welcome to the SOX Contributing Wiki!
It's really easy to contribute to SOX -- just follow some simple steps:
- Write a function that implements the new feature you're adding. Give it a simple, unique name in CamelCase
- Add it to the bottom of
sox.features.js - If you have any extra CSS that you need, add it at the bottom of
sox.css - Add the function ID to
sox.user.js, in the correct category at the bottom of the file. Make sure you add a description. - Submit a pull request. The changes will be checked and should be pushed in the next dev or main version.
Some rules...
- A short description of the function (the same you add to
sox.user.js) should be added on the first line of the function, in the form of:// Description: [description here] - All functions should run within their defined areas, eg. not running unless they need to
- CSS rule definitions should be prepended with the name of the function for which they are defined. eg
.functionName-element
###Helper Functions
SOX has a few helper functions added to it to make it easy to determine common things. You can see these at https://github.com/soscripted/sox/blob/master/sox.helpers.js.
Note: * means the function returns false if the user is not logged in.
-
getUsername()*: returns the logged in user's display name -
getReputation()*: returns the logged in user's reputation -
getSiteName(type): iftypeisapi, it will return the api sitename (eg.metaorstackoverflow), else it will return the normal site name (eg.Meta Stack ExchangeorStack Overflow) -
getSiteType(): returnsbetaorgraduated, depending on the site's status -
getQuestionId(): returns the question ID -
isLoggedIn(): returnstrueif the user is logged in, else it returnsfalse -
isOnUserProfile(): returnstrueif the user is on the profile page, else it returnsfalse -
isOnChat(): returnstrueif the user is on a chat page, else it returnsfalse -
hasPriv(priv)*: please see the source to see what theprivparameter may be. This function returnstrueif the logged in user has the reputation points required to have a certainpriv, else it returnsfalse.