Skip to content

Commit f140e15

Browse files
committed
fix: added GTM and css for diff page
1 parent 73492f6 commit f140e15

File tree

4 files changed

+57
-37
lines changed

4 files changed

+57
-37
lines changed

app.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@
33

44
<head {{ HEAD_ATTRS }}>
55
<title>Diff viewer</title>
6+
<script>(function (w, d, s, l, i) {
7+
w[l] = w[l] || []; w[l].push({
8+
'gtm.start':
9+
new Date().getTime(), event: 'gtm.js'
10+
}); var f = d.getElementsByTagName(s)[0],
11+
j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
12+
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
13+
})(window, document, 'script', 'dataLayer', 'GTM-K3KPK8G');</script>
614
{{ HEAD }}
715
</head>
816

917
<body {{ BODY_ATTRS }}>
18+
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-K3KPK8G" height="0" width="0"
19+
style="display:none;visibility:hidden"></iframe></noscript>
1020
{{ APP }}
1121
</body>
1222

components/navbar.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
<header class="fixed top-0 left-0 right-0 bg-white shadow-lg">
33
<div class="container flex items-center h-full p-4 mx-auto">
44
<div class="flex-shrink-0 mr-auto md:w-48">
5-
<img
6-
class="h-8 md:h-10"
7-
src="https://i.ibb.co/98pHdFq/2021-10-27-15h51-15.png"
8-
alt=""
9-
/>
5+
<NuxtLink to="/">
6+
<img
7+
class="h-8 md:h-10"
8+
src="https://i.ibb.co/98pHdFq/2021-10-27-15h51-15.png"
9+
alt=""
10+
/>
11+
</NuxtLink>
1012
</div>
1113

1214
<!-- buttons -->

pages/diff/_lhs/_rhs.vue

Lines changed: 40 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
<template>
22
<div class="h-full">
33
<main class="container h-full mx-auto mt-24">
4-
<p v-for="(lineDiff, index) in lhsDiff" :key="index">
5-
<span v-html="lineDiff"></span>
6-
</p>
7-
<p v-for="(lineDiff, index) in rhsDiff" :key="index">
8-
<span v-html="lineDiff"></span>
9-
</p>
4+
<div class="flex gap-4 mt-5">
5+
<div class="flex-1 max-h-full p-4 border-2 rounded-sm">
6+
<p v-for="(lineDiff, index) in lhsDiff" :key="index">
7+
<span v-html="lineDiff"></span>
8+
</p>
9+
</div>
10+
<div class="flex-1 max-h-full p-4 border-2 rounded-sm">
11+
<p v-for="(lineDiff, index) in rhsDiff" :key="index">
12+
<span v-html="lineDiff"></span>
13+
</p>
14+
</div>
15+
</div>
1016
</main>
1117
</div>
1218
</template>
@@ -30,31 +36,34 @@ export default {
3036
}
3137
return dmp.diff_main(x, this.originalRhs[i])
3238
})
33-
this.lhsDiff = diff.map((lineDiff) => {
34-
return lineDiff
35-
.map((item) => {
36-
if (item[0] === -1 || item[0] === 0) {
37-
const className = item[0] === -1 ? 'bg-red-300' : ''
38-
return `<pre class="inline mr-[-4px] p-0 m-0 ${className}">${item[1]}</pre>`
39-
}
40-
return ''
41-
})
42-
.filter(Boolean)
43-
.join('\n')
44-
})
45-
this.rhsDiff = diff.map((lineDiff) => {
46-
return lineDiff
47-
.map((item) => {
48-
if (item[0] === 1 || item[0] === 0) {
49-
const className = item[0] === 1 ? 'bg-green-300' : ''
50-
return `<pre class="inline mr-[-4px] p-0 m-0 ${className}">${item[1]}</pre>`
51-
}
52-
return ''
53-
})
54-
.filter(Boolean)
55-
.join('\n')
56-
})
57-
console.log(this.originalLhs, this.originalRhs, diff)
39+
this.lhsDiff = diff
40+
.map((lineDiff) => {
41+
return lineDiff
42+
.map((item) => {
43+
if (item[0] === -1 || item[0] === 0) {
44+
const className = item[0] === -1 ? 'bg-red-300' : ''
45+
return `<pre class="inline mr-[-4px] p-0 m-0 ${className}">${item[1]}</pre>`
46+
}
47+
return ''
48+
})
49+
.filter(Boolean)
50+
.join('\n')
51+
})
52+
.filter(Boolean)
53+
this.rhsDiff = diff
54+
.map((lineDiff) => {
55+
return lineDiff
56+
.map((item) => {
57+
if (item[0] === 1 || item[0] === 0) {
58+
const className = item[0] === 1 ? 'bg-green-300' : ''
59+
return `<pre class="inline mr-[-4px] p-0 m-0 ${className}">${item[1]}</pre>`
60+
}
61+
return ''
62+
})
63+
.filter(Boolean)
64+
.join('\n')
65+
})
66+
.filter(Boolean)
5867
},
5968
data() {
6069
return {

pages/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export default Vue.extend({
3131
layout: 'main',
3232
methods: {
3333
checkForm(e: any) {
34-
console.log('demo')
3534
e.preventDefault()
3635
const lhsTextArea: HTMLTextAreaElement = document.getElementById(
3736
'lhs'

0 commit comments

Comments
 (0)