AgeManning / EthereumMiningCalculator

Advanced statistics for mining ethereum and other cryptocurrencies.
https://thecalc.io
16 stars 11 forks source link

Implement mathJax #25

Open AgeManning opened 8 years ago

AgeManning commented 8 years ago

Implement mathJax for my math typesetting.

AgeManning commented 8 years ago

This was working in the commit that closed it. But now mathjax only recognizes things in index.html. It doesn't work for inject html, but it did previously. I'm not sure what has changed? Maybe he have a discussion on this one.

paulhauner commented 8 years ago

I fixed this in b24c28eedc0ada46b29c3f26b4f0b12a1c10ef7c. (I made a mistake in the commit message and didn't close it via that).

I have created a mathjaxBind directive which calls Mathjax.Hub.Typeset() after the directives $scope is updated.

You should add a mathjax-bind HTML attribute (eg, <span mathjax-bind>{{formula}}</span> to anything you want to trigger a mathjax Typeset() after a $scope digest cycle.

As the new directive will not detect changes in child scopes, you must add the mathjax-bind element to the element closest to the mathjax equation. For example, you can't just add mathjax-bind to <body> because it won't notice when a $scope change happens further down inside a forecaster input directive.

There is probably a more efficient way to do this (I am pretty sure mathjax scans the whole page each time), however this works and doesn't seem to cause issues.

Keep an eye out for bugs as I wouldn't be surprised if something has slipped through the net.

paulhauner commented 8 years ago

Still an issue - can't get it to work consistently. I need to come back to this.

paulhauner commented 8 years ago

FYI, the issue here is determining when Typeset() should run - we might have to call it manually.

AgeManning commented 8 years ago

I've sort of fixed this. about to commit. I made a new problem in my solution however

AgeManning commented 8 years ago

Not sure whether I've improved this or not. But it does basically what I want. However the text after the equation's don't show?. Not super important, but would be nice. See e6e944804c4da9db820e16ffadf63b2e355846fb