From dba1fb6c6608f364da9ef6a128a249119f64f957 Mon Sep 17 00:00:00 2001 From: Klemek Date: Thu, 26 Sep 2019 11:13:41 +0200 Subject: [PATCH] web app boilerplate --- .gitignore | 1 + .jshintrc | 24 ++++++++++++++++++++++++ index.html | 16 ++++++++++++++++ js/main.js | 15 +++++++++++++++ js/utils.js | 17 +++++++++++++++++ style.css | 0 6 files changed, 73 insertions(+) create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 index.html create mode 100644 js/main.js create mode 100644 js/utils.js create mode 100644 style.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..ac711a3 --- /dev/null +++ b/.jshintrc @@ -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 + } +} \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..e6bacea --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ + + + + + Wikipedia Translator + + + + + + +
+

{{sample}}

+
+ + \ No newline at end of file diff --git a/js/main.js b/js/main.js new file mode 100644 index 0000000..9cf8c6d --- /dev/null +++ b/js/main.js @@ -0,0 +1,15 @@ +/* exported app */ + +let app = { + el: '#app', + data: { + sample: 'Wikipedia translator' + }, + methods: {}, + 'mounted': {}, + 'created': {} +}; + +window.onload = () => { + app = new Vue(app); +}; \ No newline at end of file diff --git a/js/utils.js b/js/utils.js new file mode 100644 index 0000000..6645146 --- /dev/null +++ b/js/utils.js @@ -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(); + }); + } +}; \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..e69de29