-
Notifications
You must be signed in to change notification settings - Fork 4
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
28 changed files
with
21,134 additions
and
232 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
output | ||
*.zip |
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,77 @@ | ||
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
clean: ['output', '*.zip'], | ||
copy: { | ||
dist: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'src', | ||
src: ['**', '!**/*.psd'], | ||
dest: 'output' | ||
}] | ||
} | ||
}, | ||
uglify: { | ||
dist: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'src', | ||
src: ['**/*.js', '!**/*.min.js'], | ||
dest: 'output' | ||
}] | ||
} | ||
}, | ||
cssmin: { | ||
dist: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'src', | ||
src: ['**/*.css', '!**/*.min.css'], | ||
dest: 'output' | ||
}] | ||
} | ||
}, | ||
jshint: { | ||
all: ['src/js/**/*.js', 'src/plugin/*.js'] | ||
}, | ||
'string-replace': { | ||
dist: { | ||
files: { | ||
'output/manifest.json': 'output/manifest.json' | ||
}, | ||
options: { | ||
replacements: [{ | ||
pattern: '0.0.0.0', | ||
replacement: '<%= grunt.template.today("yy.m.d") %>' | ||
}] | ||
} | ||
} | ||
}, | ||
compress: { | ||
main: { | ||
options: { | ||
archive: 'show-me-the-data-<%= grunt.template.today("yy.m.d") %>.zip' | ||
}, | ||
files: [{ | ||
expand: true, | ||
cwd: 'output', | ||
src: '**' | ||
}] | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-cssmin'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-string-replace'); | ||
grunt.loadNpmTasks('grunt-contrib-compress'); | ||
|
||
grunt.registerTask('default', ['jshint', 'clean', 'copy', 'uglify', 'cssmin', 'string-replace']); | ||
grunt.registerTask('release', function() { | ||
grunt.task.run('default', 'compress'); | ||
}); | ||
}; |
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,22 @@ | ||
{ | ||
"name": "show-me-the-data", | ||
"description": "a chrome extension for bingo-view users", | ||
"version": "13.11.1", | ||
"devDependencies": { | ||
"grunt": "~0.4.2", | ||
"grunt-contrib-uglify": "~0.2.7", | ||
"grunt-contrib-cssmin": "~0.7.0", | ||
"grunt-contrib-copy": "~0.5.0", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-jshint": "~0.8.0", | ||
"grunt-string-replace": "~0.2.7", | ||
"grunt-contrib-compress": "~0.5.3" | ||
}, | ||
"dependencies": { | ||
"grunt": "~0.4.2" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tbfe/show-me-the-data.git" | ||
} | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,65 @@ | ||
var PARAM_KEY = '__qa', | ||
LANGUAGE_KEY = '__type'; | ||
|
||
(function() { | ||
|
||
var KEY_URL = 'http://liye04.fe.baidu.com/key.php'; | ||
|
||
function _getKeyFromCache() { | ||
try { | ||
var value = localStorage.getItem(PARAM_KEY); | ||
if (value === "") { | ||
return false; | ||
} else { | ||
var time = localStorage.getItem('time'); | ||
if ((new Date(Number(time))).toDateString() === (new Date()).toDateString()) { | ||
return value; | ||
} else { | ||
return false; | ||
} | ||
} | ||
} catch (e) { | ||
return false; | ||
} | ||
return false; | ||
} | ||
|
||
function _cacheKeyFromServer(callback) { | ||
var xhr = new XMLHttpRequest(); | ||
xhr.onreadystatechange = function handleStateChange(xhrpe) { | ||
if (xhrpe.srcElement.readyState !== 4) { | ||
return; | ||
} | ||
var response = xhrpe.srcElement.response; | ||
localStorage.setItem(PARAM_KEY, response); | ||
localStorage.setItem('time', Date.now()); | ||
if (typeof callback === 'function') callback(response); | ||
}; | ||
xhr.open("GET", KEY_URL, true); | ||
xhr.send(); | ||
} | ||
|
||
var Cache = { | ||
getKey: function(callback) { | ||
var key = _getKeyFromCache(); | ||
if (key) { | ||
callback(key); | ||
} else { | ||
_cacheKeyFromServer(callback); | ||
} | ||
}, | ||
getLanguage: function() { | ||
try { | ||
language = localStorage.getItem('language'); | ||
} catch (e) {} | ||
return language || 'php'; | ||
}, | ||
setLanguage: function(language) { | ||
try { | ||
localStorage.setItem('language', language); | ||
} catch (e) {} | ||
} | ||
}; | ||
|
||
window.Cache = Cache; | ||
})(); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.