Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3

Conflicts:
	4chan_x.user.js
This commit is contained in:
Zixaphir 2013-03-18 12:28:52 -07:00
commit f50c1fcedf
11 changed files with 408 additions and 162 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
builds/
node_modules/ node_modules/
tmp/ tmp/
4chan_x.user.js 4chan_x.user.js

View File

@ -6,16 +6,16 @@
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com> // @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
// @copyright 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com> // @copyright 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
// @license MIT; http://en.wikipedia.org/wiki/Mit_license // @license MIT; http://en.wikipedia.org/wiki/Mit_license
// @match *://api.4chan.org/*
// @match *://boards.4chan.org/* // @match *://boards.4chan.org/*
// @match *://images.4chan.org/* // @match *://images.4chan.org/*
// @match *://sys.4chan.org/* // @match *://sys.4chan.org/*
// @match *://api.4chan.org/*
// @grant GM_getValue // @grant GM_getValue
// @grant GM_setValue // @grant GM_setValue
// @grant GM_deleteValue // @grant GM_deleteValue
// @grant GM_openInTab // @grant GM_openInTab
// @run-at document-start // @run-at document-start
// @updateURL https://github.com/MayhemYDG/4chan-x/raw/v3/4chan_x.meta.js // @updateURL https://github.com/MayhemYDG/4chan-x/raw/v3/4chan-X.meta.js
// @downloadURL https://github.com/MayhemYDG/4chan-x/raw/v3/4chan_x.user.js // @downloadURL https://github.com/MayhemYDG/4chan-x/raw/v3/4chan-X.user.js
// @icon data:image/gif;base64,R0lGODlhEAAQAKECAAAAAGbMM////////yH5BAEKAAIALAAAAAAQABAAAAIxlI+pq+D9DAgUoFkPDlbs7lGiI2bSVnKglnJMOL6omczxVZK3dH/41AG6Lh7i6qUoAAA7 // @icon data:image/gif;base64,R0lGODlhEAAQAKECAAAAAGbMM////////yH5BAEKAAIALAAAAAAQABAAAAIxlI+pq+D9DAgUoFkPDlbs7lGiI2bSVnKglnJMOL6omczxVZK3dH/41AG6Lh7i6qUoAAA7
// ==/UserScript== // ==/UserScript==

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,5 @@ Note: this is only used to release new 4chan X versions, and is **not** needed o
### Contribute ### Contribute
- Edit the CoffeeScript sources. - Edit the CoffeeScript sources.
- Build the JavaScript.
- If the edits affect regular users, edit the changelog. - If the edits affect regular users, edit the changelog.
- Fork the repository.
- Open a pull request. - Open a pull request.

View File

@ -23,7 +23,31 @@ module.exports = (grunt) ->
] ]
dest: 'tmp/script.coffee' dest: 'tmp/script.coffee'
script: manifest:
options:
process:
data: pkg
src: 'src/manifest.json',
dest: 'builds/crx/manifest.json'
metadata:
options:
process:
data: pkg
src: 'src/metadata.js',
dest: '<%= pkg.name %>.meta.js'
crx:
options:
process:
data: pkg
src: [
'src/banner.js'
'tmp/script.js'
]
dest: 'builds/crx/script.js'
userscript:
options: options:
process: process:
data: pkg data: pkg
@ -32,14 +56,12 @@ module.exports = (grunt) ->
'src/banner.js' 'src/banner.js'
'tmp/script.js' 'tmp/script.js'
] ]
dest: '<%= pkg.meta.files.userjs %>' dest: '<%= pkg.name %>.user.js'
metadata: userjs:
options: # Lazily copy the userscript
process: src: '<%= pkg.name %>.user.js'
data: pkg dest: 'builds/<%= pkg.name %>.js'
src: 'src/metadata.js',
dest: '<%= pkg.meta.files.metajs %>'
coffee: coffee:
script: script:
@ -88,10 +110,13 @@ module.exports = (grunt) ->
grunt.loadNpmTasks 'grunt-exec' grunt.loadNpmTasks 'grunt-exec'
grunt.registerTask 'default', [ grunt.registerTask 'default', [
'concat:coffee' 'concat:coffee',
'coffee:script' 'coffee:script',
'concat:script' 'concat:manifest',
'concat:metadata' 'concat:crx',
'concat:userscript',
'concat:userjs',
'concat:metadata',
'clean' 'clean'
] ]
@ -103,8 +128,24 @@ module.exports = (grunt) ->
grunt.registerTask 'patch', [ grunt.registerTask 'patch', [
'bump' 'bump'
'updcl:3'
] ]
grunt.registerTask 'upgrade', [ grunt.registerTask 'minor', [
'bump:minor' 'bump:minor'
'updcl:2'
] ]
grunt.registerTask 'major', [
'bump:major'
'updcl:1'
]
grunt.registerTask 'updcl', 'Update the changelog', (i) ->
# Update the `pkg` object with the new version.
pkg = grunt.file.readJSON('package.json');
# i is the number of #s for markdown.
version = []
version.length = +i + 1
version = version.join('#') + ' ' + pkg.version + ' *(' + grunt.template.today('yyyy-mm-dd') + ')*'
grunt.file.write 'CHANGELOG.md', version + '\n' + grunt.file.read('CHANGELOG.md')
grunt.log.ok 'Changelog updated for v' + pkg.version + '.'

View File

@ -1,106 +0,0 @@
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
// Project configuration.
grunt.initConfig({
pkg: pkg,
concat: {
coffee: {
options: { process: { data: pkg } },
src: [
'src/config.coffee',
'src/globals.coffee',
'lib/ui.coffee',
'lib/$.coffee',
'lib/polyfill.coffee',
'src/features.coffee',
'src/qr.coffee',
'src/report.coffee',
'src/main.coffee'
],
dest: 'tmp/script.coffee'
},
script: {
options: { process: { data: pkg } },
src: [
'src/metadata.js',
'src/banner.js',
'tmp/script.js'
],
dest: '<%= pkg.meta.files.userjs %>'
},
metadata: {
options: { process: { data: pkg } },
src: 'src/metadata.js',
dest: '<%= pkg.meta.files.metajs %>'
}
},
coffee: {
script: {
src: 'tmp/script.coffee',
dest: 'tmp/script.js'
}
},
exec: {
commit: {
command: function() {
var release = pkg.meta.name + ' v' + pkg.version;
return [
'git checkout ' + pkg.meta.mainBranch,
'git commit -am "Release ' + release + '."',
'git tag -a ' + pkg.version + ' -m "' + release + '."',
'git tag -af stable-v3 -m "' + release + '."'
].join(' && ');
},
stdout: true
},
push: {
command: 'git push origin --all && git push origin --tags',
stdout: true
}
},
watch: {
all: {
options: {
interrupt: true
},
files: [
'Gruntfile.js',
'package.json',
'lib/**/*.coffee',
'src/**/*.coffee',
'src/**/*.js',
'css/**/*.css',
'img/*'
],
tasks: 'default'
}
},
clean: {
tmp: 'tmp'
}
});
grunt.loadNpmTasks('grunt-bump');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('default', ['concat:coffee', 'coffee:script', 'concat:script', 'concat:metadata', 'clean']);
grunt.registerTask('release', ['default', 'exec:commit', 'exec:push']);
grunt.registerTask('patch', ['bump', 'updcl:3']);
grunt.registerTask('minor', ['bump:minor', 'updcl:2']);
grunt.registerTask('major', ['bump:major', 'updcl:1']);
grunt.registerTask('updcl', 'Update the changelog', function(i) {
// Update the `pkg` object with the new version.
pkg = grunt.file.readJSON('package.json');
// i is the number of #s for markdown.
var version = new Array(+i + 1).join('#') + ' ' + pkg.version + ' *(' + grunt.template.today('yyyy-mm-dd') + ')*';
grunt.file.write('CHANGELOG.md', version + '\n' + grunt.file.read('CHANGELOG.md'));
grunt.log.ok('Changelog updated for v' + pkg.version + '.');
});
};

View File

@ -232,7 +232,7 @@ $.extend $,
unsafeWindow: unsafeWindow:
if window.opera # Opera if window.opera # Opera
window window
else if unsafeWindow isnt window # Firefox else if unsafeWindow? # Firefox
unsafeWindow unsafeWindow
else # Chrome else # Chrome
do -> do ->

View File

@ -7,16 +7,18 @@
"repo": "https://github.com/MayhemYDG/4chan-x/", "repo": "https://github.com/MayhemYDG/4chan-x/",
"page": "http://mayhemydg.github.com/4chan-x/", "page": "http://mayhemydg.github.com/4chan-x/",
"mainBranch": "v3", "mainBranch": "v3",
"files": { "matches": [
"metajs": "4chan_x.meta.js", "*://api.4chan.org/*",
"userjs": "4chan_x.user.js" "*://boards.4chan.org/*",
} "*://images.4chan.org/*",
"*://sys.4chan.org/*"
]
}, },
"devDependencies": { "devDependencies": {
"grunt": "~0.4.0", "grunt": "~0.4.0",
"grunt-bump": "~0.0.0", "grunt-bump": "~0.0.0",
"grunt-contrib-clean": "~0.4.0", "grunt-contrib-clean": "~0.4.0",
"grunt-contrib-coffee": "~0.6.0", "grunt-contrib-coffee": "~0.6.2",
"grunt-contrib-concat": "~0.1.0", "grunt-contrib-concat": "~0.1.0",
"grunt-contrib-watch": "~0.3.0", "grunt-contrib-watch": "~0.3.0",
"grunt-exec": "~0.4.0" "grunt-exec": "~0.4.0"

View File

@ -8,7 +8,7 @@ d = document
doc = null doc = null
g = g =
VERSION: '<%= version %>' VERSION: '<%= version %>'
NAMESPACE: "<%= meta.name %>." NAMESPACE: '<%= meta.name %>.'
boards: {} boards: {}
threads: {} threads: {}
posts: {} posts: {}

14
src/manifest.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "<%= meta.name %>",
"version": "<%= version %>",
"manifest_version": 2,
"description": "<%= description %>",
"content_scripts": [{
"js": ["script.js"],
"matches": <%= JSON.stringify(meta.matches) %>,
"run_at": "document_start"
}],
"homepage_url": "<%= meta.page %>",
"incognito": "spanning",
"minimum_chrome_version": "25"
}

View File

@ -6,16 +6,17 @@
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com> // @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
// @copyright 2012-<%= grunt.template.today('yyyy') %> Nicolas Stepien <stepien.nicolas@gmail.com> // @copyright 2012-<%= grunt.template.today('yyyy') %> Nicolas Stepien <stepien.nicolas@gmail.com>
// @license MIT; http://en.wikipedia.org/wiki/Mit_license // @license MIT; http://en.wikipedia.org/wiki/Mit_license
// @match *://boards.4chan.org/* <%=
// @match *://images.4chan.org/* meta.matches.map(function(match) {
// @match *://sys.4chan.org/* return '// @match ' + match;
// @match *://api.4chan.org/* }).join('\n')
%>
// @grant GM_getValue // @grant GM_getValue
// @grant GM_setValue // @grant GM_setValue
// @grant GM_deleteValue // @grant GM_deleteValue
// @grant GM_openInTab // @grant GM_openInTab
// @run-at document-start // @run-at document-start
// @updateURL <%= meta.repo %>raw/<%= meta.mainBranch %>/<%= meta.files.metajs %> // @updateURL <%= meta.repo %>raw/<%= meta.mainBranch %>/<%= name %>.meta.js
// @downloadURL <%= meta.repo %>raw/<%= meta.mainBranch %>/<%= meta.files.userjs %> // @downloadURL <%= meta.repo %>raw/<%= meta.mainBranch %>/<%= name %>.user.js
// @icon data:image/gif;base64,<%= grunt.file.read('img/icon.gif', {encoding: 'base64'}) %> // @icon data:image/gif;base64,<%= grunt.file.read('img/icon.gif', {encoding: 'base64'}) %>
// ==/UserScript== // ==/UserScript==