web app boilerplate
This commit is contained in:
@@ -0,0 +1 @@
|
||||
.idea
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"esversion": 6,
|
||||
"maxerr": 999,
|
||||
"indent": true,
|
||||
"camelcase": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"immed": true,
|
||||
"latedef": true,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": true,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"varstmt": true,
|
||||
"sub": true,
|
||||
"quotmark": "single",
|
||||
"browser": true,
|
||||
"globals": {
|
||||
"Vue": false,
|
||||
"utils": true,
|
||||
"app": true
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Wikipedia Translator</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
|
||||
<script type="text/javascript" src="js/utils.js"></script>
|
||||
<script type="text/javascript" src="js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<main id="app">
|
||||
<h2>{{sample}}</h2>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/* exported app */
|
||||
|
||||
let app = {
|
||||
el: '#app',
|
||||
data: {
|
||||
sample: 'Wikipedia translator'
|
||||
},
|
||||
methods: {},
|
||||
'mounted': {},
|
||||
'created': {}
|
||||
};
|
||||
|
||||
window.onload = () => {
|
||||
app = new Vue(app);
|
||||
};
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
/* exported utils */
|
||||
|
||||
const utils = {
|
||||
get: (url, proxy = false) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
if (proxy) {
|
||||
const http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
|
||||
url = http + '//cors-anywhere.herokuapp.com/' + url;
|
||||
}
|
||||
xhr.open("GET", url);
|
||||
xhr.onload = () => resolve(xhr.responseText);
|
||||
xhr.onerror = () => reject(xhr.statusText);
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user