forked from ywzhaiqi/userscript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 修正百度搜索规则 - 增加爱活网规则
- Loading branch information
Showing
7 changed files
with
6,633 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
tmp/ | ||
*.sublime-workspace | ||
*.sublime-workspace | ||
*.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
module.exports = function(grunt) { | ||
|
||
var concatOptions = { | ||
banner: '(function() {', | ||
footer: '})();', | ||
separator: '//----------------------------------' | ||
}; | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
clean: ['tmp'], | ||
concat: { | ||
dist: { | ||
options: concatOptions, | ||
src: ['src/meta.js', 'src/rule.js', 'src/main.js'], | ||
dest: '<%= pkg.name %>.user.js' | ||
}, | ||
}, | ||
watch: { | ||
files: ['src/**/*.js'], | ||
tasks: ['default'] | ||
} | ||
}) | ||
|
||
|
||
grunt.registerTask('split', 'split file', function () { | ||
grunt.file.expand('src/*').forEach(function(path){ | ||
grunt.file.delete(path); | ||
}); | ||
|
||
var source = grunt.file.read('super_preloaderplus_one.user.js'); | ||
|
||
// 去除首行和尾行 | ||
source = source.replace(/^\(function\(\).*/, '') | ||
.replace(/\}\)\(\);$/, ''); | ||
|
||
var arr = source.split(/\n\/\/\-+/); | ||
|
||
arr.forEach(function (text, index) { | ||
if (index === 0) { | ||
grunt.file.write('src/meta.js', text); | ||
} else { | ||
var match = text.match(/\n\/\/\s*(.*)/); | ||
var name = match ? match[1] : ('split' + index + '.js' ); | ||
grunt.file.write('src/' + name, text); | ||
} | ||
}); | ||
|
||
// grunt.log.writeln(); | ||
}); | ||
|
||
|
||
grunt.registerTask('default', [ | ||
//'jshint', | ||
'concat', | ||
]) | ||
|
||
grunt.registerTask('watch', ['watch']) | ||
|
||
grunt.loadNpmTasks('grunt-contrib-concat') | ||
grunt.loadNpmTasks('grunt-contrib-clean') | ||
grunt.loadNpmTasks('grunt-contrib-watch') | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "super_preloaderplus_one", | ||
"version": "6.2.0", | ||
"devDependencies": { | ||
"grunt": "~0.4.5", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-concat": "~0.4.0", | ||
"grunt-contrib-watch": "~0.6.1" | ||
} | ||
} |
Oops, something went wrong.