First Commit
This commit is contained in:
commit
fc975446f2
9 files changed
+330
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
*.exe
|
||||||
|
Manuals/
|
||||||
Whitespace-only changes.
@@ -0,0 +1,9 @@
|
|||||||
|
module Server
|
||||||
|
|
||||||
|
go 1.12
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/gorilla/mux v1.7.0
|
||||||
|
github.com/jbowtie/gokogiri v0.0.0-20190301021639-37f655d3078f
|
||||||
|
github.com/jbowtie/ratago v0.0.0-20180115094149-33a9dca16476
|
||||||
|
)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U=
|
||||||
|
github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
|
github.com/jbowtie/gokogiri v0.0.0-20190301021639-37f655d3078f h1:6UIvzqlGM38lOpKP380Wbl0kUyyjutcc7KJUaDM/U4o=
|
||||||
|
github.com/jbowtie/gokogiri v0.0.0-20190301021639-37f655d3078f/go.mod h1:C3R3VzPq+DAwilxue7DiV6F2QL1rrQX0L56GyI+sBxM=
|
||||||
|
github.com/jbowtie/ratago v0.0.0-20180115094149-33a9dca16476 h1:oJjMBS3C2YJEWJDRuIGCcLahNlpfID52BlqDmZx40Ks=
|
||||||
|
github.com/jbowtie/ratago v0.0.0-20180115094149-33a9dca16476/go.mod h1:6IMkzlV446Sd3u2cvB69IdW8uJDphLzkPf05hjOyKvM=
|
||||||
+159
@@ -0,0 +1,159 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
<title>Service Information</title>
|
||||||
|
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900|Material+Icons' rel="stylesheet">
|
||||||
|
<link href="static/vuetify.min.css" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
.v-treeview-node__content,
|
||||||
|
.v-treeview-node__label{flex-shrink:1;font-size:0.9rem;}
|
||||||
|
.v-treeview-node__root{height:auto;}
|
||||||
|
[class="1-column-portrait"]{float:right;max-width:330px;}
|
||||||
|
.dtwarning{color:red;}
|
||||||
|
.dtnote{color:blue;}
|
||||||
|
.dtcaution{color:goldenrod;}
|
||||||
|
@media print {.v-content{padding:0 !important;}}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="app">
|
||||||
|
<v-app>
|
||||||
|
<v-toolbar app clipped-left class="hidden-print-only">
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-flex xs3 d-flex>
|
||||||
|
<v-select
|
||||||
|
v-model="year"
|
||||||
|
:items="yearitems"
|
||||||
|
label="Year"
|
||||||
|
outline
|
||||||
|
height=18
|
||||||
|
v-on:input="changeYear"
|
||||||
|
></v-select>
|
||||||
|
</v-flex>
|
||||||
|
<v-flex xs3 d-flex>
|
||||||
|
<v-select
|
||||||
|
v-model="model"
|
||||||
|
:items="modelitems"
|
||||||
|
label="Model"
|
||||||
|
outline
|
||||||
|
height=18
|
||||||
|
v-on:input="changeEngine"
|
||||||
|
></v-select>
|
||||||
|
</v-flex>
|
||||||
|
<v-flex xs3 d-flex>
|
||||||
|
<v-select
|
||||||
|
v-model="engine"
|
||||||
|
:items="engineitems"
|
||||||
|
label="Engine"
|
||||||
|
outline
|
||||||
|
height=18
|
||||||
|
v-on:input="changeCar"
|
||||||
|
></v-select>
|
||||||
|
</v-flex>
|
||||||
|
</v-toolbar>
|
||||||
|
<v-navigation-drawer permanent app fixed clipped class="hidden-print-only">
|
||||||
|
<v-text-field
|
||||||
|
v-model="search"
|
||||||
|
label="Search Manuals"
|
||||||
|
flat
|
||||||
|
solo-inverted
|
||||||
|
hide-details
|
||||||
|
clearable
|
||||||
|
></v-text-field>
|
||||||
|
<v-treeview
|
||||||
|
:open.sync="listactive"
|
||||||
|
:items="sidebar"
|
||||||
|
:search="search"
|
||||||
|
item-key="id"
|
||||||
|
open-on-click>
|
||||||
|
<template v-slot:label="{ item }">
|
||||||
|
<a v-if="item.file" @click="index(item.file)">{{item.name}}</a>
|
||||||
|
<span v-else :id="item.id">{{item.name}}</span>
|
||||||
|
</template>
|
||||||
|
</v-treeview>
|
||||||
|
</v-navigation-drawer>
|
||||||
|
<v-content>
|
||||||
|
<v-container fluid>
|
||||||
|
<div :is="dynamicHtml"></div>
|
||||||
|
</v-container>
|
||||||
|
</v-content>
|
||||||
|
</v-app>
|
||||||
|
</div>
|
||||||
|
<script src="static/vue.min.js"></script>
|
||||||
|
<script src="static/vuetify.min.js"></script>
|
||||||
|
<script>
|
||||||
|
var app = new Vue({
|
||||||
|
el: '#app',
|
||||||
|
data: {
|
||||||
|
listactive: [],
|
||||||
|
body: "",
|
||||||
|
sidebar: [],
|
||||||
|
search:"",
|
||||||
|
items: [],
|
||||||
|
yearitems: [],
|
||||||
|
year:" ",
|
||||||
|
modelitems: [],
|
||||||
|
model:" ",
|
||||||
|
engineitems: [],
|
||||||
|
engine:" "
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
dynamicHtml() {
|
||||||
|
return {
|
||||||
|
template: this.body
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created: function() {
|
||||||
|
fetch('cars')
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => {
|
||||||
|
this.items = json;
|
||||||
|
this.yearitems = Object.keys(json);
|
||||||
|
})
|
||||||
|
},
|
||||||
|
updated: function() {
|
||||||
|
const refs = document.querySelectorAll('.intxref');
|
||||||
|
refs.forEach(refitem => {
|
||||||
|
var pointedAt = document.querySelector(refitem.getAttribute('href'));
|
||||||
|
refitem.innerText = pointedAt.getElementsByTagName("em")[0].innerText;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
changeYear() {
|
||||||
|
this.modelitems = Object.keys(this.items[this.year])
|
||||||
|
},
|
||||||
|
changeEngine() {
|
||||||
|
this.engineitems = Object.keys(this.items[this.year][this.model])
|
||||||
|
},
|
||||||
|
changeCar() {
|
||||||
|
document.title = [this.year, this.model, this.engine].join(" ");
|
||||||
|
fetch(this.items[this.year][this.model][this.engine])
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(json => {
|
||||||
|
this.sidebar=json;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
switchToc(list) {
|
||||||
|
var temp = JSON.parse(list);
|
||||||
|
temp.forEach(item => this.listactive.push(item));
|
||||||
|
var element = document.getElementById(temp[0]);
|
||||||
|
element.scrollIntoView({block: "start"});
|
||||||
|
},
|
||||||
|
index (folder) {
|
||||||
|
fetch("file/" + folder)
|
||||||
|
.then(res => res.text())
|
||||||
|
.then(json => {
|
||||||
|
this.$set(this, 'body', json);
|
||||||
|
console.log(this.body);
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
})
|
||||||
|
.catch(err => console.warn(err))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
/*!
|
||||||
|
* Vue.js v2.6.8
|
||||||
|
* (c) 2014-2019 Evan You
|
||||||
|
* Released under the MIT License.
|
||||||
|
*/
|
||||||
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i<r.length;i++)n[r[i]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}var d=p("slot,component",!0),v=p("key,ref,slot,slot-scope,is");function h(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function k(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function A(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n<e.length;n++)e[n]&&A(t,e[n]);return t}function S(e,t,n){}var T=function(e,t,n){return!1},E=function(e){return e};function N(e,t){if(e===t)return!0;var n=o(e),r=o(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var i=Array.isArray(e),a=Array.isArray(t);if(i&&a)return e.length===t.length&&e.every(function(e,n){return N(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(i||a)return!1;var s=Object.keys(e),c=Object.keys(t);return s.length===c.length&&s.every(function(n){return N(e[n],t[n])})}catch(e){return!1}}function j(e,t){for(var n=0;n<e.length;n++)if(N(e[n],t))return n;return-1}function D(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}var L="data-server-rendered",M=["component","directive","filter"],I=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],F={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:T,isReservedAttr:T,isUnknownElement:T,getTagNamespace:S,parsePlatformTagName:E,mustUseProp:T,async:!0,_lifecycleHooks:I},P=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function R(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var H=new RegExp("[^"+P.source+".$_\\d]");var B,U="__proto__"in{},z="undefined"!=typeof window,V="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,K=V&&WXEnvironment.platform.toLowerCase(),J=z&&window.navigator.userAgent.toLowerCase(),q=J&&/msie|trident/.test(J),W=J&&J.indexOf("msie 9.0")>0,Z=J&&J.indexOf("edge/")>0,G=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),X=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),Y={}.watch,Q=!1;if(z)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Q=!0}}),window.addEventListener("test-passive",null,ee)}catch(e){}var te=function(){return void 0===B&&(B=!z&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},ne=z&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function re(e){return"function"==typeof e&&/native code/.test(e.toString())}var ie,oe="undefined"!=typeof Symbol&&re(Symbol)&&"undefined"!=typeof Reflect&&re(Reflect.ownKeys);ie="undefined"!=typeof Set&&re(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ae=S,se=0,ce=function(){this.id=se++,this.subs=[]};ce.prototype.addSub=function(e){this.subs.push(e)},ce.prototype.removeSub=function(e){h(this.subs,e)},ce.prototype.depend=function(){ce.target&&ce.target.addDep(this)},ce.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t<n;t++)e[t].update()},ce.target=Line truncated
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
/*!
|
||||||
|
* Vuetify v1.5.5
|
||||||
|
* Forged by John Leider
|
||||||
|
* Released under the MIT License.
|
||||||
|
*/@-webkit-keyframes shake{59%{margin-left:0}60%,80%{margin-left:2px}70%,90%{margin-left:-2px}}@keyframes shake{59%{margin-left:0}60%,80%{margin-left:2px}70%,90%{margin-left:-2px}}.black{background-color:#000!important;border-color:#000!important}.black--text{color:#000!important;caret-color:#000!important}.white{background-color:#fff!important;border-color:#fff!important}.white--text{color:#fff!important;caret-color:#fff!important}.transparent{background-color:transparent!important;border-color:transparent!important}.transparent--text{color:transparent!important;caret-color:transparent!important}.red{background-color:#f44336!important;border-color:#f44336!important}.red--text{color:#f44336!important;caret-color:#f44336!important}.red.lighten-5{background-color:#ffebee!important;border-color:#ffebee!important}.red--text.text--lighten-5{color:#ffebee!important;caret-color:#ffebee!important}.red.lighten-4{background-color:#ffcdd2!important;border-color:#ffcdd2!important}.red--text.text--lighten-4{color:#ffcdd2!important;caret-color:#ffcdd2!important}.red.lighten-3{background-color:#ef9a9a!important;border-color:#ef9a9a!important}.red--text.text--lighten-3{color:#ef9a9a!important;caret-color:#ef9a9a!important}.red.lighten-2{background-color:#e57373!important;border-color:#e57373!important}.red--text.text--lighten-2{color:#e57373!important;caret-color:#e57373!important}.red.lighten-1{background-color:#ef5350!important;border-color:#ef5350!important}.red--text.text--lighten-1{color:#ef5350!important;caret-color:#ef5350!important}.red.darken-1{background-color:#e53935!important;border-color:#e53935!important}.red--text.text--darken-1{color:#e53935!important;caret-color:#e53935!important}.red.darken-2{background-color:#d32f2f!important;border-color:#d32f2f!important}.red--text.text--darken-2{color:#d32f2f!important;caret-color:#d32f2f!important}.red.darken-3{background-color:#c62828!important;border-color:#c62828!important}.red--text.text--darken-3{color:#c62828!important;caret-color:#c62828!important}.red.darken-4{background-color:#b71c1c!important;border-color:#b71c1c!important}.red--text.text--darken-4{color:#b71c1c!important;caret-color:#b71c1c!important}.red.accent-1{background-color:#ff8a80!important;border-color:#ff8a80!important}.red--text.text--accent-1{color:#ff8a80!important;caret-color:#ff8a80!important}.red.accent-2{background-color:#ff5252!important;border-color:#ff5252!important}.red--text.text--accent-2{color:#ff5252!important;caret-color:#ff5252!important}.red.accent-3{background-color:#ff1744!important;border-color:#ff1744!important}.red--text.text--accent-3{color:#ff1744!important;caret-color:#ff1744!important}.red.accent-4{background-color:#d50000!important;border-color:#d50000!important}.red--text.text--accent-4{color:#d50000!important;caret-color:#d50000!important}.pink{background-color:#e91e63!important;border-color:#e91e63!important}.pink--text{color:#e91e63!important;caret-color:#e91e63!important}.pink.lighten-5{background-color:#fce4ec!important;border-color:#fce4ec!important}.pink--text.text--lighten-5{color:#fce4ec!important;caret-color:#fce4ec!important}.pink.lighten-4{background-color:#f8bbd0!important;border-color:#f8bbd0!important}.pink--text.text--lighten-4{color:#f8bbd0!important;caret-color:#f8bbd0!important}.pink.lighten-3{background-color:#f48fb1!important;border-color:#f48fb1!important}.pink--text.text--lighten-3{color:#f48fb1!important;caret-color:#f48fb1!important}.pink.lighten-2{background-color:#f06292!important;border-color:#f06292!important}.pink--text.text--lighten-2{color:#f06292!important;caret-color:#f06292!important}.pink.lighten-1{background-color:#ec407a!important;border-color:#ec407a!important}.pink--text.text--lighten-1{color:#ec407a!important;caret-color:#ec407a!important}.pink.darken-1{background-color:#d81b60!important;border-color:#d81b60!important}.pink--text.text--darken-1{color:#d81b60!important;caret-color:#d81b60!important}.pink.darken-2{background-color:#c2185b!important;border-color:#c2185b!important}.pink--text.text--darken-2{color:#c2185b!important;caret-color:#c2185b!important}.pink.darken-3{background-color:#ad1457!important;border-color:#ad1457!important}.pink--text.text--darken-3{color:#ad1457!important;caret-color:#ad1457!important}.pink.darken-4{background-color:#880e4f!important;border-color:#880e4f!important}.pink--text.text--darken-4{color:#880e4f!important;caret-color:#880e4f!important}.pink.accent-1{background-color:#ff80ab!important;border-color:#ff80ab!important}.pink--text.text--accent-1{color:#ff80ab!important;caret-color:#ff80ab!important}.pink.accent-2{background-color:#ff4081!important;border-color:#ff4081!important}.pink--text.text--accent-2{color:#ff4081!important;caret-color:#ff4081!important}.pink.accent-3{background-color:#f50057!important;border-color:#f50057!important}.pink--text.text--accent-3{color:#f50057!important;caret-color:#f50057!important}.pink.accent-4{background-color:#c51162!important;border-color:#c51162!importLine truncated
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
/*!
|
||||||
|
* Vuetify v1.5.5
|
||||||
|
* Forged by John Leider
|
||||||
|
* Released under the MIT License.
|
||||||
|
*/
|
||||||
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("vue")):"function"==typeof define&&define.amd?define(["vue"],e):"object"==typeof exports?exports.Vuetify=e(require("vue")):t.Vuetify=e(t.Vue)}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=76)}([function(e,i){e.exports=t},,function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){},function(t,e,i){"use strict";i.r(e);var n={};i.r(n),i.d(n,"linear",function(){return st}),i.d(n,"easeInQuad",function(){return rt}),i.d(n,"easeOutQuad",function(){return at}),i.d(n,"easeInOutQuad",function(){return ot}),i.d(n,"easeInCubic",function(){return lt}),i.d(n,"easeOutCubic",function(){return ut}),i.d(n,"easeInOutCubic",function(){return ht}),i.d(n,"easeInQuart",function(){return ct}),i.d(n,"easeOutQuart",function(){return dt}),i.d(n,"easeInOutQuart",function(){return ft}),i.d(n,"easeInQuint",function(){return pt}),i.d(n,"easeOutQuint",function(){return vt}),i.d(n,"easeInOutQuint",function(){return mt});var s={};i.r(s),i.d(s,"VApp",function(){return Gt}),i.d(s,"VAlert",function(){return ce}),i.d(s,"VAutocomplete",function(){return Wn}),i.d(s,"VAvatar",function(){return cn}),i.d(s,"VBadge",function(){return Xn}),i.d(s,"VBottomNav",function(){return ns}),i.d(s,"VBottomSheet",function(){return ls}),i.d(s,"VBreadcrumbs",function(){return cs}),i.d(s,"VBreadcrumbsItem",function(){return us}),i.d(s,"VBreadcrumbsDivider",function(){return ds}),i.d(s,"VBtn",function(){return ys}),i.d(s,"VBtnToggle",function(){return ws}),i.d(s,"VCalendar",function(){return mr}),i.d(s,"VCalendarDaily",function(){return pr}),i.d(s,"VCalendarWeekly",function(){return lr}),i.d(s,"VCalendarMonthly",function(){return ur}),i.d(s,"VCard",function(){return kr}),i.d(s,"VCardMedia",function(){return _r}),i.d(s,"VCardTitle",function(){return Tr}),i.d(s,"VCardActions",function(){return Ar}),i.d(s,"VCardText",function(){return Br}),i.d(s,"VCarousel",function(){return Pr}),i.d(s,"VCarouselItem",function(){return Nr}),i.d(s,"VCheckbox",function(){return Si}),i.d(s,"VChip",function(){return fe}),i.d(s,"VCombobox",function(){return Hr}),i.d(s,"VCounter",function(){return wn}),i.d(s,"VDataIterator",function(){return Zr}),i.d(s,"VDataTable",function(){return sa}),i.d(s,"VEditDialog",function(){return ra}),i.d(s,"VTableOverflow",function(){return aa}),i.d(s,"VDatePicker",function(){return Aa}),i.d(s,"VDatePickerTitle",function(){return la}),i.d(s,"VDatePickerHeader",function(){return ma}),i.d(s,"VDatePickerDateTable",function(){return xa}),i.d(s,"VDatePickerMonthTable",function(){return wa}),i.d(s,"VDatePickerYears",function(){return Sa}),i.d(s,"VDialog",function(){return as}),i.d(s,"VDivider",function(){return $i}),i.d(s,"VExpansionPanel",function(){return Oa}),i.d(s,"VExpansionPanelContent",function(){return Va}),i.d(s,"Line truncated
|
||||||
@@ -0,0 +1,137 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"compress/gzip"
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
"github.com/jbowtie/gokogiri/xml"
|
||||||
|
"github.com/jbowtie/ratago/xslt"
|
||||||
|
)
|
||||||
|
|
||||||
|
type TOCNode struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
File string `json:"file,omitempty"`
|
||||||
|
Key string `json:"id"`
|
||||||
|
Children []TOCNode `json:"children,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CarInfo struct {
|
||||||
|
SoftLink url.Values `json:"softlink"`
|
||||||
|
ToC []TOCNode `json:"toc"`
|
||||||
|
Values map[string]url.Values `json:"tocpath"`
|
||||||
|
}
|
||||||
|
|
||||||
|
var indexList CarInfo
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
r := mux.NewRouter()
|
||||||
|
r.PathPrefix("/static/").Handler(http.StripPrefix("/static", http.FileServer(http.Dir("html/static"))))
|
||||||
|
r.HandleFunc("/cars", HomeHandler)
|
||||||
|
r.HandleFunc("/{car}", CarHandler)
|
||||||
|
r.HandleFunc("/file/{page}", PageHandler)
|
||||||
|
r.HandleFunc("/img/{file}", ImgHandler)
|
||||||
|
r.PathPrefix("/").Handler(http.FileServer(http.Dir("html")))
|
||||||
|
err := http.ListenAndServe(":8080", r)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("ListenAndServe: ", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func HomeHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
body, _ := ioutil.ReadFile("Manuals/vehicles.json")
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.Write(body)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func CarHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
vars := mux.Vars(r)
|
||||||
|
folder := vars["car"]
|
||||||
|
indexList = CarInfo{}
|
||||||
|
file, err := os.Open(path.Join("Manuals", folder+".toc"))
|
||||||
|
if err != nil {
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
empty := []TOCNode{TOCNode{Name: "Not Available", Key: "1"}}
|
||||||
|
json.NewEncoder(w).Encode(empty)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
json.NewDecoder(file).Decode(&indexList)
|
||||||
|
w.Header().Set("Content-Encoding", "gzip")
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
writer := gzip.NewWriter(w)
|
||||||
|
json.NewEncoder(writer).Encode(indexList.ToC)
|
||||||
|
writer.Close()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func PageHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
vars := mux.Vars(r)
|
||||||
|
img := vars["page"]
|
||||||
|
style, _ := xml.ReadFile(path.Join("Manuals", "techauth.xsl"), xml.StrictParseOption)
|
||||||
|
stylesheet, _ := xslt.ParseStylesheet(style, path.Join("Manuals", "techauth.xsl"))
|
||||||
|
|
||||||
|
input, err := xml.ReadFile(path.Join("Manuals", "files", img), xml.StrictParseOption)
|
||||||
|
if err != nil {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
params := make(map[string]interface{})
|
||||||
|
params["TOCPath"] = indexList.Values[img]["TOCPath"][0]
|
||||||
|
params["modelyear"] = indexList.Values[img]["year"][0]
|
||||||
|
params["modelname"] = indexList.Values[img]["platform"][0]
|
||||||
|
params["ENG"] = indexList.Values[img]["ENG"][0]
|
||||||
|
params["locale"] = indexList.Values[img]["lang"][0]
|
||||||
|
params["vid"] = indexList.Values[img]["VID"][0]
|
||||||
|
params["contentPath"] = "img/"
|
||||||
|
output, err := stylesheet.Process(input, xslt.StylesheetOptions{false, params})
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
if strings.Contains(output, "REPLACEME") {
|
||||||
|
reg := regexp.MustCompile(`REPLACEME="(\d+?)"`)
|
||||||
|
matches := reg.FindAllStringSubmatch(output, -1)
|
||||||
|
for _, item := range matches {
|
||||||
|
location := indexList.SoftLink[item[1]]
|
||||||
|
if len(location) > 1 {
|
||||||
|
string2 := FindToc(indexList.ToC, location[0])
|
||||||
|
place, _ := json.Marshal(string2)
|
||||||
|
output = strings.Replace(output, item[0], fmt.Sprintf(`v-on:click="app.switchToc('%s')"`, strings.Replace(string(place), `"`, `"`, -1)), -1)
|
||||||
|
} else {
|
||||||
|
output = strings.Replace(output, item[0], fmt.Sprintf(`v-on:click="app.index('%s')"`, location[0]), -1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
w.Write([]byte(output))
|
||||||
|
}
|
||||||
|
|
||||||
|
func ImgHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
vars := mux.Vars(r)
|
||||||
|
img := vars["file"]
|
||||||
|
img = strings.Replace(img, ".tif", ".jpg", -1)
|
||||||
|
http.ServeFile(w, r, path.Join("Manuals", "files", "img", img))
|
||||||
|
}
|
||||||
|
|
||||||
|
func FindToc(toc []TOCNode, file string) []string {
|
||||||
|
var list []string
|
||||||
|
for _, item := range toc {
|
||||||
|
if item.File == file {
|
||||||
|
list = append([]string{item.Key}, list...)
|
||||||
|
}
|
||||||
|
list2 := FindToc(item.Children, file)
|
||||||
|
if len(list2) > 0 {
|
||||||
|
list = append([]string{item.Key}, list2...)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return list
|
||||||
|
}
|
||||||
Reference in new issue
Block a user