Make Chrome ext/userscript/userjs builds.
This commit is contained in:
parent
f4c248f18c
commit
0a41f0ae6c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
|
builds/
|
||||||
node_modules/
|
node_modules/
|
||||||
tmp/
|
tmp/
|
||||||
|
|||||||
@ -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==
|
||||||
|
|||||||
@ -6,21 +6,21 @@
|
|||||||
// @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==
|
||||||
|
|
||||||
/* 4chan X Beta - Version 3.0.0 - 2013-03-15
|
/* 4chan X Beta - Version 3.0.0 - 2013-03-18
|
||||||
* http://mayhemydg.github.com/4chan-x/
|
* http://mayhemydg.github.com/4chan-x/
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
|
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
|
||||||
@ -918,7 +918,7 @@
|
|||||||
$.add(d.head, script);
|
$.add(d.head, script);
|
||||||
return $.rm(script);
|
return $.rm(script);
|
||||||
},
|
},
|
||||||
unsafeWindow: window.opera ? window : unsafeWindow !== window ? unsafeWindow : (function() {
|
unsafeWindow: window.opera ? window : typeof unsafeWindow !== "undefined" && unsafeWindow !== null ? unsafeWindow : (function() {
|
||||||
var p;
|
var p;
|
||||||
p = d.createElement('p');
|
p = d.createElement('p');
|
||||||
p.setAttribute('onclick', 'return window');
|
p.setAttribute('onclick', 'return window');
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
41
Gruntfile.js
41
Gruntfile.js
@ -21,19 +21,37 @@ module.exports = function(grunt) {
|
|||||||
],
|
],
|
||||||
dest: 'tmp/script.coffee'
|
dest: 'tmp/script.coffee'
|
||||||
},
|
},
|
||||||
script: {
|
manifest: {
|
||||||
|
options: { process: { data: pkg } },
|
||||||
|
src: 'src/manifest.json',
|
||||||
|
dest: 'builds/crx/manifest.json'
|
||||||
|
},
|
||||||
|
crx: {
|
||||||
|
options: { process: { data: pkg } },
|
||||||
|
src: [
|
||||||
|
'src/banner.js',
|
||||||
|
'tmp/script.js'
|
||||||
|
],
|
||||||
|
dest: 'builds/crx/script.js'
|
||||||
|
},
|
||||||
|
metadata: {
|
||||||
|
options: { process: { data: pkg } },
|
||||||
|
src: 'src/metadata.js',
|
||||||
|
dest: 'builds/<%= pkg.name %>.meta.js'
|
||||||
|
},
|
||||||
|
userscript: {
|
||||||
options: { process: { data: pkg } },
|
options: { process: { data: pkg } },
|
||||||
src: [
|
src: [
|
||||||
'src/metadata.js',
|
'src/metadata.js',
|
||||||
'src/banner.js',
|
'src/banner.js',
|
||||||
'tmp/script.js'
|
'tmp/script.js'
|
||||||
],
|
],
|
||||||
dest: '<%= pkg.meta.files.userjs %>'
|
dest: 'builds/<%= pkg.name %>.user.js'
|
||||||
},
|
},
|
||||||
metadata: {
|
userjs: {
|
||||||
options: { process: { data: pkg } },
|
// Lazily copy the userscript
|
||||||
src: 'src/metadata.js',
|
src: 'builds/<%= pkg.name %>.user.js',
|
||||||
dest: '<%= pkg.meta.files.metajs %>'
|
dest: 'builds/<%= pkg.name %>.js'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
coffee: {
|
coffee: {
|
||||||
@ -89,7 +107,16 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||||
grunt.loadNpmTasks('grunt-exec');
|
grunt.loadNpmTasks('grunt-exec');
|
||||||
|
|
||||||
grunt.registerTask('default', ['concat:coffee', 'coffee:script', 'concat:script', 'concat:metadata', 'clean']);
|
grunt.registerTask('default', [
|
||||||
|
'concat:coffee',
|
||||||
|
'coffee:script',
|
||||||
|
'concat:manifest',
|
||||||
|
'concat:crx',
|
||||||
|
'concat:userscript',
|
||||||
|
'concat:userjs',
|
||||||
|
'concat:metadata',
|
||||||
|
'clean'
|
||||||
|
]);
|
||||||
grunt.registerTask('release', ['default', 'exec:commit', 'exec:push']);
|
grunt.registerTask('release', ['default', 'exec:commit', 'exec:push']);
|
||||||
grunt.registerTask('patch', ['bump', 'updcl:3']);
|
grunt.registerTask('patch', ['bump', 'updcl:3']);
|
||||||
grunt.registerTask('minor', ['bump:minor', 'updcl:2']);
|
grunt.registerTask('minor', ['bump:minor', 'updcl:2']);
|
||||||
|
|||||||
@ -189,7 +189,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 ->
|
||||||
|
|||||||
10
package.json
10
package.json
@ -7,10 +7,12 @@
|
|||||||
"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",
|
||||||
|
|||||||
14
src/manifest.json
Normal file
14
src/manifest.json
Normal 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"
|
||||||
|
}
|
||||||
@ -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==
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user