2016-10-03 21:19:13 +03:00
|
|
|
//- ----------------------------------
|
|
|
|
//- 💫 INCLUDES > FUNCTIONS
|
|
|
|
//- ----------------------------------
|
2016-03-31 17:24:48 +03:00
|
|
|
|
2016-10-03 21:19:13 +03:00
|
|
|
//- Add prefixes to items of an array (for modifier CSS classes)
|
2016-03-31 17:24:48 +03:00
|
|
|
|
|
|
|
- function prefixArgs(array, prefix) {
|
2016-10-19 01:16:11 +03:00
|
|
|
<<<<<<< HEAD
|
2016-10-03 21:19:13 +03:00
|
|
|
- return array.map(function(arg) {
|
|
|
|
- return prefix + '--' + arg;
|
|
|
|
- }).join(' ');
|
2016-10-19 01:16:11 +03:00
|
|
|
=======
|
2016-03-31 17:24:48 +03:00
|
|
|
- for(var i = 0; i < array.length; i++) {
|
|
|
|
- array[i] = prefix + array[i];
|
|
|
|
- }
|
|
|
|
- return array.join(' ');
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
//- Convert date to human readable and timestamp format
|
|
|
|
input - [string] date in the format YYYY-MM-DD
|
|
|
|
|
|
|
|
- function convertDate(input) {
|
|
|
|
- var dates = [];
|
|
|
|
- var months = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ];
|
|
|
|
- var date = new Date(input);
|
|
|
|
- dates.full = months[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear();
|
|
|
|
- dates.timestamp = JSON.parse(JSON.stringify(date));
|
|
|
|
- return dates;
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
//- Convert date to valid RSS pubDate
|
|
|
|
input - [string] date in the format YYYY-MM-DD
|
|
|
|
|
|
|
|
- function convertPubDate(input) {
|
|
|
|
- var date = new Date(input);
|
|
|
|
- var pieces = date.toString().split(' ');
|
|
|
|
- var offsetTime = pieces[5].match(/[-+]\d{4}/);
|
|
|
|
- var offset = (offsetTime) ? offsetTime : pieces[5];
|
|
|
|
- var parts = [ pieces[0] + ',', pieces[2], pieces[1], pieces[3], pieces[4], offset ];
|
|
|
|
- return parts.join(' ');
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
//- Compile scrset attribute for hero images
|
|
|
|
image - [object] article image object from _data.json
|
|
|
|
path - [string] relative path to image folder
|
|
|
|
|
|
|
|
- function getScrset(image, path) {
|
|
|
|
- var scrset = path + image.file + ' ' + image_sizes.medium + 'w';
|
|
|
|
- if(image.file_small) scrset += ', ' + path + image.file_small + ' ' + image_sizes.small + 'w';
|
|
|
|
- if(image.file_large) scrset += ', ' + path + image.file_large + ' ' + image_sizes.large + 'w';
|
|
|
|
- return scrset;
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
//- Get meta image
|
|
|
|
|
|
|
|
- function getMetaImage() {
|
|
|
|
- if(current.path[0] == 'blog' && image && image.file) {
|
2016-09-30 21:29:03 +03:00
|
|
|
- return url + '/blog/img/' + (image.file_small || image.file);
|
2016-03-31 17:24:48 +03:00
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- return url + '/assets/img/social.png';
|
|
|
|
- }
|
2016-10-19 01:16:11 +03:00
|
|
|
>>>>>>> v1.0.0-rc1
|
2016-03-31 17:24:48 +03:00
|
|
|
- }
|