console-theme 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,393 @@
1
+ /**
2
+ * simplePagination.js v1.6
3
+ * A simple jQuery pagination plugin.
4
+ * http://flaviusmatis.github.com/simplePagination.js/
5
+ *
6
+ * Copyright 2012, Flavius Matis
7
+ * Released under the MIT license.
8
+ * http://flaviusmatis.github.com/license.html
9
+ */
10
+
11
+ (function($){
12
+
13
+ var methods = {
14
+ init: function(options) {
15
+ var o = $.extend({
16
+ items: 1,
17
+ itemsOnPage: 1,
18
+ pages: 0,
19
+ displayedPages: 5,
20
+ edges: 2,
21
+ currentPage: 0,
22
+ hrefTextPrefix: '#page-',
23
+ hrefTextSuffix: '',
24
+ prevText: 'Prev',
25
+ nextText: 'Next',
26
+ ellipseText: '…',
27
+ ellipsePageSet: true,
28
+ cssStyle: 'light-theme',
29
+ listStyle: '',
30
+ labelMap: [],
31
+ selectOnClick: true,
32
+ nextAtFront: false,
33
+ invertPageOrder: false,
34
+ useStartEdge : true,
35
+ useEndEdge : true,
36
+ onPageClick: function(pageNumber, event) {
37
+ // Callback triggered when a page is clicked
38
+ // Page number is given as an optional parameter
39
+ },
40
+ onInit: function() {
41
+ // Callback triggered immediately after initialization
42
+ }
43
+ }, options || {});
44
+
45
+ var self = this;
46
+
47
+ o.pages = o.pages ? o.pages : Math.ceil(o.items / o.itemsOnPage) ? Math.ceil(o.items / o.itemsOnPage) : 1;
48
+ if (o.currentPage)
49
+ o.currentPage = o.currentPage - 1;
50
+ else
51
+ o.currentPage = !o.invertPageOrder ? 0 : o.pages - 1;
52
+ o.halfDisplayed = o.displayedPages / 2;
53
+
54
+ this.each(function() {
55
+ self.addClass(o.cssStyle + ' simple-pagination').data('pagination', o);
56
+ methods._draw.call(self);
57
+ });
58
+
59
+ o.onInit();
60
+
61
+ return this;
62
+ },
63
+
64
+ selectPage: function(page) {
65
+ methods._selectPage.call(this, page - 1);
66
+ return this;
67
+ },
68
+
69
+ prevPage: function() {
70
+ var o = this.data('pagination');
71
+ if (!o.invertPageOrder) {
72
+ if (o.currentPage > 0) {
73
+ methods._selectPage.call(this, o.currentPage - 1);
74
+ }
75
+ } else {
76
+ if (o.currentPage < o.pages - 1) {
77
+ methods._selectPage.call(this, o.currentPage + 1);
78
+ }
79
+ }
80
+ return this;
81
+ },
82
+
83
+ nextPage: function() {
84
+ var o = this.data('pagination');
85
+ if (!o.invertPageOrder) {
86
+ if (o.currentPage < o.pages - 1) {
87
+ methods._selectPage.call(this, o.currentPage + 1);
88
+ }
89
+ } else {
90
+ if (o.currentPage > 0) {
91
+ methods._selectPage.call(this, o.currentPage - 1);
92
+ }
93
+ }
94
+ return this;
95
+ },
96
+
97
+ getPagesCount: function() {
98
+ return this.data('pagination').pages;
99
+ },
100
+
101
+ setPagesCount: function(count) {
102
+ this.data('pagination').pages = count;
103
+ },
104
+
105
+ getCurrentPage: function () {
106
+ return this.data('pagination').currentPage + 1;
107
+ },
108
+
109
+ destroy: function(){
110
+ this.empty();
111
+ return this;
112
+ },
113
+
114
+ drawPage: function (page) {
115
+ var o = this.data('pagination');
116
+ o.currentPage = page - 1;
117
+ this.data('pagination', o);
118
+ methods._draw.call(this);
119
+ return this;
120
+ },
121
+
122
+ redraw: function(){
123
+ methods._draw.call(this);
124
+ return this;
125
+ },
126
+
127
+ disable: function(){
128
+ var o = this.data('pagination');
129
+ o.disabled = true;
130
+ this.data('pagination', o);
131
+ methods._draw.call(this);
132
+ return this;
133
+ },
134
+
135
+ enable: function(){
136
+ var o = this.data('pagination');
137
+ o.disabled = false;
138
+ this.data('pagination', o);
139
+ methods._draw.call(this);
140
+ return this;
141
+ },
142
+
143
+ updateItems: function (newItems) {
144
+ var o = this.data('pagination');
145
+ o.items = newItems;
146
+ o.pages = methods._getPages(o);
147
+ this.data('pagination', o);
148
+ methods._draw.call(this);
149
+ },
150
+
151
+ updateItemsOnPage: function (itemsOnPage) {
152
+ var o = this.data('pagination');
153
+ o.itemsOnPage = itemsOnPage;
154
+ o.pages = methods._getPages(o);
155
+ this.data('pagination', o);
156
+ methods._selectPage.call(this, 0);
157
+ return this;
158
+ },
159
+
160
+ getItemsOnPage: function() {
161
+ return this.data('pagination').itemsOnPage;
162
+ },
163
+
164
+ _draw: function() {
165
+ var o = this.data('pagination'),
166
+ interval = methods._getInterval(o),
167
+ i,
168
+ tagName;
169
+
170
+ methods.destroy.call(this);
171
+
172
+ tagName = (typeof this.prop === 'function') ? this.prop('tagName') : this.attr('tagName');
173
+
174
+ var $panel = tagName === 'UL' ? this : $('<ul' + (o.listStyle ? ' class="' + o.listStyle + '"' : '') + '></ul>').appendTo(this);
175
+
176
+ // Generate Prev link
177
+ if (o.prevText) {
178
+ methods._appendItem.call(this, !o.invertPageOrder ? o.currentPage - 1 : o.currentPage + 1, {text: o.prevText, classes: 'prev'});
179
+ }
180
+
181
+ // Generate Next link (if option set for at front)
182
+ if (o.nextText && o.nextAtFront) {
183
+ methods._appendItem.call(this, !o.invertPageOrder ? o.currentPage + 1 : o.currentPage - 1, {text: o.nextText, classes: 'next'});
184
+ }
185
+
186
+ // Generate start edges
187
+ if (!o.invertPageOrder) {
188
+ if (interval.start > 0 && o.edges > 0) {
189
+ if(o.useStartEdge) {
190
+ var end = Math.min(o.edges, interval.start);
191
+ for (i = 0; i < end; i++) {
192
+ methods._appendItem.call(this, i);
193
+ }
194
+ }
195
+ if (o.edges < interval.start && (interval.start - o.edges != 1)) {
196
+ $panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
197
+ } else if (interval.start - o.edges == 1) {
198
+ methods._appendItem.call(this, o.edges);
199
+ }
200
+ }
201
+ } else {
202
+ if (interval.end < o.pages && o.edges > 0) {
203
+ if(o.useStartEdge) {
204
+ var begin = Math.max(o.pages - o.edges, interval.end);
205
+ for (i = o.pages - 1; i >= begin; i--) {
206
+ methods._appendItem.call(this, i);
207
+ }
208
+ }
209
+
210
+ if (o.pages - o.edges > interval.end && (o.pages - o.edges - interval.end != 1)) {
211
+ $panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
212
+ } else if (o.pages - o.edges - interval.end == 1) {
213
+ methods._appendItem.call(this, interval.end);
214
+ }
215
+ }
216
+ }
217
+
218
+ // Generate interval links
219
+ if (!o.invertPageOrder) {
220
+ for (i = interval.start; i < interval.end; i++) {
221
+ methods._appendItem.call(this, i);
222
+ }
223
+ } else {
224
+ for (i = interval.end - 1; i >= interval.start; i--) {
225
+ methods._appendItem.call(this, i);
226
+ }
227
+ }
228
+
229
+ // Generate end edges
230
+ if (!o.invertPageOrder) {
231
+ if (interval.end < o.pages && o.edges > 0) {
232
+ if (o.pages - o.edges > interval.end && (o.pages - o.edges - interval.end != 1)) {
233
+ $panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
234
+ } else if (o.pages - o.edges - interval.end == 1) {
235
+ methods._appendItem.call(this, interval.end);
236
+ }
237
+ if(o.useEndEdge) {
238
+ var begin = Math.max(o.pages - o.edges, interval.end);
239
+ for (i = begin; i < o.pages; i++) {
240
+ methods._appendItem.call(this, i);
241
+ }
242
+ }
243
+ }
244
+ } else {
245
+ if (interval.start > 0 && o.edges > 0) {
246
+ if (o.edges < interval.start && (interval.start - o.edges != 1)) {
247
+ $panel.append('<li class="disabled"><span class="ellipse">' + o.ellipseText + '</span></li>');
248
+ } else if (interval.start - o.edges == 1) {
249
+ methods._appendItem.call(this, o.edges);
250
+ }
251
+
252
+ if(o.useEndEdge) {
253
+ var end = Math.min(o.edges, interval.start);
254
+ for (i = end - 1; i >= 0; i--) {
255
+ methods._appendItem.call(this, i);
256
+ }
257
+ }
258
+ }
259
+ }
260
+
261
+ // Generate Next link (unless option is set for at front)
262
+ if (o.nextText && !o.nextAtFront) {
263
+ methods._appendItem.call(this, !o.invertPageOrder ? o.currentPage + 1 : o.currentPage - 1, {text: o.nextText, classes: 'next'});
264
+ }
265
+
266
+ if (o.ellipsePageSet && !o.disabled) {
267
+ methods._ellipseClick.call(this, $panel);
268
+ }
269
+
270
+ },
271
+
272
+ _getPages: function(o) {
273
+ var pages = Math.ceil(o.items / o.itemsOnPage);
274
+ return pages || 1;
275
+ },
276
+
277
+ _getInterval: function(o) {
278
+ return {
279
+ start: Math.ceil(o.currentPage > o.halfDisplayed ? Math.max(Math.min(o.currentPage - o.halfDisplayed, (o.pages - o.displayedPages)), 0) : 0),
280
+ end: Math.ceil(o.currentPage > o.halfDisplayed ? Math.min(o.currentPage + o.halfDisplayed, o.pages) : Math.min(o.displayedPages, o.pages))
281
+ };
282
+ },
283
+
284
+ _appendItem: function(pageIndex, opts) {
285
+ var self = this, options, $link, o = self.data('pagination'), $linkWrapper = $('<li></li>'), $ul = self.find('ul');
286
+
287
+ pageIndex = pageIndex < 0 ? 0 : (pageIndex < o.pages ? pageIndex : o.pages - 1);
288
+
289
+ options = {
290
+ text: pageIndex + 1,
291
+ classes: ''
292
+ };
293
+
294
+ if (o.labelMap.length && o.labelMap[pageIndex]) {
295
+ options.text = o.labelMap[pageIndex];
296
+ }
297
+
298
+ options = $.extend(options, opts || {});
299
+
300
+ if (pageIndex == o.currentPage || o.disabled) {
301
+ if (o.disabled || options.classes === 'prev' || options.classes === 'next') {
302
+ $linkWrapper.addClass('disabled');
303
+ } else {
304
+ $linkWrapper.addClass('active');
305
+ }
306
+ $link = $('<span class="current">' + (options.text) + '</span>');
307
+ } else {
308
+ $link = $('<a href="' + o.hrefTextPrefix + (pageIndex + 1) + o.hrefTextSuffix + '" class="page-link">' + (options.text) + '</a>');
309
+ $link.click(function(event){
310
+ return methods._selectPage.call(self, pageIndex, event);
311
+ });
312
+ }
313
+
314
+ if (options.classes) {
315
+ $link.addClass(options.classes);
316
+ }
317
+
318
+ $linkWrapper.append($link);
319
+
320
+ if ($ul.length) {
321
+ $ul.append($linkWrapper);
322
+ } else {
323
+ self.append($linkWrapper);
324
+ }
325
+ },
326
+
327
+ _selectPage: function(pageIndex, event) {
328
+ var o = this.data('pagination');
329
+ o.currentPage = pageIndex;
330
+ if (o.selectOnClick) {
331
+ methods._draw.call(this);
332
+ }
333
+ return o.onPageClick(pageIndex + 1, event);
334
+ },
335
+
336
+
337
+ _ellipseClick: function($panel) {
338
+ var self = this,
339
+ o = this.data('pagination'),
340
+ $ellip = $panel.find('.ellipse');
341
+ $ellip.addClass('clickable').parent().removeClass('disabled');
342
+ $ellip.click(function(event) {
343
+ if (!o.disable) {
344
+ var $this = $(this),
345
+ val = (parseInt($this.parent().prev().text(), 10) || 0) + 1;
346
+ $this
347
+ .html('<input type="number" min="1" max="' + o.pages + '" step="1" value="' + val + '">')
348
+ .find('input')
349
+ .focus()
350
+ .click(function(event) {
351
+ // prevent input number arrows from bubbling a click event on $ellip
352
+ event.stopPropagation();
353
+ })
354
+ .keyup(function(event) {
355
+ var val = $(this).val();
356
+ if (event.which === 13 && val !== '') {
357
+ // enter to accept
358
+ if ((val>0)&&(val<=o.pages))
359
+ methods._selectPage.call(self, val - 1);
360
+ } else if (event.which === 27) {
361
+ // escape to cancel
362
+ $ellip.empty().html(o.ellipseText);
363
+ }
364
+ })
365
+ .bind('blur', function(event) {
366
+ var val = $(this).val();
367
+ if (val !== '') {
368
+ methods._selectPage.call(self, val - 1);
369
+ }
370
+ $ellip.empty().html(o.ellipseText);
371
+ return false;
372
+ });
373
+ }
374
+ return false;
375
+ });
376
+ }
377
+
378
+ };
379
+
380
+ $.fn.pagination = function(method) {
381
+
382
+ // Method calling logic
383
+ if (methods[method] && method.charAt(0) != '_') {
384
+ return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
385
+ } else if (typeof method === 'object' || !method) {
386
+ return methods.init.apply(this, arguments);
387
+ } else {
388
+ $.error('Method ' + method + ' does not exist on jQuery.pagination');
389
+ }
390
+
391
+ };
392
+
393
+ })(jQuery);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.7.2
3
+ * Copyright (C) 2016 Oliver Nightingale
4
+ * @license MIT
5
+ */
6
+ !function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.7.2",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.utils.asString=function(t){return void 0===t||null===t?"":t.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(e){if(!arguments.length||null==e||void 0==e)return[];if(Array.isArray(e))return e.map(function(e){return t.utils.asString(e).toLowerCase()});var n=t.tokenizer.seperator||t.tokenizer.separator;return e.toString().trim().toLowerCase().split(n)},t.tokenizer.seperator=!1,t.tokenizer.separator=/[\s\-]+/,t.tokenizer.load=function(t){var e=this.registeredFunctions[t];if(!e)throw new Error("Cannot load un-registered function: "+t);return e},t.tokenizer.label="default",t.tokenizer.registeredFunctions={"default":t.tokenizer},t.tokenizer.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing tokenizer: "+n),e.label=n,this.registeredFunctions[n]=e},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,r=0;n>r;r++){for(var o=t[r],s=0;i>s&&(o=this._stack[s](o,r,t),void 0!==o&&""!==o);s++);void 0!==o&&""!==o&&e.push(o)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e<i.idx)return this.list=new t.Vector.Node(e,n,i),this.length++;for(var r=i,o=i.next;void 0!=o;){if(e<o.idx)return r.next=new t.Vector.Node(e,n,o),this.length++;r=o,o=o.next}return r.next=new t.Vector.Node(e,n,o),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t,e=this.list,n=0;e;)t=e.val,n+=t*t,e=e.next;return this._magnitude=Math.sqrt(n)},t.Vector.prototype.dot=function(t){for(var e=this.list,n=t.list,i=0;e&&n;)e.idx<n.idx?e=e.next:e.idx>n.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},t.SortedSet.prototype.toArray=function(){return this.elements.slice()},t.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},t.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},t.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;){if(o===t)return r;t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r]}return o===t?r:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,r=e+Math.floor(i/2),o=this.elements[r];i>1;)t>o&&(e=r),o>t&&(n=r),i=n-e,r=e+Math.floor(i/2),o=this.elements[r];return o>t?r:t>o?r+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,r=0,o=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>o-1||r>s-1)break;a[i]!==h[r]?a[i]<h[r]?i++:a[i]>h[r]&&r++:(n.add(a[i]),i++,r++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone();for(var r=0,o=n.toArray();r<o.length;r++)i.add(o[r]);return i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this.tokenizerFn=t.tokenizer,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.tokenizer(t.tokenizer.load(e.tokenizer)),n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.tokenizer=function(e){var n=e.label&&e.label in t.tokenizer.registeredFunctions;return n||t.utils.warn("Function is not a registered tokenizer. This may cause problems when serialising the index"),this.tokenizerFn=e,this},t.Index.prototype.add=function(e,n){var i={},r=new t.SortedSet,o=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(t){var n=this.pipeline.run(this.tokenizerFn(e[t.name]));i[t.name]=n;for(var o=0;o<n.length;o++){var s=n[o];r.add(s),this.corpusTokens.add(s)}},this),this.documentStore.set(o,r);for(var s=0;s<r.length;s++){for(var a=r.elements[s],h=0,u=0;u<this._fields.length;u++){var l=this._fields[u],c=i[l.name],f=c.length;if(f){for(var d=0,p=0;f>p;p++)c[p]===a&&d++;h+=d/f*l.boost}}this.tokenStore.add(a,{ref:o,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(this.tokenizerFn(e)),i=new t.Vector,r=[],o=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*o,h=this,u=this.tokenStore.expand(e).reduce(function(n,r){var o=h.corpusTokens.indexOf(r),s=h.idf(r),u=1,l=new t.SortedSet;if(r!==e){var c=Math.max(3,r.length-e.length);u=1/Math.log(c)}o>-1&&i.insert(o,a*s*u);for(var f=h.tokenStore.get(r),d=Object.keys(f),p=d.length,v=0;p>v;v++)l.add(f[d[v]].ref);return n.union(l)},new t.SortedSet);r.push(u)},this);var a=r.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,r=new t.Vector,o=0;i>o;o++){var s=n.elements[o],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);r.insert(this.corpusTokens.indexOf(s),a*h)}return r},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,tokenizer:this.tokenizerFn.label,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",r=n+"[^aeiouy]*",o=i+"[aeiou]*",s="^("+r+")?"+o+r,a="^("+r+")?"+o+r+"("+o+")?$",h="^("+r+")?"+o+r+o+r,u="^("+r+")?"+i,l=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(u),p=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,g=/^(.+?)eed$/,m=/^(.+?)(ed|ing)$/,y=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),k=new RegExp("^"+r+i+"[^aeiouwxy]$"),x=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,F=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,_=/^(.+?)(s|t)(ion)$/,z=/^(.+?)e$/,O=/ll$/,P=new RegExp("^"+r+i+"[^aeiouwxy]$"),T=function(n){var i,r,o,s,a,h,u;if(n.length<3)return n;if(o=n.substr(0,1),"y"==o&&(n=o.toUpperCase()+n.substr(1)),s=p,a=v,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=g,a=m,s.test(n)){var T=s.exec(n);s=l,s.test(T[1])&&(s=y,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,u=k,a.test(n)?n+="e":h.test(n)?(s=y,n=n.replace(s,"")):u.test(n)&&(n+="e"))}if(s=x,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+t[r])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],r=T[2],s=l,s.test(i)&&(n=i+e[r])}if(s=F,a=_,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=z,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=P,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=O,a=c,s.test(n)&&a.test(n)&&(s=y,n=n.replace(s,"")),"y"==o&&(n=o.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.generateStopWordFilter=function(t){var e=t.reduce(function(t,e){return t[e]=e,t},{});return function(t){return t&&e[t]!==t?t:void 0}},t.stopWordFilter=t.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){return t.replace(/^\W+/,"").replace(/\W+$/,"")},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t.charAt(0),r=t.slice(1);return i in n||(n[i]={docs:{}}),0===r.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(r,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return!1;e=e[t.charAt(n)]}return!0},t.TokenStore.prototype.getNode=function(t){if(!t)return{};for(var e=this.root,n=0;n<t.length;n++){if(!e[t.charAt(n)])return{};e=e[t.charAt(n)]}return e},t.TokenStore.prototype.get=function(t,e){return this.getNode(t,e).docs||{}},t.TokenStore.prototype.count=function(t,e){return Object.keys(this.get(t,e)).length},t.TokenStore.prototype.remove=function(t,e){if(t){for(var n=this.root,i=0;i<t.length;i++){if(!(t.charAt(i)in n))return;n=n[t.charAt(i)]}delete n.docs[e]}},t.TokenStore.prototype.expand=function(t,e){var n=this.getNode(t),i=n.docs||{},e=e||[];return Object.keys(i).length&&e.push(t),Object.keys(n).forEach(function(n){"docs"!==n&&e.concat(this.expand(t+n,e))},this),e},t.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.lunr=e()}(this,function(){return t})}();
data/assets/js/main.js ADDED
@@ -0,0 +1,26 @@
1
+ jQuery(document).ready(function(){
2
+ svg4everybody();
3
+ $(".icon-hamburger").on('click', function(event){
4
+ $(".site-navigation").toggleClass('active');
5
+ if($(".container-search-main").hasClass('active'))
6
+ $(".container-search-main").toggleClass('active');
7
+ });
8
+
9
+ $(".icon-cross").on('click', function(event){
10
+ $(".site-navigation").toggleClass('active');
11
+ });
12
+
13
+ $(".icon-search").on('click', function(event){
14
+ $(".container-search-main").toggleClass('active');
15
+ if($(".site-navigation").hasClass('active'))
16
+ $(".site-navigation").toggleClass('active');
17
+ });
18
+
19
+ $('.anchor').click(function(e){
20
+ e.preventDefault();
21
+ setTimeout(function(){
22
+ $('body,html').animate({scrollTop:$('#top').offset().top},500);
23
+ }, 100);
24
+ });
25
+
26
+ });
@@ -0,0 +1,174 @@
1
+ jQuery(document).ready(function(){
2
+
3
+ var resultArray = null;
4
+ var itemsOnPage = 3;
5
+ var store = window.store;
6
+ var searchResults = document.getElementById('search-results');
7
+ var currLang = 'en';
8
+ var langJSON = {};
9
+
10
+ function populateJSON(){
11
+ langJSON = {
12
+ "no_result" : [
13
+ {"en" : "No results found"},
14
+ {"de" : "Keine Ergebnisse gefunden"},
15
+ {"ko" : "결과 내용이 없습니다"}
16
+ ],
17
+ "input_needed" : [
18
+ {"en" : "Please give some input to start"},
19
+ {"de" : "Bitte geben Sie eine Eingabe zu starten"},
20
+ {"ko" : "값을 입력해 주세요"}
21
+ ],
22
+ "read_more" : [
23
+ {"en" : "Read more"},
24
+ {"de" : "Mehr"},
25
+ {"ko" : "읽기"}
26
+ ],
27
+ "prev": [
28
+ {"en": "Prev"},
29
+ {"de": "Zurück"},
30
+ {"ko": "이전"}
31
+ ],
32
+ "next": [
33
+ {"en": "Next"},
34
+ {"de": "Weiter"},
35
+ {"ko": "다음"}
36
+ ]
37
+ };
38
+ }
39
+
40
+ function getJSON(string, lang){
41
+ var stringArray = langJSON[string];
42
+ for(var i = 0; i < stringArray.length; i++){
43
+ var currObj = stringArray[i];
44
+ for( var lang in currObj){
45
+ if(lang == currLang)
46
+ return currObj[lang];
47
+ }
48
+ }
49
+ }
50
+
51
+ function initLang(){
52
+ currLang = jQuery('.container-main-language-link.active').attr('id');
53
+ populateJSON();
54
+ }
55
+
56
+ function paginationGoTo(){
57
+ var pageNumber = jQuery('.pagination').pagination('getCurrentPage');
58
+ displaySearchResultsForPage(pageNumber, itemsOnPage);
59
+ }
60
+
61
+ function loadPagination(itemSize){
62
+
63
+ if(itemSize == 0){
64
+ searchResults.innerHTML = '<div class=\"post-list-no-results\"><svg class=\"icon-wrench\"><use xlink:href=\"/assets/images/graphics/svg-symbols.svg\#wrench"></use></svg><li class="no-results">' + getJSON("no_result", currLang) + '</li></div>';
65
+ return;
66
+ }
67
+
68
+ jQuery('.pagination').pagination({
69
+ items: itemSize,
70
+ itemsOnPage: itemsOnPage,
71
+ prevText: getJSON("prev", currLang),
72
+ nextText: getJSON("next", currLang),
73
+ cssStyle: 'light-theme',
74
+ onPageClick: function(){
75
+ paginationGoTo();
76
+ },
77
+ onInit: function(){
78
+ initSearchResults();
79
+ }
80
+ });
81
+ }
82
+
83
+ function renderResultList(array, startIdx, endIdx){
84
+ var appendString = '';
85
+
86
+ for (var i = startIdx; i <= endIdx; i++) {
87
+ var item = store[array[i].ref];
88
+ appendString += '<li class="post-list-enclosure-1pr">';
89
+ appendString += '<div class="card-details">';
90
+ appendString += '<div class="card-details-header">';
91
+ appendString += '<span class="card-details-header-title">' + item.title + '</span>';
92
+ appendString += '<span class="card-details-header-category">' + item.category + '</span>';
93
+ appendString += '<span class="card-details-header-date">' + item.date + '</span>';
94
+ appendString += '</div>';
95
+ appendString += '<div class="card-details-main">';
96
+ if(item.content.length <= 149) appendString += item.content + '</div>';
97
+ else appendString += item.content.substring(0, 300) + '...</div>';
98
+ appendString += '<div class="card-details-readmore">' + '<a href="' + item.url + '">' + getJSON("read_more", currLang) + ' > </a></div>';
99
+ appendString += '</div>';
100
+ appendString += '</li>';
101
+ }
102
+
103
+ return appendString;
104
+ }
105
+
106
+ function displaySearchResultsForPage(pageNumber, itemsOnPage){
107
+
108
+ searchResults.innerHTML = '';
109
+
110
+ var startIndex = itemsOnPage * (pageNumber - 1);
111
+ var endIndex = startIndex + (itemsOnPage - 1);
112
+ var totalPageCount = $('.pagination').pagination('getPagesCount');
113
+
114
+ if( pageNumber == totalPageCount && endIndex > (resultArray.length - 1))
115
+ var endIndex = resultArray.length -1;
116
+
117
+ searchResults.innerHTML = renderResultList(resultArray, startIndex, endIndex);
118
+ }
119
+
120
+ function initSearchResults() {
121
+
122
+ if(resultArray === null){
123
+ searchResults.innerHTML = '<div class=\"post-list-input-required\"><svg class=\"icon-warning\"><use xlink:href=\"/assets/images/graphics/svg-symbols.svg\#warning"></use></svg><li class="ask-input">' + getJSON("input_needed", currLang) + '<blink>_</blink> </li></div>';
124
+ return;
125
+ }
126
+
127
+ if(resultArray.length < itemsOnPage - 1)
128
+ searchResults.innerHTML = renderResultList(resultArray, 0, resultArray.length - 1);
129
+ else
130
+ searchResults.innerHTML = renderResultList(resultArray, 0, itemsOnPage - 1);
131
+
132
+ }
133
+
134
+ function getQueryVariable(variable) {
135
+ var query = window.location.search.substring(1);
136
+ var vars = query.split('&');
137
+
138
+ for (var i = 0; i < vars.length; i++) {
139
+ var pair = vars[i].split('=');
140
+
141
+ if (pair[0] === variable)
142
+ return decodeURIComponent(pair[1].replace(/\+/g, '%20'));
143
+ }
144
+ }
145
+
146
+ var searchTerm = getQueryVariable('query');
147
+ initLang();
148
+
149
+ if (searchTerm) {
150
+ document.getElementById('search-box').setAttribute("value", searchTerm);
151
+
152
+ var idx = lunr(function () {
153
+ this.field('id');
154
+ this.field('title', { boost: 10 });
155
+ this.field('author');
156
+ this.field('category');
157
+ this.field('content');
158
+ });
159
+
160
+ for (var key in store) {
161
+ idx.add({
162
+ 'id': key,
163
+ 'title': store[key].title,
164
+ 'author': store[key].author,
165
+ 'category': store[key].category,
166
+ 'content': store[key].content
167
+ });
168
+ }
169
+
170
+ var resultArray = idx.search(searchTerm);
171
+ loadPagination(resultArray.length);
172
+ }else initSearchResults();
173
+
174
+ });
@@ -0,0 +1 @@
1
+ !function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.svg4everybody=b()}):"object"==typeof module&&module.exports?module.exports=b():a.svg4everybody=b()}(this,function(){function a(a,b,c){if(c){var d=document.createDocumentFragment(),e=!b.hasAttribute("viewBox")&&c.getAttribute("viewBox");e&&b.setAttribute("viewBox",e);for(var f=c.cloneNode(!0);f.childNodes.length;)d.appendChild(f.firstChild);a.appendChild(d)}}function b(b){b.onreadystatechange=function(){if(4===b.readyState){var c=b._cachedDocument;c||(c=b._cachedDocument=document.implementation.createHTMLDocument(""),c.body.innerHTML=b.responseText,b._cachedTarget={}),b._embeds.splice(0).map(function(d){var e=b._cachedTarget[d.id];e||(e=b._cachedTarget[d.id]=c.getElementById(d.id)),a(d.parent,d.svg,e)})}},b.onreadystatechange()}function c(c){function e(){for(var c=0;c<p.length;){var j=p[c],k=j.parentNode,l=d(k);if(l){var m=j.getAttribute("xlink:href")||j.getAttribute("href");if(f){var q=document.createElement("img");q.style.cssText="display:inline-block;height:100%;width:100%",q.setAttribute("width",l.getAttribute("width")||l.clientWidth),q.setAttribute("height",l.getAttribute("height")||l.clientHeight),q.src=g(m,l,j),k.replaceChild(q,j)}else if(i&&(!h.validate||h.validate(m,l,j))){k.removeChild(j);var r=m.split("#"),s=r.shift(),t=r.join("#");if(s.length){var u=n[s];u||(u=n[s]=new XMLHttpRequest,u.open("GET",s),u.send(),u._embeds=[]),u._embeds.push({parent:k,svg:l,id:t}),b(u)}else a(k,document.getElementById(t))}}else++c}o(e,67)}var f,g,h=Object(c);g=h.fallback||function(a){return a.replace(/\?[^#]+/,"").replace("#",".").replace(/^\./,"")+".png"+(/\?[^#]+/.exec(a)||[""])[0]},f="nosvg"in h?h.nosvg:/\bMSIE [1-8]\b/.test(navigator.userAgent),f&&(document.createElement("svg"),document.createElement("use"));var i,j=/\bMSIE [1-8]\.0\b/,k=/\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/,l=/\bAppleWebKit\/(\d+)\b/,m=/\bEdge\/12\.(\d+)\b/;i="polyfill"in h?h.polyfill:j.test(navigator.userAgent)||k.test(navigator.userAgent)||(navigator.userAgent.match(m)||[])[1]<10547||(navigator.userAgent.match(l)||[])[1]<537;var n={},o=window.requestAnimationFrame||setTimeout,p=document.getElementsByTagName("use");i&&e()}function d(a){for(var b=a;"svg"!==b.nodeName.toLowerCase()&&(b=b.parentNode););return b}return c});
@@ -0,0 +1 @@
1
+ !function(a,b){"function"==typeof define&&define.amd?define([],function(){return a.svg4everybody=b()}):"object"==typeof module&&module.exports?module.exports=b():a.svg4everybody=b()}(this,function(){function a(a,b,c){if(c){var d=document.createDocumentFragment(),e=!b.hasAttribute("viewBox")&&c.getAttribute("viewBox");e&&b.setAttribute("viewBox",e);for(var f=c.cloneNode(!0);f.childNodes.length;)d.appendChild(f.firstChild);a.appendChild(d)}}function b(b){b.onreadystatechange=function(){if(4===b.readyState){var c=b._cachedDocument;c||(c=b._cachedDocument=document.implementation.createHTMLDocument(""),c.body.innerHTML=b.responseText,b._cachedTarget={}),b._embeds.splice(0).map(function(d){var e=b._cachedTarget[d.id];e||(e=b._cachedTarget[d.id]=c.getElementById(d.id)),a(d.parent,d.svg,e)})}},b.onreadystatechange()}function c(c){function e(){for(var c=0;c<m.length;){var h=m[c],i=h.parentNode,j=d(i);if(j){var n=h.getAttribute("xlink:href")||h.getAttribute("href");if(f&&(!g.validate||g.validate(n,j,h))){i.removeChild(h);var o=n.split("#"),p=o.shift(),q=o.join("#");if(p.length){var r=k[p];r||(r=k[p]=new XMLHttpRequest,r.open("GET",p),r.send(),r._embeds=[]),r._embeds.push({parent:i,svg:j,id:q}),b(r)}else a(i,document.getElementById(q))}}else++c}l(e,67)}var f,g=Object(c),h=/\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/,i=/\bAppleWebKit\/(\d+)\b/,j=/\bEdge\/12\.(\d+)\b/;f="polyfill"in g?g.polyfill:h.test(navigator.userAgent)||(navigator.userAgent.match(j)||[])[1]<10547||(navigator.userAgent.match(i)||[])[1]<537;var k={},l=window.requestAnimationFrame||setTimeout,m=document.getElementsByTagName("use");f&&e()}function d(a){for(var b=a;"svg"!==b.nodeName.toLowerCase()&&(b=b.parentNode););return b}return c});