├── dist
├── commentaculous.user.js
└── commentaculous.js
├── src
├── commentaculous.user.js
└── commentaculous.js
├── grunt.js
└── README.md
/dist/commentaculous.user.js:
--------------------------------------------------------------------------------
1 | /*! comment.aculo.us - v0.1.0 - 2012-04-05
2 | * https://github.com/cowboy/comment.aculo.us
3 | * Copyright (c) 2012 "Cowboy" Ben Alman; Licensed MIT */
4 |
5 | // ==UserScript==
6 | // @match http://mir.aculo.us/*/*/*/*
7 | // @run-at document-end
8 | // ==/UserScript==
9 |
10 | var elem = document.createElement("script");
11 | elem.src = "https://raw.github.com/cowboy/comment.aculo.us/master/dist/commentaculous.js";
12 | document.body.appendChild(elem);
13 |
--------------------------------------------------------------------------------
/src/commentaculous.user.js:
--------------------------------------------------------------------------------
1 | /*
2 | * comment.aculo.us
3 | * https://github.com/cowboy/comment.aculo.us
4 | *
5 | * Copyright (c) 2012 "Cowboy" Ben Alman
6 | * Licensed under the MIT license.
7 | * http://benalman.com/about/license/
8 | */
9 |
10 | // ==UserScript==
11 | // @match http://mir.aculo.us/*/*/*/*
12 | // @run-at document-end
13 | // ==/UserScript==
14 |
15 | var elem = document.createElement("script");
16 | elem.src = "https://raw.github.com/cowboy/comment.aculo.us/master/dist/commentaculous.js";
17 | document.body.appendChild(elem);
18 |
--------------------------------------------------------------------------------
/dist/commentaculous.js:
--------------------------------------------------------------------------------
1 | /*! comment.aculo.us - v0.1.0 - 2012-04-05
2 | * https://github.com/cowboy/comment.aculo.us
3 | * Copyright (c) 2012 "Cowboy" Ben Alman; Licensed MIT */
4 | var disqus_shortname;(function(a,b,c,d,e,f,g,h){if(!(e=a.jQuery)||c>e.fn.jquery||d(e))f=b.createElement("script"),f.type="text/javascript",f.src="http://ajax.googleapis.com/ajax/libs/jquery/"+c+"/jquery.min.js",f.onload=f.onreadystatechange=function(){!g&&(!(h=this.readyState)||h==="loaded"||h==="complete")&&(d((e=a.jQuery).noConflict(1),g=1),e(f).remove())},b.documentElement.childNodes[0].appendChild(f)})(window,document,"1.7",function(a,b){disqus_shortname="commentaculous",a("h1").last().closest("div").append('
'),a.getScript("http://"+disqus_shortname+".disqus.com/embed.js")})
--------------------------------------------------------------------------------
/grunt.js:
--------------------------------------------------------------------------------
1 | /*global module:false*/
2 | module.exports = function(grunt) {
3 |
4 | // Project configuration.
5 | grunt.initConfig({
6 | meta: {
7 | version: '0.1.0',
8 | banner: '/*! comment.aculo.us - v<%= meta.version %> - ' +
9 | '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
10 | '* https://github.com/cowboy/comment.aculo.us\n' +
11 | '* Copyright (c) <%= grunt.template.today("yyyy") %> ' +
12 | '"Cowboy" Ben Alman; Licensed MIT */'
13 | },
14 | lint: {
15 | files: ['grunt.js', 'src/**/*.js']
16 | },
17 | concat: {
18 | user: {
19 | src: ['', ''],
20 | dest: 'dist/commentaculous.user.js'
21 | }
22 | },
23 | min: {
24 | main: {
25 | src: ['', ''],
26 | dest: 'dist/commentaculous.js'
27 | }
28 | },
29 | watch: {
30 | files: '',
31 | tasks: 'lint'
32 | },
33 | jshint: {
34 | options: {
35 | curly: true,
36 | eqeqeq: true,
37 | immed: true,
38 | latedef: true,
39 | newcap: true,
40 | noarg: true,
41 | sub: true,
42 | undef: true,
43 | boss: true,
44 | eqnull: true,
45 | browser: true
46 | },
47 | globals: {}
48 | },
49 | uglify: {}
50 | });
51 |
52 | // Default task.
53 | grunt.registerTask('default', 'lint concat min');
54 |
55 | };
56 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # comment.aculo.us
2 |
3 | Have you ever wanted to comment on [mir.aculo.us][] blog posts? Me neither. But now, you can!
4 |
5 | ## Installation
6 |
7 | [mainscript]: https://raw.github.com/cowboy/comment.aculo.us/master/dist/commentaculous.js
8 | [userscript]: https://raw.github.com/cowboy/comment.aculo.us/master/dist/commentaculous.user.js
9 | [greasemonkey]: https://addons.mozilla.org/en-US/firefox/addon/greasemonkey/
10 | [mir.aculo.us]: http://mir.aculo.us/
11 |
12 | If you're using Firefox, make sure you have the [Greasemonkey][greasemonkey] add-on installed first.
13 |
14 | **To install, [click this userscript][userscript], then click Ok/Continue/Install in any browser confirmation dialogs that pop up.** Once installed, reload the [mir.aculo.us][] webpage. If you scroll down, you should see comments.
15 |
16 | ## What's a Userscript?
17 |
18 | Userscripts are a convenient way to be able to add extra functionality to webpages. Chrome has native support for userscripts as Extensions, and Firefox supports userscripts via the [Greasemonkey][greasemonkey] add-on.
19 |
20 | To manage userscripts:
21 |
22 | * In Chrome: Tools > Extensions
23 | * In Firefox: Greasemonkey > Manage User Scripts
24 |
25 | ## Updating
26 |
27 | Once the [userscript][userscript] has been installed, changes to the [main script file][mainscript] will automatically load whenever it's updated. Just reload the [mir.aculo.us][] webpage to get the latest version.
28 |
29 | ## Contributing
30 | In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/cowboy/grunt).
31 |
32 | _Also, please don't edit files in the "dist" subdirectory as they are generated via grunt. You'll find source code in the "src" subdirectory!_
33 |
34 | ## License
35 | Copyright (c) 2012 "Cowboy" Ben Alman
36 | Licensed under the MIT license.
37 |
38 |
--------------------------------------------------------------------------------
/src/commentaculous.js:
--------------------------------------------------------------------------------
1 | /*
2 | * comment.aculo.us
3 | * https://github.com/cowboy/comment.aculo.us
4 | *
5 | * Copyright (c) 2012 "Cowboy" Ben Alman
6 | * Licensed under the MIT license.
7 | * http://benalman.com/about/license/
8 | */
9 |
10 | var disqus_shortname;
11 |
12 | // From http://benalman.com/projects/run-jquery-code-bookmarklet/
13 | (function(window, document, reqVersion, callback, $, script, done, readystate) {
14 |
15 | // If jQuery isn't loaded, or is a lower version than specified, load the
16 | // specified version and call the callback, otherwise just call the callback.
17 | if (!($ = window.jQuery) || reqVersion > $.fn.jquery || callback($)) {
18 |
19 | // Create a script element.
20 | script = document.createElement('script');
21 | script.type = 'text/javascript';
22 |
23 | // Load the specified jQuery from the Google AJAX API server (minified).
24 | script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/' + reqVersion + '/jquery.min.js';
25 |
26 | // When the script is loaded, remove it, execute jQuery.noConflict( true )
27 | // on the newly-loaded jQuery (thus reverting any previous version to its
28 | // original state), and call the callback with the newly-loaded jQuery.
29 | script.onload = script.onreadystatechange = function() {
30 | if (!done && (!(readystate = this.readyState) ||
31 | readystate === 'loaded' || readystate === 'complete')) {
32 |
33 | callback(($ = window.jQuery).noConflict(1), done = 1);
34 |
35 | $(script).remove();
36 | }
37 | };
38 |
39 | // Add the script element to either the head or body, it doesn't matter.
40 | document.documentElement.childNodes[0].appendChild(script);
41 | }
42 |
43 | }(window, document,
44 |
45 | // Minimum jQuery version required. Change this as-needed.
46 | '1.7',
47 |
48 | // Your jQuery code goes inside this callback. $ refers to the jQuery object,
49 | // and L is a boolean that indicates whether or not an external jQuery file
50 | // was just "L"oaded.
51 | function($, L) {
52 |
53 | // Do stuff once jQuery is loaded.
54 | disqus_shortname = 'commentaculous';
55 | $('h1').last().closest('div').append('');
56 | $.getScript('http://' + disqus_shortname + '.disqus.com/embed.js');
57 |
58 | }
59 | ));
60 |
--------------------------------------------------------------------------------