diff --git a/src/App.js b/src/App.js index 04fb158..1543177 100644 --- a/src/App.js +++ b/src/App.js @@ -41,7 +41,7 @@ class App extends Component { } {showAnswer &&
Get a PC
+ returnGet a PC
; + } else if (Rules.Contribute.getResult(value)) { + window.location.href = "https://github.com/hoily/how-do-i"; + returnGithub
; } else { returnDon't
} diff --git a/src/rules.js b/src/rules.js index 6806d13..a860ec8 100644 --- a/src/rules.js +++ b/src/rules.js @@ -7,15 +7,21 @@ const Rule = class Rule { if(options.os != null) { this.os = options.os } + if (options.text != null) { + this.text = options.text; + } } - getResult() { - if (this.os != null) { + getResult(input) { + if (this.text != null) { + return input.toLowerCase() === this.text.toLowerCase(); + } else if (this.os != null) { return useragent.getOS().name === this.os; } else { return false } } -} +}; export const Mac = new Rule({os: "Mac OS"}); +export const Contribute = new Rule({ text: "contribute" });