Commit 22601464 authored by yPhil's avatar yPhil
Browse files

Nagging random dialogs OK, buttons focus OK

parent 4be2d297
......@@ -1255,8 +1255,8 @@
"version": "git+https://framagit.org/yphil/feedrat.git#deefb8fb927269948b587424e379b31f5b1c3b46",
"from": "git+https://framagit.org/yphil/feedrat.git",
"requires": {
"cheerio": "1.0.0-rc.5",
"request": "^2.88.2"
"cheerio": "^1.0.0-rc.5",
"node-fetch": "^2.6.1"
}
},
"file-uri-to-path": {
......@@ -1927,6 +1927,11 @@
"resolved": "https://registry.npmjs.org/netmask/-/netmask-1.0.6.tgz",
"integrity": "sha1-ICl+idhvb2QA8lDZ9Pa0wZRfzTU="
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
},
"normalize-package-data": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
......
......@@ -396,6 +396,12 @@ li.feed-item:not(.error) a {
background: var(--color-qua);
}
/* button.ui-state-focus { */
/* border: 3px solid var(--color-ui-sec) !important; */
/* } */
i.item-icon {
float: right;
margin: 0.2em;
......@@ -602,17 +608,6 @@ nav#sideMenu.expanded {
text-align: left;
}
#console.expanded {
height: 120px;
cursor: n-resize;
}
/* fieldset.retracted { */
/* height: 0; */
/* } */
#console > div > span.prompt {
margin-right: 3px;
font-weight: 900;
......
......@@ -7,81 +7,92 @@ PTL.dialog = {
},
nagUser:function() {
$('#dialogs').load('/static/templates/dialogs.html #nagDialog', function() {
var $dialog = $(this);
var $nag1 = $('<div>').attr('class', 'dialogContent')
.append($('<div>').attr('class', 'dialogImage')
.append($('<span>')
.attr('class', 'huge dialogImage')
.text('🍏')))
.append($('<div>').attr('class', 'dialogText')
.append($('<h1>').text(PTL.tr('Pétrolette needs you')))
.append($('<p>').text(PTL.tr('Pétrolette is free software. However the development requires a lot of time and a lot of work.')))
.append($('<p>').text(PTL.tr('In order to keep developing Pétrolette with new features I need your help.')))
.append($('<p>').text(PTL.tr('Please consider to support the Pétrolette project by sending a donation. Even the smallest amount will help a lot.'))));
var $nag2 = $('<div>').attr('class', 'dialogContent')
.append($('<div>').attr('class', 'dialogImage')
.append($('<span>')
.attr('class', 'huge dialogImage')
.text('🌴')))
.append($('<div>').attr('class', 'dialogText')
.append($('<h1>').text(PTL.tr('Pétrolette is cool')))
.append($('<p>').text(PTL.tr('Pétrolette is free software. However the development requires a lot of time and a lot of work.')))
.append($('<p>').text(PTL.tr('In order to keep developing Pétrolette with new features I need your help.')))
.append($('<p>').text(PTL.tr('Please consider to support the Pétrolette project by sending a donation. Even the smallest amount will help a lot.'))));
var $nag3 = $('<div>').attr('class', 'dialogContent')
.append($('<div>').attr('class', 'dialogImage')
.append($('<span>')
.attr('class', 'huge dialogImage')
.text('🌱')))
.append($('<div>').attr('class', 'dialogText')
.append($('<h1>').text(PTL.tr('Pétrolette is growing')))
.append($('<p>').text(PTL.tr('Pétrolette is free software. However the development requires a lot of time and a lot of work.')))
.append($('<p>').text(PTL.tr('In order to keep developing Pétrolette with new features I need your help.')))
.append($('<p>').text(PTL.tr('Please consider to support the Pétrolette project by sending a donation. Even the smallest amount will help a lot.'))));
var $nags = [$nag1, $nag2, $nag3];
var random = Math.floor(Math.random() * $nags.length);
$dialog.append($nags[random]);
$dialog.dialog({
title: PTL.tr('Support Pétrolette'),
buttons: [
{
text: PTL.tr('Cancel'),
title: PTL.tr('Cancel'),
class: 'ui-state-default translate',
click: function() {
PTL.dialog.kill($dialog);
}
},
{
text: PTL.tr('Donate'),
title: PTL.tr('Send your love to Pétrolette'),
class: 'ui-state-active translate',
click: function() {
window.location.href = 'https://liberapay.com/yPhil/donate';
var $dialogs = $('#dialogs'),
isOpen = $dialogs.length > 0;
if (isOpen) {
PTL.util.console(PTL.tr('A window is already open, so not nagging'), 'warning');
} else {
$dialogs.load('/static/templates/dialogs.html #nagDialog', function() {
var $dialog = $(this);
var $nag1 = $('<div>').attr('class', 'dialogContent')
.append($('<div>').attr('class', 'dialogImage')
.append($('<span>')
.attr('class', 'huge dialogImage')
.text('🍏')))
.append($('<div>').attr('class', 'dialogText')
.append($('<h1>').text(PTL.tr('Pétrolette needs you')))
.append($('<p>').text(PTL.tr('Pétrolette is free software. However the development requires a lot of time and a lot of work.')))
.append($('<p>').text(PTL.tr('In order to keep developing Pétrolette with new features I need your help.')))
.append($('<p>').text(PTL.tr('Please consider to support the Pétrolette project by sending a donation. Even the smallest amount will help a lot.'))));
var $nag2 = $('<div>').attr('class', 'dialogContent')
.append($('<div>').attr('class', 'dialogImage')
.append($('<span>')
.attr('class', 'huge dialogImage')
.text('🌴')))
.append($('<div>').attr('class', 'dialogText')
.append($('<h1>').text(PTL.tr('Pétrolette is cool')))
.append($('<p>').text(PTL.tr('Pétrolette is free software. However the development requires a lot of time and a lot of work.')))
.append($('<p>').text(PTL.tr('In order to keep developing Pétrolette with new features I need your help.')))
.append($('<p>').text(PTL.tr('Please consider to support the Pétrolette project by sending a donation. Even the smallest amount will help a lot.'))));
var $nag3 = $('<div>').attr('class', 'dialogContent')
.append($('<div>').attr('class', 'dialogImage')
.append($('<span>')
.attr('class', 'huge dialogImage')
.text('🌱')))
.append($('<div>').attr('class', 'dialogText')
.append($('<h1>').text(PTL.tr('Pétrolette is growing')))
.append($('<p>').text(PTL.tr('Pétrolette is free software. However the development requires a lot of time and a lot of work.')))
.append($('<p>').text(PTL.tr('In order to keep developing Pétrolette with new features I need your help.')))
.append($('<p>').text(PTL.tr('Please consider to support the Pétrolette project by sending a donation. Even the smallest amount will help a lot.'))));
var $nags = [$nag1, $nag2, $nag3];
var random = Math.floor(Math.random() * $nags.length);
$dialog.append($nags[random]);
$dialog.dialog({
title: PTL.tr('Support Pétrolette'),
buttons: [
{
text: PTL.tr('Cancel'),
title: PTL.tr('Cancel'),
class: 'ui-state-default translate',
click: function() {
PTL.dialog.kill($dialog);
}
},
{
text: PTL.tr('Donate'),
title: PTL.tr('Send your love to Pétrolette'),
class: 'translate ui-state-focus',
click: function() {
window.location.href = 'https://liberapay.com/yPhil/donate';
}
}
}
],
open: function () {
],
open: function () {
$('.ui-widget-overlay').on('click', function() {
PTL.dialog.kill($dialog);
});
$('.ui-widget-overlay').on('click', function() {
PTL.dialog.kill($dialog);
});
}
}
});
$dialog.dialog('open');
});
}
},
help:function() {
......@@ -295,7 +306,6 @@ PTL.dialog = {
searchPrefix: PTL.prefs.readConfig('searchPrefix'),
timeout: 2000
}).fail(function(req, status, xhr) {
console.log('fail!!');
guessError();
}).done(function(feed) {
$guessSpinner.removeClass('spin icon-cog');
......@@ -373,7 +383,7 @@ PTL.dialog = {
},
killColumn:function($button) {
$('#dialogs').load('/static/templates/dialogs.html #question-dialog', function() {
$('#dialogs').load('/static/templates/dialogs.html #questionDialog', function() {
var $dialog = $(this),
$column = $button.parent().parent(),
......@@ -383,7 +393,7 @@ PTL.dialog = {
colIndex = $panel.find('.column').index($column),
$feedsInCol = $column.find('.feed'),
nbOfFeedsInCol = $feedsInCol.length,
$icon = $dialog.find('div.icon > i');
$icon = $dialog.find('div.dialogImage > i');
$icon.addClass('icon-trash-empty danger');
......@@ -393,7 +403,7 @@ PTL.dialog = {
{
text: PTL.tr('Cancel'),
title: PTL.tr('Cancel'),
class: 'translate',
class: 'translate ui-state-focus',
click: function() {
PTL.dialog.kill($dialog);
}
......@@ -428,7 +438,7 @@ PTL.dialog = {
},
kbShortcuts:function() {
$('#dialogs').load('/static/templates/dialogs.html #question-dialog', function() {
$('#dialogs').load('/static/templates/dialogs.html #questionDialog', function() {
var $dialog = $(this),
$iconDiv = $dialog.find('div.icon');
......@@ -553,10 +563,10 @@ PTL.dialog = {
},
addFeed:function(feedUrl) {
$('#dialogs').load('/static/templates/dialogs.html #question-dialog', function() {
$('#dialogs').load('/static/templates/dialogs.html #questionDialog', function() {
var $dialog = $(this),
$icon = $dialog.find('div.icon > i'),
$icon = $dialog.find('div.dialogImage > i'),
isUrl = false,
h1, h2;
......@@ -612,7 +622,7 @@ PTL.dialog = {
},
killTab:function($button) {
$('#dialogs').load('/static/templates/dialogs.html #question-dialog', function() {
$('#dialogs').load('/static/templates/dialogs.html #questionDialog', function() {
var $dialog = $(this),
$tabs = $('#tabs'),
......@@ -622,7 +632,7 @@ PTL.dialog = {
$selectedPanel = $tabs.find(tabId),
selectedTabIndex = $tabs.tabs('option', 'active'),
previousTabIndex = selectedTabIndex === 0 ? 0 : selectedTabIndex -1,
$icon = $dialog.find('div.icon > i');
$icon = $dialog.find('div.dialogImage > i');
$icon.addClass('icon-trash-empty danger');
......@@ -632,7 +642,7 @@ PTL.dialog = {
{
text: PTL.tr('Cancel'),
title: PTL.tr('Cancel'),
class: 'translate',
class: 'translate ui-state-focus',
click: function() {
PTL.dialog.kill($dialog);
}
......@@ -678,13 +688,13 @@ PTL.dialog = {
},
killFeed:function($button) {
$('#dialogs').load('/static/templates/dialogs.html #question-dialog', function() {
$('#dialogs').load('/static/templates/dialogs.html #questionDialog', function() {
var $dialog = $(this),
$thisFeed = $button.parent().parent().parent().parent(),
thisFeedId = $button.parent().parent().parent().parent().attr('id'),
thisFeedName = $button.parent().parent().parent().find('.feed-title').text(),
$icon = $dialog.find('div.icon > i');
$icon = $dialog.find('div.dialogImage > i');
$icon.addClass('icon-trash-empty danger');
......@@ -702,7 +712,7 @@ PTL.dialog = {
{
text: PTL.tr('Delete'),
title: PTL.tr('Wait! Are you sure?'),
class: 'dangerous translate',
class: 'translate',
click: function() {
$thisFeed.hide('fade', 1000, function() {
$(this).remove();
......@@ -726,6 +736,7 @@ PTL.dialog = {
});
$dialog.data('feedId', thisFeedId).dialog('open');
});
},
......
......@@ -312,7 +312,7 @@ PTL.feed = {
var $description = $.parseHTML(item.description),
summary,
imageUrl,
// imageUrls = [],
imageUrls = [],
imgTypes = ['image',
'image/jpg',
'image/jpeg',
......@@ -422,7 +422,9 @@ PTL.feed = {
.attr('href', item.link)
.append(item['mastodon:scope'] ? $summary.trim() : item.title);
if (typeof imageUrls != 'undefined') {
if (imageUrls && imageUrls.length >= 1) {
console.log('imageUrls.length: %s (%s)',imageUrls.length);
$image = $('<div>')
.attr('class', 'ptl-img')
......@@ -440,11 +442,9 @@ PTL.feed = {
.appendTo($image));
}
} else if (imageUrl) {
} else if (imageUrl && typeof imageUrl !== 'undefined' && !imageUrl.includes('pixel')) {
if (!PTL.util.isUrl(imageUrl)) {
imageUrl = feedHost + '/' + imageUrl.substring(imageUrl.indexOf("/") + 1);
}
if (!PTL.util.isUrl(imageUrl)) imageUrl = feedHost + '/' + imageUrl.substring(imageUrl.indexOf("/") + 1);
$imageLink
.attr('href', imageUrl)
......@@ -456,11 +456,12 @@ PTL.feed = {
.attr('class', 'ptl-img')
.appendTo($imageLink);
if (PTL.prefs.readConfig('brokenImages') === 'hide') $image.attr('onerror', "this.style.display='none'");
}
if (!new RegExp('^(?:[a-z]+:)?//', 'i').test(imageUrl)) imageUrl = feedHost + imageUrl;
if ($image && feedType == 'photo') $image.addClass('full');
if (feedType !== 'text') $imageLink.appendTo($itemDiv);
if ($image && feedType == 'photo') $image.addClass('full');
if (feedType !== 'text') $imageLink.appendTo($itemDiv);
$itemLink.appendTo($itemDiv);
$itemDiv.appendTo($feedItem);
......
......@@ -37,10 +37,6 @@ var PTL = (function() {
$('.js-enabled-only').show();
$('#console').click(function() {
$(this).toggleClass('expanded');
});
$('body').on('click','.help-bookmarklet', function(event) {
event.preventDefault();
});
......
......@@ -11,12 +11,11 @@ PTL.prefs = (function() {
],
[
{"url":"https://www.reddit.com/r/worldnews.rss","type":"mixed","limit": 6,"status":"off"},
{"url":"http://rss.nytimes.com/services/xml/rss/nyt/World.xml","type":"mixed","limit": 6,"status":"off"},
{"url":"https://www.npr.org/rss/rss.php?id=1001","type":"mixed","limit": 4,"status":"on"}
],
[
{"url":"http://xkcd.com/rss.xml","type":"photo","limit": 2,"status":"on"},
{"url":"http://comicfeeds.chrisbenard.net/view/dilbert/default","type":"photo","limit": 2,"status":"on"}
{"url":"http://comicfeeds.chrisbenard.net/view/dilbert/default","type":"photo","limit": 1,"status":"on"},
{"url":"http://xkcd.com/rss.xml","type":"photo","limit": 2,"status":"on"}
]
]
},
......@@ -40,17 +39,26 @@ PTL.prefs = (function() {
"columns": [
[
{"url":"http://cabinporn.com/rss/","type":"photo","limit": 3,"status":"off"},
{"url":"http://www.nasa.gov/rss/dyn/lg_image_of_the_day.rss","type":"photo","limit": 3,"status":"on"}
{"url":"http://blog.theanimalrescuesite.greatergood.com/feed/","type":"photo","limit": 3,"status":"on"}
],
[
{"url":"http://www.nasa.gov/rss/dyn/lg_image_of_the_day.rss","type":"photo","limit": 3,"status":"on"},
{"url":"https://www.youtube.com/feeds/videos.xml?user=AnimalPlanetTV","type":"mixed","limit": 3,"status":"off"}
]
]
},
{"name":"social",
"columns": [
[
{"url":"https://framasphere.org/public/xaccrocheur.atom","type":"mixed","limit": 8,"status":"on"}
{"url":"https://framasphere.org/public/librazik.atom","type":"mixed","limit": 8,"status":"on"}
],
[
{"url":"https://framapiaf.org/@yphil.rss","type":"mixed","limit": 8,"status":"on"},
{"url":"https://mastodon.social/@unfa.rss","type":"mixed","limit": 8,"status":"on"},
{"url":"https://botsin.space/@tinyskylines.rss","type":"photo","limit": 3,"status":"on"}
]
]
......@@ -59,12 +67,12 @@ PTL.prefs = (function() {
"columns": [
[
{"url":"http://createdigitalmusic.com/feed/","type":"mixed","limit": 8,"status":"off"},
{"url":"https://tube.netzspielplatz.de/feeds/videos.xml?videoChannelId=8984","type":"mixed","limit": 8,"status":"on"},
{"url":"https://www.youtube.com/feeds/videos.xml?channel_id=UC3I2GFN_F8WudD_2jUZbojA","type":"mixed","limit": 8,"status":"on"}
{"url":"http://planet.linuxaudio.org/rss20.xml","type":"mixed","limit": 8,"status":"on"},
{"url":"https://www.youtube.com/feeds/videos.xml?channel_id=UCAYKj_peyESIMDp5LtHlH2A","type":"mixed","limit": 8,"status":"on"}
],
[
{"url":"https://www.rollingstone.com/music/rss","type":"photo","limit": 4,"status":"on"},
{"url":"http://planet.linuxaudio.org/rss20.xml","type":"mixed","limit": 12,"status":"on"}
{"url":"http://www.premierguitar.com/rss/1","type":"mixed","limit": 12,"status":"on"}
],
[
{"url":"https://feeds.feedburner.com/dangerousminds/dot/net","type":"photo","mixed": 4,"status":"on"}
......
......@@ -13,6 +13,7 @@ PTL.util = {
console.log('dateNow: %s (%s)', dateNow);
PTL.prefs.writeConfig('nextNag', dateNow);
PTL.dialog.nagUser();
return;
}
if (dateNow > nextNag) {
......
......@@ -57,7 +57,20 @@
<link rel="stylesheet" href="/bower/fancybox/dist/jquery.fancybox.min.css" />
<link rel="stylesheet" href="/bower/intro.js/minified/introjs.min.css" />
<link rel="stylesheet" href="/static/css/petrolette.css">
<!-- https://css-tricks.com/how-to-load-fonts-in-a-way-that-fights-fout-and-makes-lighthouse-happy/ -->
<link rel="preload"
as="style"
href="/static/css/petrolette.css" />
<link rel="stylesheet"
href="/static/css/petrolette.css"
media="print" onload="this.media='all'" />
<noscript>
<link rel="stylesheet"
href="/static/css/petrolette.css" />
</noscript>
<script src="/bower/jquery/dist/jquery.min.js"></script>
<script src="/bower/jquery-ui/jquery-ui.min.js"></script>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment