enzanki-website-template 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/assets/js/live.js ADDED
@@ -0,0 +1,237 @@
1
+ ---
2
+ ---
3
+
4
+ /*
5
+ Live.js - One script closer to Designing in the Browser
6
+ Written for Handcraft.com by Martin Kool (@mrtnkl).
7
+
8
+ Version 4.
9
+ Recent change: Made stylesheet and mimetype checks case insensitive.
10
+
11
+ http://livejs.com
12
+ http://livejs.com/license (MIT)
13
+ @livejs
14
+
15
+ Include live.js#css to monitor css changes only.
16
+ Include live.js#js to monitor js changes only.
17
+ Include live.js#html to monitor html changes only.
18
+ Mix and match to monitor a preferred combination such as live.js#html,css
19
+
20
+ By default, just include live.js to monitor all css, js and html changes.
21
+
22
+ Live.js can also be loaded as a bookmarklet. It is best to only use it for CSS then,
23
+ as a page reload due to a change in html or css would not re-include the bookmarklet.
24
+ To monitor CSS and be notified that it has loaded, include it as: live.js#css,notify
25
+ */
26
+ (function () {
27
+
28
+ var headers = { "Etag": 1, "Last-Modified": 1, "Content-Length": 1, "Content-Type": 1 },
29
+ resources = {},
30
+ pendingRequests = {},
31
+ currentLinkElements = {},
32
+ oldLinkElements = {},
33
+ interval = {{ page.live-reload-time | default: site.live-reload-time | default: 5000 }},
34
+ loaded = false,
35
+ active = { "html": 1, "css": 1, "js": 1 };
36
+
37
+ var Live = {
38
+
39
+ // performs a cycle per interval
40
+ heartbeat: function () {
41
+ if (document.body) {
42
+ // make sure all resources are loaded on first activation
43
+ if (!loaded) Live.loadresources();
44
+ Live.checkForChanges();
45
+ }
46
+ setTimeout(Live.heartbeat, interval);
47
+ },
48
+
49
+ // loads all local css and js resources upon first activation
50
+ loadresources: function () {
51
+
52
+ // helper method to assert if a given url is local
53
+ function isLocal(url) {
54
+ var loc = document.location,
55
+ reg = new RegExp("^\\.|^\/(?!\/)|^[\\w]((?!://).)*$|" + loc.protocol + "//" + loc.host);
56
+ return url.match(reg);
57
+ }
58
+
59
+ // gather all resources
60
+ var scripts = document.getElementsByTagName("script"),
61
+ links = document.getElementsByTagName("link"),
62
+ uris = [];
63
+
64
+ // track local js urls
65
+ for (var i = 0; i < scripts.length; i++) {
66
+ var script = scripts[i], src = script.getAttribute("src");
67
+ if (src && isLocal(src))
68
+ uris.push(src);
69
+ if (src && src.match(/\blive.js#/)) {
70
+ for (var type in active)
71
+ active[type] = src.match("[#,|]" + type) != null
72
+ if (src.match("notify"))
73
+ alert("Live.js is loaded.");
74
+ }
75
+ }
76
+ if (!active.js) uris = [];
77
+ if (active.html) uris.push(document.location.href);
78
+
79
+ // track local css urls
80
+ for (var i = 0; i < links.length && active.css; i++) {
81
+ var link = links[i], rel = link.getAttribute("rel"), href = link.getAttribute("href", 2);
82
+ if (href && rel && rel.match(new RegExp("stylesheet", "i")) && isLocal(href)) {
83
+ uris.push(href);
84
+ currentLinkElements[href] = link;
85
+ }
86
+ }
87
+
88
+ // initialize the resources info
89
+ for (var i = 0; i < uris.length; i++) {
90
+ var url = uris[i];
91
+ Live.getHead(url, function (url, info) {
92
+ resources[url] = info;
93
+ });
94
+ }
95
+
96
+ // add rule for morphing between old and new css files
97
+ var head = document.getElementsByTagName("head")[0],
98
+ style = document.createElement("style"),
99
+ rule = "transition: all .3s ease-out;"
100
+ css = [".livejs-loading * { ", rule, " -webkit-", rule, "-moz-", rule, "-o-", rule, "}"].join('');
101
+ style.setAttribute("type", "text/css");
102
+ head.appendChild(style);
103
+ style.styleSheet ? style.styleSheet.cssText = css : style.appendChild(document.createTextNode(css));
104
+
105
+ // yep
106
+ loaded = true;
107
+ },
108
+
109
+ // check all tracking resources for changes
110
+ checkForChanges: function () {
111
+ for (var url in resources) {
112
+ if (pendingRequests[url])
113
+ continue;
114
+
115
+ Live.getHead(url, function (url, newInfo) {
116
+ var oldInfo = resources[url],
117
+ hasChanged = false;
118
+ resources[url] = newInfo;
119
+ for (var header in oldInfo) {
120
+ // do verification based on the header type
121
+ var oldValue = oldInfo[header],
122
+ newValue = newInfo[header],
123
+ contentType = newInfo["Content-Type"];
124
+ switch (header.toLowerCase()) {
125
+ case "etag":
126
+ if (!newValue) break;
127
+ // fall through to default
128
+ default:
129
+ hasChanged = oldValue != newValue;
130
+ break;
131
+ }
132
+ // if changed, act
133
+ if (hasChanged) {
134
+ Live.refreshResource(url, contentType);
135
+ break;
136
+ }
137
+ }
138
+ });
139
+ }
140
+ },
141
+
142
+ // act upon a changed url of certain content type
143
+ refreshResource: function (url, type) {
144
+ switch (type.toLowerCase()) {
145
+ // css files can be reloaded dynamically by replacing the link element
146
+ case "text/css":
147
+ var link = currentLinkElements[url],
148
+ html = document.body.parentNode,
149
+ head = link.parentNode,
150
+ next = link.nextSibling,
151
+ newLink = document.createElement("link");
152
+
153
+ html.className = html.className.replace(/\s*livejs\-loading/gi, '') + ' livejs-loading';
154
+ newLink.setAttribute("type", "text/css");
155
+ newLink.setAttribute("rel", "stylesheet");
156
+ newLink.setAttribute("href", url + "?now=" + new Date() * 1);
157
+ next ? head.insertBefore(newLink, next) : head.appendChild(newLink);
158
+ currentLinkElements[url] = newLink;
159
+ oldLinkElements[url] = link;
160
+
161
+ // schedule removal of the old link
162
+ Live.removeoldLinkElements();
163
+ break;
164
+
165
+ // check if an html resource is our current url, then reload
166
+ case "text/html":
167
+ if (url != document.location.href)
168
+ return;
169
+
170
+ // local javascript changes cause a reload as well
171
+ case "text/javascript":
172
+ case "application/javascript":
173
+ case "application/x-javascript":
174
+ document.location.reload();
175
+ }
176
+ },
177
+
178
+ // removes the old stylesheet rules only once the new one has finished loading
179
+ removeoldLinkElements: function () {
180
+ var pending = 0;
181
+ for (var url in oldLinkElements) {
182
+ // if this sheet has any cssRules, delete the old link
183
+ try {
184
+ var link = currentLinkElements[url],
185
+ oldLink = oldLinkElements[url],
186
+ html = document.body.parentNode,
187
+ sheet = link.sheet || link.styleSheet,
188
+ rules = sheet.rules || sheet.cssRules;
189
+ if (rules.length >= 0) {
190
+ oldLink.parentNode.removeChild(oldLink);
191
+ delete oldLinkElements[url];
192
+ setTimeout(function () {
193
+ html.className = html.className.replace(/\s*livejs\-loading/gi, '');
194
+ }, 100);
195
+ }
196
+ } catch (e) {
197
+ pending++;
198
+ }
199
+ if (pending) setTimeout(Live.removeoldLinkElements, 50);
200
+ }
201
+ },
202
+
203
+ // performs a HEAD request and passes the header info to the given callback
204
+ getHead: function (url, callback) {
205
+ pendingRequests[url] = true;
206
+ var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XmlHttp");
207
+ xhr.open("HEAD", url + "?reloadtime=" + new Date().getTime(), true);
208
+ xhr.setRequestHeader("Cache-Control", "no-cache");
209
+ xhr.onreadystatechange = function () {
210
+ delete pendingRequests[url];
211
+ if (xhr.readyState == 4 && xhr.status != 304) {
212
+ xhr.getAllResponseHeaders();
213
+ var info = {};
214
+ for (var h in headers) {
215
+ var value = xhr.getResponseHeader(h);
216
+ // adjust the simple Etag variant to match on its significant part
217
+ if (h.toLowerCase() == "etag" && value) value = value.replace(/^W\//, '');
218
+ if (h.toLowerCase() == "content-type" && value) value = value.replace(/^(.*?);.*?$/i, "$1");
219
+ info[h] = value;
220
+ }
221
+ callback(url, info);
222
+ }
223
+ }
224
+ xhr.send();
225
+ }
226
+ };
227
+
228
+ // start listening
229
+ if (document.location.protocol != "file:") {
230
+ if (!window.liveJsLoaded)
231
+ Live.heartbeat();
232
+
233
+ window.liveJsLoaded = true;
234
+ }
235
+ else if (window.console)
236
+ console.log("Live.js doesn't support the file protocol. It needs http.");
237
+ })();
data/assets/js/main.js ADDED
@@ -0,0 +1,132 @@
1
+ ---
2
+ ---
3
+
4
+ function loadSuccess() {
5
+ document.getElementById("blockedInfo").innerHTML = "<span class=\"label label-info\">"
6
+ + "YouTube Access Check Succeeded.</span>";
7
+ var image_x = document.getElementById("blockedImage");
8
+ image_x.parentNode.removeChild(image_x);
9
+ ga("send", "event", "YouTube Success", "YouTube Load Success");
10
+ }
11
+
12
+ function loadError(site) {
13
+ document.getElementById("blockedInfo").innerHTML = "<div class=\"alert alert-danger\" role=\"alert\">"
14
+ + "<strong>" + site + " Blocked: </strong>You seem to be accessing this website from a location where "
15
+ + site + " is blocked. As part of this website uses items from " + site + ", "
16
+ + "please contact your network administrator in order to view this website as intended.</div>";
17
+ var image_x = document.getElementById("blockedImage");
18
+ image_x.parentNode.removeChild(image_x);
19
+ ga("send", "event", "YouTube Error", "YouTube Load Error");
20
+ }
21
+
22
+ // Code below is modified from http://stackoverflow.com/a/38118591/6820516
23
+
24
+ function calcSpeed(speed) {
25
+ // Time = Distance/Speed
26
+ var spanSelector = document.querySelectorAll('.marquee p'),i;
27
+ for (i = 0; i < spanSelector.length; i++) {
28
+ var spanLength = spanSelector[i].offsetWidth;
29
+ var timeTaken = spanLength / speed;
30
+ spanSelector[i].style.animationDuration = timeTaken + "s";
31
+ }
32
+ }
33
+
34
+ // End modified code.
35
+
36
+ $(window).on("load", function() {
37
+ //Fix for header scroll http://stackoverflow.com/a/25887125/6820516
38
+ var elements = document.querySelectorAll('input,select,textarea');
39
+ var invalidListener = function(){ this.scrollIntoView(false); };
40
+
41
+ for(var i = elements.length; i--;)
42
+ elements[i].addEventListener('invalid', invalidListener);
43
+
44
+ $("time.timeago").timeago();
45
+ $.timeago.settings.allowFuture = true;
46
+
47
+ $("[data-toggle=\"tooltip\"]").tooltip();
48
+ calcSpeed(75);
49
+ });
50
+
51
+ // Code below is modified from http://codepen.io/ashblue/pen/mCtuA/
52
+
53
+ var $TABLE = $('#table');
54
+
55
+ $('.table-add').click(function () {
56
+ var $clone = $TABLE.find('tr.hide').clone(true).removeClass('hide table-line');
57
+ $TABLE.find('table').append($clone);
58
+ });
59
+
60
+ $('.table-remove').click(function () {
61
+ $(this).parents('tr').detach();
62
+ });
63
+
64
+ // A few jQuery helpers for exporting only
65
+ jQuery.fn.pop = [].pop;
66
+ jQuery.fn.shift = [].shift;
67
+
68
+ function dataexport() {
69
+ var $rows = $TABLE.find('tr:not(:hidden)');
70
+ var headers = [];
71
+ var data = "score:\n";
72
+
73
+ // Get the headers (add special header logic here)
74
+ $($rows.shift()).find('th:not(:empty)').each(function () {
75
+ headers.push($(this).text().toLowerCase());
76
+ });
77
+
78
+ // Turn all existing rows into a loopable array
79
+ $rows.each(function () {
80
+ var $td = $(this).find('td');
81
+
82
+ // Use the headers from earlier to name our hash keys
83
+ headers.forEach(function (header, i) {
84
+ if (header == "team") {
85
+ data += " - team: " + $td.eq(i).text() + "\n";
86
+ } else if (header == "points") {
87
+ data += " points: " + $td.eq(i).text() + "\n";
88
+ }
89
+ });
90
+ });
91
+
92
+ console.log(data);
93
+
94
+ // Output the result
95
+ if (data=="score:\n") {
96
+ return "";
97
+ } else {
98
+ return data;
99
+ }
100
+ };
101
+
102
+
103
+ // End code modified from http://codepen.io/ashblue/pen/mCtuA/
104
+
105
+ function submit(type, values) {
106
+ var filename = encodeURIComponent("_" + type + "s/"
107
+ + moment(document.getElementById("date").value).format("YYYY-MM-DD")
108
+ + "-" + getSlug(document.getElementById("title").value) + ".md");
109
+
110
+ var content = "---\nenabled: true\n";
111
+ $.each(values, function( index, value ) {
112
+ if (value == "date") {
113
+ content += value + ": " + moment(document.getElementById("date").value)
114
+ .format("YYYY-MM-DD hh:MM A") + "\n";
115
+ } else if (value == "score") {
116
+ content += dataexport();
117
+ } else if (document.getElementById(value).value) {
118
+ content += value + ": " + document.getElementById(value).value + "\n";
119
+ }
120
+ });
121
+ content += "---\n"
122
+
123
+ content = encodeURIComponent(content);
124
+
125
+ message = encodeURIComponent("[New " + type + "] "
126
+ + moment(document.getElementById("date").value).format("YYYY-MM-DD")
127
+ + "-" + document.getElementById("title").value);
128
+ description = encodeURIComponent("Submitted via " + window.location.href);
129
+ window.location.href = "{{ site.github.repository_url }}/new/master?filename=" + filename
130
+ + "&value=" + content + "&message=" + message
131
+ + "&description=" + description;
132
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ ---
3
+
4
+ var _rollbarConfig = {
5
+ accessToken: "{{ site.data.debug.rollbar }}",
6
+ captureUncaught: true,
7
+ captureUnhandledRejections: true,
8
+ payload: {
9
+ environment: "{{ jekyll.environment }}"
10
+ }
11
+ };
12
+ // Rollbar Snippet
13
+ !function(r){function e(t){if(o[t])return o[t].exports;var n=o[t]={exports:{},id:t,loaded:!1};return r[t].call(n.exports,n,n.exports,e),n.loaded=!0,n.exports}var o={};return e.m=r,e.c=o,e.p="",e(0)}([function(r,e,o){"use strict";var t=o(1).Rollbar,n=o(2);_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://d37gvrvc0wt4s1.cloudfront.net/js/v1.9/rollbar.min.js";var a=t.init(window,_rollbarConfig),i=n(a,_rollbarConfig);a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,i)},function(r,e){"use strict";function o(r){return function(){try{return r.apply(this,arguments)}catch(e){try{console.error("[Rollbar]: Internal error",e)}catch(o){}}}}function t(r,e,o){window._rollbarWrappedError&&(o[4]||(o[4]=window._rollbarWrappedError),o[5]||(o[5]=window._rollbarWrappedError._rollbarContext),window._rollbarWrappedError=null),r.uncaughtError.apply(r,o),e&&e.apply(window,o)}function n(r){var e=function(){var e=Array.prototype.slice.call(arguments,0);t(r,r._rollbarOldOnError,e)};return e.belongsToShim=!0,e}function a(r){this.shimId=++c,this.notifier=null,this.parentShim=r,this._rollbarOldOnError=null}function i(r){var e=a;return o(function(){if(this.notifier)return this.notifier[r].apply(this.notifier,arguments);var o=this,t="scope"===r;t&&(o=new e(this));var n=Array.prototype.slice.call(arguments,0),a={shim:o,method:r,args:n,ts:new Date};return window._rollbarShimQueue.push(a),t?o:void 0})}function l(r,e){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){var o=e.addEventListener;e.addEventListener=function(e,t,n){o.call(this,e,r.wrap(t),n)};var t=e.removeEventListener;e.removeEventListener=function(r,e,o){t.call(this,r,e&&e._wrapped?e._wrapped:e,o)}}}var c=0;a.init=function(r,e){var t=e.globalAlias||"Rollbar";if("object"==typeof r[t])return r[t];r._rollbarShimQueue=[],r._rollbarWrappedError=null,e=e||{};var i=new a;return o(function(){if(i.configure(e),e.captureUncaught){i._rollbarOldOnError=r.onerror,r.onerror=n(i);var o,a,c="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(o=0;o<c.length;++o)a=c[o],r[a]&&r[a].prototype&&l(i,r[a].prototype)}return e.captureUnhandledRejections&&(i._unhandledRejectionHandler=function(r){var e=r.reason,o=r.promise,t=r.detail;!e&&t&&(e=t.reason,o=t.promise),i.unhandledRejection(e,o)},r.addEventListener("unhandledrejection",i._unhandledRejectionHandler)),r[t]=i,i})()},a.prototype.loadFull=function(r,e,t,n,a){var i=function(){var e;if(void 0===r._rollbarPayloadQueue){var o,t,n,i;for(e=new Error("rollbar.js did not load");o=r._rollbarShimQueue.shift();)for(n=o.args,i=0;i<n.length;++i)if(t=n[i],"function"==typeof t){t(e);break}}"function"==typeof a&&a(e)},l=!1,c=e.createElement("script"),d=e.getElementsByTagName("script")[0],p=d.parentNode;c.crossOrigin="",c.src=n.rollbarJsUrl,c.async=!t,c.onload=c.onreadystatechange=o(function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){c.onload=c.onreadystatechange=null;try{p.removeChild(c)}catch(r){}l=!0,i()}}),p.insertBefore(c,d)},a.prototype.wrap=function(r,e){try{var o;if(o="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._wrapped){r._wrapped=function(){try{return r.apply(this,arguments)}catch(e){throw e._rollbarContext=o()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e,e}},r._wrapped._isWrap=!0;for(var t in r)r.hasOwnProperty(t)&&(r._wrapped[t]=r[t])}return r._wrapped}catch(n){return r}};for(var d="log,debug,info,warn,warning,error,critical,global,configure,scope,uncaughtError,unhandledRejection".split(","),p=0;p<d.length;++p)a.prototype[d[p]]=i(d[p]);r.exports={Rollbar:a,_rollbarWindowOnError:t}},function(r,e){"use strict";r.exports=function(r,e){return function(o){if(!o&&!window._rollbarInitialized){var t=window.RollbarNotifier,n=e||{},a=n.globalAlias||"Rollbar",i=window.Rollbar.init(n,r);i._processShimQueue(window._rollbarShimQueue||[]),window[a]=i,window._rollbarInitialized=!0,t.processPayloads()}}}}]);
14
+ // End Rollbar Snippet
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: enzanki-website-template
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Shafer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-12-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: github-pages
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '172'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '172'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - shafer.alex@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - LICENSE.md
63
+ - README.md
64
+ - _includes/footer.html
65
+ - _includes/header.html
66
+ - _includes/htmlfooter.html
67
+ - _includes/htmlheader.html
68
+ - _includes/navbarlink.html
69
+ - _includes/postheader.html
70
+ - _includes/postpages.html
71
+ - _includes/reportissue.html
72
+ - _includes/youtube-embed.html
73
+ - _includes/ytblock.html
74
+ - _layouts/default.html
75
+ - _layouts/htmlapi.html
76
+ - _layouts/post.html
77
+ - _layouts/revealjs.html
78
+ - _layouts/ytpost.html
79
+ - assets/css/main.css
80
+ - assets/js/live.js
81
+ - assets/js/main.js
82
+ - assets/js/rollbar.js
83
+ homepage: https://enzanki-ars.github.io/
84
+ licenses:
85
+ - AGPL-3.0
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.5.2.1
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: enzanki_ars's template for websites.
107
+ test_files: []