Skip to content
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

basic url hash functionality to make examples linkable #31

Merged
merged 2 commits into from
Jan 28, 2015

Conversation

SoonDead
Copy link
Contributor

This is an attempt to do #30 .

Functionality is preserved. Back button works as expected.

I had to do an unlucky hack because args.name is modified in every call, so I had to copy the whole argument object before feeding it to open.
I did it with Object.create(), which is ES5 standard and solves this with simple prototype inheritance.
Every non-crappy browser supports it, but if IE8 support is necessary, I might need to change it.

if (example) {
explainGit.reset();
document.getElementById(linkId).classList.add('selected');
explainGit.open(Object.create(example));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I certainly don't care about IE8 at all! Although this should probably be done in the explainGit.open() method instead of here.

@SoonDead
Copy link
Contributor Author

I'm going to fix these issues you mentioned in this pull request.

moving Object.create into .open()
open = function (args) {
var name = prefix + args.name,
open = function (_args) {
var args = Object.create(_args),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved Object.create() into explainGit.open().

Renaming the parameter was harder to screw up then changing all internal references.

onlywei added a commit that referenced this pull request Jan 28, 2015
basic url hash functionality to make examples linkable
@onlywei onlywei merged commit 5320480 into onlywei:master Jan 28, 2015
@SoonDead SoonDead deleted the hash-in-url branch January 28, 2015 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants