Welcome to mirror list, hosted at ThFree Co, Russian Federation.

single.html « _default « layouts - github.com/schollz/onetwothree.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5bc2db2a96f4dd1d44c111cc3b08a4e86b3d5ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
{{ partial "header.html" . }}


<div id="loadingMask" style="width: 100%; height: 100%; position: fixed; background: #fff;"></div>
<script>
function fadeOut(el) {
  el.style.opacity = 1;
  var last = +new Date();
  var tick = function() {
    el.style.opacity = +el.style.opacity - (new Date() - last) / 80;
    last = +new Date();
    // console.log(el.style.opacity);
    if (el.style.opacity > 0) {
      (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16);
    } else {
        el.style.display='none';
    }
  };
  tick();
}
function ready(fn) {
    if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading") {
         el = document.getElementById('loadingMask');
         fadeOut(el);
        var elements = document.querySelectorAll("img");
        Array.prototype.forEach.call(elements, function(el, i) {
            if (el.getAttribute("alt")) {
                const caption = document.createElement('figcaption');
                var node = document.createTextNode(el.getAttribute("alt"));
                caption.appendChild(node);
                const wrapper = document.createElement('figure');
                wrapper.className = 'image';
                el.parentNode.insertBefore(wrapper, el);
                el.parentNode.removeChild(el);
                wrapper.appendChild(el);
                wrapper.appendChild(caption);
            }
        });
    } else {
        document.addEventListener('DOMContentLoaded', fn);
    }

      guestbook.innerHTML = "Loading ...";
  var tag = document.createElement("script");
  var message = encodeURIComponent(document.querySelector('#message').value);
  var name = encodeURIComponent(document.querySelector('#name').value);
  var email = encodeURIComponent(document.querySelector('#email').value);
  tag.src = `${serverURL}/jsonp?callback=myCallback&message=${message}&name=${name}&email=${name}`;
  document.querySelector("head").appendChild(tag);
}
window.onload = ready;
</script>

<div id="documentbody">
    <div class="wtblog">
        <div class="maintext">
            <div class="wikitext titlehack">
                <h1>{{ .Title }}</h1>
                <div class="posttitle">
                    <small>{{ .Date.Format "January 2, 2006"}}</small>
                </div>
            </div>
            <div class="wikitext">
                {{ .Content }}
            </div>
            <br>

  
<!-- Start of guestbook -->

<div class="collapse" tabindex="1">
        <a id="commenttoggle" href="#commentssection" onclick="toggle_visibility('commentssection');">Show comments</a>
        <script type="text/javascript">
            <!--
                function toggle_visibility(id) {
                   var e = document.getElementById(id);
                   if(e.style.display == 'block') {
                    e.style.display = 'none';
                      document.getElementById("commenttoggle").innerText = "Show comments";
                   }  else       {
                    e.style.display = 'block';
                    document.getElementById("commenttoggle").innerText = "Hide comments";
                   }
                }
            //-->
            </script>
<div id="commentssection" style="display:none;">
        <hr>

        <div id="comments">
        </div>

         <!-- Guestbook form -->
         <div class="guestbook-form">
            <strong>Leave a comment:</strong>
            <textarea rows='5' cols='75' id="message" name="message" class="guestbook"></textarea>
            <br>
            <table style="margin-bottom:0">
                <tr>
                    <td style="padding-right: 10px">
                        <label for="name">Who are you?</label>
                    </td>
                    <td>
                        <input id="name" class="guestbook" type="text" size=40 type="text" value=""> </td>
                </tr>
                <tr>
                    <td style="padding-right: 10px">
                        <label for="whourl">(optional URL)</label>
                    </td>
                    <td>
                        <input id="email" class="guestbook" size=40 type="url" value=""> </td>
                </tr>
                <tr>
                    <td>
                        <input class="guestbook-button" type="button" id="btn" value="Submit">
                    </td>
                </tr>
            </table>
        </div>
            <!-- End of Guestbook form -->
    
        <script>
            var serverURL = "https://guestbook.schollz.com"
            var btn = document.getElementById("btn");
            var guestbook = document.getElementById("comments");
            var firstMessage = 0;
    
            function myCallback(acptlang) {
                console.log(firstMessage);
                console.log((acptlang.Message != "" && firstMessage == 1));
                if (acptlang.Message != "" && firstMessage == 1) {
                    alert(acptlang.Message);
                    firstMessage = 1;
                }
    
                console.log(acptlang);
                guestbook.innerHTML = "";
                console.log(acptlang.Entries.length);
                for (var i = 0; i < acptlang.Entries.length; i++) {
                    guestbook.innerHTML = guestbook.innerHTML +
                        `<div class="comment">
    <div class="entryid"> By ${acptlang.Entries[i].Name} on ${acptlang.Entries[i].DateString} in ${acptlang.Entries[i].Location}: </div>
    <blockquote> <div class="wikitext">${acptlang.Entries[i].Message}
    </div> </blockquote> </div>`
    
                }
            }
    
            function jsonp() {
                guestbook.innerHTML = "Loading ...";
                var tag = document.createElement("script");
                var message = encodeURIComponent(document.querySelector('#message').value);
                var name = encodeURIComponent(document.querySelector('#name').value);
                var email = encodeURIComponent(document.querySelector('#email').value);
                tag.src = `${serverURL}/jsonp?callback=myCallback&message=${message}&name=${name}&email=${name}`;
                document.querySelector("head").appendChild(tag);
            }
            btn.addEventListener("click", jsonp);
        </script>
    </div>
    <br>
</div>
    <!-- END OF COMMENTS -->

            <small>Written on <a href="/written/{{ .Date.Format "2006-01-02" | lower}}">{{ .Date.Format "2"}}</a> 
                <a href="/written/{{ .Date.Format "2006-01" | lower}}">{{ .Date.Format "January"}}</a>
                <a href="/written/{{ .Date.Format "2006" | lower}}">{{ .Date.Format "2006"}}</a>.
            {{ if .Params.Tags}}
            Categories:
                {{ range $i, $e := .Params.Tags }}{{ if $i }}, {{ end }}<a href="/tags/{{$e}}/">{{ $e }}</a>{{ end }}.
            {{ end }}
            </small> 


<br>
                <br>
            <table border=0 width="100%">
                <tr>
                    {{ if .PrevInSection }}
                    <td width="50%" style="padding-right: 0.5em">
                        <table>
                            <tr>
                                <td> &laquo; </td>
                                <td>
                                        
                                        <a href="{{ .PrevInSection.URL }}">{{ .PrevInSection.Title }}</a>&nbsp;
                                </td>
                            </tr>
                        </table>
                    </td>
                    {{end}}
                    {{ if .NextInSection }}
                    <td width="50%" style="padding-left: 0.5em; border-left: 1px dotted;">
                        <table>
                            <tr>
                                <td>
                                        
                                        <a href="{{ .NextInSection.URL }}" style="float:right;">{{ .NextInSection.Title }}</a>
                                </td>
                                <td> &raquo; </td>
                            </tr>
                        </table>
                    </td>
                    {{ end }}
                </tr>
            </table>
        </div>
        {{ partial "sidebar.html" . }}

    </div>
</div>


{{ partial "footer.html" . }}