1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-08-14 04:34:21 +02:00

updated the hash resolver for disqus links

This commit is contained in:
Pomax
2018-06-20 08:41:02 -07:00
parent 0600c4b759
commit f4f9067793
9 changed files with 57 additions and 16 deletions

View File

@@ -1,16 +1,20 @@
var React = require("react");
var hashResolver = require("../lib/hash-resolver.js");
var SectionHeader = React.createClass({
statics: {
locale: ''
locale: ""
},
render: function() {
var locale = SectionHeader.locale;
if (typeof window !== "undefined" && window.location.toString().indexOf(locale) === -1) {
locale = '';
if (
typeof window !== "undefined" &&
window.location.toString().indexOf(locale) === -1
) {
locale = "";
}
var fragmentid = `${locale ? './' + locale + '/': '.'}#${this.props.name}`;
var fragmentid = `${locale ? "./" + locale + "/" : "."}#${this.props.name}`;
return (
<h2 id={this.props.name} data-num={this.props.number}>
<a href={fragmentid}>{this.props.title}</a>
@@ -18,12 +22,7 @@ var SectionHeader = React.createClass({
);
},
componentDidMount() {
if (typeof window !== "undefined" && window.location) {
var h = window.location.hash;
if (h) {
window.location = window.location.hash;
}
}
hashResolver();
}
});