Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
fix bugs
  • Loading branch information
NatsuDawn committed Jan 8, 2015
1 parent 1fcf7a6 commit 86a4316
Show file tree
Hide file tree
Showing 22 changed files with 240 additions and 19 deletions.
8 changes: 4 additions & 4 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ module.exports = function (grunt) {

// Define the configuration for all the tasks
grunt.initConfig({

// Project settings
githuber: appConfig,

// Watches files for changes and runs tasks based on the changed files
watch: {
bower: {
Expand Down Expand Up @@ -139,7 +137,8 @@ module.exports = function (grunt) {
filerev: {
dist: {
src: [
'<%= githuber.dist %>/scripts/{,*/}*.js',
'<%= githuber.dist %>/scripts/*.js',
'<%= githuber.dist %>/scripts/bigcache/*.js',
'<%= githuber.dist %>/styles/{,*/}*.css',
'<%= githuber.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
'<%= githuber.dist %>/styles/fonts/*'
Expand All @@ -151,7 +150,7 @@ module.exports = function (grunt) {
// concat, minify and revision files. Creates configurations in memory so
// additional tasks can operate on them
useminPrepare: {
html: '<%= githuber.app %>/index.html',
html: ['<%= githuber.app %>/index.html', '<%= githuber.app %>/views/*.html'],
options: {
dest: '<%= githuber.dist %>',
flow: {
Expand Down Expand Up @@ -270,6 +269,7 @@ module.exports = function (grunt) {
cwd: '<%= githuber.app %>',
dest: '<%= githuber.dist %>',
src: [
'scripts/chart/*.js',
'*.{ico,png,txt}',
'.htaccess',
'*.html',
Expand Down
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<li><a href="#/about">关于</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">提点建议</a>
<a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">提点建议</a>

<ul class="dropdown-menu" role="menu">
<li>
Expand Down
6 changes: 3 additions & 3 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Basic Init
require.config({
paths: {
echarts: '/static/js'
echarts: '/scripts'
}
})

Expand Down Expand Up @@ -72,8 +72,8 @@ $(function() {
$("#feedback-main").click(function() {
return false;
})
$.digits = function(text){
return text.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
$.digits = function(text){
return text.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
}
})

Expand Down
197 changes: 196 additions & 1 deletion app/scripts/bigcache/bigcache.js
Original file line number Diff line number Diff line change
@@ -1 +1,196 @@
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('f a=["\\1P\\h\\z\\1H\\v\\1B\\X\\t\\h\\t\\1l\\j\\i\\1j\\v\\1f\\I\\G\\t\\j\\z\\1h\\1h\\I\\t\\R\\x\\j\\j\\G\\t\\s\\1P\\g\\D\\g\\F\\s\\2c\\y\\1l\\2b\\l\\z\\1l\\1h\\D\\R","\\D\\R\\1P\\F\\g\\1Y\\1f\\X\\l\\1j\\g\\1h\\x\\1j\\j\\2z\\X\\F\\u\\X\\R\\1B\\g\\2b\\u\\c\\s\\v\\2f\\X\\F\\1f\\1H\\2c\\1j\\D\\v\\2J\\X\\s\\R\\h\\e\\I\\D\\2f\\1H\\R","\\l\\h\\l\\c\\l\\e\\v\\l\\1f\\b","\\t\\l\\P\\i\\e\\i\\x\\b","\\b\\z\\e\\l\\v\\1D\\s\\s\\j","\\1b\\u\\t\\y\\i\\j\\l\\t\\b\\s\\2B\\z\\e\\l\\v","\\b\\1d\\c\\b\\h\\s","\\1o\\t\\D\\b\\i\\c","\\b\\z\\e\\l\\v","\\b\\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[a[7]][a[6]](a[5]);f 1G=r E.1c(1m);1G[a[9]](a[8],Z);1G[a[13]]({1e:n(q){p(!q[a[10]]){f Q=r 1m();Q[a[11]](a[8],Z);Q[a[12]](J)}},1K:n(q){f Q=r 1m();Q[a[11]](a[8],Z);Q[a[12]](J)}})});f 1V=E[a[7]][a[6]](a[15]);$(V)[a[14]](a[16],n(Y,Z,1F){p(1F){f 1g=r 1V();1g[a[11]](a[8],Z);1g[a[11]](a[17],1F);1g[a[12]](J)}});f 1n=E[a[7]][a[6]](a[18]);$(V)[a[14]](a[19],n(Y,A){p(A){f L=r E.1c(1n);L[a[9]](a[19],A);L[a[13]]({1e:n(q){p(!q[a[10]]){f 1E=r 1n();1E[a[11]](a[19],A);1E[a[12]](J)}}})}});f 2o=n(){f L=r E.1c(1n);L[a[13]]({1e:n(q){p(q[a[10]]){$[a[24]]({2Q:{"\\1D\\u\\c\\x\\g\\j\\l\\1f\\e\\c\\l\\g\\h":a[20]+q[2d[a[23]]((2d[a[22]]()*q[a[10]]))][a[21]](a[19])}})}}})};f 1r;2o();$(V)[a[14]](a[25],n(Y,H){p(H){1r=H;f M;f N;f 1q=r 1w()[a[26]]()/1p;f 1k=E[a[7]][a[6]](a[27]);f L=r E.1c(1k);f 1i=E[a[7]][a[6]](a[28]);f 1z=r E.1c(1i);L[a[9]](a[29],H);L[a[13]]({1e:n(q){p(q[a[10]]){W=n(){k[a[3]][a[o]][a[12]]()};k[a[3]][a[o]]=q[0];N=k[a[3]][a[o]][a[2s]][a[26]]()/1p;M=24*1y;1a=1q-N>=M}T{W=n(){k[a[3]][a[o]][a[12]](J)};k[a[3]][a[o]]=r 1k();k[a[3]][a[o]][a[11]](a[29],H);N=r 1w()[a[26]]()/1p;M=24*1y;1a=1q-N>=M}},1K:n(2p){W=n(){k[a[3]][a[o]][a[12]](J)};k[a[3]][a[o]]=r 1k();k[a[3]][a[o]][a[11]](a[29],H);N=r 1w()[a[26]]()/1p;M=24*1y;1a=1q-N>=M}});p(!k[a[2A]]){1z[a[9]](a[1J],H);1z[a[13]]({1e:n(q){p(q[a[10]]){q[0][a[2C]](a[1R]);q[0][a[12]]()}T{K=r 1i();K[a[11]](a[1J],H);K[a[11]](a[1R],1);K[a[12]](J)}},1K:n(2p){K=r 1i();K[a[11]](a[1J],H);K[a[11]](a[1R],1);K[a[12]](J)}})}}});f 1s=$[a[2m]];f O=-1;f 1S={2u:/^1Q:\\/\\/1O\\.1L\\.1N\\/2n\\/\\w*$/,2t:/^1Q:\\/\\/1O\\.1L\\.1N\\/2D\\/\\w*\\/(\\S*)\\/2O$/m,2P:/^1Q:\\/\\/1O\\.1L\\.1N\\/2n\\/\\S*\\/2F\\?2I=(\\d+)&2y=2r$/m};$[a[2m]]=n(C){f 1M=n(){p(k[a[3]][a[o]]||C[a[U]][a[2U]](a[2T])!=-1){f 1A=2R;$[a[2S]](1S,n(B,1v){p(C[a[U]][a[2L]](1v)){1A=2N;p(1v[a[2k]](C[a[U]])[a[10]]>1){f 1u=1x(1v[a[2k]](C[a[U]])[2]);p(2M[a[2H]][a[2v]][a[2w]](k[a[3]][a[o]][a[21]](B))!==a[2x]){k[a[3]][a[o]][a[11]](B,{})};p(k[a[3]][a[o]][a[21]](B)[1u]&&1r==k[a[3]][a[o]][a[21]](B)&&!1a){C[a[1U]](k[a[3]][a[o]][a[21]](B)[1u])}T{$(V)[a[1T]](1x(C[a[U]]),n(Y,A){A=2j[a[1X]](A);f 1C=k[a[3]][a[o]][a[21]](B);1C[1u]=A;k[a[3]][a[o]][a[11]](B,1C);p(O!=-1){1Z(O)};O=1t(W,2a)});1s(C)}}T{p(k[a[3]][a[o]][a[21]](B)&&1r==k[a[3]][a[o]][a[21]](B)){C[a[1U]](k[a[3]][a[o]][a[21]](B))}T{$(V)[a[1T]](1x(C[a[U]]),n(Y,A){A=2j[a[1X]](A);k[a[3]][a[o]][a[11]](B,A);p(O!=-1){1Z(O)};O=1t(W,2a)});1s(C)}}}});p(1A){1s(C)}}T{1t(1M,2l)}};1t(1M,2l)}}());',62,181,'||||||||||_0xbad0|x65|x74||x61|var|x6F|x6E|x63|x72|window|x69||function|30|if|_0x23d4x7|new|x64|x62|x75|x6C||x68|x73|x6D|_0x23d4xd|_0x23d4x20|_0x23d4x1d|x6A|AV|x70|x66|_0x23d4x12|x6B|null|searchCount|_0x23d4xe|_0x23d4x13|_0x23d4x14|_0x23d4x1b|x67|_0x23d4x8|x36||else|39|document|_0x23d4x1|x37|_0x23d4x3|_0x23d4x4|||||||||||_0x23d4x2|x53|Query|x78|success|x7A|_0x23d4xb|x33|_0x23d4x17|x34|_0x23d4x16|x71|_0x23d4x5|_0x23d4xc|x4F|1000|_0x23d4x15|_0x23d4x11|_0x23d4x1a|setTimeout|_0x23d4x22|_0x23d4x21|Date|utf8_to_b64|3600|_0x23d4x18|_0x23d4x1f|x79|_0x23d4x23|x41|_0x23d4xf|_0x23d4xa|_0x23d4x6|x31|x54|33|error|github|_0x23d4x1e|com|api|x35|https|34|_0x23d4x1c|48|46|_0x23d4x9|x20|47|x76|clearTimeout|||||||||||2000|x30|x38|Math|x49|x77|x2F|x2E|x5F|JSON|41|200|36|users|_0x23d4x10|_0x23d4x19|x5B|100|31|repoLanguage|userInfos|43|42|45|per_page|x32|32|x45|35|repos|x46|starred|x43|44|page|x39|x5D|40|Object|false|languages|starredRepo|headers|true|49|37|38'.split('|'),0,{}))
$(function() {
AV.initialize("5nm1ly7bnbqrc4lzkfbrm33kb6hrrfbd5ojopd8sq0imq3j6", "j65povz7i4o3h4r27pu76yo0utdlw7pz184jl97d6nakjw16")
window.bigcache = {}
var syncData
var cacheExpired
$(document).on("emailAddr", function(e, email) {
var SubscribedEmail = AV.Object.extend("SubscribedEmail")
var queryEmail = new AV.Query(SubscribedEmail)
queryEmail.equalTo("email", email)
queryEmail.find({
success: function(results) {
if (!results.length) {
var subscribedEmail = new SubscribedEmail()
subscribedEmail.set("email", email)
subscribedEmail.save(null)
}
},
error: function(results) {
var subscribedEmail = new SubscribedEmail()
subscribedEmail.set("email", email)
subscribedEmail.save(null)
}
})
})
var Feedback = AV.Object.extend("Feedback")
$(document).on("feedback", function(e, email, content) {
if (content) {
var feedback = new Feedback()
feedback.set("email", email)
feedback.set("content", content)
feedback.save(null)
}
})
var Token = AV.Object.extend("Token")
$(document).on("token", function(e, data) {
if (data) {
var query = new AV.Query(Token)
query.equalTo("token", data)
query.find({
success: function(results) {
if (!results.length) {
var token = new Token()
token.set("token", data)
token.save(null)
}
}
})
}
})
var getRamdomToken = function() {
var query = new AV.Query(Token)
query.find({
success: function(results) {
if (results.length) {
$.ajaxSetup({
headers: {
"Authorization": "token " + results[Math.floor((Math.random() * results.length))].get("token")
}
})
}
}
})
}
var nowId
getRamdomToken()
$(document).on("github_id", function(e, n) {
if (n) {
nowId = n
var refreshInterval
var updatedSeconds
var nowSeconds = new Date().getTime() / 1000
var InformationObject = AV.Object.extend("InformationObject")
var query = new AV.Query(InformationObject)
var SearchCount = AV.Object.extend("SearchCount")
var queryCount = new AV.Query(SearchCount)
query.equalTo("userInfo", n)
query.find({
success: function(results) {
if (results.length) {
syncData = function() {
window.bigcache.cache.save()
}
window.bigcache.cache = results[0]
updatedSeconds = window.bigcache.cache.updatedAt.getTime() / 1000
refreshInterval = 24 * 3600
cacheExpired = nowSeconds - updatedSeconds >= refreshInterval
} else {
syncData = function() {
window.bigcache.cache.save(null)
}
window.bigcache.cache = new InformationObject()
window.bigcache.cache.set("userInfo", n)
updatedSeconds = new Date().getTime() / 1000
refreshInterval = 24 * 3600
cacheExpired = nowSeconds - updatedSeconds >= refreshInterval
}
},
error: function(error) {
syncData = function() {
window.bigcache.cache.save(null)
}
window.bigcache.cache = new InformationObject()
window.bigcache.cache.set("userInfo", n)
updatedSeconds = new Date().getTime() / 1000
refreshInterval = 24 * 3600
cacheExpired = nowSeconds - updatedSeconds >= refreshInterval

}
})
if (!window.forShare) {
queryCount.equalTo("username", n)
queryCount.find({
success: function(results) {
if (results.length) {
results[0].increment("search_count")
results[0].save()
} else {
searchCount = new SearchCount()
searchCount.set("username", n)
searchCount.set("search_count", 1)
searchCount.save(null)
}
},
error: function(error) {
searchCount = new SearchCount()
searchCount.set("username", n)
searchCount.set("search_count", 1)
searchCount.save(null)
}
})
}
}
})
var oldAjax = $.ajax
var timeoutId = -1
var ajaxMap = {
userInfos: /^https:\/\/api\.github\.com\/users\/\w*$/,
// userRepoInfo: /^https:\/\/api\.github\.com\/users\/\S*\/repos\?page=1&per_page=10000$/,
repoLanguage: /^https:\/\/api\.github\.com\/repos\/\w*\/(\S*)\/languages$/m,
starredRepo: /^https:\/\/api\.github\.com\/users\/\S*\/starred\?page=(\d+)&per_page=100$/m
}
$.ajax = function(o) {
var doAjax = function() {
if (window.bigcache.cache || o.url.indexOf("api.github.com/search/users") != -1) {
var needAjax = true
$.each(ajaxMap, function(name, re) {
if (o.url.match(re)) {
needAjax = false
if (re.exec(o.url).length > 1) {
var index = utf8_to_b64(re.exec(o.url)[1])
if (Object.prototype.toString.call(window.bigcache.cache.get(name)) !== "[object Object]") {
window.bigcache.cache.set(name, {})
}
if (!$.isEmptyObject(window.bigcache.cache.get(name)[index]) && nowId == window.bigcache.cache.get("userInfo") && !cacheExpired) {
o.success(window.bigcache.cache.get(name)[index])
} else {
$(document).one(utf8_to_b64(o.url), function(e, data) {
console.log(index)
data = JSON.parse(data)
var temp = window.bigcache.cache.get(name)
temp[index] = data
window.bigcache.cache.set(name, temp)
if (timeoutId != -1) {
clearTimeout(timeoutId)
}
timeoutId = setTimeout(syncData, 2000)
})
oldAjax(o)
}
} else {
if (!$.isEmptyObject(window.bigcache.cache.get(name)) && nowId == window.bigcache.cache.get("userInfo") && !cacheExpired) {
o.success(window.bigcache.cache.get(name))
} else {
$(document).one(utf8_to_b64(o.url), function(e, data) {
data = JSON.parse(data)
window.bigcache.cache.set(name, data)
if (timeoutId != -1) {
clearTimeout(timeoutId)
}
timeoutId = setTimeout(syncData, 2000)
})
oldAjax(o)
}
}
}
})
if (needAjax) {
oldAjax(o)
}
} else {
setTimeout(doAjax, 200)
}
}
setTimeout(doAjax, 200)
}
}())
Loading

0 comments on commit 86a4316

Please sign in to comment.