footer.njk 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <div>
  2. <button
  3. id="upBtn" aria-label="Button Up"
  4. ><i class="arrow up"></i></button>
  5. </div>
  6. <div class="footer w-600">&#169; kusaeni 2022 &middot; dibuat dengan <a class="lume" href="https://lume.land">lume</a></div>
  7. </div> <!-- container -->
  8. <script data-goatcounter="https://kusaeni.goatcounter.com/count">
  9. ;(function() {
  10. 'use strict';
  11. if (window.goatcounter && window.goatcounter.vars)
  12. window.goatcounter = window.goatcounter.vars
  13. else
  14. window.goatcounter = window.goatcounter || {}
  15. var s = document.querySelector('script[data-goatcounter]')
  16. if (s && s.dataset.goatcounterSettings) {
  17. try { var set = JSON.parse(s.dataset.goatcounterSettings) }
  18. catch (err) { console.error('invalid JSON in data-goatcounter-settings: ' + err) }
  19. for (var k in set)
  20. if (['no_onload', 'no_events', 'allow_local', 'allow_frame', 'path', 'title', 'referrer', 'event'].indexOf(k) > -1)
  21. window.goatcounter[k] = set[k]
  22. }
  23. var enc = encodeURIComponent
  24. var get_data = function(vars) {
  25. var data = {
  26. p: (vars.path === undefined ? goatcounter.path : vars.path),
  27. r: (vars.referrer === undefined ? goatcounter.referrer : vars.referrer),
  28. t: (vars.title === undefined ? goatcounter.title : vars.title),
  29. e: !!(vars.event || goatcounter.event),
  30. s: [window.screen.width, window.screen.height, (window.devicePixelRatio || 1)],
  31. b: is_bot(),
  32. q: location.search,
  33. }
  34. var rcb, pcb, tcb
  35. if (typeof(data.r) === 'function') rcb = data.r
  36. if (typeof(data.t) === 'function') tcb = data.t
  37. if (typeof(data.p) === 'function') pcb = data.p
  38. if (is_empty(data.r)) data.r = document.referrer
  39. if (is_empty(data.t)) data.t = document.title
  40. if (is_empty(data.p)) data.p = get_path()
  41. if (rcb) data.r = rcb(data.r)
  42. if (tcb) data.t = tcb(data.t)
  43. if (pcb) data.p = pcb(data.p)
  44. return data
  45. }
  46. var is_empty = function(v) { return v === null || v === undefined || typeof(v) === 'function' }
  47. var is_bot = function() {
  48. var w = window, d = document
  49. if (w.callPhantom || w._phantom || w.phantom)
  50. return 150
  51. if (w.__nightmare)
  52. return 151
  53. if (d.__selenium_unwrapped || d.__webdriver_evaluate || d.__driver_evaluate)
  54. return 152
  55. if (navigator.webdriver)
  56. return 153
  57. return 0
  58. }
  59. var urlencode = function(obj) {
  60. var p = []
  61. for (var k in obj)
  62. if (obj[k] !== '' && obj[k] !== null && obj[k] !== undefined && obj[k] !== false)
  63. p.push(enc(k) + '=' + enc(obj[k]))
  64. return '?' + p.join('&')
  65. }
  66. var warn = function(msg) {
  67. if (console && 'warn' in console)
  68. console.warn('goatcounter: ' + msg)
  69. }
  70. var get_endpoint = function() {
  71. var s = document.querySelector('script[data-goatcounter]')
  72. if (s && s.dataset.goatcounter)
  73. return s.dataset.goatcounter
  74. return (goatcounter.endpoint || window.counter)
  75. }
  76. var get_path = function() {
  77. var loc = location,
  78. c = document.querySelector('link[rel="canonical"][href]')
  79. if (c) {
  80. var a = document.createElement('a')
  81. a.href = c.href
  82. if (a.hostname.replace(/^www\./, '') === location.hostname.replace(/^www\./, ''))
  83. loc = a
  84. }
  85. return (loc.pathname + loc.search) || '/'
  86. }
  87. var on_load = function(f) {
  88. if (document.body === null)
  89. document.addEventListener('DOMContentLoaded', function() { f() }, false)
  90. else
  91. f()
  92. }
  93. goatcounter.filter = function() {
  94. if ('visibilityState' in document && document.visibilityState === 'prerender')
  95. return 'visibilityState'
  96. if (!goatcounter.allow_frame && location !== parent.location)
  97. return 'frame'
  98. if (!goatcounter.allow_local && location.hostname.match(/(localhost$|^127\.|^10\.|^172\.(1[6-9]|2[0-9]|3[0-1])\.|^192\.168\.|^0\.0\.0\.0$)/))
  99. return 'localhost'
  100. if (!goatcounter.allow_local && location.protocol === 'file:')
  101. return 'localfile'
  102. if (localStorage && localStorage.getItem('skipgc') === 't')
  103. return 'disabled with #toggle-goatcounter'
  104. return false
  105. }
  106. window.goatcounter.url = function(vars) {
  107. var data = get_data(vars || {})
  108. if (data.p === null)
  109. return
  110. data.rnd = Math.random().toString(36).substr(2, 5)
  111. var endpoint = get_endpoint()
  112. if (!endpoint)
  113. return warn('no endpoint found')
  114. return endpoint + urlencode(data)
  115. }
  116. window.goatcounter.count = function(vars) {
  117. var f = goatcounter.filter()
  118. if (f)
  119. return warn('not counting because of: ' + f)
  120. var url = goatcounter.url(vars)
  121. if (!url)
  122. return warn('not counting because path callback returned null')
  123. var img = document.createElement('img')
  124. img.src = url
  125. img.style.position = 'absolute'
  126. img.style.bottom = '0px'
  127. img.style.width = '1px'
  128. img.style.height = '1px'
  129. img.loading = 'eager'
  130. img.setAttribute('alt', '')
  131. img.setAttribute('aria-hidden', 'true')
  132. var rm = function() { if (img && img.parentNode) img.parentNode.removeChild(img) }
  133. img.addEventListener('load', rm, false)
  134. document.body.appendChild(img)
  135. }
  136. window.goatcounter.get_query = function(name) {
  137. var s = location.search.substr(1).split('&')
  138. for (var i = 0; i < s.length; i++)
  139. if (s[i].toLowerCase().indexOf(name.toLowerCase() + '=') === 0)
  140. return s[i].substr(name.length + 1)
  141. }
  142. window.goatcounter.bind_events = function() {
  143. if (!document.querySelectorAll)
  144. return
  145. var send = function(elem) {
  146. return function() {
  147. goatcounter.count({
  148. event: true,
  149. path: (elem.dataset.goatcounterClick || elem.name || elem.id || ''),
  150. title: (elem.dataset.goatcounterTitle || elem.title || (elem.innerHTML || '').substr(0, 200) || ''),
  151. referrer: (elem.dataset.goatcounterReferrer || elem.dataset.goatcounterReferral || ''),
  152. })
  153. }
  154. }
  155. Array.prototype.slice.call(document.querySelectorAll("*[data-goatcounter-click]")).forEach(function(elem) {
  156. if (elem.dataset.goatcounterBound)
  157. return
  158. var f = send(elem)
  159. elem.addEventListener('click', f, false)
  160. elem.addEventListener('auxclick', f, false)
  161. elem.dataset.goatcounterBound = 'true'
  162. })
  163. }
  164. window.goatcounter.visit_count = function(opt) {
  165. on_load(function() {
  166. opt = opt || {}
  167. opt.type = opt.type || 'html'
  168. opt.append = opt.append || 'body'
  169. opt.path = opt.path || get_path()
  170. opt.attr = opt.attr || {width: '200', height: (opt.no_branding ? '60' : '80')}
  171. opt.attr['src'] = get_endpoint() + 'er/' + enc(opt.path) + '.' + enc(opt.type) + '?'
  172. if (opt.no_branding) opt.attr['src'] += '&no_branding=1'
  173. if (opt.style) opt.attr['src'] += '&style=' + enc(opt.style)
  174. if (opt.start) opt.attr['src'] += '&start=' + enc(opt.start)
  175. if (opt.end) opt.attr['src'] += '&end=' + enc(opt.end)
  176. var tag = {png: 'img', svg: 'img', html: 'iframe'}[opt.type]
  177. if (!tag)
  178. return warn('visit_count: unknown type: ' + opt.type)
  179. if (opt.type === 'html') {
  180. opt.attr['frameborder'] = '0'
  181. opt.attr['scrolling'] = 'no'
  182. }
  183. var d = document.createElement(tag)
  184. for (var k in opt.attr)
  185. d.setAttribute(k, opt.attr[k])
  186. var p = document.querySelector(opt.append)
  187. if (!p)
  188. return warn('visit_count: append not found: ' + opt.append)
  189. p.appendChild(d)
  190. })
  191. }
  192. if (location.hash === '#toggle-goatcounter') {
  193. if (localStorage.getItem('skipgc') === 't') {
  194. localStorage.removeItem('skipgc', 't')
  195. alert('GoatCounter tracking is now ENABLED in this browser.')
  196. }
  197. else {
  198. localStorage.setItem('skipgc', 't')
  199. alert('GoatCounter tracking is now DISABLED in this browser until ' + location + ' is loaded again.')
  200. }
  201. }
  202. if (!goatcounter.no_onload)
  203. on_load(function() {
  204. if (!('visibilityState' in document) || document.visibilityState === 'visible')
  205. goatcounter.count()
  206. else {
  207. var f = function(e) {
  208. if (document.visibilityState !== 'visible')
  209. return
  210. document.removeEventListener('visibilitychange', f)
  211. goatcounter.count()
  212. }
  213. document.addEventListener('visibilitychange', f)
  214. }
  215. if (!goatcounter.no_events)
  216. goatcounter.bind_events()
  217. })
  218. })();
  219. </script>
  220. <script>
  221. // up
  222. var upBtn = document.getElementById("upBtn");
  223. window.addEventListener('scroll', () => {
  224. if (window.scrollY > 250) {
  225. upBtn.style.opacity = 1;
  226. upBtn.style.pointerEvents = 'auto';
  227. }
  228. else {
  229. upBtn.style.opacity = 0;
  230. upBtn.style.pointerEvents = 'none';
  231. }
  232. })
  233. upBtn.addEventListener('click', () => {
  234. document.body.scrollTop = 0;
  235. document.documentElement.scrollTop = 0;
  236. })
  237. </script>
  238. </body>
  239. </html>