Last active
September 26, 2021 10:08
-
-
Save ShapeGroup/6c55e3305b0445a0801806b1f0515fe1 to your computer and use it in GitHub Desktop.
js-kit-pathfinder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//// JS KIT - PATHS FINDER | |
//// MIT LICENCE | |
//// Credit: alberto marà | |
// how to use: | |
// <img src="'+this.resouces+'images/imagename.svg" />; | |
class PATHFINDER | |
{ | |
constructor() | |
{ | |
this.pathanalyzer(); | |
} | |
pathanalyzer() | |
{ | |
this.url = String(window.location); | |
this.islocal = this.url.includes('dev-') ? true : false; | |
this.protocol = this.url.includes('https') ? 'https' : 'http'; | |
this.hostname = this.url.split(this.protocol+"://")[1].split("/")[0]; | |
this.basehost = this.protocol+"://"+this.hostname+'/'; | |
this.pagename = this.url.split("/").pop().split("?")[0]; | |
this.resouces = this.basehost+'resources/'; | |
} | |
} | |
const paths = new PATHFINDER(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment