This repository was archived by the owner on Oct 6, 2022. It is now read-only.
forked from mdcfe/EssentialsX-Website
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
100 additions
and
72 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const re = /\[\[([\w\s]+)\]\]/g; // [[SupaHam]] | ||
const rePiped = /\[\[([\w\s]+)(?:\|)(\w+)\]\]/g; // [[Pineapple|MD678685]] | ||
|
||
const replacement = `<a class="router-link" href="#/$uri">$text</a>`; | ||
|
||
function docuteWikilink(context) { | ||
context.beforeParse(content => { | ||
/* | ||
const parsed = content.replace(re, `[$1]($1)`) | ||
.replace(rePiped, "[$1]($2)"); | ||
*/ | ||
const parsed = content.replace(re, (match, p1) => | ||
replacement.replace("$text", p1).replace("$uri", p1.replace(" ", "-"))) | ||
.replace(rePiped, (match, p1, p2) => | ||
replacement.replace("$text", p1).replace("$uri", p2)); | ||
|
||
console.log(content, parsed); | ||
return parsed; | ||
}); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,8 @@ | |
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | ||
<script src="https://unpkg.com/[email protected]/components/prism-groovy.js"></script> | ||
<script src="https://unpkg.com/[email protected]/components/prism-java.js"></script> | ||
<script src="docute-wikilink.js"></script> | ||
<script src="vue-dlpage.js"></script> | ||
<script src="main.js"></script> | ||
</body> | ||
</html> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
const component = { | ||
html: ` | ||
<transition name="fadein"> | ||
<div id="landing" class="main content markdown-body"> | ||
<p><img src="https://camo.githubusercontent.com/9ad178e5cf76a372d6aaee8bbdf13485fbc1d51b/68747470733a2f2f692e696d6775722e636f6d2f435034535a70422e706e67"></img></p> | ||
<p><i>This is not an official EssentialsX site.</i></p> | ||
<h2>Download EssentialsX</h2> | ||
<section> | ||
<p v-if="buildNo">The latest version of EssentialsX is <b>{{build}}</b>.</p> | ||
<p v-if="failed" class="warning">Could not retrieve information about the latest version.</p> | ||
<table v-if="buildNo"> | ||
<tr> | ||
<th>Plugin</th> | ||
<th>Main</th> | ||
<th>Mirror</th> | ||
</tr> | ||
<tr v-for="plugin in plugins" :key="plugin.name"> | ||
<td>{{ plugin.name }}</td> | ||
<td><a :href="plugin.main">Download</a></td> | ||
<td><a :href="plugin.mirror">Download</a></td> | ||
</tr> | ||
</table> | ||
<button @click="updateInfo">Update</button> | ||
</section> | ||
<h2>Help for EssentialsX</h2> | ||
<section> | ||
<router-link to="/Home">Go to EssentialsX Wiki</router-link> | ||
</section> | ||
</div> | ||
</transition> | ||
`, | ||
component: { | ||
data() { | ||
return { | ||
buildNo: null, | ||
failed: null, | ||
plugins: [], | ||
}; | ||
}, | ||
computed: { | ||
build() { | ||
return this.buildNo ? `b${this.buildNo}` : "unknown"; | ||
}, | ||
}, | ||
methods: { | ||
updateInfo() { | ||
axios.get("lastSuccessfulBuild/api/json") | ||
.then(response => { | ||
this.buildNo = response.data.id; | ||
this.plugins = response.data.artifacts.map(artifact => { | ||
return { | ||
name: `EssentialsX ${artifact.displayPath.match(/EssentialsX([A-Za-z]*)/)[1]}`, | ||
main: `${mainCI}lastSuccessfulBuild/artifact/${artifact.relativePath}`, | ||
mirror: `${mirrorCI}lastSuccessfulBuild/artifact/${artifact.relativePath}`, | ||
}; | ||
}); | ||
this.failed = null; | ||
}, error => { | ||
if (error.response) { | ||
this.failed = error.response.data; | ||
} else { | ||
this.failed = error.message; | ||
} | ||
} | ||
); | ||
} | ||
}, | ||
mounted: function () { | ||
this.updateInfo(); | ||
} | ||
}, | ||
}; | ||
|
||
window.dlPage = component; |