-
Notifications
You must be signed in to change notification settings - Fork 141
Fix for the sketchy Yahoo API #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
PLEASE review my code. It works but I'm afraid it's a bit hacky.
@@ -27,11 +28,10 @@ function update_counter() { | |||
$('#counter').text(_cnt).parent().toggle(!!_cnt); | |||
} | |||
|
|||
|
|||
var x2js = new X2JS(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see where this is coming from
@@ -48,15 +48,27 @@ function realmAPI(path, opts, extraopts, callback) { | |||
ifr.src = url | |||
return | |||
} | |||
|
|||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please don't leave commented code, version control exists for a reason
complete: function(result){ | ||
var jsonResult = x2js.xml_str2json(result.responseText); | ||
//console.log(JSON.stringify(jsonResult)); | ||
callback(jsonResult); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you changed the type of the argument that is passed to callback (it used to be the xhr object) and didn't fix all instances where this function is used (namely the migrate/progress
call in mule.js
)
@@ -1,3 +1,4 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of the whitespace changes are uncalled for. also use tabs for indentation (in all the other places)
} else { | ||
data.query.results.Chars = d | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These switches are presumably for compatibility with yql? If you intend to have it as a fallback, actually do it.
@@ -309,13 +307,22 @@ var STATTAGS = 'MaxHitPoints MaxMagicPoints Attack Defense Speed Dexterity HpReg | |||
var STATABBR = 'HP MP ATT DEF SPD DEX VIT WIS'.split(' ') | |||
Mule.prototype.parse = function(data) { | |||
if (this.overlay) this.overlay.hide() | |||
|
|||
var d = data.query.results.Chars | |||
console.log(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no
@@ -89,7 +89,7 @@ function addreloader(mule, target) { | |||
var rld = $('<div class="button">') | |||
rld.text('\u21bb') | |||
if (mule.data) { | |||
var updated = new Date(mule.data.query.created) | |||
var updated = new Date(mule.data.created) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the query
object and it's created
property are inherent to the yql api. With your changes this is same as new Date()
which is not correct if loading from cache. You need to set this timestamp yourself after updating.
Like I said, it was just a hacky example of getting rid of YQL, not intended to be shipped out immediately. I didn't mean to leave my code so ugly but I just wanted you to see an alternative. I didn't exactly go through the entire code to look for syntax, I was just trying to make it workable. I'm not the greatest at just picking up a project out of the blue and making glorious edits, sorry about that. But yeah, I just wanted to give an example of life without the Yahoo API. |
PLEASE review my code. It works but I'm afraid it's a bit hacky.