Nasty hacks away from submodules: my unified vision has not been realised

This commit is contained in:
Andy Tudhope 2019-03-31 10:57:49 +02:00
parent 729edc7611
commit b3065d45d2
No known key found for this signature in database
GPG Key ID: 02A3DFA93BF26AD2
4 changed files with 30 additions and 32 deletions

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "themes/navy/layout/partial/shared-partials"]
path = themes/navy/layout/partial/shared-partials
url = https://github.com/status-im/status.im-partials
[submodule "themes/navy/source/js/shared-js"]
path = themes/navy/source/js/shared-js
url = git@github.com:status-im/status-im-js.git

View File

@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"hexo": {
"version": "3.8.0"
"version": "3.7.1"
},
"scripts": {
"clean": "rm -rf public/*",
@ -26,7 +26,8 @@
"hexo-renderer-stylus": "^0.3.1",
"hexo-server": "^0.2.0",
"lodash": "^4.5.1",
"lunr": "^2.1.2"
"lunr": "^2.1.2",
"moment": "^2.24.0"
},
"devDependencies": {
"babel-core": "^6.26.0",

@ -1 +1 @@
Subproject commit 1aac6836d674dbd9006775345a947cf7a8783752
Subproject commit ef5db8a4de18fe58b1e5e44c7b7f965b13850a91

View File

@ -1,3 +1,15 @@
/* global $ */
const moment = require('moment');
function formatDate(date) {
const day = moment().date(date.get('date')).format('DD');
const month = moment().month(date.get('month')).format('MMM');
const hour = moment().hour(date.get('hour')).format('HH');
const minute = moment().minute(date.get('minute')).format('mm');
return `${day} ${month} at ${hour}:${minute}`;
}
$(document).ready(function () {
// Fixes Parallax effect and div to popup overlapping with the main menu options
@ -28,41 +40,29 @@ $(document).ready(function () {
return str.split(/\s+/).slice(0,25).join(" ");
}
var months = {'01':'Jan', '02':'Feb', '03':'Mar', '04':'Apr', '05':'May', '06':'Jun', '07':'Jul', '08':'Aug', '09':'Sep', '10':'Oct', '11':'Nov', '12':'Dec'};
url = 'https://our.status.im/ghost/api/v0.1/posts/?order=published_at%20desc&limit=2&formats=plaintext&client_id=ghost-frontend&client_secret=2b055fcd57ba';
let url_news = 'https://our.status.im/ghost/api/v0.1/posts/?order=published_at%20desc&limit=2&formats=plaintext&client_id=ghost-frontend&client_secret=2b055fcd57ba';
$.ajax({
type: "get",
url: url,
success: function (response) {
type: 'get',
url: url_news,
success: function(response) {
response.posts = response.posts.reverse();
$.each(response.posts, function (index, val) {
var excerpt = '';
if(val.custom_excerpt != null) {
excerpt = val.custom_excerpt;
}else{
excerpt = getWords(val.plaintext);
}
var newDate = new Date(val.published_at);
var minutes = newDate.getMinutes();
minutes = minutes + "";
if(minutes.length == 1){
minutes = '0' + minutes;
}
$('.latest-posts').prepend(' \
<div class="post"> \
<time>'+ newDate.getDate() + ' ' + months[(newDate.getMonth()+1)] + ' at ' + newDate.getHours() + ':' + minutes + '</time> \
<h4><a href="https://our.status.im/'+ val.slug +'">'+ val.title +'</a></h3> \
</div> \
');
$.each(response.posts, function(index, val) {
const date = moment(val.published_at);
$('.latest-news').prepend(
`<div class="post">
<time>${formatDate(date)}</time>
<h4><a href="https://our.status.im/${val.slug}">${val.title}</a></h4>
</div>`
);
});
}
});
});
/* Popups */
var addClassToElement = require('./shared-js/js/utils').addClassToElement;
var removeClassFromElement = require('./shared-js/js/utils').removeClassFromElement;