Skip to content

Commit

Permalink
Remove support for subdomains.
Browse files Browse the repository at this point in the history
  • Loading branch information
Potherca authored Feb 18, 2024
1 parent 1887fba commit d6c6995
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions js/faq.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,15 @@ var faqOptions = faqOptions || {};
*
* https://one.faq.exchange/two?three#four
*
* 1. Sub-domain: https://search-term.faq.exchange (does not support [TAG] syntax)
* 2. Path: https://faq.exchange/search-term
* 3. Query: https://faq.exchange/?search-term
* 4. Hash: https://faq.exchange/#search-term
* 1. Path: https://faq.exchange/search-term
* 2. Query: https://faq.exchange/?search-term
* 3. Hash: https://faq.exchange/#search-term
*/
function getSubjectFromUrl(p_oUrl) {

const domain = document.location.host.split('.').slice(-2, -1)[0]
let subject = document.location.host.split('.').shift()

if (subject === domain) {
subject = ['pathname', 'search', 'hash']
.map(name => document.location[name])
.map(value => value.substring(1))
.reduce((accumulator, currentValue) => accumulator !== '' ? accumulator : currentValue, '')
}
let subject = ['pathname', 'search', 'hash']
.map(name => document.location[name])
.map(value => value.substring(1))
.reduce((accumulator, currentValue) => accumulator !== '' ? accumulator : currentValue, '')

try {
subject = decodeURIComponent(subject)
Expand Down

0 comments on commit d6c6995

Please sign in to comment.