Skip to content

A widget that displays questions and answers from Stack Exchange sites on your blog or any HTML page.

Notifications You must be signed in to change notification settings

OfirD1/StackTack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StackTack

StackTack is a tool that will fetch information about any question in the Stack Exchange network of sites and format it in a nicely-styled and functional widget.

What Has Been Changed

This fork has few changes from the already forked StackTack. The changes are:

  • build.py was transformed to Python 3.
  • Dedicated demo folder was added, with a shorter demo.html file.
  • Few documentation fixes and changes.

Dependencies

  • jQuery (only if built with --disable-jquery-check)

Build Dependencies

Build Instructions

  1. Determine whether you want the CSS styles to be included in the minified JS file or whether you want to create an external minified CSS file.
  2. Run the following command:
    python build.py
    Note: add the --enable-embed-css option to the command above if you want to embed the CSS.
  3. You should now have a 'stacktack.min.js' file and (depending on the options you specified) a 'style.min.css' file in the 'out' folder.

Running the demo

Live demo is hosted on jsFiddle.

  • Note: Currently, the live demo is possible by serving the Github source files through Combinatorics. However, this would probably break someday in the future, as such services tend to.

To run the demo locally:

  1. Run the following commands:

    cd demo
    python -m http.serve
    Notes:
    1. The default port is 8000, but you can specify another port, see here.
    2. The minified files in the demo folder are a copy of the resultant files after following the Build Instructions section above.

  2. Browse to http://localhost:8000/demo.html.

Using StackTack

Adding StackTack to a page is relatively simple and consists of the following steps:

  1. If you did not build StackTack with the --enable-embed-css option, add the following line to the <head> section of your page:
    <link rel="stylesheet" href="style.min.css" />
  2. If you built StackTack with the --disable-jquery-check option, you will need to manually load jQuery by adding the following to the end of the <body> section of your page:
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
  3. Add StackTack to the <body> section of your page:
    <script type="text/javascript" src="stacktack.min.js"></script>
  4. To insert a StackTack widget on the page, use the following template:
    <div class="stacktack" data-site="stackoverflow" data-id="1732348" data-answers="all"></div>
    The <div> contains a number of data-* attributes that specify the options for that particular instance. These options include:
    • answers: specifies the answers that will be displayed - this can be 'all', 'none', 'accepted', or a comma-separated list of answer IDs
    • id: the ID of the question [required]
    • question: whether or not to display the question
    • secure: whether to use HTTPS when retrieving data from the API
    • site: the site to retrieve the question from
    • tags: whether or not to display the question's tags
    • votes: whether or not to display vote score on answers
    • width: the width (in pixels) of the widget
    These options (except 'id') can also be specified in a map in the .stacktack() method in the previous step.

About

A widget that displays questions and answers from Stack Exchange sites on your blog or any HTML page.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 51.4%
  • Python 39.3%
  • CSS 9.3%