Skip to content

Contributing

ᔕᖺᘎᕊ edited this page Jul 21, 2018 · 13 revisions

Contributing

Thank you for considering to contribute to SOX!

We would appreciate any and all contributions, partial or complete, and try to respond to all issues/pull requests as soon as we can!

Contributing doesn't have to be with code! Fixing a simple typo, or helping us document code/update the wiki, is equally as important! :)

Contributing new features

Please follow the following steps when adding a new feature:

  1. Write a Javascript function that implements the feature. It's name should be in camelCase. Your function may use jQuery!
  2. Add it to the bottom of the features object in sox.features.js.
  3. Add a JSON object for the feature to sox.features.info.json. Please put it under the most fitting category array from Appearance, Comments, Editing, Flags, Sidebar, Chat, Voting, and Extras. The following fields must be included:
    • name: the camelCase ID of the function you added to sox.features.js
    • desc: a short description of the feature you're adding, which will be displayed in the control panel
    • meta: a URL linking to a meta post if that is where you got the idea from/were trying to fix, or ""
    • match: a string of comma-separated match patterns for URLs where the feature should run on. Some common match patterns that you may need are:
      • for question pages: *://*/questions*,
      • for review pages: *://*/review*
      • for user profile pages: *://*/users/*
      • for search pages: *://*.com/search*
    • exclude: a string of comma-separated match patterns for URLs where the feature should run on, or "". An extra 'match pattern' is included called SE1.0 for Stack Exchange 1.0 sites.
  4. Submit a pull request to the dev branch!

Please note any CSS that the feature uses should be added to the bottom of sox.css, with a comment before it indicating which feature it is for. CSS rules should ideally be prepended with the function's ID (the camelCase name).


Contributing bug fixes

If you've found a bug, we'd be grateful for any fixes (even if they're partial!) you could provide. We ask that you first raise an issue on Github so other contributors can discuss and help fix it.

SOX should automatically add a list of your features to any issues that you add to help in debugging :)

Please submit any pull requests to the dev branch.


Helper functions

SOX has various helper functions and getters you can use to get information. Please see Helper Functions for a list of them.


Testing locally

To test locally, simply create a userscript which //@require's the local version of your files. We strongy recommend using Tampermonkey as your userscript manager.

Here's a template that you can modify to work for your system:

// ==UserScript==
// @name         Local SOX
// @match        *://*.stackoverflow.com/*
// @match        *://*.stackexchange.com/*
// @match        *://*.superuser.com/*
// @match        *://*.serverfault.com/*
// @match        *://*.askubuntu.com/*
// @match        *://*.stackapps.com/*
// @match        *://*.mathoverflow.net/*
// @match        *://github.com/soscripted/*
// @match        *://soscripted.github.io/sox/*
// @exclude      *://data.stackexchange.com/*
// @exclude      *://api.stackexchange.com/*

// @require      https://code.jquery.com/jquery-3.3.1.min.js
// @require      https://code.jquery.com/ui/1.12.1/jquery-ui.min.js
// @require      https://api.stackexchange.com/js/2.0/all.js
// @require      https://cdnjs.cloudflare.com/ajax/libs/jquery-timeago/1.5.3/jquery.timeago.min.js

// @require      file:///C:/User/Github/sox/sox.common.js
// @require      file:///C:/User/Github/sox/sox.github.js
// @require      file:///C:/User/Github/sox/sox.dialog.js
// @require      file:///C:/User/Github/sox/sox.features.js
// @require      file:///C:/User/Github/sox/sox.user.js

// @resource     css file:///C:/User/Github/sox/sox.css
// @resource     dialog file:///C:/User/Github/sox/sox.dialog.html
// @resource     featuresJSON file:///C:/User/Github/sox/sox.features.info.json
// @resource     common file:///C:/User/Github/sox/sox.common.info.json

// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @grant        GM_getResourceText
// @grant        GM_addStyle
// @grant        GM_info
// ==/UserScript==

Make sure Tampermonkey has been allowed access to local file URLs!

Clone this wiki locally