Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelioDeRosa committed Aug 3, 2014
0 parents commit e825013
Show file tree
Hide file tree
Showing 12 changed files with 430 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
18 changes: 18 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"node": true,
"esnext": true,
"bitwise": false,
"curly": false,
"eqeqeq": true,
"eqnull": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"undef": true,
"unused": true,
"quotmark": "single",
"strict": false,
"trailing": true,
"smarttabs": true
}
17 changes: 17 additions & 0 deletions GPL-3.0-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
JoindIn.js is an unofficial JavaScript library to embed Joind.in
comments, talks, and more.

Copyright (C) 2014 Aurelio De Rosa

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
46 changes: 46 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = function (grunt) {
'use strict';

require('load-grunt-tasks')(grunt);

var config = {
src: 'src',
dist: 'dist'
};

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
config: config,

uglify: {
options: {
banner: '/*! joindin.js <%= pkg.version %> | Aurelio De Rosa (@AurelioDeRosa) | MIT/GPL-3.0 Licensed */\n'
},
dist: {
files: {
'<%= config.dist %>/joindin.min.js': ['<%= config.src %>/joindin.js']
}
}
},
jshint: {
files: ['Gruntfile.js', 'src/**/*.js'],
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['jshint']
}
});

grunt.registerTask('test', [
'jshint'
]);

grunt.registerTask('default', [
'jshint',
'uglify'
]);
};
19 changes: 19 additions & 0 deletions MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2014 Aurelio De Rosa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
102 changes: 102 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# JoindIn.js #

[JoindIn.js](https://github.com/AurelioDeRosa/JoindIn.js) is an unofficial JavaScript library to embed Joind.in
comments, talks, and more. The library is written in plain JavaScript, so has no dependencies.

## Compatibility ##

JoindIn.js has been tested on the following browsers: Internet Explorer 9+, Chrome, Opera, Firefox, and Safari.

## Elements supported ##

The library supports the following elements:

* Talk (`data-type="talks"`)
* Comment (`data-type="talk_comments"`)

More elements will be integrated soon.

## Installation ##

You can install JoindIn.js using [Bower](http://bower.io):

```shell
bower install joindin-js
```

Then, include the JavaScript file in your web page as shown below:

```html
<script src="bower_components/joindin-js/dist/joindin.min.js" async></script>
```

**Note**: the `async` attribute isn't necessary but can improve the performance of your website.

If you don't have or don't want to use Bower, you can clone this repository running the command:

```shell
git clone https://github.com/AurelioDeRosa/JoindIn.js.git
```

The last option is to manually download the library.

## Usage ##

Once you have the JavaScript file in place, you have to create one or more DOM elements for every element you want to
embed: talk, comment, or any other of the [element supported](#elements-supported). The DOM elements you create must
use the class `joindin-embed` and define two `data-*` attributes:

* `data-id`: the ID of the element you want to embed. To know how to retrieve the ID of an element read the
section [How to retrieve the ID of the element to embed](#how-to-retrieve-the-id-of-the-element-to-embed);
* `data-type`: [the type of the element](#elements-supported) to embed.

### Embedding a talk ###
To embed my talk "[Modern front-end with the eyes of a PHP developer](https://joind.in/talk/view/10889)",
you have to add the following element to your page:

```html
<div class="joindin-embed" data-id="10889" data-type="talks">
</div>
```

### Embedding a comment on a talk ###

To embed one specific comment published on the same talk, you have to add the following element instead:

```html
<div class="joindin-embed" data-id="44197" data-type="talk_comments">
</div>
```

Note that in this case the ID refers to the comment, not the talk.

### How to retrieve the ID of the element to embed ##

Retrieving the ID of the element you want to embed is the tricky part of using this library.

For a talk the ID can be found in the URL of the website. For example, the URL of my talk
"[Modern front-end with the eyes of a PHP developer](https://joind.in/talk/view/10889)" is
[https://joind.in/talk/view/10889](https://joind.in/talk/view/10889), so its ID is 10889.

To retrieve the ID of a comment you have to look at the source code of the page. It's written as part of the class
name set to the element wrapping each comment. For example, you can find a class name like `comment-43964` where
43964 is the ID of the comment.

## Note ##

JoindIn.js is in a very early stage, so it's not stable and [every contribution is welcomed](#contribute).

## Contribute ##

I'd love the contribution of anyone who is keen to help. Report a bug, fix a issue, suggest a feature:
any contribution to improve the project is highly appreciated. If you're uncertain whether an addition should be
made, feel free to open up an issue so we can discuss it.

## License ##

JoindIn.js is dual licensed under [MIT](http://www.opensource.org/licenses/MIT) and
[GPL-3.0](http://opensource.org/licenses/GPL-3.0)

## Author ##

[Aurelio De Rosa](http://www.audero.it) ([@AurelioDeRosa](https://twitter.com/AurelioDeRosa))
25 changes: 25 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "joindin-js",
"version": "0.1.0",
"main": "src/joindin.js",
"author": {
"name": "Aurelio De Rosa",
"email": "[email protected]",
"web": "http://www.audero.it"
},
"description": "An unofficial JavaScript library to embed Joind.in comments, talks, and more.",
"keywords": [
"javascript",
"library",
"joind.in",
"joind"
],
"license": [
"MIT",
"GPL-3.0"
],
"ignore": [
"**/.*",
"node_modules"
]
}
33 changes: 33 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JoindIn.js Demo by Aurelio De Rosa</title>
<style>
body
{
margin: auto;
max-width: 800px;
}
</style>
</head>
<body>
<h1>JoindIn.js Demo</h1>

<p>The elements below are loaded asynchronously using the JoindIn.js library.</p>

<div class="joindin-embed" data-id="10889" data-type="talks">
</div>

<div class="joindin-embed" data-id="44197" data-type="talk_comments">
</div>

<div>
<a href="https://github.com/AurelioDeRosa/JoindIn.js">JoindIn.js</a> has been created by
<a href="http://www.audero.it">Aurelio De Rosa</a>
(<a href="https://twitter.com/AurelioDeRosa">@AurelioDeRosa</a>).
</div>

<script async src="../src/joindin.js"></script>
</body>
</html>
2 changes: 2 additions & 0 deletions dist/joindin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "joindin-js",
"version": "0.1.0",
"author": {
"name": "Aurelio De Rosa",
"email": "[email protected]",
"web": "http://www.audero.it"
},
"description": "An unofficial JavaScript library to embed Joind.in comments, talks, and more",
"dependencies": {},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-jshint": "^0.9.2",
"grunt-contrib-uglify": "^0.5.1",
"jshint-stylish": "^0.4.0",
"load-grunt-tasks": "^0.6.0"
},
"engines": {
"node": ">=0.10.16"
}
}
Loading

0 comments on commit e825013

Please sign in to comment.